X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Flocalidentitiespage.cpp;h=8b26238ff2e436ba7ac4c002ac674e51bf8dbd7c;hb=b4f4686250878cdf4fcb2986a2ea6546cba867d1;hp=8d5ab480c3f68872c8db146ec629cabca557b4ed;hpb=befd91205eff729a182f66de15374a577a8718f7;p=fms.git diff --git a/src/http/pages/localidentitiespage.cpp b/src/http/pages/localidentitiespage.cpp index 8d5ab48..8b26238 100644 --- a/src/http/pages/localidentitiespage.cpp +++ b/src/http/pages/localidentitiespage.cpp @@ -1,6 +1,7 @@ #include "../../../include/http/pages/localidentitiespage.h" #include "../../../include/stringfunctions.h" #include "../../../include/http/identityexportxml.h" +#include "../../../include/global.h" #ifdef XMEM #include @@ -41,15 +42,17 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c std::vector singleuse; std::vector publishtrustlist; std::vector publishboardlist; + std::vector publishfreesite; CreateArgArray(queryvars,"chkidentityid",ids); CreateArgArray(queryvars,"singleuse",singleuse); CreateArgArray(queryvars,"publishtrustlist",publishtrustlist); CreateArgArray(queryvars,"publishboardlist",publishboardlist); + CreateArgArray(queryvars,"publishfreesite",publishfreesite); if((*queryvars.find("formaction")).second=="update") { - SQLite3DB::Statement update=m_db->Prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=?, PublishBoardList=? WHERE LocalIdentityID=?;"); + SQLite3DB::Statement update=m_db->Prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=?, PublishBoardList=?, PublishFreesite=? WHERE LocalIdentityID=?;"); for(int i=0; iPrepare("SELECT Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList FROM tblLocalIdentity WHERE PublicKey IS NOT NULL AND PrivateKey IS NOT NULL;"); + 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;"); exp.Step(); while(exp.RowReturned()) { @@ -92,6 +96,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c bool singleuse=false; bool publishtrustlist=false; bool publishboardlist=false; + bool publishfreesite=false; exp.ResultText(0,name); exp.ResultText(1,publickey); @@ -111,8 +116,13 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c { publishboardlist=true; } + exp.ResultText(6,tempval); + if(tempval=="true") + { + publishfreesite=true; + } - xml.AddIdentity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist); + xml.AddIdentity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist,publishfreesite); exp.Step(); } @@ -125,7 +135,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c IdentityExportXML xml; if(xml.ParseXML((*queryvars.find("file")).second)) { - SQLite3DB::Statement imp=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList) VALUES(?,?,?,?,?,?);"); + SQLite3DB::Statement imp=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList,PublishFreesite) VALUES(?,?,?,?,?,?,?);"); for(int i=0; i"; - content+=""; - content+=""; +// content+=""; +// content+=""; + content+="
NameSingle UsePublish Trust ListPublish Board ListAnnounced? *
"; - 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;"); + 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;"); st.Step(); + 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;"); + count=0; while(st.RowReturned()) { @@ -201,8 +222,8 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c std::string publickey=""; std::string publishtrustlist=""; std::string singleuse=""; - std::string keypart=""; std::string publishboardlist=""; + std::string publishfreesite=""; st.ResultText(0,id); st.ResultText(1,name); @@ -210,18 +231,31 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c st.ResultText(3,publishtrustlist); st.ResultText(4,singleuse); st.ResultText(5,publishboardlist); - - if(publickey.size()>8) - { - keypart=publickey.substr(3,5); - } + st.ResultText(7,publishfreesite); content+=""; - content+=""; - content+=""; +// content+=""; + content+=""; content+=""; content+=""; content+=""; + content+=""; + + trustst.Bind(0,publickey); + trustst.Step(); + if(trustst.RowReturned()) + { + std::string numlists=""; + trustst.ResultText(0,numlists); + content+=""; + } + else + { + content+=""; + } + trustst.Reset(); + +/* if(st.ResultNull(6)) { content+=""; @@ -230,14 +264,18 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c { content+=""; } +*/ + + content+=""; + content+=""; content+=""; st.Step(); count++; } - content+=""; +// content+=""; content+="
NameSingle UsePublish Trust ListPublish Board ListPublish FreesiteAnnounced? *
"+SanitizeOutput(name+keypart)+"..."+SanitizeOutput(CreateShortIdentityName(name,publickey))+""+CreateTrueFalseDropDown("singleuse["+countstr+"]",singleuse)+""+CreateTrueFalseDropDown("publishtrustlist["+countstr+"]",publishtrustlist)+""+CreateTrueFalseDropDown("publishboardlist["+countstr+"]",publishboardlist)+""+CreateTrueFalseDropDown("publishfreesite["+countstr+"]",publishfreesite)+"Yes ("+numlists+")NoNoYes
"; - content+="

* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity.

"; + content+="

* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity. The number in parenthesis is how many trust lists that identity appears in.

"; content+="

Single Use Identities will automatically be deleted 7 days after creation.

"; return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content);