Esempio n. 1
0
function export_all_domains()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $oldpid = @file_get_contents($pidfile);
    if ($unix->process_exists($oldpid)) {
        die;
    }
    @file_put_contents($pidfile, getmypid());
    $ldap = new clladp();
    $array_final = array();
    $array = $ldap->hash_get_all_domains();
    if (!is_array($array)) {
        return;
    }
    while (list($index, $none) = each($array)) {
        $ou = $ldap->ou_by_smtp_domain($index);
        $array_final[trim(strtolower($index))]["ou"] = $ou;
        $array_final[trim(strtolower($index))]["TYPE"] = "LOCAL";
        $ous[] = $ou;
    }
    if (!is_array($ous)) {
        return null;
    }
    while (list($index, $ou) = each($ous)) {
        $hash = $ldap->Hash_relay_domains($ou);
        if (is_array($hash)) {
            while (list($domain, $transport) = each($hash)) {
                $array_final[trim(strtolower($domain))]["TYPE"] = $transport;
            }
        }
    }
    if (!is_array($array_final)) {
        return null;
    }
    echo "exporting " . count($array_final) . " domains in \"/etc/artica-postfix/metadomains.cache\"\n";
    $datas = base64_encode(serialize($array_final));
    @file_put_contents("/etc/artica-postfix/metadomains.cache", $datas);
    $http = new httpget();
    $sock = new sockets();
    $meta = new artica_meta();
    $http->uploads["ALL_DOMAINS"] = "/etc/artica-postfix/metadomains.cache";
    $body = $http->send("{$meta->ArticaMetaHostname}/lic.users.import.php", "post", array("DATAS" => base64_encode(serialize($meta->GLOBAL_ARRAY))));
    events(count($array_final) . " domains exported to global Management console", __FUNCTION__, __FILE__, __LINE__);
    send_email_events(count($array_final) . " domains exported to global Management console", $body, "CLOUD");
    echo $body;
}
function config()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $ldap = new clladp();
    $ou = $_GET["ou"];
    $domain = $_GET["domain"];
    $HashDomains = $ldap->Hash_relay_domains($_GET["ou"]);
    $routage = $HashDomains[$_GET["domain"]];
    $tools = new DomainsTools();
    $arr = $tools->transport_maps_explode($routage);
    $dn = "cn=@{$_GET["domain"]},cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
    $html = "\n\t<div style='font-size:30px;margin-bottom:20px'>{$_GET["ou"]}: {$_GET["domain"]}</div>\n\t<div class=explain id='div-{$_GET["domain"]}' style='font-size:18px'>{relaydomain_explain}</div>\n\t<p>&nbsp;</p>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{target_computer_name}:</td>\n\t\t<td style='font-size:16px'>" . Field_text("target_computer_name", "{$arr[1]}", "font-size:22px;width:490px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{port}:</td>\n\t\t<td style='font-size:16px'>" . Field_text("remote-port", "{$arr[2]}", "font-size:22px;width:110px;text-align:right") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button("{apply}", "SaveRelayDomainNew()", 40) . "</td>\n\t</tr>\n\t</table>\n\t\n\t</div>\n\t<script>\n\t\t\n\t\tvar x_SaveRelayDomainNew= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tif(IsFunctionExists('FlexReloadRemoteDomainList')){FlexReloadRemoteDomainList();}\n\t\t\tRefreshTab('main_config_relay_domain');\n\t\t}\t\t\n\t\t\n\t\t\n\n\n\tfunction SaveRelayDomainNew(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('remote',document.getElementById('target_computer_name').value);\n\t\t\tXHR.appendData('port',document.getElementById('remote-port').value);\n\t\t\tXHR.appendData('ou','{$ou}');\n\t\t\tXHR.appendData('domain','{$domain}');\n\t\t\tdocument.getElementById('div-{$_GET["domain"]}').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>';\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveRelayDomainNew);\t\t\n\t\n\t}\n\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Esempio n. 3
0
function config()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $ldap = new clladp();
    $ou = $_GET["ou"];
    $domain = $_GET["domain"];
    $HashDomains = $ldap->Hash_relay_domains($_GET["ou"]);
    $routage = $HashDomains[$_GET["domain"]];
    $tools = new DomainsTools();
    $arr = $tools->transport_maps_explode($routage);
    $dn = "cn=@{$_GET["domain"]},cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
    if ($ldap->ExistsDN($dn)) {
        $trusted_smtp_domain = 1;
    }
    $html = "\n\t<div style='font-size:16px'>{$_GET["domain"]}</div>\n\t<div class=explain id='div-{$_GET["domain"]}'>{relaydomain_explain}</div>\n\t<p>&nbsp;</p>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{target_computer_name}:</td>\n\t\t<td style='font-size:16px'>" . Field_text("target_computer_name", "{$arr[1]}", "font-size:16px;width:220px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{port}:</td>\n\t\t<td style='font-size:16px'>" . Field_text("remote-port", "{$arr[2]}", "font-size:16px;width:60px;text-align:right") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{trusted_smtp_domain}:</td>\n\t\t<td style='font-size:16px'>" . Field_checkbox("trusted_smtp_domain", 1, $trusted_smtp_domain, "trusted_smtp_domain_save()") . "</td>\n\t\t<td>" . help_icon("{trusted_smtp_domain_text}") . "</td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button("{apply}", "SaveRelayDomainNew()") . "</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t<script>\n\t\tvar x_trusted_smtp_domain_save= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tif (document.getElementById('RelayDomainsList')){\n\t\t\t\tLoadAjax('RelayDomainsList','domains.edit.domains.php?RelayDomainsList=yes&ou={$ou}');\n\t\t\t}\n\t\t\t\n\t\t\tRefreshTab('main_config_relay_domain');\n\t\t}\n\t\t\n\t\t\n\t\tvar x_SaveRelayDomainNew= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tif (document.getElementById('RelayDomainsList')){\n\t\t\t\tLoadAjax('RelayDomainsList','domains.edit.domains.php?RelayDomainsList=yes&ou={$ou}');\n\t\t\t}\n\t\t\tRefreshTab('main_config_relay_domain');\n\t\t}\t\t\n\t\t\n\t\t\n\n\n\tfunction SaveRelayDomainNew(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('remote',document.getElementById('target_computer_name').value);\n\t\t\tXHR.appendData('port',document.getElementById('remote-port').value);\n\t\t\tXHR.appendData('ou','{$ou}');\n\t\t\tXHR.appendData('domain','{$domain}');\n\t\t\tdocument.getElementById('div-{$_GET["domain"]}').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>';\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveRelayDomainNew);\t\t\n\t\n\t}\n\n\tfunction trusted_smtp_domain_save(num){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif (document.getElementById('trusted_smtp_domain').checked){\n\t\t\tXHR.appendData('trusted_smtp_domain',1);}else{\n\t\t\tXHR.appendData('trusted_smtp_domain',0);}\n\t\t\tXHR.appendData('ou','{$ou}');\n\t\t\tXHR.appendData('domain','{$domain}');\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_trusted_smtp_domain_save);\t\n\t\t\t\n\t\t}\t\n\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Esempio n. 4
0
function RELAY_DOMAINS_LIST_SEARCH()
{
    $ldap = new clladp();
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $ou = $_GET["ou"];
    include_once "ressources/class.amavis.inc";
    $amavis = new amavis();
    $amavis_oui = false;
    $t = $_GET["t"];
    writelogs("----------------> Hash_relay_domains", __FUNCTION__, __FILE__, __LINE__);
    $HashDomains = $ldap->Hash_relay_domains($ou);
    $aliases = new AutoAliases($ou);
    $users->LoadModulesEnabled();
    if ($users->AMAVIS_INSTALLED) {
        if ($users->EnableAmavisDaemon == 1) {
            $amavis_oui = true;
        }
    }
    $disclaimer = IS_DISCLAIMER();
    $tools = new DomainsTools();
    $domainstyle = "font-size:16px";
    if (isset($_GET["expand"])) {
        $domainstyle = "font-size:18px";
    }
    if ($_POST["query"] != null) {
        $search = str_replace("*", ".*?", $_POST["query"]);
    }
    $data = array();
    $c = 0;
    while (list($num, $ligne) = each($HashDomains)) {
        if ($search != null) {
            if (!preg_match("#{$search}#", $num)) {
                continue;
            }
        }
        $c++;
        $autoalias = "&nbsp;";
        $disclaimer_domain = "&nbsp;";
        $amavis_infos = "&nbsp;";
        $amavis_duplicate = "&nbsp;";
        $delete = imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteRelayDomain{$t}('{$num}')");
        if ($amavis->copy_to_domain_array[strtolower($num)]["enable"] == 1) {
            $amavis_duplicate = "<strong style='font-size:12px'>{$amavis->copy_to_domain_array[strtolower($num)]["duplicate_host"]}:{$amavis->copy_to_domain_array[strtolower($num)]["duplicate_port"]}";
        }
        $autoalias = $tpl->_ENGINE_parse_body($autoalias);
        writelogs("add in row {$ligne} ", __FUNCTION__, __FILE__);
        $arr = $tools->transport_maps_explode($ligne);
        $alreadyDomain[$num] = true;
        $count++;
        $js = "Loadjs('domains.relay.domains.php?domain={$num}&ou={$ou}')";
        $relay = "{$arr[1]}:{$arr[2]}";
        if (strlen($aliases->DomainsArray[$num]) > 0) {
            $autoalias = "<img src='img/20-check.png'>";
        }
        if ($arr[3] == "yes") {
            $mx = "{yes}";
        } else {
            $mx = "{no}";
        }
        if ($amavis_oui) {
            $amavis_infos = imgtootltip("24-parameters.png", "AS -> {$num}", "Loadjs('domains.amavis.php?domain={$num}')");
        }
        if ($disclaimer) {
            $disclaimer_domain = imgtootltip("24-parameters.png", "disclaimer -> {$num}", "Loadjs('domains.disclaimer.php?domain={$num}&ou={$ou}')");
        }
        $data['rows'][] = array('id' => "dom-{$num}", 'cell' => array("\n\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='{$domainstyle};font-weight:bold;text-decoration:underline'>{$num}</span>", "<span style='font-size:14px'>{$autoalias}</span>", "<span style='font-size:14px'>{$amavis_infos}</span>", "<span style='font-size:14px'>{$disclaimer_domain}</span>", "<span style='font-size:14px'>{$relay}</span>", $delete));
    }
    $dn = "cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
    $hash = $ldap->Ldap_search($dn, '(objectclass=transportTable)', array());
    for ($i = 0; $i < $hash["count"]; $i++) {
        $transport = $hash[$i]["transport"][0];
        $domain = $hash[$i]["cn"][0];
        if (isset($alreadyDomain[$domain])) {
            continue;
        }
        if ($search != null) {
            if (!preg_match("#{$search}#", $domain)) {
                continue;
            }
        }
        $arr = $tools->transport_maps_explode($transport);
        $relay = "{$arr[1]}:{$arr[2]}";
        $js = "PostfixAddRoutingTable('{$domain}')";
        $count++;
        $data['rows'][] = array('id' => "dom-{$domain}", 'cell' => array("\n\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:16px;font-weight:bold;text-decoration:underline'>{$domain}</span>", "<span style='font-size:14px'>&nbsp;</span>", "<span style='font-size:14px'>&nbsp;</span>", "<span style='font-size:14px'>&nbsp;</span>", "<span style='font-size:14px'>{$relay}</span>", "&nbsp;"));
    }
    $data['page'] = 1;
    $data['total'] = $c;
    echo json_encode($data);
}
function remotedomain_search()
{
    $users = new usersMenus();
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $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) {
        $HashDomains = $ldap->Hash_relay_domains();
    } else {
        $HashDomains = $ldap->Hash_relay_domains($_SESSION["ou"]);
    }
    if (!is_array($HashDomains)) {
        $HashDomains = array();
    }
    $tools = new DomainsTools();
    $search = string_to_flexregex("remotedomain-search");
    while (list($domain, $ligne) = each($HashDomains)) {
        $id = md5($domain);
        $delete = imgsimple("delete-32.png", null, "DeleteRemoteDomain{$t}('{$domain}','{$id}')");
        if ($search != null) {
            if (!preg_match("#{$search}#", $domain)) {
                continue;
            }
        }
        $arr = $tools->transport_maps_explode($ligne);
        $relay = "{$arr[1]}:{$arr[2]}";
        $js = "Loadjs('{$page}?remotedomain-new-js=yes&domain=" . urlencode($domain) . "')";
        $trSwitch = $boot->trswitch($js);
        $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td style='font-size:18px' {$trSwitch}><i class='icon-globe'></i>&nbsp;{$domain}</td>\n\t\t<td style='font-size:18px' nowrap {$trSwitch}><i class='icon-arrow-right'></i>&nbsp;{$relay}</td>\n\t\t<td style='text-align:center'>{$delete}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\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 style='width:99%'>{destination}</th>\n\t\t\t\t\t<th>&nbsp;</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\t\t</table>\n<script>\n\tvar xmem{$t}='';\nvar xDeleteRemoteDomain{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue); return;};\n\t\$('#'+xmem{$t}).remove();\n}\n\t\nfunction DeleteRemoteDomain{$t}(domain,id){\n\txmem{$t}=id;\n\tif(confirm('{$are_you_sure_to_delete} '+domain)){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('remotedomain-remove',domain);\n\t\tXHR.appendData('ou','{$_SESSION["ou"]}');\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDeleteRemoteDomain{$t});\n\t}\n}\n</script>\n";
}
Esempio n. 6
0
function RELAY_DOMAINS_LIST($ou)
{
    $ldap = new clladp();
    $tpl = new templates();
    $amavis_oui = false;
    writelogs("----------------> Hash_relay_domains", __FUNCTION__, __FILE__, __LINE__);
    $HashDomains = $ldap->Hash_relay_domains($ou);
    $aliases = new AutoAliases($ou);
    if (!is_array($HashDomains)) {
        $titleerrrr = $tpl->_ENGINE_parse_body("<span style='font-size:12px'>{no_remote_domain_here}</span>");
    }
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    if (!$users->POSTFIX_INSTALLED) {
        writelogs("POSTFIX IS NOT INSTALLED", __FUNCTION__, __FILE__, __LINE__);
        return null;
    }
    if ($users->AMAVIS_INSTALLED) {
        if ($users->EnableAmavisDaemon == 1) {
            $amavis_oui = true;
        }
    }
    $disclaimer = IS_DISCLAIMER();
    $tools = new DomainsTools();
    $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th colspan=4 style='font-size:14px'>{relay_domain_map}&nbsp;{$titleerrrr}</th>\n\t<tr>\n\t<th>" . imgtootltip("plus-24.png", "{add}", "AddRemoteDomain_form('{$ou}','new domain')") . "</th>\n\t<th>{domain}</th>\n\t<th>{relay}</th>\n\t<th>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    if (is_array($HashDomains)) {
        while (list($num, $ligne) = each($HashDomains)) {
            writelogs("add in row {$ligne} ", __FUNCTION__, __FILE__);
            $arr = $tools->transport_maps_explode($ligne);
            $count = $count = 1;
            $js = "Loadjs('domains.relay.domains.php?domain={$num}&ou={$ou}')";
            if ($classtr == "oddRow") {
                $classtr = null;
            } else {
                $classtr = "oddRow";
            }
            $relay = "{$arr[1]}:{$arr[2]}";
            $amavis = "&nbsp;";
            $disclaimer_domain = "&nbsp;";
            $autoalias = "&nbsp;";
            if (strlen($aliases->DomainsArray[$num]) > 0) {
                $autoalias = "{yes}";
            } else {
                $autoalias = "{no}";
            }
            if ($arr[3] == "yes") {
                $mx = "{yes}";
            } else {
                $mx = "{no}";
            }
            if ($amavis_oui) {
                $amavis = texttooltip("[{settings}]", "{Anti-spam}:{$num}", "Loadjs('domains.amavis.php?domain={$num}')", null, 0, "font-weight:bold;font-size:12px");
            }
            if ($disclaimer) {
                $disclaimer_domain = texttooltip("[{settings}]", "{disclaimer}:{$num}", "Loadjs('domains.disclaimer.php?domain={$num}&ou={$ou}')", null, 0, "font-weight:bold;font-size:12px");
            }
            $html = $html . "<tr class={$classtr}>\n\t\t\t\t\t\t<td width=1% valign='top'>" . imgtootltip("domain-32.png", "{edit}", $js) . "</td>\n\t\t\t\t\t\t<td><div style='font-size:16px;font-weight:bold'>" . texttooltip("{$num}", "{parameters}", $js, null, 0, "font-size:18px") . "</div></td>\n\t\t\t\t\t\t<td><div style='font-size:16px;font-weight:bold'>" . texttooltip("{$relay}", "{parameters}", $js, null, 0, "font-size:18px") . "</div></td>\n\t\t\t\t\t\t<td width=1%>" . imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteRelayDomain('{$num}')") . "</td>\n\t\t\t\t\t</tr>";
        }
    }
    $dn = "cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
    $hash = $ldap->Ldap_search($dn, '(objectclass=transportTable)', array());
    for ($i = 0; $i < $hash["count"]; $i++) {
        $transport = $hash[$i]["transport"][0];
        $domain = $hash[$i]["cn"][0];
        $arr = $tools->transport_maps_explode($transport);
        $relay = "{$arr[1]}:{$arr[2]}";
        $js = "PostfixAddRoutingTable('{$domain}')";
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $html = $html . "<tr class={$classtr}>\n\t\t\t\t\t\t<td width=1% valign='top'>" . imgtootltip("domain-32.png", "{edit}", $js) . "</td>\n\t\t\t\t\t\t<td><div style='font-size:16px;font-weight:bold'>" . texttooltip("{$domain}", "{parameters}", $js, null, 0, "font-size:18px") . "</div>\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td><div style='font-size:16px;font-weight:bold'>" . texttooltip("{$relay}", "{parameters}", $js, null, 0, "font-size:18px") . "</div>\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td width=1%>&nbsp;</td>\n\t\t\t\t\t</tr>";
    }
    $ou_ser = urlencode($ou);
    $html = $html . "\n\t\n\t</table>\n\t\n\t<script>\n\t\n\t\tvar x_DeleteRelayDomain= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tLoadAjax('RelayDomainsList','domains.edit.domains.php?RelayDomainsList=yes&ou={$ou_ser}');\n\t\t}\t\n\t\n\t\t\n\t\tfunction DeleteRelayDomain(domain_name){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DeleteRelayDomainName',domain_name);\n\t\t\tXHR.appendData('ou','{$ou}');\n\t\t\tdocument.getElementById('RelayDomainsList').innerHTML='<center style=margin:10px><img src=img/wait_verybig.gif></center>';\n\t\t\tXHR.sendAndLoad('domains.edit.domains.php', 'GET',x_DeleteRelayDomain);\n\t\t\n\t\t}\n\t\n\t\tLoadjs('js/postfix-transport.js');\n\t</script>\n\t";
    return $tpl->_ENGINE_parse_body($html);
}
function organization_list()
{
    $ldap = new clladp();
    $tpl = new templates();
    $tools = new DomainsTools();
    $t = $_GET["t"];
    $localdomains = $ldap->Hash_associated_domains();
    $relaydomains = $ldap->Hash_relay_domains();
    $sock = new sockets();
    $PostfixLocalDomainToRemote = $sock->GET_INFO("PostfixLocalDomainToRemote");
    if (!is_numeric($PostfixLocalDomainToRemote)) {
        $PostfixLocalDomainToRemote = 0;
    }
    $PostfixLocalDomainToRemoteAddr = $sock->GET_INFO("PostfixLocalDomainToRemoteAddr");
    $forwared = $tpl->_ENGINE_parse_body("{forwarded}");
    while (list($domain, $ligne) = each($localdomains)) {
        $array[$domain]["DELETE"] = "DeleteLocalDomain{$t}('{$domain}')";
        $ou = $ldap->organization_name_from_localdomain($domain);
        if ($ou == null) {
            $ou = "{none}";
        }
        $array[$domain]["TEXT"] = "<span style='font-size:18px'>{localdomain}</span><br><span style='font-size:16px'>{organization}: <strong>{$ou}</strong>";
        if ($PostfixLocalDomainToRemote == 1) {
            $array[$domain]["TEXT"] = "<span style='font-size:18px'>{localdomain}</span><br><span style='font-size:16px'>{organization}: <strong>{$ou}</strong></span><br>{$forwared} -&raquo; smtp:{$PostfixLocalDomainToRemoteAddr} ";
        }
    }
    while (list($domain, $ligne) = each($relaydomains)) {
        $arr = $tools->transport_maps_explode($ligne);
        $ou = $ldap->organization_name_from_transporttable($domain);
        $array[$domain]["TEXT"] = "{$arr[1]}:{$arr[2]} ({$ou})";
        $array[$domain]["OU"] = $ou;
        $array[$domain]["DELETE"] = "DeleteTransportDomain{$t}('{$domain}')";
    }
    $data = array();
    if ($_POST["query"] != null) {
        $search = string_to_regex($_POST["query"]);
    }
    $c = 0;
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    } else {
        ksort($array);
    }
    while (list($domain, $ligne) = each($array)) {
        if ($search != null) {
            if (!preg_match("#{$search}#", $domain)) {
                continue;
            }
        }
        $c++;
        $ligne["TEXT"] = $tpl->_ENGINE_parse_body($ligne["TEXT"]);
        $domainenc = urlencode($domain);
        $OuEnc = urlencode($ligne["OU"]);
        $delete = imgsimple("delete-48.png", '{label_delete_transport}', $ligne["DELETE"]);
        $m5 = md5($domain);
        $js = "Loadjs('domains.relay.domains.php?domain={$domainenc}&ou={$OuEnc}')";
        $data['rows'][] = array('id' => "dom{$m5}", 'cell' => array("\n\t\t<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:{$js}\" \n\t\t\tstyle='font-size:24px;font-weight:bold;text-decoration:underline'>{$domain}</span>", "<span style='font-size:24px'>{$ligne["TEXT"]}</span>", "<center>{$delete}</center>"));
        if ($c > $_POST["rp"]) {
            break;
        }
    }
    if ($c == 0) {
        json_error_show("no data");
    }
    $data['page'] = 1;
    $data['total'] = $c;
    echo json_encode($data);
}
function RELAY_DOMAINS_LIST($ou)
{
    $ldap = new clladp();
    $tpl = new templates();
    $amavis_oui = false;
    writelogs("----------------> Hash_relay_domains", __FUNCTION__, __FILE__);
    $HashDomains = $ldap->Hash_relay_domains($ou);
    $aliases = new AutoAliases($ou);
    if (!is_array($HashDomains)) {
        return $tpl->_ENGINE_parse_body('<H5>{no_remote_domain_here}</H5>');
    }
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    if (!$users->POSTFIX_INSTALLED) {
        return null;
    }
    if ($users->AMAVIS_INSTALLED) {
        if ($users->EnableAmavisDaemon == 1) {
            $amavis_oui = true;
        }
    }
    $disclaimer = IS_DISCLAIMER();
    $tools = new DomainsTools();
    if (is_array($HashDomains)) {
        $ul[] = "<ul id='domains-checklist'>";
        while (list($num, $ligne) = each($HashDomains)) {
            writelogs("add in row {$ligne} ", __FUNCTION__, __FILE__);
            $arr = $tools->transport_maps_explode($ligne);
            $count = $count = 1;
            $js = "AddRemoteDomain_form('{$ou}','{$num}')";
            $relay = "{$arr[1]}:{$arr[2]}";
            if (strlen($aliases->DomainsArray[$num]) > 0) {
                $autoalias = "{yes}";
            } else {
                $autoalias = "{no}";
            }
            if ($arr[3] == "yes") {
                $mx = "{yes}";
            } else {
                $mx = "{no}";
            }
            if ($amavis_oui) {
                $amavis = "\n\t\t\t\t<tr>\n\t\t\t\t<td class=legend width=1% nowrap>{Anti-spam}:</td>\n\t\t\t\t<td>" . texttooltip("[{settings}]", "{Anti-spam}:{$num}", "Loadjs('domains.amavis.php?domain={$num}')", null, 0, "font-weight:bold;font-size:12px") . "</td>\n\t\t\t\t</tr>";
            }
            if ($disclaimer) {
                $disclaimer_domain = "\n\t\t\t\t<tr>\n\t\t\t\t<td class=legend width=1% nowrap>{disclaimer}:</td>\n\t\t\t\t<td>" . texttooltip("[{settings}]", "{disclaimer}:{$num}", "Loadjs('domains.disclaimer.php?domain={$num}&ou={$ou}')", null, 0, "font-weight:bold;font-size:12px") . "</td>\n\t\t\t\t</tr>";
            }
            $ul[] = "<li class='domainsli' style='width:350px'><table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td width=1% valign='top'>" . imgtootltip("domain-relay-64.png", "{edit}", $js) . "</td>\n\t\t\t\t<td valign='top'>";
            $ul[] = "\n\t\t\t<table style='width:90%'>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><strong style='font-size:16px'>" . texttooltip($num, "{parameters}", $js, null, 0, "font-size:16px;color:#005447") . "</strong>\n\t\t\t\t\t\t<div style='font-size:12px;text-align:right;border-top:1px solid #005447;padding:3px;font-weight:bolder'>{$relay}</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td valign='top' width=1% align='right'>" . imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteRelayDomain('{$num}')") . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t\t\t<td class=legend width=1% nowrap>{mx_look_text}:</td>\n\t\t\t\t<td><strong>{$autoalias}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend width=1% nowrap>{aliases}:</td>\n\t\t\t\t<td><strong>{$autoalias}</strong></td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t{$amavis}\n\t\t\t{$amavis_duplicate}\n\t\t\t{$disclaimer_domain}\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t";
            $ul[] = "</li>";
        }
        $ul[] = "</ul>";
    }
    return $tpl->_ENGINE_parse_body(@implode("\n", $ul));
}
Esempio n. 9
0
function default_outgoing_rule()
{
    if (!is_file("/opt/kaspersky/klms/bin/klms-control")) {
        echo "Starting......: " . date("H:i:s") . " Kaspersky Mail security Suite `klms-control` no such binary\n";
        return;
    }
    $unix = new unix();
    $ruleslist = ruleslist();
    $ID = $ruleslist["From Local Network"];
    if (!is_numeric($ID)) {
        $ID = 0;
    }
    echo "Starting......: " . date("H:i:s") . " Kaspersky Mail security Suite default rule ID:{$ID}\n";
    $sock = new sockets();
    $MynetworksInISPMode = $sock->GET_INFO("MynetworksInISPMode");
    $PostfixBadNettr = unserialize(base64_decode($sock->GET_INFO("PostfixBadNettr")));
    if (!is_numeric($MynetworksInISPMode)) {
        $MynetworksInISPMode = 0;
    }
    $ldap = new clladp();
    $NEWAR["127.0.0.1"] = true;
    if ($MynetworksInISPMode == 0) {
        $array = $ldap->load_mynetworks();
        while (list($key, $IP) = each($array)) {
            if (isset($PostfixBadNettr[$IP])) {
                if ($PostfixBadNettr[$IP] == 1) {
                    continue;
                }
            }
            $NEWAR[$IP] = true;
        }
    }
    $tools = new DomainsTools();
    $HashDomains = $ldap->Hash_relay_domains();
    if (is_array($HashDomains)) {
        while (list($num, $ligne) = each($HashDomains)) {
            $arr = $tools->transport_maps_explode($ligne);
            $NEWAR[$arr[1]] = true;
        }
    }
    $q = new mysql();
    $sql = "SELECT ipaddr FROM postfix_whitelist_con";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $NEWAR[$ligne["ipaddr"]] = true;
    }
    $f = array();
    $f[] = "<root>";
    $f[] = "    <belongingCriteria>";
    $f[] = "        <sender>";
    while (list($key, $none) = each($NEWAR)) {
        if ($key == null) {
            continue;
        }
        $f[] = "            <item>";
        $f[] = "                <type>CIDR</type>";
        $f[] = "                <value>{$key}</value>";
        $f[] = "            </item>";
    }
    $f[] = "        </sender>";
    $f[] = "        <recipient>";
    $f[] = "            <item>";
    $f[] = "                <type>EMailMask</type>";
    $f[] = "                <value>*</value>";
    $f[] = "            </item>";
    $f[] = "        </recipient>";
    $f[] = "    </belongingCriteria>";
    $f[] = "    <scanSettings>";
    $f[] = "        <ruleDescription>Local networks will be not scanned for outgoing connexions...</ruleDescription>";
    $f[] = "        <active>1</active>";
    $f[] = "        <ruleAction>Scan</ruleAction>";
    $f[] = "        <avScanSettings>";
    $f[] = "            <engineSettings>";
    $f[] = "                <enableScan>1</enableScan>";
    $f[] = "                <maxSizeLimit>0</maxSizeLimit>";
    $f[] = "                <excludedNames />";
    $f[] = "                <excludedFormats>";
    $f[] = "                    <executableCategory>";
    $f[] = "                        <executableWin>0</executableWin>";
    $f[] = "                        <executableMsi>0</executableMsi>";
    $f[] = "                        <executableJava>0</executableJava>";
    $f[] = "                        <executableElf>0</executableElf>";
    $f[] = "                        <executableDeb>0</executableDeb>";
    $f[] = "                        <executableRpm>0</executableRpm>";
    $f[] = "                    </executableCategory>";
    $f[] = "                    <officeCategory>";
    $f[] = "                        <documentSubcategory>";
    $f[] = "                            <msOfficeDoc>0</msOfficeDoc>";
    $f[] = "                            <msOfficeDocx>0</msOfficeDocx>";
    $f[] = "                            <msOfficeDocm>0</msOfficeDocm>";
    $f[] = "                            <msOfficeDot>0</msOfficeDot>";
    $f[] = "                            <msOfficeDotx>0</msOfficeDotx>";
    $f[] = "                            <msOfficeDotm>0</msOfficeDotm>";
    $f[] = "                            <officePdf>0</officePdf>";
    $f[] = "                            <officeXps>0</officeXps>";
    $f[] = "                            <officeRtf>0</officeRtf>";
    $f[] = "                            <officeOdt>0</officeOdt>";
    $f[] = "                            <officeSxw>0</officeSxw>";
    $f[] = "                        </documentSubcategory>";
    $f[] = "                        <spreadsheetSubcategory>";
    $f[] = "                            <msOfficeXls>0</msOfficeXls>";
    $f[] = "                            <msOfficeXlsx>0</msOfficeXlsx>";
    $f[] = "                            <msOfficeXlsm>0</msOfficeXlsm>";
    $f[] = "                            <msOfficeXlsb>0</msOfficeXlsb>";
    $f[] = "                            <msOfficeXltx>0</msOfficeXltx>";
    $f[] = "                            <msOfficeXltm>0</msOfficeXltm>";
    $f[] = "                            <msOfficeXlam>0</msOfficeXlam>";
    $f[] = "                            <officeOds>0</officeOds>";
    $f[] = "                        </spreadsheetSubcategory>";
    $f[] = "                        <presentationSubcategory>";
    $f[] = "                            <msOfficePpt>0</msOfficePpt>";
    $f[] = "                            <msOfficePptx>0</msOfficePptx>";
    $f[] = "                            <msOfficePptm>0</msOfficePptm>";
    $f[] = "                            <msOfficePotx>0</msOfficePotx>";
    $f[] = "                            <msOfficePotm>0</msOfficePotm>";
    $f[] = "                            <msOfficePpsx>0</msOfficePpsx>";
    $f[] = "                            <msOfficePpsm>0</msOfficePpsm>";
    $f[] = "                            <officeOdp>0</officeOdp>";
    $f[] = "                        </presentationSubcategory>";
    $f[] = "                        <specializedSubcategory>";
    $f[] = "                            <officeMsg>0</officeMsg>";
    $f[] = "                            <officeOne>0</officeOne>";
    $f[] = "                            <officeOnepkg>0</officeOnepkg>";
    $f[] = "                            <officeVsd>0</officeVsd>";
    $f[] = "                            <officeVdx>0</officeVdx>";
    $f[] = "                            <officeXsn>0</officeXsn>";
    $f[] = "                            <msOfficePub>0</msOfficePub>";
    $f[] = "                        </specializedSubcategory>";
    $f[] = "                    </officeCategory>";
    $f[] = "                    <multimediaCategory>";
    $f[] = "                        <videoSubcategory>";
    $f[] = "                            <videoFlv>0</videoFlv>";
    $f[] = "                            <videoF4v>0</videoF4v>";
    $f[] = "                            <videoAvi>0</videoAvi>";
    $f[] = "                            <video3gpp>0</video3gpp>";
    $f[] = "                            <videoDivx>0</videoDivx>";
    $f[] = "                            <videoMkv>0</videoMkv>";
    $f[] = "                            <videoMov>0</videoMov>";
    $f[] = "                            <videoAsf>0</videoAsf>";
    $f[] = "                            <videoRm>0</videoRm>";
    $f[] = "                            <videoVob>0</videoVob>";
    $f[] = "                            <videoBik>0</videoBik>";
    $f[] = "                        </videoSubcategory>";
    $f[] = "                        <audioSubcategory>";
    $f[] = "                            <audioMp3>0</audioMp3>";
    $f[] = "                            <audioFlac>0</audioFlac>";
    $f[] = "                            <audioApe>0</audioApe>";
    $f[] = "                            <audioOgg>0</audioOgg>";
    $f[] = "                            <audioAac>0</audioAac>";
    $f[] = "                            <audioWma>0</audioWma>";
    $f[] = "                            <audioAc3>0</audioAc3>";
    $f[] = "                            <audioWav>0</audioWav>";
    $f[] = "                            <audioMka>0</audioMka>";
    $f[] = "                            <audioRa>0</audioRa>";
    $f[] = "                            <audioMidi>0</audioMidi>";
    $f[] = "                            <audioCda>0</audioCda>";
    $f[] = "                        </audioSubcategory>";
    $f[] = "                    </multimediaCategory>";
    $f[] = "                    <imageCategory>";
    $f[] = "                        <bitmapSubcategory>";
    $f[] = "                            <imageJpeg>0</imageJpeg>";
    $f[] = "                            <imageGif>0</imageGif>";
    $f[] = "                            <imagePng>0</imagePng>";
    $f[] = "                            <imageBmp>0</imageBmp>";
    $f[] = "                            <imageTiff>0</imageTiff>";
    $f[] = "                        </bitmapSubcategory>";
    $f[] = "                        <vectorSubcategory>";
    $f[] = "                            <imageEmf>0</imageEmf>";
    $f[] = "                            <imageEps>0</imageEps>";
    $f[] = "                            <imagePsd>0</imagePsd>";
    $f[] = "                            <imageCdr>0</imageCdr>";
    $f[] = "                        </vectorSubcategory>";
    $f[] = "                        <animationSubcategory>";
    $f[] = "                            <multimediaSwf>0</multimediaSwf>";
    $f[] = "                        </animationSubcategory>";
    $f[] = "                    </imageCategory>";
    $f[] = "                    <archiveCategory>";
    $f[] = "                        <archiveZip>0</archiveZip>";
    $f[] = "                        <archive7z>0</archive7z>";
    $f[] = "                        <archiveRar>0</archiveRar>";
    $f[] = "                        <archiveIso>0</archiveIso>";
    $f[] = "                        <archiveCab>0</archiveCab>";
    $f[] = "                        <archiveJar>0</archiveJar>";
    $f[] = "                        <archiveBzip2>0</archiveBzip2>";
    $f[] = "                        <archiveGzip>0</archiveGzip>";
    $f[] = "                        <archiveArj>0</archiveArj>";
    $f[] = "                    </archiveCategory>";
    $f[] = "                    <databaseCategory>";
    $f[] = "                        <databaseAccdb>0</databaseAccdb>";
    $f[] = "                        <databaseAccdc>0</databaseAccdc>";
    $f[] = "                        <databaseMdb>0</databaseMdb>";
    $f[] = "                    </databaseCategory>";
    $f[] = "                    <miscellaneousCategory>";
    $f[] = "                        <generalTxt>0</generalTxt>";
    $f[] = "                        <textChm>0</textChm>";
    $f[] = "                        <generalHtml>0</generalHtml>";
    $f[] = "                    </miscellaneousCategory>";
    $f[] = "                </excludedFormats>";
    $f[] = "                <scanArchived>1</scanArchived>";
    $f[] = "            </engineSettings>";
    $f[] = "            <intrusionThreatAction>Reject</intrusionThreatAction>";
    $f[] = "            <infectedFirstAction>Cure</infectedFirstAction>";
    $f[] = "            <infectedSecondAction>DeleteAttachment</infectedSecondAction>";
    $f[] = "            <suspiciousAction>DeleteAttachment</suspiciousAction>";
    $f[] = "            <corruptedAction>Skip</corruptedAction>";
    $f[] = "            <encryptedAction>Skip</encryptedAction>";
    $f[] = "            <intrusionThreatMark>[Intrusion Threat]</intrusionThreatMark>";
    $f[] = "            <infectedMark>[Infected]</infectedMark>";
    $f[] = "            <suspiciousMark>[Suspicious]</suspiciousMark>";
    $f[] = "            <disinfectedMark>[Cured]</disinfectedMark>";
    $f[] = "            <encryptedMark></encryptedMark>";
    $f[] = "            <corruptedMark></corruptedMark>";
    $f[] = "        </avScanSettings>";
    $f[] = "        <asScanSettings>";
    $f[] = "            <engineSettings>";
    $f[] = "                <enableScan>0</enableScan>";
    $f[] = "                <maxSizeLimit>1572864</maxSizeLimit>";
    $f[] = "                <spamRateLimit>Standard</spamRateLimit>";
    $f[] = "                <externalServices>";
    $f[] = "                    <useDns>1</useDns>";
    $f[] = "                    <useSpf>1</useSpf>";
    $f[] = "                    <useSurbl>1</useSurbl>";
    $f[] = "                    <useSurblDefaultList>1</useSurblDefaultList>";
    $f[] = "                    <useDnsbl>1</useDnsbl>";
    $f[] = "                    <useDnsblDefaultList>1</useDnsblDefaultList>";
    $f[] = "                    <dnsHostInDns>1</dnsHostInDns>";
    $f[] = "                    <dnsDynamicResolvedFrom>0</dnsDynamicResolvedFrom>";
    $f[] = "                </externalServices>";
    $f[] = "                <advancedOptions>";
    $f[] = "                    <parseRtf>0</parseRtf>";
    $f[] = "                    <useGsg>1</useGsg>";
    $f[] = "                    <disableLangChinese>0</disableLangChinese>";
    $f[] = "                    <disableLangKorean>0</disableLangKorean>";
    $f[] = "                    <disableLangThai>0</disableLangThai>";
    $f[] = "                    <disableLangJapanese>0</disableLangJapanese>";
    $f[] = "                </advancedOptions>";
    $f[] = "            </engineSettings>";
    $f[] = "            <backupSpam>0</backupSpam>";
    $f[] = "            <backupProbableSpam>0</backupProbableSpam>";
    $f[] = "            <backupBlacklisted>0</backupBlacklisted>";
    $f[] = "            <spamAction>Skip</spamAction>";
    $f[] = "            <probableSpamAction>Skip</probableSpamAction>";
    $f[] = "            <blacklistedAction>Skip</blacklistedAction>";
    $f[] = "            <spamMark>[Spam]</spamMark>";
    $f[] = "            <probableSpamMark>[Probable spam]</probableSpamMark>";
    $f[] = "            <blacklistedMark>[Blacklisted]</blacklistedMark>";
    $f[] = "        </asScanSettings>";
    $f[] = "        <cfScanSettings>";
    $f[] = "            <sizeExceededAction>Reject</sizeExceededAction>";
    $f[] = "            <bannedFileNameAction>Reject</bannedFileNameAction>";
    $f[] = "            <bannedFileFormatAction>Reject</bannedFileFormatAction>";
    $f[] = "            <backupSizeExceeded>0</backupSizeExceeded>";
    $f[] = "            <backupBannedFileName>0</backupBannedFileName>";
    $f[] = "            <backupBannedFileFormat>0</backupBannedFileFormat>";
    $f[] = "            <engineSettings>";
    $f[] = "                <enableScan>0</enableScan>";
    $f[] = "                <maxAllowedSize>0</maxAllowedSize>";
    $f[] = "                <bannedFileNames />";
    $f[] = "                <bannedFileFormats>";
    $f[] = "                    <executableCategory>";
    $f[] = "                        <executableWin>0</executableWin>";
    $f[] = "                        <executableMsi>0</executableMsi>";
    $f[] = "                        <executableJava>0</executableJava>";
    $f[] = "                        <executableElf>0</executableElf>";
    $f[] = "                        <executableDeb>0</executableDeb>";
    $f[] = "                        <executableRpm>0</executableRpm>";
    $f[] = "                    </executableCategory>";
    $f[] = "                    <officeCategory>";
    $f[] = "                        <documentSubcategory>";
    $f[] = "                            <msOfficeDoc>0</msOfficeDoc>";
    $f[] = "                            <msOfficeDocx>0</msOfficeDocx>";
    $f[] = "                            <msOfficeDocm>0</msOfficeDocm>";
    $f[] = "                            <msOfficeDot>0</msOfficeDot>";
    $f[] = "                            <msOfficeDotx>0</msOfficeDotx>";
    $f[] = "                            <msOfficeDotm>0</msOfficeDotm>";
    $f[] = "                            <officePdf>0</officePdf>";
    $f[] = "                            <officeXps>0</officeXps>";
    $f[] = "                            <officeRtf>0</officeRtf>";
    $f[] = "                            <officeOdt>0</officeOdt>";
    $f[] = "                            <officeSxw>0</officeSxw>";
    $f[] = "                        </documentSubcategory>";
    $f[] = "                        <spreadsheetSubcategory>";
    $f[] = "                            <msOfficeXls>0</msOfficeXls>";
    $f[] = "                            <msOfficeXlsx>0</msOfficeXlsx>";
    $f[] = "                            <msOfficeXlsm>0</msOfficeXlsm>";
    $f[] = "                            <msOfficeXlsb>0</msOfficeXlsb>";
    $f[] = "                            <msOfficeXltx>0</msOfficeXltx>";
    $f[] = "                            <msOfficeXltm>0</msOfficeXltm>";
    $f[] = "                            <msOfficeXlam>0</msOfficeXlam>";
    $f[] = "                            <officeOds>0</officeOds>";
    $f[] = "                        </spreadsheetSubcategory>";
    $f[] = "                        <presentationSubcategory>";
    $f[] = "                            <msOfficePpt>0</msOfficePpt>";
    $f[] = "                            <msOfficePptx>0</msOfficePptx>";
    $f[] = "                            <msOfficePptm>0</msOfficePptm>";
    $f[] = "                            <msOfficePotx>0</msOfficePotx>";
    $f[] = "                            <msOfficePotm>0</msOfficePotm>";
    $f[] = "                            <msOfficePpsx>0</msOfficePpsx>";
    $f[] = "                            <msOfficePpsm>0</msOfficePpsm>";
    $f[] = "                            <officeOdp>0</officeOdp>";
    $f[] = "                        </presentationSubcategory>";
    $f[] = "                        <specializedSubcategory>";
    $f[] = "                            <officeMsg>0</officeMsg>";
    $f[] = "                            <officeOne>0</officeOne>";
    $f[] = "                            <officeOnepkg>0</officeOnepkg>";
    $f[] = "                            <officeVsd>0</officeVsd>";
    $f[] = "                            <officeVdx>0</officeVdx>";
    $f[] = "                            <officeXsn>0</officeXsn>";
    $f[] = "                            <msOfficePub>0</msOfficePub>";
    $f[] = "                        </specializedSubcategory>";
    $f[] = "                    </officeCategory>";
    $f[] = "                    <multimediaCategory>";
    $f[] = "                        <videoSubcategory>";
    $f[] = "                            <videoFlv>0</videoFlv>";
    $f[] = "                            <videoF4v>0</videoF4v>";
    $f[] = "                            <videoAvi>0</videoAvi>";
    $f[] = "                            <video3gpp>0</video3gpp>";
    $f[] = "                            <videoDivx>0</videoDivx>";
    $f[] = "                            <videoMkv>0</videoMkv>";
    $f[] = "                            <videoMov>0</videoMov>";
    $f[] = "                            <videoAsf>0</videoAsf>";
    $f[] = "                            <videoRm>0</videoRm>";
    $f[] = "                            <videoVob>0</videoVob>";
    $f[] = "                            <videoBik>0</videoBik>";
    $f[] = "                        </videoSubcategory>";
    $f[] = "                        <audioSubcategory>";
    $f[] = "                            <audioMp3>0</audioMp3>";
    $f[] = "                            <audioFlac>0</audioFlac>";
    $f[] = "                            <audioApe>0</audioApe>";
    $f[] = "                            <audioOgg>0</audioOgg>";
    $f[] = "                            <audioAac>0</audioAac>";
    $f[] = "                            <audioWma>0</audioWma>";
    $f[] = "                            <audioAc3>0</audioAc3>";
    $f[] = "                            <audioWav>0</audioWav>";
    $f[] = "                            <audioMka>0</audioMka>";
    $f[] = "                            <audioRa>0</audioRa>";
    $f[] = "                            <audioMidi>0</audioMidi>";
    $f[] = "                            <audioCda>0</audioCda>";
    $f[] = "                        </audioSubcategory>";
    $f[] = "                    </multimediaCategory>";
    $f[] = "                    <imageCategory>";
    $f[] = "                        <bitmapSubcategory>";
    $f[] = "                            <imageJpeg>0</imageJpeg>";
    $f[] = "                            <imageGif>0</imageGif>";
    $f[] = "                            <imagePng>0</imagePng>";
    $f[] = "                            <imageBmp>0</imageBmp>";
    $f[] = "                            <imageTiff>0</imageTiff>";
    $f[] = "                        </bitmapSubcategory>";
    $f[] = "                        <vectorSubcategory>";
    $f[] = "                            <imageEmf>0</imageEmf>";
    $f[] = "                            <imageEps>0</imageEps>";
    $f[] = "                            <imagePsd>0</imagePsd>";
    $f[] = "                            <imageCdr>0</imageCdr>";
    $f[] = "                        </vectorSubcategory>";
    $f[] = "                        <animationSubcategory>";
    $f[] = "                            <multimediaSwf>0</multimediaSwf>";
    $f[] = "                        </animationSubcategory>";
    $f[] = "                    </imageCategory>";
    $f[] = "                    <archiveCategory>";
    $f[] = "                        <archiveZip>0</archiveZip>";
    $f[] = "                        <archive7z>0</archive7z>";
    $f[] = "                        <archiveRar>0</archiveRar>";
    $f[] = "                        <archiveIso>0</archiveIso>";
    $f[] = "                        <archiveCab>0</archiveCab>";
    $f[] = "                        <archiveJar>0</archiveJar>";
    $f[] = "                        <archiveBzip2>0</archiveBzip2>";
    $f[] = "                        <archiveGzip>0</archiveGzip>";
    $f[] = "                        <archiveArj>0</archiveArj>";
    $f[] = "                    </archiveCategory>";
    $f[] = "                    <databaseCategory>";
    $f[] = "                        <databaseAccdb>0</databaseAccdb>";
    $f[] = "                        <databaseAccdc>0</databaseAccdc>";
    $f[] = "                        <databaseMdb>0</databaseMdb>";
    $f[] = "                    </databaseCategory>";
    $f[] = "                    <miscellaneousCategory>";
    $f[] = "                        <generalTxt>0</generalTxt>";
    $f[] = "                        <textChm>0</textChm>";
    $f[] = "                        <generalHtml>0</generalHtml>";
    $f[] = "                    </miscellaneousCategory>";
    $f[] = "                </bannedFileFormats>";
    $f[] = "            </engineSettings>";
    $f[] = "        </cfScanSettings>";
    $f[] = "        <notificationSettings>";
    $f[] = "            <admin>";
    $f[] = "                <enableInfected>1</enableInfected>";
    $f[] = "                <enableCorrupted>0</enableCorrupted>";
    $f[] = "                <enableEncrypted>0</enableEncrypted>";
    $f[] = "                <enableCFFail>1</enableCFFail>";
    $f[] = "            </admin>";
    $f[] = "            <sender>";
    $f[] = "                <enableInfected>1</enableInfected>";
    $f[] = "                <enableCorrupted>0</enableCorrupted>";
    $f[] = "                <enableEncrypted>0</enableEncrypted>";
    $f[] = "                <enableCFFail>1</enableCFFail>";
    $f[] = "            </sender>";
    $f[] = "            <recipient>";
    $f[] = "                <enableInfected>0</enableInfected>";
    $f[] = "                <enableCorrupted>0</enableCorrupted>";
    $f[] = "                <enableEncrypted>0</enableEncrypted>";
    $f[] = "                <enableCFFail>0</enableCFFail>";
    $f[] = "            </recipient>";
    $f[] = "            <additional>";
    $f[] = "                <options>";
    $f[] = "                    <enableInfected>0</enableInfected>";
    $f[] = "                    <enableCorrupted>0</enableCorrupted>";
    $f[] = "                    <enableEncrypted>0</enableEncrypted>";
    $f[] = "                    <enableCFFail>0</enableCFFail>";
    $f[] = "                </options>";
    $f[] = "                <emailListInfected />";
    $f[] = "                <emailListCorrupted />";
    $f[] = "                <emailListEncrypted />";
    $f[] = "                <emailListCFFail />";
    $f[] = "            </additional>";
    $f[] = "        </notificationSettings>";
    $f[] = "    </scanSettings>";
    $f[] = "</root>";
    $filetemp = $unix->FILE_TEMP();
    @file_put_contents($filetemp, @implode("\n", $f));
    $cmd = "/opt/kaspersky/klms/bin/klms-control --create-rule \"From Local Network\" -f {$filetemp}";
    if ($ID > 0) {
        $cmd = "/opt/kaspersky/klms/bin/klms-control --set-rule-settings {$ID} -f {$filetemp}";
    }
    echo "Starting......: " . date("H:i:s") . " Kaspersky Mail security Suite `{$cmd}`\n";
    exec($cmd, $results);
    while (list($key, $line) = each($results)) {
        echo "Starting......: " . date("H:i:s") . " Kaspersky Mail security Suite \"{$line}\"\n";
    }
}