X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fhomepage.cpp;h=15cf76e37a24f4d46cdd09f0bc7ead4c5ac66ecd;hb=59a5414ec47a2932a7802fcd1d98c4d80166564f;hp=a64efd2fb8cafab4f0563bccbaf39d82909e96c4;hpb=023b2219068d481cd6a300982427c99bacd88a12;p=fms.git diff --git a/src/http/pages/homepage.cpp b/src/http/pages/homepage.cpp index a64efd2..15cf76e 100644 --- a/src/http/pages/homepage.cpp +++ b/src/http/pages/homepage.cpp @@ -11,15 +11,17 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::map &queryvars) { + Option option(m_db); + std::string messagecountstr=""; std::string filecountstr=""; std::string fcphost="127.0.0.1"; std::string fproxyport="8888"; - Option::Instance()->Get("FCPHost",fcphost); - Option::Instance()->Get("FProxyPort",fproxyport); + option.Get("FCPHost",fcphost); + option.Get("FProxyPort",fproxyport); - if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="shutdown") + if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="shutdown" && ValidateFormPassword(queryvars)) { m_log->trace("HomePage::GeneratePage requested shutdown"); ((FMSApp *)&FMSApp::instance())->Terminate(); @@ -36,29 +38,46 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m st.Step(); if(st.RowReturned()) { - std::string currentmajor=VERSION_MAJOR; - std::string currentminor=VERSION_MINOR; - std::string currentrelease=VERSION_RELEASE; - std::string major=""; - std::string minor=""; - std::string release=""; + int major=0; + int minor=0; + int release=0; + int currentmajor=0; + int currentminor=0; + int currentrelease=0; std::string freesite=""; - st.ResultText(0,major); - st.ResultText(1,minor); - st.ResultText(2,release); + std::string majorstr=""; + std::string minorstr=""; + std::string releasestr=""; + + StringFunctions::Convert(VERSION_MAJOR,currentmajor); + StringFunctions::Convert(VERSION_MINOR,currentminor); + StringFunctions::Convert(VERSION_RELEASE,currentrelease); + + st.ResultInt(0,major); + st.ResultInt(1,minor); + st.ResultInt(2,release); st.ResultText(3,freesite); + StringFunctions::Convert(major,majorstr); + StringFunctions::Convert(minor,minorstr); + StringFunctions::Convert(release,releasestr); + if(currentmajorFMS "+major+"."+minor+"."+release+"
"; + content+="You are running an old version of FMS. Please update here: FMS "+majorstr+"."+minorstr+"."+releasestr+"
"; + content+="You can see the release info here
"; showgenericupdate=false; } + else + { + content+="Release info
"; + } } if(showgenericupdate) { - content+="Check for new versions at the FMS Freesite
"; + content+="Check for new versions at the FMS Freesite
"; } content+="Use these pages to administer your FMS installation."; @@ -70,7 +89,12 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m { st.ResultText(0,messagecountstr); } - content+="Messages waiting to be inserted:"+messagecountstr+"
"; + content+="Messages waiting to be inserted:"+messagecountstr; + if (messagecountstr!="0") //show link to message page + { + content+=" (show messages)"; + } + content+="
"; st=m_db->Prepare("SELECT COUNT(*) FROM tblFileInserts WHERE Key IS NULL;"); st.Step(); if(st.RowReturned()) @@ -78,9 +102,9 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m st.ResultText(0,filecountstr); } content+="Files waiting to be inserted:"+filecountstr+"
"; - content+="

"; content+="

"; + content+=CreateFormPassword(); content+=""; content+=""; content+="
";