X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Flocalidentitiespage.cpp;h=3fd3c48b8ba510a6c5ebb7be191f0287883bb27a;hb=14fff12d9df0ee30e2df4bf9d22c2e83065816df;hp=8b6afcb8ff317691ec4e01968db8866010e99753;hpb=8a0a83a78390f22f99d4487cda2569909dfbc28e;p=fms.git diff --git a/src/http/pages/localidentitiespage.cpp b/src/http/pages/localidentitiespage.cpp index 8b6afcb..3fd3c48 100644 --- a/src/http/pages/localidentitiespage.cpp +++ b/src/http/pages/localidentitiespage.cpp @@ -1,33 +1,12 @@ #include "../../../include/http/pages/localidentitiespage.h" #include "../../../include/stringfunctions.h" #include "../../../include/http/identityexportxml.h" +#include "../../../include/global.h" #ifdef XMEM #include #endif -const std::string LocalIdentitiesPage::CreateTrueFalseDropDown(const std::string &name, const std::string &selected) -{ - std::string rval=""; - - rval+=""; - content+=""; +// content+=""; +// content+=""; + content+="
NameSingle UsePublish Trust ListPublish Board ListPublish FreesiteAnnounced? *
"; 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()) { @@ -219,7 +200,6 @@ 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=""; @@ -231,18 +211,29 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c st.ResultText(5,publishboardlist); st.ResultText(7,publishfreesite); - if(publickey.size()>8) - { - keypart=publickey.substr(3,5); - } - 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+=""; @@ -251,14 +242,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);