Example #1
0
function save()
{
    $sender_canonical = $_GET["sender_canonical"];
    $relay_address = $_GET["relay_address"];
    $relay_port = $_GET["relay_port"];
    $sasl_username = $_GET["sasl_username"];
    $sasl_password = $_GET["sasl_password"];
    $user = new user($_SESSION["uid"]);
    $user->SenderCanonical = $_GET["sender_canonical"];
    $user->add_Canonical();
    if ($relay_address != null && $relay_port != null) {
        $domain = new DomainsTools();
        $line = $domain->transport_maps_implode($relay_address, $relay_port, null, "no");
        $user->SenderCanoniCalSMTPRelayAdd($line, $sasl_username, $sasl_password, $relay_address);
    }
}
function relayhostSave()
{
    $ou = $_GET["ou"];
    $hostname = $_GET["hostname"];
    $tpl = new templates();
    if ($_GET["relay_port"] == null) {
        $_GET["relay_port"] = 25;
    }
    if ($_GET["relay_address"] == null) {
        echo $tpl->_ENGINE_parse_body("{error_no_server_specified}");
        exit;
    }
    $tool = new DomainsTools();
    writelogs("Port={$_GET["relay_port"]} address={$_GET["relay_address"]}", __FUNCTION__, __FILE__);
    $data = $tool->transport_maps_implode($_GET["relay_address"], $_GET["relay_port"], 'smtp', $_GET["MX_lookups"]);
    writelogs("Port={$_GET["relay_port"]} address={$_GET["relay_address"]}={$data}", __FUNCTION__, __FILE__);
    $data = str_replace('smtp:', '', $data);
    //smtp_sasl_password_maps
    $main = new maincf_multi($hostname, $ou);
    if ($_GET["username"] != null) {
        $auth = "{$_GET["username"]}:{$_GET["password"]}";
        $main->SET_VALUE("relayhost_authentication", $auth);
    }
    $main->SET_VALUE("relayhost", $data);
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?postfix-multi-relayhost={$_GET["hostname"]}");
}
function PostFixAddServerCacheSave()
{
    $tool = new DomainsTools();
    $tpl = new templates();
    $relay_address = $_GET["relay_address"];
    $relay_port = $_GET["relay_port"];
    $MX_lookups = $_GET["MX_lookups"];
    $domain = $_GET["domain"];
    if ($domain != null && $relay_address != null) {
        echo $tpl->_ENGINE_parse_body('{error_give_server_or_domain}');
        exit;
    }
    if ($relay_address != null) {
        $line = $tool->transport_maps_implode($relay_address, $relay_port, null, $MX_lookups);
        $line = str_replace('smtp:', '', $line);
    } else {
        $line = $domain;
    }
    $ldap = new clladp();
    if (!$ldap->ExistsDN("cn=smtp_connection_cache_destinations,cn=artica,{$ldap->suffix}")) {
        $dn = "cn=smtp_connection_cache_destinations,cn=artica,{$ldap->suffix}";
        $upd["cn"][0] = 'smtp_connection_cache_destinations';
        $upd['objectClass'][0] = 'PostFixStructuralClass';
        $upd['objectClass'][1] = 'top';
        if (!$ldap->ldap_add($dn, $upd)) {
            echo $ldap->ldap_last_error;
        }
        unset($upd);
    }
    $dn = "cn={$line},cn=smtp_connection_cache_destinations,cn=artica,{$ldap->suffix}";
    $upd["cn"][0] = $line;
    $upd['objectClass'][0] = 'PostFixSmtpConnectionCacheDestinations';
    $upd['objectClass'][1] = 'top';
    if (!$ldap->ldap_add($dn, $upd)) {
        echo $ldap->ldap_last_error;
    }
}
function import_save()
{
    $tpl = new templates();
    $q = new mysql();
    if ($_POST["recipient-import"] == null) {
        return;
    }
    if ($_POST["relay_address"] == null) {
        echo $tpl->_ENGINE_parse_body('{error_no_server_specified}');
        exit;
    }
    $domaintools = new DomainsTools();
    $transport = $domaintools->transport_maps_implode($_POST["relay_address"], $_POST["port"], "smtp", $_POST["MX_lookups"]);
    $prefix = "INSERT IGNORE INTO postfix_transport_recipients (recipient,transport,enabled,hostname) VALUES ";
    $tr = explode("\n", $_POST["recipient-import"]);
    while (list($num, $email) = each($tr)) {
        $email = trim($email);
        $email = str_replace("\r", "", $email);
        $email = str_replace("\n", "", $email);
        if ($email == null) {
            continue;
        }
        $f[] = "('{$email}','{$transport}',1,'{$_POST["hostname"]}')";
    }
    if (count($f) > 0) {
        $sql = $prefix . @implode(",", $f);
        $q->QUERY_SQL($sql, "artica_backup");
        if (!$q->ok) {
            echo $q->mysql_error;
            return;
        }
        echo $tpl->javascript_parse_text(count($f) . " {new_items}");
    }
}
Example #5
0
function smtp_instance_cache_destinations_save()
{
    $tool = new DomainsTools();
    $tpl = new templates();
    $relay_address = $_POST["relay_address"];
    $relay_port = $_POST["relay_port"];
    $MX_lookups = $_GET["MX_lookups"];
    $domain = $_POST["domain"];
    $uuid = $_POST["uuid"];
    if ($domain != null && $relay_address != null) {
        echo $tpl->javascript_parse_text('{error_give_server_or_domain}');
        exit;
    }
    if ($relay_address != null) {
        $line = $tool->transport_maps_implode($relay_address, $relay_port, null, $MX_lookups);
        $line = str_replace('smtp:', '', $line);
    } else {
        $line = $domain;
    }
    $main = new maincf_multi($_POST["hostname"], $_POST["ou"]);
    $array = unserialize(base64_decode($main->GET_BIGDATA("domain_throttle_daemons_list")));
    $array[$uuid]["smtp-instance-cache-destinations"][$line] = "OK";
    $smtp_connection_cache_destinations_new = base64_encode(serialize($array));
    if (!$main->SET_BIGDATA("domain_throttle_daemons_list", addslashes($smtp_connection_cache_destinations_new))) {
        echo $main->{$q}->mysql_error;
        return;
    }
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?postfix-throttle=yes&instance={$_GET["hostname"]}");
}
Example #6
0
function PostfixAddRoutingRuleTableSave(){
$MX_lookups=$_GET["MX_lookups"];
$domain=$_GET["domain"];
$org=$_GET["org"];
$relay_address=$_GET["relay_address"];
$relay_port	=$_GET["relay_port"];
$service=$_GET["service"];
$tpl=new templates();
if($relay_address==null){echo $tpl->_ENGINE_parse_body('{error_give_address}');return null;}
if($domain==null){echo $tpl->_ENGINE_parse_body('{error_give_pattern}');return null;}
if($org==null){echo $tpl->_ENGINE_parse_body('{error_no_organization}');return null;}
writelogs("organization for this transport table rule=$org",__FUNCTION__,__FILE__);
	$tool=new DomainsTools();
	$line=$tool->transport_maps_implode($relay_address,$relay_port,$service,$MX_lookups);
writelogs("$line",__FUNCTION__,__FILE__);	
	$ldap=new clladp();
	$ldap->AddTransportTable($domain,$line,$org);
	$sock=new sockets();
	$sock->getFrameWork("services.php?postfix-single=yes");

}
function table_list()
{
    $MyPage = CurrentPageName();
    $page = 1;
    $tpl = new templates();
    $q = new mysql();
    if (!$q->TABLE_EXISTS("postfix_transport_recipients", "artica_backup")) {
        $q->BuildTables();
    }
    $table = "postfix_transport_recipients";
    $t = $_GET["t"];
    $database = "artica_backup";
    $FORCE_FILTER = " hostname='{$_GET["hostname"]}'";
    if ($q->COUNT_ROWS($table, $database) == 0) {
        json_error_show("{$table} is empty");
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($_POST["query"] != null) {
        $_POST["query"] = str_replace("*", "%", $_POST["query"]);
        $search = $_POST["query"];
        $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')";
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}");
        }
        $total = $ligne["TCOUNT"];
        if ($total == 0) {
            json_error_show("No rows for {$search}");
        }
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE_FILTER}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    if ($OnlyEnabled) {
        $limitSql = null;
    }
    $sql = "SELECT *  FROM {$table} WHERE {$FORCE_FILTER} {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, $database);
    if (!$q->ok) {
        json_error_show("{$q->mysql_error}<hr>{$sql}<hr>");
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (mysql_num_rows($results) == 0) {
        json_error_show("No rules...", 1);
    }
    $tools = new DomainsTools();
    $style = "font-size:14px;";
    while ($ligne = mysql_fetch_assoc($results)) {
        $transport = $ligne["transport"];
        $arr = $tools->transport_maps_explode($transport);
        $relay = "{$arr[1]}:{$arr[2]}";
        $js = "TransPortRecipt{$t}('{$ligne["recipient"]}')";
        $md = md5(serialize($ligne));
        $cells = array();
        $cells[] = "<a href=\"javascript:blur();\" Onclick=\"javascript:{$js};\" style='font-size:22px;font-weight:bold'>{$ligne["recipient"]}</a>";
        $cells[] = "<a href=\"javascript:blur();\" Onclick=\"javascript:{$js};\" style='font-size:22px;font-weight:bold'>{$relay}</a>";
        $cells[] = "<center>" . Field_checkbox("{$md}-enabled", 1, $ligne["enabled"], "TransPortReciptEnable{$t}('{$md}','{$ligne["recipient"]}')") . "</center>";
        $cells[] = "<center>" . imgsimple("delete-32.png", null, "TransPortReciptDel{$t}('{$ligne["recipient"]}','{$md}')") . "</center>";
        $data['rows'][] = array('id' => $md, 'cell' => $cells);
    }
    echo json_encode($data);
}
Example #8
0
function PostfixAddFallBackerserverList()
{
    $main = new maincf_multi($_GET["hostname"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $add = imgtootltip("plus-24.png", "{add_server_domain}", "PostfixAddFallBackServer()");
    $hash = explode(',', $main->GET_BIGDATA("smtp_fallback_relay"));
    $tool = new DomainsTools();
    $html = "<center>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>{$add}</th>\n\t\t<th>{relay_address}</th>\n\t\t<th>{smtp_port}</th>\n\t\t<th>{MX_lookups}</th>\n\t\t<th colspan=3>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    if (is_array($hash)) {
        while (list($index, $ligne) = each($hash)) {
            if ($classtr == "oddRow") {
                $classtr = null;
            } else {
                $classtr = "oddRow";
            }
            if ($ligne != null) {
                $cell_up = "<td width=1%>" . imgtootltip('arrow_up.gif', '{up}', "PostfixAddFallBackServerMove('{$index}','up')") . "</td>";
                $cell_down = "<td width=1%>" . imgtootltip('arrow_down.gif', '{down}', "PostfixAddFallBackServerMove('{$index}','down')") . "</td>";
                $arr = $tool->transport_maps_explode("smtp:{$ligne}");
                $html = $html . "<tr>\n\t\t\t\n\t\t\t\t<td colspan=2><code style='font-size:14px'><a href=\"javascript:PostfixAddFallBackServer('{$index}');\">{$arr[1]}</a></code></td>\n\t\t\t\t<td align='center' style='font-size:14px' ><code>{$arr[2]}</code></td>\n\t\t\t\t<td align='center'style='font-size:14px'><code>{$arr[3]}</code></td>\n\t\t\t\t{$cell_up}\n\t\t\t\t{$cell_down}\n\t\t\t\t<td align='center' width=1%>" . imgtootltip("delete-32.png", '{delete}', "PostfixAddFallBackerserverDelete('{$index}')") . "</td>\n\t\t\t\t</tr>";
            }
        }
    }
    $html = $html . "</tbody></table></center>\n<script>\n\tvar x_PostfixAddFallBackServerMove=function(obj){\n    \tvar tempvalue=trim(obj.responseText);\n\t  \tif(tempvalue.length>3){alert(tempvalue);}\n\t\tRefreshFailBackServers();\n\t\t}\t\n\n\nfunction PostfixAddFallBackServerMove(num,move){\n\tvar XHR = new XHRConnection();\t\n\tXHR.appendData('PostfixAddFallBackServerMove',num);\n\tXHR.appendData('move',num);\n\tXHR.appendData('hostname','{$_GET["hostname"]}');\t\t\t\n\tXHR.sendAndLoad('{$page}', 'GET',x_PostfixAddFallBackServerMove);\t\n\t\t\t\n}\n\n</script>\n";
    return $tpl->_ENGINE_parse_body($html);
}
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 PostfixAddFallBackerserverList()
{
    $main = new maincf_multi($_GET["hostname"]);
    $tpl = new templates();
    $Mypage = CurrentPageName();
    $add = imgtootltip("plus-24.png", "{add_server_domain}", "PostfixAddFallBackServer()");
    $hash = explode(',', $main->GET_BIGDATA("smtp_fallback_relay"));
    $tool = new DomainsTools();
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($hash);
    $data['rows'] = array();
    $search = string_to_flexregex();
    $c = 0;
    if (is_array($hash)) {
        while (list($index, $ligne) = each($hash)) {
            if ($ligne == null) {
                continue;
            }
            $arr = $tool->transport_maps_explode("smtp:{$ligne}");
            if ($search != null) {
                if (!preg_match("#{$search}#", $arr[1])) {
                    continue;
                }
            }
            $cell_up = "<td width=1%>" . imgsimple('arrow_up.gif', '{up}', "PostfixAddFallBackServerMove('{$index}','up')") . "</td>";
            $cell_down = "<td width=1%>" . imgsimple('arrow_down.gif', '{down}', "PostfixAddFallBackServerMove('{$index}','down')") . "</td>";
            $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<code style='font-size:14px'><a href=\"javascript:PostfixAddFallBackServer('{$index}');\">{$arr[1]}</a></code>", "<span style='font-size:14px;color:{$color};'>{$arr[2]}</span>", "<span style='font-size:14px;color:{$color};'>{$arr[3]}</span>", "<span style='font-size:14px;color:{$color};'><table><tr>{$cell_up}{$cell_down}</tr></table></span>", imgsimple("delete-32.png", '{delete}', "PostfixAddFallBackerserverDelete('{$index}')")));
            $c++;
        }
    }
    $data['total'] = $c;
    echo json_encode($data);
}
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));
}
function sender_host()
{
    $uid = $_GET["uid"];
    $user = new user($uid);
    $SenderParams = $user->SenderCanonicalSMTPRelay();
    $host = $SenderParams["HOST"];
    $auth = $SenderParams["AUTH"];
    $users = new usersMenus();
    $page = CurrentPageName();
    if ($host != null) {
        $dom = new DomainsTools();
        $arr = $dom->transport_maps_explode($host);
    }
    if ($arr[2] == null) {
        $arr[2] = 25;
    }
    $form = "\n<H3 style='font-size:16px;font-weight:bolder;color:#005447' >{user_transport}</H3>\n<table style='width:100%'>\n\t<td align='right' nowrap class=legend>{relay_address}:</strong></td>\n\t<td>" . Field_text('relay_address', $arr[1], 'width:120px') . "</td>\t\n\t<tr>\n\t\t<td align='right' nowrap class=legend>{smtp_port}:</strong></td>\n\t\t<td>" . Field_text('relay_port', $arr[2], 'width:60px') . "</td>\t\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap>" . Field_yesno_checkbox_img('MX_lookups', $relayT[3], '{MX_lookups_text}') . "</td>\n\t\t<td>{MX_lookups}</td>\t\n\t</tr>\t\n\t</table>";
    if (preg_match("#(.+?):(.+)#", $auth, $re)) {
        $username = $re[1];
        $password = $re[2];
    }
    $form2 = "\n<H3 style='font-size:16px;font-weight:bolder;color:#005447' >{AUTH_SETTINGS}</H3>\n<table style='width:100%'>\n<tr>\n<td colspan=2 align=right>{$user->SenderCanonical}</td></tr>\n\t<tr>\n\t\t<td valign='top' class=legend nowrap>{username}:</td>\n\t\t<td valign='top'>" . Field_text('sasl_username', $username) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' class=legend nowrap>{password}:</td>\n\t\t<td valign='top'>" . Field_password('sasl_password', $password) . "</td>\n\t</tr>\t\n\t</table>";
    $delete = imgtootltip("ed_delete.gif", "{delete}", "DeleteUserSenderTransport()");
    $button = "<div style='width:100%;text-align:right'>\n" . button("{edit}", "SaveUserSenderTransport();") . "\n</div>";
    if (!$users->AllowSenderCanonical) {
        $form2 = null;
        $button = null;
        $delete = null;
    }
    if ($arr[1] == null) {
        $delete = null;
    }
    $html = "\n<H1>{user_transport}</H1>\n<div id='sasltransport'>\n<table style='width:100%'>\n<tr>\n\t<td valign='top'>\n\t\t<img src='img/user-server-128.png'>\n\t</td>\n\t<td valign='top'>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='top'>\n\t\t\t\t{$form}\n\t\t\t\t<br>\n\t\t\t\t{$form2}\n\t\t\t\t<hr>\n\t\t\t</td>\n\t\t\t<td valign='top' width=1%>{$delete}</td>\n\t\t</tr>\n\t\t</table>\n{$button}\n\t</td>\n</tr>\n</table>\n</div>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
    return false;
    $dusbin = "\n\t<form name='FFMrelayhost'>\n<input type='hidden' name='uid' value='{$uid}'>\n\t<table style='width:100%'>\n\t<td align='right' nowrap class=legend>{relay_address}:</strong></td>\n\t<td>" . Field_text('relay_address', $relayT[1]) . "</td>\t\n\t</tr>\n\t</tr>\n\t<td align='right' nowrap class=legend>{smtp_port}:</strong></td>\n\t<td>" . Field_text('relay_port', $relayT[2]) . "</td>\t\n\t</tr>\t\n\t<tr>\n\t<td align='right' nowrap>" . Field_yesno_checkbox_img('MX_lookups', $relayT[3], '{enable_disable}') . "</td>\n\t<td>{MX_lookups}</td>\t\n\t</tr>\n\t<tr>\n\t<td align='right' colspan=2 align='right'><input type='button' value='{edit}&nbsp;&raquo;' OnClick=\"javascript:SaveUserTransport();\"></td>\n\t</tr>\t\t\n\t<tr>\n\t<td align='left' colspan=2><hr><p class=caption>{MX_lookups}<br>{MX_lookups_text}</p></td>\n\t</tr>\t\t\t\t\t\n\t</form>";
    if ($user->AlternateSmtpRelay != null) {
        $dom = new DomainsTools();
        $arr = $dom->transport_maps_explode($user->AlternateSmtpRelay);
        $p1 = Paragraphe32('AUTH_SETTINGS', 'AUTH_SETTINGS_TEXT', "Loadjs('{$page}?smtp-sasl={$user->AlternateSmtpRelay}&uid={$uid}')", "inboux-out-32.png");
        $p2 = Paragraphe32('sender_canonical', 'sender_canonical_text', "Loadjs('{$page}?sender-email-js=yes&uid={$uid}')", "32-email-out.png");
        $form = "\n\t\t<center>\n\t\t<table style='width:100%'><tr><td>{$p1}</td><td>{$p2}</td></tr></table>\n\t\t</center>\n\t\t\t<table style='width:100%' class=table_form>\n\t\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend>{relay_address}:</td>\n\t\t\t<td style='font-size:12px;color:red;font-weight:bold'>{$user->AlternateSmtpRelay}</td>\n\t\t\t<td width=1%>" . imgtootltip('ed_delete.gif', '{delete}', "DeleteAlternateSmtpRelay();") . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t</table>\n\t\t\n\t\t";
    }
    $html = "\n\t<H1>{user_transport}</H1>\n\t<p class=caption>{user_transport_text}</p>\n\t{$form}\n\t\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
function PostfixAddFallBackerserverList()
{
    $main = new main_cf();
    $hash = explode(',', $main->main_array["smtp_fallback_relay"]);
    $tool = new DomainsTools();
    $html = "<center>\n<table style='width:458px;padding:5px;border:1px dotted #8E8785;' align='center'>\n\t<tr style='background-color:#CCCCCC'>\n\t\t<td>&nbsp;</td>\n\t\t<td><strong>{relay_address}</strong></td>\n\t\t<td align='center'><strong>{smtp_port}</strong></td>\n\t\t<td align='center'><strong>{MX_lookups}</strong></td>\n\t\t<td><strong>-</strong></td>\n\t\t<td align='center'><strong>-</strong></td>\n\t\t<td align='center'><strong-</strong></td>\n\t</tr>";
    if (is_array($hash)) {
        while (list($index, $ligne) = each($hash)) {
            if ($ligne != null) {
                $cell_up = "<td width=1%>" . imgtootltip('arrow_up.gif', '{up}', "PostfixAddFallBackServerMove('{$index}','up')") . "</td>";
                $cell_down = "<td width=1%>" . imgtootltip('arrow_down.gif', '{down}', "PostfixAddFallBackServerMove('{$index}','down')") . "</td>";
                $arr = $tool->transport_maps_explode("smtp:{$ligne}");
                $html = $html . "<tr>\n\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t<td><code><a href=\"javascript:PostfixAddFallBackServer('{$index}');\">{$arr[1]}</a></code></td>\n\t\t<td align='center'><code>{$arr[2]}</code></td>\n\t\t<td align='center'><code>{$arr[3]}</code></td>\n\t\t{$cell_up}\n\t\t{$cell_down}\n\t\t<td align='center' width=1%>" . imgtootltip("x.gif", '{delete}', "PostfixAddFallBackerserverDelete('{$index}')") . "</td>\n\t\t</tr>";
            }
        }
    }
    $html = $html . "</table></center>";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
Example #15
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);
}
Example #16
0
function TLSAddSMTPServer()
{
    $main = new main_cf();
    if ($_GET["tls_smtp_server"] != null) {
        $ldap = new clladp();
        $tool = new DomainsTools();
        $h = $ldap->hash_Smtp_Tls_Policy_Maps();
        $relayT = $tool->transport_maps_explode($_GET["tls_smtp_server"]);
        $tls_value = $h[$_GET["tls_smtp_server"]];
    }
    $field = Field_array_Hash($main->array_field_relay_tls, 'smtp_tls_policy_maps', $tls_value);
    $page = CurrentPageName();
    $html = "<div style='padding:20px'>\n\t<H3>{tls_smtp_server}</H3>\n\t<form name='tls_smtp_server'>\n<input type='hidden' name='TLSAddSMTPServerSave' value='yes'>\n\t<table style='width:100%'>\n\t<td align='right' nowrap><strong>{relay_address}:</strong></td>\n\t<td>" . Field_text('relay_address', $relayT[1]) . "</td>\t\n\t</tr>\n\t</tr>\n\t<td align='right' nowrap><strong>{smtp_port}:</strong></td>\n\t<td>" . Field_text('relay_port', $relayT[2]) . "</td>\t\n\t</tr>\t\n\t<tr>\n\t<td align='right' nowrap>" . Field_yesno_checkbox_img('MX_lookups', $relayT[3], '{enable_disable}') . "</td>\n\t<td>{MX_lookups}</td>\t\n\t</tr>\n\t</tr>\n\t<td align='right' nowrap valign='top'><strong>{tls_level}:</strong></td>\n\t<td>{$field}<div class='caption'>{use_tls_relay_explain}</div></td>\t\n\t</tr>\t\t\n\t<tr>\n\t<td align='right' class=caption colspan=2><input type='button' value='{edit}&nbsp;&raquo;' OnClick=\"javascript:ParseForm('tls_smtp_server','{$page}',true);TLSLoadTable();\"></td>\n\t</tr>\t\t\n\t<tr>\n\t<td align='left' class=caption colspan=2><strong>{MX_lookups}</strong><br>{MX_lookups_text}</td>\n\t</tr>\t\t\t\t\t\n\t</form>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
function sender_host(){
	$uid=$_GET["uid"];
	$user=new user($uid);
	$SenderParams=$user->SenderCanonicalSMTPRelay();
	
	

	
	
	$host=$SenderParams["HOST"];
	$auth=$SenderParams["AUTH"];
	
	$users=new usersMenus();
	$page=CurrentPageName();
	if($host<>null){
		$dom=new DomainsTools();
		$arr=$dom->transport_maps_explode($host);
	}	
	if($arr[2]==null){$arr[2]=25;}
	
$form="
<div style='font-size:14px;font-weight:bolder;color:#005447'>{user_transport}</div>
<table style='width:100%' class=form>
	<td align='right' nowrap class=legend>{relay_address}:</strong></td>
	<td>" . Field_text('relay_address',$arr[1],'width:150px;font-size:15px;padding:3px') . "</td>	
	<tr>
		<td align='right' nowrap class=legend>{smtp_port}:</strong></td>
		<td>" . Field_text('relay_port',$arr[2],'width:60px;font-size:15px;padding:3px') . "</td>	
	</tr>	
	<tr>
		<td align='right' nowrap>" . Field_yesno_checkbox_img('MX_lookups',$arr[3],'{MX_lookups_text}')."</td>
		<td>{MX_lookups}</td>	
	</tr>	
	</table>";



	
	if(preg_match("#(.+?):(.+)#",$auth,$re)){
		$username=$re[1];
		$password=$re[2];
	}

	
$form2="
<div style='font-size:14px;font-weight:bolder;color:#005447' >{AUTH_SETTINGS}</div>
<table style='width:100%' class=form>
<tr>
<td colspan=2 align=right style='font-size:13px;font-weight:bolder'>$user->SenderCanonical</td></tr>
	<tr>
		<td valign='top' class=legend nowrap>{username}:</td>
		<td valign='top'>".Field_text('sasl_username',$username,'width:130px;font-size:15px;padding:3px')."</td>
	</tr>
	<tr>
		<td valign='top' class=legend nowrap>{password}:</td>
		<td valign='top'>".Field_password('sasl_password',$password,'width:90px;font-size:15px;padding:3px')."</td>
	</tr>	
	</table>";

$delete=imgtootltip("ed_delete.gif","{delete}","DeleteUserSenderTransport()");
$button="<div style='width:100%;text-align:right'>
". button("{edit}","SaveUserSenderTransport();")."
</div>";

if(!$users->AllowSenderCanonical){$form2=null;$button=null;$delete=null;}
if($arr[1]==null){$delete=null;}

	if($user->SenderCanonical==null){
		$js_disable="DisableSenderForm()";
		$button=null;
		$explain_a="<div class=explain>{SMTP_SENDER_FILL_SENDER_CANONICAL_FIRST}</div>";
	}

$html="

<div id='sasltransport'>
<table style='width:100%'>
<tr>
	<td valign='top'>
		<img src='img/user-server-128.png'>
	</td>
	<td valign='top'>$explain_a
		<table style='width:100%'>
		<tr>
			<td valign='top'>
				$form
				<br>
				$form2
				<hr>
			</td>
			<td valign='top' width=1%>$delete</td>
		</tr>
		</table>
$button
	</td>
</tr>
</table>
</div>

<script>
  function DisableSenderForm(){
  	document.getElementById('sasl_username').disabled=true;
  	document.getElementById('sasl_password').disabled=true;
  	document.getElementById('relay_address').disabled=true;
  	document.getElementById('relay_port').disabled=true;
	}
	
	$js_disable;
</script>




";




	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html);
	return false;

$dusbin="
	<form name='FFMrelayhost'>
<input type='hidden' name='uid' value='$uid'>
	<table style='width:100%'>
	<td align='right' nowrap class=legend>{relay_address}:</strong></td>
	<td>" . Field_text('relay_address',$relayT[1]) . "</td>	
	</tr>
	</tr>
	<td align='right' nowrap class=legend>{smtp_port}:</strong></td>
	<td>" . Field_text('relay_port',$relayT[2]) . "</td>	
	</tr>	
	<tr>
	<td align='right' nowrap>" . Field_yesno_checkbox_img('MX_lookups',$relayT[3],'{enable_disable}')."</td>
	<td>{MX_lookups}</td>	
	</tr>
	<tr>
	<td align='right' colspan=2 align='right'><input type='button' value='{edit}&nbsp;&raquo;' OnClick=\"javascript:SaveUserTransport();\"></td>
	</tr>		
	<tr>
	<td align='left' colspan=2><hr><p class=caption>{MX_lookups}<br>{MX_lookups_text}</p></td>
	</tr>					
	</form>";

	if($user->AlternateSmtpRelay<>null){
		$dom=new DomainsTools();
		$arr=$dom->transport_maps_explode($user->AlternateSmtpRelay);
		$p1=Paragraphe32('AUTH_SETTINGS','AUTH_SETTINGS_TEXT',"Loadjs('$page?smtp-sasl=$user->AlternateSmtpRelay&uid=$uid')","inboux-out-32.png");
		$p2=Paragraphe32('sender_canonical','sender_canonical_text',"Loadjs('$page?sender-email-js=yes&uid=$uid')","32-email-out.png");
		$form="
		<center>
		<table style='width:100%'><tr><td>$p1</td><td>$p2</td></tr></table>
		</center>
			<table style='width:100%' class=table_form>
			<tr>
			<td align='right' nowrap class=legend>{relay_address}:</td>
			<td style='font-size:12px;color:red;font-weight:bold'>$user->AlternateSmtpRelay</td>
			<td width=1%>". imgtootltip('ed_delete.gif','{delete}',"DeleteAlternateSmtpRelay();")."</td>
			</tr>
			
			</table>
		
		";
	}

	
	$html="
	<H1>{user_transport}</H1>
	<p class=caption>{user_transport_text}</p>
	$form
	
	
	";
	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html);
	
}
function AddTransportToDomain()
{
    $usr = new usersMenus();
    $tpl = new templates();
    if ($usr->AllowChangeDomains == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $domain = $_GET["AddTransportToDomain"];
    $ou = $_GET["ou"];
    $ldap = new clladp();
    $tpl = new templates();
    $tool = new DomainsTools();
    $line = $tool->transport_maps_implode($_GET["transport_ip"], '25', 'smtp');
    $ldap->AddDomainTransport($ou, $domain, $_GET["transport_ip"], '25', $_GET["transport_type"], 'smtp');
    if ($ldap->ldap_last_error != null) {
        echo $ldap->ldap_last_error;
        return;
    }
}
function PostFixAddServerCacheSave()
{
    $tool = new DomainsTools();
    $tpl = new templates();
    $relay_address = $_POST["relay_address"];
    $relay_port = $_POST["relay_port"];
    $MX_lookups = $_GET["MX_lookups"];
    $domain = $_POST["domain"];
    if ($domain != null && $relay_address != null) {
        echo $tpl->javascript_parse_text('{error_give_server_or_domain}');
        exit;
    }
    if ($relay_address != null) {
        $line = $tool->transport_maps_implode($relay_address, $relay_port, null, $MX_lookups);
        $line = str_replace('smtp:', '', $line);
    } else {
        $line = $domain;
    }
    $main = new maincf_multi($_POST["hostname"]);
    $smtp_connection_cache_destinations = unserialize(base64_decode($main->GET_BIGDATA("smtp_connection_cache_destinations")));
    $smtp_connection_cache_destinations[$line] = "OK";
    $smtp_connection_cache_destinations_new = base64_encode(serialize($smtp_connection_cache_destinations));
    if (!$main->SET_BIGDATA("smtp_connection_cache_destinations", addslashes($smtp_connection_cache_destinations_new))) {
        echo $main->{$q}->mysql_error;
        return;
    }
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?postfix-others-values=yes&hostname={$_POST["hostname"]}");
}
Example #20
0
function SaveISPAddress()
{
    $tpl = new templates();
    $domain = new DomainsTools();
    $page = CurrentPageName();
    $address = $domain->transport_maps_implode($_GET["isp_address"], $_GET["isp_port"]);
    $sasl = new smtp_sasl_password_maps();
    writepostfixlogs("Set ISP server has {$address}", __FUNCTION__, __FILE__);
    $sock = new sockets();
    $sock->SET_INFO("PostfixRelayHost", "{$address}");
    writepostfixlogs("is this server {$address} must use authentication ?", __FUNCTION__, __FILE__);
    if (trim($_GET["isp_username"]) == null) {
        $sasl->delete($address);
        exit;
    }
    if (trim($_GET["isp_password"]) == null) {
        die("password NULL !");
    }
    writepostfixlogs("Enable SMTP Sasl", __FUNCTION__, __FILE__);
    $main = new main_cf();
    $main->smtp_sasl_password_maps_enable();
    if (!$sasl->add($address, trim($_GET["isp_username"]), trim($_GET["isp_password"]))) {
        die($sasl->ldap_infos);
    }
}
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";
}
Example #22
0
function USER_TRANSPORT_SAVE()
{
    $domain = new DomainsTools();
    $line = $domain->transport_maps_implode($_GET["relay_address"], $_GET["relay_port"], null, $_GET["MX_lookups"]);
    $user = new user($_GET["uid"]);
    $user->add_transport("{$line}");
}
Example #23
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);
}
function relayhost()
{
    $sock = new sockets();
    $PostfixRelayHost = trim($sock->GET_INFO("PostfixRelayHost"));
    if ($PostfixRelayHost == null) {
        shell_exec("{$GLOBALS["postconf"]} -e \"relayhost =\" >/dev/null 2>&1");
        return null;
    }
    $tools = new DomainsTools();
    $hash = $tools->transport_maps_explode($PostfixRelayHost);
    if ($hash[2] == null) {
        $hash[2] = 25;
    }
    $PostfixRelayHost_pattern = "[{$hash[1]}]:{$hash[2]}";
    echo "Starting......: Relay host: {$PostfixRelayHost_pattern}\n";
    $ldap = new clladp();
    $sasl_password_string = $ldap->sasl_relayhost($hash[1]);
    if ($sasl_password_string != null) {
        $relayhost_hash = "{$PostfixRelayHost_pattern}\t{$sasl_password_string}\n";
        @file_put_contents("/etc/postfix/sasl_passwd", $relayhost_hash);
        shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/sasl_passwd >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd\" >/dev/null 2>&1");
    }
    shell_exec("{$GLOBALS["postconf"]} -e \"relayhost ={$PostfixRelayHost_pattern}\" >/dev/null 2>&1");
}
Example #25
0
function SaveAmavisConfig()
{
    $tpl = new templates();
    $domain = $_GET["domain"];
    $users = new usersMenus();
    if (!$users->AllowChangeAntiSpamSettings) {
        echo $tpl->_ENGINE_parse_body("alert('{ERROR_NO_PRIVS}')");
        exit;
    }
    writelogs("domain={$domain}", __FUNCTION__, __FILE__);
    $dom = new DomainsTools();
    $dom->LoadAmavisDomain($domain);
    while (list($num, $ligne) = each($_GET)) {
        $dom->{$num} = $ligne;
    }
    if ($dom->SaveAmavisConfig()) {
        echo $tpl->_ENGINE_parse_body('{success}');
    }
}
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);
}
Example #27
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";
    }
}