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


PHP maincf_multi::check_client_access方法代码示例

本文整理汇总了PHP中maincf_multi::check_client_access方法的典型用法代码示例。如果您正苦于以下问题:PHP maincf_multi::check_client_access方法的具体用法?PHP maincf_multi::check_client_access怎么用?PHP maincf_multi::check_client_access使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maincf_multi的用法示例。


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

示例1: SaveConf

function SaveConf()
{
    include_once dirname(__FILE__) . "/ressources/class.maincf.multi.inc";
    shell_exec("export LC_CTYPE=C");
    shell_exec("export LC_ALL=C");
    shell_exec("export LANG=C");
    shell_exec("export LANGUAGE=C");
    shell_exec("export LC_MESSAGES=posix");
    $user = new usersMenus();
    $spam = new spamassassin();
    $unix = new unix();
    $postfix_multi = new maincf_multi("master");
    $postfix_multi->check_client_access();
    $spamd = $unix->find_program("spamd");
    if (is_file("/usr/local/bin/spamd")) {
        $spamd = "/usr/local/bin/spamd";
    }
    $content = @file_get_contents($spamd);
    if (strpos($content, "/etc/mail/spamassassin") > 0) {
        $content = str_replace("/etc/mail/spamassassin", "/etc/spamassassin", $content);
        @file_put_contents($spamd, $content);
    }
    $datas = $spam->BuildConfig();
    $datas = str_replace("Array", "", $datas);
    echo "Starting......: " . date("H:i:s") . " spamassassin saving /etc/spamassassin/local.cf\n";
    @unlink("/etc/spamassassin/local.cf");
    file_put_contents("/etc/spamassassin/local.cf", $datas);
    if (is_file("/etc/spamassassin/v312.pre")) {
        @unlink("/etc/spamassassin/v312.pre");
    }
    if (is_file("/etc/mail/spamassassin/v312.pre")) {
        @unlink("/etc/mail/spamassassin/v312.pre");
    }
    if (is_file("/etc/mail/spamassassin/local.cf")) {
        @unlink("/etc/mail/spamassassin/local.cf");
        file_put_contents("/etc/mail/spamassassin/local.cf", $datas);
    }
    if (is_file("/usr/share/artica-postfix/bin/install/postfix/Botnet.cf")) {
        @copy("/usr/share/artica-postfix/bin/install/postfix/Botnet.cf", "/etc/spamassassin/Botnet.cf");
        @copy("/usr/share/artica-postfix/bin/install/postfix/Botnet.pl", "/etc/spamassassin/Botnet.pl");
        @copy("/usr/share/artica-postfix/bin/install/postfix/Botnet.pm", "/etc/spamassassin/Botnet.pm");
    }
    if (is_file("/usr/share/artica-postfix/bin/install/postfix/sakam.cf")) {
        @copy("/usr/share/artica-postfix/bin/install/postfix/sakam.cf", "/etc/spamassassin/sakam.cf");
    }
    Chineses_rules();
    TrustedNetworks();
}
开发者ID:articatech,项目名称:artica,代码行数:48,代码来源:exec.spamassassin.php

示例2: update_milter_greylist

function update_milter_greylist()
{
    $unix = new unix();
    $mirror = "http://mirror.articatech.net/webfilters-databases";
    if ($GLOBALS["VERBOSE"]) {
        echo "Downloading {$mirror}/milter-greylist-database.txt\n";
    }
    $curl = new ccurl("{$mirror}/milter-greylist-database.txt");
    $curl->NoHTTP_POST = true;
    $temppath = $unix->TEMP_DIR();
    if (!$curl->GetFile("{$temppath}/milter-greylist-database.txt")) {
        postfix_admin_mysql(0, "Unable to get Milter-greylist index file", $curl->error);
        return;
    }
    if (!is_file("{$temppath}/milter-greylist-database.txt")) {
        postfix_admin_mysql(0, "Unable to get Milter-greylist index file (no such file)", $curl->error);
        return;
    }
    $data = @file_get_contents("{$temppath}/milter-greylist-database.txt");
    $MAIN = unserialize($data);
    if ($GLOBALS["VERBOSE"]) {
        echo $data . "\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        print_r($MAIN);
    }
    @unlink("{$temppath}/milter-greylist-database.txt");
    $TIME = $MAIN["PATTERN"]["TIME"];
    $MD5 = $MAIN["PATTERN"]["MD5"];
    $sock = new sockets();
    $MyTime = $sock->GET_INFO("MilterGreyListPatternTime");
    if (!is_file("/etc/mail/milter-greylist-database.conf")) {
        $MyTime = 0;
    }
    if ($TIME == $MyTime) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$TIME}=={$MyTime} No new update\n";
        }
        return;
    }
    $curl = new ccurl("{$mirror}/milter-greylist-database.gz");
    $curl->NoHTTP_POST = true;
    if (!$curl->GetFile("{$temppath}/milter-greylist-database.gz")) {
        postfix_admin_mysql(0, "Unable to get milter-greylist-database.gz", $curl->error, __FILE__, __LINE__);
        return;
    }
    $md5f = md5_file("{$temppath}/milter-greylist-database.gz");
    if ($md5f != $MD5) {
        @unlink("{$temppath}/milter-greylist-database.gz");
        postfix_admin_mysql(0, "Unable to get milter-greylist-database.gz (corrupted)", $curl->error, __FILE__, __LINE__);
        return;
    }
    if (!$unix->uncompress("{$temppath}/milter-greylist-database.gz", "{$temppath}/milter-greylist-database.conf")) {
        @unlink("{$temppath}/milter-greylist-database.gz");
        postfix_admin_mysql(0, "Unable to extract milter-greylist-database.gz (corrupted)", null, __FILE__, __LINE__);
        return;
    }
    @unlink("{$temppath}/milter-greylist-database.gz");
    @unlink("/etc/mail/milter-greylist-database.conf");
    @copy("{$temppath}/milter-greylist-database.conf", "/etc/mail/milter-greylist-database.conf");
    @unlink("{$temppath}/milter-greylist-database.conf");
    postfix_admin_mysql(0, "Success updating new Milter-greylist database version {$TIME}", null, __FILE__, __LINE__);
    $sock->SET_INFO("MilterGreyListPatternTime", $TIME);
    $sock->SET_INFO("MilterGreyListPatternCount", $unix->COUNT_LINES_OF_FILE("/etc/mail/milter-greylist-database.conf"));
    $main = new maincf_multi("master", "master");
    $check_client_access = $main->check_client_access();
    $postfix = $unix->find_program("postfix");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    shell_exec("{$php5} /usr/share/artica-postfix/exec.postfix.maincf.php --body-checks >/dev/null 2>&1 &");
    shell_exec("{$postfix} stop");
    shell_exec("{$postfix} start");
    postfix_admin_mysql(1, "Restarting Milter-greylist service", null, __FILE__, __LINE__);
    shell_exec("/etc/init.d/milter-greylist restart");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:75,代码来源:exec.milter-greylist.update.php

示例3: smtpd_client_restrictions

function smtpd_client_restrictions()
{
    if (!isset($GLOBALS["CLASS_SOCKET"])) {
        $GLOBALS["CLASS_SOCKET"] = new sockets();
        $sock = $GLOBALS["CLASS_SOCKET"];
    } else {
        $sock = $GLOBALS["CLASS_SOCKET"];
    }
    exec("{$GLOBALS["postconf"]} -h smtpd_client_restrictions", $datas);
    $tbl = explode(",", implode(" ", $datas));
    echo "Old values = {$datas}\n";
    $EnablePostfixAntispamPack = $sock->GET_INFO("EnablePostfixAntispamPack");
    $EnableArticaPolicyFilter = $sock->GET_INFO("EnableArticaPolicyFilter");
    $EnableArticaPolicyFilter = 0;
    $EnableAmavisInMasterCF = $sock->GET_INFO('EnableAmavisInMasterCF');
    $EnableAmavisDaemon = $sock->GET_INFO('EnableAmavisDaemon');
    $amavis_internal = null;
    $newHash = array();
    smtpd_client_restrictions_progress("{cleaning_data}", 10);
    if (is_array($tbl)) {
        while (list($num, $ligne) = each($tbl)) {
            $ligne = trim($ligne);
            if (trim($ligne) == null) {
                continue;
            }
            if ($ligne == "Array") {
                continue;
            }
            $newHash[$ligne] = $ligne;
        }
    }
    $hashToDelete[] = "check_client_access hash:/etc/postfix/check_client_access";
    $hashToDelete[] = "check_client_access \"hash:/etc/postfix/postfix_allowed_connections\"";
    $hashToDelete[] = "check_client_access hash:/etc/postfix/postfix_allowed_connections";
    $hashToDelete[] = "check_client_access pcre:/etc/postfix/fqrdns.pcre";
    $hashToDelete[] = "check_reverse_client_hostname_access pcre:/etc/postfix/fqrdns.pcre";
    $hashToDelete[] = "reject_unknown_reverse_client_hostname";
    $hashToDelete[] = "reject_unknown_client_hostname";
    $hashToDelete[] = "reject_non_fqdn_hostname";
    $hashToDelete[] = "reject_unknown_sender_domain";
    $hashToDelete[] = "reject_non_fqdn_sender";
    $hashToDelete[] = "reject_unauth_pipelining";
    $hashToDelete[] = "reject_invalid_hostname";
    $hashToDelete[] = "reject_unknown_client_hostname";
    $hashToDelete[] = "reject_unknown_reverse_client_hostname";
    $hashToDelete[] = "reject_invalid_hostname";
    $hashToDelete[] = "reject_rbl_client zen.spamhaus.org";
    $hashToDelete[] = "reject_rbl_client sbl.spamhaus.org";
    $hashToDelete[] = "reject_rbl_client cbl.abuseat.org";
    $hashToDelete[] = "reject_unauth_pipelining";
    $hashToDelete[] = "reject_unauth_pipelining";
    $hashToDelete[] = "reject_rbl_client=zen.spamhaus.org";
    $hashToDelete[] = "reject_rbl_client=sbl.spamhaus.org";
    $hashToDelete[] = "reject_rbl_client=sbl.spamhaus.org";
    $hashToDelete[] = "permit_sasl_authenticated";
    $hashToDelete[] = "check_client_access hash:/etc/postfix/amavis_internal";
    $hashToDelete[] = "check_client_access cidr:/etc/postfix/acls.cdir.cf";
    $hashToDelete[] = "check_client_access hash:/etc/postfix/blacklist.domains.cf";
    $hashToDelete[] = "check_recipient_access hash:/etc/postfix/check_recipient_access_ou";
    while (list($num, $ligne) = each($hashToDelete)) {
        if (isset($newHash[$ligne])) {
            unset($newHash[$ligne]);
        }
    }
    if (is_file("/etc/postfix/acls.cdir.cf")) {
        $newHash["check_client_access cidr:/etc/postfix/acls.cdir.cf"] = "check_client_access cidr:/etc/postfix/acls.cdir.cf";
    }
    if (is_file("/etc/postfix/blacklist.domains.cf.db")) {
        $newHash["check_client_access hash:/etc/postfix/blacklist.domains.cf"] = "check_client_access hash:/etc/postfix/blacklist.domains.cf";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . " smtpd_client_restrictions: origin:" . @implode(",", $newHash) . "\n";
    }
    $main = new maincf_multi("master", "master");
    $check_client_access = $main->check_client_access();
    if (strpos($check_client_access, ",") > 0) {
        $check_client_accessEX = explode(",", $check_client_access);
        $check_client_access = null;
        while (list($num, $ligne) = each($check_client_accessEX)) {
            $ligne = trim($ligne);
            if ($ligne == null) {
                continue;
            }
            $newHash[$ligne] = $ligne;
        }
    }
    if ($check_client_access != null) {
        $newHash[$check_client_access] = $check_client_access;
    }
    $smtpd_client_restrictions = array();
    if (count($newHash) > 0) {
        while (list($num, $ligne) = each($newHash)) {
            echo "Starting......: " . date("H:i:s") . " smtpd_client_restrictions: Checks \"{$ligne}\"\n";
            if (preg_match("#(hash|cidr):(.+)\$#", $ligne, $re)) {
                $path = trim($re[2]);
                if (!is_file($path)) {
                    echo "Starting......: " . date("H:i:s") . " smtpd_client_restrictions: bungled \"{$ligne}\"\n";
                    continue;
                }
                $smtpd_client_restrictions[] = $ligne;
//.........这里部分代码省略.........
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:exec.postfix.maincf.php


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