X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Ffreenet%2Fsiteinserter.cpp;h=e54a28ea080854512bcbd7708b04f4e0c896ca56;hp=9ee3019a352892125abe2de401df1af309d4a331;hb=853f67b0b7b8121d572cff34d40f7b28cac8f65e;hpb=63376b2a82c3f6cdf2df56b1f134bd7df0aaab3a diff --git a/src/freenet/siteinserter.cpp b/src/freenet/siteinserter.cpp index 9ee3019..e54a28e 100644 --- a/src/freenet/siteinserter.cpp +++ b/src/freenet/siteinserter.cpp @@ -22,6 +22,10 @@ void SiteInserter::CheckForNeededInsert() { DateTime date; date.SetToGMTime(); + date.SetHour(0); + date.SetMinute(0); + date.SetSecond(0); + date.Normalize(); SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID FROM tblLocalIdentity WHERE PublishFreesite='true' AND (LastInsertedFreesite IS NULL OR LastInsertedFreesiteFMS site of "+SanitizeOutput(name)+""; - content+="

My last few posts

"; SQLite3DB::Statement boardst=m_db->Prepare("SELECT tblBoard.BoardName FROM tblBoard INNER JOIN tblMessageBoard ON tblBoard.BoardID=tblMessageBoard.BoardID WHERE tblMessageBoard.MessageID=? ORDER BY tblBoard.BoardName COLLATE NOCASE;"); @@ -84,6 +86,9 @@ std::string SiteInserter::GenerateIndex(const std::string &htmltemplate, const l content+=""; content+="
"; content+=SanitizeOutput(post); + //post=SanitizeOutput(post); + //StringFunctions::Replace(post,"\r\n","
"); + //content+=post; content+="
"; content+=""; @@ -127,14 +132,29 @@ void SiteInserter::GeneratePages(const long localidentityid, std::string &uskkey std::string publishboardliststr=""; bool publishtrustlist=false; bool publishboardlist=false; + std::string editionstr=""; st.ResultText(0,name); st.ResultText(1,key); st.ResultText(2,publishtrustliststr); st.ResultText(3,publishboardliststr); + st.ResultText(4,editionstr); publishtrustliststr=="true" ? publishtrustlist=true : publishtrustlist=false; publishboardliststr=="true" ? publishboardlist=true : publishboardlist=false; + // no edition exists - start at 0 + if(editionstr=="") + { + editionstr="0"; + } + // previous edition exists - add 1 + else + { + int edition=0; + StringFunctions::Convert(editionstr,edition); + edition++; + StringFunctions::Convert(edition,editionstr); + } filename=name+"-template.htm"; FILE *infile=fopen(filename.c_str(),"r+b"); @@ -156,6 +176,7 @@ void SiteInserter::GeneratePages(const long localidentityid, std::string &uskkey htmltemplate.append(data.begin(),data.end()); htmltemplate=StringFunctions::Replace(htmltemplate,"[LINKS]",GenerateLinks(publishtrustlist,publishboardlist)); + htmltemplate=StringFunctions::Replace(htmltemplate,"[IDENTITYNAME]",SanitizeOutput(name)); pages["index.htm"]=GenerateIndex(htmltemplate,localidentityid,name); if(publishtrustlist) @@ -173,7 +194,7 @@ void SiteInserter::GeneratePages(const long localidentityid, std::string &uskkey key.erase(0,3); key="USK"+key; } - key+=m_messagebase+"/0/"; + key+=m_messagebase+"/"+editionstr+"/"; uskkey=key; } @@ -399,7 +420,7 @@ const std::string SiteInserter::SanitizeOutput(const std::string &input) return output; } -void SiteInserter::StartInsert(const long &localidentityid) +const bool SiteInserter::StartInsert(const long &localidentityid) { FCPMessage message; std::string localidentityidstr=""; @@ -443,4 +464,6 @@ void SiteInserter::StartInsert(const long &localidentityid) m_inserting.push_back(localidentityid); + return true; + }