--- /dev/null
+<?php\r
+\r
+ include_once('config.php');\r
+ include_once('linkbar.php');\r
+ \r
+function content()\r
+{\r
+ \r
+ global $dblocation;\r
+ \r
+ $db=new PDO('sqlite:'.$dblocation);\r
+ $st=$db->prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust FROM tblIdentity ORDER BY Name;");\r
+ $st->execute();\r
+ ?>\r
+ <h2>Identity Trust</h2>\r
+ <table>\r
+ <tr>\r
+ <th>Peer</th>\r
+ <th>Local Message Trust</th>\r
+ <th>Peer Message Trust</th>\r
+ <th>Local Trust List Trust</th>\r
+ <th>Peer Trust List Trust</th>\r
+ </tr>\r
+ <?php\r
+ while($record=$st->fetch())\r
+ {\r
+ ?>\r
+ <tr>\r
+ <td><?php print($record[1]) ?></td>\r
+ <td><?php print($record[2]) ?></td>\r
+ <td><?php print($record[3]) ?></td>\r
+ <td><?php print($record[4]) ?></td>\r
+ <td><?php print($record[5]) ?></td>\r
+ </tr>\r
+ <?php \r
+ }\r
+ ?>\r
+ </table>\r
+ <?php\r
+}\r
+ \r
+ include_once('template.php');\r
+\r
+?>
\ No newline at end of file
<li><a href="introduce.php">Introduce Identity</a></li>\r
<li><a href="introductionstatus.php">Introduction Status</a></li>\r
<li><a href="addpeeridentity.php">Manually Add Peer</a></li>\r
+ <li><a href="identitytrust.php">Identity Trust</a></li>\r
</ul>\r
</div>\r
<?php\r
public:\r
Statement();\r
Statement(sqlite3_stmt *statement);\r
- Statement(Statement &rhs);\r
+ Statement(const Statement &rhs);\r
virtual ~Statement();\r
\r
virtual const int ParameterCount() { return m_parametercount; }\r
\r
virtual const bool Bind(const int column);\r
virtual const bool Bind(const int column, const int value);\r
+ virtual const bool Bind(const int column, const long value) { return Bind(column,static_cast<int>(value)); }\r
virtual const bool Bind(const int column, const double value);\r
virtual const bool Bind(const int column, const std::string &value);\r
virtual const bool Bind(const int column, const void *data, const int length);\r
#include <vector>\r
#include <zthread/Thread.h>\r
\r
-#define FMS_VERSION "0.0.3"\r
+#define FMS_VERSION "0.0.4"\r
\r
// opens database and creates tables and initial inserts if necessary\r
void SetupDB();\r
}\r
}\r
\r
-Statement::Statement(Statement &rhs)\r
+Statement::Statement(const Statement &rhs)\r
{\r
m_statement=NULL;\r
m_parametercount=0;\r
m_receivednodehello=false;\r
}\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" trying to connect to node "+m_fcphost);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_INFO,"FreenetMasterThread::FCPConnect trying to connect to node "+m_fcphost);\r
\r
if(m_fcp.Connect(m_fcphost.c_str(),m_fcpport)==true)\r
{\r
// send ClientHello message to node\r
m_fcp.SendMessage("ClientHello",2,"Name",clientname.c_str(),"ExpectedVersion","2.0");\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" connected to node");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_INFO,"FreenetMasterThread::FCPConnect connected to node");\r
\r
return true;\r
}\r
{\r
info+="\t\t\t\t"+(*mi).first+"="+(*mi).second+"\r\n";\r
}\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" received unhandled "+message.GetName()+" message. Message content :\r\n"+info);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"FreenetMasterThread::HandleMessage received unhandled "+message.GetName()+" message. Message content :\r\n"+info);\r
\r
// if unhandled message was alldata - we must retrieve the data\r
if(message.GetName()=="AllData")\r
}\r
else\r
{\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" received "+message.GetName()+" message before NodeHello");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::HandleMessage received "+message.GetName()+" message before NodeHello");\r
}\r
\r
return false;\r
if(FCPConnect()==false)\r
{\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" could not connect to node. Waiting 60 seconds.");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::run could not connect to node. Waiting 60 seconds.");\r
\r
// wait 60 seconds - will then try to connect again\r
try\r
{\r
m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false', LastInsertedIdentity='"+now.Format("%Y-%m-%d %H:%M:%S")+"' WHERE LocalIdentityID="+idparts[1]+";");\r
m_db->Execute("INSERT INTO tblLocalIdentityInserts(LocalIdentityID,Day,InsertIndex) VALUES("+idparts[1]+",'"+idparts[4]+"',"+idparts[2]+");");\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted Identity xml");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityInserter::HandleMessage inserted Identity xml");\r
return true;\r
}\r
\r
if(message.GetName()=="PutFailed")\r
{\r
m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false' WHERE LocalIdentityID="+idparts[1]+";");\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failure inserting identity xml. Code="+message["Code"]+" Description="+message["CodeDescription"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityInserter::HandleMessage failure inserting Identity xml. Code="+message["Code"]+" Description="+message["CodeDescription"]);\r
\r
// if code 9 (collision), then insert index into inserted table\r
if(message["Code"]=="9")\r
if(message["Fatal"]=="true" || message["Code"]=="9")\r
{\r
m_db->Execute("DELETE FROM tblIdentityIntroductionInserts WHERE UUID='"+idparts[3]+"';");\r
- m_log->WriteLog(LogFile::LOGLEVEL_WARNING,__FUNCTION__" received fatal error trying to insert IdentityIntroduction "+idparts[3]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"IdentityIntroductionInserter::HandleMessage received fatal error trying to insert IdentityIntroduction "+idparts[3]);\r
}\r
m_inserting=false;\r
return true;\r
{\r
m_db->Execute("UPDATE tblIdentityIntroductionInserts SET Inserted='true' WHERE UUID='"+idparts[3]+"';");\r
m_inserting=false;\r
- m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" successfully inserted IdentityIntroduction "+idparts[3]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_INFO,"IdentityIntroductionInserter::HandleMessage successfully inserted IdentityIntroduction "+idparts[3]);\r
return true;\r
}\r
\r
}\r
else\r
{\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" could not find a public key for identity. It is probably a new identity that doesn't have a key yet.");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionInserter::StartInsert could not find a public key for identity. It is probably a new identity that doesn't have a key yet.");\r
}\r
\r
}
\ No newline at end of file
}\r
else\r
{\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" parsed public SSK key was not valid.");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityIntroductionRequester::HandleAllData parsed public SSK key was not valid.");\r
}\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed IdentityIntroduction XML file : "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionRequester::HandleAllData parsed IdentityIntroduction XML file : "+message["Identifier"]);\r
}\r
else\r
{\r
st.Step();\r
st.Finalize(); \r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing IdentityIntroduction XML file : "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityIntroductionRequester::HandleAllData error parsing IdentityIntroduction XML file : "+message["Identifier"]);\r
}\r
\r
// remove UUID from request list\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" Fatal GetFailed for "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionRequester::HandleAllData Fatal GetFailed for "+message["Identifier"]);\r
}\r
\r
// remove UUID from request list\r
st.Bind(0,UUID);\r
st.Step();\r
\r
- //TODO finish\r
if(st.RowReturned())\r
{\r
st.ResultText(0,day);\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed Identity XML file : "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityRequester::HandleAllData parsed Identity XML file : "+message["Identifier"]);\r
}\r
else\r
{\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing Identity XML file : "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityRequester::HandleAllData error parsing Identity XML file : "+message["Identifier"]);\r
}\r
\r
// remove this identityid from request list\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityRequester::HandleGetFailed fatal error requesting "+message["Identifier"]);\r
}\r
\r
// remove this identityid from request list\r
m_db->Execute("UPDATE tblIntroductionPuzzleInserts SET Day='"+idparts[5]+"', InsertIndex="+idparts[2]+", FoundSolution='true' WHERE UUID='"+idparts[3]+"';");\r
}\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failed to insert puzzle "+idparts[3]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::HandlePutFailed failed to insert puzzle "+idparts[3]);\r
\r
return true;\r
}\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted puzzle "+idparts[3]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::HandlePutSuccessful inserted puzzle "+idparts[3]);\r
\r
return true;\r
}\r
m_db->Execute("UPDATE tblLocalIdentity SET InsertingPuzzle='true' WHERE LocalIdentityID="+idstring+";");\r
m_db->Execute("INSERT INTO tblIntroductionPuzzleInserts(UUID,Type,MimeType,LocalIdentityID,PuzzleData,PuzzleSolution) VALUES('"+xml.GetUUID()+"','captcha','image/bmp',"+idstring+",'"+encodedpuzzle+"','"+solutionstring+"');");\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" started insert for id "+idstring);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::StartInsert started insert for id "+idstring);\r
\r
}\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed IntroductionPuzzle XML file : "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleRequester::HandleAllData parsed IntroductionPuzzle XML file : "+message["Identifier"]);\r
}\r
else\r
{\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing IntroductionPuzzle XML file : "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IntroductionPuzzleRequester::HandleAllData error parsing IntroductionPuzzle XML file : "+message["Identifier"]);\r
}\r
\r
// remove this identityid from request list\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IntroductionPuzzleRequester::HandleGetFailed fatal error requesting "+message["Identifier"]);\r
}\r
\r
// remove this identityid from request list\r
{\r
m_db->Execute("UPDATE tblLocalIdentity SET InsertingTrustList='false', LastInsertedTrustList='"+now.Format("%Y-%m-%d %H:%M:%S")+"' WHERE LocalIdentityID="+idparts[1]+";");\r
m_db->Execute("INSERT INTO tblTrustListInserts(LocalIdentityID,Day,InsertIndex) VALUES("+idparts[1]+",'"+idparts[4]+"',"+idparts[2]+");");\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted TrustList xml");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListInserter::HandleMessage inserted TrustList xml");\r
return true;\r
}\r
\r
if(message.GetName()=="PutFailed")\r
{\r
m_db->Execute("UPDATE tblLocalIdentity SET InsertingTrustList='false' WHERE LocalIdentityID="+idparts[1]+";");\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failure inserting TrustList xml. Code="+message["Code"]+" Description="+message["CodeDescription"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListInserter::HandleMessage failure inserting TrustList xml. Code="+message["Code"]+" Description="+message["CodeDescription"]);\r
\r
// if code 9 (collision), then insert index into inserted table\r
if(message["Code"]=="9")\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed TrustList XML file : "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListRequester::HandleAllData parsed TrustList XML file : "+message["Identifier"]);\r
}\r
else\r
{\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing TrustList XML file : "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListRequester::HandleAllData error parsing TrustList XML file : "+message["Identifier"]);\r
}\r
\r
// remove this identityid from request list\r
st.Step();\r
st.Finalize();\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]);\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListRequester::HandleGetFailed fatal error requesting "+message["Identifier"]);\r
}\r
\r
// remove this identityid from request list\r
}\r
else\r
{\r
- m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__," malformed Trust in TrustList.xml");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListXML::ParseXML malformed Trust in TrustList.xml");\r
}\r
\r
node=node->NextSibling("Trust");\r
SaveKeys(id,message["RequestURI"],message["InsertURI"]);\r
}\r
\r
- m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" received keypair");\r
+ m_log->WriteLog(LogFile::LOGLEVEL_INFO,"UnkeyedIDCreator::HandleMessage received keypair");\r
\r
m_waiting=false;\r
\r
TrustListTrust INTEGER CHECK(TrustListTrust BETWEEN 0 AND 100)\\r
);");\r
\r
+ db->Execute("CREATE TABLE IF NOT EXISTS tblBoard(\\r
+ BoardID INTEGER PRIMARY KEY,\\r
+ BoardName TEXT UNIQUE,\\r
+ BoardDescription TEXT,\\r
+ DateAdded DATETIME\\r
+ );");\r
+\r
+ db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('fms','Freenet Message System','2007-12-01');");\r
+ db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('freenet','Discussion about Freenet','2007-12-01');");\r
+ db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('public','Public discussion','2007-12-01');");\r
+ db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('test','Test board','2007-12-01');");\r
+\r
+ db->Execute("CREATE TABLE IF NOT EXISTS tblMessage(\\r
+ MessageID INTEGER PRIMARY KEY,\\r
+ MessageDate DATE,\\r
+ MessageTime TIME,\\r
+ Subject TEXT,\\r
+ MessageUUID TEXT UNIQUE,\\r
+ ReplyBoardID INTEGER,\\r
+ Body TEXT\\r
+ );");\r
+\r
+ db->Execute("CREATE TABLE IF NOT EXISTS tblMessageReplyTo(\\r
+ MessageID INTEGER,\\r
+ ReplyToMessageID INTEGER,\\r
+ Order INTEGER\\r
+ );");\r
+ \r
+ db->Execute("CREATE TABLE IF NOT EXISTS tblMessageBoard(\\r
+ MessageID INTEGER,\\r
+ BoardID INTEGER\\r
+ );");\r
+\r
+ // low / high / message count for each board\r
+ db->Execute("CREATE VIEW IF NOT EXISTS vwBoardStats AS \\r
+ SELECT tblBoard.BoardID AS 'BoardID', IFNULL(MIN(MessageID),0) AS 'LowMessageID', IFNULL(MAX(MessageID),0) AS 'HighMessageID', COUNT(MessageID) AS 'MessageCount' \\r
+ FROM tblBoard LEFT JOIN tblMessageBoard ON tblBoard.BoardID=tblMessageBoard.BoardID \\r
+ GROUP BY tblBoard.BoardID;");\r
+\r
// calculates peer trust\r
db->Execute("CREATE VIEW IF NOT EXISTS vwCalculatedPeerTrust AS \\r
SELECT TargetIdentityID, \\r