本文整理汇总了PHP中clladp::hash_get_all_local_domains方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::hash_get_all_local_domains方法的具体用法?PHP clladp::hash_get_all_local_domains怎么用?PHP clladp::hash_get_all_local_domains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clladp
的用法示例。
在下文中一共展示了clladp::hash_get_all_local_domains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckCyrusByDomains
function CheckCyrusByDomains()
{
if (!is_file('/etc/artica-postfix/settings/Daemons/EnableVirtualDomainsInMailBoxes')) {
return null;
}
$EnableVirtualDomainsInMailBoxes = trim(@file_get_contents('/etc/artica-postfix/settings/Daemons/EnableVirtualDomainsInMailBoxes'));
if ($EnableVirtualDomainsInMailBoxes != 1) {
return null;
}
$users = new usersMenus();
$cyrus_text_password = $users->cyrus_ldap_admin_password;
$ldap = new clladp();
$locals_domains = $ldap->hash_get_all_local_domains();
writelogs("wants to set virtdomains, " . count($locals_domains) . " local domains", __FUNCTION__, __FILE__, __LINE__);
if (!is_array($locals_domains)) {
writelogs("wants to set virtdomains, but no domains set in ldap", __FUNCTION__, __FILE__, __LINE__);
return null;
}
while (list($num, $ligne) = each($locals_domains)) {
writelogs("check {$num} domains", __FUNCTION__, __FILE__, __LINE__);
if ($num == null) {
continue;
}
$cyr = "cyrus@{$num}";
$cyrus_accounts[$cyr] = $cyr;
ChangeCyrusPassword($cyr, $cyrus_text_password);
}
$cyrus_accounts["cyrus"] = "cyrus";
$change = false;
$local_admins = get_cyrus_admins();
while (list($num, $ligne) = each($cyrus_accounts)) {
if (!$local_admins[$ligne]) {
writelogs("Must add {$ligne} in cyrus configuration...", __FUNCTION__, __FILE__, __LINE__);
$local_admins[$ligne] = true;
$change = true;
}
}
if ($change) {
while (list($num, $ligne) = each($local_admins)) {
if (trim($num) == null) {
continue;
}
$admins = $admins . $num . " ";
}
set_cyrus_admins($admins);
} else {
writelogs("no admins to add in /etc/imapd.conf", __FUNCTION__, __FILE__, __LINE__);
}
reset($cyrus_accounts);
while (list($num, $ligne) = each($cyrus_accounts)) {
if (is_file("/usr/sbin/testsaslauthd")) {
writelogs("Testing cyrus account {$num}", __FUNCTION__, __FILE__, __LINE__);
system("/usr/sbin/testsaslauthd -u {$num} -p {$cyrus_text_password} >/dev/null 2>&1");
}
}
}
示例2: build_conf
function build_conf(){
@unlink("/etc/spamassassin/sa-learn-cyrus.conf");
$users=new usersMenus();
if(!$users->cyrus_imapd_installed){return null;}
if($users->ZARAFA_INSTALLED){return null;}
if(!$users->spamassassin_installed){return null;}
$usersList=ListUsers();
if(count($usersList)==0){return null;}
$unix=new unix();
$salearn=$unix->find_program("sa-learn");
$ipurge=$unix->LOCATE_CYRUS_IPURGE();
$users_list=@implode(" ",$usersList);
$sock=new sockets();
$EnableVirtualDomainsInMailBoxes=$sock->GET_INFO("EnableVirtualDomainsInMailBoxes");
if($EnableVirtualDomainsInMailBoxes==1){
$ldap=new clladp();
$domains=$ldap->hash_get_all_local_domains();
while (list ($num, $ligne) = each ($domains) ){
if(trim($ligne)==null){continue;}
$doms[]=$ligne;
}
$domains_list=@implode(" ",$doms);
}
$l[]="# Configuration for sa-learn-cyrus";
$l[]="#";
$l[]="# hjb -- 2008-02-12";
$l[]="#";
$l[]="# -------------------------------------------------------";
$l[]="# global parameters";
$l[]="#";
$l[]="[global]";
$l[]="";
$l[]="# Directory to store output of sa-learn and ipurge temporarily ";
$l[]="tmp_dir = /tmp";
$l[]="";
$l[]="# To avoid race conditions, we use a lock file.";
$l[]="lock_file = /var/lock/sa-learn-cyrus.lock";
$l[]="";
$l[]="# level of verbosity (0 .. 3)?";
$l[]="verbose = 2";
$l[]="";
$l[]="# Don't excute commands, show only what would be executed,";
$l[]="# Change this to 'no' after testing.";
$l[]="simulate = no";
$l[]="";
$l[]="# -------------------------------------------------------";
$l[]="# Mailbox";
$l[]="#";
$l[]="[mailbox]";
$l[]="";
$l[]="# List of mailboxes/users which will be considered.";
$l[]="# If this list is empty all mailboxes will be searched.";
$l[]="#";
$l[]="include_list = '$users_list'";
$l[]="";
$l[]="# If include_list is empty, only mailboxes matching this pattern will be considered";
$l[]="include_regexp = '.*'";
$l[]="";
$l[]="# List of mailboxes/users which will be ignored";
$l[]="exclude_list = ''";
$l[]="";
$l[]="# If exclude_list is empty, mailboxes matching this pattern will be ignored";
$l[]="exclude_regexp = ''";
$l[]="";
$l[]="# Spam folder relative to INBOX (cyrus nomenclature: e.g. 'junk.Spam')";
$l[]="spam_folder = 'Junk'";
$l[]="";
$l[]="# Ham folder relative to INBOX (cyrus nomenclature: e.g. 'junk.Ham')";
$l[]="ham_folder = 'Ham'";
$l[]="";
$l[]="# Remove spam after feeding it to SA";
$l[]="remove_spam = yes";
$l[]="";
$l[]="# Remove ham after feeding it to SA";
$l[]="remove_ham = no";
$l[]="";
$l[]="# -------------------------------------------------------";
$l[]="# Spamassassin";
$l[]="#";
$l[]="[sa]";
$l[]="";
$l[]="# Path with system-wide SA preferences";
$l[]="site_config_path = /etc/spamassassin";
$l[]="";
$l[]="# SA configuration file";
$l[]="prefs_file = /etc/spamassassin/local.cf";
$l[]="";
$l[]="# Path to sa-learn";
$l[]="learn_cmd = $salearn";
$l[]="";
$l[]="# SA user and group";
$l[]="user = root";
//.........这里部分代码省略.........
示例3: localdomain_search
function localdomain_search()
{
$users = new usersMenus();
$page = CurrentPageName();
$t = time();
$tpl = new templates();
$ldap = new clladp();
$are_you_sure_to_delete = $tpl->javascript_parse_text("{are_you_sure_to_delete}");
if ($users->AsPostfixAdministrator) {
$hash = $ldap->hash_get_all_local_domains();
} else {
$hash = $ldap->Hash_associated_domains($_SESSION["ou"]);
}
$search = string_to_flexregex("localdomain-search");
while (list($domain, $ligne) = each($hash)) {
$id = md5($domain);
$delete = imgsimple("delete-32.png", null, "DeleteLocalDomain{$t}('{$domain}','{$id}')");
if ($search != null) {
if (!preg_match("#{$search}#", $domain)) {
continue;
}
}
$tr[] = "\n\t\t<tr id='{$id}'>\n\t\t\t<td style='font-size:18px'><i class='icon-globe'></i> {$domain}</td>\n\t\t\t<td style='text-align:center'>{$delete}</td>\n\t\t</tr>";
}
echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th style='width:99%'>{domains}</th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t\t</table>\n<script>\n\tvar xmem{$t}='';\n\tvar xDeleteLocalDomain{$t}= function (obj) {\t\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue); return;};\n\t\t\$('#'+xmem{$t}).remove();\n\t}\t\t\t\n\t\t\t\t\n\t\tfunction DeleteLocalDomain{$t}(domain,id){\n\t\t\txmem{$t}=id;\n\t\t\tif(confirm('{$are_you_sure_to_delete} '+domain)){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('localdomain-remove',domain);\n\t\t\t\tXHR.appendData('ou','{$_SESSION["ou"]}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',xDeleteLocalDomain{$t});\t\n\t\t\t}\n\t\t}\n\t\t\t\t\n</script>";
}
示例4: BuildConfig
//.........这里部分代码省略.........
$f[] = "mupdate_password: {$LDAP_PASSWORD}";
$f[] = "#mupdate_config: standard";
$f[] = "allowusermoves: true";
$f[] = "{$backend_server_name}_authname: murder";
$f[] = "{$backend_server_name}_password: {$LDAP_PASSWORD}";
$f[] = "proxy_authname: murder";
}
if ($EnableCyrusMasterCluster == 1) {
$ini = new Bs_IniHandler();
$ini->loadFile("/etc/artica-postfix/settings/Daemons/CyrusClusterReplicaInfos");
$CyrusClusterID = intval($sock->GET_INFO("CyrusClusterID"));
if ($CyrusClusterID == 0) {
$CyrusClusterID = 1;
}
$f[] = "sync_host: {$ini->_params["REPLICA"]["servername"]}";
$f[] = "sync_authname: cyrus";
$f[] = "sync_password: {$ini->_params["REPLICA"]["password"]}";
$f[] = "guid_mode: sha1";
$f[] = "sync_log: yes";
$f[] = "sync_repeat_interval: 60";
$f[] = "sync_batch_size: 1000";
$f[] = "sync_machineid: {$CyrusClusterID}";
}
$cur_email[] = "cyrus";
$cur_email[] = "cyrus@{$DOMAIN}";
if ($EnableVirtualDomainsInMailBoxes == 1) {
$ldap = new clladp();
if ($ldap->ldapFailed) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed to connect to LDAP server, checking cache\n";
}
$cur_email = unserialize(@file_get_contents("/etc/artica-postfix/CYRUS_ADMINS_CACHE"));
} else {
$domains = $ldap->hash_get_all_local_domains();
while (list($domain, $cyrusadm) = each($domains)) {
$ldap->CyrusAdminOtherCreate("cyrus@{$domain}", null, true);
$cur_email[] = "cyrus@{$domain}";
}
@file_put_contents("/etc/artica-postfix/CYRUS_ADMINS_CACHE", serialize($cur_email));
}
}
if ($CyrusAdmPlus != null) {
$cur_email[] = $CyrusAdmPlus;
}
while (list($index, $cyrusadm) = each($cur_email)) {
$cyrusadm = trim($cyrusadm);
if ($cyrusadm == null) {
continue;
}
$_cyrusadms[$cyrusadm] = $cyrusadm;
}
while (list($cyrusadm, $xcyrusadm) = each($_cyrusadms)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Cyrus Admin..............: `{$cyrusadm}`\n";
}
$_cyrusadms2[] = $cyrusadm;
}
if ($EnableVirtualDomainsInMailBoxes == 1) {
$f[] = "virtdomains: userid";
$f[] = "defaultdomain: localhost.localdomain";
} else {
$f[] = "virtdomains: no";
}
$f[] = "sasl_mech_list: {$sasl_mech_list}";
if ($CyrusEnableBackendMurder == 1) {
$cur_email[] = "murder";