version 0.3.2
[fms.git] / src / http / pages / homepage.cpp
index 37d8dc6..b295f45 100644 (file)
@@ -30,11 +30,41 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m
        content+="<b>FMS version ";\r
        content+=FMS_VERSION;\r
        content+="</b><br>";\r
-       content+="Check for new versions at the <a href=\"http://"+fcphost+":"+fproxyport+"/USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/58/\">FMS Freesite</a><br>";\r
+\r
+       bool showgenericupdate=true;\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT Major, Minor, Release, PageKey FROM tblFMSVersion ORDER BY Major DESC, Minor DESC, Release DESC;");\r
+       st.Step();\r
+       if(st.RowReturned())\r
+       {\r
+               std::string currentmajor=VERSION_MAJOR;\r
+               std::string currentminor=VERSION_MINOR;\r
+               std::string currentrelease=VERSION_RELEASE;\r
+               std::string major="";\r
+               std::string minor="";\r
+               std::string release="";\r
+               std::string freesite="";\r
+               st.ResultText(0,major);\r
+               st.ResultText(1,minor);\r
+               st.ResultText(2,release);\r
+               st.ResultText(3,freesite);\r
+\r
+               if(currentmajor<major || (currentmajor==major && currentminor<minor) || (currentmajor==major && currentminor==minor && currentrelease<release))\r
+               {\r
+                       content+="<b>You are running an old version of FMS.  Please update here: <a href=\"http://"+fcphost+":"+fproxyport+"/"+freesite+"\">FMS "+major+"."+minor+"."+release+"</a></b><br>";\r
+                       showgenericupdate=false;\r
+               }\r
+\r
+       }\r
+\r
+       if(showgenericupdate)\r
+       {\r
+               content+="Check for new versions at the <a href=\"http://"+fcphost+":"+fproxyport+"/USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/60/\">FMS Freesite</a><br>";\r
+       }\r
+\r
        content+="Use these pages to administer your FMS installation.";\r
        content+="</p>";\r
 \r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT COUNT(*) FROM tblMessageInserts WHERE Inserted='false';");\r
+       st=m_db->Prepare("SELECT COUNT(*) FROM tblMessageInserts WHERE Inserted='false';");\r
        st.Step();\r
        if(st.RowReturned())\r
        {\r