1 #include "../../../include/http/pages/homepage.h"
\r
2 #include "../../../include/stringfunctions.h"
\r
3 #include "../../../include/global.h"
\r
4 #include "../../../include/fmsapp.h"
\r
5 #include "../../../include/option.h"
\r
11 const std::string HomePage::GeneratePage(const std::string &method, const std::map<std::string,std::string> &queryvars)
\r
14 std::string messagecountstr="";
\r
15 std::string filecountstr="";
\r
16 std::string fcphost="127.0.0.1";
\r
17 std::string fproxyport="8888";
\r
19 Option::Instance()->Get("FCPHost",fcphost);
\r
20 Option::Instance()->Get("FProxyPort",fproxyport);
\r
22 if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="shutdown")
\r
24 m_log->trace("HomePage::GeneratePage requested shutdown");
\r
25 ((FMSApp *)&FMSApp::instance())->Terminate();
\r
28 std::string content="<h2>Home</h2>";
\r
29 content+="<p class=\"paragraph\">";
\r
30 content+="<b>FMS version ";
\r
31 content+=FMS_VERSION;
\r
32 content+="</b><br>";
\r
34 bool showgenericupdate=true;
\r
35 SQLite3DB::Statement st=m_db->Prepare("SELECT Major, Minor, Release, PageKey FROM tblFMSVersion ORDER BY Major DESC, Minor DESC, Release DESC LIMIT 1;");
\r
37 if(st.RowReturned())
\r
39 std::string currentmajor=VERSION_MAJOR;
\r
40 std::string currentminor=VERSION_MINOR;
\r
41 std::string currentrelease=VERSION_RELEASE;
\r
42 std::string major="";
\r
43 std::string minor="";
\r
44 std::string release="";
\r
45 std::string freesite="";
\r
46 st.ResultText(0,major);
\r
47 st.ResultText(1,minor);
\r
48 st.ResultText(2,release);
\r
49 st.ResultText(3,freesite);
\r
51 if(currentmajor<major || (currentmajor==major && currentminor<minor) || (currentmajor==major && currentminor==minor && currentrelease<release))
\r
53 content+="<b>You are running an old version of FMS. Please update here: <a href=\"http://"+fcphost+":"+fproxyport+"/"+freesite+"\">FMS "+major+"."+minor+"."+release+"</a></b><br>";
\r
54 showgenericupdate=false;
\r
59 if(showgenericupdate)
\r
61 content+="Check for new versions at the <a href=\"http://"+fcphost+":"+fproxyport+"/USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/63/\">FMS Freesite</a><br>";
\r
64 content+="Use these pages to administer your FMS installation.";
\r
67 st=m_db->Prepare("SELECT COUNT(*) FROM tblMessageInserts WHERE Inserted='false';");
\r
69 if(st.RowReturned())
\r
71 st.ResultText(0,messagecountstr);
\r
73 content+="Messages waiting to be inserted:"+messagecountstr+"<br>";
\r
74 st=m_db->Prepare("SELECT COUNT(*) FROM tblFileInserts WHERE Key IS NULL;");
\r
76 if(st.RowReturned())
\r
78 st.ResultText(0,filecountstr);
\r
80 content+="Files waiting to be inserted:"+filecountstr+"<br>";
\r
82 content+="<p class=\"paragraph\">";
\r
83 content+="<form name=\"frmshutdown\" method=\"POST\">";
\r
84 content+="<input type=\"hidden\" name=\"formaction\" value=\"shutdown\">";
\r
85 content+="<input type=\"submit\" value=\"Shutdown FMS\">";
\r
89 return StringFunctions::Replace(m_template,"[CONTENT]",content);
\r
92 const bool HomePage::WillHandleURI(const std::string &uri)
\r