function DOMAINSLIST_SEARCH()
{
    $ldap = new clladp();
    $page = CurrentPageName();
    $tpl = new templates();
    $ou = $_GET["ou"];
    include_once "ressources/class.amavis.inc";
    $amavis = new amavis();
    $amavis_oui = false;
    $disclaimer = true;
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    if ($users->AMAVIS_INSTALLED) {
        if ($users->EnableAmavisDaemon == 1) {
            $amavis_oui = true;
        }
    }
    $POSTFIX_INSTALLED = $users->POSTFIX_INSTALLED;
    $sock = new sockets();
    $disclaimer = IS_DISCLAIMER();
    $HashDomains = $ldap->Hash_associated_domains($ou);
    if ($GLOBALS["VERBOSE"]) {
        echo count($HashDomains) . " domains for this ou = {$ou}\n";
    }
    $aliases = new AutoAliases($ou);
    $search = string_to_regex($_POST["query"]);
    $domainstyle = "font-size:16px";
    if (isset($_GET["expand"])) {
        $domainstyle = "font-size:18px";
    }
    $data = array();
    $c = 0;
    while (list($num, $ligne) = each($HashDomains)) {
        if ($search != null) {
            if (!preg_match("#{$search}#", $num)) {
                continue;
            }
        }
        $c++;
        $autoalias = " ";
        $disclaimer_domain = " ";
        $amavis_infos = " ";
        $amavis_duplicate = " ";
        $js = "Loadjs('domains.relay.domains.php?domain={$num}&ou={$ou}&local=yes')";
        $delete = imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteInternetDomainInside('{$num}')");
        if (strlen($aliases->DomainsArray[$num]) > 0) {
            $autoalias = "<img src='img/20-check.png'>";
        }
        if ($amavis_oui) {
            $amavis_infos = imgtootltip("24-parameters.png", "AS -> {$num}", "Loadjs('domains.amavis.php?domain={$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"]}";
        }
        if ($disclaimer) {
            $disclaimer_domain = imgtootltip("24-parameters.png", "disclaimer -> {$num}", "Loadjs('domains.disclaimer.php?domain={$num}&ou={$ou}')");
        }
        $autoalias = $tpl->_ENGINE_parse_body($autoalias);
        $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'>{$amavis_duplicate}</span>", $delete));
    }
    if ($c == 0) {
        json_error_show("No Internet domain...");
    }
    $data['page'] = 1;
    $data['total'] = $c;
    echo json_encode($data);
}
function localdomain_search()
{
    $users = new usersMenus();
    $page = CurrentPageName();
    $t = time();
    $tpl = new templates();
    $ldap = new clladp();
    $are_you_sure_to_delete = $tpl->javascript_parse_text("{are_you_sure_to_delete}");
    if ($users->AsPostfixAdministrator) {
        $hash = $ldap->hash_get_all_local_domains();
    } else {
        $hash = $ldap->Hash_associated_domains($_SESSION["ou"]);
    }
    $search = string_to_flexregex("localdomain-search");
    while (list($domain, $ligne) = each($hash)) {
        $id = md5($domain);
        $delete = imgsimple("delete-32.png", null, "DeleteLocalDomain{$t}('{$domain}','{$id}')");
        if ($search != null) {
            if (!preg_match("#{$search}#", $domain)) {
                continue;
            }
        }
        $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t\t<td style='font-size:18px'><i class='icon-globe'></i>&nbsp;{$domain}</td>\n\t\t\t<td style='text-align:center'>{$delete}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th style='width:99%'>{domains}</th>\n\t\t\t\t\t<th>&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</table>\n<script>\n\tvar xmem{$t}='';\n\tvar xDeleteLocalDomain{$t}= function (obj) {\t\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue); return;};\n\t\t\$('#'+xmem{$t}).remove();\n\t}\t\t\t\n\t\t\t\t\n\t\tfunction DeleteLocalDomain{$t}(domain,id){\n\t\t\txmem{$t}=id;\n\t\t\tif(confirm('{$are_you_sure_to_delete} '+domain)){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('localdomain-remove',domain);\n\t\t\t\tXHR.appendData('ou','{$_SESSION["ou"]}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',xDeleteLocalDomain{$t});\t\n\t\t\t}\n\t\t}\n\t\t\t\t\n</script>";
}
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);
}
Exemple #4
0
function DOMAINSLIST($ou)
{
    $ldap = new clladp();
    $page = CurrentPageName();
    $tpl = new templates();
    $are_you_sure_to_delete = $tpl->javascript_parse_text("{are_you_sure_to_delete}");
    include_once "ressources/class.amavis.inc";
    $amavis = new amavis();
    $amavis_oui = false;
    $disclaimer = true;
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    if ($users->AMAVIS_INSTALLED) {
        if ($users->EnableAmavisDaemon == 1) {
            $amavis_oui = true;
        }
    }
    $POSTFIX_INSTALLED = $users->POSTFIX_INSTALLED;
    $sock = new sockets();
    $disclaimer = IS_DISCLAIMER();
    $HashDomains = $ldap->Hash_associated_domains($ou);
    if ($GLOBALS["VERBOSE"]) {
        echo count($HashDomains) . " domains for this ou = {$ou}\n";
    }
    $html = "<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th colspan=3 style='font-size:14px'>{local_domain_map}</th>\n\t<tr>\n\t<th>" . imgtootltip("plus-24.png", "{add}", "AddLocalDomain_form()") . "</th>\n\t<th>{domain}</th>\n\t<th>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $aliases = new AutoAliases($ou);
    if (is_array($HashDomains)) {
        if ($amavis_oui) {
            $amavis_tr = "<th>{Anti-spam}</th>";
        }
        $amavis_duplicate_tr = "<th>{duplicate_domain}</th>";
        if ($disclaimer) {
            $disclaimer_tr = "<th>{disclaimer}</th>";
        }
        while (list($num, $ligne) = each($HashDomains)) {
            $amavis_infos = "&nbsp;";
            $amavis_duplicate = "&nbsp;";
            $disclaimer_domain = "&nbsp;";
            $autoalias = "&nbsp;";
            $js = "Loadjs('domains.relay.domains.php?domain={$num}&ou={$ou}&local=yes')";
            $jstr = CellRollOver();
            if (strlen($aliases->DomainsArray[$num]) > 0) {
                $autoalias = "{yes}";
            } else {
                $autoalias = "{no}";
            }
            if ($amavis_oui) {
                $amavis_infos = "<strong style='font-size:12px'>" . texttooltip("[{settings}]", "{Anti-spam}:{$num}", "Loadjs('domains.amavis.php?domain={$num}')", null, 0, "font-weight:bold;font-size:12px");
                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"]}";
                }
            }
            if ($disclaimer) {
                $disclaimer_domain = texttooltip("[{settings}]", "{disclaimer}:{$num}", "Loadjs('domains.disclaimer.php?domain={$num}&ou={$ou}')", null, 0, "font-weight:bold;font-size:12px");
            }
            $delete = imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteInternetDomainInside('{$num}')");
            if (!$POSTFIX_INSTALLED) {
                $js = null;
            }
            if ($classtr == "oddRow") {
                $classtr = null;
            } else {
                $classtr = "oddRow";
            }
            $html = $html . "\n\t\t\t\n\t\t\t\t\t<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 nowrap><strong style='font-size:16px'>" . texttooltip($num, "{parameters}", $js, null, 0, "font-size:18px") . "</strong></td>\n\t\t\t\t\t\t<td width=1% >" . imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteInternetDomainInside('{$num}')") . "</td>\n\t\t\t\t\t</tr>";
        }
    }
    $html = $html . "\n\t</table>\n\t<script>\n\t\tvar x_DeleteInternetDomainInside= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tif (document.getElementById('LocalDomainsList')){\n\t\t\t\tLoadAjax('LocalDomainsList','domains.edit.domains.php?LocalDomainList=yes&ou={$ou}');\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\n\n\tfunction DeleteInternetDomainInside(num){\n\t\t\tvar mytext='{$are_you_sure_to_delete}';\n\t\t\tif(confirm(mytext+' '+num)){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('DeleteInternetDomain',num);\n\t\t\t\tXHR.appendData('ou','{$ou}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_DeleteInternetDomainInside);\t\n\t\t\t}\n\t\t\t\n\t\t}\t\t\n\t</script>\t\n\t";
    return $tpl->_ENGINE_parse_body($html);
}
function DOMAINSLIST($ou)
{
    $ldap = new clladp();
    $tpl = new templates();
    include_once "ressources/class.amavis.inc";
    $amavis = new amavis();
    $amavis_oui = false;
    $disclaimer = true;
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    if ($users->AMAVIS_INSTALLED) {
        if ($users->EnableAmavisDaemon == 1) {
            $amavis_oui = true;
        }
    }
    $POSTFIX_INSTALLED = $users->POSTFIX_INSTALLED;
    $sock = new sockets();
    $disclaimer = IS_DISCLAIMER();
    $HashDomains = $ldap->Hash_associated_domains($ou);
    $aliases = new AutoAliases($ou);
    if (is_array($HashDomains)) {
        $ul[] = "<ul id='domains-checklist'>";
        while (list($num, $ligne) = each($HashDomains)) {
            $ul[] = "<li class='domainsli' style='width:350px'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td width=1% valign='top'>" . imgtootltip("domain-64.png", "{edit}", $js) . "</td>\n\t\t\t\t<td valign='top'>";
            $js = "EditInfosLocalDomain('{$num}','{$ou}');";
            $jstr = CellRollOver();
            if (strlen($aliases->DomainsArray[$num]) > 0) {
                $autoalias = "{yes}";
            } else {
                $autoalias = "{no}";
            }
            if ($amavis_oui) {
                $amavis_infos = "\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 ($amavis->copy_to_domain_array[strtolower($num)]["enable"] == 1) {
                    $amavis_duplicate = "\n\t\t\t\t<tr>\n\t\t\t\t<td class=legend width=1% nowrap>{duplicate_domain}:</td>\n\t\t\t\t<td><strong style='font-size:12px'>{$amavis->copy_to_domain_array[strtolower($num)]["duplicate_host"]}:{$amavis->copy_to_domain_array[strtolower($num)]["duplicate_port"]}</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>";
            }
            $delete = "<tr>\n\t\t\t\t<td colspan=2 align='right'>" . imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteInternetDomain('{$num}')") . "</td>\n\t\t\t</tr>";
            if (!$POSTFIX_INSTALLED) {
                $js = null;
            }
            $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></td>\n\t\t\t\t\t\t<td>" . imgtootltip("delete-24.png", '{label_delete_transport}', "DeleteInternetDomain('{$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>{aliases}:</td>\n\t\t\t\t<td><strong>{$autoalias}</strong></td>\n\t\t\t</tr>\n\t\t\t{$amavis_infos}\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>";
    $html = @implode("\n", $ul);
    return $tpl->_ENGINE_parse_body($html);
}