Ejemplo n.º 1
0
//PEAR_LOG_EMERG, PEAR_LOG_ALERT, PEAR_LOG_CRIT, PEAR_LOG_ERR,
//PEAR_LOG_WARNING, PEAR_LOG_NOTICE, PEAR_LOG_INFO, PEAR_LOG_DEBUG
$conf["log"]["level"] = PEAR_LOG_DEBUG;
//druh handleru (mail,file,console,firebug,display,error_log,null,mdb2,syslog,sql)
$conf["log"]["handler"] = "file";
//rozsirujici konfigurace handleru
$conf["log"]["conf"] = array("timeFormat" => "%Y-%m-%d %H:%M:%S", "lineFormat" => "%{timestamp} [%{priority}] %{message}", "buffering" => true);
//konec logu
session_start();
//inicializace db
foreach ($conf["sqlconn"] as $server => $db) {
    try {
        $sqlEngine = new SQLEngine();
        $sqlEngine->setSlaveConnection($db["dbhost"], $db["dbuser"], $db["dbpass"], $db["dbname"]);
        $adminDataQuery = "SELECT * FROM spravce_info";
        $rs = $sqlEngine->query($adminDataQuery);
        $conf["spravce_info"] = SQLEngine::getFirstRow($rs);
        $pocetDnu = 7;
        $rozdil = 60 * 60 * 24 * $pocetDnu;
        $selMsg = "SELECT TIMESTAMPDIFF(DAY, vlozeno, NOW()) as naposledyVlozeno\n           FROM zpravy\n           INNER JOIN spravce_admini ON spravce_admini.id = zpravy.vytvoril\n           WHERE TIMESTAMPDIFF(DAY, vlozeno, NOW()) >= 7";
        $rs = $sqlEngine->query($selMsg);
        if (SQLEngine::getRowCount($rs) > 0) {
            $pocetDnu = SQLEngine::getFirstRow($rs);
            $pocetDnu = $pocetDnu["naposledyVlozeno"];
            echo $server . ": " . $pocetDnu . " > " . $conf["spravce_info"]["spravceEmail"] . "<br />";
            $mail = new PHPMailer();
            $mail->From = $conf["spravce_info"]["odesilatelEmail"];
            $mail->FromName = $conf["spravce_info"]["odesilatelName"];
            $mail->set('Return-Path', $conf["spravce_info"]["odesilatelEmail"]);
            $mail->AddReplyTo($conf["spravce_info"]["odesilatelEmail"], $conf["spravce_info"]["odesilatelName"]);
            $mail->ContentType = 'text/plain';
Ejemplo n.º 2
0
// tady musi byt bezpecnostni kontrola, jestli promenna $modul obsahuje platny nazev templatu z adresare srcTpl, kdyz ne, tak unset($modul)
if (!isset($modul)) {
    //tady bude redirect na userDetail
    header('location: ' . getUrl("userLogin", array()));
    exit;
}
//zjistime zda je pro domenu vubec definovana DB
if (!isset($conf["sqlconn"][$_REQUEST["s"]])) {
    die($conf["version"] . "<BR><BR>  Litujeme, ale pro -" . $_REQUEST["s"] . "- neni sluzba povolena. <BR><BR>  Vice informaci naleznete na <A HREF=\"http://www.combros.info\">www.combros.info</A>");
}
//echo $_SERVER["PHP_SELF"];
//inicializace db
$sqlEngine = new SQLEngine($conf["sqlconn"][$_REQUEST["s"]]["dbhost"], $conf["sqlconn"][$_REQUEST["s"]]["dbuser"], $conf["sqlconn"][$_REQUEST["s"]]["dbpass"], $conf["sqlconn"][$_REQUEST["s"]]["dbname"]);
// nacteme dalsi konfiguraci z DB
$sql = "SELECT * FROM spravce_info";
$rs = $sqlEngine->query($sql);
$conf["spravce_info"] = SQLEngine::getFirstRow($rs);
$conf['lng'] = $conf["spravce_info"]["contentLanguage"];
/*
foreach (SQLEngine::getRows($rs) as $radek) {
    $out["uzivatel"]["doprava"][$radek['poradi']]["nazev"] = $radek["nazev"];
    $out["uzivatel"]["doprava"][$radek['poradi']]["cena"]  = $radek["cena"];
}
*/
// controller zavola zobrazovac, ktery nacte template
$T = new MyTemplate();
require 'moduly/' . $modul . '.php';
// hlavicka
$T->assignVars('hlavicka', $conf["spravce_info"]["nazev"]);
$T->assignVars('pageTitle', "COMBROS " . $conf["spravce_info"]["nazev"]);
$T->assignVars('cssLocation', $_REQUEST["s"]);
Ejemplo n.º 3
0
                $_SESSION["user"]["email"] = $_REQUEST["email"];
                $script .= "alert('Zadaný kód byl úspěšně ověřen, děkujeme. " . $out["result_text"] . "');parent.location.href='" . getUrl("userDetail", array("s" => $_REQUEST["svalue"])) . "';";
            } else {
                // kod neni zadan v poradku
                $script = "alert('Zadaný kód není správný');";
            }
            break;
        case 'checkAuthCodesms':
            // overime zda auth kod je ;
            if ($_SESSION["bgWorker"]["authCode"] == $_REQUEST["authcodesms"]) {
                // bezpecnostni zdrzeni kvuli robotum
                sleep(2);
                //inicializace db
                $sqlEngine2 = new SQLEngine($conf["sqlconn"][$_REQUEST["svalue"]]["dbhost"], $conf["sqlconn"][$_REQUEST["svalue"]]["dbuser"], $conf["sqlconn"][$_REQUEST["svalue"]]["dbpass"], $conf["sqlconn"][$_REQUEST["svalue"]]["dbname"]);
                $sql2 = "UPDATE uzivatele SET sms=? WHERE id=?";
                $rs = $sqlEngine2->query($sql2, array($_REQUEST["sms"], $_SESSION["user"]["id"]));
                $out["result"] = SQLEngine::getErrorCode($rs);
                $out["result_text"] = SQLEngine::getErrorText($rs);
                unset($_SESSION["bgWorker"]["authCode"]);
                $_SESSION["user"]["email"] = $_REQUEST["email"];
                $script = "alert('Zadaný kód byl úspěšně ověřen, děkujeme. " . $out["result_text"] . "');parent.location.href='" . getUrl("userDetail", array()) . "';";
            } else {
                // kod neni zadan v poradku
                $script = "alert('Zadaný kód není správný');";
            }
            break;
        default:
            break;
    }
}
//$script="parent.getElementById('authcode').style.display='block';alert('unauthorized access');";
Ejemplo n.º 4
0
$conf["log"]["level"] = PEAR_LOG_DEBUG;
//druh handleru (mail,file,console,firebug,display,error_log,null,mdb2,syslog,sql)
$conf["log"]["handler"] = "file";
//rozsirujici konfigurace handleru
$conf["log"]["conf"] = array("timeFormat" => "%Y-%m-%d %H:%M:%S", "lineFormat" => "%{timestamp} [%{priority}] %{message}", "buffering" => true);
//konec logu
foreach ($conf["sqlconn"] as $zakaznik => $zakaznikSQLConf) {
    // zpracujeme jen ty databaze co jsou v configu povoleny
    if ($zakaznikSQLConf["enableSendMessage"] != "Y") {
        continue;
    }
    // byla nalezena db kterou se mame zabyvat, startujeme
    $sqlEngine = new SQLEngine($conf["sqlconn"][$zakaznik]["dbhost"], $conf["sqlconn"][$zakaznik]["dbuser"], $conf["sqlconn"][$zakaznik]["dbpass"], $conf["sqlconn"][$zakaznik]["dbname"]);
    // zjistime zda je na DB zamek jine instance sender.php
    $sql = "SELECT * FROM scriptLockLog WHERE scriptName = ? AND dbName = ? AND finishTime IS NULL";
    $rs = $sqlEngine->query($sql, array("sender.php", $conf["sqlconn"][$zakaznik]["dbname"]));
    // zamek uz je tak prejdeme na dalsi DB
    if (SQLEngine::getRowCount($rs) > 0) {
        continue;
    }
    // neni zamek, vytvorime ho a muzeme zacit
    $sql = "INSERT INTO scriptLockLog SET scriptName = ? , dbName = ? , startTime = NOW()";
    $rs = $sqlEngine->query($sql, array("sender.php", $conf["sqlconn"][$zakaznik]["dbname"]));
    $sql = "SELECT * FROM spravce_info";
    $rs = $sqlEngine->query($sql);
    unset($conf["spravce_info"]);
    $conf["spravce_info"] = SQLEngine::getFirstRow($rs);
    //vytvoreni seznamu zprav a prirareni je k uzivatelum, kategoriim, kanalum
    $selMsg = "SELECT zpravy.id as zpravyID, uzivatele.email, uzivatele.sms, uzivatele.ID as uID, uzivatele.login, uzivatele_skupiny.cena, \n                      uzivatele_skupiny.hradi, skupiny.nazev, text AS obsahEmail, textSMS AS obsahSMS, odeslatPo, kanal, zpravy.stav\n               FROM zpravy\n               INNER JOIN spravce_admini ON spravce_admini.id = zpravy.vytvoril\n               INNER JOIN zpravy_skupiny ON zpravy_skupiny.idZpravy = zpravy.id\n               INNER JOIN skupiny ON skupiny.id = zpravy_skupiny.idSkupiny\n               INNER JOIN uzivatele_skupiny ON uzivatele_skupiny.idSkupina = skupiny.id\n               INNER JOIN uzivatele ON uzivatele.id = uzivatele_skupiny.idUzivatel\n               INNER JOIN kanaly ON kanaly.id = uzivatele_skupiny.kanal\n               LEFT JOIN zpravy_doruceni ON zpravy_doruceni.idZprava=zpravy.id AND zpravy_doruceni.idUzivatel=uzivatele_skupiny.idUzivatel\n               WHERE zpravy.stav != 'STOP' && zpravy.stav != 'DONE' && odeslatPo < NOW() && uzivatele.stav = 'active' && ((kanaly.nazev='email' AND uzivatele.email !='') OR (kanaly.nazev='sms' AND uzivatele.sms !='')) AND zpravy_doruceni.odeslano IS NULL\n               ORDER BY odeslatPo";
    $rs = $sqlEngine->query($selMsg);
    //pruchodu seznamu zprav na odeslani