X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fhomepage.cpp;h=1a65cf46a0d59b716def95bacc3046e7639fc046;hb=14fff12d9df0ee30e2df4bf9d22c2e83065816df;hp=cbc57e44b50eef5e09f0049ea324836226f4678d;hpb=f208e33c29132aacaec448e74341edea1b925a2a;p=fms.git diff --git a/src/http/pages/homepage.cpp b/src/http/pages/homepage.cpp index cbc57e4..1a65cf4 100644 --- a/src/http/pages/homepage.cpp +++ b/src/http/pages/homepage.cpp @@ -1,5 +1,6 @@ #include "../../../include/http/pages/homepage.h" #include "../../../include/stringfunctions.h" +#include "../../../include/global.h" #ifdef XMEM #include @@ -7,10 +8,45 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::map &queryvars) { + + std::string messagecountstr=""; + std::string filecountstr=""; + + if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="shutdown") + { + wantshutdown=true; + } + std::string content="

Home

"; content+="

"; + content+="FMS version "; + content+=FMS_VERSION; + content+="
"; content+="Use these pages to administer your FMS installation."; content+="

"; + + SQLite3DB::Statement st=m_db->Prepare("SELECT COUNT(*) FROM tblMessageInserts WHERE Inserted='false';"); + st.Step(); + if(st.RowReturned()) + { + st.ResultText(0,messagecountstr); + } + content+="Messages waiting to be inserted:"+messagecountstr+"
"; + st=m_db->Prepare("SELECT COUNT(*) FROM tblFileInserts WHERE Key IS NULL;"); + st.Step(); + if(st.RowReturned()) + { + st.ResultText(0,filecountstr); + } + content+="Files waiting to be inserted:"+filecountstr+"
"; + + content+="

"; + content+="

"; + content+=""; + content+=""; + content+="
"; + content+="

"; + return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content); }