version 0.2.11
[fms.git] / src / http / pages / insertedfilespage.cpp
diff --git a/src/http/pages/insertedfilespage.cpp b/src/http/pages/insertedfilespage.cpp
new file mode 100644 (file)
index 0000000..13abc3d
--- /dev/null
@@ -0,0 +1,48 @@
+#include "../../../include/http/pages/insertedfilespage.h"\r
+#include "../../../include/stringfunctions.h"\r
+#include "../../../include/option.h"\r
+\r
+#ifdef XMEM\r
+       #include <xmem.h>\r
+#endif\r
+\r
+const std::string InsertedFilesPage::GeneratePage(const std::string &method, const std::map<std::string,std::string> &queryvars)\r
+{\r
+       std::string content="<h2>Inserted Files</h2>";\r
+\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT Key,FileName,Size FROM tblFileInserts WHERE Key IS NOT NULL ORDER BY FileName");\r
+       st.Step();\r
+\r
+       std::string node="localhost";\r
+       Option::Instance()->Get("FCPHost",node);\r
+\r
+       while(st.RowReturned())\r
+       {\r
+               std::string key="";\r
+               std::string filename="";\r
+               std::string sizestr="";\r
+\r
+               st.ResultText(0,key);\r
+               st.ResultText(1,filename);\r
+               st.ResultText(2,sizestr);\r
+\r
+               content+="<a href=\"http://"+node+":8888/"+StringFunctions::UriEncode(key)+"\">"+SanitizeOutput(filename)+"</a> - "+sizestr+" bytes";\r
+               content+="<br>";\r
+\r
+               st.Step();\r
+       }\r
+\r
+       return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content);\r
+}\r
+\r
+const bool InsertedFilesPage::WillHandleURI(const std::string &uri)\r
+{\r
+       if(uri.find("insertedfiles.")!=std::string::npos)\r
+       {\r
+               return true;\r
+       }\r
+       else\r
+       {\r
+               return false;\r
+       }\r
+}\r