X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Ffmshttprequesthandlerfactory.cpp;h=84952d295c11c7f6c85adfedd32e96016ab0012a;hb=f2545574af789b63fc655decfe31a3d9f1b30504;hp=8d89baac0abb5aeda2da2a5d6b711c3bc19dd032;hpb=4855de56590e2f27d39036922339992c96bce9d1;p=fms.git diff --git a/src/http/fmshttprequesthandlerfactory.cpp b/src/http/fmshttprequesthandlerfactory.cpp index 8d89baa..84952d2 100644 --- a/src/http/fmshttprequesthandlerfactory.cpp +++ b/src/http/fmshttprequesthandlerfactory.cpp @@ -17,12 +17,18 @@ #include "../../include/http/pages/peermaintenancepage.h" #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); @@ -38,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)); @@ -54,6 +78,12 @@ FMSHTTPRequestHandlerFactory::FMSHTTPRequestHandlerFactory() m_pagehandlers.push_back(new PeerMaintenancePage(templatestr)); 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));