const std::string CreateIdentityPage::GenerateContent(const std::string &method, const std::map<std::string,QueryVar> &queryvars) { std::string content=""; if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="create" && ValidateFormPassword(queryvars)) { SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublishTrustList,DateCreated) VALUES(?,'false',?);"); std::string name=""; Poco::DateTime date; if(queryvars.find("name")!=queryvars.end()) { name=(*queryvars.find("name")).second.GetData(); name=StringFunctions::RemoveControlChars(name); } st.Bind(0,name); st.Bind(1,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); // insert all identities not in trust list already m_db->Execute("INSERT OR IGNORE INTO tblIdentityTrust(LocalIdentityID,IdentityID) SELECT LocalIdentityID,IdentityID FROM tblLocalIdentity,tblIdentity;"); content+="<h2>"+m_trans->Get("web.page.createidentity.createdidentity")+"</h2>"; content+=m_trans->Get("web.page.createidentity.aftercreateinstructions"); } else { content+="<h2>"+m_trans->Get("web.page.createidentity.title")+"</h2>"; content+="<form name=\"frmcreateidentity\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"create\">"; content+="Name : <input type=\"text\" name=\"name\" maxlength=\""MAX_IDENTITY_NAME_LENGTH_STR"\">"; content+=" <input type=\"submit\" value=\""+m_trans->Get("web.page.createidentity.create")+"\">"; content+="</form>"; } return content; }
const std::string AddPeerPage::GenerateContent(const std::string &method, const std::map<std::string,QueryVar> &queryvars) { std::string content=""; if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="add" && ValidateFormPassword(queryvars)) { Poco::DateTime date; std::string publickey=""; if(queryvars.find("publickey")!=queryvars.end()) { publickey=(*queryvars.find("publickey")).second.GetData(); } if(publickey!="" && publickey.find("SSK@")==0 && publickey[publickey.size()-1]=='/') { SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod,IsFMS) VALUES(?,?,?,1);"); st.Bind(0,publickey); st.Bind(1,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Bind(2,"manually"); st.Step(); st.Reset(); } } content+="<h2>"+m_trans->Get("web.page.addpeer.title")+"</h2>"; content+="<form name=\"frmaddpeer\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"add\">"; content+=m_trans->Get("web.page.addpeer.publickey")+" "; content+="<input type=\"text\" name=\"publickey\" size=\"100\">"; content+="<br>"; content+=m_trans->Get("web.page.addpeer.validpubkey"); content+="<br>"; content+="<input type=\"submit\" value=\""+m_trans->Get("web.page.addpeer.add")+"\">"; content+="</form>"; return content; }
const std::string PeerMaintenancePage::GenerateContent(const std::string &method, const std::map<std::string,QueryVar> &queryvars) { std::string content(""); std::string sql(""); SQLite3DB::Statement st; std::string tempval; Poco::DateTime date; bool m_localtrustoverrides=false; Option opt(m_db); opt.GetBool("LocalTrustOverridesPeerTrust",m_localtrustoverrides); if(queryvars.find("formaction")!=queryvars.end() && ValidateFormPassword(queryvars)) { if((*queryvars.find("formaction")).second=="removenotseen") { m_db->Execute("DELETE FROM tblIdentity WHERE LastSeen IS NULL AND WOTLastSeen IS NULL;"); } else if((*queryvars.find("formaction")).second=="removelastseen20") { date=Poco::Timestamp(); date-=Poco::Timespan(20,0,0,0,0); st=m_db->Prepare("DELETE FROM tblIdentity WHERE IFNULL(LastSeen<?,1) AND IFNULL(WOTLastSeen<?,1);"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Bind(1,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); } else if((*queryvars.find("formaction")).second=="removeneversent") { m_db->Execute("DELETE FROM tblIdentity WHERE IdentityID NOT IN (SELECT IdentityID FROM tblMessage WHERE IdentityID IS NOT NULL GROUP BY IdentityID);"); } else if((*queryvars.find("formaction")).second=="removelastseenneversent20") { date=Poco::Timestamp(); date-=Poco::Timespan(20,0,0,0,0); st=m_db->Prepare("DELETE FROM tblIdentity WHERE IdentityID NOT IN (SELECT IdentityID FROM tblMessage WHERE IdentityID IS NOT NULL GROUP BY IdentityID) AND IFNULL(LastSeen<?,1) AND IFNULL(WOTLastSeen<?,1);"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Bind(1,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); } else if((*queryvars.find("formaction")).second=="removedaysago" && queryvars.find("daysago")!=queryvars.end() && (*queryvars.find("daysago")).second!="") { int tempint=10000; StringFunctions::Convert((*queryvars.find("daysago")).second.GetData(),tempint); date=Poco::Timestamp(); date-=Poco::Timespan(tempint,0,0,0,0); st=m_db->Prepare("DELETE FROM tblIdentity WHERE IFNULL(LastSeen<?,1) AND IFNULL(WOTLastSeen<?,1);"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Bind(1,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); } else if((*queryvars.find("formaction")).second=="removenulldaysago" && queryvars.find("daysago")!=queryvars.end() && (*queryvars.find("daysago")).second!="") { int tempint=10000; StringFunctions::Convert((*queryvars.find("daysago")).second.GetData(),tempint); date=Poco::Timestamp(); date-=Poco::Timespan(tempint,0,0,0,0); st=m_db->Prepare("DELETE FROM tblIdentity WHERE IFNULL(LastSeen<?,1) AND IFNULL(WOTLastSeen<?,1) AND LocalMessageTrust IS NULL AND LocalTrustListTrust IS NULL;"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Bind(1,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); } else if((*queryvars.find("formaction")).second=="removeposted30daysago") { date=Poco::Timestamp(); date-=Poco::Timespan(30,0,0,0,0); st=m_db->Prepare("DELETE FROM tblIdentity WHERE IdentityID IN (SELECT tblIdentity.IdentityID FROM tblIdentity INNER JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE (SELECT MAX(MessageDate) FROM tblMessage WHERE tblMessage.IdentityID=tblIdentity.IdentityID)<=? GROUP BY tblIdentity.IdentityID);"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d")); st.Step(); } else if((*queryvars.find("formaction")).second=="removeadded20daysneversent") { date=Poco::Timestamp(); date-=Poco::Timespan(20,0,0,0,0); st=m_db->Prepare("DELETE FROM tblIdentity WHERE IdentityID IN (SELECT tblIdentity.IdentityID FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE tblMessage.IdentityID IS NULL AND tblIdentity.DateAdded<?);"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); } } content+="<h2>"+m_trans->Get("web.page.peermaintenance.title")+"</h2>"; content+="<p class=\"paragraph\">"+m_trans->Get("web.page.peermaintenance.instructions")+"</p>"; content+="<p>"; content+="<a href=\"recentlyadded.htm\">"+m_trans->Get("web.page.peermaintenance.recentlyadded")+"</a>"; content+="</p>"; content+="<table>"; content+="<tr><th colspan=\"3\">"+m_trans->Get("web.page.peermaintenance.stats")+"</th></tr>"; content+="<tr>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity;"); st.Step(); st.ResultText(0,tempval); content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.knownpeers")+"</td>"; content+="</tr>"; content+="<tr>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity WHERE IsFMS=1;"); st.Step(); st.ResultText(0,tempval); content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.fmspeers")+"</td>"; content+="</tr>"; content+="<tr>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity WHERE IsWOT=1;"); st.Step(); st.ResultText(0,tempval); content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.wotpeers")+"</td>"; content+="</tr>"; content+="<tr>"; sql="SELECT COUNT(*) FROM tblIdentity WHERE "; if(m_localtrustoverrides==true) { sql+="(tblIdentity.LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust') OR (tblIdentity.LocalMessageTrust IS NULL AND (tblIdentity.PeerMessageTrust IS NULL OR tblIdentity.PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust'))))"; } else { sql+="(tblIdentity.LocalMessageTrust IS NULL OR tblIdentity.LocalMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinLocalMessageTrust'))"; sql+="AND (tblIdentity.PeerMessageTrust IS NULL OR tblIdentity.PeerMessageTrust>=(SELECT OptionValue FROM tblOption WHERE Option='MinPeerMessageTrust'))"; } st=m_db->Prepare(sql); st.Step(); st.ResultText(0,tempval); content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.trustedcount")+"</td>"; content+="</tr>"; content+="<tr>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity WHERE LastSeen IS NULL AND WOTLastSeen IS NULL;"); st.Step(); st.ResultText(0,tempval); content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.neverseen")+"</td>"; content+="<td>"; content+="<form name=\"frmremove\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"removenotseen\">"; content+="<input type=\"submit\" value=\""+m_trans->Get("web.page.peermaintenance.remove")+"\">"; content+="</form>"; content+="</td>"; content+="</tr>"; date=Poco::Timestamp(); date-=Poco::Timespan(20,0,0,0,0); st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity WHERE IFNULL(LastSeen<?,1) AND IFNULL(WOTLastSeen<?,1);"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); st.ResultText(0,tempval); content+="<tr>"; content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.lastseen20days")+"</td>"; content+="<td>"; content+="<form name=\"frmremove\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"removelastseen20\">"; content+="<input type=\"submit\" value=\""+m_trans->Get("web.page.peermaintenance.remove")+"\">"; content+="</form>"; content+="</td>"; content+="</tr>"; date=Poco::Timestamp(); date-=Poco::Timespan(30,0,0,0,0); st=m_db->Prepare("SELECT COUNT(*) FROM (SELECT tblIdentity.IdentityID FROM tblIdentity INNER JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE (SELECT MAX(MessageDate) FROM tblMessage WHERE tblMessage.IdentityID=tblIdentity.IdentityID)<=? GROUP BY tblIdentity.IdentityID);"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d")); st.Step(); st.ResultText(0,tempval); content+="<tr>"; content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.lastsent30days")+"</td>"; content+="<td>"; content+="<form name=\"frmremove\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"removeposted30daysago\">"; content+="<input type=\"submit\" value=\""+m_trans->Get("web.page.peermaintenance.remove")+"\">"; content+="</form>"; content+="</td>"; content+="</tr>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE tblMessage.IdentityID IS NULL;"); st.Step(); st.ResultText(0,tempval); content+="<tr>"; content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.neversent")+"</td>"; content+="<td>"; content+="<form name=\"frmremove\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"removeneversent\">"; content+="<input type=\"submit\" value=\""+m_trans->Get("web.page.peermaintenance.remove")+"\">"; content+="</form>"; content+="</td>"; content+="</tr>"; date=Poco::Timestamp(); date-=Poco::Timespan(20,0,0,0,0); st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE tblMessage.IdentityID IS NULL AND tblIdentity.DateAdded<?;"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); st.ResultText(0,tempval); content+="<tr>"; content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.added20daysneversent")+"</td>"; content+="<td>"; content+="<form name=\"frmremove\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"removeadded20daysneversent\">"; content+="<input type=\"submit\" value=\""+m_trans->Get("web.page.peermaintenance.remove")+"\">"; content+="</form>"; content+="</td>"; content+="</tr>"; date=Poco::Timestamp(); date-=Poco::Timespan(20,0,0,0,0); st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE tblMessage.IdentityID IS NULL AND IFNULL(tblIdentity.LastSeen<?,1) AND IFNULL(tblIdentity.WOTLastSeen<?,1);"); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Bind(1,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); st.ResultText(0,tempval); content+="<tr>"; content+="<td>"+tempval+"</td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.lastseen20daysneversent")+"</td>"; content+="<td>"; content+="<form name=\"frmremove\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"removelastseenneversent20\">"; content+="<input type=\"submit\" value=\""+m_trans->Get("web.page.peermaintenance.remove")+"\">"; content+="</form>"; content+="</td>"; content+="</tr>"; content+="<tr>"; content+="<td><form name=\"frmdelete\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"removedaysago\"></td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.lastseen")+" <input type=\"text\" name=\"daysago\" size=\"2\"> "+m_trans->Get("web.page.peermaintenance.daysago")+"</td>"; content+="<td><input type=\"submit\" value=\""+m_trans->Get("web.page.peermaintenance.remove")+"\"></form></td>"; content+="</tr>"; content+="<tr>"; content+="<td><form name=\"frmdelete\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"removenulldaysago\"></td>"; content+="<td>"+m_trans->Get("web.page.peermaintenance.lastseen")+" <input type=\"text\" name=\"daysago\" size=\"2\"> "+m_trans->Get("web.page.peermaintenance.daysagonulltrust")+"</td>"; content+="<td><input type=\"submit\" value=\""+m_trans->Get("web.page.peermaintenance.remove")+"\"></form></td>"; content+="</tr>"; content+="</table>"; return content; }
const std::string RecentlyAddedPage::GenerateContent(const std::string &method, const std::map<std::string,QueryVar> &queryvars) { std::string content=""; Poco::DateTime date; int count=0; std::string countstr="0"; if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="delete" && ValidateFormPassword(queryvars)) { std::vector<std::string> identityids; CreateArgArray(queryvars,"chkdel",identityids); SQLite3DB::Statement del=m_db->Prepare("DELETE FROM tblIdentity WHERE IdentityID=?;"); for(std::vector<std::string>::iterator i=identityids.begin(); i!=identityids.end(); i++) { if((*i)!="") { del.Bind(0,(*i)); del.Step(); del.Reset(); } } } content="<h2>"+m_trans->Get("web.page.recentlyadded.title")+"</h2>"; SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID, PublicKey, Name, DateAdded, AddedMethod FROM tblIdentity WHERE DateAdded>=? ORDER BY DateAdded DESC;"); date-=Poco::Timespan(5,0,0,0,0); st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Step(); content+="<form name=\"frmdel\" method=\"post\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"delete\">"; content+="<table class=\"small90\">"; content+="<tr><th>"+m_trans->Get("web.page.recentlyadded.name")+"</th><th>"+m_trans->Get("web.page.recentlyadded.dateadded")+"</th><th>"+m_trans->Get("web.page.recentlyadded.addedmethod")+"</th></tr>"; while(st.RowReturned()) { std::string identityidstr=""; std::string publickey=""; std::string name=""; std::string dateadded=""; std::string addedmethod=""; st.ResultText(0,identityidstr); st.ResultText(1,publickey); st.ResultText(2,name); st.ResultText(3,dateadded); st.ResultText(4,addedmethod); StringFunctions::Convert(count,countstr); content+="<tr>"; content+="<td title=\""+publickey+"\">"; content+="<a href=\"peerdetails.htm?identityid="+identityidstr+"\">"; content+=SanitizeOutput(CreateShortIdentityName(name,publickey)); content+="</a>"; content+="</td>"; content+="<td>"+dateadded+"</td>"; content+="<td>"+SanitizeOutput(addedmethod)+"</td>"; content+="<td><input type=\"checkbox\" name=\"chkdel["+countstr+"]\" value=\""+identityidstr+"\"></td>"; content+="</tr>"; count++; st.Step(); } content+="<tr><td colspan=\"4\"><center><input type=\"submit\" value=\""+m_trans->Get("web.page.recentlyadded.deleteselected")+"\"></center></td></tr>"; content+="</table>"; return content; }
const std::string ShowPendingMessagePage::GenerateContent(const std::string &method, const std::map<std::string,QueryVar> &queryvars) { if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="delete" && ValidateFormPassword(queryvars)) { m_log->information("User requested to delete message "+(*queryvars.find("uuid")).second.GetData()); SQLite3DB::Statement st=m_db->Prepare("DELETE FROM tblMessageInserts WHERE MessageUUID=?"); st.Bind(0, (*queryvars.find("uuid")).second.GetData()); st.Step(); } SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID, MessageXML, SendDate, MessageUUID FROM tblMessageInserts WHERE Inserted='false';"); st.Step(); int msgcount=0; std::string tblcontent=""; std::string content=""; tblcontent+="<table><tr><td>"+m_trans->Get("web.page.pendingmessages.identity")+"</td><td>"+m_trans->Get("web.page.pendingmessages.boards")+"</td><td>"+m_trans->Get("web.page.pendingmessages.subject")+"</td><td>"+m_trans->Get("web.page.pendingmessages.time")+"</td></tr>"; while (st.RowReturned()) { int identityid=0; std::string time(""); std::string uuid(""); std::string subject(""); st.ResultInt(0,identityid); st.ResultText(2,time); st.ResultText(3, uuid); LocalIdentity ident(m_db); //found a canned way, thanks SomeDude! ident.Load(identityid); tblcontent+="<tr><td>"; tblcontent+=SanitizeOutput(ident.GetName())+"</td><td>"; //yes, the next bit sucks but there's no better way to do it (that I could find) //we will look at the message XML to find the board(s) posted to.... std::string xml=""; st.ResultText(1,xml); MessageXML mxml; mxml.ParseXML(xml); std::vector<std::string> boards=mxml.GetBoards(); std::vector<std::string>::iterator iter; for (iter=boards.begin(); iter!=boards.end(); ++iter) tblcontent+=*iter+", "; tblcontent.erase(tblcontent.length()-2); //strip final ", " tblcontent+="</td><td>"; subject=mxml.GetSubject(); tblcontent+=SanitizeOutput(subject); tblcontent+="</td><td>"; tblcontent+=time+"</td><td>"; //button tblcontent+="<form name=\"frmdelete\" method=\"POST\">"; tblcontent+=CreateFormPassword(); tblcontent+="<input type=\"hidden\" name=\"formaction\" value=\"delete\">"; tblcontent+="<input type=\"hidden\" name=\"uuid\" value=\""+uuid+"\">"; tblcontent+="<input type=\"submit\" value=\""+m_trans->Get("web.page.pendingmessages.deletemessage")+"\">"; tblcontent+="</form>"; tblcontent+="</td></tr>"; st.Step(); msgcount++; } tblcontent+="</table>"; std::string msgcountstr(""); StringFunctions::Convert(msgcount,msgcountstr); content="<h2>"+msgcountstr+" "+m_trans->Get("web.page.pendingmessages.messageswaiting")+"</h2>"; content+=tblcontent; return content; }
const std::string HomePage::GenerateContent(const std::string &method, const std::map<std::string,QueryVar> &queryvars) { Option option(m_db); std::string messagecountstr=""; std::string filecountstr=""; std::string fproxyhost="127.0.0.1"; std::string fproxyport="8888"; std::string fproxyprotocol="http"; option.Get("FProxyHost",fproxyhost); option.Get("FProxyPort",fproxyport); option.Get("FProxyProtocol",fproxyprotocol); if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="shutdown" && ValidateFormPassword(queryvars)) { m_log->trace("HomePage::GeneratePage requested shutdown"); ((FMSApp *)&FMSApp::instance())->Terminate(); global::shutdown=true; } std::string content="<h2>"+m_trans->Get("web.page.home.title")+"</h2>"; content+="<p class=\"paragraph\">"; content+="<strong>"+m_trans->Get("web.page.home.fmsversion")+" "; content+=FMS_VERSION; content+="</strong><br>"; bool showgenericupdate=true; 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()) { int major=0; int minor=0; int release=0; int currentmajor=0; int currentminor=0; int currentrelease=0; std::string freesite=""; 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(currentmajor<major || (currentmajor==major && currentminor<minor) || (currentmajor==major && currentminor==minor && currentrelease<release)) { content+="<strong>"+m_trans->Get("web.page.home.oldversion")+" <a href=\""+fproxyprotocol+"://"+fproxyhost+":"+fproxyport+"/"+freesite+"\">FMS "+majorstr+"."+minorstr+"."+releasestr+"</a></strong><br>"; content+=m_trans->Get("web.page.home.releaseinfo")+" <a href=\"versioninfo.htm?Major="+majorstr+"&Minor="+minorstr+"&Release="+releasestr+"\">"+m_trans->Get("web.page.home.releaseinfohere")+"</a><br>"; showgenericupdate=false; } else { content+="<a href=\"versioninfo.htm\">"+m_trans->Get("web.page.home.releaseinfo")+"</a><br>"; } } if(showgenericupdate) { content+=m_trans->Get("web.page.home.checknewreleases")+" <a href=\""+fproxyprotocol+"://"+fproxyhost+":"+fproxyport+"/"+FMS_FREESITE_USK+"\">"+m_trans->Get("web.page.home.fmsfreesite")+"</a><br>"; } content+=m_trans->Get("web.page.home.admininstructions"); content+="</p>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblMessageInserts WHERE Inserted='false';"); st.Step(); if(st.RowReturned()) { st.ResultText(0,messagecountstr); } content+=m_trans->Get("web.page.home.messageswaiting")+messagecountstr; if (messagecountstr!="0") //show link to message page { content+=" (<a href=\"showpendingmessage.htm\">"+m_trans->Get("web.page.home.showmessageswaiting")+"</a>)"; } content+="<br>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblFileInserts WHERE Key IS NULL;"); st.Step(); if(st.RowReturned()) { st.ResultText(0,filecountstr); } content+=m_trans->Get("web.page.home.fileswaiting")+filecountstr+"<br>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblMessageInserts WHERE Inserted='true';"); st.Step(); if(st.RowReturned()) { st.ResultText(0,messagecountstr); } /* st=m_db->Prepare("SELECT COUNT(*) FROM tblMessageInserts WHERE MessageUUID IN (SELECT MessageUUID FROM tblMessage);"); st.Step(); if(st.RowReturned()) { st.ResultText(0,filecountstr); } */ content+=m_trans->Get("web.page.home.msgsinserted")+" "+messagecountstr;//+" / "+filecountstr; if (messagecountstr!="0") //show link to message page { content+=" (<a href=\"showinsertedmessage.htm\">"+m_trans->Get("web.page.home.show")+"</a>)"; } content+="<br>"; st=m_db->Prepare("SELECT COUNT(*) FROM tblMessage;"); st.Step(); if(st.RowReturned()) { st.ResultText(0,filecountstr); } content+=m_trans->Get("web.page.home.msgsreceived")+" "+filecountstr+" (<a href=\"showreceivedmessage.htm\">"+m_trans->Get("web.page.home.show")+"</a>)<br>"; content+="<p class=\"paragraph\">"; content+="<form name=\"frmshutdown\" method=\"POST\">"; content+=CreateFormPassword(); content+="<input type=\"hidden\" name=\"formaction\" value=\"shutdown\">"; content+="<input type=\"submit\" value=\""+m_trans->Get("web.page.home.shutdownfms")+"\">"; content+="</form>"; content+="</p>"; return content; }