#include "../../../include/http/pages/homepage.h"\r
#include "../../../include/stringfunctions.h"\r
+#include "../../../include/global.h"\r
\r
#ifdef XMEM\r
#include <xmem.h>\r
\r
const std::string HomePage::GeneratePage(const std::string &method, const std::map<std::string,std::string> &queryvars)\r
{\r
+\r
+ std::string messagecountstr="";\r
+ std::string filecountstr="";\r
+\r
+ if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="shutdown")\r
+ {\r
+ wantshutdown=true;\r
+ }\r
+\r
std::string content="<h2>Home</h2>";\r
content+="<p class=\"paragraph\">";\r
+ content+="<b>FMS version ";\r
+ content+=FMS_VERSION;\r
+ content+="</b><br>";\r
content+="Use these pages to administer your FMS installation.";\r
content+="</p>";\r
+\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT COUNT(*) FROM tblMessageInserts WHERE Inserted='false';");\r
+ st.Step();\r
+ if(st.RowReturned())\r
+ {\r
+ st.ResultText(0,messagecountstr);\r
+ }\r
+ content+="Messages waiting to be inserted:"+messagecountstr+"<br>";\r
+ st=m_db->Prepare("SELECT COUNT(*) FROM tblFileInserts WHERE Key IS NULL;");\r
+ st.Step();\r
+ if(st.RowReturned())\r
+ {\r
+ st.ResultText(0,filecountstr);\r
+ }\r
+ content+="Files waiting to be inserted:"+filecountstr+"<br>";\r
+\r
+ content+="<p class=\"paragraph\">";\r
+ content+="<form name=\"frmshutdown\" method=\"POST\">";\r
+ content+="<input type=\"hidden\" name=\"formaction\" value=\"shutdown\">";\r
+ content+="<input type=\"submit\" value=\"Shutdown FMS\">";\r
+ content+="</form>";\r
+ content+="</p>";\r
+\r
return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content);\r
}\r
\r