X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fhomepage.cpp;h=1a65cf46a0d59b716def95bacc3046e7639fc046;hb=14fff12d9df0ee30e2df4bf9d22c2e83065816df;hp=28bfa0fb9071d184cb320af1e77cfb4092b06259;hpb=d8ccfe2b3944adf07d35534459cdda19d15217c8;p=fms.git diff --git a/src/http/pages/homepage.cpp b/src/http/pages/homepage.cpp index 28bfa0f..1a65cf4 100644 --- a/src/http/pages/homepage.cpp +++ b/src/http/pages/homepage.cpp @@ -1,4 +1,6 @@ #include "../../../include/http/pages/homepage.h" +#include "../../../include/stringfunctions.h" +#include "../../../include/global.h" #ifdef XMEM #include @@ -6,7 +8,46 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::map &queryvars) { - return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\nHome"; + + 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); } const bool HomePage::WillHandleURI(const std::string &uri)