version 0.3.16
[fms.git] / src / http / pages / homepage.cpp
index a64efd2..9264ca1 100644 (file)
@@ -19,7 +19,7 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m
        Option::Instance()->Get("FCPHost",fcphost);\r
        Option::Instance()->Get("FProxyPort",fproxyport);\r
 \r
-       if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="shutdown")\r
+       if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="shutdown" && ValidateFormPassword(queryvars))\r
        {\r
                m_log->trace("HomePage::GeneratePage requested shutdown");\r
                ((FMSApp *)&FMSApp::instance())->Terminate();\r
@@ -36,21 +36,34 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m
        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
+               int major=0;\r
+               int minor=0;\r
+               int release=0;\r
+               int currentmajor=0;\r
+               int currentminor=0;\r
+               int currentrelease=0;\r
                std::string freesite="";\r
-               st.ResultText(0,major);\r
-               st.ResultText(1,minor);\r
-               st.ResultText(2,release);\r
+               std::string majorstr="";\r
+               std::string minorstr="";\r
+               std::string releasestr="";\r
+\r
+               StringFunctions::Convert(VERSION_MAJOR,currentmajor);\r
+               StringFunctions::Convert(VERSION_MINOR,currentminor);\r
+               StringFunctions::Convert(VERSION_RELEASE,currentrelease);\r
+\r
+               st.ResultInt(0,major);\r
+               st.ResultInt(1,minor);\r
+               st.ResultInt(2,release);\r
                st.ResultText(3,freesite);\r
 \r
+               StringFunctions::Convert(major,majorstr);\r
+               StringFunctions::Convert(minor,minorstr);\r
+               StringFunctions::Convert(release,releasestr);\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
+                       content+="<b>You are running an old version of FMS.  Please update here: <a href=\"http://"+fcphost+":"+fproxyport+"/"+freesite+"\">FMS "+majorstr+"."+minorstr+"."+releasestr+"</a></b><br>";\r
+                       content+="You can see the release info <a href=\"versioninfo.htm?Major="+majorstr+"&Minor="+minorstr+"&Release="+releasestr+"\">here</a><br>";\r
                        showgenericupdate=false;\r
                }\r
 \r
@@ -58,7 +71,7 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m
 \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/63/\">FMS Freesite</a><br>";\r
+               content+="Check for new versions at the <a href=\"http://"+fcphost+":"+fproxyport+"/USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/76/\">FMS Freesite</a><br>";\r
        }\r
 \r
        content+="Use these pages to administer your FMS installation.";\r
@@ -81,6 +94,7 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m
 \r
        content+="<p class=\"paragraph\">";\r
        content+="<form name=\"frmshutdown\" method=\"POST\">";\r
+       content+=CreateFormPassword();\r
        content+="<input type=\"hidden\" name=\"formaction\" value=\"shutdown\">";\r
        content+="<input type=\"submit\" value=\"Shutdown FMS\">";\r
        content+="</form>";\r