function restrict_relay_domains() { @file_put_contents("/etc/postfix/relay_domains_restricted", "\n"); $ldap = new clladp(); $q = new mysql(); $f = array(); $relaysdomains = $ldap->hash_get_relay_domains(); $main = new maincf_multi("master", "master"); $relay_domains_restricted = $main->relay_domains_restricted(); echo "Starting......: " . date("H:i:s") . " Postfix " . count($relay_domains_restricted) . " restricted defined domains\n"; if (count($relaysdomains) > 0) { while (list($domain, $ligne) = each($relaysdomains)) { if (preg_match("#^@(.+)#", $domain, $re)) { $domain = $re[1]; } if (!isset($relay_domains_restricted[$domain])) { continue; } $f[] = "{$domain}\tartica_restrict_relay_domains"; echo "Starting......: " . date("H:i:s") . " Postfix `{$domain}` will be restricted\n"; } } echo "Starting......: " . date("H:i:s") . " Postfix " . count($f) . " restricted relayed domains\n"; @file_put_contents("/etc/postfix/relay_domains_restricted", implode("\n", $f)); shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/relay_domains_restricted >/dev/null 2>&1"); }