Commit 3dccd6de authored by jan.koester's avatar jan.koester
Browse files

fixed

parent fb062b12
Loading
Loading
Loading
Loading
+3 −1
Changes for plugins/contact/contact.cpp: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -49,7 +49,9 @@ namespace blogi {
    public:

        void initPlugin(){
            _Receiver=Args->config->getValue(Args->config->getKey("/BLOGI/CONTACT/RECEIVER"),0);

            getConfig(*Args->database[0],"CONTACTRECIVER",_Receiver);

            std::cout << "contact plugin loaded" <<std::endl;
        }

+6 −6
Changes for src/blogi.cpp: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -65,12 +65,6 @@ blogi::Blogi::Blogi(Config *blgcfg,netplus::socket *serversocket,bool debug) : H
    PlgArgs = new PluginArgs;
    PlgArgs->debug=debug;
    PlgArgs->config=blgcfg;
    PlgArgs->smtp=new SmtpSettings;
    PlgArgs->smtp->_SHost=blgcfg->getValue(blgcfg->getKey("/BLOGI/SMTP/ADDR"),0);
    PlgArgs->smtp->_SPort=blgcfg->getIntValue(blgcfg->getKey("/BLOGI/SMTP/PORT"),0);
    PlgArgs->smtp->_SUser=blgcfg->getValue(blgcfg->getKey("/BLOGI/SMTP/USER"),0);
    PlgArgs->smtp->_SPass=blgcfg->getValue(blgcfg->getKey("/BLOGI/SMTP/PASS"),0);
    PlgArgs->smtp->_Sender=blgcfg->getValue(blgcfg->getKey("/BLOGI/SMTP/SENDER"),0);

    PlgArgs->database=new dbpp::Database*[threads];

@@ -88,6 +82,12 @@ blogi::Blogi::Blogi(Config *blgcfg,netplus::socket *serversocket,bool debug) : H

    }

    PlgArgs->smtp=new SmtpSettings;
    getConfig(*PlgArgs->database[0],"SMTPADDR",PlgArgs->smtp->_SHost);
    getConfig(*PlgArgs->database[0],"SMTPPORT",PlgArgs->smtp->_SPort);
    getConfig(*PlgArgs->database[0],"SMTPPASS",PlgArgs->smtp->_SPass);
    getConfig(*PlgArgs->database[0],"SMTPSENDER",PlgArgs->smtp->_Sender);

    PlgArgs->auth=new Auth(PlgArgs->database,PlgArgs->config);
    PlgArgs->edit=new Editor(PlgArgs->config);

−36
Changes for src/conf.cpp: 0 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -64,22 +64,6 @@ blogi::Config::Config(const char *path) : confplus::Config(path){
    else
        _MaxCon=-1;

    try{
        _RedisHost=getValue(getKey("/BLOGI/REDIS/HOST"),0);
        _RedisPassword=getValue(getKey("/BLOGI/REDIS/PASSWORD"),0);
    }catch(...){
    }

    if(getKey("/BLOGI/REDIS/PORT"))
        _RedisPort=getIntValue(getKey("/BLOGI/REDIS/PORT"),0);
    else
        _RedisPort=-1;

    if(getKey("/BLOGI/REDIS/TIMEOUT"))
        _RedisTimeout=getIntValue(getKey("/BLOGI/REDIS/TIMEOUT"),0);
    else
        _RedisTimeout=0;

    if(getKey("/BLOGI/HTTP/URL"))
        _HttpUrl=getValue(getKey("/BLOGI/HTTP/URL"),0);

@@ -175,26 +159,6 @@ int blogi::Config::gethttpmaxcon(){
    return _MaxCon;
}

const char * blogi::Config::getRedisHost(){
    if(_RedisHost.empty())
        return nullptr;
    return _RedisHost.c_str();
}

const char * blogi::Config::getRedisPassword(){
    if(_RedisPassword.empty())
        return nullptr;
    return _RedisPassword.c_str();
}

int blogi::Config::getRedisPort(){
    return _RedisPort;
}

int blogi::Config::getRedisTimeout(){
    return _RedisTimeout;
}

const char * blogi::Config::getsiteurl(){
    if(_HttpUrl.empty())
        return nullptr;
+4 −6
Changes for src/conf.h: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@

#include <confplus/conf.h>

#include <dbpp/database.h>

#pragma once

namespace blogi {
@@ -85,10 +87,6 @@ namespace blogi {
        std::string               _HttpBind;
        int                       _HttpPort;
        int                       _MaxCon;
        std::string               _RedisHost;
        int                       _RedisPort;
        int                       _RedisTimeout;
        std::string               _RedisPassword;
        std::string               _HttpUrl;
        std::string               _HttpPrefix;
        std::string               _Template;
@@ -99,7 +97,7 @@ namespace blogi {
        std::string               _CookieDomain;
    };

    void getConfig(dbpp::Database &db,const std::string &key,std::string &value){
    inline void getConfig(dbpp::Database &db,const std::string &key,std::string &value){
        dbpp::SQL sql;
        dbpp::DBResult res;
        sql << "SELECT value FROM options WHERE key='" << key.c_str() << "'";
@@ -107,7 +105,7 @@ namespace blogi {
        value=res[0][0];
    }

    void getConfig(dbpp::Database &db,const std::string &key,int &value){
    inline void getConfig(dbpp::Database &db,const std::string &key,int &value){
        std::string buf;
        getConfig(db,key,buf);
        value=atoi(buf.c_str());