Commit c2ee8e93 authored by jan.koester's avatar jan.koester
Browse files

new api

parent fb1fc8b4
Loading
Loading
Loading
Loading
+14 −21
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ namespace blogi {

            if (ncount<1) {
                *condat << " </div>";
                std::string *out=new std::string;
                std::string out;
                page->getElementbyID("main")->insertChild(condat->parse());;
                Args->theme->printSite(out,page,curreq->getRequestURL(),Args->auth->isLoggedIn(curreq,sid),meta.c_str());

@@ -99,8 +99,8 @@ namespace blogi {
                resp.setVersion(HTTPVERSION(1.1));
                resp.setState(HTTP200);
                resp.setContentType("text/html");
                resp.send(curcon,out->c_str(),out->length());
                delete out;
                resp.send(curcon,out.c_str(),out.length());

                delete condat;
                return;
            }
@@ -148,7 +148,7 @@ namespace blogi {

                *condat << "</ul></div>";
            }
            std::string *out=new std::string;
            std::string out;


            page->getElementbyID("main")->insertChild(condat->parse());
@@ -161,8 +161,8 @@ namespace blogi {
            resp.setVersion(HTTPVERSION(1.1));
            resp.setState(HTTP200);
            resp.setContentType("text/html");
            resp.send(curcon,out->c_str(),out->length());
            delete out;
            resp.send(curcon,out.c_str(),out.length());
            out;
        };

        void contentPage(netplus::con* curcon, libhttppp::HttpRequest* curreq,libhtmlpp::HtmlElement &page) {
@@ -203,12 +203,11 @@ namespace blogi {
            << "<span class=\"author\">verfasst von " << res[0][3] << " am "<< res[0][4]  <<" </span>"
            << "</div></div>";

            std::string *out=new std::string;
            std::string out;

            try{
                page.getElementbyID("main")->insertChild(condat->parse());
            }catch(libhtmlpp::HTMLException &e){
                delete out;
                delete condat;
                excep[libhttppp::HTTPException::Error] << e.what();
                throw excep;
@@ -222,8 +221,7 @@ namespace blogi {
            resp.setVersion(HTTPVERSION(1.1));
            resp.setState(HTTP200);
            resp.setContentType("text/html");
            resp.send(curcon,out->c_str(),out->length());
            delete out;
            resp.send(curcon,out.c_str(),out.length());
        };

        void addPostPage(netplus::con *curcon,libhttppp::HttpRequest *curreq,libhtmlpp::HtmlElement &page){
@@ -360,7 +358,7 @@ namespace blogi {
            << "</form>"
            << "</div>";

            std::string *out = new std::string;
            std::string out;

            page.getElementbyID("main")->insertChild(condat.parse());

@@ -370,8 +368,7 @@ namespace blogi {
            resp.setVersion(HTTPVERSION(1.1));
            resp.setState(HTTP200);
            resp.setContentType("text/html");
            resp.send(curcon,out->c_str(),out->length());
            delete out;
            resp.send(curcon,out.c_str(),out.length());
        }

        void delPostPage(netplus::con* curcon, libhttppp::HttpRequest* curreq,libhtmlpp::HtmlElement &page) {
@@ -408,12 +405,11 @@ namespace blogi {

            condat << "<span>Beitrag geloescht</span>";

            std::string *out=new std::string;
            std::string out;

            try{
                page.getElementbyID("main")->insertChild(condat.parse());
            }catch(libhtmlpp::HTMLException &e){
                delete out;
                excep[libhttppp::HTTPException::Error] << e.what();
                throw excep;
            }
@@ -424,8 +420,7 @@ namespace blogi {
            resp.setVersion(HTTPVERSION(1.1));
            resp.setState(HTTP200);
            resp.setContentType("text/html");
            resp.send(curcon,out->c_str(),out->length());
            delete out;
            resp.send(curcon,out.c_str(),out.length());

        }

@@ -611,12 +606,11 @@ namespace blogi {
                << "</form>"
                << "</div>";
            };
            std::string *out=new std::string;
            std::string out;

            try{
                page.getElementbyID("main")->insertChild(condat.parse());
            }catch(libhtmlpp::HTMLException &e){
                delete out;
                excep[libhttppp::HTTPException::Error] << e.what();
                throw excep;
            }
@@ -626,8 +620,7 @@ namespace blogi {
            resp.setVersion(HTTPVERSION(1.1));
            resp.setState(HTTP200);
            resp.setContentType("text/html");
            resp.send(curcon,out->c_str(),out->length());
            delete out;
            resp.send(curcon,out.c_str(),out.length());
        }

        const char *getName(){
+2 −3
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ namespace blogi {

            condat << "</div>";

            std::string *out=new std::string,sid;
            std::string out,sid;
            page->getElementbyID("main")->insertChild(condat.parse());

            Args->theme->printSite(out,page,req->getRequestURL(),
@@ -141,8 +141,7 @@ namespace blogi {
            resp.setVersion(HTTPVERSION(1.1));
            resp.setState(HTTP200);
            resp.setContentType("text/html");
            resp.send(curcon,out->c_str(),out->length());
            delete out;
            resp.send(curcon,out.c_str(),out.length());
            return true;

        }
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ namespace blogi {
                if(strcmp(curdat->getKey(),"albumid")==0)
                    id=atoi(curdat->getValue());
                if(strcmp(curdat->getKey(),"albumname")==0)
                    libhtmlpp::HtmlEncode(curdat->getValue(),&name);
                    libhtmlpp::HtmlEncode(curdat->getValue(),name);
            }

            if(id<0){
+2 −3
Original line number Diff line number Diff line
@@ -322,7 +322,7 @@ namespace blogi {
                }

                libhtmlpp::HtmlString fileHtml;
                std::string *out=new std::string,sid;
                std::string out,sid;

                try{
                    RenderUI(path,ndir,fileHtml);
@@ -344,8 +344,7 @@ namespace blogi {
                curres.setVersion(HTTPVERSION(1.1));
                curres.setContentType("text/html");
                curres.setState(HTTP200);
                curres.send(curcon, out->c_str(),out->length());
                delete out;
                curres.send(curcon, out.c_str(),out.length());
            }catch(libhttppp::HTTPException &e){
                libhttppp::HttpResponse curres;
                curres.setVersion(HTTPVERSION(1.1));
+5 −7
Original line number Diff line number Diff line
@@ -114,15 +114,14 @@ namespace blogi {
            html.setAttribute("id","content");
            html.insertChild(&table);

            std::string *out=new std::string,sid,*systable=new std::string;
            std::string out,sid,systable;
            libhtmlpp::print(&html,systable);

            libhtmlpp::HtmlString *condat=new libhtmlpp::HtmlString();
            *condat << *systable;
            libhtmlpp::HtmlString condat;
            condat << systable;

            delete systable;

            page->getElementbyID("main")->insertChild(condat->parse());
            page->getElementbyID("main")->insertChild(condat.parse());

            Args->theme->printSite(out,page,req->getRequestURL(),
                                    Args->auth->isLoggedIn(req,sid));
@@ -133,8 +132,7 @@ namespace blogi {
            resp.setVersion(HTTPVERSION(1.1));
            resp.setState(HTTP200);
            resp.setContentType("text/html");
            resp.send(curcon,out->c_str(),out->length());
            delete out;
            resp.send(curcon,out.c_str(),out.length());
            return true;

        }
Loading