#include "../../../include/http/pages/announceidentitypage.h"\r
#include "../../../include/stringfunctions.h"\r
#include "../../../include/datetime.h"\r
+#include "../../../include/global.h"\r
\r
#ifdef XMEM\r
#include <xmem.h>\r
st.ResultText(1,name);\r
st.ResultText(2,pubkey);\r
\r
- rval+="<option value=\""+id+"\" title=\""+pubkey+"\">"+name+"</option>";\r
+ rval+="<option value=\""+id+"\" title=\""+pubkey+"\">"+SanitizeOutput(CreateShortIdentityName(name,pubkey))+"</option>";\r
st.Step();\r
}\r
rval+="</select>";\r
std::string lastid="";\r
std::string thisid="";\r
std::string day="";\r
+ int requestindex=0;\r
+ bool willshow=false;\r
\r
if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="announce")\r
{\r
content+="<tr><td colspan=\"4\"><center>Select Identity : ";\r
content+=CreateLocalIdentityDropDown("localidentityid","");\r
content+="</td></tr>";\r
- content+="<tr><td colspan=\"4\"><center>Type the answers of a few puzzles</td></tr>";\r
+ content+="<tr><td colspan=\"4\"><center>Type the answers of a few puzzles. The puzzles are case sensitive. Getting announced will take some time. DO NOT continuously solve captchas. Solve 30 at most, wait a day, and if your identity has not been announced, repeat until it is.</td></tr>";\r
content+="<tr>";\r
\r
- //TODO if we are already inserting a solution for an identity - we shouldn't select any puzzles that are older than the one we are inserting\r
\r
date.SetToGMTime();\r
date.Add(0,0,0,-1);\r
- SQLite3DB::Statement st=m_db->Prepare("SELECT UUID,Day,IdentityID FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND UUID NOT IN (SELECT UUID FROM tblIntroductionPuzzleInserts) AND Day>='"+date.Format("%Y-%m-%d")+"' AND Found='true' ORDER BY IdentityID, Day DESC, RequestIndex DESC;");\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT UUID,Day,IdentityID,RequestIndex FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND UUID NOT IN (SELECT UUID FROM tblIntroductionPuzzleInserts) AND Day>='"+date.Format("%Y-%m-%d")+"' AND Found='true' ORDER BY IdentityID, Day DESC, RequestIndex DESC;");\r
st.Step();\r
\r
if(st.RowReturned()==false)\r
st.ResultText(0,uuid);\r
st.ResultText(1,day);\r
st.ResultText(2,thisid);\r
+ st.ResultInt(3,requestindex);\r
+\r
+ // if we are already inserting a solution for an identity - we shouldn't show any puzzles that are older than the one we are inserting\r
+ // get the last index # we are inserting this day from this identity\r
+ // if the index here is greater than the index in the st statement, we will skip this puzzle because we are already inserting a puzzle with a greater index\r
+ willshow=true;\r
+ SQLite3DB::Statement st2=m_db->Prepare("SELECT MAX(RequestIndex) FROM tblIdentityIntroductionInserts INNER JOIN tblIntroductionPuzzleRequests ON tblIdentityIntroductionInserts.UUID=tblIntroductionPuzzleRequests.UUID WHERE tblIdentityIntroductionInserts.Day=? AND tblIdentityIntroductionInserts.UUID IN (SELECT UUID FROM tblIntroductionPuzzleRequests WHERE IdentityID=? AND Day=?) GROUP BY tblIdentityIntroductionInserts.Day;");\r
+ st2.Step();\r
+ if(st2.RowReturned()==true)\r
+ {\r
+ int index=0;\r
+ st2.ResultInt(0,index);\r
+ if(index>=requestindex)\r
+ {\r
+ willshow=false;\r
+ }\r
+ }\r
\r
- if(thisid!=lastid)\r
+ if(willshow && thisid!=lastid)\r
{\r
StringFunctions::Convert(shown,countstr);\r
if(shown>0 && shown%4==0)\r
content+="<input type=\"hidden\" name=\"day["+countstr+"]\" value=\""+day+"\">";\r
content+="<input type=\"text\" name=\"solution["+countstr+"]\">";\r
content+="</td>\r\n";\r
- thisid=lastid;\r
+ lastid=thisid;\r
shown++;\r
}\r
\r