ADD_LIBRARY(sqlite3 libs/sqlite3/sqlite3.c)\r
TARGET_LINK_LIBRARIES(fms sqlite3)\r
INCLUDE_DIRECTORIES(libs/sqlite3)\r
+ IF(CMAKE_COMPILER_IS_GNUCC)\r
+ TARGET_LINK_LIBRARIES(fms dl)\r
+ ENDIF(CMAKE_COMPILER_IS_GNUCC)\r
ENDIF(SQLITE3_LIBRARY)\r
\r
IF(TINYXML_LIBRARY)\r
?>\r
<tr>\r
<td title="<?php print($record[6]); ?>">\r
- <?php print($record[1]); ?>\r
+ <?php \r
+ print($record[1]);\r
+ if($record[1]=='')\r
+ {\r
+ print("[Unknown Name]"); \r
+ }\r
+ ?>\r
<input type="hidden" name="identityid[]" value="<?php print($record[0]); ?>">\r
</td>\r
<td>\r
<input type="hidden" name="oldlocalmessagetrust[]" value="<?php print($record[2]); ?>">\r
<input type="text" name="newlocalmessagetrust[]" size="2" maxlength="3" value="<?php print($record[2]); ?>">\r
</td>\r
- <td><?php print($record[3]); ?></td>\r
+ <td>\r
+ <?php print($record[3]); ?>\r
+ </td>\r
<td>\r
<input type="hidden" name="oldlocaltrustlisttrust[]" value="<?php print($record[4]); ?>">\r
<input type="text" name="newlocaltrustlisttrust[]" size="2" maxlength="3" value="<?php print($record[4]); ?>">\r
print "<br>Type answers for a few puzzles and submit<br>";\r
\r
\r
- $st=$db->prepare("SELECT UUID,Day,IdentityID FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND Day>='".gmdate('Y-m-d',strtotime('-1 day'))."' AND Found='true' ORDER BY IdentityID, Day DESC, RequestIndex DESC;");\r
+ $st=$db->prepare("SELECT UUID,Day,IdentityID FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND UUID NOT IN (SELECT UUID FROM tblIntroductionPuzzleInserts) AND Day>='".gmdate('Y-m-d',strtotime('-1 day'))."' AND Found='true' ORDER BY IdentityID, Day DESC, RequestIndex DESC;");\r
$st->execute();\r
\r
// only show latest captcha for each known identity\r
#include "idatabase.h"\r
\r
//#include <zthread/Thread.h>\r
-#include "pthreadwrapper.h"\r
+#include "pthreadwrapper/runnable.h"\r
\r
class CommandThread:public PThread::Runnable,public ILogger, public IDatabase\r
{\r
\r
#include "../sqlite3db.h"\r
\r
+#if SQLITE_VERSION_NUMBER<3005000\r
+#error "Your version of SQLite is too old! 3.5.0 or later is required."\r
+#endif\r
+\r
namespace SQLite3DB\r
{\r
\r
long m_lastinsertrowid;\r
\r
static std::map<sqlite3_stmt *, long> m_statementcount;\r
- std::vector<char *> textptrs;\r
+ //std::vector<char *> textptrs;\r
+ std::vector<std::vector<char>> m_boundtext;\r
\r
}; //class\r
\r
//#include <zthread/Thread.h>\r
#include "pthreadwrapper/thread.h"\r
\r
-#define FMS_VERSION "0.1.3"\r
+#define FMS_VERSION "0.1.4"\r
\r
// opens database and creates tables and initial inserts if necessary\r
void SetupDB();\r
--- /dev/null
+#ifndef _pthread_wrapper_\r
+#define _pthread_wrapper_\r
+\r
+#include <exception>\r
+\r
+namespace PThread\r
+{\r
+ \r
+class DeadlockException:public std::exception\r
+{\r
+public:\r
+ const char *what() const { return "Deadlock Exception"; }\r
+};\r
+ \r
+} // namespace\r
+\r
+#endif // _pthread_wrapper_\r
#define _pthread_mutex_\r
\r
#include <pthread.h>\r
-#include <exception>\r
+#include "deadlockexception.h"\r
\r
namespace PThread\r
{\r
\r
private:\r
\r
- friend Thread;\r
+ friend class Thread;\r
Thread *m_thread;\r
\r
};\r
\r
Finalize();\r
\r
+ /*\r
std::vector<char *>::iterator i;\r
for(i=textptrs.begin(); i!=textptrs.end(); i++)\r
{\r
delete [] (*i);\r
}\r
}\r
+ */\r
}\r
\r
const bool Statement::Bind(const int column)\r
{\r
if(Valid() && column>=0 && column<m_parametercount)\r
{\r
- char *text=new char[value.size()+1];\r
- strncpy(text,value.c_str(),value.size());\r
- text[value.size()]=NULL;\r
- textptrs.push_back(text);\r
+ //char *text=new char[value.size()+1];\r
+ //strncpy(text,value.c_str(),value.size());\r
+ //text[value.size()]=NULL;\r
+ //textptrs.push_back(text);\r
+ \r
//ZThread::Guard<ZThread::Mutex> g(DB::instance()->m_mutex);\r
PThread::Guard g(DB::Instance()->m_mutex);\r
- if(sqlite3_bind_text(m_statement,column+1,text,value.size(),NULL)==SQLITE_OK)\r
+ m_boundtext.push_back(std::vector<char>(value.begin(),value.end()));\r
+ //if(sqlite3_bind_text(m_statement,column+1,text,value.size(),NULL)==SQLITE_OK)\r
+ if(sqlite3_bind_text(m_statement,column+1,&m_boundtext[m_boundtext.size()-1][0],m_boundtext[m_boundtext.size()-1].size(),NULL)==SQLITE_OK) \r
{\r
return true;\r
}\r
done=true;\r
}\r
*/\r
- for(int i=0; i<60,!IsCancelled(); i++)\r
+ for(int i=0; i<60 && !IsCancelled(); i++)\r
{\r
Sleep(1000);\r
}\r
if(message["Fatal"]=="true" || message["Code"]=="9")\r
{\r
m_db->Execute("DELETE FROM tblIdentityIntroductionInserts WHERE UUID='"+idparts[3]+"';");\r
+ // update the puzzle from the request table (set to not found) because we don't need it anymore and don't want to user tyring to solve it again\r
+ m_db->Execute("UPDATE tblIntroductionPuzzleRequests SET Found='false' WHERE UUID='"+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
\r
// insert SomeDude's public key\r
date.SetToGMTime();\r
-// db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"');");\r
+ //db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"');");\r
\r
}\r
\r
#include "../../include/pthreadwrapper/mutex.h"\r
#include <exception>\r
\r
+#ifndef _WIN32\r
+ #include <sys/errno.h>\r
+#endif\r
+\r
#ifdef XMEM\r
#include <xmem.h>\r
#endif\r
// deadlock - throw exception\r
if(rval==EDEADLK)\r
{\r
- throw std::exception("Mutex would deadlock!");\r
+ throw DeadlockException();\r
}\r
}\r
}\r