Loading src/blogi.cpp +14 −8 Original line number Diff line number Diff line Loading @@ -74,7 +74,9 @@ blogi::Blogi::Blogi(Config *blgcfg,netplus::socket *serversocket) : event(server PlgArgs->theme=new Template(tplcfg); Page = new libhtmlpp::HtmlPage; PlgArgs->theme->renderPage("index.html",Page,Index); MPage = new libhtmlpp::HtmlPage; PlgArgs->theme->renderPage("mobile.html",MPage,MIndex); BlogiPlg = new Plugin(); Loading @@ -91,6 +93,8 @@ blogi::Blogi::~Blogi(){ delete PlgArgs->database; delete BlogiPlg; delete PlgArgs; delete Page; delete MPage; } void blogi::Blogi::loginPage(netplus::con*curcon,libhttppp::HttpRequest *curreq){ Loading Loading @@ -125,9 +129,9 @@ void blogi::Blogi::loginPage(netplus::con*curcon,libhttppp::HttpRequest *curreq) libhtmlpp::HtmlElement *index = new libhtmlpp::HtmlElement; if(curreq->isMobile()) index=&MIndex; index=MIndex; else index=&Index; index=Index; if (!username || !password) { libhtmlpp::HtmlString condat; Loading Loading @@ -316,16 +320,16 @@ RETRY_REQUEST: return; } libhtmlpp::HtmlElement index; libhtmlpp::HtmlElement *index; if(req.isMobile()) index=&MIndex; index= new libhtmlpp::HtmlElement(MIndex); else index=&Index; index= new libhtmlpp::HtmlElement(Index);; if(!PlgArgs->theme->Controller(curcon,&req)){ for(blogi::Plugin::PluginData *curplg=BlogiPlg->getFirstPlugin(); curplg; curplg=curplg->getNextPlg()){ curplg->getInstace()->Rendering(&req,index); curplg->getInstace()->Rendering(&req,*index); } for(blogi::Plugin::PluginData *curplg=BlogiPlg->getFirstPlugin(); curplg; curplg=curplg->getNextPlg()){ Loading @@ -334,11 +338,13 @@ RETRY_REQUEST: url+="/"; url+=api->getName(); if(strncmp(req.getRequestURL(),url.c_str(),url.length())==0){ if(api->Controller(curcon,&req,index)) if(api->Controller(curcon,&req,index)){ delete index; return; } } } delete index; std::string *output=new std::string; libhtmlpp::HtmlString err; Loading src/blogi.h +2 −2 Original line number Diff line number Diff line Loading @@ -44,8 +44,8 @@ namespace blogi { private: Plugin *BlogiPlg; PluginArgs *PlgArgs; libhtmlpp::HtmlPage Page,MPage; libhtmlpp::HtmlElement Index,MIndex; libhtmlpp::HtmlPage *Page,*MPage; libhtmlpp::HtmlElement *Index,*MIndex; blogi::Config *BlogConfig; }; }; src/theme.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -109,31 +109,33 @@ blogi::Template::~Template(){ } void blogi::Template::renderPage(const char *name,libhtmlpp::HtmlPage& page, libhtmlpp::HtmlElement& index){ void blogi::Template::renderPage(const char *name,libhtmlpp::HtmlPage* page, libhtmlpp::HtmlElement* index){ std::string htmlfile=_Config.Theme; htmlfile.append("/"); htmlfile.append(name); std::ifstream fhfile(htmlfile); std::string temp,line; std::string *temp=new std::string,line; if (fhfile.is_open()){ while ( getline (fhfile,line) ){ temp.append(line); temp->append(line); } fhfile.close(); }else{ delete temp; return; } size_t pos=0; while( (pos=temp.find("${prefix}",pos)) < temp.length()){ temp.replace(pos,9,_Config.config->getprefix()); while( (pos=temp->find("${prefix}",pos)) < temp->length()){ temp->replace(pos,9,_Config.config->getprefix()); ++pos; } index=page.loadString(temp); index=page->loadString(temp); delete temp; } bool blogi::Template::Controller(netplus::con *curcon,libhttppp::HttpRequest *req){ Loading src/theme.h +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ namespace blogi { Template(TemplateConfig &config); ~Template(); void renderPage(const char *name,libhtmlpp::HtmlPage &page,libhtmlpp::HtmlElement &index); void renderPage(const char *name,libhtmlpp::HtmlPage *page,libhtmlpp::HtmlElement *index); bool Controller(netplus::con *curcon,libhttppp::HttpRequest *req); Loading Loading
src/blogi.cpp +14 −8 Original line number Diff line number Diff line Loading @@ -74,7 +74,9 @@ blogi::Blogi::Blogi(Config *blgcfg,netplus::socket *serversocket) : event(server PlgArgs->theme=new Template(tplcfg); Page = new libhtmlpp::HtmlPage; PlgArgs->theme->renderPage("index.html",Page,Index); MPage = new libhtmlpp::HtmlPage; PlgArgs->theme->renderPage("mobile.html",MPage,MIndex); BlogiPlg = new Plugin(); Loading @@ -91,6 +93,8 @@ blogi::Blogi::~Blogi(){ delete PlgArgs->database; delete BlogiPlg; delete PlgArgs; delete Page; delete MPage; } void blogi::Blogi::loginPage(netplus::con*curcon,libhttppp::HttpRequest *curreq){ Loading Loading @@ -125,9 +129,9 @@ void blogi::Blogi::loginPage(netplus::con*curcon,libhttppp::HttpRequest *curreq) libhtmlpp::HtmlElement *index = new libhtmlpp::HtmlElement; if(curreq->isMobile()) index=&MIndex; index=MIndex; else index=&Index; index=Index; if (!username || !password) { libhtmlpp::HtmlString condat; Loading Loading @@ -316,16 +320,16 @@ RETRY_REQUEST: return; } libhtmlpp::HtmlElement index; libhtmlpp::HtmlElement *index; if(req.isMobile()) index=&MIndex; index= new libhtmlpp::HtmlElement(MIndex); else index=&Index; index= new libhtmlpp::HtmlElement(Index);; if(!PlgArgs->theme->Controller(curcon,&req)){ for(blogi::Plugin::PluginData *curplg=BlogiPlg->getFirstPlugin(); curplg; curplg=curplg->getNextPlg()){ curplg->getInstace()->Rendering(&req,index); curplg->getInstace()->Rendering(&req,*index); } for(blogi::Plugin::PluginData *curplg=BlogiPlg->getFirstPlugin(); curplg; curplg=curplg->getNextPlg()){ Loading @@ -334,11 +338,13 @@ RETRY_REQUEST: url+="/"; url+=api->getName(); if(strncmp(req.getRequestURL(),url.c_str(),url.length())==0){ if(api->Controller(curcon,&req,index)) if(api->Controller(curcon,&req,index)){ delete index; return; } } } delete index; std::string *output=new std::string; libhtmlpp::HtmlString err; Loading
src/blogi.h +2 −2 Original line number Diff line number Diff line Loading @@ -44,8 +44,8 @@ namespace blogi { private: Plugin *BlogiPlg; PluginArgs *PlgArgs; libhtmlpp::HtmlPage Page,MPage; libhtmlpp::HtmlElement Index,MIndex; libhtmlpp::HtmlPage *Page,*MPage; libhtmlpp::HtmlElement *Index,*MIndex; blogi::Config *BlogConfig; }; };
src/theme.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -109,31 +109,33 @@ blogi::Template::~Template(){ } void blogi::Template::renderPage(const char *name,libhtmlpp::HtmlPage& page, libhtmlpp::HtmlElement& index){ void blogi::Template::renderPage(const char *name,libhtmlpp::HtmlPage* page, libhtmlpp::HtmlElement* index){ std::string htmlfile=_Config.Theme; htmlfile.append("/"); htmlfile.append(name); std::ifstream fhfile(htmlfile); std::string temp,line; std::string *temp=new std::string,line; if (fhfile.is_open()){ while ( getline (fhfile,line) ){ temp.append(line); temp->append(line); } fhfile.close(); }else{ delete temp; return; } size_t pos=0; while( (pos=temp.find("${prefix}",pos)) < temp.length()){ temp.replace(pos,9,_Config.config->getprefix()); while( (pos=temp->find("${prefix}",pos)) < temp->length()){ temp->replace(pos,9,_Config.config->getprefix()); ++pos; } index=page.loadString(temp); index=page->loadString(temp); delete temp; } bool blogi::Template::Controller(netplus::con *curcon,libhttppp::HttpRequest *req){ Loading
src/theme.h +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ namespace blogi { Template(TemplateConfig &config); ~Template(); void renderPage(const char *name,libhtmlpp::HtmlPage &page,libhtmlpp::HtmlElement &index); void renderPage(const char *name,libhtmlpp::HtmlPage *page,libhtmlpp::HtmlElement *index); bool Controller(netplus::con *curcon,libhttppp::HttpRequest *req); Loading