src/freenet/messagerequester.cpp\r
src/freenet/messagexml.cpp\r
src/freenet/periodicdbmaintenance.cpp\r
+src/freenet/siteinserter.cpp\r
src/freenet/trustlistinserter.cpp\r
src/freenet/trustlistrequester.cpp\r
src/freenet/trustlistxml.cpp\r
void StartRequest(const long &identityid);\r
const bool HandleAllData(FCPMessage &message);\r
const bool HandleGetFailed(FCPMessage &message);\r
+\r
+ bool m_savemessagesfromnewboards;\r
+\r
};\r
\r
#endif // _boardlistrequester_\r
m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IIndexRequester<IDTYPE>::FCPConnected fcpuniquename contains | character! This is not a valid character!");\r
}\r
\r
+ m_lastreceived.SetToGMTime();\r
m_requesting.clear();\r
PopulateIDList();\r
- m_lastreceived.SetToGMTime();\r
m_lastpopulated.SetToGMTime();\r
}\r
\r
long m_maxdaysbackward;\r
long m_maxpeermessages;\r
long m_maxboardspermessage;\r
+ bool m_savemessagesfromnewboards;\r
\r
};\r
\r
--- /dev/null
+#ifndef _site_inserter_\r
+#define _site_inserter_\r
+\r
+#include "iindexinserter.h"\r
+\r
+class SiteInserter:public IIndexInserter<long>\r
+{\r
+public:\r
+ SiteInserter();\r
+ SiteInserter(FCPv2 *fcp);\r
+\r
+private:\r
+ void Initialize();\r
+ const bool HandlePutSuccessful(FCPMessage &message);\r
+ const bool HandlePutFailed(FCPMessage &message);\r
+ void StartInsert(const long &localidentityid);\r
+ void CheckForNeededInsert();\r
+ const std::string SanitizeOutput(const std::string &input);\r
+ void GeneratePages(const long localidentityid, std::string &uskkey, std::map<std::string,std::string> &pages);\r
+ std::string GenerateLinks(const bool publishtrustlist, const bool publishboardlist);\r
+ std::string GenerateIndex(const std::string &htmltemplate, const long localidentityid, const std::string &name);\r
+ std::string GenerateTrustList(const std::string &htmltemplate, const long localidentityid, const std::string &name);\r
+ const std::string GetClassString(const std::string &trustlevel);\r
+\r
+};\r
+\r
+#endif // _site_inserter_\r
#include <vector>\r
#include "pthreadwrapper/thread.h"\r
\r
-#define FMS_VERSION "0.2.3"\r
+#define FMS_VERSION "0.2.4"\r
\r
// opens database and creates tables and initial inserts if necessary\r
void SetupDB();\r
void ConvertDB0101To0103();\r
void ConvertDB0103To0104();\r
void ConvertDB0104To0105();\r
+void ConvertDB0105To0106();\r
// inserts default options into the database\r
void SetupDefaultOptions();\r
// opens logfile and sets it up\r
std::string GetXML();\r
const bool ParseXML(const std::string &xml);\r
\r
- void AddIdentity(const std::string &name, const std::string &publickey, const std::string &privatekey, const bool singleuse=false, const bool publishtrustlist=false, const bool publishboardlist=false);\r
+ void AddIdentity(const std::string &name, const std::string &publickey, const std::string &privatekey, const bool singleuse=false, const bool publishtrustlist=false, const bool publishboardlist=false, const bool publishfreesite=false);\r
\r
const long GetCount() { return m_identities.size(); }\r
\r
const bool GetSingleUse(const long index);\r
const bool GetPublishTrustList(const long index);\r
const bool GetPublishBoardList(const long index);\r
+ const bool GetPublishFreesite(const long index);\r
\r
private:\r
void Initialize();\r
\r
struct identity\r
{\r
- identity(const std::string &name, const std::string &publickey, const std::string &privatekey, const bool singleuse, const bool publishtrustlist, const bool publishboardlist):m_name(name),m_publickey(publickey),m_privatekey(privatekey),m_singleuse(singleuse),m_publishtrustlist(publishtrustlist),m_publishboardlist(publishboardlist) {}\r
+ identity(const std::string &name, const std::string &publickey, const std::string &privatekey, const bool singleuse, const bool publishtrustlist, const bool publishboardlist, const bool publishfreesite):m_name(name),m_publickey(publickey),m_privatekey(privatekey),m_singleuse(singleuse),m_publishtrustlist(publishtrustlist),m_publishboardlist(publishboardlist),m_publishfreesite(publishfreesite) {}\r
std::string m_name;\r
std::string m_publickey;\r
std::string m_privatekey;\r
bool m_singleuse;\r
bool m_publishtrustlist;\r
bool m_publishboardlist;\r
+ bool m_publishfreesite;\r
};\r
\r
std::vector<identity> m_identities;\r
username for the newsgroup account. The email address may be anything, as it\r
is discarded when posting messages.\r
\r
-Posting Messages\r
+POSTING MESSAGES\r
----------------\r
Use must set your newsreader to use UTF-8 when posting messages. Any non-text\r
attachment to the message will be stripped. Text attachments will be inlined\r
board with the same message. The control boards will be stripped from the\r
message before inserting into Freenet.\r
\r
+FREESITES\r
+---------\r
+Each identity has the option to publish a freesite. A generic HTML template\r
+called site-template.htm is used to insert the site. You can customize the\r
+template by placing an HTML file called identityname-template.htm in the same\r
+directory as the fms binary. In the template, the string [LINKS] will be\r
+replaced by a <ul> list of links and [CONTENT] will be replaced by the page\r
+content. The Freesite will be inserted once a day and contain your last 10\r
+posts and your trust list if you are publishing it.\r
+\r
TRUST\r
-----\r
Trust is the most important element of FMS. It determines which identities you\r
--- /dev/null
+<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+<title>FMS : Freenet Message System</title>\r
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
+<style type="text/css">\r
+body {\r
+ background-color: #FFF;\r
+ color: #000;\r
+ font-family: Verdana, Arial, Helvetica, sans-serif;\r
+ font-size: 90%;\r
+}\r
+a, a:link, a:active { color: #0000FF; text-decoration: none; }\r
+a:visited { color: #003399; text-decoration: none; }\r
+a:hover { color: #990000; text-decoration: underline; }\r
+p {}\r
+div {\r
+}\r
+h1 {}\r
+h2 { color: #003366;}\r
+h3 { color: #336699; border-bottom: 1px solid #336699;}\r
+h4 { color: #6699CC; border-bottom: 1px solid #6699CC;}\r
+h5 { color: #99CCFF;}\r
+\r
+ul {\r
+ padding:0px;\r
+ margin-top:5px;\r
+ margin-bottom:5px;\r
+ margin-left:25px;\r
+ }\r
+\r
+.banner { \r
+ background-color: #003366;\r
+ color: #FFFFFF;\r
+ font-weight: bolder;\r
+}\r
+.navigation {\r
+ background-color: #CCDDEE;\r
+ border: 1px solid #999999;\r
+ font-size: 80%;\r
+}\r
+.content_main { background-color: #FFFFFF;}\r
+.content_left {\r
+ font-size: 90%;\r
+}\r
+.content_left .box {\r
+ border: 1px solid #336699;\r
+ background-color: #DDEEFF;\r
+ font-size: 85%;\r
+}\r
+.content_left .box .header {\r
+ background-color: #003366; \r
+ color: #FFFFFF;\r
+ font-weight: bold;\r
+ font-size: 1em;\r
+}\r
+.content_left .box p {\r
+}\r
+.content_right {\r
+}\r
+.footer { \r
+ color: #999;\r
+ font-size: smaller;\r
+ text-align: center;\r
+ border-top: 1px dashed #CCCCCC;\r
+}\r
+.meta-info {\r
+ font-size: 80%;\r
+}\r
+.paragraph {\r
+ line-height: 1.4em;\r
+}\r
+\r
+.smaller { font-size: 65%; }\r
+.darkest { background-color: #003366; }\r
+.darker { background-color: #336699; }\r
+.dark { background-color: #6699CC; }\r
+.light { background-color: #99CCFF; }\r
+.lighter { background-color: #DDEEFF; }\r
+.lightest { background-color: #FFFFFF; }\r
+\r
+.xml1-attributename { color: #800000; }\r
+.xml1-attributevalue { color: #FF0000; }\r
+.xml1-cdatasection { color: #808000; }\r
+.xml1-comment { color: #808080; font-style: italic; }\r
+.xml1-currentline { color: #000000; }\r
+.xml1-doctypesection { color: #008080; }\r
+.xml1-elementname { color: #000080; }\r
+.xml1-entityreference { color: #0000FF; }\r
+.xml1-matchedbraces { color: #FF0000; }\r
+.xml1-namespaceattributename { color: #008000; }\r
+.xml1-namespaceattributevalue { color: #0000FF; }\r
+.xml1-processinginstruction { color: #000080; }\r
+.xml1-rightedge { color: #C0C0C0; }\r
+.xml1-selection { color: #FFFFFF; }\r
+.xml1-symbol { color: #808080; }\r
+.xml1-text { color: #000000; }\r
+.xml1-whitespace { color: #FFFFFF; }\r
+\r
+.calcheading {\r
+ font-weight:bold;\r
+ }\r
+ \r
+.calcheading td {\r
+ padding-left:10px;\r
+ padding-right:10px;\r
+ }\r
+ \r
+.calcrow td {\r
+ background-color:#EEEEEE;\r
+ text-align:right;\r
+ }\r
+ \r
+.totalrow td {\r
+ text-align:right;\r
+ }\r
+ \r
+/* layout */\r
+ \r
+body {\r
+ width: auto;\r
+ margin: 1em;\r
+}\r
+p, div {\r
+ margin: 0em 0em 0em 0em;\r
+ padding: 0em;\r
+}\r
+h1, h2, h3, h4, h5, h6 {\r
+ margin: 0em 0em .2em 0em;\r
+ padding: 0em 0em .1em 0em;\r
+}\r
+\r
+.banner { \r
+ margin: 0em;\r
+ padding: .5em;\r
+\r
+}\r
+.navigation {\r
+ margin: 0em 0em 0em 0em;\r
+ padding: .3em;\r
+}\r
+\r
+.content_main {\r
+ margin: 0em;\r
+ padding: 0em;\r
+}\r
+\r
+.content_left {\r
+ float: left;\r
+ width: 200px;\r
+ margin: 1em 0em 0em 0em;\r
+ padding: 0em;\r
+}\r
+.content_left .box {\r
+ margin: 0em 0em 1em 0em;\r
+}\r
+.content_left .box .header {\r
+ padding: .5em;\r
+}\r
+.content_left .box p {\r
+ padding: 0em .3em 0em .3em;\r
+ margin: .0em 0em .5em 0em;\r
+}\r
+\r
+.content_right {\r
+ position:absolute;\r
+ left:220px;\r
+ margin: 0px 0px 0px 0px;\r
+ padding: 1em;\r
+}\r
+\r
+.meta-info {\r
+ text-align: right;\r
+}\r
+\r
+.footer {\r
+ clear: both;\r
+ padding: 1em;\r
+ margin: 0em;\r
+}\r
+\r
+.paragraph {\r
+ margin-bottom:.5em;\r
+ }\r
+</style>\r
+<style type="text/css">\r
+ \r
+.trust0 {background-color:#ff5961;}\r
+.trust1 {background-color:#ff7a67;}\r
+.trust2 {background-color:#ff9b6c;}\r
+.trust3 {background-color:#ffbb72;}\r
+.trust4 {background-color:#ffdc77;}\r
+.trust5 {background-color:#fffd7d;}\r
+.trust6 {background-color:#e2fd83;}\r
+.trust7 {background-color:#c5fe8a;}\r
+.trust8 {background-color:#a7fe90;}\r
+.trust9 {background-color:#8aff97;}\r
+.trust10 {background-color:#6dff9d;}\r
+\r
+form { display:inline; }\r
+\r
+th { padding-left:5px; padding-right:5px; }\r
+td { padding-left:5px; padding-right:5px; }\r
+\r
+.post {\r
+ margin-bottom:2em;\r
+ }\r
+ \r
+.post .postsubject {\r
+ font-size:1.2em;\r
+ font-style:bolder;\r
+ }\r
+ \r
+.post .postboards {\r
+ font-size:1.2em;\r
+ font-style:bolder;\r
+ }\r
+ \r
+.post .postbody {\r
+ white-space:pre;\r
+ }\r
+\r
+</style>\r
+</head>\r
+\r
+<body>\r
+ \r
+ <div class="banner">\r
+ FMS : Freenet Message System\r
+ </div>\r
+ \r
+ <div class="content_main">\r
+\r
+ <div class="content_left">\r
+ <div class="box">\r
+ <div class="header">Links</div>\r
+ [LINKS]\r
+ </div>\r
+ \r
+ </div>\r
+ \r
+ <div class="content_right">\r
+ \r
+ [CONTENT]\r
+ \r
+ </div>\r
+ \r
+ </div>\r
+\r
+\r
+</body>\r
+</html>\r
{\r
\r
SQLite3DB::Statement brd=m_db->Prepare("SELECT BoardID,BoardName,BoardDescription FROM tblBoard WHERE BoardName=?;");\r
- SQLite3DB::Statement ins=m_db->Prepare("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES(?,?,?);");\r
+ SQLite3DB::Statement ins=m_db->Prepare("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,SaveReceivedMessages) VALUES(?,?,?,?);");\r
SQLite3DB::Statement upd=m_db->Prepare("UPDATE tblBoard SET BoardDescription=? WHERE BoardID=?;");\r
for(long i=0; i<xml.GetCount(); i++)\r
{\r
ins.Bind(0,xml.GetName(i));\r
ins.Bind(1,xml.GetDescription(i));\r
ins.Bind(2,now.Format("%Y-%m-%d %H:%M:%S"));\r
+ if(m_savemessagesfromnewboards)\r
+ {\r
+ ins.Bind(3,"true");\r
+ }\r
+ else\r
+ {\r
+ ins.Bind(3,"false");\r
+ }\r
ins.Step();\r
ins.Reset();\r
}\r
{\r
m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"Option MaxBoardListRequests is currently set at "+tempval+". This value might be incorrectly configured.");\r
}\r
+\r
+ Option::Instance()->Get("SaveMessagesFromNewBoards",tempval);\r
+ if(tempval=="true")\r
+ {\r
+ m_savemessagesfromnewboards=true;\r
+ }\r
+ else\r
+ {\r
+ m_savemessagesfromnewboards=false;\r
+ }\r
+\r
}\r
\r
void BoardListRequester::PopulateIDList()\r
void SimpleCaptcha::Generate()\r
{\r
BMP bmp;\r
- int bmpwidth=100;\r
+ int bmpwidth=110;\r
int bmpheight=50;\r
RGBApixel lettercols[5];\r
std::string puzzlestring;\r
#include "../../include/freenet/periodicdbmaintenance.h"\r
#include "../../include/freenet/boardlistinserter.h"\r
#include "../../include/freenet/boardlistrequester.h"\r
+#include "../../include/freenet/siteinserter.h"\r
\r
//#include <zthread/Thread.h>\r
#include "../../include/pthreadwrapper/thread.h"\r
m_registrables.push_back(new MessageInserter(&m_fcp));\r
m_registrables.push_back(new BoardListInserter(&m_fcp));\r
m_registrables.push_back(new BoardListRequester(&m_fcp));\r
+ m_registrables.push_back(new SiteInserter(&m_fcp));\r
m_registrables.push_back(new PeriodicDBMaintenance());\r
\r
for(std::vector<IFreenetRegistrable *>::iterator i=m_registrables.begin(); i!=m_registrables.end(); i++)\r
{\r
DateTime now;\r
now.SetToGMTime();\r
- st=m_db->Prepare("INSERT INTO tblBoard(BoardName,DateAdded) VALUES(?,?);");\r
+ st=m_db->Prepare("INSERT INTO tblBoard(BoardName,DateAdded,SaveReceivedMessages) VALUES(?,?,?);");\r
st.Bind(0,boardname);\r
st.Bind(1,now.Format("%Y-%m-%d %H:%M:%S"));\r
+ if(m_savemessagesfromnewboards)\r
+ {\r
+ st.Bind(2,"true");\r
+ }\r
+ else\r
+ {\r
+ st.Bind(2,"false");\r
+ }\r
st.Step(true);\r
return st.GetLastInsertRowID();\r
} \r
{\r
m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"Option MaxBoardsPerMessage is currently set at "+tempval+". This value might be incorrectly configured.");\r
}\r
+ Option::Instance()->Get("SaveMessagesFromNewBoards",tempval);\r
+ if(tempval=="true")\r
+ {\r
+ m_savemessagesfromnewboards=true;\r
+ }\r
+ else\r
+ {\r
+ m_savemessagesfromnewboards=false;\r
+ }\r
}\r
\r
void MessageRequester::PopulateIDList()\r
st.Step();\r
}\r
\r
-\r
+ // set null peer trust for identities without a calculated trust\r
+ st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE IdentityID NOT IN (SELECT TargetIdentityID FROM vwCalculatedPeerTrust);");\r
+ upd=m_db->Prepare("UPDATE tblIdentity SET PeerMessageTrust=NULL, PeerTrustListTrust=NULL WHERE IdentityID=?;");\r
+ st.Step();\r
+ while(st.RowReturned())\r
+ {\r
+ int identityid=0;\r
+ st.ResultInt(0,identityid);\r
+ upd.Bind(0,identityid);\r
+ upd.Step();\r
+ upd.Reset();\r
+ st.Step();\r
+ }\r
\r
m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"PeriodicDBMaintenance::Do1HourMaintenance");\r
}\r
void PeriodicDBMaintenance::Do6HourMaintenance()\r
{\r
\r
+ // if we remove a board and the reply boardid is still set to it, we need to replace it with a boardid that does exist\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT MessageID FROM tblMessage WHERE ReplyBoardID NOT IN (SELECT BoardID FROM tblBoard);");\r
+ SQLite3DB::Statement st2=m_db->Prepare("SELECT BoardID FROM tblMessageBoard WHERE MessageID=?;");\r
+ SQLite3DB::Statement upd=m_db->Prepare("UPDATE tblMessage SET ReplyBoardID=? WHERE MessageID=?;");\r
+ st.Step();\r
+ while(st.RowReturned())\r
+ {\r
+ // find a valid boardid for the message\r
+ int messageid=0;\r
+ int boardid=0;\r
+\r
+ st.ResultInt(0,messageid);\r
+\r
+ st2.Bind(0,messageid);\r
+ st2.Step();\r
+ if(st2.RowReturned())\r
+ {\r
+ st2.ResultInt(0,boardid);\r
+ upd.Bind(0,boardid);\r
+ upd.Bind(1,messageid);\r
+ upd.Step();\r
+ upd.Reset();\r
+ }\r
+ st2.Reset();\r
+ \r
+ st.Step();\r
+ }\r
+\r
m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"PeriodicDBMaintenance::Do6HourMaintenance");\r
}\r
\r
--- /dev/null
+#include "../../include/freenet/siteinserter.h"\r
+\r
+#ifdef XMEM\r
+ #include <xmem.h>\r
+#endif\r
+\r
+SiteInserter::SiteInserter()\r
+{\r
+ Initialize();\r
+}\r
+\r
+SiteInserter::SiteInserter(FCPv2 *fcp):IIndexInserter<long>(fcp)\r
+{\r
+ Initialize();\r
+}\r
+\r
+void SiteInserter::CheckForNeededInsert()\r
+{\r
+ // only do 1 insert at a time\r
+ if(m_inserting.size()==0)\r
+ {\r
+ DateTime date;\r
+ date.SetToGMTime();\r
+\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID FROM tblLocalIdentity WHERE PublishFreesite='true' AND (LastInsertedFreesite IS NULL OR LastInsertedFreesite<?);");\r
+ st.Bind(0,date.Format("%Y-%m-%d"));\r
+\r
+ st.Step();\r
+ if(st.RowReturned())\r
+ {\r
+ int localidentityid=0;\r
+ st.ResultInt(0,localidentityid);\r
+ StartInsert(localidentityid);\r
+ }\r
+ }\r
+}\r
+\r
+std::string SiteInserter::GenerateIndex(const std::string &htmltemplate, const long localidentityid, const std::string &name)\r
+{\r
+ std::string content="";\r
+\r
+ content="<h2>FMS site of "+SanitizeOutput(name)+"</h2>";\r
+\r
+ content+="<h3>My last few posts</h3>";\r
+\r
+ 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;");\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT tblMessage.Body, tblMessage.Subject, tblMessage.MessageID FROM tblMessage INNER JOIN tblIdentity ON tblMessage.IdentityID=tblIdentity.IdentityID INNER JOIN tblLocalIdentity ON tblIdentity.PublicKey=tblLocalIdentity.PublicKey WHERE tblLocalIdentity.LocalIdentityID=? ORDER BY tblMessage.MessageDate DESC, tblMessage.MessageTime DESC LIMIT 0,10;");\r
+ st.Bind(0,localidentityid);\r
+ st.Step();\r
+\r
+ while(st.RowReturned())\r
+ {\r
+ std::string post="";\r
+ std::string subject="";\r
+ std::string boards="";\r
+ int messageid=0;\r
+\r
+ st.ResultText(0,post);\r
+ st.ResultText(1,subject);\r
+ st.ResultInt(2,messageid);\r
+\r
+ boardst.Bind(0,messageid);\r
+ boardst.Step();\r
+ while(boardst.RowReturned())\r
+ {\r
+ std::string board="";\r
+ boardst.ResultText(0,board);\r
+ if(boards!="")\r
+ {\r
+ boards+=",";\r
+ }\r
+ boards+=board;\r
+ boardst.Step();\r
+ }\r
+ boardst.Reset();\r
+\r
+ content+="<div class=\"post\">";\r
+ content+="<div class=\"postboards\">";\r
+ content+=SanitizeOutput(boards);\r
+ content+="</div>";\r
+ content+="<div class=\"postsubject\">";\r
+ content+=SanitizeOutput(subject);\r
+ content+="</div>";\r
+ content+="<div class=\"postbody\">";\r
+ content+=SanitizeOutput(post);\r
+ content+="</div>";\r
+ content+="</div>";\r
+\r
+ st.Step();\r
+ }\r
+\r
+ return StringFunctions::Replace(htmltemplate,"[CONTENT]",content);\r
+\r
+}\r
+\r
+std::string SiteInserter::GenerateLinks(const bool publishtrustlist, const bool publishboardlist)\r
+{\r
+ std::string links="";\r
+ links+="<ul>";\r
+ links+="<li><a href=\"index.htm\">Home</a></li>";\r
+ if(publishtrustlist)\r
+ {\r
+ links+="<li><a href=\"trustlist.htm\">Trust List</a></li>";\r
+ }\r
+ if(publishboardlist)\r
+ {\r
+// links+="<li><a href=\"boardlist.htm\">Board List</a></li>";\r
+ }\r
+ links+="</ul>";\r
+ return links;\r
+}\r
+\r
+void SiteInserter::GeneratePages(const long localidentityid, std::string &uskkey, std::map<std::string,std::string> &pages)\r
+{\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT Name, PrivateKey, PublishTrustList, PublishBoardList FROM tblLocalIdentity WHERE LocalIdentityID=?;");\r
+ st.Bind(0,localidentityid);\r
+ st.Step();\r
+\r
+ if(st.RowReturned())\r
+ {\r
+ std::string htmltemplate="";\r
+ std::string filename="";\r
+ std::string name="";\r
+ std::string key="";\r
+ std::string publishtrustliststr="";\r
+ std::string publishboardliststr="";\r
+ bool publishtrustlist=false;\r
+ bool publishboardlist=false;\r
+\r
+ st.ResultText(0,name);\r
+ st.ResultText(1,key);\r
+ st.ResultText(2,publishtrustliststr);\r
+ st.ResultText(3,publishboardliststr);\r
+\r
+ publishtrustliststr=="true" ? publishtrustlist=true : publishtrustlist=false;\r
+ publishboardliststr=="true" ? publishboardlist=true : publishboardlist=false;\r
+\r
+ filename=name+"-template.htm";\r
+ FILE *infile=fopen(filename.c_str(),"r+b");\r
+ if(!infile)\r
+ {\r
+ infile=fopen("site-template.htm","r+b");\r
+ }\r
+ if(infile)\r
+ {\r
+ fseek(infile,0,SEEK_END);\r
+ long len=ftell(infile);\r
+ fseek(infile,0,SEEK_SET);\r
+\r
+ std::vector<unsigned char> data;\r
+ data.resize(len);\r
+ fread(&data[0],1,data.size(),infile);\r
+ fclose(infile);\r
+\r
+ htmltemplate.append(data.begin(),data.end());\r
+\r
+ htmltemplate=StringFunctions::Replace(htmltemplate,"[LINKS]",GenerateLinks(publishtrustlist,publishboardlist));\r
+\r
+ pages["index.htm"]=GenerateIndex(htmltemplate,localidentityid,name);\r
+ if(publishtrustlist)\r
+ {\r
+ pages["trustlist.htm"]=GenerateTrustList(htmltemplate,localidentityid,name);\r
+ }\r
+ if(publishboardlist)\r
+ {\r
+// pages["boardlist.htm"]=GenerateBoardList(htmltemplate,localidentityid,name);\r
+ }\r
+\r
+ // make SSK a USK\r
+ if(key.find("SSK@")==0)\r
+ {\r
+ key.erase(0,3);\r
+ key="USK"+key;\r
+ }\r
+ key+=m_messagebase+"/0/";\r
+ uskkey=key;\r
+\r
+ }\r
+ else\r
+ {\r
+ LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_ERROR,"SiteInserter::GeneratePages unable to open "+filename+" or site-template.htm.");\r
+ }\r
+\r
+ }\r
+}\r
+\r
+std::string SiteInserter::GenerateTrustList(const std::string &htmltemplate, const long localidentityid, const std::string &name)\r
+{\r
+ std::string content="";\r
+ DateTime date;\r
+\r
+ date.SetToGMTime();\r
+ date.Add(0,0,0,-20);\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT Name,PublicKey,LocalMessageTrust,LocalTrustListTrust,IdentityID,MessageTrustComment,TrustListTrustComment FROM tblIdentity WHERE PublicKey IS NOT NULL AND LastSeen IS NOT NULL AND LastSeen>=? ORDER BY Name COLLATE NOCASE;");\r
+ st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Step();\r
+\r
+ content+="<table>";\r
+ content+="<tr><th colspan=\"5\">";\r
+ content+="Trust List of "+SanitizeOutput(name);\r
+ content+="</th></tr>";\r
+ content+="<tr><td></td><th>Message Trust</th><th>Message Comment</th><th>Trust List Trust</th><th>Trust Comment</th></tr>";\r
+ while(st.RowReturned())\r
+ {\r
+ std::string idname="";\r
+ std::string thisid="";\r
+ std::string messagetrustcomment="";\r
+ std::string trustlisttrustcomment="";\r
+ std::string messagetrust="";\r
+ std::string trustlisttrust="";\r
+ std::string publickey="";\r
+ std::string keypart="";\r
+ std::string uskkey="";\r
+\r
+ st.ResultText(0,idname);\r
+ st.ResultText(1,publickey);\r
+ st.ResultText(2,messagetrust);\r
+ st.ResultText(3,trustlisttrust);\r
+ st.ResultText(4,thisid);\r
+ st.ResultText(5,messagetrustcomment);\r
+ st.ResultText(6,trustlisttrustcomment);\r
+\r
+ if(publickey.size()>8)\r
+ {\r
+ keypart=publickey.substr(3,5);\r
+ }\r
+\r
+ if(publickey.find("SSK@")==0)\r
+ {\r
+ uskkey=publickey;\r
+ uskkey.erase(0,3);\r
+ uskkey="USK"+uskkey;\r
+ uskkey+=m_messagebase+"/0/";\r
+ }\r
+\r
+ content+="<tr>";\r
+ content+="<td><a href=\""+uskkey+"\">"+SanitizeOutput(idname+keypart)+"...</a></td>";\r
+ content+="<td "+GetClassString(messagetrust)+">"+messagetrust+"</td>";\r
+ content+="<td>"+SanitizeOutput(messagetrustcomment)+"</td>";\r
+ content+="<td "+GetClassString(trustlisttrust)+">"+trustlisttrust+"</td>";\r
+ content+="<td>"+SanitizeOutput(trustlisttrustcomment)+"</td>";\r
+ content+="</tr>\r\n";\r
+\r
+ st.Step();\r
+ }\r
+\r
+ return StringFunctions::Replace(htmltemplate,"[CONTENT]",content);\r
+\r
+}\r
+\r
+const std::string SiteInserter::GetClassString(const std::string &trustlevel)\r
+{\r
+ int tempint=0;\r
+ std::string tempstr;\r
+\r
+ StringFunctions::Convert(trustlevel,tempint);\r
+ tempint/=10;\r
+ StringFunctions::Convert(tempint,tempstr);\r
+\r
+ if(trustlevel!="")\r
+ {\r
+ return "class=\"trust"+tempstr+"\"";\r
+ }\r
+ else\r
+ {\r
+ return "";\r
+ }\r
+}\r
+\r
+const bool SiteInserter::HandlePutFailed(FCPMessage &message)\r
+{\r
+ std::vector<std::string> idparts;\r
+ long localidentityid;\r
+\r
+ StringFunctions::Split(message["Identifier"],"|",idparts);\r
+ StringFunctions::Convert(idparts[1],localidentityid);\r
+\r
+ RemoveFromInsertList(localidentityid);\r
+\r
+ return true;\r
+}\r
+\r
+const bool SiteInserter::HandlePutSuccessful(FCPMessage &message)\r
+{\r
+ std::vector<std::string> idparts;\r
+ long localidentityid;\r
+ DateTime now;\r
+\r
+ now.SetToGMTime();\r
+\r
+ StringFunctions::Split(message["Identifier"],"|",idparts);\r
+ StringFunctions::Convert(idparts[1],localidentityid);\r
+\r
+ SQLite3DB::Statement st=m_db->Prepare("UPDATE tblLocalIdentity SET LastInsertedFreesite=? WHERE LocalIdentityID=?;");\r
+ st.Bind(0,now.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(1,localidentityid);\r
+ st.Step();\r
+\r
+ m_log->WriteLog(LogFile::LOGLEVEL_INFO,"SiteInserter::HandlePutSuccessful successfully inserted Freesite.");\r
+\r
+ RemoveFromInsertList(localidentityid);\r
+\r
+ return true;\r
+}\r
+\r
+void SiteInserter::Initialize()\r
+{\r
+ m_fcpuniquename="SiteInserter";\r
+}\r
+\r
+const std::string SiteInserter::SanitizeOutput(const std::string &input)\r
+{\r
+ // must do & first because all other elements have & in them!\r
+ std::string output=StringFunctions::Replace(input,"&","&");\r
+ output=StringFunctions::Replace(output,"<","<");\r
+ output=StringFunctions::Replace(output,">",">");\r
+ output=StringFunctions::Replace(output,"\"",""");\r
+ output=StringFunctions::Replace(output," "," ");\r
+ return output;\r
+}\r
+\r
+void SiteInserter::StartInsert(const long &localidentityid)\r
+{\r
+ FCPMessage message;\r
+ std::string localidentityidstr="";\r
+ std::string sizestr="";\r
+ std::string uskkey="";\r
+ std::map<std::string,std::string> pages;\r
+ int filenum=0;\r
+\r
+ StringFunctions::Convert(localidentityid,localidentityidstr);\r
+\r
+ GeneratePages(localidentityid,uskkey,pages);\r
+\r
+ message.SetName("ClientPutComplexDir");\r
+ message["URI"]=uskkey;\r
+ message["Identifier"]=m_fcpuniquename+"|"+localidentityidstr+"|"+message["URI"];\r
+ message["DefaultName"]="index.htm";\r
+\r
+ // add each page to the message\r
+ for(std::map<std::string,std::string>::iterator pagei=pages.begin(); pagei!=pages.end(); pagei++)\r
+ {\r
+ std::string filenumstr;\r
+ StringFunctions::Convert(filenum,filenumstr);\r
+\r
+ sizestr="0";\r
+ StringFunctions::Convert((*pagei).second.size(),sizestr);\r
+\r
+ message["Files."+filenumstr+".Name"]=(*pagei).first;\r
+ message["Files."+filenumstr+".UploadFrom"]="direct";\r
+ message["Files."+filenumstr+".DataLength"]=sizestr;\r
+\r
+ filenum++;\r
+ }\r
+\r
+ m_fcp->SendMessage(message);\r
+\r
+ // send data of each page\r
+ for(std::map<std::string,std::string>::iterator pagei=pages.begin(); pagei!=pages.end(); pagei++)\r
+ {\r
+ m_fcp->SendRaw(&(*pagei).second[0],(*pagei).second.size());\r
+ }\r
+\r
+ m_inserting.push_back(localidentityid);\r
+\r
+}\r
major=1;\r
minor=5;\r
}\r
+ if(major==1 && minor==5)\r
+ {\r
+ ConvertDB0105To0106();\r
+ major=1;\r
+ minor=6;\r
+ }\r
}\r
else\r
{\r
- db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,5);");\r
+ db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,6);");\r
}\r
\r
- db->Execute("UPDATE tblDBVersion SET Major=1, Minor=4;");\r
+ db->Execute("UPDATE tblDBVersion SET Major=1, Minor=6;");\r
\r
db->Execute("CREATE TABLE IF NOT EXISTS tblOption(\\r
Option TEXT UNIQUE,\\r
SingleUse BOOL CHECK(SingleUse IN('true','false')) DEFAULT 'false',\\r
PublishTrustList BOOL CHECK(PublishTrustList IN('true','false')) DEFAULT 'false',\\r
PublishBoardList BOOL CHECK(PublishBoardList IN('true','false')) DEFAULT 'false',\\r
+ PublishFreesite BOOL CHECK(PublishFreesite IN('true','false')) DEFAULT 'false',\\r
InsertingIdentity BOOL CHECK(InsertingIdentity IN('true','false')) DEFAULT 'false',\\r
LastInsertedIdentity DATETIME,\\r
InsertingPuzzle BOOL CHECK(InsertingPuzzle IN('true','false')) DEFAULT 'false',\\r
LastInsertedBoardList DATETIME,\\r
InsertingMessageList BOOL CHECK(InsertingMessageList IN('true','false')) DEFAULT 'false',\\r
LastInsertedMessageList DATETIME,\\r
+ LastInsertedFreesite DATETIME,\\r
DateCreated DATETIME\\r
);");\r
\r
db->Execute("UPDATE tblDBVersion SET Major=1, Minor=5;");\r
}\r
\r
+void ConvertDB0105To0106()\r
+{\r
+ // add Publish Freesite\r
+ SQLite3DB::DB *db=SQLite3DB::DB::Instance();\r
+ db->Execute("ALTER TABLE tblLocalIdentity ADD COLUMN PublishFreesite BOOL CHECK(PublishFreesite IN('true','false')) DEFAULT 'false';");\r
+ db->Execute("ALTER TABLE tblLocalIdentity ADD COLUMN LastInsertedFreesite DATETIME;");\r
+ db->Execute("UPDATE tblDBVersion SET Major=1, Minor=6;");\r
+}\r
+\r
void SetupDefaultOptions()\r
{\r
// OptionValue should always be inserted as a string, even if the option really isn't a string - just to keep the field data type consistent\r
\r
st.Bind(0,"StartHTTP");\r
st.Bind(1,"true");\r
- st.Bind(2,"Start HTTP server.");\r
+ st.Bind(2,"Start HTTP server. WARNING: If you turn this off, you won't be able to access the administration pages.");\r
st.Step();\r
st.Reset();\r
\r
// StartFreenetUpdater\r
st.Bind(0,"StartFreenetUpdater");\r
st.Bind(1,"true");\r
- st.Bind(2,"Start Freenet Updater thread.");\r
+ st.Bind(2,"Set to true to start the Freenet Updater thread and connect to Freenet. Set to false to prevent communication with Freenet.");\r
st.Step();\r
st.Reset();\r
\r
st.Reset();\r
\r
st.Bind(0,"MinLocalTrustListTrust");\r
- st.Bind(1,"51");\r
+ st.Bind(1,"50");\r
st.Bind(2,"Specifies a local trust list trust level that a peer must have before its trust list will be included in the weighted average. Any peers below this number will be excluded from the results.");\r
st.Step();\r
st.Reset();\r
st.Step();\r
st.Reset();\r
\r
+ st.Bind(0,"SaveMessagesFromNewBoards");\r
+ st.Bind(1,"true");\r
+ st.Bind(2,"Set to true to automatically save messages posted to new boards. Set to false to ignore messages to new boards.");\r
+ st.Step();\r
+ st.Reset();\r
+\r
st.Bind(0,"ChangeMessageTrustOnReply");\r
st.Bind(1,"0");\r
st.Bind(2,"How much the local message trust level of an identity should change when you reply to one of their messages.");\r
Initialize();\r
}\r
\r
-void IdentityExportXML::AddIdentity(const std::string &name, const std::string &publickey, const std::string &privatekey, const bool singleuse, const bool publishtrustlist, const bool publishboardlist)\r
+void IdentityExportXML::AddIdentity(const std::string &name, const std::string &publickey, const std::string &privatekey, const bool singleuse, const bool publishtrustlist, const bool publishboardlist, const bool publishfreesite)\r
{\r
- m_identities.push_back(identity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist));\r
+ m_identities.push_back(identity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist,publishfreesite));\r
}\r
\r
const std::string IdentityExportXML::GetName(const long index)\r
}\r
}\r
\r
+const bool IdentityExportXML::GetPublishFreesite(const long index)\r
+{\r
+ if(index>=0 && index<GetCount())\r
+ {\r
+ return m_identities[index].m_publishfreesite;\r
+ }\r
+ else\r
+ {\r
+ return false;\r
+ }\r
+}\r
+\r
const bool IdentityExportXML::GetPublishTrustList(const long index)\r
{\r
if(index>=0 && index<GetCount())\r
tr->LinkEndChild(XMLCreateBooleanElement("SingleUse",(*i).m_singleuse));\r
tr->LinkEndChild(XMLCreateBooleanElement("PublishTrustList",(*i).m_publishtrustlist));\r
tr->LinkEndChild(XMLCreateBooleanElement("PublishBoardList",(*i).m_publishboardlist));\r
+ tr->LinkEndChild(XMLCreateBooleanElement("PublishFreesite",(*i).m_publishfreesite));\r
}\r
\r
td.Accept(&tp);\r
bool singleuse=false;\r
bool publishtrustlist=false;\r
bool publishboardlist=false;\r
+ bool publishfreesite=false;\r
TiXmlText *txt;\r
TiXmlHandle hnd(&td);\r
TiXmlNode *node;\r
singleuse=false;\r
publishtrustlist=false;\r
publishboardlist=false;\r
+ publishfreesite=false;\r
\r
TiXmlHandle hnd2(node);\r
txt=hnd2.FirstChild("Name").FirstChild().ToText();\r
singleuse=XMLGetBooleanElement(node->ToElement(),"SingleUse");\r
publishtrustlist=XMLGetBooleanElement(node->ToElement(),"PublishTrustList");\r
publishboardlist=XMLGetBooleanElement(node->ToElement(),"PublishBoardList");\r
+ publishfreesite=XMLGetBooleanElement(node->ToElement(),"PublishFreesite");\r
\r
if(name!="" && publickey!="" && privatekey!="")\r
{\r
- m_identities.push_back(identity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist));\r
+ m_identities.push_back(identity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist,publishfreesite));\r
}\r
\r
node=node->NextSibling("Identity");\r
if(publickey!="" && publickey.find("SSK@")==0 && publickey[publickey.size()-1]=='/')\r
{\r
date.SetToGMTime();\r
- SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblIdentity(PublicKey,DateAdded) VALUES(?,?);");\r
+ SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES(?,?,?);");\r
st.Bind(0,publickey);\r
st.Bind(1,date.Format("%Y-%m-%d %H:%M:%S"));\r
+ st.Bind(2,"manually");\r
st.Step();\r
st.Reset();\r
}\r
addst.Bind(2,now.Format("%Y-%m-%d %H:%M:%S"));\r
addst.Step();\r
}\r
+ if((*queryvars.find("formaction")).second=="remove0messages")\r
+ {\r
+ m_db->Execute("DELETE FROM tblBoard WHERE BoardID IN (SELECT BoardID FROM vwBoardStats WHERE MessageCount=0);");\r
+ }\r
if((*queryvars.find("formaction")).second=="update")\r
{\r
int boardid;\r
content+="</tr>";\r
\r
content+="<tr>";\r
+ content+="<td colspan=\"3\"><center>";\r
+ content+="<form name=\"frmremoveboard\" action=\"boards.htm\" method=\"POST\"><input type=\"hidden\" name=\"formaction\" value=\"remove0messages\">Remove boards with 0 messages<input type=\"submit\" value=\"Remove\"></form>";\r
+ content+="</center></td>";\r
+ content+="</tr>";\r
+\r
+ content+="<tr>";\r
content+="<td><form name=\"frmaddboard\" method=\"POST\"><input type=\"hidden\" name=\"formaction\" value=\"addboard\"><input type=\"text\" name=\"boardname\"></td><td><input type=\"text\" name=\"boarddescription\" size=\"40\" maxlength=\"50\"></td><td><input type=\"submit\" value=\"Add Board\"></form></td>";\r
content+="</tr>";\r
\r
std::vector<std::string> singleuse;\r
std::vector<std::string> publishtrustlist;\r
std::vector<std::string> publishboardlist;\r
+ std::vector<std::string> publishfreesite;\r
\r
CreateArgArray(queryvars,"chkidentityid",ids);\r
CreateArgArray(queryvars,"singleuse",singleuse);\r
CreateArgArray(queryvars,"publishtrustlist",publishtrustlist);\r
CreateArgArray(queryvars,"publishboardlist",publishboardlist);\r
+ CreateArgArray(queryvars,"publishfreesite",publishfreesite);\r
\r
if((*queryvars.find("formaction")).second=="update")\r
{\r
- SQLite3DB::Statement update=m_db->Prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=?, PublishBoardList=? WHERE LocalIdentityID=?;");\r
+ SQLite3DB::Statement update=m_db->Prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=?, PublishBoardList=?, PublishFreesite=? WHERE LocalIdentityID=?;");\r
for(int i=0; i<ids.size(); i++)\r
{\r
if(ids[i]!="")\r
update.Bind(0,singleuse[i]);\r
update.Bind(1,publishtrustlist[i]);\r
update.Bind(2,publishboardlist[i]);\r
- update.Bind(3,id);\r
+ update.Bind(3,publishfreesite[i]);\r
+ update.Bind(4,id);\r
update.Step();\r
update.Reset();\r
}\r
if((*queryvars.find("formaction")).second=="export")\r
{\r
IdentityExportXML xml;\r
- SQLite3DB::Statement exp=m_db->Prepare("SELECT Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList FROM tblLocalIdentity WHERE PublicKey IS NOT NULL AND PrivateKey IS NOT NULL;");\r
+ SQLite3DB::Statement exp=m_db->Prepare("SELECT Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList,PublishFreesite FROM tblLocalIdentity WHERE PublicKey IS NOT NULL AND PrivateKey IS NOT NULL;");\r
exp.Step();\r
while(exp.RowReturned())\r
{\r
bool singleuse=false;\r
bool publishtrustlist=false;\r
bool publishboardlist=false;\r
+ bool publishfreesite=false;\r
\r
exp.ResultText(0,name);\r
exp.ResultText(1,publickey);\r
{\r
publishboardlist=true;\r
}\r
+ exp.ResultText(6,tempval);\r
+ if(tempval=="true")\r
+ {\r
+ publishfreesite=true;\r
+ }\r
\r
- xml.AddIdentity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist);\r
+ xml.AddIdentity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist,publishfreesite);\r
\r
exp.Step();\r
}\r
IdentityExportXML xml;\r
if(xml.ParseXML((*queryvars.find("file")).second))\r
{\r
- SQLite3DB::Statement imp=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList) VALUES(?,?,?,?,?,?);");\r
+ SQLite3DB::Statement imp=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList,PublishFreesite) VALUES(?,?,?,?,?,?,?);");\r
for(int i=0; i<xml.GetCount(); i++)\r
{\r
std::string tempval="false";\r
tempval="false";\r
}\r
imp.Bind(5,tempval);\r
+ if(xml.GetPublishFreesite(i))\r
+ {\r
+ tempval="true";\r
+ }\r
+ else\r
+ {\r
+ tempval="false";\r
+ }\r
+ imp.Bind(6,tempval);\r
imp.Step();\r
imp.Reset();\r
}\r
\r
content+="<form name=\"frmlocalidentity\" method=\"POST\">";\r
content+="<input type=\"hidden\" name=\"formaction\" value=\"update\">";\r
- content+="<table><tr><td></td><th>Name</th><th>Single Use</th><th>Publish Trust List</th><th>Publish Board List</th><th>Announced? *</th></tr>";\r
+ content+="<table><tr><td></td><th>Name</th><th>Single Use</th><th>Publish Trust List</th><th>Publish Board List</th><th>Publish Freesite</th><th>Announced? *</th></tr>";\r
\r
- SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID,tblLocalIdentity.Name,tblLocalIdentity.PublicKey,tbLLocalIdentity.PublishTrustList,tblLocalIdentity.SingleUse,tblLocalIdentity.PublishBoardList,tblIdentity.IdentityID FROM tblLocalIdentity LEFT JOIN tblIdentity ON tblLocalIdentity.PublicKey=tblIdentity.PublicKey ORDER BY tblLocalIdentity.Name;");\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID,tblLocalIdentity.Name,tblLocalIdentity.PublicKey,tbLLocalIdentity.PublishTrustList,tblLocalIdentity.SingleUse,tblLocalIdentity.PublishBoardList,tblIdentity.IdentityID,tblLocalIdentity.PublishFreesite FROM tblLocalIdentity LEFT JOIN tblIdentity ON tblLocalIdentity.PublicKey=tblIdentity.PublicKey ORDER BY tblLocalIdentity.Name;");\r
st.Step();\r
\r
count=0;\r
std::string singleuse="";\r
std::string keypart="";\r
std::string publishboardlist="";\r
+ std::string publishfreesite="";\r
\r
st.ResultText(0,id);\r
st.ResultText(1,name);\r
st.ResultText(3,publishtrustlist);\r
st.ResultText(4,singleuse);\r
st.ResultText(5,publishboardlist);\r
+ st.ResultText(7,publishfreesite);\r
\r
if(publickey.size()>8)\r
{\r
content+="<td>"+CreateTrueFalseDropDown("singleuse["+countstr+"]",singleuse)+"</td>";\r
content+="<td>"+CreateTrueFalseDropDown("publishtrustlist["+countstr+"]",publishtrustlist)+"</td>";\r
content+="<td>"+CreateTrueFalseDropDown("publishboardlist["+countstr+"]",publishboardlist)+"</td>";\r
+ content+="<td>"+CreateTrueFalseDropDown("publishfreesite["+countstr+"]",publishfreesite)+"</td>";\r
if(st.ResultNull(6))\r
{\r
content+="<td>No</td>";\r
count++;\r
}\r
\r
- content+="<tr><td colspan=\"5\"><center><input type=\"submit\" value=\"Update Selected\"> <input type=\"submit\" value=\"Delete Selected\" onClick=\"if(confirm('Delete Selected Identities?')){frmlocalidentity.formaction.value='delete';}else{return false;}\"></td></tr>";\r
+ content+="<tr><td colspan=\"5\"><center><input type=\"submit\" value=\"Update Selected\"> <input type=\"submit\" value=\"Delete Selected\"></td></tr>";\r
content+="</table>";\r
content+="<p class=\"paragraph\">* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity.</p>";\r
content+="<p class=\"paragraph\">Single Use Identities will automatically be deleted 7 days after creation.</p>";\r
st.Step();\r
\r
content+="<table>";\r
- content+="<tr><th colspan=\"3\">";\r
+ content+="<tr><th colspan=\"5\">";\r
content+="Trust List of this identity";\r
content+="</th></tr>";\r
content+="<tr><td></td><th>Message Trust</th><th>Message Comment</th><th>Trust List Trust</th><th>Trust Comment</th></tr>";\r
st.Bind(0,identityid);\r
st.Step();\r
\r
- content+="<tr><th colspan=\"3\">";\r
+ content+="<tr><th colspan=\"5\">";\r
content+="Trust of this identity from other identities";\r
content+="</th></tr>";\r
content+="<tr><td></td><th>Message Trust</th><th>Message Comment</th><th>Trust List Trust</th><th>Trust Comment</th></tr>";\r
origmessagetrust+=changemessagetrust;\r
origtrustlisttrust+=changetrustlisttrust;\r
\r
- if(origmessagetrust<0)\r
- {\r
- origmessagetrust=0;\r
- }\r
- if(origmessagetrust>100)\r
- {\r
- origmessagetrust=100;\r
- }\r
- if(origtrustlisttrust<0)\r
- {\r
- origtrustlisttrust=0;\r
- }\r
- if(origtrustlisttrust>100)\r
- {\r
- origtrustlisttrust=100;\r
- }\r
+ origmessagetrust<0 ? origmessagetrust=0 : false;\r
+ origmessagetrust>100 ? origmessagetrust=100 : false;\r
+ origtrustlisttrust<0 ? origtrustlisttrust=0 : false;\r
+ origtrustlisttrust>100 ? origtrustlisttrust=100 : false;\r
\r
// update new trust levels\r
SQLite3DB::Statement update=m_db->Prepare("UPDATE tblIdentity SET LocalMessageTrust=?, LocalTrustListTrust=? WHERE IdentityID=?;");\r