X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Flocalidentitiespage.cpp;fp=src%2Fhttp%2Fpages%2Flocalidentitiespage.cpp;h=821339de153032c41ae8f70f2ae7d13c58d4f2c5;hb=f208e33c29132aacaec448e74341edea1b925a2a;hp=0000000000000000000000000000000000000000;hpb=d8ccfe2b3944adf07d35534459cdda19d15217c8;p=fms.git diff --git a/src/http/pages/localidentitiespage.cpp b/src/http/pages/localidentitiespage.cpp new file mode 100644 index 0000000..821339d --- /dev/null +++ b/src/http/pages/localidentitiespage.cpp @@ -0,0 +1,139 @@ +#include "../../../include/http/pages/localidentitiespage.h" +#include "../../../include/stringfunctions.h" + +#ifdef XMEM + #include +#endif + +const std::string LocalIdentitiesPage::CreateTrueFalseDropDown(const std::string &name, const std::string &selected) +{ + std::string rval=""; + + rval+=""; + content+=""; + + 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;"); + st.Step(); + + count=0; + while(st.RowReturned()) + { + StringFunctions::Convert(count,countstr); + std::string id; + std::string name; + std::string publickey; + std::string publishtrustlist; + std::string singleuse; + + st.ResultText(0,id); + st.ResultText(1,name); + st.ResultText(2,publickey); + st.ResultText(3,publishtrustlist); + st.ResultText(4,singleuse); + + content+=""; + content+=""; + content+=""; + content+=""; + content+=""; + if(st.ResultNull(6)) + { + content+=""; + } + else + { + content+=""; + } + content+=""; + st.Step(); + count++; + } + + content+=""; + content+="
NameSingle UsePublish Trust ListAnnounced? *
"+name+""+CreateTrueFalseDropDown("singleuse["+countstr+"]",singleuse)+""+CreateTrueFalseDropDown("publishtrustlist["+countstr+"]",publishtrustlist)+"NoYes
"; + content+="

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

"; + + return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content); +} + +const bool LocalIdentitiesPage::WillHandleURI(const std::string &uri) +{ + if(uri.find("localidentities.")!=std::string::npos) + { + return true; + } + else + { + return false; + } +}