Commit 005a583a authored by jan.koester's avatar jan.koester
Browse files

test

parent 200d1bda
Loading
Loading
Loading
Loading
+3 −19
Changes for plugins/staticpage/static.cpp: 3 added lines, 19 removed lines.
Original line number Diff line number Diff line
@@ -516,7 +516,6 @@ bool blogi::StaticPage::Controller(const int tid,libhttppp::HttpRequest &req,lib
        std::string surl=req.getRequestURL().substr(Args->config->buildurl("staticpage/").length(),
                                                                                    req.getRequestURL().length()-Args->config->buildurl("staticpage/").length());

        libhtmlpp::HtmlString condat;
        libhttppp::HTTPException excep;

        dbpp::SQL sql;
@@ -530,24 +529,8 @@ bool blogi::StaticPage::Controller(const int tid,libhttppp::HttpRequest &req,lib
            throw excep;
        }

        libhtmlpp::HtmlString out;
        condat << "<div id=\"content\" class=\"staticpage\" >"
               << res[0][1]
               << "</div>";

        try {
            page->getElementbyID("main")->insertChild(condat.parse());
        } catch(libhtmlpp::HTMLException &e) {
            std::cerr << "staticpage: HTML error in '" << surl << "': " << e.what() << std::endl;
            // Retry with content as plain text so the page still displays something
            libhtmlpp::HtmlElement content("div");
            content.setAttribute("id","content");
            content.setAttribute("class","staticpage");
            if(res[0][1])
                content.appendChild(libhtmlpp::TextElement(res[0][1]));
            page->getElementbyID("main")->appendChild(content);
        }

        std::string text = res[0][1] ? res[0][1] : "";
        RenderPublished(tid, text, nullptr, *page);

         libhtmlpp::HtmlElement canon("link");
         std::stringstream href;
@@ -557,6 +540,7 @@ bool blogi::StaticPage::Controller(const int tid,libhttppp::HttpRequest &req,lib
         if(page->getElementbyTag("head"))
            page->getElementbyTag("head")->appendChild(canon);

        libhtmlpp::HtmlString out;
        Args->theme->printSite(tid,out,page,req.getRequestURL(),Args->auth->isLoggedIn(tid,req,sessionid),res[0][2]);

        libhttppp::HttpResponse resp;
+4 −1
Changes for src/edit.h: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -49,7 +49,10 @@ namespace blogi {
                void Renderer(
                    libhttppp::HttpRequest& curreq,
                    const int tid, const std::string &sessionid,const libhtmlpp::HtmlElement &index,
                    const std::string &rootEl
                    const std::string &rootEl,
                    Plugin *plugins = nullptr,
                    const std::string &publishTarget = "",
                    json_object *publishParams = nullptr
                );
                std::vector<std::string> getPluginNames() const;
                void JsonApi(const int tid, json_object *request, json_object *response, Plugin *plugins = nullptr);