X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fhomepage.cpp;h=ec4ea3298faf550cd9f0fd06eca2d82a57365803;hb=221236a4d3aac4144529d418ce368db5c98facb0;hp=b295f451653fff51139f91f89f21293f0d71de46;hpb=76805933f794915a72b7f0a21b12af6654759f4f;p=fms.git
diff --git a/src/http/pages/homepage.cpp b/src/http/pages/homepage.cpp
index b295f45..ec4ea32 100644
--- a/src/http/pages/homepage.cpp
+++ b/src/http/pages/homepage.cpp
@@ -19,7 +19,7 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m
Option::Instance()->Get("FCPHost",fcphost);
Option::Instance()->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();
@@ -32,33 +32,50 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m
content+="
";
bool showgenericupdate=true;
- SQLite3DB::Statement st=m_db->Prepare("SELECT Major, Minor, Release, PageKey FROM tblFMSVersion ORDER BY Major DESC, Minor DESC, Release DESC;");
+ SQLite3DB::Statement st=m_db->Prepare("SELECT Major, Minor, Release, PageKey FROM tblFMSVersion ORDER BY Major DESC, Minor DESC, Release DESC LIMIT 1;");
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(currentmajorYou are running an old version of FMS. Please update here: FMS "+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.";
@@ -81,6 +98,7 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m
content+="";
content+="
";