#include "../../../include/http/pages/localidentitiespage.h"\r
#include "../../../include/stringfunctions.h"\r
#include "../../../include/http/identityexportxml.h"\r
+#include "../../../include/global.h"\r
\r
#ifdef XMEM\r
#include <xmem.h>\r
std::vector<std::string> singleuse;\r
std::vector<std::string> publishtrustlist;\r
std::vector<std::string> publishboardlist;\r
+ std::vector<std::string> publishfreesite;\r
\r
CreateArgArray(queryvars,"chkidentityid",ids);\r
CreateArgArray(queryvars,"singleuse",singleuse);\r
CreateArgArray(queryvars,"publishtrustlist",publishtrustlist);\r
CreateArgArray(queryvars,"publishboardlist",publishboardlist);\r
+ CreateArgArray(queryvars,"publishfreesite",publishfreesite);\r
\r
if((*queryvars.find("formaction")).second=="update")\r
{\r
- SQLite3DB::Statement update=m_db->Prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=?, PublishBoardList=? WHERE LocalIdentityID=?;");\r
+ SQLite3DB::Statement update=m_db->Prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=?, PublishBoardList=?, PublishFreesite=? WHERE LocalIdentityID=?;");\r
for(int i=0; i<ids.size(); i++)\r
{\r
if(ids[i]!="")\r
update.Bind(0,singleuse[i]);\r
update.Bind(1,publishtrustlist[i]);\r
update.Bind(2,publishboardlist[i]);\r
- update.Bind(3,id);\r
+ update.Bind(3,publishfreesite[i]);\r
+ update.Bind(4,id);\r
update.Step();\r
update.Reset();\r
}\r
if((*queryvars.find("formaction")).second=="export")\r
{\r
IdentityExportXML xml;\r
- SQLite3DB::Statement exp=m_db->Prepare("SELECT Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList FROM tblLocalIdentity WHERE PublicKey IS NOT NULL AND PrivateKey IS NOT NULL;");\r
+ 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;");\r
exp.Step();\r
while(exp.RowReturned())\r
{\r
bool singleuse=false;\r
bool publishtrustlist=false;\r
bool publishboardlist=false;\r
+ bool publishfreesite=false;\r
\r
exp.ResultText(0,name);\r
exp.ResultText(1,publickey);\r
{\r
publishboardlist=true;\r
}\r
+ exp.ResultText(6,tempval);\r
+ if(tempval=="true")\r
+ {\r
+ publishfreesite=true;\r
+ }\r
\r
- xml.AddIdentity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist);\r
+ xml.AddIdentity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist,publishfreesite);\r
\r
exp.Step();\r
}\r
IdentityExportXML xml;\r
if(xml.ParseXML((*queryvars.find("file")).second))\r
{\r
- SQLite3DB::Statement imp=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList) VALUES(?,?,?,?,?,?);");\r
+ SQLite3DB::Statement imp=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList,PublishFreesite) VALUES(?,?,?,?,?,?,?);");\r
for(int i=0; i<xml.GetCount(); i++)\r
{\r
std::string tempval="false";\r
tempval="false";\r
}\r
imp.Bind(5,tempval);\r
+ if(xml.GetPublishFreesite(i))\r
+ {\r
+ tempval="true";\r
+ }\r
+ else\r
+ {\r
+ tempval="false";\r
+ }\r
+ imp.Bind(6,tempval);\r
imp.Step();\r
imp.Reset();\r
}\r
\r
content+="<hr>";\r
\r
- content+="<form name=\"frmlocalidentity\" method=\"POST\">";\r
- content+="<input type=\"hidden\" name=\"formaction\" value=\"update\">";\r
- content+="<table><tr><td></td><th>Name</th><th>Single Use</th><th>Publish Trust List</th><th>Publish Board List</th><th>Announced? *</th></tr>";\r
+// content+="<form name=\"frmlocalidentity\" method=\"POST\">";\r
+// content+="<input type=\"hidden\" name=\"formaction\" value=\"update\">";\r
+ content+="<table><tr><th>Name</th><th>Single Use</th><th>Publish Trust List</th><th>Publish Board List</th><th>Publish Freesite</th><th>Announced? *</th></tr>";\r
\r
- 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;");\r
+ 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;");\r
st.Step();\r
\r
+ 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;");\r
+\r
count=0;\r
while(st.RowReturned())\r
{\r
std::string publickey="";\r
std::string publishtrustlist="";\r
std::string singleuse="";\r
- std::string keypart="";\r
std::string publishboardlist="";\r
+ std::string publishfreesite="";\r
\r
st.ResultText(0,id);\r
st.ResultText(1,name);\r
st.ResultText(3,publishtrustlist);\r
st.ResultText(4,singleuse);\r
st.ResultText(5,publishboardlist);\r
-\r
- if(publickey.size()>8)\r
- {\r
- keypart=publickey.substr(3,5);\r
- }\r
+ st.ResultText(7,publishfreesite);\r
\r
content+="<tr>";\r
- content+="<td><input type=\"checkbox\" name=\"chkidentityid["+countstr+"]\" value=\""+id+"\"></td>";\r
- content+="<td title=\""+publickey+"\">"+SanitizeOutput(name+keypart)+"...</td>";\r
+// content+="<td><input type=\"checkbox\" name=\"chkidentityid["+countstr+"]\" value=\""+id+"\"></td>";\r
+ content+="<td title=\""+publickey+"\"><form name=\"frmupdate\""+countstr+"\" method=\"POST\"><input type=\"hidden\" name=\"formaction\" value=\"update\"><input type=\"hidden\" name=\"chkidentityid["+countstr+"]\" value=\""+id+"\">"+SanitizeOutput(CreateShortIdentityName(name,publickey))+"</td>";\r
content+="<td>"+CreateTrueFalseDropDown("singleuse["+countstr+"]",singleuse)+"</td>";\r
content+="<td>"+CreateTrueFalseDropDown("publishtrustlist["+countstr+"]",publishtrustlist)+"</td>";\r
content+="<td>"+CreateTrueFalseDropDown("publishboardlist["+countstr+"]",publishboardlist)+"</td>";\r
+ content+="<td>"+CreateTrueFalseDropDown("publishfreesite["+countstr+"]",publishfreesite)+"</td>";\r
+ \r
+ trustst.Bind(0,publickey);\r
+ trustst.Step();\r
+ if(trustst.RowReturned())\r
+ {\r
+ std::string numlists="";\r
+ trustst.ResultText(0,numlists);\r
+ content+="<td>Yes ("+numlists+")</td>";\r
+ }\r
+ else\r
+ {\r
+ content+="<td>No</td>";\r
+ }\r
+ trustst.Reset();\r
+\r
+/*\r
if(st.ResultNull(6))\r
{\r
content+="<td>No</td>";\r
{\r
content+="<td>Yes</td>";\r
}\r
+*/\r
+\r
+ content+="<td><input type=\"submit\" value=\"Update\"></form></td>";\r
+ content+="<td><form name=\"frmdel\""+countstr+"\" method=\"POST\"><input type=\"hidden\" name=\"formaction\" value=\"delete\"><input type=\"hidden\" name=\"chkidentityid["+countstr+"]\" value=\""+id+"\"><input type=\"submit\" value=\"Delete\"></form></td>";\r
content+="</tr>";\r
st.Step();\r
count++;\r
}\r
\r
- content+="<tr><td colspan=\"5\"><center><input type=\"submit\" value=\"Update Selected\"> <input type=\"submit\" value=\"Delete Selected\" onClick=\"if(confirm('Delete Selected Identities?')){frmlocalidentity.formaction.value='delete';}else{return false;}\"></td></tr>";\r
+// content+="<tr><td colspan=\"5\"><center><input type=\"submit\" value=\"Update Selected\"> <input type=\"submit\" value=\"Delete Selected\" onClick=\"if(confirm('Delete Selected Identities?')){frmlocalidentity.formaction.value='delete';}else{return false;}\"></td></tr>";\r
content+="</table>";\r
- content+="<p class=\"paragraph\">* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity.</p>";\r
+ content+="<p class=\"paragraph\">* 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.</p>";\r
content+="<p class=\"paragraph\">Single Use Identities will automatically be deleted 7 days after creation.</p>";\r
\r
return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content);\r