本文整理汇总了PHP中maincf_multi::RelayToPattern方法的典型用法代码示例。如果您正苦于以下问题:PHP maincf_multi::RelayToPattern方法的具体用法?PHP maincf_multi::RelayToPattern怎么用?PHP maincf_multi::RelayToPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maincf_multi
的用法示例。
在下文中一共展示了maincf_multi::RelayToPattern方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sender_dependent_relayhost_maps_build
function sender_dependent_relayhost_maps_build()
{
$ldap = new clladp();
$main = new maincf_multi();
$sender_dependent_relayhost_maps = array();
$filter = "(&(objectClass=SenderDependentRelayhostMaps)(cn=*))";
$attrs = array("cn", "SenderRelayHost");
$dn = "cn=Sender_Dependent_Relay_host_Maps,cn=artica,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter, $attrs);
for ($i = 0; $i < $hash["count"]; $i++) {
$mail = $hash[$i]["cn"][0];
$value = trim($hash[$i][strtolower("SenderRelayHost")][0]);
if ($value == null) {
continue;
}
if ($value == ":") {
continue;
}
$sender_dependent_relayhost_maps[$mail] = $value;
//$GLOBALS["sender_dependent_relayhost_maps"][]="$mail\t$value";
}
$filter = "(&(objectClass=userAccount)(mail=*))";
$attrs = array("mail", "AlternateSmtpRelay");
$dn = "dc=organizations,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter, $attrs);
for ($i = 0; $i < $hash["count"]; $i++) {
$mail = $hash[$i]["mail"][0];
if (!isset($hash[$i][strtolower("AlternateSmtpRelay")])) {
continue;
}
$value = trim($hash[$i][strtolower("AlternateSmtpRelay")][0]);
if ($value == null) {
continue;
}
if ($value == ":") {
continue;
}
$sender_dependent_relayhost_maps[$mail] = $value;
//$GLOBALS["sender_dependent_relayhost_maps"][]="$mail\t$value";
}
$filter = "(&(objectClass=SenderDependentSaslInfos)(cn=*))";
$attrs = array("cn", "SenderCanonicalRelayHost");
$dn = "dc=organizations,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter, $attrs);
for ($i = 0; $i < $hash["count"]; $i++) {
$mail = $hash[$i]["cn"][0];
$value = trim($hash[$i][strtolower("SenderCanonicalRelayHost")][0]);
if ($value == null) {
continue;
}
if ($value == ":") {
continue;
}
$sender_dependent_relayhost_maps[$mail] = $value;
}
$arr = array("SmtpSaslPasswordString");
$filter = "(&(objectclass=PostfixSmtpSaslPaswordMaps)(cn=*))";
$dn = "cn=smtp_sasl_password_maps,cn=artica,{$ldap->suffix}";
$hash = $ldap->Ldap_search($dn, $filter, $attrs);
for ($i = 0; $i < $hash["count"]; $i++) {
$mail = "{$hash[$i]["cn"][0]}";
$value = trim($hash[$i][strtolower("SmtpSaslPasswordString")][0]);
if ($value == null) {
continue;
}
if ($value == ":") {
continue;
}
$sender_dependent_relayhost_maps[$mail] = $value;
}
$q = new mysql();
$sql = "SELECT * FROM sender_dependent_relay_host WHERE enabled=1\n\t\t\tAND `override_transport`=0\n\t\t\tAND `override_relay`=0\n\t\t\tAND `hostname`='master' ORDER by zOrders";
$results = $q->QUERY_SQL($sql, "artica_backup");
while ($ligne = mysql_fetch_assoc($results)) {
$relay = $ligne["relay"];
$relay_port_text = null;
$relay_port = $ligne["relay_port"];
$lookups = $ligne["lookups"];
$relay_text = $main->RelayToPattern($relay, $relay_port, $lookups);
if ($ligne["directmode"] == 1) {
$relay_text = "smtp:";
}
$domain = $ligne["domain"];
$sender_dependent_relayhost_maps[$domain] = $relay_text;
}
if (is_array($sender_dependent_relayhost_maps)) {
while (list($mail, $value) = each($sender_dependent_relayhost_maps)) {
$mail = str_replace(".", "\\.", $mail);
$mail = str_replace("*", ".*", $mail);
if (strpos($mail, "@") == 0) {
$mail = ".*@{$mail}";
}
$GLOBALS["sender_dependent_relayhost_maps"][] = "/{$mail}/\t{$value}";
}
}
}
示例2: main_search
function main_search()
{
$MyPage = CurrentPageName();
$main = new maincf_multi();
$page = CurrentPageName();
$tpl = new templates();
$sock = new sockets();
$q = new mysql();
$t = $_GET["t"];
$table = "sender_dependent_relay_host";
$searchstring = string_to_flexquery();
$page = 1;
$table = "(SELECT * FROM sender_dependent_relay_host WHERE `hostname`='{$_GET["hostname"]}' ORDER by zOrders) as t";
if (isset($_POST["sortname"])) {
if ($_POST["sortname"] != null) {
$ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}";
}
}
if (isset($_POST['page'])) {
$page = $_POST['page'];
}
if ($searchstring != null) {
$sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1);
}
$total = $ligne["tcount"];
} else {
$sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1);
}
$total = $ligne["tcount"];
}
if (isset($_POST['rp'])) {
$rp = $_POST['rp'];
}
if (!is_numeric($rp)) {
$rp = 50;
}
$pageStart = ($page - 1) * $rp;
$limitSql = "LIMIT {$pageStart}, {$rp}";
$sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} ";
$results = $q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
if ($q->mysql_error != null) {
json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1);
}
}
if (mysql_num_rows($results) == 0) {
json_error_show("no data", 1);
}
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
$fontsize = "22";
$free_text = $tpl->javascript_parse_text("{free}");
$computers = $tpl->javascript_parse_text("{computers}");
$overloaded_text = $tpl->javascript_parse_text("{overloaded}");
$orders_text = $tpl->javascript_parse_text("{orders}");
$directories_monitor = $tpl->javascript_parse_text("{directories_monitor}");
$dns_destination = $tpl->javascript_parse_text("{direct_mode}");
$all_others_domains = $tpl->javascript_parse_text("{all_others_domains}");
while ($ligne = mysql_fetch_assoc($results)) {
$LOGSWHY = array();
$overloaded = null;
$loadcolor = "black";
$StatHourColor = "black";
$ColorTime = "black";
$hostname = $ligne["hostname"];
$domain = $ligne["domain"];
$zmd5 = $ligne["zmd5"];
$relay = $ligne["relay"];
$relay_port = $ligne["relay_port"];
$lookups = $ligne["lookups"];
$relay_text = $main->RelayToPattern($relay, $relay_port, $lookups);
$icon_grey = "ok32-grey.png";
$icon_warning_32 = "warning32.png";
$icon_red_32 = "32-red.png";
$icon = "ok-32.png";
$icon_f = $icon_grey;
if ($ligne["enabled"] == 0) {
$ColorTime = "#8a8a8a";
}
$styleHref = " style='font-size:{$fontsize}px;text-decoration:underline;color:{$ColorTime}'";
$style = " style='font-size:{$fontsize}px;color:{$ColorTime}'";
$urijs = "Loadjs('{$MyPage}?item-js=yes&zmd5={$zmd5}&hostname={$hostname}');";
$link = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$urijs}\" {$styleHref}>";
$orders = imgtootltip("48-settings.png", null, "Loadjs('artica-meta.menus.php?gpid={$ligne["ID"]}');");
$delete = imgtootltip("delete-32.png", null, "Loadjs('{$MyPage}?item-delete-js={$zmd5}')");
$up = imgsimple("arrow-up-32.png", null, "MoveSubRuleLinks{$t}('{$zmd5}','up')");
$down = imgsimple("arrow-down-32.png", null, "MoveSubRuleLinks{$t}('{$zmd5}','down')");
if ($ligne["directmode"] == 1) {
$relay_text = "{$dns_destination}";
}
if ($ligne["enabledauth"] == 1) {
$icon_f = $icon;
//.........这里部分代码省略.........
示例3: MasterCFBuilder
//.........这里部分代码省略.........
$conf[] = "artica-reportquar\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --quarantines";
$conf[] = "artica-spam\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --spam";
$conf[] = "zarafa\tunix\t-\tn\tn\t-\t-\tpipe\tuser=mail argv=/usr/bin/zarafa-dagent \${user}";
$unix = new unix();
$cyrdeliver = $unix->find_program("cyrdeliver");
if (is_file($cyrdeliver)) {
echo "Starting......: " . date("H:i:s") . " master.cf adding cyrus\n";
$conf[] = "cyrus\tunix\t-\tn\tn\t-\t-\tpipe\tflags=R user=cyrus argv=/usr/sbin/cyrdeliver -e -m \${extension} \${user}";
} else {
$conf[] = "# cyrdeliver no such binary.";
}
$conf[] = "";
$conf[] = "";
$conf[] = $master_amavis;
$conf[] = "";
$conf[] = "127.0.0.1:33559\tinet\tn\t-\tn\t-\t-\tsmtpd";
$conf[] = " -o notify_classes=protocol,resource,software";
$conf[] = " -o header_checks=";
$conf[] = " -o content_filter=";
$conf[] = " -o smtpd_restriction_classes=";
$conf[] = " -o smtpd_delay_reject=no";
$conf[] = " -o smtpd_client_restrictions=permit_mynetworks,reject";
$conf[] = " -o smtpd_helo_restrictions=";
$conf[] = " -o smtpd_sender_restrictions=";
$conf[] = " -o smtpd_recipient_restrictions=permit_mynetworks,reject";
$conf[] = " -o smtpd_data_restrictions=reject_unauth_pipelining";
$conf[] = " -o smtpd_end_of_data_restrictions=";
$conf[] = " -o mynetworks=127.0.0.0/8";
$conf[] = " -o strict_rfc821_envelopes=yes";
$conf[] = " -o smtpd_error_sleep_time=0";
$conf[] = " -o smtpd_soft_error_limit=1001";
$conf[] = " -o smtpd_hard_error_limit=1000";
$conf[] = " -o smtpd_client_connection_count_limit=0";
$conf[] = " -o smtpd_client_connection_rate_limit=0";
$conf[] = " -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks";
$conf[] = " -o smtp_send_xforward_command=yes";
$conf[] = " -o disable_dns_lookups=yes";
$conf[] = " -o local_header_rewrite_clients=";
$conf[] = " -o smtp_generic_maps=";
$conf[] = " -o sender_canonical_maps=";
$conf[] = " -o smtpd_milters=";
$conf[] = " -o smtpd_sasl_auth_enable=no";
$conf[] = " -o smtpd_use_tls=no";
if ($ver210) {
$conf[] = "\t -o smtpd_upstream_proxy_protocol=";
}
$q = new mysql();
$sql = "SELECT * FROM sender_dependent_relay_host WHERE enabled=1 \n\t\t\t\tAND `override_transport`=1 \n\t\t\t\tAND `hostname`='master' ORDER by zOrders";
$results = $q->QUERY_SQL($sql, "artica_backup");
echo "Starting......: " . date("H:i:s") . " master.cf sender_dependent_relay_host " . mysql_num_rows($results) . " item(s)\n";
build_progress_sender_routing("{building} master.cf sender_dependent_relay_host", 50);
$main = new maincf_multi();
while ($ligne = mysql_fetch_assoc($results)) {
$domain = $ligne["domain"];
$md5 = $ligne["zmd5"];
$relay = $ligne["relay"];
$relay_port_text = null;
$relay_port = $ligne["relay_port"];
$lookups = $ligne["lookups"];
$relay_text = $main->RelayToPattern($relay, $relay_port, $lookups);
$conf[] = "";
$conf[] = "{$md5}\tunix\t-\t-\tn\t-\t-\tsmtp";
if ($ligne["smtp_bind_address"] != null) {
$conf[] = " -o smtp_bind_address={$ligne["smtp_bind_address"]}";
}
if ($ligne["smtp_helo_name"] != null) {
$conf[] = " -o smtp_helo_name={$ligne["smtp_helo_name"]}";
}
if ($ligne["syslog_name"] != null) {
$ligne["syslog_name"] = str_replace(" ", "-", $ligne["syslog_name"]);
$conf[] = " -o syslog_name={$ligne["syslog_name"]}";
}
if ($ligne["directmode"] == 0) {
if ($ligne["relay"] != null) {
$conf[] = " -o relayhost={$relay_text}";
if ($ligne["enabledauth"] == 0) {
$conf[] = " -o smtp_sasl_password_maps=hash:/etc/postfix/smtp_sasl_password";
$conf[] = " -o smtp_sasl_auth_enable=yes";
}
}
} else {
$conf[] = " -o relayhost=";
$conf[] = " -o smtp_host_lookup=dns";
}
// 04 -o syslog_name=postfix-customer1
}
$conf[] = "";
$conf[] = "";
build_progress_sender_routing("{building} master.cf {done}", 55);
@file_put_contents("/etc/postfix/master.cf", @implode("\n", $conf));
echo "Starting......: " . date("H:i:s") . " master.cf done\n";
if ($GLOBALS["RELOAD"]) {
shell_exec("/usr/sbin/postfix reload >/dev/null 2>&1");
}
if ($restart_service) {
build_progress_sender_routing("{restarting_service}", 60);
shell_exec("{$GLOBALS["postfix"]} stop");
shell_exec("{$GLOBALS["postfix"]} start");
}
}