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


PHP maincf_multi::mailman_aliases方法代码示例

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


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

示例1: build_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"]) {
        echo __FUNCTION__ . " -> writing /etc/postfix/virtual\n";
    }
    @file_put_contents("/etc/postfix/virtual", implode("\n", $final));
    @file_put_contents("/etc/postfix/virtual.domains", implode("\n", $li));
    echo "Starting......: " . date("H:i:s") . " Postfix compiling virtual aliase database /etc/postfix/virtual\n";
    if ($GLOBALS["DEBUG"]) {
        echo __FUNCTION__ . " -> {$GLOBALS["postmap"]} hash:/etc/postfix/virtual >/dev/null 2>&1\n";
    }
    shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/virtual >/dev/null 2>&1");
    $dbmaps = new postfix_extern();
    $contz = $dbmaps->build_extern("master", "virtual_alias_maps");
    if ($contz != null) {
        $virtual_alias_maps_cf[] = $contz;
    }
    if (!is_array($virtual_alias_maps_cf)) {
        if ($GLOBALS["DEBUG"]) {
            echo __FUNCTION__ . " -> {$GLOBALS["postconf"]} -e \"virtual_alias_maps = \" >/dev/null 2>&1\n";
        }
        shell_exec("{$GLOBALS["postconf"]} -e \"virtual_alias_maps = \" >/dev/null 2>&1");
        echo "Starting......: " . date("H:i:s") . " Postfix No virtual aliases\n";
        return;
    } else {
        echo "Starting......: " . date("H:i:s") . " Postfix building virtual_alias_maps\n";
        shell_exec("{$GLOBALS["postconf"]} -e \"virtual_alias_maps = " . @implode(",", $virtual_alias_maps_cf) . $main->mailman_aliases() . "\" >/dev/null 2>&1");
    }
}
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:exec.postfix.hashtables.php


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