From dabd19d7f764b8275c9c8370c7b89675b6a78243 Mon Sep 17 00:00:00 2001 From: SomeDude Date: Sat, 23 Aug 2008 10:23:00 +0200 Subject: [PATCH] version 0.3.18 --- include/global.h | 4 +++- src/board.cpp | 8 ++++++-- src/dbsetup.cpp | 1 + src/freenet/captcha/alternatecaptcha2.cpp | 6 +++--- src/freenet/captcha/freeimage/bitmap.cpp | 1 + src/http/pages/homepage.cpp | 2 +- src/http/pages/localidentitiespage.cpp | 22 +++++++++++++++++++++- src/http/pages/peertrustpage.cpp | 4 ++-- src/optionssetup.cpp | 3 ++- 9 files changed, 40 insertions(+), 11 deletions(-) diff --git a/include/global.h b/include/global.h index 2a9478d..f2a9e56 100644 --- a/include/global.h +++ b/include/global.h @@ -7,8 +7,10 @@ #define VERSION_MAJOR "0" #define VERSION_MINOR "3" -#define VERSION_RELEASE "17" +#define VERSION_RELEASE "18" #define FMS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_RELEASE +#define FMS_FREESITE_USK "USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/78/" +#define FMS_VERSION_EDITION "19" typedef Poco::ScopedLock Guard; diff --git a/src/board.cpp b/src/board.cpp index e429c6c..2d05fed 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -58,7 +58,9 @@ const bool Board::Load(const long boardid) m_messagecount=0; m_addedmethod=""; - SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, AddedMethod FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardID=?;"); + // Optimize query by not using vwBoardStats + //SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, AddedMethod FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardID=?;"); + SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, IFNULL(MAX(MessageID),'0') AS HighMessageID, IFNULL(MIN(MessageID),'0') AS LowMessageID, COUNT(MessageID) AS MessageCount, SaveReceivedMessages, AddedMethod FROM tblBoard LEFT JOIN tblMessageBoard ON tblBoard.BoardID=tblMessageBoard.BoardID WHERE tblBoard.BoardID=? AND (MessageID IS NULL OR MessageID>=0);"); st.Bind(0,boardid); st.Step(); @@ -132,7 +134,9 @@ const bool Board::Load(const std::string &boardname) // same as loading form bo int tempint=-1; m_addedmethod=""; - SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, tblBoard.BoardID, AddedMethod FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardName=?;"); + // Optimize query by not using vwBoardStats + //SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, tblBoard.BoardID, AddedMethod FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardName=?;"); + SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, IFNULL(MAX(MessageID),'0') AS HighMessageID, IFNULL(MIN(MessageID),'0') AS LowMessageID, COUNT(MessageID) AS MessageCount, SaveReceivedMessages, tblBoard.BoardID, AddedMethod FROM tblBoard LEFT JOIN tblMessageBoard ON tblBoard.BoardID=tblMessageBoard.BoardID WHERE tblBoard.BoardName=? AND (MessageID IS NULL OR MessageID>=0);"); st.Bind(0,boardname); st.Step(); diff --git a/src/dbsetup.cpp b/src/dbsetup.cpp index b9f30be..2eb5403 100644 --- a/src/dbsetup.cpp +++ b/src/dbsetup.cpp @@ -16,6 +16,7 @@ void SetupDB() db->Open("fms.db3"); db->SetBusyTimeout(20000); // set timeout to 20 seconds + db->Execute("PRAGMA synchronous = FULL;"); db->Execute("CREATE TABLE IF NOT EXISTS tblDBVersion(\ Major INTEGER,\ diff --git a/src/freenet/captcha/alternatecaptcha2.cpp b/src/freenet/captcha/alternatecaptcha2.cpp index 7495f36..f63d525 100644 --- a/src/freenet/captcha/alternatecaptcha2.cpp +++ b/src/freenet/captcha/alternatecaptcha2.cpp @@ -67,14 +67,14 @@ void AlternateCaptcha2::Generate() // rotate and skew the big bitmap a few times int lastrot=0; int thisrot=0; - int numrots=(rand()%4)+4; + int numrots=(rand()%3)+4; for(int i=0; i +#include namespace FreeImage { diff --git a/src/http/pages/homepage.cpp b/src/http/pages/homepage.cpp index 9264ca1..3ebe2f1 100644 --- a/src/http/pages/homepage.cpp +++ b/src/http/pages/homepage.cpp @@ -71,7 +71,7 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m if(showgenericupdate) { - content+="Check for new versions at the FMS Freesite
"; + content+="Check for new versions at the FMS Freesite
"; } content+="Use these pages to administer your FMS installation."; diff --git a/src/http/pages/localidentitiespage.cpp b/src/http/pages/localidentitiespage.cpp index d4e0d44..400260f 100644 --- a/src/http/pages/localidentitiespage.cpp +++ b/src/http/pages/localidentitiespage.cpp @@ -37,6 +37,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID,tblLocalIdentity.Name,tblLocalIdentity.PublicKey,tbLLocalIdentity.PublishTrustList,tblLocalIdentity.SingleUse,tblLocalIdentity.PublishBoardList,tblIdentity.IdentityID,tblLocalIdentity.PublishFreesite,tblLocalIdentity.MinMessageDelay,tblLocalIdentity.MaxMessageDelay FROM tblLocalIdentity LEFT JOIN tblIdentity ON tblLocalIdentity.PublicKey=tblIdentity.PublicKey ORDER BY tblLocalIdentity.Name;"); st.Step(); + SQLite3DB::Statement st2=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey=?;"); SQLite3DB::Statement trustst=m_db->Prepare("SELECT COUNT(*) FROM tblPeerTrust LEFT JOIN tblIdentity ON tblPeerTrust.TargetIdentityID=tblIdentity.IdentityID WHERE tblIdentity.PublicKey=? GROUP BY tblPeerTrust.TargetIdentityID;"); @@ -53,6 +54,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c std::string publishfreesite=""; std::string minmessagedelay="0"; std::string maxmessagedelay="0"; + std::string identityidstr=""; st.ResultText(0,id); st.ResultText(1,name); @@ -64,8 +66,26 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c st.ResultText(8,minmessagedelay); st.ResultText(9,maxmessagedelay); + st2.Bind(0,publickey); + st2.Step(); + if(st2.RowReturned()) + { + st2.ResultText(0,identityidstr); + } + st2.Reset(); + content+=""; - content+="
"+CreateFormPassword()+""+SanitizeOutput(CreateShortIdentityName(name,publickey))+""; + content+=""+CreateFormPassword()+""; + if(identityidstr!="") + { + content+=""; + } + content+=SanitizeOutput(CreateShortIdentityName(name,publickey)); + if(identityidstr!="") + { + content+=""; + } + content+=""; content+=""+CreateTrueFalseDropDown("singleuse["+countstr+"]",singleuse)+""; content+=""+CreateTrueFalseDropDown("publishtrustlist["+countstr+"]",publishtrustlist)+""; content+=""+CreateTrueFalseDropDown("publishboardlist["+countstr+"]",publishboardlist)+""; diff --git a/src/http/pages/peertrustpage.cpp b/src/http/pages/peertrustpage.cpp index 3fee7ac..fe03c91 100644 --- a/src/http/pages/peertrustpage.cpp +++ b/src/http/pages/peertrustpage.cpp @@ -297,7 +297,7 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s // get count of identities we are showing sql="SELECT COUNT(*) FROM tblIdentity LEFT JOIN tblIdentityTrust ON tblIdentity.IdentityID=tblIdentityTrust.IdentityID "; - sql+="WHERE tblIdentity.Hidden='false' AND tblIdentityTrust.LocalIdentityID=?"; + sql+="WHERE tblIdentityTrust.LocalIdentityID=? AND tblIdentity.Hidden='false'"; if(namesearch!="") { sql+=" AND (Name LIKE '%' || ? || '%' OR PublicKey LIKE '%' || ? || '%')"; @@ -316,7 +316,7 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s sql="SELECT tblIdentity.IdentityID,Name,tblIdentityTrust.LocalMessageTrust,PeerMessageTrust,tblIdentityTrust.LocalTrustListTrust,PeerTrustListTrust,PublicKey,tblIdentityTrust.MessageTrustComment,tblIdentityTrust.TrustListTrustComment,COUNT(MessageID) AS 'MessageCount',tblIdentity.PublishTrustList "; sql+="FROM tblIdentity LEFT JOIN tblIdentityTrust ON tblIdentity.IdentityID=tblIdentityTrust.IdentityID LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID "; - sql+="WHERE tblIdentity.Hidden='false' AND tblIdentityTrust.LocalIdentityID=?"; + sql+="WHERE tblIdentityTrust.LocalIdentityID=? AND tblIdentity.Hidden='false'"; if(namesearch!="") { sql+=" AND (Name LIKE '%' || ? || '%' OR PublicKey LIKE '%' || ? || '%')"; diff --git a/src/optionssetup.cpp b/src/optionssetup.cpp index 91ddcbc..1f3562f 100644 --- a/src/optionssetup.cpp +++ b/src/optionssetup.cpp @@ -1,5 +1,6 @@ #include "../include/optionssetup.h" #include "../include/db/sqlite3db.h" +#include "../include/global.h" #include @@ -68,7 +69,7 @@ void SetupDefaultOptions() upd.Reset(); st.Bind(0,"FMSVersionEdition"); - st.Bind(1,"19"); + st.Bind(1,FMS_VERSION_EDITION); st.Step(); st.Reset(); upd.Bind(0,"Program"); -- 2.7.4