#include "../../../include/http/pages/peermaintenancepage.h"\r
#include "../../../include/stringfunctions.h"\r
-#include "../../../include/datetime.h"\r
+\r
+#include <Poco/DateTime.h>\r
+#include <Poco/Timestamp.h>\r
+#include <Poco/Timespan.h>\r
+#include <Poco/DateTimeFormatter.h>\r
\r
#ifdef XMEM\r
#include <xmem.h>\r
std::string content="";\r
SQLite3DB::Statement st;\r
std::string tempval;\r
- DateTime date;\r
+ Poco::DateTime date;\r
\r
if(queryvars.find("formaction")!=queryvars.end())\r
{\r
}\r
else if((*queryvars.find("formaction")).second=="removelastseen20")\r
{\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-20);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(20,0,0,0,0);\r
st=m_db->Prepare("DELETE FROM tblIdentity WHERE LastSeen<?;");\r
- st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
}\r
else if((*queryvars.find("formaction")).second=="removeneversent")\r
}\r
else if((*queryvars.find("formaction")).second=="removelastseenneversent20")\r
{\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-20);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(20,0,0,0,0);\r
st=m_db->Prepare("DELETE FROM tblIdentity WHERE IdentityID NOT IN (SELECT IdentityID FROM tblMessage GROUP BY IdentityID) AND LastSeen<?;");\r
- st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
}\r
else if((*queryvars.find("formaction")).second=="removedaysago" && queryvars.find("daysago")!=queryvars.end() && (*queryvars.find("daysago")).second!="")\r
{\r
int tempint=10000;\r
StringFunctions::Convert((*queryvars.find("daysago")).second,tempint);\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-tempint);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(tempint,0,0,0,0);\r
st=m_db->Prepare("DELETE FROM tblIdentity WHERE LastSeen<?;");\r
- st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
}\r
else if((*queryvars.find("formaction")).second=="removenulldaysago" && queryvars.find("daysago")!=queryvars.end() && (*queryvars.find("daysago")).second!="")\r
{\r
int tempint=10000;\r
StringFunctions::Convert((*queryvars.find("daysago")).second,tempint);\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-tempint);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(tempint,0,0,0,0);\r
st=m_db->Prepare("DELETE FROM tblIdentity WHERE LastSeen<? AND LocalMessageTrust IS NULL AND LocalTrustListTrust IS NULL;");\r
- st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
}\r
else if((*queryvars.find("formaction")).second=="removeposted30daysago")\r
{\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-30);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(30,0,0,0,0);\r
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);");\r
- st.Bind(0,date.Format("%Y-%m-%d"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d"));\r
st.Step();\r
}\r
else if((*queryvars.find("formaction")).second=="removeadded20daysneversent")\r
{\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-20);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(20,0,0,0,0);\r
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<?);");\r
- st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
}\r
}\r
content+="</td>";\r
content+="</tr>";\r
\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-20);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(20,0,0,0,0);\r
st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity WHERE LastSeen<?;");\r
- st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
st.ResultText(0,tempval);\r
content+="<tr>";\r
content+="</td>";\r
content+="</tr>";\r
\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-30);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(30,0,0,0,0);\r
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);");\r
- st.Bind(0,date.Format("%Y-%m-%d"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d"));\r
st.Step();\r
st.ResultText(0,tempval);\r
content+="<tr>";\r
content+="</td>";\r
content+="</tr>";\r
\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-20);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(20,0,0,0,0);\r
st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE tblMessage.IdentityID IS NULL AND tblIdentity.DateAdded<?;");\r
- st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
st.ResultText(0,tempval);\r
content+="<tr>";\r
content+="</td>";\r
content+="</tr>";\r
\r
- date.SetToGMTime();\r
- date.Add(0,0,0,-20);\r
+ date=Poco::Timestamp();\r
+ date-=Poco::Timespan(20,0,0,0,0);\r
st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE tblMessage.IdentityID IS NULL AND tblIdentity.LastSeen<?;");\r
- st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
st.ResultText(0,tempval);\r
content+="<tr>";\r
\r
content+="</table>";\r
\r
- return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content);\r
+ return StringFunctions::Replace(m_template,"[CONTENT]",content);\r
}\r
\r
const bool PeerMaintenancePage::WillHandleURI(const std::string &uri)\r