X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Finsertedfilespage.cpp;h=dbd27b0f51df7c537340f34d591877924e4802c9;hb=59a5414ec47a2932a7802fcd1d98c4d80166564f;hp=13abc3d9eab2cdf8a91ebe954221e33fff2bf065;hpb=63376b2a82c3f6cdf2df56b1f134bd7df0aaab3a;p=fms.git diff --git a/src/http/pages/insertedfilespage.cpp b/src/http/pages/insertedfilespage.cpp index 13abc3d..dbd27b0 100644 --- a/src/http/pages/insertedfilespage.cpp +++ b/src/http/pages/insertedfilespage.cpp @@ -10,29 +10,47 @@ const std::string InsertedFilesPage::GeneratePage(const std::string &method, con { std::string content="

Inserted Files

"; - SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName"); - st.Step(); - + Option option(m_db); std::string node="localhost"; - Option::Instance()->Get("FCPHost",node); + option.Get("FCPHost",node); + std::string fproxyport="8888"; + option.Get("FProxyPort",fproxyport); + + if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="removefile" && queryvars.find("fileid")!=queryvars.end() && ValidateFormPassword(queryvars)) + { + SQLite3DB::Statement del=m_db->Prepare("DELETE FROM tblFileInserts WHERE FileInsertID=?;"); + del.Bind(0,(*queryvars.find("fileid")).second); + del.Step(); + } + + SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size,FileInsertID FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName"); + st.Step(); while(st.RowReturned()) { std::string key=""; std::string filename=""; std::string sizestr=""; + std::string insertidstr=""; st.ResultText(0,key); st.ResultText(1,filename); st.ResultText(2,sizestr); + st.ResultText(3,insertidstr); - content+=""+SanitizeOutput(filename)+" - "+sizestr+" bytes"; + content+=""+SanitizeOutput(filename)+" - "+sizestr+" bytes"; + content+="
"; + content+=CreateFormPassword(); + content+=""; + content+=""; + content+=""; + content+="
"; content+="
"; st.Step(); } - return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content); + return StringFunctions::Replace(m_template,"[CONTENT]",content); } const bool InsertedFilesPage::WillHandleURI(const std::string &uri)