当前位置: 首页>>代码示例>>PHP>>正文


PHP WriteToSyslogMail函数代码示例

本文整理汇总了PHP中WriteToSyslogMail函数的典型用法代码示例。如果您正苦于以下问题:PHP WriteToSyslogMail函数的具体用法?PHP WriteToSyslogMail怎么用?PHP WriteToSyslogMail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了WriteToSyslogMail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build_blacklists

function build_blacklists($aspid = false)
{
    $unix = new unix();
    $FINALARRAY = array();
    $f = array();
    $PidFile = "/etc/artica-postfix/pids/squid_build_blacklists.pid";
    $dbfile = "/var/log/squid/ufdbgclient.black.db";
    if ($aspid) {
        $pid = $unix->get_pid_from_file($PidFile);
        if ($pid != getmypid()) {
            if ($unix->process_exists($pid, basename(__FILE__))) {
                echo "Starting......: " . date("H:i:s") . " Blacklists: Another artica script running pid {$pid}, aborting ...\n";
                WriteToSyslogMail("build_blacklists():: Another artica script running pid {$pid}, aborting ...", basename(__FILE__));
                return;
            }
        }
    }
    @unlink($dbfile);
    try {
        echo "berekley_db:: Creating {$dbfile} database\n";
        $db_desttmp = @dba_open($dbfile, "c", "db4");
        @dba_close($db_desttmp);
    } catch (Exception $e) {
        $error = $e->getMessage();
        echo "berekley_db::FATAL ERROR {$error} on {$dbfile}\n";
        return;
    }
    $q = new mysql_squid_builder();
    $array = array();
    $db_con = @dba_open($dbfile, "c", "db4");
    $sql = "SELECT * FROM deny_websites";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "Starting......: " . date("H:i:s") . " [ACLS]: {$q->mysql_error}\n";
        return;
    }
    @unlink("/etc/squid3/www-blacklists.db");
    while ($ligne = mysql_fetch_assoc($results)) {
        if ($ligne["items"] == null) {
            continue;
        }
        $item = $ligne["items"];
        $item = str_replace("/", "\\/", $item);
        $item = str_replace(".", "\\.", $item);
        $item = str_replace("*", ".*?", $item);
        @dba_replace($item, $item, $db_con);
        $array[] = $ligne["items"];
    }
    @dba_close($db_con);
    @file_put_contents("/var/log/squid/ufdbgclient.reload", "#");
    @chown("/var/log/squid/ufdbgclient.reload", "squid");
    @chgrp("/var/log/squid/ufdbgclient.reload", "squid");
    $acl = new squid_acls();
    $url_rewrite_program = $acl->clean_dstdomains($array);
    echo "Starting......: " . date("H:i:s") . " [ACLS]: " . count($url_rewrite_program) . " blacklisted webistes\n";
    @file_put_contents("/etc/squid3/www-blacklists.db", @implode("\n", $url_rewrite_program) . "\n");
    @chown("/etc/squid3/www-blacklists.db", "squid");
    @chgrp("/etc/squid3/www-blacklists.db", "squid");
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:59,代码来源:exec.ufdbgclient.whitelists.php

示例2: build


//.........这里部分代码省略.........
        echo "DEBUG::{$funtion}:: SQUIDEnable={$SQUIDEnable}\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "DEBUG::{$funtion}:: UseRemoteUfdbguardService={$UseRemoteUfdbguardService}\n";
    }
    $GLOBALS["SQUIDBIN"] = $squidbin;
    if ($EnableWebProxyStatsAppliance == 0) {
        $installed = false;
        if ($users->SQUIDGUARD_INSTALLED) {
            $installed = true;
            echo "Starting......: " . date("H:i:s") . " SquidGuard is installed\n";
        }
        if ($users->APP_UFDBGUARD_INSTALLED) {
            $installed = true;
            echo "Starting......: " . date("H:i:s") . " Webfiltering service is installed\n";
        }
        if ($users->DANSGUARDIAN_INSTALLED) {
            $installed = true;
            echo "Starting......: " . date("H:i:s") . " Dansguardian is installed\n";
        }
        if (!$installed) {
            if ($GLOBALS["VERBOSE"]) {
                echo "No one installed...\n";
                shell_exec("{$nohup} " . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.usrmactranslation.php >/dev/null 2>&1 &");
                return false;
            }
        }
    }
    if ($EnableUfdbGuard == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "UfDbguard is disabled ( see EnableUfdbGuard ) in line: " . __LINE__ . "\n";
        }
        return;
    }
    if ($SQUIDEnable == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "UfDbguard is disabled ( see SQUIDEnable ) in line: " . __LINE__ . "\n";
        }
        return;
    }
    if ($UseRemoteUfdbguardService == 1) {
        if ($GLOBALS["VERBOSE"]) {
            echo "UfDbguard is disabled ( see UseRemoteUfdbguardService ) in line: " . __LINE__ . "\n";
        }
        return;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "FIX_1_CATEGORY_CHECKED()\n";
    }
    FIX_1_CATEGORY_CHECKED();
    if ($EnableRemoteStatisticsAppliance == 1) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Use the Web statistics appliance to get configuration file...\n";
        }
        shell_exec("{$nohup} " . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.usrmactranslation.php >/dev/null 2>&1 &");
        ufdbguard_remote();
        return;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$funtion}::" . __LINE__ . "Loading compile_dansguardian()\n";
    }
    $dans = new compile_dansguardian();
    if ($GLOBALS["VERBOSE"]) {
        echo "{$funtion}::" . __LINE__ . "Loading compile_dansguardian::->build()\n";
    }
    $dans->build();
    echo "Starting......: " . date("H:i:s") . " Dansguardian compile done...\n";
    if (function_exists('WriteToSyslogMail')) {
        WriteToSyslogMail("build() -> reconfigure UfdbGuardd", basename(__FILE__));
    }
    build_ufdbguard_config();
    ufdbguard_schedule();
    if ($EnableWebProxyStatsAppliance == 1) {
        echo "Starting......: " . date("H:i:s") . " This server is a Squid Appliance, compress databases and notify proxies\n";
        CompressCategories();
        notify_remote_proxys();
    }
    shell_exec("{$php5} /usr/share/artica-postfix/exec.initslapd.php --ufdbguard");
    CheckPermissions();
    ufdbguard_admin_events("Service will be rebuiled and restarted", __FUNCTION__, __FILE__, __LINE__, "config");
    shell_exec("{$nohup} " . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.usrmactranslation.php >/dev/null 2>&1 &");
    if (!$GLOBALS["RESTART"]) {
        if (is_file("/etc/init.d/ufdb")) {
            echo "Starting......: " . date("H:i:s") . " Checking watchdog\n";
            ufdbguard_watchdog();
            echo "Starting......: " . date("H:i:s") . " Webfiltering service reloading service\n";
            build_ufdbguard_HUP();
        }
    }
    if ($GLOBALS["RESTART"]) {
        if (is_file("/etc/init.d/ufdb")) {
            echo "Starting......: " . date("H:i:s") . " Restarting\n";
            shell_exec("/etc/init.d/ufdb restart");
        }
    }
    if ($users->DANSGUARDIAN_INSTALLED) {
        echo "Starting......: " . date("H:i:s") . " Dansguardian reloading service\n";
        shell_exec("/usr/share/artica-postfix/bin/artica-install --reload-dansguardian --withoutconfig");
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.squidguard.php

示例3: xsyslog

function xsyslog($text)
{
    if (function_exists("WriteToSyslogMail")) {
        WriteToSyslogMail($text, basename(__FILE__));
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:6,代码来源:exec.kerbauth.php

示例4: archive_process


//.........这里部分代码省略.........
    if ($MailArchiverToMailBox == 1) {
        if ($GLOBALS["VERBOSE"]) {
            echo "archive_process_smtp({$fullmessagesdir},{$realmailfrom})\n";
        }
        if (!$ARCHIVED) {
            if (!archive_process_smtp($file, $realmailfrom)) {
                return false;
            }
        }
    }
    if ($MailArchiverSMTP == 1) {
        if (!$ARCHIVED) {
            if (!archive_process_smtpsrv($file, $realmailfrom, $realmailto)) {
                return false;
            }
        }
    }
    if (!$ARCHIVED) {
        if (!archive_process_copyto($file, $realmailfrom, $realmailto)) {
            return false;
        }
    }
    if ($MailArchiverToMySQL == 0) {
        return true;
    }
    $ldap = new clladp();
    $q = new mysql_mailarchive_builder();
    events("Unpack {$target_file}");
    $mm = new demime($target_file);
    if (!$mm->unpack()) {
        events("Failed unpack with error \"{$mm->error}\"");
        if ($mm->MustkillMail) {
            @unlink($target_file);
        }
        return false;
    }
    $message_html = $mm->ExportToHtml($target_file);
    if (strlen($message_html) == 0) {
        system_admin_events("{$target_file}: HTML FAILED...", __FUNCTION__, __FILE__, __LINE__, "archive");
        return false;
    }
    if (count($mm->mailto_array) == 0) {
        if ($realmailto != null) {
            $mm->mailto_array[] = $realmailto;
        }
    }
    if (count($mm->mailto_array) == 0) {
        system_admin_events("{$target_file}: Fatal No recipients Aborting", __FUNCTION__, __FILE__, __LINE__, "archive");
        return true;
    }
    $filesize = @filesize($target_file);
    events("Message with " . count($mm->mailto_array) . " recipients html file:" . strlen($message_html) . " bytes");
    if ($realmailfrom != null) {
        $mm->mailfrom = $realmailfrom;
    }
    if (preg_match("#(.+?)@(.+)#", $mm->mailfrom, $re)) {
        $domain_from = $re[2];
    }
    $message_html = addslashes($message_html);
    $mm->message_date = date("Y-m-d H:i:s", $timeMessage);
    $tableDest = date("Ymd", $timeMessage);
    if (!$q->BuildDayTable($tableDest)) {
        system_admin_events("Fatal unable to create {$tableDest} date...", __FUNCTION__, __FILE__, __LINE__, "archive");
        return false;
    }
    $SubjectMysql = addslashes(mime_decode($mm->subject));
    while (list($num, $recipient) = each($mm->mailto_array)) {
        if (preg_match("#(.+?)@(.+)#", $recipient, $re)) {
            $recipient_domain = $re[2];
        }
        $ou = $mm->GetOuFromEmail($recipient);
        $sql_source_file = $target_file;
        events("(New message)time={$mm->message_date} message-id=<{$mm->message_id}> from=<{$mm->mailfrom}> to=<{$recipient}> size={$filesize}");
        $newmessageid = md5($mm->message_id . $recipient);
        $sqlfilesize = @filesize($target_file);
        $BinMessg = addslashes(fread(fopen($target_file, "r"), $sqlfilesize));
        $sql = "INSERT IGNORE INTO `{$tableDest}` (\n\t\t\t\tMessageID,\n\t\t\t\tzDate,\n\t\t\t\tmailfrom,\n\t\t\t\tmailfrom_domain,\n\t\t\t\tsubject,\n\t\t\t\tMessageBody,\n\t\t\t\torganization,\n\t\t\t\tmailto,\n\t\t\t\tfile_path,\n\t\t\t\toriginal_messageid,\n\t\t\t\tmessage_size,\n\t\t\t\tBinMessg,filename,filesize\n\t\t\t\t)\n\t\t\tVALUES(\n\t\t\t\t'{$newmessageid}',\n\t\t\t\t'{$mm->message_date}',\n\t\t\t\t'{$mm->mailfrom}',\n\t\t\t\t'{$domain_from}',\n\t\t\t\t'{$SubjectMysql}',\n\t\t\t\t'{$message_html}',\n\t\t\t\t'{$ou}',\n\t\t\t\t'{$recipient}',\n\t\t\t\t'{$sql_source_file}',\n\t\t\t\t'{$mm->message_id}',\n\t\t\t\t'{$filesize}','{$BinMessg}','{$filename}','{$sqlfilesize}')";
        if (!$q->QUERY_SQL($sql)) {
            system_admin_events("Fatal {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "archive");
            return false;
        }
    }
    events("Analyze sender {$mm->mailfrom}...");
    $ou = $mm->GetOuFromEmail($mm->mailfrom);
    if ($ou == null) {
        events("Not organization found for {$mm->mailfrom}...");
        return true;
    }
    $recipients = $mm->mailto_array;
    $impled_rctp = implode(";", $recipients);
    $sql = "INSERT IGNORE INTO `{$tableDest}` (\n\t\t\t\tMessageID,\n\t\t\t\tzDate,\n\t\t\t\tmailfrom,\n\t\t\t\tmailfrom_domain,\n\t\t\t\tsubject,\n\t\t\t\tMessageBody,\n\t\t\t\torganization,\n\t\t\t\tmailto,\n\t\t\t\tfile_path,\n\t\t\t\toriginal_messageid,\n\t\t\t\tmessage_size,BinMessg,filename,filesize\n\t\t\t\t)\n\t\t\tVALUES(\n\t\t\t\t'{$newmessageid}',\n\t\t\t\t'{$mm->message_date}',\n\t\t\t\t'{$mm->mailfrom}',\n\t\t\t\t'{$domain_from}',\n\t\t\t\t'{$SubjectMysql}',\n\t\t\t\t'{$message_html}',\n\t\t\t\t'{$ou}',\n\t\t\t\t'{$impled_rctp}',\n\t\t\t\t'{$sql_source_file}',\n\t\t\t\t'{$mm->message_id}',\n\t\t\t\t'{$filesize}','{$BinMessg}','{$filename}','{$sqlfilesize}')";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        system_admin_events("Fatal {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "archive");
        return false;
    }
    WriteToSyslogMail("{$mm->message_id}: <{$mm->mailfrom}> to: <{$impled_rctp}> size={$filesize} bytes (saved into backup area)", __FILE__);
    events("time={$mm->message_date} message-id=<{$mm->message_id}> from=<{$mm->mailfrom}> to=<{$impled_rctp}> size={$filesize}");
    return true;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.mailarchiver.php

示例5: remove_database

function remove_database($allprocedure = false)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if ($allprocedure) {
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            build_progress_status(100, "Already task running PID {$pid}");
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: Already task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
    }
    $mysql = $unix->find_program("mysql");
    $rm = $unix->find_program("rm");
    $sock = new sockets();
    build_progress_status(2, "Stopping monitor");
    shell_exec("/etc/init.d/monit stop");
    shell_exec("/etc/init.d/artica-status stop --force");
    shell_exec("/etc/init.d/postfix-logger stop");
    build_progress_status(5, "Removing MySQL Zarafa Database");
    WriteToSyslogMail("Action: Removing Zarafa Database MySQL client `{$mysql}`....", __FILE__);
    $cmd = "{$mysql} --socket=/var/run/mysqld/zarafa-db.sock --protocol=socket --user=root --batch --debug-info --database=zarafa --execute=\"DROP DATABASE zarafa\" 2>&1";
    $results = array();
    exec("{$cmd}", $results);
    $WORKDIR = $sock->GET_INFO("ZarafaDedicateMySQLWorkDir");
    if ($WORKDIR == null) {
        $WORKDIR = "/home/zarafa-db";
    }
    while (list($num, $ligne) = each($results)) {
        echo WriteToSyslogMail("MySQL: (Delete Database) {$ligne}", __FILE__);
    }
    build_progress_status(10, "Removing Zarafa Database MySQL");
    if (is_dir("{$WORKDIR}")) {
        recursive_remove_directory("{$WORKDIR}");
    }
    WriteToSyslogMail("Action: Restarting MySQL service...", __FILE__);
    WriteToSyslogMail("Action: Stopping MySQL service...", __FILE__);
    build_progress_status(15, "Stopping MySQL Zarafa Database");
    build_progress_status(40, "Stopping Zarafa Server service");
    WriteToSyslogMail("Action: Stopping Zarafa server...", __FILE__);
    @unlink("/tmp/zarafa-upgrade-lock");
    system("/etc/init.d/zarafa-server stop --kill");
    stop(true);
    WriteToSyslogMail("Action: Starting MySQL service (InnoDB recovery mode)...", __FILE__);
    build_progress_status(20, "Starting MySQL Zarafa Database (InnoDB recovery mode)");
    start(true, true);
    while (list($num, $ligne) = each($results)) {
        echo "Service: {$ligne}\n";
    }
    sleep(5);
    $ZARAFADB_PID = ZARAFADB_PID();
    if (!$unix->process_exists($ZARAFADB_PID)) {
        build_progress_status(110, "{failed}");
        return;
    }
    if ($allprocedure) {
        build_progress_status(25, "Restarting MySQL service (normal)");
        echo "Action: Restarting MySQL service...\n";
        echo "Action: Stopping MySQL service...\n";
        build_progress_status(30, "Stopping MySQL service (normal)");
        stop(true);
        echo "Action: Starting MySQL service (InnoDB normal mode)...\n";
        build_progress_status(35, "Starting MySQL service (normal)");
        start(true, false);
        while (list($num, $ligne) = each($results)) {
            echo "Service: {$ligne}\n";
        }
        sleep(5);
        $ZARAFADB_PID = ZARAFADB_PID();
        if (!$unix->process_exists($ZARAFADB_PID)) {
            build_progress_status(110, "{failed}");
            return;
        }
    }
    build_progress_status(40, "Stopping Zarafa Server service");
    WriteToSyslogMail("Action: Stopping Zarafa server...", __FILE__);
    @unlink("/tmp/zarafa-upgrade-lock");
    system("/etc/init.d/zarafa-server stop --kill");
    $pid = XZARAFA_SERVER_PID();
    if ($unix->process_exists($pid)) {
        $kill = $unix->find_program("kill");
        unix_system_kill_force($pid);
    }
    build_progress_status(43, "Starting monitors");
    shell_exec("/etc/init.d/monit start");
    shell_exec("/etc/init.d/artica-status start");
    shell_exec("/etc/init.d/postfix-logger start");
    build_progress_status(45, "Restarting Zarafa Server service");
    WriteToSyslogMail("Action: Restarting Zarafa server...", __FILE__);
    shell_exec("/etc/init.d/zarafa-server restart");
    WriteToSyslogMail("Action: sleeping 5s", __FILE__);
    sleep(5);
    build_progress_status(50, "Restarting Zarafa Server service");
    WriteToSyslogMail("Action: Restarting Zarafa server...", __FILE__);
    system("/etc/init.d/zarafa-server restart");
    build_progress_status(60, "Checking DB size");
    databasesize(true);
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.zarafa-db.php

示例6: basename

$GLOBALS["CLASS_UNIX"] = $unix;
if (!is_file($GLOBALS["postfix"])) {
    die;
}
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
    $time = $unix->PROCCESS_TIME_MIN($pid);
    echo "Starting......: " . date("H:i:s") . " Already executed pid:{$pid} since {$time}Mn\n";
    $unix->send_email_events("Postfix user databases aborted (instance executed)", "Already instance pid {$pid} is executed", "postfix");
    die;
}
@file_put_contents($pidfile, getmypid());
$ldap = new clladp();
if ($ldap->ldapFailed) {
    WriteToSyslogMail("Fatal: connecting to ldap server {$ldap->ldap_host}", basename(__FILE__), true);
    echo "Starting......: " . date("H:i:s") . " failed connecting to ldap server {$ldap->ldap_host}\n";
    $unix->send_email_events("Postfix user databases aborted (ldap failed)", "The process has been scheduled to start in few seconds.", "postfix");
    $unix->THREAD_COMMAND_SET(trim($unix->LOCATE_PHP5_BIN() . " " . __FILE__ . " {$argv[1]}"));
    die;
}
if ($argv[1] == "--dump-db_extern") {
    $GLOBALS["VERBOSE"] = true;
    ini_set('html_errors', 0);
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
    DUMP_EXTERNALS_DBS();
    die;
}
if ($GLOBALS["EnablePostfixMultiInstance"] == 1) {
    if ($argv[1] == "--aliases") {
开发者ID:articatech,项目名称:artica,代码行数:31,代码来源:exec.postfix.hashtables.php

示例7: build_blacklists

function build_blacklists($aspid = false)
{
    $unix = new unix();
    $FINALARRAY = array();
    $f = array();
    $PidFile = "/etc/artica-postfix/pids/squid_build_blacklists.pid";
    $dbfile = "/var/log/squid/ufdbgclient.black.db";
    if ($aspid) {
        $pid = $unix->get_pid_from_file($PidFile);
        if ($pid != getmypid()) {
            if ($unix->process_exists($pid, basename(__FILE__))) {
                echo "Starting......: " . date("H:i:s") . " Blacklists: Another artica script running pid {$pid}, aborting ...\n";
                WriteToSyslogMail("build_blacklists():: Another artica script running pid {$pid}, aborting ...", basename(__FILE__));
                return;
            }
        }
    }
    build_progress_wb("{compiling}", 41);
    @unlink($dbfile);
    try {
        echo "berekley_db:: Creating {$dbfile} database\n";
        $db_desttmp = @dba_open($dbfile, "c", "db4");
        @dba_close($db_desttmp);
    } catch (Exception $e) {
        $error = $e->getMessage();
        echo "berekley_db::FATAL ERROR {$error} on {$dbfile}\n";
        return;
    }
    @file_put_contents("/etc/squid3/ip-blacklists.db", "#");
    @file_put_contents("/etc/squid3/www-blacklists.db", "#");
    $ARRAY_IPS = array();
    $ip = new IP();
    $q = new mysql_squid_builder();
    $array = array();
    $db_con = @dba_open($dbfile, "c", "db4");
    $sql = "SELECT * FROM deny_websites";
    $results = $q->QUERY_SQL($sql);
    if ($GLOBALS["VERBOSE"]) {
        echo "BLACK " . mysql_num_rows($results) . " items SQL\n";
    }
    if (!$q->ok) {
        echo "Starting......: " . date("H:i:s") . " [ACLS]: {$q->mysql_error}\n";
        return;
    }
    @unlink("/etc/squid3/www-blacklists.db");
    build_progress_wb("{compiling}", 42);
    while ($ligne = mysql_fetch_assoc($results)) {
        if ($ligne["items"] == null) {
            continue;
        }
        $item = $ligne["items"];
        if (preg_match("#^http:\\/\\/([0-9\\.]+)(\\/|\$)#", $item, $re)) {
            $ARRAY_IPS[$re[1]] = true;
            continue;
        }
        if ($ip->isValid($item)) {
            $ARRAY_IPS[$item] = true;
            continue;
        }
        $item = str_replace("/", "\\/", $item);
        $item = str_replace(".", "\\.", $item);
        $item = str_replace("*", ".*?", $item);
        @dba_replace($item, $item, $db_con);
        if ($GLOBALS["VERBOSE"]) {
            echo "BLACK {$item}\n";
        }
        $array[] = $ligne["items"];
    }
    @dba_close($db_con);
    build_progress_wb("{compiling}", 43);
    @file_put_contents("/var/log/squid/ufdbgclient.reload", "#");
    @chown("/var/log/squid/ufdbgclient.reload", "squid");
    @chgrp("/var/log/squid/ufdbgclient.reload", "squid");
    $acl = new squid_acls();
    $url_rewrite_program = $acl->clean_dstdomains($array);
    echo "Starting......: " . date("H:i:s") . " [ACLS]: " . count($url_rewrite_program) . " blacklisted webistes\n";
    @file_put_contents("/etc/squid3/www-blacklists.db", @implode("\n", $url_rewrite_program) . "\n");
    @chown("/etc/squid3/www-blacklists.db", "squid");
    @chgrp("/etc/squid3/www-blacklists.db", "squid");
    if (count($ARRAY_IPS) > 0) {
        while (list($item, $line) = each($ARRAY_IPS)) {
            $zips[] = $item;
        }
        @file_put_contents("/etc/squid3/ip-blacklists.db", @implode("\n", $zips) . "\n");
        @chown("/etc/squid3/ip-blacklists.db", "squid");
        @chgrp("/etc/squid3/ip-blacklists.db", "squid");
    }
    build_progress_wb("{compiling}", 44);
    $php = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    $DenyBlacksites = false;
    $f = explode("\n", @file_get_contents("/etc/squid3/squid.conf"));
    while (list($num, $line) = each($f)) {
        if (preg_match("#DenyBlacksites dstdomain#", $line, $re)) {
            $DenyBlacksites = true;
        }
    }
    if (!$DenyBlacksites) {
        system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force --noufdbg");
        return;
//.........这里部分代码省略.........
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:exec.ufdbgclient.whitelists.php

示例8: clladp

$GLOBALS["postalias"] = $unix->find_program("postalias");
$GLOBALS["postfix"] = $unix->find_program("postfix");
if (class_exists("clladp")) {
    $ldap = new clladp();
    if ($ldap->ldapFailed) {
        WriteToSyslogMail("Fatal: connecting to ldap server {$ldap->ldap_host}", basename(__FILE__), true);
        echo "Starting......: " . date("H:i:s") . " failed connecting to ldap server {$ldap->ldap_host}\n";
        $unix->send_email_events("Postfix user databases aborted (ldap failed)", "The process has been scheduled to start in few seconds.", "postfix");
        $unix->THREAD_COMMAND_SET(trim($unix->LOCATE_PHP5_BIN() . " " . __FILE__ . " {$argv[1]}"));
        die;
    }
}
if (class_exists("mysql")) {
    $mysql = new mysql();
    if (!$mysql->TestingConnection()) {
        WriteToSyslogMail("Fatal: connecting to MySQL server {$mysql->mysql_error}", basename(__FILE__), true);
        echo "Starting......: " . date("H:i:s") . " failed connecting to ldap server {$mysql->mysql_error}\n";
        $unix->send_email_events("Postfix user databases aborted (MySQL failed)", "The process has been scheduled to start in few seconds.", "postfix");
        $unix->THREAD_COMMAND_SET(trim($unix->LOCATE_PHP5_BIN() . " " . __FILE__ . " {$argv[1]}"));
        die;
    }
}
if ($argv[1] == '--reconfigure-all') {
    reconfigure();
    die;
}
if ($argv[1] == '--restart-all') {
    restart_all_instances();
    die;
}
if ($argv[1] == '--aliases') {
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.postfix-multi.php

示例9: archive_process

function archive_process($file)
{
    $fullmessagesdir = "/opt/artica/share/www/original_messages";
    $target_file = $file;
    $filename = basename($target_file);
    $ldap = new clladp();
    $q = new mysql();
    events("Unpack {$target_file}");
    $mm = new demime($target_file);
    if (!$mm->unpack()) {
        events("Failed unpack with error \"{$mm->error}\"");
        if ($mm->MustkillMail) {
            @unlink($target_file);
        }
        return false;
    }
    $message_html = $mm->ExportToHtml($target_file);
    if (strlen($message_html) == 0) {
        return false;
    }
    if (count($mm->mailto_array) == 0) {
        events("No recipients Aborting");
        return true;
    }
    $filesize = filesize($target_file);
    events("Message with " . count($mm->mailto_array) . " recipients html file:" . strlen($message_html) . " bytes");
    if (preg_match("#(.+?)@(.+)#", $mm->mailfrom, $re)) {
        $domain_from = $re[2];
    }
    $message_html = addslashes($message_html);
    while (list($num, $recipient) = each($mm->mailto_array)) {
        if (preg_match("#(.+?)@(.+)#", $recipient, $re)) {
            $recipient_domain = $re[2];
        }
        $ou = $mm->GetOuFromEmail($recipient);
        $sql_source_file = $target_file;
        events("(New message)time={$mm->message_date} message-id=<{$mm->message_id}> from=<{$mm->mailfrom}> to=<{$recipient}> size={$filesize}");
        $newmessageid = md5($mm->message_id . $recipient);
        $sqlfilesize = @filesize($target_file);
        $BinMessg = addslashes(fread(fopen($target_file, "r"), $sqlfilesize));
        $sql = "INSERT IGNORE INTO storage (\n\t\t\t\tMessageID,\n\t\t\t\tzDate,\n\t\t\t\tmailfrom,\n\t\t\t\tmailfrom_domain,\n\t\t\t\tsubject,\n\t\t\t\tMessageBody,\n\t\t\t\torganization,\n\t\t\t\tmailto,\n\t\t\t\tfile_path,\n\t\t\t\toriginal_messageid,\n\t\t\t\tmessage_size,\n\t\t\t\tBinMessg,filename,filesize\n\t\t\t\t)\n\t\t\tVALUES(\n\t\t\t\t'{$newmessageid}',\n\t\t\t\t'{$mm->message_date}',\n\t\t\t\t'{$mm->mailfrom}',\n\t\t\t\t'{$domain_from}',\n\t\t\t\t'{$mm->subject}',\n\t\t\t\t'{$message_html}',\n\t\t\t\t'{$ou}',\n\t\t\t\t'{$recipient}',\n\t\t\t\t'{$sql_source_file}',\n\t\t\t\t'{$mm->message_id}',\n\t\t\t\t'{$filesize}','{$BinMessg}','{$filename}','{$sqlfilesize}')";
        if (!$q->QUERY_SQL($sql, "artica_backup")) {
            events($q->mysql_error);
            file_put_contents("/var/log/artica-postfix/mysql-error." . md5($sql) . ".err", "{$sql}\n\n{$q->mysql_error}");
            events("error saved into  /var/log/artica-postfix/mysql-error." . md5($sql) . ".err");
            return false;
        } else {
            events("Success saved in mysql...");
        }
    }
    events("Analyze sender {$mm->mailfrom}...");
    $ou = $mm->GetOuFromEmail($mm->mailfrom);
    if ($ou == null) {
        events("Not organization found for {$mm->mailfrom}...");
        return true;
    }
    $recipients = $mm->mailto_array;
    $impled_rctp = implode(";", $recipients);
    $sql = "INSERT IGNORE INTO storage (\n\t\t\t\tMessageID,\n\t\t\t\tzDate,\n\t\t\t\tmailfrom,\n\t\t\t\tmailfrom_domain,\n\t\t\t\tsubject,\n\t\t\t\tMessageBody,\n\t\t\t\torganization,\n\t\t\t\tmailto,\n\t\t\t\tfile_path,\n\t\t\t\toriginal_messageid,\n\t\t\t\tmessage_size,BinMessg,filename,filesize\n\t\t\t\t)\n\t\t\tVALUES(\n\t\t\t\t'{$newmessageid}',\n\t\t\t\t'{$mm->message_date}',\n\t\t\t\t'{$mm->mailfrom}',\n\t\t\t\t'{$domain_from}',\n\t\t\t\t'{$mm->subject}',\n\t\t\t\t'{$message_html}',\n\t\t\t\t'{$ou}',\n\t\t\t\t'{$impled_rctp}',\n\t\t\t\t'{$sql_source_file}',\n\t\t\t\t'{$mm->message_id}',\n\t\t\t\t'{$filesize}','{$BinMessg}','{$filename}','{$sqlfilesize}')";
    if (!$q->QUERY_SQL($sql, "artica_backup")) {
        events($q->mysql_error);
        file_put_contents("/var/log/artica-postfix/mysql-error." . md5($sql) . ".err", "{$sql}\n\n{$q->mysql_error}");
        WriteToSyslogMail("error saved into  /var/log/artica-postfix/mysql-error." . md5($sql) . ".err", __FILE__);
        return false;
    }
    WriteToSyslogMail("{$mm->message_id}: <{$mm->mailfrom}> to: <{$impled_rctp}> size={$filesize} bytes (saved into backup area)", __FILE__);
    events("time={$mm->message_date} message-id=<{$mm->message_id}> from=<{$mm->mailfrom}> to=<{$impled_rctp}> size={$filesize}");
    return true;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:69,代码来源:exec.mailbackup.php

示例10: ApplyConfig

function ApplyConfig($smooth = false)
{
    if (function_exists("WriteToSyslogMail")) {
        WriteToSyslogMail("Invoke ApplyConfig function", basename(__FILE__));
    }
    $unix = new unix();
    $ulimit = $unix->find_program("ulimit");
    if (is_file($ulimit)) {
        shell_exec("{$ulimit} -HSd unlimited");
    } else {
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid ulimit no such binary...\n";
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid apply kernel settings\n";
    build_progress("{reconfigure} Kernel values", 46);
    kernel_values();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid apply Checks security limits\n";
    build_progress("{reconfigure} Security limits", 47);
    security_limit();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Remote appliances...\n";
    build_progress("{reconfigure} checks remote appliances", 48);
    remote_appliance_restore_tables();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Remote appliances done...\n";
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $squidbin = $unix->find_program("squid");
    $SQUID_CONFIG_PATH = $unix->SQUID_CONFIG_PATH();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid loading libraires...\n";
    $sock = new sockets();
    $squid = new squidbee();
    if (!is_file($squidbin)) {
        $squidbin = $unix->find_program("squid3");
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid binary: `{$squidbin}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Conf..: `{$SQUID_CONFIG_PATH}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid php...: `{$php5}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid nohup.: `{$nohup}`\n";
    $DenySquidWriteConf = $sock->GET_INFO("DenySquidWriteConf");
    if (!is_numeric($DenySquidWriteConf)) {
        $DenySquidWriteConf = 0;
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking `DenySquidWriteConf` = {$DenySquidWriteConf}\n";
    @copy("/etc/artica-postfix/settings/Daemons/SquidNudityScanParams", "/etc/squid3/SquidNudityScanParams");
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking `NudeBooster`\n";
    build_progress("{reconfigure} Nude booster", 49);
    NudeBooster();
    if (!is_dir("/usr/share/squid-langpack")) {
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Templates from MySQL\n";
        $unix->THREAD_COMMAND_SET("{$php5} " . __FILE__ . " --tpl-save");
    }
    $EnableRemoteStatisticsAppliance = 0;
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Build blocked Websites list...\n";
    build_progress("{reconfigure} Whitelisted browsers", 50);
    acl_whitelisted_browsers();
    build_progress("{reconfigure} allowed browsers", 51);
    acl_allowed_browsers();
    echo "Starting......: " . date("H:i:s") . " Checking wrapzap\n";
    build_progress("{reconfigure} wrapzap", 52);
    wrapzap();
    build_progress("{reconfigure} Mime.conf", 53);
    mime_conf();
    build_progress("{reconfigure} Blocked websites", 54);
    $squid->BuildBlockedSites();
    build_progress("{reconfigure} FTP clients ACLs", 55);
    acl_clients_ftp();
    build_progress("{reconfigure} Dynamic rules caches", 56);
    echo "Starting......: " . date("H:i:s") . " [SYS]: Dynamic rules caches...\n";
    dyn_caches();
    build_progress("{reconfigure} Webfiltering whitelisted", 57);
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Build url_rewrite_access deny...\n";
    urlrewriteaccessdeny();
    echo "Starting......: " . date("H:i:s") . " [SYS]:Squid building main configuration done\n";
    if ($GLOBALS["NOAPPLY"]) {
        $DenySquidWriteConf = 0;
    }
    if ($DenySquidWriteConf == 0) {
        @mkdir("/tmp", 0755, true);
        $squid->CURRENT_PROGRESS = 79;
        $squid->MAX_PROGRESS = 79;
        $conf = $squid->BuildSquidConf();
        $conf = str_replace("\n\n", "\n", $conf);
        build_progress("{writing_configuration}", 79);
        @file_put_contents("/tmp/squid.conf", $conf);
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Check validity of the configuration file with /tmp/squid.conf...\n";
        $GLOBALS["SQUID_PATTERN_ERROR"] = array();
        CheckConfig("/tmp/squid.conf");
        if (count($GLOBALS["SQUID_PATTERN_ERROR"]) > 0) {
            echo "Starting......: " . date("H:i:s") . " [SYS]: Some errors are detected and cleaned\n";
            squid_admin_mysql(1, "Some errors has been detected in settings", "Please check theses values:\n" . @implode("\n", $GLOBALS["SQUID_PATTERN_ERROR"]));
            $conf = @file_get_contents("/tmp/squid.conf");
        }
        exec("{$squidbin} -f /tmp/squid.conf -k parse 2>&1", $results);
        while (list($index, $ligne) = each($results)) {
            if (strpos($ligne, "| WARNING:") > 0) {
                continue;
            }
            if (preg_match("#ERROR: Failed#", $ligne)) {
                build_progress("{operation_failed} !!!", 110);
                echo "Starting......: " . date("H:i:s") . " [SYS]: Squid `{$ligne}`, aborting configuration, keep the old one...\n";
                echo "<div style='font-size:16px;font-weight:bold;color:#E71010'>{$ligne}</div>";
                $sock->TOP_NOTIFY("{$ligne}", "error");
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.squid.php

示例11: SwapWatchdog


//.........这里部分代码省略.........
    if ($pourc > 50) {
        if ($pourc < 70) {
            $filetime = $GLOBALS["CLASS_UNIX"]->file_time_min($filecache50);
            if ($filetime > 15) {
                @unlink($filecache50);
                @file_put_contents($filecache50, time());
                squid_admin_mysql(1, "[WARNING]: System swap exceed {$pourc}%", "Time {$filetime}Mn\nYou will find here a snapshot of current tasks\n" . $GLOBALS["CLASS_UNIX"]->ps_mem_report(), __FILE__, __LINE__);
            }
        }
    }
    if ($pourc > 70) {
        $filetime = $GLOBALS["CLASS_UNIX"]->file_time_min($filecache100);
        if ($filetime > 10) {
            @unlink($filecache100);
            @file_put_contents($filecache100, time());
            squid_admin_mysql(0, "[ALERT!!]: System swap exceed {$pourc}%", "Time {$filetime}Mn\nYou will find here a snapshot of current tasks\n" . $GLOBALS["CLASS_UNIX"]->ps_mem_report(), __FILE__, __LINE__);
        }
    }
    if ($SwapOffOn["SwapEnabled"] == 0) {
        return;
    }
    $filetime = $GLOBALS["CLASS_UNIX"]->file_time_min($filecache);
    if ($filetime < $SwapOffOn["SwapTimeOut"]) {
        events("{$filetime}Mn need to wait {$SwapOffOn["SwapTimeOut"]}mn", __FUNCTION__, __LINE__);
        return;
    }
    if ($SwapOffOn["SwapMaxMB"] > 0) {
        if ($sys->swap_used > $SwapOffOn["SwapMaxMB"]) {
            $execeed_text = $SwapOffOn["SwapMaxMB"] . "MB";
            $reboot = true;
        }
    }
    if ($SwapOffOn["SwapMaxMB"] == 0) {
        if ($pourc > 3) {
            if ($pourc > $SwapOffOn["SwapMaxPourc"]) {
                $execeed_text = $SwapOffOn["SwapMaxPourc"] . "%";
                $reboot = true;
            }
        }
    }
    @unlink($filecache);
    @file_put_contents($filecache, time());
    if (!$reboot) {
        return;
    }
    $swapoff = $GLOBALS["CLASS_UNIX"]->find_program("swapoff");
    $swapon = $GLOBALS["CLASS_UNIX"]->find_program("swapon");
    if (!is_file($swapoff)) {
        events("swapoff no such file", __FUNCTION__, __LINE__);
        shell_exec2("sync; echo \"3\" > /proc/sys/vm/drop_caches >/dev/null 2>&1");
        return;
    }
    if (!is_file($swapon)) {
        events("swapon no such file", __FUNCTION__, __LINE__);
        shell_exec2("sync; echo \"3\" > /proc/sys/vm/drop_caches >/dev/null 2>&1");
        return;
    }
    $time = time();
    if (function_exists("WriteToSyslogMail")) {
        WriteToSyslogMail("SwapWatchdog:: Starting to purge the swap file because it execeed rules", basename(__FILE__));
    }
    $cmd = "{$swapoff} -a 2>&1";
    $results = array();
    $results[] = $cmd;
    events("running {$cmd}", __FUNCTION__, __LINE__);
    exec($cmd, $results);
    $cmd = "{$swapon} -a 2>&1";
    $results[] = $cmd;
    events("running {$cmd}", __FUNCTION__, __LINE__);
    exec($cmd, $results);
    $text = @implode("\n", $results);
    $time_duration = distanceOfTimeInWords($time, time());
    shell_exec2("sync; echo \"3\" > /proc/sys/vm/drop_caches >/dev/null 2>&1");
    events("results: {$time_duration}\n {$text}", __FUNCTION__, __LINE__);
    $notif = $notif . "\nMemory swap purge {$execeed_text} ({$time_duration})\n{$text}";
    $notif = $notif . "\n" . $GLOBALS["CLASS_UNIX"]->ps_mem_report();
    squid_admin_mysql(1, "Memory swap purge {$execeed_text}", "(Execution time: {$time_duration})", __FILE__, __LINE__);
    $GLOBALS["CLASS_UNIX"]->send_email_events("Memory swap purge {$execeed_text} (task time execuction: {$time_duration})", $text, "system");
    $sqdbin = $GLOBALS["CLASS_UNIX"]->find_program("squid");
    if (!is_file($sqdbin)) {
        $sqdbin = $GLOBALS["CLASS_UNIX"]->find_program("squid3");
    }
    if (is_file($sqdbin)) {
        $php5 = $GLOBALS["CLASS_UNIX"]->LOCATE_PHP5_BIN();
        $nohup = $GLOBALS["CLASS_UNIX"]->find_program("nohup");
        if (function_exists("debug_backtrace")) {
            $trace = debug_backtrace();
            if (isset($trace[1])) {
                $sourcefunction = $trace[1]["function"];
                $sourceline = $trace[1]["line"];
                $executed = "Executed by {$sourcefunction}() line {$sourceline}\nusing argv:{$GLOBALS["ARGVS"]}\n";
            }
        }
        squid_admin_mysql(1, "Asking to reload proxy service after purging the Swap file", "{$executed}\n{$notif}", __FILE__, __LINE__);
        if (function_exists("WriteToSyslogMail")) {
            WriteToSyslogMail("SwapWatchdog:: reloading Squid after purging the Swap file", basename(__FILE__));
        }
        shell_exec2("{$nohup} {$php5} /usr/share/artica-postfix/exec.squid.php --reload-squid --bywatchdog >/dev/null 2>&1 &");
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.status.php

示例12: JOIN_ACTIVEDIRECTORY

function JOIN_ACTIVEDIRECTORY()
{
    $unix = new unix();
    $function = __FUNCTION__;
    $user = new settings_inc();
    $netbin = $unix->LOCATE_NET_BIN_PATH();
    if (!is_file($netbin)) {
        echo "Starting......: " . date("H:i:s") . "  {$function}, net, no such binary\n";
        return;
    }
    if (!$user->SAMBA_INSTALLED) {
        echo "Starting......: " . date("H:i:s") . "  {$function}, Samba, no such software\n";
        return;
    }
    $NetADSINFOS = $unix->SAMBA_GetNetAdsInfos();
    $KDC_SERVER = $NetADSINFOS["KDC server"];
    $sock = new sockets();
    $array = unserialize(base64_decode($sock->GET_INFO("SambaAdInfos")));
    run_msktutils();
    $domainUp = strtoupper($array["ADDOMAIN"]);
    $domain_lower = strtolower($array["ADDOMAIN"]);
    $adminpassword = $array["PASSWORD"];
    $adminpassword = $unix->shellEscapeChars($adminpassword);
    $adminname = $array["ADADMIN"];
    $ad_server = $array["ADSERVER"];
    $workgroup = $array["WORKGROUP"];
    $ipaddr = trim($array["ADSERVER_IP"]);
    if ($GLOBALS["VERBOSE"]) {
        echo "{$function}, Using Password: {$adminpassword}";
    }
    if (function_exists("WriteToSyslogMail")) {
        WriteToSyslogMail("Trying to relink this server with Active Directory {$ad_server}.{$domain_lower} server", basename(__FILE__));
    }
    echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname}]: Kdc server ads : {$KDC_SERVER}\n";
    if ($KDC_SERVER == null) {
        $cmd = "{$netbin} ads join -W {$ad_server}.{$domain_lower} -S {$ad_server} -U {$adminname}%{$adminpassword} 2>&1";
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . "  {$function}, {$cmd}\n";
        }
        exec("{$cmd}", $results);
        while (list($index, $line) = each($results)) {
            echo "Starting......: " . date("H:i:s") . "  {$function}, ads join [{$adminname}]: {$line}\n";
        }
        $NetADSINFOS = $unix->SAMBA_GetNetAdsInfos();
        $KDC_SERVER = $NetADSINFOS["KDC server"];
    }
    if ($KDC_SERVER == null) {
        echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname}]: unable to join the domain {$domain_lower}\n";
    }
    echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname}]: setauthuser..\n";
    $cmd = "{$netbin} setauthuser -U {$adminname}%{$adminpassword}";
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . "  {$function}, {$cmd}\n";
    }
    shell_exec($cmd);
    if ($ipaddr == null) {
        $JOINEDRES = false;
        echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname} 0]: join for {$workgroup} (without IP addr)\n";
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . "  {$function},[{$adminname} 0]: {$cmd}\n";
        }
        $cmd = "{$netbin} join -U {$adminname}%{$adminpassword} {$workgroup} 2>&1";
        exec($cmd, $A1);
        while (list($index, $line) = each($A1)) {
            if (preg_match("#Joined#", $line)) {
                echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname} 0]: join for {$workgroup} (without IP addr) success\n";
                $JOINEDRES = true;
                break;
            }
            if (function_exists("WriteToSyslogMail")) {
                WriteToSyslogMail("Starting......: " . date("H:i:s") . "  Samba, {$line}", basename(__FILE__));
            }
        }
        if (!$JOINEDRES) {
            echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname} 0]: join as netrpc.. (without IP addr)\n";
            $cmd = "{$netbin} rpc join -U {$adminname}%{$adminpassword} {$workgroup} 2>&1";
            exec($cmd, $A2);
            if ($GLOBALS["VERBOSE"]) {
                echo "Starting......: " . date("H:i:s") . "  {$function}, {$cmd}\n";
            }
            while (list($index, $line) = each($A2)) {
                if (preg_match("#Joined#", $line)) {
                    echo "Starting......: " . date("H:i:s") . "  Samba, [{$adminname} 0]: join for {$workgroup} (without IP addr) success\n";
                    $JOINEDRES = true;
                    break;
                }
                if (function_exists("WriteToSyslogMail")) {
                    WriteToSyslogMail("Starting......: " . date("H:i:s") . "  Samba, {$line}", basename(__FILE__));
                }
            }
        }
    }
    if ($ipaddr != null) {
        if (!$GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . "  {$function}, [{$adminname} 1]: ads '{$netbin} ads join -I {$ipaddr} -U {$adminname}%**** {$workgroup}'\n";
        }
        //$cmd="$netbin ads join -S $ad_server.$domain_lower -I $ipaddr -U $adminname%$adminpassword 2>&1";
        $cmd = "{$netbin} ads join -I {$ipaddr} -U {$adminname}%{$adminpassword} {$workgroup} 2>&1";
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . "  {$function},[{$adminname} 1]: {$cmd}\n";
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.samba.php

示例13: LOG_ADDED_CATZ

 function LOG_ADDED_CATZ($category_table, $rownumbers)
 {
     //webfilters_bigcatzlogs
     if (function_exists("debug_backtrace")) {
         $trace = @debug_backtrace();
         if (isset($trace[1])) {
             $called = "called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
         }
     }
     if ($rownumbers == 0) {
         return;
     }
     if (!is_numeric($rownumbers)) {
         return;
     }
     if ($category_table == null) {
         if (function_exists("WriteToSyslog")) {
             WriteToSyslog("Fatal: No category Table set {$called}", basename(__FILE__));
         }
     }
     if ($this->TABLE_EXISTS("webfilters_bigcatzlogs")) {
         $this->CheckTables();
     }
     $categoryname = $this->tablename_tocat($category_table);
     if ($categoryname == null) {
         if (function_exists("WriteToSyslog")) {
             WriteToSyslog("Warning: Unable to find category for {$categoryname} {$called}", basename(__FILE__));
         }
     }
     $sql = "INSERT IGNORE INTO webfilters_bigcatzlogs (zDate,category_table,category,AddedItems) \n\t\tVALUES (NOW(),'{$category_table}','{$categoryname}','{$rownumbers}')";
     $this->QUERY_SQL($sql);
     if (!$this->ok) {
         if (function_exists("WriteToSyslogMail")) {
             WriteToSyslogMail(__FUNCTION__ . "::{$q->mysql_error}", basename(__FILE__));
         }
         return;
     }
     //if(function_exists("WriteToSyslogMail")){WriteToSyslogMail("$category_table $rownumbers new items", basename(__FILE__));}
     $ID = time();
     $sql = "INSERT IGNORE INTO instant_updates (ID,zDate,CountItems) VALUES('{$ID}',NOW(),'{$rownumbers}')";
     $this->QUERY_SQL($sql);
 }
开发者ID:articatech,项目名称:artica,代码行数:42,代码来源:class.mysql.squid.builder.php

示例14: Parseline


//.........这里部分代码省略.........
        }
        return;
    }
    // -------------------------------------------------------------------------------------------------------------------------------------------------
    if (preg_match("#failed due to\\s+\\[winbind client not authorized to use winbindd_pam_auth_crap\\.\\s+Ensure permissions on.+?are set correctly#", $buffer)) {
        events("SQUID: winbindd_pam_auth_crap --> exec.kerbauth.php --winbindfix");
        $file = "/etc/artica-postfix/croned.1/winbindd_pam_auth_crap";
        if (IfFileTime($file, 5)) {
            squid_admin_mysql(0, "NTLM: client not authorized to use winbindd_pam_auth_crap", $buffer, __FILE__, __LINE__);
            shell_exec("{$GLOBALS["nohup"]} {$GLOBALS["LOCATE_PHP5_BIN"]} /usr/share/artica-postfix/exec.kerbauth.php --winbindfix");
            @unlink($file);
            WriteFileCache($file);
        }
        return;
    }
    // -------------------------------------------------------------------------------------------------------------------------------------------------
    if (preg_match("#smbd\\[.+?:\\s+smbd_open_once_socket: open_socket_in: Address already in use#", $buffer)) {
        events("SMBD: smbd_open_once_socket: open_socket_in: Address already in use");
        $file = "/etc/artica-postfix/croned.1/smbd_open_once_socket.open_socket_in.Address.already.in.use";
        if (IfFileTime($file, 10)) {
            email_events("Samba: try to bind ipv6 and ipv4, fixed", "samba claims:\n{$buffer}\n\t\t\tArtica will do \"sysctl net.ipv6.bindv6only=1\" to fix this issue (see https://bugzilla.redhat.com/show_bug.cgi?id=726936)", 'system');
            shell_exec("{$GLOBALS["sysctl"]} net.ipv6.bindv6only=1");
            @unlink($file);
            WriteFileCache($file);
        }
        return;
    }
    // -------------------------------------------------------------------------------------------------------------------------------------------------
    if (preg_match("#winbindd.+?Could not receive trustdoms#", $buffer)) {
        events("WINBIND: Could not receive trustdoms");
        $file = "/etc/artica-postfix/croned.1/Could.not.receive.trustdoms";
        if (IfFileTime($file, 5)) {
            events("WINBIND: Could not receive trustdoms -> restart Winbind");
            if (function_exists("WriteToSyslogMail")) {
                WriteToSyslogMail("restart winbindd", basename(__FILE__));
            }
            email_events("Samba: Could not receive trustdoms", "samba claims:\n{$buffer}\nArtica will try to restart winbindd service", 'system');
            shell_exec("{$GLOBALS["nohup"]} /etc/init.d/winbind restart >/dev/null 2>&1 &");
            @unlink($file);
        }
        WriteFileCache($file);
        return;
    }
    if (preg_match("#winbindd\\[.+?ADS uninitialized: No logon servers#", $buffer)) {
        $file = "/etc/artica-postfix/croned.1/winbindd-No-logon-servers";
        events("WINBINDD: ADS uninitialized: No logon servers");
        if ($GLOBALS["EnableKerbAuth"] == 1) {
            if (IfFileTime($file, 3)) {
                squid_admin_mysql(0, "NTLM: No logon servers", $buffer, __FILE__, __LINE__);
                events("WINBINDD: EnableKerbAuth:: exec.kerbauth.php --build (do nothing new patch 2012-05-04)");
                //shell_exec("{$GLOBALS["nohup"]} {$GLOBALS["LOCATE_PHP5_BIN"]} /usr/share/artica-postfix/exec.kerbauth.php --build &");
                WriteFileCache($file);
            }
            return;
        }
    }
    if (preg_match("#lessfs\\[.+?send_backlog : failed to connect to the slave#", $buffer, $re)) {
        $file = "/etc/artica-postfix/croned.1/lessfs.1";
        if (IfFileTime($file, 5)) {
            email_events("lessFS: Replication deduplication to connect to the slave ", "lessFS claims:\n{$buffer}\nPlease check communications with the slave", 'system');
            WriteFileCache($file);
            return;
        }
    }
    if (preg_match("#lessfs\\[.+?send_backlog : invalid message size#", $buffer, $re)) {
        $file = "/etc/artica-postfix/croned.1/lessfs.2";
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:67,代码来源:exec.syslog.php

示例15: quarantine_process

function quarantine_process($file)
{
    if (!is_numeric($GLOBALS["ArticaMetaEnabled"])) {
        $sock = new sockets();
        $ArticaMetaEnabled = $sock->GET_INFO("ArticaMetaEnabled");
        if ($ArticaMetaEnabled == null) {
            $ArticaMetaEnabled = 0;
        }
        $GLOBALS["ArticaMetaEnabled"] = $ArticaMetaEnabled;
        $meta = new artica_meta();
        $GLOBALS["UUID"] = $meta->uuid;
        $GLOBALS["SERIAL"] = $meta->serial;
    }
    $fullmessagesdir = "/opt/artica/share/www/original_messages";
    $target_file = $file . ".eml";
    $decompress = true;
    if (preg_match("#\\.gz\$#", $file)) {
        events("gunzip compressed, decompressing {$file} to {$target_file}");
        @mkdir("/tmp/amavis-quar");
        $cmd = "/bin/gunzip -d -c \"{$file}\" >{$target_file} 2>&1";
        $values = system($cmd);
        if (!is_file($target_file)) {
            events("Failed decompress {$file} \"{$values}\"");
            return false;
        }
    } else {
        $target_file = $file;
        $decompress = false;
    }
    $ldap = new clladp();
    $q = new mysql();
    events("Unpack {$target_file} " . @filesize($target_file) . " bytes");
    $mm = new demime($target_file);
    if (!$mm->unpack()) {
        events("Failed unpack with error \"{$mm->error}\"");
        @unlink($target_file);
        return false;
    }
    $message_html = $mm->ExportToHtml($target_file);
    if (strlen($message_html) == 0) {
        if ($decompress) {
            @unlink($target_file);
        }
        return false;
    }
    if (count($mm->mailto_array) == 0) {
        events("No recipients Aborting");
        if ($decompress) {
            @unlink($target_file);
        }
        return true;
    }
    $filesize = filesize($target_file);
    events("Message with " . count($mm->mailto_array) . " recipients html file:" . strlen($message_html) . " bytes");
    if (preg_match("#(.+?)@(.+)#", $mm->mailfrom, $re)) {
        $domain_from = $re[2];
    }
    $message_html = addslashes($message_html);
    $filename = basename($target_file);
    $newmessageid = md5($mm->message_id . $recipient);
    $sqlfilesize = @filesize($target_file);
    if ($sqlfilesize == 0) {
        events("error \"{$target_file}\" filesize=0!!!");
        WriteToSyslogMail("message-id=<{$mm->message_id}> from=<{$mm->mailfrom}> to=<{$impled_rctp}> size={$filesize} filesize error", __FILE__, true);
        return false;
    }
    $BinMessg = addslashes(fread(fopen($target_file, "r"), $sqlfilesize));
    if (strlen($BinMessg) == 0) {
        events("error \"{$target_file}\" BinMessg=0!!!");
        WriteToSyslogMail("message-id=<{$mm->message_id}> from=<{$mm->mailfrom}> to=<{$impled_rctp}> size={$filesize} filesize error", __FILE__, true);
        return false;
    }
    if (count($mm->mailto_array) == 0) {
        WriteToSyslogMail("message-id=<{$mm->message_id}> from=<{$mm->mailfrom}> size={$filesize} recipient error", __FILE__, true);
        return false;
    }
    reset($mm->mailto_array);
    while (list($num, $recipient) = each($mm->mailto_array)) {
        if (preg_match("#(.+?)@(.+)#", $recipient, $re)) {
            $recipient_domain = $re[2];
        }
        $ou = $mm->GetOuFromEmail($recipient);
        if ($ou == null) {
            events("Failed to get organization name from  \"{$recipient_domain}\"");
        }
        $sql = "INSERT IGNORE INTO quarantine (\n\t\t\t\tMessageID,\n\t\t\t\tzDate,\n\t\t\t\tmailfrom,\n\t\t\t\tmailfrom_domain,\n\t\t\t\tsubject,\n\t\t\t\tMessageBody,\n\t\t\t\torganization,\n\t\t\t\tmailto,\n\t\t\t\toriginal_messageid,\n\t\t\t\tmessage_size,BinMessg,filename,filesize\n\t\t\t\t)\n\t\t\tVALUES(\n\t\t\t\t'{$newmessageid}',\n\t\t\t\t'{$mm->message_date}',\n\t\t\t\t'{$mm->mailfrom}',\n\t\t\t\t'{$domain_from}',\n\t\t\t\t'{$mm->subject}',\n\t\t\t\t'{$message_html}',\n\t\t\t\t'{$ou}',\n\t\t\t\t'{$recipient}',\n\t\t\t\t'{$mm->message_id}',\n\t\t\t\t'{$filesize}','{$BinMessg}','{$filename}','{$sqlfilesize}')";
        if (!$q->QUERY_SQL($sql, "artica_backup")) {
            events($q->mysql_error);
            file_put_contents("/var/log/artica-postfix/mysql-error." . md5($sql) . ".err", "{$sql}\n\n{$q->mysql_error}");
            events("error saved into  /var/log/artica-postfix/mysql-error." . md5($sql) . ".err");
            if ($decompress) {
                @unlink($target_file);
            }
            return false;
        } else {
            if ($GLOBALS["ArticaMetaEnabled"] == 1) {
                if ($GLOBALS["SERIAL"] != null) {
                    $md5 = md5("{$newmessageid}{$mm->message_date}");
                    $sqlmeta = "('{$GLOBALS["UUID"]}','{$GLOBALS["SERIAL"]}','{$newmessageid}','{$mm->message_date}',";
                    $sqlmeta = $sqlmeta . "'{$mm->mailfrom}','{$domain_from}','{$recipient}','{$mm->subject}','{$ou}','{$mm->message_id}',";
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.mailarchive.php


注:本文中的WriteToSyslogMail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。