#ifndef _simple_captcha_\r
#define _simple_captcha_\r
\r
+#include <string>\r
+\r
#include "icaptcha.h"\r
\r
class SimpleCaptcha:public ICaptcha\r
#include <vector>\r
#include "pthreadwrapper/thread.h"\r
\r
-#define FMS_VERSION "0.2.12"\r
+#define FMS_VERSION "0.2.13"\r
\r
// opens database and creates tables and initial inserts if necessary\r
void SetupDB();\r
#pragma once\r
#endif // _MSC_VER > 1000\r
\r
+#include <cstring>\r
#include <utility>\r
#include <string>\r
#include <list>\r
#include "../../include/db/sqlite3db/sqlite3recordset.h"\r
\r
+#include <cstdlib>\r
+\r
#ifdef XMEM\r
#include <xmem.h>\r
#endif\r
#include "../../../include/freenet/captcha/easybmp/EasyBMP_Font.h"\r
#include "../../../include/freenet/captcha/easybmp/EasyBMP_Geometry.h"\r
\r
+#include <cstdlib>\r
+\r
#ifdef XMEM\r
#include <xmem.h>\r
#endif\r
#include <cstdio>\r
#include <cstdarg>\r
#include <sstream>\r
+#include <cstring>\r
\r
#ifdef _WIN32\r
#include <ws2tcpip.h>\r
#include "../../include/freenet/boardlistrequester.h"\r
#include "../../include/freenet/siteinserter.h"\r
#include "../../include/freenet/fileinserter.h"\r
-\r
#include "../../include/pthreadwrapper/thread.h"\r
\r
+#include <cstdlib>\r
+\r
#ifdef XMEM\r
#include <xmem.h>\r
#endif\r
m_db->Execute("DELETE FROM tblIntroductionPuzzleInserts WHERE Day<='"+date.Format("%Y-%m-%d")+"';");\r
m_db->Execute("DELETE FROM tblIntroductionPuzzleRequests WHERE Day<='"+date.Format("%Y-%m-%d")+"';");\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"PeriodicDBMaintenance::Do1DayMaintenance");\r
-\r
// delete all identities we've never seen and were added more than 20 days ago\r
date.SetToGMTime();\r
date.Add(0,0,0,-20);\r
m_db->Execute("DELETE FROM tblIdentityTrust WHERE LocalIdentityID NOT IN (SELECT LocalIdentityID FROM tblLocalIdentity);");\r
m_db->Execute("DELETE FROM tblIdentityTrust WHERE IdentityID NOT IN (SELECT IdentityID FROM tblIdentity);");\r
\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"PeriodicDBMaintenance::Do1DayMaintenance");\r
+\r
}\r
\r
void PeriodicDBMaintenance::Process()\r
std::string publishboardliststr="";\r
bool publishtrustlist=false;\r
bool publishboardlist=false;\r
+ std::string editionstr="";\r
\r
st.ResultText(0,name);\r
st.ResultText(1,key);\r
st.ResultText(2,publishtrustliststr);\r
st.ResultText(3,publishboardliststr);\r
+ st.ResultText(4,editionstr);\r
\r
publishtrustliststr=="true" ? publishtrustlist=true : publishtrustlist=false;\r
publishboardliststr=="true" ? publishboardlist=true : publishboardlist=false;\r
+ // no edition exists - start at 0\r
+ if(editionstr=="")\r
+ {\r
+ editionstr="0";\r
+ }\r
+ // previous edition exists - add 1\r
+ else\r
+ {\r
+ int edition=0;\r
+ StringFunctions::Convert(editionstr,edition);\r
+ edition++;\r
+ StringFunctions::Convert(edition,editionstr);\r
+ }\r
\r
filename=name+"-template.htm";\r
FILE *infile=fopen(filename.c_str(),"r+b");\r
key.erase(0,3);\r
key="USK"+key;\r
}\r
- key+=m_messagebase+"/0/";\r
+ key+=m_messagebase+"/"+editionstr+"/";\r
uskkey=key;\r
\r
}\r
db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@bloE1LJ~qzSYUkU2nt7sB9kq060D4HTQC66pk5Q8NpA,DOOASUnp0kj6tOdhZJ-h5Tk7Ka50FSrUgsH7tCG1usU,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');");\r
// insert Flink's public key\r
db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@q2TtkNBOuuniyJ56~8NSopCs3ttwe5KlB31ugZtWmXA,6~PzIupS8YK7L6oFNpXGKJmHT2kBMDfwTg73nHdNur8,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');");\r
+ // insert Kane's public key\r
+ db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@Ofm~yZivDJ5Z2fSzZbMiLEUUQaIc0KHRdZMBTaPLO6I,WLm4s4hNbOOurJ6ijfOq4odz7-dN7uTUvYxJRwWnlMI,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');");\r
+ // inserts boardstat's public key\r
+ db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@aYWBb6zo2AM13XCNhsmmRKMANEx6PG~C15CWjdZziKA,X1pAG4EIqR1gAiyGFVZ1iiw-uTlh460~rFACJ7ZHQXk,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');");\r
\r
// TODO remove sometime after 0.1.17\r
FixCapitalBoardNames();\r
#include "../../include/http/httpdefs.h"\r
#include "../../include/stringfunctions.h"\r
\r
+#include <cstring>\r
+\r
#ifdef XMEM\r
#include <xmem.h>\r
#endif\r
{\r
std::string content="<h2>Inserted Files</h2>";\r
\r
- SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName");\r
- st.Step();\r
-\r
std::string node="localhost";\r
Option::Instance()->Get("FCPHost",node);\r
std::string fproxyport="8888";\r
Option::Instance()->Get("FProxyPort",fproxyport);\r
\r
+\r
+ if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="removefile" && queryvars.find("fileid")!=queryvars.end())\r
+ {\r
+ SQLite3DB::Statement del=m_db->Prepare("DELETE FROM tblFileInserts WHERE FileInsertID=?;");\r
+ del.Bind(0,(*queryvars.find("fileid")).second);\r
+ del.Step();\r
+ }\r
+\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size,FileInsertID FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName");\r
+ st.Step();\r
+\r
while(st.RowReturned())\r
{\r
std::string key="";\r
std::string filename="";\r
std::string sizestr="";\r
+ std::string insertidstr="";\r
\r
st.ResultText(0,key);\r
st.ResultText(1,filename);\r
st.ResultText(2,sizestr);\r
+ st.ResultText(3,insertidstr);\r
\r
content+="<a href=\"http://"+node+":"+fproxyport+"/"+StringFunctions::UriEncode(key)+"\">"+SanitizeOutput(filename)+"</a> - "+sizestr+" bytes";\r
+ content+="<form name=\"frmRemove"+insertidstr+"\" method=\"POST\">";\r
+ content+="<input type=\"hidden\" name=\"formaction\" value=\"removefile\">";\r
+ content+="<input type=\"hidden\" name=\"fileid\" value=\""+insertidstr+"\">";\r
+ content+="<input type=\"submit\" value=\"Remove\">";\r
+ content+="</form>";\r
content+="<br>";\r
\r
st.Step();\r
#include <ctime>\r
#include <csignal>\r
#include <iostream>\r
-\r
-//debug\r
-#include "../include/freenet/fcpv2.h"\r
+#include <cstring>\r
+#include <cstdlib>\r
\r
#ifdef _WIN32\r
#include "../include/fmsservice.h"\r
m_body+=bodypart;\r
}\r
// add a binary file attachment\r
- else if((*i)->GetName()!="" && (*i)->GetLength()>0 && (*i)->GetContent())\r
+ else if(((*i)->GetName()!="" || (*i)->GetFilename()!="") && (*i)->GetLength()>0 && (*i)->GetContent())\r
{\r
+ std::string filename="";\r
std::string contenttype="";\r
std::vector<unsigned char> data((*i)->GetContent(),(*i)->GetContent()+(*i)->GetContentLength());\r
if((*i)->GetContentType())\r
contenttype.erase(endpos);\r
}\r
}\r
- m_fileattachments.push_back(fileattachment((*i)->GetName(),contenttype,data));\r
+ filename=(*i)->GetFilename();\r
+ if(filename=="")\r
+ {\r
+ filename=(*i)->GetName();\r
+ }\r
+ m_fileattachments.push_back(fileattachment(filename,contenttype,data));\r
}\r
}\r
\r
#include "../../../include/nntp/mime/Mime.h"\r
#include <stdlib.h>\r
#include <time.h>\r
+#include <cstring>\r
\r
#ifndef _WIN32\r
#define stricmp strcasecmp\r
#include "../../include/global.h"\r
#include "../../include/stringfunctions.h"\r
\r
+#include <cstring>\r
+\r
#ifdef _WIN32\r
#include <winsock2.h>\r
#include <ws2tcpip.h>\r
//#include "libinn.h"\r
#include "../../include/nntp/uwildmat.h"\r
#include <string>\r
+#include <cstring>\r
\r
#define ABORT -1\r
\r
#include "../include/socketdefines.h"\r
#include <cerrno>\r
+#include <cstring>\r
\r
#ifdef XMEM\r
#include <xmem.h>\r
#include "../include/uuidgenerator.h"\r
\r
+#include <cstdlib>\r
+\r
#ifdef XMEM\r
#include <xmem.h>\r
#endif\r