當前位置: 首頁>>代碼示例>>PHP>>正文


PHP maincf_multi::mailling_list_mysql方法代碼示例

本文整理匯總了PHP中maincf_multi::mailling_list_mysql方法的典型用法代碼示例。如果您正苦於以下問題:PHP maincf_multi::mailling_list_mysql方法的具體用法?PHP maincf_multi::mailling_list_mysql怎麽用?PHP maincf_multi::mailling_list_mysql使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maincf_multi的用法示例。


在下文中一共展示了maincf_multi::mailling_list_mysql方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: build_virtual_alias_maps

function build_virtual_alias_maps()
{
    $main = new maincf_multi("master", "master");
    $ldap = new clladp();
    if ($GLOBALS["DEBUG"]) {
        echo __FUNCTION__ . " -> virtual_alias_maps=" . count($GLOBALS["virtual_alias_maps"]) . " entries\n";
    }
    if (is_array($GLOBALS["virtual_alias_maps_emailing"])) {
        echo "Starting......: " . date("H:i:s") . " Postfix [" . __LINE__ . "] " . count($GLOBALS["virtual_alias_maps_emailing"]) . " distribution listes\n";
        while (list($num, $ligne) = each($GLOBALS["virtual_alias_maps_emailing"])) {
            $num = trim($num);
            $num = str_replace("\r", "", $num);
            $num = str_replace("\n", "", $num);
            if ($GLOBALS["VERBOSE"]) {
                echo "FINAL -> {$num}/\"{$ligne}\"\n";
            }
            if ($ligne == null) {
                continue;
            }
            $final[] = $ligne;
        }
    }
    //-----------------------------------------------------------------------------------
    if (is_array($GLOBALS["virtual_alias_maps"])) {
        echo "Starting......: " . date("H:i:s") . " Cleaning virtual aliase(s)\n";
        while (list($num, $ligne) = each($GLOBALS["virtual_alias_maps"])) {
            $ligne = trim($ligne);
            $ligne = str_replace("\r", "", $ligne);
            $ligne = str_replace("\n", "", $ligne);
            if ($ligne == null) {
                continue;
            }
            if (preg_match("#x500:#", $ligne)) {
                continue;
            }
            if (preg_match("#x400:#", $ligne)) {
                continue;
            }
            $final[] = $ligne;
        }
    }
    //-----------------------------------------------------------------------------------
    $dn = "cn=artica_smtp_sync,cn=artica,{$ldap->suffix}";
    $filter = "(&(objectClass=InternalRecipients)(cn=*))";
    if ($ldap->ExistsDN($dn)) {
        $attrs = array("cn");
        $hash = $ldap->Ldap_search($dn, $filter, $attrs);
        if ($hash["count"] > 0) {
            for ($i = 0; $i < $hash["count"]; $i++) {
                $email = $hash[$i]["cn"][0];
                $email = trim($email);
                $email = str_replace("\r", "", $email);
                $email = str_replace("\n", "", $email);
                if (trim($email) == null) {
                    continue;
                }
                $final[] = "{$email}\t{$email}";
            }
        }
    }
    //-----------------------------------------------------------------------------------
    if (isset($GLOBALS["LDAPDBS"]["virtual_alias_maps"])) {
        if (!is_array($GLOBALS["LDAPDBS"]["virtual_alias_maps"])) {
            $virtual_alias_maps_cf = $GLOBALS["LDAPDBS"]["virtual_alias_maps"];
        }
    }
    $sock = new sockets();
    $MailingListUseLdap = $sock->GET_INFO("MailingListUseLdap");
    if (!is_numeric($MailingListUseLdap)) {
        $MailingListUseLdap = 0;
    }
    if ($MailingListUseLdap == 1) {
        $virtual_alias_maps_cf[] = "ldap:/etc/postfix/mailinglist.ldap.cf";
        mailling_ldap();
    }
    $sql = "SELECT * FROM postfix_aliases_domains";
    $q = new mysql();
    $pre = '${1}';
    $li = array();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $ligne["alias"] = trim($ligne["alias"]);
        $ligne["alias"] = strtolower($ligne["alias"]);
        $aliases = str_replace(".", "\\.", $ligne["alias"]);
        $domain = $ligne["domain"];
        $li[] = "/^(.*)@{$aliases}\$/\t{$pre}@{$domain}";
        $final[] = "{$ligne["alias"]}\tDOMAIN";
    }
    $main = new maincf_multi("master", "master");
    $virtual_mailing_addr = $main->mailling_list_mysql("master");
    if (is_array($virtual_mailing_addr)) {
        while (list($num, $ligne) = each($virtual_mailing_addr)) {
            $final[] = $ligne;
        }
    }
    echo "Starting......: " . date("H:i:s") . " Postfix " . count($final) . " virtual aliase(s)\n";
    echo "Starting......: " . date("H:i:s") . " Postfix " . count($li) . " virtual domain(s) aliases\n";
    $virtual_alias_maps_cf[] = "hash:/etc/postfix/virtual";
    $virtual_alias_maps_cf[] = "pcre:/etc/postfix/virtual.domains";
    if ($GLOBALS["DEBUG"]) {
//.........這裏部分代碼省略.........
開發者ID:articatech,項目名稱:artica,代碼行數:101,代碼來源:exec.postfix.hashtables.php


注:本文中的maincf_multi::mailling_list_mysql方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。