X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Finsertedfilespage.cpp;h=dbd27b0f51df7c537340f34d591877924e4802c9;hb=HEAD;hp=c9d46842bf1c3a2d1acb9828b9b2a9e2ffe36236;hpb=52581afffd81f5a71c129d87e3ac822d9522f12d;p=fms.git
diff --git a/src/http/pages/insertedfilespage.cpp b/src/http/pages/insertedfilespage.cpp
index c9d4684..dbd27b0 100644
--- a/src/http/pages/insertedfilespage.cpp
+++ b/src/http/pages/insertedfilespage.cpp
@@ -10,31 +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::Instance()->Get("FProxyPort",fproxyport);
+ 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+="";
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)