X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Ffmshttprequesthandlerfactory.cpp;h=84952d295c11c7f6c85adfedd32e96016ab0012a;hb=56f67ecca96efc7b72d03c95c8c42cfb66e31468;hp=e91fb518fe8220ff29673ff51f4e750d43dedcf4;hpb=fcb124f8d6d3f5678e82049fb8e5e23c8cfaec6d;p=fms.git
diff --git a/src/http/fmshttprequesthandlerfactory.cpp b/src/http/fmshttprequesthandlerfactory.cpp
index e91fb51..84952d2 100644
--- a/src/http/fmshttprequesthandlerfactory.cpp
+++ b/src/http/fmshttprequesthandlerfactory.cpp
@@ -18,12 +18,17 @@
#include "../../include/http/pages/peertrustpage.h"
#include "../../include/http/pages/versioninfopage.h"
#include "../../include/http/pages/recentlyaddedpage.h"
+#include "../../include/http/pages/forummainpage.h"
+#include "../../include/http/pages/showimagepage.h"
+#include "../../include/http/pages/forumthreadspage.h"
+#include "../../include/http/pages/forumviewthreadpage.h"
+#include "../../include/http/pages/forumcreatepostpage.h"
FMSHTTPRequestHandlerFactory::FMSHTTPRequestHandlerFactory()
{
// set template
std::string templatestr="
Home
Could not open template.htm! Place in program directory and restart!
[CONTENT]";
- FILE *infile=fopen("template.htm","r+b");
+ FILE *infile=fopen("template.htm","rb");
if(infile)
{
fseek(infile,0,SEEK_END);
@@ -39,6 +44,24 @@ FMSHTTPRequestHandlerFactory::FMSHTTPRequestHandlerFactory()
m_log->error("HTTPThread::HTTPThread could not open template.htm");
}
+ // load forum template
+ std::string forumtemplate="Home
Could not open forum-template.htm! Place in program directory and restart!
[CONTENT]";
+ infile=fopen("forum-template.htm","rb");
+ if(infile)
+ {
+ fseek(infile,0,SEEK_END);
+ long len=ftell(infile);
+ std::vector data(len,0);
+ fseek(infile,0,SEEK_SET);
+ fread(&data[0],1,len,infile);
+ fclose(infile);
+ forumtemplate.assign(data.begin(),data.end());
+ }
+ else
+ {
+ m_log->error("HTTPThread::HTTPThread could not open forum-template.htm");
+ }
+
// push back page handlers
m_pagehandlers.push_back(new OptionsPage(templatestr));
m_pagehandlers.push_back(new CreateIdentityPage(templatestr));
@@ -56,6 +79,11 @@ FMSHTTPRequestHandlerFactory::FMSHTTPRequestHandlerFactory()
m_pagehandlers.push_back(new PeerTrustPage(templatestr));
m_pagehandlers.push_back(new VersionInfoPage(templatestr));
m_pagehandlers.push_back(new RecentlyAddedPage(templatestr));
+ m_pagehandlers.push_back(new ShowImagePage());
+ m_pagehandlers.push_back(new ForumMainPage(forumtemplate));
+ m_pagehandlers.push_back(new ForumThreadsPage(forumtemplate));
+ m_pagehandlers.push_back(new ForumViewThreadPage(forumtemplate));
+ m_pagehandlers.push_back(new ForumCreatePostPage(forumtemplate));
// homepage must be last - catch all page handler
m_pagehandlers.push_back(new HomePage(templatestr));