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


PHP maincf_multi::mailman_virtual方法代码示例

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


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

示例1: aliases_users

function aliases_users()
{
    $ldap = new clladp();
    $users = new usersMenus();
    $main = new maincf_multi();
    if ($GLOBALS["VERBOSE"]) {
        echo "*** aliases_users() ***\n";
    }
    $filter = "(&(objectClass=userAccount)(uid=*))";
    $attrs = array("uid", "mail");
    $trap_uid = "uid";
    $dn = "dc=organizations,{$ldap->suffix}";
    if ($ldap->EnableManageUsersTroughActiveDirectory) {
        $ldapAD = new ldapAD();
        $filter = "(&(objectClass=user)(samaccountname=*))";
        $attrs = array("samaccountname", "mail");
        $trap_uid = "samaccountname";
        $dn = "{$ldapAD->suffix}";
        $hash = $ldapAD->Ldap_search($dn, $filter, $attrs);
    } else {
        $hash = $ldap->Ldap_search($dn, $filter, $attrs);
    }
    for ($i = 0; $i < $hash["count"]; $i++) {
        $uid = trim($hash[$i][$trap_uid][0]);
        if (strpos($uid, "\$") > 0) {
            continue;
        }
        if ($uid == null) {
            continue;
        }
        if (isset($hash[$i]["mail"])) {
            for ($t = 0; $t < $hash[$i]["mail"]["count"]; $t++) {
                $mail = $hash[$i]["mail"][$t];
                $mail = repair_addr($mail);
                $mail = trim($mail);
                $mail = str_replace("\r", "", $mail);
                $mail = str_replace("\n", "", $mail);
                if ($mail == null) {
                    continue;
                }
                if (!isset($GLOBALS["virtual_alias_maps_mem"][$mail])) {
                    if (!isset($GLOBALS["virtual_alias_maps_emailing"][$mail])) {
                        $GLOBALS["virtual_alias_maps_emailing"][$mail] = null;
                    }
                    if ($GLOBALS["virtual_alias_maps_emailing"][$mail] == null) {
                        $GLOBALS["virtual_alias_maps"][$mail] = "{$mail}\t{$mail}";
                    }
                }
                $GLOBALS["virtual_alias_maps_mem"][$mail] = true;
                if (!isset($GLOBALS["alias_maps_mem"][$uid])) {
                    $uid = trim($uid);
                    $uid = str_replace("\r", "", $uid);
                    $uid = str_replace("\n", "", $uid);
                    if ($uid == null) {
                        continue;
                    }
                    if (!preg_match("#.+?@#", $uid)) {
                        $GLOBALS["alias_maps"][] = "{$uid}:{$mail}";
                    }
                    $GLOBALS["alias_maps_mem"][$uid] = true;
                }
                $GLOBALS["virtual_mailbox"] = "{$mail}\t{$uid}";
            }
        } else {
            if ($GLOBALS["VERBOSE"]) {
                echo "Skipping \"{$uid}\" no \"mail\" attribute... in " . basename(__FILE__) . " Line: " . __LINE__ . "\n";
            }
        }
    }
    $filter = "(&(objectClass=transportTable)(cn=*@*))";
    $attrs = array("cn");
    $dn = "cn=PostfixRobots,cn=artica,{$ldap->suffix}";
    $hash = $ldap->Ldap_search($dn, $filter, $attrs);
    for ($i = 0; $i < $hash["count"]; $i++) {
        $cn = $hash[$i]["cn"][0];
        if (preg_match("#(.+?)@#", $cn, $re)) {
            $map = $re[1];
            if (!$GLOBALS["alias_maps_mem"][$map]) {
                $GLOBALS["alias_maps"][] = "{$map}:{$cn}";
                $GLOBALS["alias_maps_mem"][$map] = true;
            }
        }
    }
    $GLOBALS["virtual_alias_maps"] = $main->mailman_virtual($GLOBALS["virtual_alias_maps"]);
    $sock = new sockets();
    $PostfixPostmaster = trim($sock->GET_INFO("PostfixPostmaster"));
    if ($PostfixPostmaster == null) {
        return;
    }
    $myhostname = trim($sock->GET_INFO("myhostname"));
    if ($myhostname == null) {
        $myhostname = $users->hostname;
    }
    preg_match("#(.+?)@#", $PostfixPostmaster, $re);
    $PostfixPostmaster_prefix = trim($re[1]);
    $myhostname = trim($myhostname);
    $GLOBALS["virtual_alias_maps"]["{$PostfixPostmaster_prefix}@{$myhostname}"] = "{$PostfixPostmaster_prefix}@{$myhostname}\t{$PostfixPostmaster}";
    $GLOBALS["virtual_alias_maps"][$PostfixPostmaster] = "{$PostfixPostmaster}\t{$PostfixPostmaster}";
    $GLOBALS["virtual_alias_maps"]["root@{$myhostname}"] = "root@{$myhostname}\t{$PostfixPostmaster}";
    $GLOBALS["virtual_alias_maps"]["postmaster"] = "postmaster\t{$PostfixPostmaster}";
//.........这里部分代码省略.........
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:exec.postfix.hashtables.php


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