Commit 23e7396f authored by jan.koester's avatar jan.koester
Browse files

allways made sessid

parent b7b12b9b
Loading
Loading
Loading
Loading
+25 −28
Original line number Diff line number Diff line
@@ -50,14 +50,13 @@ namespace blogi {
        ~Content(){
        };

        void contentIdxPage(const int tid,libhttppp::HttpRequest *curreq,libhtmlpp::HtmlElement *page,const char *tag,int start,int end){
        void contentIdxPage(const int tid,libhttppp::HttpRequest *curreq,libhtmlpp::HtmlElement *page,const char *tag,int start,int end,const char *sessionid){
            libhttppp::HTTPException excep;
            libhtmlpp::HtmlString condat;

            condat << "<div><div id=\"contentidx\">";

            char url[512];
            std::string sid;
            blogi::SQL sql;
            blogi::DBResult res;

@@ -83,7 +82,7 @@ namespace blogi {

            std::string meta;

            if(Args->auth->isLoggedIn(tid,curreq,sid)){
            if(Args->auth->isLoggedIn(tid,curreq,sessionid)){
                condat << "<div class=\"blog_adminmenu\">"
                << "<ul>"
                << "<li><a href=\""<< Args->config->buildurl("content/addpost",url,512) <<"\">Addpost</a></li>"
@@ -95,7 +94,7 @@ namespace blogi {
                condat << " </div>";
                libhtmlpp::HtmlString out;
                page->getElementbyID("main")->insertChild(condat.parse());
                Args->theme->printSite(tid,out,page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sid),meta.c_str());
                Args->theme->printSite(tid,out,page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sessionid),meta.c_str());

                libhttppp::HttpResponse resp;
                resp.setVersion(HTTPVERSION(1.1));
@@ -155,7 +154,7 @@ namespace blogi {
            if(page->getElementbyID("main"))
                page->getElementbyID("main")->insertChild(condat.parse());

            Args->theme->printSite(tid,out,page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sid),meta.c_str());
            Args->theme->printSite(tid,out,page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sessionid),meta.c_str());

            libhttppp::HttpResponse resp;
            resp.setVersion(HTTPVERSION(1.1));
@@ -164,12 +163,11 @@ namespace blogi {
            resp.send(curreq,out.c_str(),out.size());
        };

        void contentPage(const int tid,libhttppp::HttpRequest* curreq,libhtmlpp::HtmlElement &page) {
        void contentPage(const int tid,libhttppp::HttpRequest* curreq,libhtmlpp::HtmlElement &page,const char *sessionid) {
            libhttppp::HTTPException excep;
            libhtmlpp::HtmlString condat;

            char url[512];
            std::string sid;
            int cid;

            sscanf(curreq->getRequestURL(), Args->config->buildurl("content/read/%d",url,512),&cid);
@@ -187,7 +185,7 @@ namespace blogi {
            }

            condat << "<div id=\"content\">";
            if (Args->auth->isLoggedIn(tid,curreq,sid)) {
            if (Args->auth->isLoggedIn(tid,curreq,sessionid)) {
                condat << "<div class=\"blog_adminmenu\">"
                << "<ul>"
                << "<li><a href=\"" << Args->config->buildurl("content/edit/",url,512) << cid << "\">Bearbeiten</a></li>"
@@ -210,7 +208,7 @@ namespace blogi {
                throw excep;
            }

            Args->theme->printSite(tid,out,&page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sid));
            Args->theme->printSite(tid,out,&page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sessionid));

            libhttppp::HttpResponse resp;
            resp.setVersion(HTTPVERSION(1.1));
@@ -219,11 +217,10 @@ namespace blogi {
            resp.send(curreq,out.c_str(),out.size());
        };

        void addPostPage(const int tid,libhttppp::HttpRequest *curreq,libhtmlpp::HtmlElement &page){
            std::string sid;
        void addPostPage(const int tid,libhttppp::HttpRequest *curreq,libhtmlpp::HtmlElement &page,const char *sessionid){
            char url[512];

            if(!Args->auth->isLoggedIn(tid,curreq,sid)){
            if(!Args->auth->isLoggedIn(tid,curreq,sessionid)){
                libhttppp::HTTPException exp;
                exp[libhttppp::HTTPException::Error] << "Please login before!";
                throw exp;
@@ -265,7 +262,7 @@ namespace blogi {
                    blogi::DBResult ares,res;

                    std::string uid;
                    Args->session->getSessionData(sid.c_str(),"uid",uid);
                    Args->session->getSessionData(sessionid,"uid",uid);

                    asql << "SELECT id from users WHERE sid='"<< uid.c_str() <<"' LIMIT 1;";

@@ -357,7 +354,7 @@ namespace blogi {

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

            Args->theme->printSite(tid,out,&page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sid));
            Args->theme->printSite(tid,out,&page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sessionid));

            libhttppp::HttpResponse resp;
            resp.setVersion(HTTPVERSION(1.1));
@@ -366,11 +363,11 @@ namespace blogi {
            resp.send(curreq,out.c_str(),out.size());
        }

        void delPostPage(const int tid,libhttppp::HttpRequest* curreq,libhtmlpp::HtmlElement &page) {
        void delPostPage(const int tid,libhttppp::HttpRequest* curreq,libhtmlpp::HtmlElement &page,const char *sessionid) {
            std::string sid;
            char url[512];

            if(!Args->auth->isLoggedIn(tid,curreq,sid)){
            if(!Args->auth->isLoggedIn(tid,curreq,sessionid)){
                libhttppp::HTTPException exp;
                exp[libhttppp::HTTPException::Error] << "Please login before!";
                throw exp;
@@ -409,7 +406,7 @@ namespace blogi {
                throw excep;
            }

            Args->theme->printSite(tid,out,&page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sid));
            Args->theme->printSite(tid,out,&page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sessionid));

            libhttppp::HttpResponse resp;
            resp.setVersion(HTTPVERSION(1.1));
@@ -457,10 +454,10 @@ namespace blogi {
            }
        }

        void editPostPage(const int tid,libhttppp::HttpRequest* curreq,libhtmlpp::HtmlElement &page) {
            std::string sid;
        void editPostPage(const int tid,libhttppp::HttpRequest* curreq,libhtmlpp::HtmlElement &page,const char* sessionid) {

            char url[512];
            if (!Args->auth->isLoggedIn(tid,curreq,sid)) {
            if (!Args->auth->isLoggedIn(tid,curreq,sessionid)) {
                libhttppp::HTTPException exp;
                exp[libhttppp::HTTPException::Error] << "Please login before!";
                throw exp;
@@ -610,7 +607,7 @@ namespace blogi {
                excep[libhttppp::HTTPException::Error] << e.what();
                throw excep;
            }
            Args->theme->printSite(tid,out,&page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sid));
            Args->theme->printSite(tid,out,&page,curreq->getRequestURL(),Args->auth->isLoggedIn(tid,curreq,sessionid));

            libhttppp::HttpResponse resp;
            resp.setVersion(HTTPVERSION(1.1));
@@ -657,7 +654,7 @@ namespace blogi {
            return;
        }

        bool Controller(const int tid,libhttppp::HttpRequest * req,libhtmlpp::HtmlElement *page){
        bool Controller(const int tid,libhttppp::HttpRequest * req,libhtmlpp::HtmlElement *page,const char *sessionid){
            char url[512];

            const char *requ=req->getRequestURL();
@@ -673,13 +670,13 @@ namespace blogi {
            curl.push_back('\0');

            if (strncmp(curl.data(),Args->config->buildurl("content/addpost",url,512),strlen(Args->config->buildurl("content/addpost",url,512)))==0){
                    addPostPage(tid,req,*page);
                    addPostPage(tid,req,*page,sessionid);
            }else if (strncmp(curl.data(), Args->config->buildurl("content/read",url,512), strlen(Args->config->buildurl("content/read",url,512))) == 0) {
                    contentPage(tid,req,*page);
                    contentPage(tid,req,*page,sessionid);
            }else if (strncmp(curl.data(), Args->config->buildurl("content/edit",url,512), strlen(Args->config->buildurl("content/edit",url,512))) == 0) {
                    editPostPage(tid,req,*page);
                    editPostPage(tid,req,*page,sessionid);
            }else if (strncmp(curl.data(), Args->config->buildurl("content/del",url,512), strlen(Args->config->buildurl("content/del",url,512))) == 0) {
                    delPostPage(tid,req,*page);
                    delPostPage(tid,req,*page,sessionid);
            }else{
                int startpos = 0;
                libhttppp::HttpForm start;
@@ -697,9 +694,9 @@ namespace blogi {
                    tag.push_back('\0');
                    std::vector<char> utag;
                    dec.urlDecode(tag,utag);
                    contentIdxPage(tid,req,page,utag.data(),startpos,SITELIMIT);
                    contentIdxPage(tid,req,page,utag.data(),startpos,SITELIMIT,sessionid);
                 }else{
                    contentIdxPage(tid,req,page,nullptr,startpos,SITELIMIT);
                    contentIdxPage(tid,req,page,nullptr,startpos,SITELIMIT,sessionid);
                 }
            }
            return true;
+3 −3
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ namespace blogi {
            }
        }

        bool Controller(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement *page){
        bool Controller(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement *page,const char *sessionid){
            char url[512];
            if(strncmp(req->getRequestURL(),Args->config->buildurl("gamestatus",url,512),strlen(Args->config->buildurl("gamestatus",url,512)))!=0){
                return false;
@@ -134,11 +134,11 @@ namespace blogi {
            condat << "</div>";

            libhtmlpp::HtmlString out;
            std::string sid;

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

            Args->theme->printSite(tid,out,page,req->getRequestURL(),
                                    Args->auth->isLoggedIn(tid,req,sid));
                                    Args->auth->isLoggedIn(tid,req,sessionid));

            libhttppp::HttpResponse resp;
            resp.setVersion(HTTPVERSION(1.1));
+3 −3
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ namespace blogi {
            return;
        }

        void Rendering(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement* curpage){
        void Rendering(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement* curpage,const char *sessionid){
            blogi::SQL sql,sql2;
            blogi::DBResult res,res2;
            sql << "select id,name,container_id from navbar";
@@ -354,7 +354,7 @@ namespace blogi {
                   << "</div>";
        }

        void Settings(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlString &setdiv){
        void Settings(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlString &setdiv,const char *sessionid){
            char url[512];
            std::string surl,curl=req->getRequestURL();
            size_t urlen = curl.length();
@@ -418,7 +418,7 @@ SETTINGSINDEX:

        }

        bool Controller(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement *page){
        bool Controller(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement *page,const char *sessionid){
            return false;
        }
    };
+4 −4
Original line number Diff line number Diff line
@@ -146,13 +146,13 @@ namespace blogi {
            out<<"</ul></div>";
        }

        bool Controller(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement *page){
        bool Controller(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement *page,const char *sessionid){
            char url[512];
            if(strncmp(req->getRequestURL(),Args->config->buildurl("nginxfiler",url,512),strlen(Args->config->buildurl("nginxfiler",url,512)))!=0){
                return false;
            }

            std::string sid,path;
            std::string path;

            if(req->getRequestURL()+strlen(Args->config->buildurl("nginxfiler",url,512)))
                path=req->getRequestURL()+strlen(Args->config->buildurl("nginxfiler",url,512));
@@ -346,7 +346,7 @@ namespace blogi {
                    throw ee;
                }

                Args->theme->printSite(tid,out,page,req->getRequestURL(),Args->auth->isLoggedIn(tid,req,sid));
                Args->theme->printSite(tid,out,page,req->getRequestURL(),Args->auth->isLoggedIn(tid,req,sessionid));

                libhttppp::HttpResponse curres;
                curres.setVersion(HTTPVERSION(1.1));
@@ -357,7 +357,7 @@ namespace blogi {
                libhttppp::HttpResponse curres;
                libhtmlpp::HtmlString error,out;

                Args->theme->printSite(tid,out,page,req->getRequestURL(),Args->auth->isLoggedIn(tid,req,sid));
                Args->theme->printSite(tid,out,page,req->getRequestURL(),Args->auth->isLoggedIn(tid,req,sessionid));

                std::string enc;
                libhtmlpp::HtmlEncode(e.what(),enc);
+3 −3
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ namespace blogi {
        void initPlugin(){
        }

        bool Controller(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement *page){
        bool Controller(const int tid,libhttppp::HttpRequest *req,libhtmlpp::HtmlElement *page,const char* sessionid){
            char url[512];
            if(strncmp(req->getRequestURL(),Args->config->buildurl("nodeinfo",url,512),strlen(Args->config->buildurl("nodeinfo",url,512)))!=0){
                return false;
@@ -138,7 +138,7 @@ namespace blogi {
            html.insertChild(&table);

            libhtmlpp::HtmlString out,systable;
            std::string sid;

            libhtmlpp::print(&html,systable);

            condat << systable;
@@ -146,7 +146,7 @@ namespace blogi {
            page->getElementbyID("main")->insertChild(condat.parse());

            Args->theme->printSite(tid,out,page,req->getRequestURL(),
                                    Args->auth->isLoggedIn(tid,req,sid));
                                    Args->auth->isLoggedIn(tid,req,sessionid));

            #endif

Loading