Exemplo n.º 1
0
function add_list()
{
    if ($_SESSION["uid"] == -100) {
        if (isset($_GET["ou"])) {
            $ou = base64_decode($_GET["ou"]);
        }
    } else {
        $user = new user($_SESSION["uid"]);
        $ou = $user->ou;
    }
    $users = new usersMenus();
    $ldap = new clladp();
    $domains = $ldap->Hash_domains_table($ou);
    $sock = new sockets();
    $ApacheGroupWarePort = $sock->GET_INFO("ApacheGroupWarePort");
    $pp = "<p style='font-size:14px;color:black'>{add_mailman_text}</p>";
    $mailman = new mailman_control($ou, $_GET["add-list"]);
    if (preg_match("#(.+?)@(.+)#", $_GET["add-list"], $re)) {
        $domain = $re[2];
        $listename = $re[1];
        $button_name = "{apply}";
        $pp = null;
        $filed_list = "<strong style='font-size:14px'>{$listename}</strong><input type='hidden' id='listname' value='{$listename}'>";
        $urlLink = "<strong style='font-size:14px'>\n\t\t<li><a href='http://{$mailman->webservername}:{$ApacheGroupWarePort}' target=_new>{view_list_mailman}</a></li>\n\t\t<li><a href='http://{$mailman->webservername}:{$ApacheGroupWarePort}/mailman/admin/{$listename}' target=_new>{adminweb_mailman}</a></li>";
        if ($users->POWER_DNS_INSTALLED) {
            $add_pnds = "<hr>" . button("{add_mailman_pdns}", "MailManPDNS('{$_GET["add-list"]}')");
        }
    } else {
        $button_name = "{add}";
        $filed_list = Field_text('listname', null, "width:180px;font-size:14px;padding:3px");
    }
    while (list($num, $val) = each($domains)) {
        $domainsZ[$num] = $num;
    }
    $dom2 = Field_array_Hash($domainsZ, 'wwwdomain', $domain, null, null, 0, "font-size:14px;padding:3px");
    if ($domain == null) {
        $dom = Field_array_Hash($domainsZ, 'domain', $domain, null, null, 0, "font-size:14px;padding:3px");
    } else {
        $dom = "<input type='hidden' id='domain' value='{$domain}'><strong style='font-size:14px'>{$domain}</span>";
    }
    if ($mailman->admin_email == null) {
        $mailman->admin_email = $user->mail;
    }
    if ($mailman->admin_password == null) {
        $mailman->admin_password = $user->password;
    }
    if (preg_match("#^(.+?)\\.#", $mailman->webservername, $re)) {
        $mailman->webservername = $re[1];
    }
    $html = "\n\t{$pp}\n\t<div id='mailmandiv'></div>\n\t<table>\n\t<tr>\n\t\t<td class=legend nowrap width=1%>{listname}:</td>\n\t\t<td width=1% align='right'>{$filed_list}</td>\n\t\t<td width=1% style='font-size:14px'><strong>@</strong></td>\n\t\t<td width=99%>{$dom}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap width=1%>{www_server_name}:</td>\n\t\t<td align='left' width=1%>" . Field_text('webservername', $mailman->webservername, "width:180px;font-size:14px;padding:3px") . "</td>\n\t\t<td width=1% style='font-size:14px'><strong>.</strong></td>\n\t\t<td>{$dom2}</td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend nowrap width=1%>{admin_mail}:</td>\n\t\t<td align='left' width=1% colspan=3>" . Field_text('admin_email', $mailman->admin_email, "width:180px;font-size:14px;padding:3px") . "</td>\n\t\t\n\t\t\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend nowrap>{password}:</td>\n\t\t<td width=1% colspan=3>" . Field_password('admin_password', $mailman->admin_password, "width:180px;font-size:14px;padding:3px") . "</td>\n\t\t\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=4 align='right'><hr>\n\t\t" . button("{$button_name}&nbsp;&raquo;", "SaveMailManList()") . "\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=4 align='right'>{$urlLink}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=4 align='right'>{$add_pnds}</td>\n\t</tr>\t\n\t\n\t\n\t</table>\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html, "mailman.lists.php");
}
Exemplo n.º 2
0
function sql_domain($ou)
{
    $ldap = new clladp();
    $domains = $ldap->Hash_domains_table($ou);
    if (!is_array($domains)) {
        return null;
    }
    while (list($domain, $nothing) = each($domains)) {
        $array_domain[] = "OR delivery_domain='{$domain}'";
        $GLOBALS["mydomains"][] = $domain;
    }
    $sql_domain = implode(" ", $array_domain);
    if (substr($sql_domain, 0, 2) == "OR") {
        $sql_domain = substr($sql_domain, 2, strlen($sql_domain));
    }
    $sql_domain = "(" . trim($sql_domain) . ")";
    $GLOBALS["SQL_DOMAINS"] = $sql_domain;
}
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $ldap = new clladp();
    $main = new maincf_multi($_GET["hostname"]);
    $myorigin = $main->GET("myorigin");
    $domains = $ldap->Hash_domains_table($_GET["ou"]);
    while (list($key, $line) = each($tr)) {
        $domainz[$key] = $key;
    }
    if ($myorigin == null) {
        $myorigin = '$mydomain';
    }
    if ($myorigin != '$mydomain') {
        $domainz[$myorigin] = $myorigin;
    }
    $domainz['$myhostname'] = '$myhostname';
    $domainz['$mydomain'] = '$mydomain';
    $html = "\n<div id='{$t}'>\n<div class=explain style='font-size:13px'>{myorigin_text}</div>\n<table style='width:99%' class=form>\n<tr>\n\t<td class=legend style='font-size:16px'>myorigin:</td>\n\t<td>" . Field_array_Hash($domainz, "domainz-{$t}", $myorigin, "style:font-size:16px") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:16px'>{or}:</td>\n\t<td>" . Field_text("free-{$t}", null, "font-size:16px;width:210px") . "</td>\n</tr>\n<tr>\n\t<td colspan=2 align='right'><hr>" . button("{apply}", "SaveMyOrginin{$t}()", 16) . "</td>\n</tr>\n</table>\n</div>\n<script>\n\tvar xSaveMyOrginin{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert('\"'+results+'\"'+results.length);}\n\t\tYahooWinSHide();\n\t\tRefreshTab('main_multi_config_postfix{$_GET["t"]}')\n\t\t}\n\t\t\n\t\n\t\tfunction SaveMyOrginin{$t}(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('myorigin',document.getElementById('domainz-{$t}').value);\n\t\t\tXHR.appendData('myorigin2',document.getElementById('free-{$t}').value);\n\t\t\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\t\t\tXHR.appendData('ou','{$_GET["ou"]}');\n\t\t\tAnimateDiv('{$t}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSaveMyOrginin{$t});\t\n\t\t\t\n\t\t}\n\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 4
0
function section_messaging()
{
    $ou = $_SESSION["ou"];
    $ldap = new clladp();
    $tpl = new templates();
    $domains = $ldap->Hash_domains_table($ou);
    while (list($num, $ligne) = each($domains)) {
        $doms[] = "(LENGTH(delivery_user)>0 AND delivery_domain='{$num}')";
    }
    $sql = "SELECT * FROM smtp_logs WHERE 1 AND " . implode(" OR ", $doms) . " ORDER BY time_stamp DESC LIMIT 0,200";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        echo "<H2> Failed: {$sql}</H2><H2>{$q->mysql_error}</H2>";
        return;
    }
    $count = 0;
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $count = $count + 1;
        $tr = $tr . format_line($ligne);
    }
    $html = "\n\t<table style='width:100%'>\n\t{$tr}\n\t</table>";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 5
0
function __sql_domain($ou)
{
    $ldap = new clladp();
    $domains = $ldap->Hash_domains_table($ou);
    if (!is_array($domains)) {
        return null;
    }
    while (list($domain, $nothing) = each($domains)) {
        $array_domain[] = "OR delivery_domain='{$domain}'";
        $array_domain_sender[] = "OR sender_domain='{$domain}'";
    }
    $sql_domain = implode(" ", $array_domain);
    $sql_domain_sent = implode(" ", $array_domain_sender);
    if (substr($sql_domain, 0, 2) == "OR") {
        $sql_domain = substr($sql_domain, 2, strlen($sql_domain));
    }
    if (substr($sql_domain_sent, 0, 2) == "OR") {
        $sql_domain_sent = substr($sql_domain_sent, 2, strlen($sql_domain_sent));
    }
    $sql_domain = "(" . trim($sql_domain) . ")";
    $sql_domain_sent = "(" . trim($sql_domain_sent) . ")";
    $sql = "SELECT * FROM smtp_logs WHERE 1 AND {$sql_domain} OR {$sql_domain_sent} ORDER BY time_stamp DESC LIMIT 0,100";
    return $sql;
}
Exemplo n.º 6
0
function webservice()
{
    $sql = "SELECT * FROM freeweb WHERE servername='{$_GET["servername"]}'";
    $page = CurrentPageName();
    $users = new usersMenus();
    $tpl = new templates();
    $q = new mysql();
    $sock = new sockets();
    $APACHE_PROXY_MODE = 0;
    $DNS_INSTALLED = false;
    $remove_sql = false;
    $OnlyWebSite = false;
    $countloops = countloops();
    $no_usersameftpuser = $tpl->javascript_parse_text("{no_usersameftpuser}");
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
    if (!is_numeric($_GET["t"])) {
        $_GET["t"] = 0;
    }
    $error_field_max_length = $tpl->javascript_parse_text("{error_field_max_length}");
    $error_please_fill_field = $tpl->javascript_parse_text("{error_please_fill_field}");
    $acl_dstdomain = $tpl->javascript_parse_text("{acl_dstdomain}");
    $mysql_database = $tpl->javascript_parse_text("{mysql_database}");
    $username = $tpl->javascript_parse_text("{username}");
    $password = $tpl->javascript_parse_text("{password}");
    $vgservices = unserialize(base64_decode($sock->GET_INFO("vgservices")));
    $checkboxes = 1;
    $ButtonName = "{apply}";
    if ($ligne["groupware"] == "cachemgr") {
        $checkboxes = 0;
    }
    $users = new usersMenus();
    $PUREFTP_INSTALLED = 1;
    if (!$users->PUREFTP_INSTALLED) {
        $PUREFTP_INSTALLED = 0;
    }
    $ServerIPVAL = trim($ligne["ServerIP"]);
    $ServerPort = trim($ligne["ServerPort"]);
    $sslcertificate = $ligne["sslcertificate"];
    $UseDefaultPort = 0;
    if ($users->APACHE_PROXY_MODE) {
        $APACHE_PROXY_MODE = 1;
    }
    $parcourir_domaines = button("{browse}...", "Loadjs('browse.domains.php?field=domainname')", 12);
    if ($users->dnsmasq_installed) {
        $DNS_INSTALLED = true;
    }
    if ($users->POWER_DNS_INSTALLED) {
        $DNS_INSTALLED = true;
    }
    $FreeWebDisableSSL = trim($sock->GET_INFO("FreeWebDisableSSL"));
    if (!is_numeric($FreeWebDisableSSL)) {
        $FreeWebDisableSSL = 0;
    }
    $check_configuration = $tpl->_ENGINE_parse_body("{check_configuration}");
    $webservice = $tpl->_ENGINE_parse_body("{webservice}");
    $ServerIPVAL = "{$ServerIPVAL}:{$ServerPort}";
    $freeweb = new freeweb($_GET["servername"]);
    $acl_dstdomain_label = $tpl->_ENGINE_parse_body("{acl_dstdomain}");
    //HTTTRACK ---------------------------------------------------------
    $WebCopyCount = $q->COUNT_ROWS("httrack_sites", "artica_backup");
    if ($WebCopyCount > 0) {
        $sql = "SELECT ID,sitename FROM httrack_sites";
        $results_webcopy = $q->QUERY_SQL($sql, "artica_backup");
        $WebCopyHash[0] = "{none}";
        while ($ligneWebCopy = mysql_fetch_assoc($results_webcopy)) {
            $WebCopyHash[$ligneWebCopy["ID"]] = $ligneWebCopy["sitename"];
        }
        $WebCopyTR = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>WebCopy:</td>\n\t\t\t\t<td>" . Field_array_Hash($WebCopyHash, "WebCopyID", $freeweb->WebCopyID, "style:font-size:18px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_WebCopy_explain") . "</td>\n\t\t\t</tr>";
    }
    if ($ligne["groupware"] == "SUGAR") {
        $additional_infos = sugard_additional_infos();
    }
    if ($vgservices["freewebs"] != null) {
        if (!is_numeric($ligne["lvm_size"])) {
            $ligne["lvm_size"] = 5000;
        }
        if ($ligne["lvm_vg"] == null) {
            $ligne["lvm_vg"] = $vgservices["freewebs"];
        }
        $sizelimit = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{size}:</td>\n\t\t<td style='font-size:14px;'>" . Field_text("vg_size", $ligne["lvm_size"], "font-size:18px;padding:3px;width:60px") . "&nbsp;MB</td>\n\t\t<td>&nbsp;</td>\n\t\t</tr>";
    }
    $groupwarelink = $freeweb->groupwares_InstallLink();
    $groupwares_textintro = $freeweb->groupwares_textintro();
    if ($groupwarelink != null) {
        $explain = "\n\t\t<div class=explain>{$groupwares_textintro}:<br><strong style='font-size:14px'>\n\t\t\t<a href=\"javascript:blur()\" OnClick=\"javascript:s_PopUpFull('{$groupwarelink}',1024,768)\" style='text-decoration:underline;font-weight:bold;color:#969696'>{$groupwarelink}</a></strong></div>\t\t\n\t\t";
    }
    $img = "website-64.png";
    if ($_GET["force-groupware"] != null) {
        $vhosts = new vhosts();
        $img = $vhosts->IMG_ARRAY_64[$_GET["force-groupware"]];
        $imgtitle = "<div style='font-size:18px;font-weight:bold'>{" . $vhosts->TEXT_ARRAY[$_GET["force-groupware"]]["TITLE"] . "}</div>";
        if ($_GET["force-groupware"] == "ZARAFA") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "Z-PUSH") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "ZARAFA_MOBILE") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "ROUNDCUBE") {
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "KLMS") {
            $OnlyWebSite = true;
            $remove_sql = true;
        }
    }
    $servernameenc = urlencode($_GET["servername"]);
    $configure = "&nbsp;|&nbsp;" . button("{reconfigure}", "SaveFreeWebMain();Loadjs('freeweb.rebuild.progress.php?servername={$servernameenc}')", 26);
    if ($_GET["servername"] == null) {
        $ButtonName = "{add}";
        $configure = null;
    }
    if ($ligne["domainname"] == null) {
        $dda = explode(".", $ligne["servername"]);
        $hostname = $dda[0];
        unset($dda[0]);
        $domainname = @implode(".", $dda);
    } else {
        $ff = explode(".", $ligne["servername"]);
        if (count($ff) > 2) {
            $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]);
        } else {
            $hostname = null;
        }
        $domainname = $ligne["domainname"];
        $parcourir_domaines = null;
    }
    if ($hostname == "_default_") {
        $parcourir_domaines = null;
    }
    if ($DNS_INSTALLED) {
        include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
        include_once dirname(__FILE__) . "/ressources/class.pdns.inc";
        $pdns = new pdns();
        if ($ligne["servername"] == null) {
            $ip = new networking();
            $ips = $ip->ALL_IPS_GET_ARRAY();
            $ips[null] = "{none}";
            $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:18px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>";
        } else {
            $hostip = $pdns->GetIp($ligne["servername"]);
            if ($hostip != null) {
                $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{dns_entry}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>{$hostip}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>";
            } else {
                $ip = new networking();
                $ips = $ip->ALL_IPS_GET_ARRAY();
                $ips[null] = "{none}";
                $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:18px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>";
            }
        }
    }
    $domain = "<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:18px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:18px' align='center' width=1%>&nbsp;.&nbsp;</td>\n\t\t\t<td>" . Field_text("domainname", $domainname, "font-size:18px;padding:3px;width:220px;font-weight:bold") . "</td>\n\t\t\t<td>{$parcourir_domaines}</td>\n\t\t</tr>\n\t\t</table>";
    if (!$users->AsSystemAdministrator) {
        if ($ligne["domainname"] == null) {
            $dd = explode(".", $ligne["servername"]);
            $hostname = $dd[0];
            unset($dd[0]);
            $domainname = @implode(".", $dd);
        } else {
            $ff = explode(".", $ligne["servername"]);
            if (count($ff) > 2) {
                $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]);
            } else {
                $hostname = null;
            }
            $domainname = $ligne["domainname"];
        }
        $ldap = new clladp();
        $domains = $ldap->Hash_domains_table($_SESSION["ou"]);
        while (list($a, $b) = each($domains)) {
            $c[$a] = $a;
        }
        $domain = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:18px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:18px' align='center' width=1%>&nbsp;.&nbsp;</td>\n\t\t\t<td>" . Field_array_Hash($c, "domainname", $domainname, "style:font-size:18px;padding:3px;font-weight:bold;width:220px;") . "</td>\n\t\t</tr>\n\t\t</table>";
    }
    $NewServer = 0;
    if (trim($ligne["servername"] == null)) {
        $NewServer = 1;
    }
    if ($NewServer == 0) {
        $domain = "<div style='font-size:22px'>{$ligne["servername"]}</div>\n\t\t\t<input type='hidden' value='{$ligne["servername"]}' id='servername'>\n\t\t\t<input type='hidden' value='{$ligne["domainname"]}' id='domainname'>";
    }
    if ($ligne["groupware"] != null) {
        $apache = new vhosts();
        $img = $apache->IMG_ARRAY_64[$ligne["groupware"]];
        if ($ligne["groupware"] == "ROUNDCUBE") {
            $OnlyWebSite = true;
        }
        if ($ligne["ForceInstanceZarafaID"] > 0) {
            $_GET["ForceInstanceZarafaID"] = $ligne["ForceInstanceZarafaID"];
        }
    }
    if ($OnlyWebSite) {
        $js_OnlyWebSite = "OnlyWebsite()";
    }
    $uid_uri = urlencode(base64_encode($ligne["uid"]));
    $nets = unserialize(base64_decode($sock->GET_INFO("FreeWebsApacheListenTable")));
    $znets[null] = "{default}";
    while (list($num, $ip) = each($nets)) {
        $znets[$num] = $num;
    }
    $ServerIP = Field_array_Hash($znets, 'ServerIP', $ServerIPVAL, null, null, 0, 'font-size:18px;');
    $q = new mysql();
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $sslcertificateF = Field_array_Hash($sslcertificates, "sslcertificate", $sslcertificate, "style:font-size:18px");
    $t = time();
    $html = "\n\t<div id='freewebdiv-{$t}'></div>\n\t<input type='hidden' id='force-groupware' name ='force-groupware' value='{$_GET["force-groupware"]}'>\n\t<table style='width:100%' class=TableRemove>\n\t<tr>\n\t\t<td valign='top' width=1%>\n\t\t\t<center>\n\t\t\t\t<img src='img/{$img}'>{$imgtitle}\n\t\t\t</center><br>\n\t\t\t<div style='width:190px'>\n\t\t\t\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign='top' width=99%>\n\t{$explain}\n\t<div id='freewebdiv'>\n\t\t<div id='block1' style='display:block;'>\n\t\t\t<div style='width:98%' class=form>\n\t\t\t<table>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{$acl_dstdomain_label}:</td>\n\t\t\t\t<td colspan=2>{$domain}</td>\n\t\t\t</tr>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{listen_address}:</td>\n\t\t\t\t<td colspan=2>{$ServerIP}</td>\n\t\t\t</tr>\t\t\t\t\t\n\t\t\t{$dns_field}\n\t\t\t{$WebCopyTR}\t\n\t\t\t\n\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{directory}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("www_dir", $ligne["www_dir"], "font-size:18px;padding:3px;") . "</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . button_browse("www_dir") . "</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{reverse_proxy}:</td>\n\t\t\t\t<td width=1% style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("UseReverseProxy", 1, $ligne["UseReverseProxy"], "CheckUseReverseProxy()") . "</td>\n\t\t\t</tr>\t\t\n\t\t\t\n\t\t\t{$sizelimit}\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{UseLoopDisk}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("UseLoopDisk", 1, $ligne["UseLoopDisk"], "CheckLoops()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr style='height:auto'>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>&nbsp;</td>\n\t\t\t\t<td colspan=2 style='height:auto'><span id='loops-list'></span></td></tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{member}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("www_uid", $ligne["uid"], "font-size:18px;padding:3px;") . "</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'><span id='bb_button'>" . button("{browse}...", "Loadjs('user.browse.php?field=www_uid&YahooWin=6')", 12) . "</span>\n\t\t\t\t<span id='status-uid-www' style='float:right'></span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{group}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("www_group", $ligne["gpid"], "font-size:18px;padding:3px;") . "</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'><span id='bb_button1'>" . button("{browse}...", "Loadjs('MembersBrowse.php?field-user=www_group&OnlyGroups=1&OnlyGUID=1')", 12) . "</span>\n\t\t\t\t\t<span id='status-gpid-www' style='float:right'></span>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{ssl}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("useSSL", 1, $ligne["useSSL"], "useSSLCheckCOnf()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{certificate}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>{$sslcertificateF}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\n\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{www_forward}:</td>\n\t\t\t\t<td width=1% style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("Forwarder", 1, $ligne["Forwarder"], "CheckForwarder()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{www_ForwardTo}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("ForwardTo", $ligne["ForwardTo"], "width:270px;font-size:18px;padding:3px") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t</div>\t\n\t</div>\t\n\t</div>\n\t\n\t<div style='width:100%;text-align:right;font-size:26px'><hr>" . button("{$ButtonName}", "SaveFreeWebMain()", 30) . "{$configure}</div>\n\n\n\n\t\n\t\n\t</td>\n\t</tr>\n\t</table>\n\t\n\t{$additional_infos}\n<script>\n\n\tfunction CheckDatas(){\n\t\tvar APACHE_PROXY_MODE={$APACHE_PROXY_MODE};\n\t\tvar FreeWebDisableSSL={$FreeWebDisableSSL};\n\t\t \n\t\t\n\t\tif(APACHE_PROXY_MODE==0){\n\t\t\tdocument.getElementById('UseReverseProxy').checked=false;\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t}\n\t\t\n\t\tvar x=document.getElementById('servername').value;\n\t\tvar z=document.getElementById('domainname').value;\n\t\tvar w=x.length+z.length;\n\t\tif(w>0){\n\t\t\tdocument.getElementById('servername').disabled=true;\n\t\t\tdocument.getElementById('domainname').disabled=true;\n\t\t\t}\n\t\t\n\t\tif(FreeWebDisableSSL==1){\n\t\t\tdocument.getElementById('useSSL').disabled=true;\n\t\t}\n\t\t\n\t}\n\t\n\n\t\n\n\t\n\tfunction CheckForwarder(){\n\t\tif(document.getElementById('Forwarder').checked){\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\t\tdocument.getElementById('ForwardTo').disabled=false;\n\t\t\t\n\t\t\t\n\t\t}else{\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=false;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t\tdocument.getElementById('ForwardTo').disabled=true;\n\t\t\tCheckLoops();\n\t\t}\n\t\n\t}\n\t\t\n\tfunction FreeWebsRebuildvHosts(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildvHosts','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('freeweb.edit.php', 'POST',x_SaveFreeWebMain{$t});\n\t}\n\t\n\tfunction FreeWebsRebuildGroupware(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildGroupware','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('freeweb.edit.php', 'POST',x_SaveFreeWebMain{$t});\n\t}\t\t\t\n\n\n\tvar x_SaveFreeWebMain{$t}=function (obj) {\n\t\t    var NewServer={$NewServer};\n\t\t\tvar results=obj.responseText;\n\t\t\tdocument.getElementById('freewebdiv-{$t}').innerHTML='';\n\t\t\tif(results.length>0){alert(results);return;}\n\t\t\tvar t={$_GET["t"]};\t\n\t\t\tif(t>0){\n\t\t\t\t\$('#freewebs-table-{$_GET["t"]}').flexReload();\n\t\t\t}else{\n\t\t\t\tif(document.getElementById('container-www-tabs')){RefreshTab('container-www-tabs');}\n\t\t\t\tif(document.getElementById('main_config_freeweb')){FreeWebsRefreshWebServersList();}\n\t\t\t}\n\t\t\tif(NewServer==1){\n\t\t\t\tYahooWin5Hide();\n\t\t\t\tExecuteByClassName('SearchFunction');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(document.getElementById('main_config_freewebMains')){RefreshTab('main_config_freewebMains');}\n\t\t\tExecuteByClassName('SearchFunction');\n\t\t}\t\n\t\t\n\t\tfunction SaveFreeWebMain(){\n\t\t\tvar NewServer={$NewServer};\n\t\t\t\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('SAVE_FREEWEB_MAIN','yes');\n\t\t\t\n\t\t\tif(NewServer==1){\n\t\t\t\tvar sitename=document.getElementById('servername').value;\n\t\t\t\tvar www_a=document.getElementById('domainname').value;\n\t\t\t\tvar www_b=document.getElementById('servername').value;\n\t\t\t\tvar www_t=www_a.length+www_b.length;\n\t\t\t\tif(www_t<2){\n\t\t\t\t\talert('{$error_please_fill_field}:{$acl_dstdomain}'); \n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar x=document.getElementById('domainname').value;\n\t\t\t\t\tif(x.length==0){alert('{$error_please_fill_field}:{$acl_dstdomain}');return;}\n\t\t\t\t}else{\n\t\t\t\t\tdocument.getElementById('domainname').value='';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(document.getElementById('ADD_DNS_ENTRY')){\n\t\t\t\tXHR.appendData('ADD_DNS_ENTRY',document.getElementById('ADD_DNS_ENTRY').value);\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('useSSL').checked){XHR.appendData('useSSL',1);}else{XHR.appendData('useSSL',0);}\n\t\t\t\n\t\t\tif(document.getElementById('WebCopyID')){\n\t\t\t\tXHR.appendData('WebCopyID',document.getElementById('WebCopyID').value);\n\t\t\t}\n\t\t\tif(document.getElementById('www_dir')){\n\t\t\t\tXHR.appendData('www_dir',document.getElementById('www_dir').value);\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('UseDefaultPort',0)\n\t\t\tif(document.getElementById('UseReverseProxy').checked){XHR.appendData('UseReverseProxy',1);}else{XHR.appendData('UseReverseProxy',0);}\n\t\t\tif(document.getElementById('Forwarder').checked){XHR.appendData('Forwarder',1);}else{XHR.appendData('Forwarder',0);}\n\t\t\tXHR.appendData('ForceInstanceZarafaID','{$_GET["ForceInstanceZarafaID"]}');\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('LoopMounts')){\n\t\t\t\tvar LoopMounts=document.getElementById('LoopMounts').value;\n\t\t\t\tif(LoopMounts.length>3){\n\t\t\t\t\tif(document.getElementById('UseLoopDisk').checked){XHR.appendData('UseLoopDisk',1);}else{XHR.appendData('UseLoopDisk',0);}\n\t\t\t\t\tXHR.appendData('LoopMounts',LoopMounts);\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tvar uid=trim(document.getElementById('www_uid').value);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('vg_size')){XHR.appendData('vg_size',document.getElementById('vg_size').value);}\n\t\t\tXHR.appendData('lvm_vg','{$ligne["lvm_vg"]}');\n\t\t\tif(NewServer==1){\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar www_b=document.getElementById('domainname').value;\n\t\t\t\t\tvar www_a=document.getElementById('servername').value;\n\t\t\t\t\tif(www_a.length>0){XHR.appendData('servername',www_a+'.'+www_b);}else{XHR.appendData('servername',www_b);}\n    \t\t\t\t}else{\n    \t\t\t\tXHR.appendData('servername','_default_');\n    \t\t\t}\n    \t\t}\n    \t\tif(NewServer==0){XHR.appendData('servername',document.getElementById('servername').value);}\n    \t\tXHR.appendData('domainname',document.getElementById('domainname').value);\n    \t\tXHR.appendData('uid',uid);\n    \t\tXHR.appendData('gpid',document.getElementById('www_group').value);\n    \t\tXHR.appendData('ForwardTo',document.getElementById('ForwardTo').value);\n    \t\tXHR.appendData('force-groupware',document.getElementById('force-groupware').value);\n    \t\tXHR.appendData('ServerIP',document.getElementById('ServerIP').value);\n    \t\tXHR.appendData('sslcertificate',document.getElementById('sslcertificate').value);\n    \t\t\n    \t\t\n    \t\t\n    \t\tAnimateDiv('freewebdiv-{$t}');\n    \t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain{$t});\n\t\t\t\n\t\t}\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\t\n\n\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){document.getElementById('UseLoopDisk').disabled=false;}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\tfunction CheckUseReverseProxy(){\n\t\tCheckDatas();\n\t\tuseMysqlCheck();\n\t\tCheckLoops();\n\t\t{$js_removesql};\n\t\t{$js_OnlyWebSite};\n\t}\n\t\n\n\t\n\tfunction OnlyWebsite(){\n\t\tif(document.getElementById('Forwarder')){document.getElementById('Forwarder').disabled=true;}\n\t\tif(document.getElementById('UseReverseProxy')){document.getElementById('UseReverseProxy').disabled=true;}\n\t\tif(document.getElementById('useFTP')){document.getElementById('useFTP').disabled=true;}\n\t}\n\t\n\tfunction CheckUId(){\n\t\tLoadAjaxTiny('status-uid-www','freeweb.edit.php?uid-check={$uid_uri}');\n\t}\n\t\n\n\t\n\tfunction useSSLCheckCOnf(){\n\t\tdocument.getElementById('sslcertificate').disabled=true;\n\t\t\tif(document.getElementById('useSSL').checked){\n\t\t\t\tdocument.getElementById('sslcertificate').disabled=false;\n\t\t\t}\n\t}\n\t\n\tCheckDatas();\n\tCheckLoops();\n\tCheckForwarder();\n\tCheckUId();\n\t{$js_removesql};\n\t{$js_OnlyWebSite};\n\tuseSSLCheckCOnf();\n\t\n\t</script>\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 7
0
function import_users($id)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = trim(@file_get_contents($pidfile));
    if ($unix->process_exists($pid)) {
        echo "[" . getmypid() . "]:: Process {$pid} already running...\n";
        die;
    }
    $pid = getmypid();
    @file_put_contents($pidfile, $pid);
    $emailing = new emailings($id);
    if ($emailing->error) {
        echo __FUNCTION__ . " class error: {$emailing->mysql_error}\n";
        exit;
    }
    $sql = "SELECT * FROM {$emailing->tablename}";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo __FUNCTION__ . " {$q->mysql_error}\n";
        exit;
    }
    $max = mysql_num_rows($results);
    $ldap = new clladp();
    $domains = $ldap->Hash_domains_table($ou);
    while (list($domain, $no) = each($domains)) {
        $DOMAINS_ARRAY[$domain] = true;
    }
    if ($emailing->array_options["export_domain"] == null) {
        update_export_status($id, 110, "No default domain set");
        return;
    }
    if ($emailing->array_options["gpid"] == null) {
        update_export_status($id, 110, "No default group set");
        return;
    }
    $gpid = $emailing->array_options["gpid"];
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $count = $count + 1;
        $tw = $tw + 1;
        $firstname = $ligne["firstname"];
        $lastname = $ligne["lastname"];
        $email = $ligne["email"];
        $phone = $ligne["phone"];
        $city = $ligne["city"];
        $cp = $ligne["cp"];
        $postaladdress = $ligne["postaladdress"];
        if (!preg_match("#(.+?)@#", $email, $re)) {
            continue;
        }
        $uid = $re[1];
        $new_email = "{$uid}@{$emailing->array_options["export_domain"]}";
        $ct = new user($uid);
        if (!$ct->DoesNotExists) {
            $GLOBALS["SUCCESS_CONTACTS"] = $GLOBALS["SUCCESS_CONTACTS"] + 1;
            echo "{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} already exists [SUCCESS]\n";
        }
        $ct->mail = $new_email;
        $ct->postalCode = $cp;
        $ct->postalAddress = $postaladdress;
        $ct->town = $city;
        $ct->telephoneNumber = $phone;
        $ct->DisplayName = "{$firstname} {$lastname}";
        $ct->sn = $lastname;
        $ct->givenName = $firstname;
        $ct->group_id = $gpid;
        $ct->ou = $emailing->ou;
        $ct->password = $emailing->array_options["export_default_password"];
        if ($tw > 2) {
            $purc = $count / $max;
            $purc = $purc * 100;
            $purc = round($purc, 0);
            update_export_status($id, $purc);
            $tw = 0;
        }
        if (!$ct->add_user()) {
            writeevent("{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} [FAILED]");
            $GLOBALS["FAILED_CONTACTS"] = $GLOBALS["FAILED_CONTACTS"] + 1;
            continue;
        }
        $GLOBALS["SUCCESS_CONTACTS"] = $GLOBALS["SUCCESS_CONTACTS"] + 1;
        writeevent("{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} [SUCCESS]");
        if ($new_email != $email) {
            $user = new user($uid);
            $user->add_alias($email);
        }
    }
    writeevent("Failed.:{$GLOBALS["FAILED_CONTACTS"]}", $id);
    writeevent("Success:{$GLOBALS["SUCCESS_CONTACTS"]}", $id);
    update_status($id, 100, 1, null);
}
Exemplo n.º 8
0
function popup()
{
    $t = time();
    $html = "<div id='{$t}'></div>\n\t<script>\n\t\tLoadAjax('{$t}','freeweb.edit.main.php?servername={$_GET["servername"]}&force-groupware={$_GET["force-groupware"]}&t={$_GET["t"]}');\n\t</script>\n\t\n\t\n\t";
    echo $html;
    return;
    $sql = "SELECT * FROM freeweb WHERE servername='{$_GET["servername"]}'";
    $page = CurrentPageName();
    $users = new usersMenus();
    $tpl = new templates();
    $q = new mysql();
    $sock = new sockets();
    $APACHE_PROXY_MODE = 0;
    $DNS_INSTALLED = false;
    $remove_sql = false;
    $OnlyWebSite = false;
    $countloops = countloops();
    $no_usersameftpuser = $tpl->javascript_parse_text("{no_usersameftpuser}");
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
    $error_field_max_length = $tpl->javascript_parse_text("{error_field_max_length}");
    $error_please_fill_field = $tpl->javascript_parse_text("{error_please_fill_field}");
    $acl_dstdomain = $tpl->javascript_parse_text("{acl_dstdomain}");
    $mysql_database = $tpl->javascript_parse_text("{mysql_database}");
    $username = $tpl->javascript_parse_text("{username}");
    $password = $tpl->javascript_parse_text("{password}");
    $vgservices = unserialize(base64_decode($sock->GET_INFO("vgservices")));
    $checkboxes = 1;
    $ButtonName = "{apply}";
    if ($ligne["groupware"] == "cachemgr") {
        $checkboxes = 0;
    }
    $users = new usersMenus();
    $PUREFTP_INSTALLED = 1;
    if (!$users->PUREFTP_INSTALLED) {
        $PUREFTP_INSTALLED = 0;
    }
    $ServerIPVAL = trim($ligne["ServerIP"]);
    $ServerPort = trim($ligne["ServerPort"]);
    $UseDefaultPort = 0;
    if ($users->APACHE_PROXY_MODE) {
        $APACHE_PROXY_MODE = 1;
    }
    $parcourir_domaines = "<input type='button' OnClick=\"javascript:Loadjs('browse.domains.php?field=domainname')\" value='{browse}...'>";
    if ($users->dnsmasq_installed) {
        $DNS_INSTALLED = true;
    }
    if ($users->POWER_DNS_INSTALLED) {
        $DNS_INSTALLED = true;
    }
    $FreeWebDisableSSL = trim($sock->GET_INFO("FreeWebDisableSSL"));
    if (!is_numeric($FreeWebDisableSSL)) {
        $FreeWebDisableSSL = 0;
    }
    $check_configuration = $tpl->_ENGINE_parse_body("{check_configuration}");
    $webservice = $tpl->_ENGINE_parse_body("{webservice}");
    $ServerIPVAL = "{$ServerIPVAL}:{$ServerPort}";
    if ($vgservices["freewebs"] != null) {
        if (!is_numeric($ligne["lvm_size"])) {
            $ligne["lvm_size"] = 5000;
        }
        if ($ligne["lvm_vg"] == null) {
            $ligne["lvm_vg"] = $vgservices["freewebs"];
        }
        $sizelimit = "\n\t\t<tr>\n\t\t<td class=legend>{size}:</td>\n\t\t<td style='font-size:13px;'>" . Field_text("vg_size", $ligne["lvm_size"], "font-size:13px;padding:3px;width:60px") . "&nbsp;MB</td>\n\t\t<td>&nbsp;</td>\n\t\t</tr>";
    }
    $freeweb = new freeweb($_GET["servername"]);
    $groupwarelink = $freeweb->groupwares_InstallLink();
    $groupwares_textintro = $freeweb->groupwares_textintro();
    if ($groupwarelink != null) {
        $explain = "\n\t\t<div class=explain>{$groupwares_textintro}:<br><strong style='font-size:14px'>\n\t\t\t<a href=\"javascript:blur()\" OnClick=\"javascript:s_PopUpFull('{$groupwarelink}',1024,768)\" style='text-decoration:underline;font-weight:bold;color:#969696'>{$groupwarelink}</a></strong></div>\t\t\n\t\t";
    }
    $img = "website-64.png";
    if ($_GET["force-groupware"] != null) {
        $vhosts = new vhosts();
        $img = $vhosts->IMG_ARRAY_64[$_GET["force-groupware"]];
        $imgtitle = "<div style='font-size:14px;font-weight:bold'>{" . $vhosts->TEXT_ARRAY[$_GET["force-groupware"]]["TITLE"] . "}</div>";
        if ($_GET["force-groupware"] == "ZARAFA") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "Z-PUSH") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "ZARAFA_MOBILE") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "ROUNDCUBE") {
            $OnlyWebSite = true;
        }
    }
    if ($_GET["servername"] == null) {
        $ButtonName = "{add}";
    }
    $freeweb = new freeweb($_GET["servername"]);
    if ($ligne["domainname"] == null) {
        $dda = explode(".", $ligne["servername"]);
        $hostname = $dda[0];
        unset($dda[0]);
        $domainname = @implode(".", $dda);
    } else {
        $ff = explode(".", $ligne["servername"]);
        if (count($ff) > 2) {
            $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]);
        } else {
            $hostname = null;
        }
        $domainname = $ligne["domainname"];
        $parcourir_domaines = null;
    }
    if ($hostname == "_default_") {
        $parcourir_domaines = null;
    }
    if ($DNS_INSTALLED) {
        include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
        include_once dirname(__FILE__) . "/ressources/class.pdns.inc";
        $pdns = new pdns();
        if ($ligne["servername"] == null) {
            $ip = new networking();
            $ips = $ip->ALL_IPS_GET_ARRAY();
            $ips[null] = "{none}";
            $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:14px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>";
        } else {
            $hostip = $pdns->GetIp($ligne["servername"]);
            if ($hostip != null) {
                $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td style='font-size:14px'>{$hostip}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>";
            } else {
                $ip = new networking();
                $ips = $ip->ALL_IPS_GET_ARRAY();
                $ips[null] = "{none}";
                $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:14px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>";
            }
        }
    }
    $domain = "<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:15px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:14px' align='center' width=1%>&nbsp;.&nbsp;</td>\n\t\t\t<td>" . Field_text("domainname", $domainname, "font-size:15px;padding:3px;width:220px;font-weight:bold") . "</td>\n\t\t\t<td>{$parcourir_domaines}</td>\n\t\t</tr>\n\t\t</table>";
    if (!$users->AsSystemAdministrator) {
        if ($ligne["domainname"] == null) {
            $dd = explode(".", $ligne["servername"]);
            $hostname = $dd[0];
            unset($dd[0]);
            $domainname = @implode(".", $dd);
        } else {
            $ff = explode(".", $ligne["servername"]);
            if (count($ff) > 2) {
                $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]);
            } else {
                $hostname = null;
            }
            $domainname = $ligne["domainname"];
        }
        $ldap = new clladp();
        $domains = $ldap->Hash_domains_table($_SESSION["ou"]);
        while (list($a, $b) = each($domains)) {
            $c[$a] = $a;
        }
        $domain = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:15px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:14px' align='center' width=1%>&nbsp;.&nbsp;</td>\n\t\t\t<td>" . Field_array_Hash($c, "domainname", $domainname, "style:font-size:15px;padding:3px;font-weight:bold;width:220px;") . "</td>\n\t\t</tr>\n\t\t</table>";
    }
    $NewServer = 0;
    $reconfigure = ParagrapheTEXT("48-settings-refresh.png", "{rebuild}", "{rebuild_apache_text}", "javascript:FreeWebsRebuildvHosts()");
    if (trim($ligne["servername"] == null)) {
        $reconfigure = ParagrapheTEXT_disabled("48-settings-refresh.png", "{rebuild}", "{rebuild_apache_text}");
        $NewServer = 1;
    }
    if ($NewServer == 0) {
        $domain = "<div style='font-size:16px'>{$ligne["servername"]}</div>\n\t\t\t<input type='hidden' value='{$ligne["servername"]}' id='servername'>\n\t\t\t<input type='hidden' value='{$ligne["domainname"]}' id='domainname'>";
    }
    if ($ligne["groupware"] != null) {
        $apache = new vhosts();
        $img = $apache->IMG_ARRAY_64[$ligne["groupware"]];
        $rebuild_groupware = ParagrapheTEXT("setup-icon-48.png", "{software}", "{rebuild_apache_groupware_text}", "javascript:FreeWebsRebuildGroupware()");
        $sql = "SELECT ID FROM drupal_queue_orders WHERE `ORDER`='REBUILD_GROUPWARE' AND `servername`='{$servername}'";
        $ligneDrup = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
        if (!is_numeric($ligneDrup["ID"])) {
            $ligneDrup["ID"] = 0;
        }
        if ($ligneDrup["ID"] > 0) {
            $rebuild_groupware = ParagrapheTEXT_disabled("setup-icon-48.png", "{software}", "{rebuild_apache_groupware_text}");
        }
        if ($ligne["groupware"] == "ZARAFA") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($ligne["groupware"] == "Z-PUSH") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($ligne["groupware"] == "ZARAFA_MOBILE") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($ligne["groupware"] == "ROUNDCUBE") {
            $OnlyWebSite = true;
        }
        if ($ligne["ForceInstanceZarafaID"] > 0) {
            $_GET["ForceInstanceZarafaID"] = $ligne["ForceInstanceZarafaID"];
        }
    }
    $checksDebug = ParagrapheTEXT("setup-check-icon-48.png", "{check_configuration}", "{check_configuration_text}", "javascript:FreeWebsCheckGroupware()");
    if ($remove_sql) {
        $js_removesql = "HideMysql()";
    }
    if ($OnlyWebSite) {
        $js_OnlyWebSite = "OnlyWebsite()";
    }
    $uid_uri = urlencode(base64_encode($ligne["uid"]));
    $nets = unserialize(base64_decode($sock->GET_INFO("FreeWebsApacheListenTable")));
    $znets[null] = "{default}";
    while (list($num, $ip) = each($nets)) {
        $znets[$num] = $num;
    }
    $ServerIP = Field_array_Hash($znets, 'ServerIP', $ServerIPVAL, null, null, 0, 'font-size:14px;');
    $q = new mysql();
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $sslcertificate = Field_array_Hash($sslcertificates, $ligne["sslcertificate"], "style:font-size:14px");
    $html = "\n\t<input type='hidden' id='force-groupware' name ='force-groupware' value='{$_GET["force-groupware"]}'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%>\n\t\t\t<center>\n\t\t\t\t<img src='img/{$img}'>{$imgtitle}\n\t\t\t</center><br>\n\t\t\t<div style='width:190px'>\n\t\t\t{$reconfigure}{$rebuild_groupware}{$checksDebug}{$see_config}\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign='top' width=99%>\n\t{$explain}\n\t<div style='font-size:16px'><a href=\"javascript:blur();\" style='font-size:18px;text-decoration:underline;margin-bottom:5px' \n\tOnClick=\"javascript:document.getElementById('block2').style.display='none';document.getElementById('block1').style.display='block';\">{$webservice}:</a></div>\n\t\n\t<div id='freewebdiv'>\n\t\t<div id='block1' style='display:block;'>\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{acl_dstdomain}:</td>\n\t\t\t\t<td colspan=2>{$domain}</td>\n\t\t\t</tr>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{listen_address}:</td>\n\t\t\t\t<td colspan=2>{$ServerIP}</td>\n\t\t\t</tr>\t\t\t\t\t\n\t\t\t{$dns_field}\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{www_forward}:</td>\n\t\t\t\t<td width=1%>" . Field_checkbox("Forwarder", 1, $ligne["Forwarder"], "CheckForwarder()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{reverse_proxy}:</td>\n\t\t\t\t<td width=1%>" . Field_checkbox("UseReverseProxy", 1, $ligne["UseReverseProxy"], "CheckUseReverseProxy()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\n\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{directory}:</td>\n\t\t\t\t<td>" . Field_text("www_dir", $ligne["www_dir"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td>" . button_browse("www_dir") . "</td>\n\t\t\t</tr>\t\t\t\n\t\t\t\n\t\t\t{$sizelimit}\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap>{UseLoopDisk}:</td>\n\t\t\t\t<td>" . Field_checkbox("UseLoopDisk", 1, $ligne["UseLoopDisk"], "CheckLoops()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr style='height:auto'>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td colspan=2 style='height:auto'><span id='loops-list'></span></td></tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{member}:</td>\n\t\t\t\t<td>" . Field_text("www_uid", $ligne["uid"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td><span id='bb_button'><input type='button' OnClick=\"javascript:Loadjs('user.browse.php?field=www_uid&YahooWin=6')\" value='{browse}...'></span>\n\t\t\t\t<span id='status-uid-www' style='float:right'></span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{group}:</td>\n\t\t\t\t<td>" . Field_text("www_group", $ligne["gpid"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td><span id='bb_button1'><input type='button' OnClick=\"javascript:Loadjs('MembersBrowse.php?field-user=www_group&OnlyGroups=1&OnlyGUID=1');\" value='{browse}...'></span>\n\t\t\t\t<span id='status-gpid-www' style='float:right'></span></td>\n\t\t\t</tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{ssl}:</td>\n\t\t\t\t<td>" . Field_checkbox("useSSL", 1, $ligne["useSSL"]) . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{certificate}:</td>\n\t\t\t\t<td>{$sslcertificate}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\n\t\t\t</table>\n\t</div>\n\n\t<div style='font-size:16px'><a href=\"javascript:blur();\" style='font-size:18px;text-decoration:underline;margin-bottom:5px' OnClick=\"javascript:document.getElementById('block2').style.display='block';document.getElementById('block1').style.display='none';\">{mysql_database}:</a></div>\n\t<div id='block2' style='display:none;'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{useMySQL}:</td>\n\t\t<td>" . Field_checkbox("useMysql", 1, $ligne["useMysql"], "useMysqlCheck()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{mysql_instance}:</td>\n\t\t<td><div id='freeweb-mysql-instances'></div></td>\n\t\t<td align='left'>" . imgtootltip("plus-24.png", "{add}:{mysql_instance}", "Loadjs('mysql.multi.php?mysql-server-js=yes&ID=');") . "</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend>{mysql_database}:</td>\n\t\t<td>" . Field_text("mysql_database", $ligne["mysql_database"], "width:150px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{mysql_username}:</td>\n\t\t<td>" . Field_text("mysql_username", $ligne["mysql_username"], "width:120px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{password}:</td>\n\t\t<td>" . Field_password("mysql_password", $ligne["mysql_password"], "width:90px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3><span style='font-size:16px'>{ftp_access}<hr style='border-color:005447'></td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend>{allowftp_access}:</td>\n\t\t<td>" . Field_checkbox("useFTP", 1, $ligne["useFTP"], "useMysqlCheck()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend>{ftp_user}:</td>\n\t\t<td>" . Field_text("ftpuser", $ligne["ftpuser"], "width:120px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{password}:</td>\n\t\t<td>" . Field_password("ftppassword", $ligne["ftppassword"], "width:90px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t</table>\n\t\n\n\t\n\t<div id='block3' style='display:none'>\n\t\t<table style='width:99%' class=form>\n\t\t<tr>\n\t\t\t<td class=legend>{www_ForwardTo}:</td>\n\t\t\t<td>" . Field_text("ForwardTo", $ligne["ForwardTo"], "width:270px;font-size:14px;padding:3px") . "</td>\n\t\t\t<td>&nbsp;</td>\n\t\t</tr>\n\t\t</table>\t\n\t</div>\t\n\t</div>\n\t\n\t<div style='width:100%;text-align:right'><hr>" . button("{$ButtonName}", "SaveFreeWebMain()", 18) . "</div>\n\n\n\n\t\n\t\n\t</td>\n\t</tr>\n\t</table>\n<script>\n\n\tfunction CheckDatas(){\n\t\tvar APACHE_PROXY_MODE={$APACHE_PROXY_MODE};\n\t\tvar FreeWebDisableSSL={$FreeWebDisableSSL};\n\t\t \n\t\t\n\t\tif(APACHE_PROXY_MODE==0){\n\t\t\tdocument.getElementById('UseReverseProxy').checked=false;\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t}\n\t\t\n\t\tvar x=document.getElementById('servername').value;\n\t\tvar z=document.getElementById('domainname').value;\n\t\tvar w=x.length+z.length;\n\t\tif(w>0){\n\t\t\tdocument.getElementById('servername').disabled=true;\n\t\t\tdocument.getElementById('domainname').disabled=true;\n\t\t\t}\n\t\tvar x=document.getElementById('mysql_database').value;\n\t\tif(x.length>0){document.getElementById('mysql_database').disabled=true;}\t\n\n\t\tif(FreeWebDisableSSL==1){\n\t\t\tdocument.getElementById('useSSL').disabled=true;\n\t\t}\n\t\t\n\t}\n\t\n\n\t\n\tfunction useMysqlCheck(){\n\t\tvar mysql_instance_id=0;\n\t\tvar checkboxes={$checkboxes};\n\t\tvar PUREFTP_INSTALLED={$PUREFTP_INSTALLED};\n\t\tif(document.getElementById('mysql_instance_id')){mysql_instance_id=document.getElementById('mysql_instance_id').value;}\n\t\tdocument.getElementById('useFTP').disabled=true;\n\t\tdocument.getElementById('useMysql').disabled=true;\n\t\t\n\t\tif(checkboxes==1){\n\t\t\tif(PUREFTP_INSTALLED==1){document.getElementById('useFTP').disabled=false;}\n\t\t\tif(mysql_instance_id==0){document.getElementById('useMysql').disabled=false;}\t\n\t\t}\n\t\tif(PUREFTP_INSTALLED==1){\n\t\t\tdocument.getElementById('useFTP').disabled=false;\n\t\t}else{\n\t\t\tdocument.getElementById('useFTP').disabled=true;\n\t\t\tdocument.getElementById('useFTP').checked=false;\n\t\t}\n\t\t\n\t\tdocument.getElementById('mysql_database').disabled=true;\n\t\tdocument.getElementById('mysql_username').disabled=true;\n\t\tdocument.getElementById('mysql_password').disabled=true;\n\t\tdocument.getElementById('ftpuser').disabled=true;\n\t\tdocument.getElementById('ftppassword').disabled=true;\n\t\tif(mysql_instance_id==0){\n\t\t\tif(document.getElementById('useMysql').checked){\n\t\t\t\tvar mysql_database=document.getElementById('mysql_database').value;\n\t\t\t\tif(mysql_database.length==0){document.getElementById('mysql_database').disabled=false;}\n\t\t\t\tdocument.getElementById('mysql_username').disabled=false;\n\t\t\t\tdocument.getElementById('mysql_password').disabled=false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(mysql_instance_id==1){\n\t\t\tdocument.getElementById('mysql_database').disabled=false;\n\t\t}\n\t\t\n\t\tif(!document.getElementById('useFTP').checked){return;}\n\t\tdocument.getElementById('ftpuser').disabled=false;\n\t\tdocument.getElementById('ftppassword').disabled=false;\t\t\n\t\t\n\t\t\n\t}\n\t\n\tfunction CheckForwarder(){\n\t\tif(document.getElementById('Forwarder').checked){\n\t\t\tdocument.getElementById('block2').style.display='none';\n\t\t\tdocument.getElementById('block3').style.display='block';\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\t}else{\n//\t\t\tdocument.getElementById('block2').style.display='block';\n\t\t\tdocument.getElementById('block3').style.display='none';\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=false;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t\tCheckLoops();\n\t\t}\n\t\n\t}\n\t\t\n\tfunction FreeWebsRebuildvHosts(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildvHosts','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain);\n\t}\n\t\n\tfunction FreeWebsRebuildGroupware(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildGroupware','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain);\n\t}\t\t\t\n\n\n\tvar x_SaveFreeWebMain=function (obj) {\n\t\t    var NewServer={$NewServer};\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\t\t\t\n\t\t\tRefreshTab('main_config_freewebedit');\n\t\t\tif(document.getElementById('container-www-tabs')){RefreshTab('container-www-tabs');}\n\t\t\tif(document.getElementById('main_config_freeweb')){RefreshTab('main_config_freeweb');}\n\t\t\tif(document.getElementById('sarg_tabs')){RefreshTab('sarg_tabs');}\n\t\t\t\n\t\t\tif(NewServer==1){YahooWin5Hide();}\n\t\t\t\n\t\t}\t\n\t\t\n\t\tfunction SaveFreeWebMain(){\n\t\t\tvar NewServer={$NewServer};\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(NewServer==1){\n\t\t\t\tvar sitename=document.getElementById('servername').value;\n\t\t\t\tvar www_a=document.getElementById('domainname').value;\n\t\t\t\tvar www_b=document.getElementById('servername').value;\n\t\t\t\tvar www_t=www_a.length+www_b.length;\n\t\t\t\tif(www_t<2){\n\t\t\t\t\talert('{$error_please_fill_field}:{$acl_dstdomain}'); \n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar x=document.getElementById('domainname').value;\n\t\t\t\t\tif(x.length==0){alert('{$error_please_fill_field}:{$acl_dstdomain}');return;}\n\t\t\t\t}else{\n\t\t\t\t\tdocument.getElementById('domainname').value='';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(document.getElementById('ADD_DNS_ENTRY')){\n\t\t\t\tXHR.appendData('ADD_DNS_ENTRY',document.getElementById('ADD_DNS_ENTRY').value);\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('useMysql').checked){\n\t\t\t\tvar mysql_database=document.getElementById('mysql_database').value;\n\t\t\t\tif(mysql_database.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}');\n\t\t\t\t\treturn;\t\t\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\tvar x=document.getElementById('mysql_password').value;\n\t\t\t\tif(x.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}/{$password}');\n\t\t\t\t\treturn;\n\t\t\t\t}\t\n\t\t\t\tvar x=document.getElementById('mysql_username').value;\n\t\t\t\tif(x.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}/{$username}');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(mysql_database.length>16){\n\t\t\t\t\talert('mysql_database:{$error_field_max_length}: 16');\n\t\t\t\t\tdocument.getElementById('mysql_database').disabled=false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('useSSL').checked){XHR.appendData('useSSL',1);}else{XHR.appendData('useSSL',0);}\n\t\t\tif(document.getElementById('useMysql').checked){XHR.appendData('useMysql',1);}else{XHR.appendData('useMysql',0);}\n\t\t\tif(document.getElementById('useFTP').checked){XHR.appendData('useFTP',1);}else{XHR.appendData('useFTP',0);}\n\t\t\tXHR.appendData('UseDefaultPort',0)\n\t\t\tif(document.getElementById('UseReverseProxy').checked){XHR.appendData('UseReverseProxy',1);}else{XHR.appendData('UseReverseProxy',0);}\n\t\t\tif(document.getElementById('Forwarder').checked){XHR.appendData('Forwarder',1);}else{XHR.appendData('Forwarder',0);}\n\t\t\tXHR.appendData('ForceInstanceZarafaID','{$_GET["ForceInstanceZarafaID"]}');\n\t\t\t\n\t\t\tif(document.getElementById('www_dir')){\n\t\t\t\tXHR.appendData('www_dir',document.getElementById('www_dir').value);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('LoopMounts')){\n\t\t\t\tvar LoopMounts=document.getElementById('LoopMounts').value;\n\t\t\t\tif(LoopMounts.length>3){\n\t\t\t\t\tif(document.getElementById('UseLoopDisk').checked){XHR.appendData('UseLoopDisk',1);}else{XHR.appendData('UseLoopDisk',0);}\n\t\t\t\t\tXHR.appendData('LoopMounts',LoopMounts);\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tvar ftpuser=trim(document.getElementById('ftpuser').value);\n\t\t\tvar uid=trim(document.getElementById('www_uid').value);\n\t\t\tif(document.getElementById('useFTP').checked){\t\n\t\t\t\tif(uid==ftpuser){\n\t\t\t\t\talert('{$no_usersameftpuser}');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('vg_size')){XHR.appendData('vg_size',document.getElementById('vg_size').value);}\n\t\t\tXHR.appendData('lvm_vg','{$ligne["lvm_vg"]}');\n\t\t\tif(NewServer==1){\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar www_b=document.getElementById('domainname').value;\n\t\t\t\t\tvar www_a=document.getElementById('servername').value;\n\t\t\t\t\tif(www_a.length>0){XHR.appendData('servername',www_a+'.'+www_b);}else{XHR.appendData('servername',www_b);}\n    \t\t\t\t}else{\n    \t\t\t\tXHR.appendData('servername','_default_');\n    \t\t\t}\n    \t\t}\n    \t\tif(NewServer==0){XHR.appendData('servername',document.getElementById('servername').value);}\n    \t\tXHR.appendData('domainname',document.getElementById('domainname').value);\n    \t\tXHR.appendData('uid',uid);\n    \t\tXHR.appendData('gpid',document.getElementById('www_group').value);\n    \t\tXHR.appendData('mysql_instance_id',document.getElementById('mysql_instance_id').value);\n    \t\tXHR.appendData('mysql_database',document.getElementById('mysql_database').value);\n    \t\tXHR.appendData('mysql_password',document.getElementById('mysql_password').value);\n    \t\tXHR.appendData('mysql_username',document.getElementById('mysql_username').value);\n    \t\tXHR.appendData('ftpuser',ftpuser);\n    \t\tXHR.appendData('ftppassword',document.getElementById('ftppassword').value);\n    \t\tXHR.appendData('ForwardTo',document.getElementById('ForwardTo').value);\n    \t\tXHR.appendData('force-groupware',document.getElementById('force-groupware').value);\n    \t\tXHR.appendData('mysql_instance_id',document.getElementById('mysql_instance_id').value);\n    \t\tXHR.appendData('ServerIP',document.getElementById('ServerIP').value);\n    \t\tXHR.appendData('sslcertificate',document.getElementById('sslcertificate').value);\n    \t\t\n    \t\t\n    \t\t\n    \t\tAnimateDiv('freewebdiv');\n    \t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveFreeWebMain);\n\t\t\t\n\t\t}\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\t\n\tfunction FreeWebsCheckGroupware(){\n\t\tLoadWinORG2('850','{$page}?FreeWebsCheck=yes&servername={$ligne["servername"]}','{$check_configuration}::{$ligne["servername"]}');\n\t\n\t}\n\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){document.getElementById('UseLoopDisk').disabled=false;}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\tfunction CheckUseReverseProxy(){\n\t\tCheckDatas();\n\t\tuseMysqlCheck();\n\t\tCheckLoops();\n\t\t{$js_removesql};\n\t\t{$js_OnlyWebSite};\n\t}\n\t\n\tfunction HideMysql(){\n\t\tdocument.getElementById('useMysql').disabled=true;\n\t}\n\t\n\tfunction OnlyWebsite(){\n\t\tif(document.getElementById('Forwarder')){document.getElementById('Forwarder').disabled=true;}\n\t\tif(document.getElementById('UseReverseProxy')){document.getElementById('UseReverseProxy').disabled=true;}\n\t\tif(document.getElementById('useFTP')){document.getElementById('useFTP').disabled=true;}\n\t}\n\t\n\tfunction CheckUId(){\n\t\tLoadAjaxTiny('status-uid-www','{$page}?uid-check={$uid_uri}');\n\t}\n\n\t\n\tfunction freeweb_mysql_instances(){\n\t\tLoadAjaxTiny('freeweb-mysql-instances','{$page}?freeweb-mysql-instances-field=yes&servername={$ligne["servername"]}');\n\t\n\t}\n\t\n\tfunction mysql_instance_id_check(){\n\t\t\t\n\t\t\tvar mysql_instance_id=document.getElementById('mysql_instance_id').value;\n\t\t\t\n\t\t\tif(mysql_instance_id>0){\n\t\t\t\tdocument.getElementById('useMysql').disabled=true;\n\t\t\t\tuseMysqlCheck();\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('useMysql').disabled=false;\n\t\t\t\tuseMysqlCheck();\n\t\t\t}\n\t\t}\n\t\t\n\n\t\n\tCheckDatas();\n\tuseMysqlCheck();\n\tCheckLoops();\n\tCheckForwarder();\n\tCheckUId();\n\t{$js_removesql};\n\t{$js_OnlyWebSite};\n\t\n\tfreeweb_mysql_instances();\n\t\n\t</script>\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 9
0
function ReloadPostfix($nohastables = false)
{
    $ldap = new clladp();
    $domains = $ldap->Hash_domains_table();
    $unix = new unix();
    $php5 = $unix->LOCATE_PHP5_BIN();
    if (is_array($domains)) {
        while (list($num, $ligne) = each($domains)) {
            $dom[] = $num;
        }
        $myOrigin = $dom[0];
    }
    if ($myOrigin == null) {
        if (!isset($GLOBALS["CLASS_USERS_MENUS"])) {
            $user = new usersMenus();
        } else {
            $user = $GLOBALS["CLASS_USERS_MENUS"];
        }
        $myOrigin = $user->hostname;
    }
    if ($myOrigin == null) {
        $myOrigin = "localhost.localdomain";
    }
    $postfix = $unix->find_program("postfix");
    $daemon_directory = $unix->LOCATE_POSTFIX_DAEMON_DIRECTORY();
    echo "Starting......: Postfix daemon directory \"{$daemon_directory}\"\n";
    postconf("daemon_directory", $daemon_directory);
    if ($myOrigin == null) {
        $myOrigin = "localhost.localdomain";
    }
    if (!$nohastables) {
        echo "Starting......: Postfix launch datases compilation...\n";
        buildtables_background();
    }
    postconf("myorigin", "{$myOrigin}");
    postconf("smtpd_delay_reject", "yes");
    $main = new maincf_multi("master", "master");
    $freeze_delivery_queue = $main->GET("freeze_delivery_queue");
    if ($freeze_delivery_queue == 1) {
        postconf("master_service_disable", "qmgr.fifo");
        postconf("in_flow_delay", "0");
    } else {
        postconf("master_service_disable", "");
        $in_flow_delay = $main->GET("in_flow_delay");
        if ($in_flow_delay == null) {
            $in_flow_delay = "1s";
        }
        postconf("in_flow_delay", $in_flow_delay);
    }
    echo "Starting......: Postfix Apply securities issues\n";
    appliSecu();
    echo "Starting......: Postfix Reloading ASSP\n";
    system("/usr/share/artica-postfix/bin/artica-install --reload-assp");
    echo "Starting......: Postfix reloading postfix master with \"{$postfix}\"\n";
    if (is_file($postfix)) {
        shell_exec("{$postfix} reload >/dev/null 2>&1");
        return;
    }
}
Exemplo n.º 10
0
function database_migrate_popup(){
		$tpl=new templates();
	$users=new usersMenus();
	if(!$users->AllowAddUsers){
		echo "<H2>".$tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}")."</H2>";exit;
	}
	
	$ID=$_GET["database-migrate"];
	$ou=$_GET["ou"];
	$ou=base64_decode($ou);
	$emailing=new emailings($ID);
	$ldap=new clladp();
	$group=$ldap->hash_groups($ou,1);
	$group[null]="{select}";
	
	
	$field=Field_array_Hash($group,'emailing_gpid_migr',trim($emailing->array_options["gpid"]),null,null,0,"font-size:14px;padding:4px");
	$page=CurrentPageName();
	$confirm=$tpl->javascript_parse_text('{confirm}?');
	
	
	$ldap=new clladp();
	$domains=$ldap->Hash_domains_table($ou);
	while (list ($domain, $no) = each ($domains) ){
		$DOMAINS_ARRAY[$domain]=$domain;
	}	
	$DOMAINS_ARRAY[null]="{select}";
	$domains_field=Field_array_Hash($DOMAINS_ARRAY,'export_domain',$emailing->array_options["export_domain"],null,null,0,"font-size:14px;padding:4px");
	
	$html="
	<div id='database_migrate_popup_id'>
	<table style='width:100%'>
	<tr>
	<td valign='top' width=1%><img src='img/user-migrate-90.png'></td>
	<td valign='top'>
	<div style='font-size:13px'>{migrate_user_text}</div>
	<table style='width:100%'>
	<tr>
		<td class=legend style='font-size:14px'>{group}:</td>
		<td>$field</td>
	</tr>
	<tr>
		<td class=legend style='font-size:14px'>{domain}:</td>
		<td>$domains_field</td>
	</tr>
	<tr>
		<td class=legend style='font-size:14px'>{default_password}:</td>
		<td>". Field_password("export_default_password",$emailing->array_options["export_default_password"],"font-size:14px;padding:4px;width:120px")."</td>
	</tr>			
	<tr>
		<td colspan=2 align='right'><hr>". button("{import}","MigrateUsersToLdapPerform()")."</td>
	</tr>
	
	</table>
	
	
	
	</td>
	</tr>
	</table>
	</div>
	
	<script>
		var x_MigrateUsersToLdapPerform= function (obj) {
			var tempvalue=obj.responseText;
			if(tempvalue.length>0){alert(tempvalue);}
			YahooWin5Hide();
			RefreshTab('emailing_campaigns');	
		}		
	
		function MigrateUsersToLdapPerform(){
			if(confirm('$confirm')){
				var XHR = new XHRConnection();
	      		XHR.appendData('database-migrate-perform','$ID');
	      		XHR.appendData('ou','{$_GET["ou"]}');
	      		XHR.appendData('gpid',document.getElementById('emailing_gpid_migr').value);
	      		XHR.appendData('export_domain',document.getElementById('export_domain').value);
	      		XHR.appendData('export_default_password',document.getElementById('export_default_password').value);
	      		if(document.getElementById('database_migrate_popup_id')){document.getElementById('database_migrate_popup_id').innerHTML='<center style=\"margin:20px;padding:20px\"><img src=\"img/wait_verybig.gif\"></center>';}
		  		XHR.sendAndLoad('$page', 'GET',x_MigrateUsersToLdapPerform);	
				}
			
			}	

	</script>
	
	";
		echo $tpl->_ENGINE_parse_body("$html");
	
	
}
Exemplo n.º 11
0
function DeleteInternetDomain()
{
    $usr = new usersMenus();
    if ($usr->AllowChangeDomains == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $domain = $_GET["DeleteInternetDomain"];
    $ou = $_GET["ou"];
    $tpl = new templates();
    $artica = new artica_general();
    $ldap = new clladp();
    if ($artica->RelayType == "single") {
        $ldap->delete_VirtualDomainsMapsMTA($ou, $domain);
    }
    $HashDomains = $ldap->Hash_domains_table($ou);
    $ldap = new clladp();
    $h = $ldap->Ldap_search($ldap->suffix, "(associatedDomain={$domain})", array("dn"));
    if ($h["count"] > 0) {
        $res["associatedDomain"] = $domain;
        if ($h["count"] == 1) {
            $res["objectClass"] = "domainRelatedObject";
        }
        for ($i = 0; $i < $h["count"]; $i++) {
            $ldap->Ldap_del_mod($h[$i]["dn"], $res);
        }
    }
    writelogs("{$domain} type=" . $HashDomains[$domain], __FUNCTION__, __FILE__);
    switch ($HashDomains[$domain]) {
        case "associateddomain":
            $ldap->delete_associated_domain($ou, $domain);
            break;
        case "dn":
            if ($ldap->ExistsDN("cn={$domain},ou={$ou},{$ldap->suffix}")) {
                writelogs("cn={$domain},ou={$ou},{$ldap->suffix} exists, delete it...", __FUNCTION__, __FILE__);
                if (!$ldap->ldap_delete("cn={$domain},ou={$ou},{$ldap->suffix}")) {
                    writelogs("Error line :" . __LINE__ . " " . $ldap->ldap_last_error, __FUNCTION__, __FILE__);
                }
            }
            break;
        default:
            return null;
            break;
    }
    if ($ldap->ldap_last_error != null) {
        echo $ldap->ldap_last_error;
    } else {
        echo html_entity_decode($tpl->_ENGINE_parse_body('{success}'));
        exit;
    }
}
Exemplo n.º 12
0
function sql_domain()
{
    $ldap = new clladp();
    $domains = $ldap->Hash_domains_table($GLOBALS["OU"]);
    if (!is_array($domains)) {
        echo __FUNCTION__ . " No domains for '{$GLOBALS["OU"]}'\n";
        return null;
    }
    while (list($domain, $nothing) = each($domains)) {
        $array_domain[] = "OR delivery_domain='{$domain}'";
        $array_out_domain[] = "OR sender_domain='{$domain}'";
        echo __FUNCTION__ . " {$domain}...\n";
        $GLOBALS["mydomains"][] = $domain;
    }
    $sql_domain = implode(" ", $array_domain);
    $sql_out_domain = implode(" ", $array_out_domain);
    if (substr($sql_domain, 0, 2) == "OR") {
        $sql_domain = substr($sql_domain, 2, strlen($sql_domain));
    }
    if (substr($sql_out_domain, 0, 2) == "OR") {
        $sql_out_domain = substr($sql_out_domain, 2, strlen($sql_out_domain));
    }
    $sql_domain = "(" . trim($sql_domain) . ")";
    $GLOBALS["SQL_DOMAINS"] = $sql_domain;
    $GLOBALS["SQL_OUT_DOMAINS"] = $sql_out_domain;
}
Exemplo n.º 13
0
function popup(){
	$sql="SELECT * FROM freeweb WHERE servername='{$_GET["servername"]}'";
	$page=CurrentPageName();
	$users=new usersMenus();
	$tpl=new templates();
	$q=new mysql();
	$sock=new sockets();
	$APACHE_PROXY_MODE=0;
	$countloops=countloops();
	$no_usersameftpuser=$tpl->javascript_parse_text("{no_usersameftpuser}");
	$ligne=@mysql_fetch_array($q->QUERY_SQL($sql,'artica_backup'));
	$error_field_max_length=$tpl->javascript_parse_text("{error_field_max_length}");
	$error_please_fill_field=$tpl->javascript_parse_text("{error_please_fill_field}");
	$acl_dstdomain=$tpl->javascript_parse_text("{acl_dstdomain}");
	$mysql_database=$tpl->javascript_parse_text("{mysql_database}");
	$username=$tpl->javascript_parse_text("{username}");
	$password=$tpl->javascript_parse_text("{password}");
	$vgservices=unserialize(base64_decode($sock->GET_INFO("vgservices")));
	$checkboxes=1;
	if($ligne["groupware"]=="cachemgr"){$checkboxes=0;}
	$users=new usersMenus();
	$PUREFTP_INSTALLED=1;
	if(!$users->PUREFTP_INSTALLED){$PUREFTP_INSTALLED=0;}
	$ServerPort=trim($ligne["ServerPort"]);
	$UseDefaultPort=0;
	if(!is_numeric($ServerPort)){$UseDefaultPort=1;}
	if($ServerPort==null){$UseDefaultPort=1;}
	if($ServerPort==0){$UseDefaultPort=1;}
	if($users->APACHE_PROXY_MODE){$APACHE_PROXY_MODE=1;}
	$parcourir_domaines="<input type='button' OnClick=\"javascript:Loadjs('browse.domains.php?field=domainname')\" value='{browse}...'>";
		
	
	if($vgservices["freewebs"]<>null){
		if(!is_numeric($ligne["lvm_size"])){$ligne["lvm_size"]=5000;}
		if($ligne["lvm_vg"]==null){$ligne["lvm_vg"]=$vgservices["freewebs"];}
		$sizelimit="
		<tr>
		<td class=legend>{size}:</td>
		<td style='font-size:13px;'>". Field_text("vg_size",$ligne["lvm_size"],"font-size:13px;padding:3px;width:60px")."&nbsp;MB</td>
		<td>&nbsp;</td>
		</tr>";
		
	}
	
		if($ligne["domainname"]==null){
			$dda=explode(".",$ligne["servername"]);
			$hostname=$dda[0];
			unset($dda[0]);
			$domainname=@implode(".",$dda);
		}else{
			$hostname=str_replace(".{$ligne["domainname"]}","",$ligne["servername"]);
			$domainname=$ligne["domainname"];
			$parcourir_domaines=null;
		}
		
	if($hostname=="_default_"){$parcourir_domaines=null;}
	
	
	$domain="<table style='width:100%'>
		<tr>
			<td>".Field_text("servername",$hostname,"font-size:13px;padding:3px")."</td>
			<td style='font-size:14px' align='center' width=1%>&nbsp;.&nbsp;</td>
			<td>".Field_text("domainname",$domainname,"font-size:13px;padding:3px;width:220px")."</td>
			<td>$parcourir_domaines</td>
		</tr>
		</table>";
	
	if(!$users->AsSystemAdministrator){
		if($ligne["domainname"]==null){
			$dd=explode(".",$ligne["servername"]);
			$hostname=$dd[0];
			unset($dd[0]);
			$domainname=@implode(".",$dd);
		}else{
			$hostname=str_replace(".{$ligne["domainname"]}","",$ligne["servername"]);
			$domainname=$ligne["domainname"];
		}

		$ldap=new clladp();
		$domains=$ldap->Hash_domains_table($_SESSION["ou"]);
		while (list ($a, $b) = each ($domains) ){$c[$a]=$a;}
		
		$domain="
		<table style='width:100%'>
		<tr>
			<td>".Field_text("servername",$hostname,"font-size:13px;padding:3px")."</td>
			<td style='font-size:14px' align='center' width=1%>&nbsp;.&nbsp;</td>
			<td>". Field_array_Hash($c,"domainname",$domainname,"style:font-size:13px;padding:3px;")."</td>
		</tr>
		</table>";
		
	}
	$NewServer=0;
	if($ligne["servername"]==null){$NewServer=1;}
	
	$html="
	<table style='width:100%'>
	<tr>
		<td valign='top'><img src='img/website-64.png'></td>
		<td valign='top'>
	
	<div id='freewebdiv'>
	<table style='width:100%' class=form>
	<tr> 
		<td class=legend nowrap>{acl_dstdomain}:</td>
		<td colspan=2>$domain</td>
	</tr>	
	<tr>
		<td class=legend nowrap>{listen_port}:</td>
		<td>
			<table>
			<tr>
				<td class=legend width=1% nowrap>{default}:</td>
				<td width=1%>". Field_checkbox("UseDefaultPort", 1,$UseDefaultPort,"CheckUseDefaultPort()")."</td>
				<td>". Field_text("ServerPort",$ServerPort,"font-size:13px;padding:3px;width:65px")."</td>
			</tr>
			</table>
	</tr>
	<tr> 
		<td class=legend nowrap>{www_forward}:</td>
		<td width=1%>". Field_checkbox("Forwarder", 1,$ligne["Forwarder"],"CheckForwarder()")."</td>
	</tr>				
	<tr> 
		<td class=legend nowrap>{reverse_proxy}:</td>
		<td width=1%>". Field_checkbox("UseReverseProxy", 1,$ligne["UseReverseProxy"],"CheckUseReverseProxy()")."</td>
	</tr>		
	
	$sizelimit
	<tr>
		<td class=legend nowrap>{UseLoopDisk}:</td>
		<td>". Field_checkbox("UseLoopDisk",1,$ligne["UseLoopDisk"],"CheckLoops()")."</td>
		<td>&nbsp;</td>
	</tr>
	<tr style='height:auto'>
		<td>&nbsp;</td>
		<td colspan=2 style='height:auto'><span id='loops-list'></span></td></tr>		
	<tr>
		<td class=legend>{member}:</td>
		<td>". Field_text("www_uid",$ligne["uid"],"font-size:13px;padding:3px;")."</td>
		<td><span id='bb_button'><input type='button' OnClick=\"javascript:Loadjs('user.browse.php?field=www_uid&YahooWin=6')\" value='{browse}...'></span></td>
	</tr>	
	<tr>
		<td class=legend>{ssl}:</td>
		<td>". Field_checkbox("useSSL",1,$ligne["useSSL"])."</td>
		<td>&nbsp;</td>
	</tr>
	</table>
	<div id='block2'>
	<table style='width:100%' class=form>
	<tr>
		<td colspan=3><span style='font-size:16px'>{mysql_database}<hr style='border-color:005447'></td>
	</tr>
	<tr>
		<td class=legend>{useMySQL}:</td>
		<td>". Field_checkbox("useMysql",1,$ligne["useMysql"],"useMysqlCheck()")."</td>
		<td>&nbsp;</td>
	</tr>	
	
	
	<tr>
		<td class=legend>{mysql_database}:</td>
		<td>". Field_text("mysql_database",$ligne["mysql_database"],"width:150px;font-size:13px;padding:3px")."</td>
		<td>&nbsp;</td>
	</tr>	
	<tr>
		<td class=legend>{mysql_username}:</td>
		<td>". Field_text("mysql_username",$ligne["mysql_username"],"width:120px;font-size:13px;padding:3px")."</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td class=legend>{password}:</td>
		<td>". Field_password("mysql_password",$ligne["mysql_password"],"width:90px;font-size:13px;padding:3px")."</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td colspan=3><span style='font-size:16px'>{ftp_access}<hr style='border-color:005447'></td>
	</tr>	
	
	
	<tr>
		<td class=legend>{allowftp_access}:</td>
		<td>". Field_checkbox("useFTP",1,$ligne["useFTP"],"useMysqlCheck()")."</td>
		<td>&nbsp;</td>
	</tr>	
	
	<tr>
		<td class=legend>{ftp_user}:</td>
		<td>". Field_text("ftpuser",$ligne["ftpuser"],"width:120px;font-size:13px;padding:3px")."</td>
		<td>&nbsp;</td>
	</tr>	
	<tr>
		<td class=legend>{password}:</td>
		<td>". Field_password("ftppassword",$ligne["ftppassword"],"width:90px;font-size:13px;padding:3px")."</td>
		<td>&nbsp;</td>
	</tr>	
	</table>
	</div>
	
	<div id='block3' style='display:none'>
		<table style='width:100%' class=form>
		<tr>
			<td class=legend>{www_ForwardTo}:</td>
			<td>". Field_text("ForwardTo",$ligne["ForwardTo"],"width:270px;font-size:14px;padding:3px")."</td>
			<td>&nbsp;</td>
		</tr>
		</table>	
	</div>	
	
		<div style='width:100%;text-align:right'><hr>". button("{apply}","SaveFreeWebMain()")."</div>
	</div>


	
	
	</td>
	</tr>
	</table>
<script>

	function CheckDatas(){
		var APACHE_PROXY_MODE=$APACHE_PROXY_MODE;
		if(APACHE_PROXY_MODE==0){
			document.getElementById('UseReverseProxy').checked=false;
			document.getElementById('UseReverseProxy').disabled=true;
		}
		
		var x=document.getElementById('servername').value;
		if(x.length>0){
			document.getElementById('servername').disabled=true;
			document.getElementById('domainname').disabled=true;
			}
		var x=document.getElementById('mysql_database').value;
		if(x.length>0){document.getElementById('mysql_database').disabled=true;}		
		
	}
	
	function CheckUseDefaultPort(){
		if(document.getElementById('UseDefaultPort').checked){
			document.getElementById('ServerPort').disabled=true;
			return;
		}
		document.getElementById('ServerPort').disabled=false;
	}
	
	function useMysqlCheck(){
		var checkboxes=$checkboxes;
		var PUREFTP_INSTALLED=$PUREFTP_INSTALLED;
		document.getElementById('useFTP').disabled=true;
		document.getElementById('useMysql').disabled=true;
		
		if(checkboxes==1){
			if(PUREFTP_INSTALLED==1){document.getElementById('useFTP').disabled=false;}
			document.getElementById('useMysql').disabled=false;	
		}
		if(PUREFTP_INSTALLED==1){
			document.getElementById('useFTP').disabled=false;
		}else{
			document.getElementById('useFTP').disabled=true;
			document.getElementById('useFTP').checked=false;
		}
		
		document.getElementById('mysql_database').disabled=true;
		document.getElementById('mysql_username').disabled=true;
		document.getElementById('mysql_password').disabled=true;
		document.getElementById('ftpuser').disabled=true;
		document.getElementById('ftppassword').disabled=true;
	
		if(document.getElementById('useMysql').checked){
			document.getElementById('mysql_database').disabled=false;
			document.getElementById('mysql_username').disabled=false;
			document.getElementById('mysql_password').disabled=false;
		}

		if(!document.getElementById('useFTP').checked){return;}
		document.getElementById('ftpuser').disabled=false;
		document.getElementById('ftppassword').disabled=false;		
		
		
	}
	
	function CheckForwarder(){
		if(document.getElementById('Forwarder').checked){
			document.getElementById('block2').style.display='none';
			document.getElementById('block3').style.display='block';
			document.getElementById('UseReverseProxy').disabled=true;
			document.getElementById('UseLoopDisk').disabled=true;
		}else{
			document.getElementById('block2').style.display='block';
			document.getElementById('block3').style.display='none';
			document.getElementById('UseReverseProxy').disabled=false;
			document.getElementById('UseLoopDisk').disabled=false;
			CheckLoops();
		}
	
	}


	var x_SaveFreeWebMain=function (obj) {
		    var NewServer=$NewServer;
			var results=obj.responseText;
			if(results.length>0){alert(results);}			
			RefreshTab('main_config_freewebedit');
			RefreshTab('main_config_freeweb');
			if(document.getElementById('container-www-tabs')){RefreshTab('container-www-tabs');}
			if(NewServer==1){YahooWin5Hide();}
		}	
		
		function SaveFreeWebMain(){
			var XHR = new XHRConnection();
			var sitename=document.getElementById('servername').value;
			
			var x=document.getElementById('servername').value;
			
			if(x.length<2){
				alert('$error_please_fill_field:$acl_dstdomain'); 
				return;
			}
			
			if(sitename!=='_default_'){
				var x=document.getElementById('domainname').value;
				if(x.length==0){alert('$error_please_fill_field:$acl_dstdomain');return;}
			}else{
				document.getElementById('domainname').value='';
			}
						
			
			
			if(document.getElementById('useMysql').checked){
				var mysql_database=document.getElementById('mysql_database').value;
				if(mysql_database.length==0){
					alert('$error_please_fill_field:$mysql_database');
					return;						
				}	
				var x=document.getElementById('mysql_password').value;
				if(x.length==0){
					alert('$error_please_fill_field:$mysql_database/$password');
					return;
				}	
				var x=document.getElementById('mysql_username').value;
				if(x.length==0){
					alert('$error_please_fill_field:$mysql_database/$username');
					return;
				}
				
				if(mysql_database.length>16){
					alert('$error_field_max_length: 16');
					return;
				}
			}
			
			if(document.getElementById('useSSL').checked){XHR.appendData('useSSL',1);}else{XHR.appendData('useSSL',0);}
			if(document.getElementById('useMysql').checked){XHR.appendData('useMysql',1);}else{XHR.appendData('useMysql',0);}
			if(document.getElementById('useFTP').checked){XHR.appendData('useFTP',1);}else{XHR.appendData('useFTP',0);}
			if(document.getElementById('UseDefaultPort').checked){XHR.appendData('UseDefaultPort',1);}else{XHR.appendData('UseDefaultPort',0);}
			if(document.getElementById('UseReverseProxy').checked){XHR.appendData('UseReverseProxy',1);}else{XHR.appendData('UseReverseProxy',0);}
			if(document.getElementById('Forwarder').checked){XHR.appendData('Forwarder',1);}else{XHR.appendData('Forwarder',0);}
			
			
			
			
			if(document.getElementById('LoopMounts')){
				var LoopMounts=document.getElementById('LoopMounts').value;
				if(LoopMounts.length>3){
					if(document.getElementById('UseLoopDisk').checked){XHR.appendData('UseLoopDisk',1);}else{XHR.appendData('UseLoopDisk',0);}
					XHR.appendData('LoopMounts',LoopMounts);
				}
			
			}
			
			
			var ftpuser=trim(document.getElementById('ftpuser').value);
			var uid=trim(document.getElementById('www_uid').value);
			if(document.getElementById('useFTP').checked){	
				if(uid==ftpuser){
					alert('$no_usersameftpuser');
					return;
				}
			}
			
			if(document.getElementById('vg_size')){XHR.appendData('vg_size',document.getElementById('vg_size').value);}
			XHR.appendData('lvm_vg','{$ligne["lvm_vg"]}');
			if(sitename!=='_default_'){
    			XHR.appendData('servername',document.getElementById('servername').value+'.'+document.getElementById('domainname').value);
    		}else{
    			XHR.appendData('servername','_default_');
    		}
    		XHR.appendData('domainname',document.getElementById('domainname').value);
    		XHR.appendData('uid',uid);
    		XHR.appendData('mysql_database',document.getElementById('mysql_database').value);
    		XHR.appendData('mysql_password',document.getElementById('mysql_password').value);
    		XHR.appendData('mysql_username',document.getElementById('mysql_username').value);
    		XHR.appendData('ftpuser',ftpuser);
    		XHR.appendData('ftppassword',document.getElementById('ftppassword').value);
    		XHR.appendData('ServerPort',document.getElementById('ServerPort').value);
    		XHR.appendData('ForwardTo',document.getElementById('ForwardTo').value);
			AnimateDiv('freewebdiv');
    		XHR.sendAndLoad('$page', 'GET',x_SaveFreeWebMain);
			
		}	
		
	function CheckLoops(){
		var countloops=$countloops;
		document.getElementById('UseLoopDisk').disabled=true;
		if(countloops>0){
			document.getElementById('UseLoopDisk').disabled=false;
		}
		document.getElementById('loops-list').innerHTML='';
		
		if(document.getElementById('UseLoopDisk').checked){
			if(document.getElementById('vg_size')){
				document.getElementById('vg_size').disabled=true;
			}
			LoadAjax('loops-list','$page?loops-list=yes&servername={$ligne["servername"]}');
		}
	}
	
		
	function CheckLoops(){
		var countloops=$countloops;
		document.getElementById('UseLoopDisk').disabled=true;
		if(countloops>0){document.getElementById('UseLoopDisk').disabled=false;}
		document.getElementById('loops-list').innerHTML='';
		
		if(document.getElementById('UseLoopDisk').checked){
			if(document.getElementById('vg_size')){
				document.getElementById('vg_size').disabled=true;
			}
			LoadAjax('loops-list','$page?loops-list=yes&servername={$ligne["servername"]}');
		}
	}
	
	function CheckUseReverseProxy(){
		CheckDatas();
		useMysqlCheck();
		CheckLoops();
	}

	CheckUseDefaultPort();
	CheckDatas();
	useMysqlCheck();
	CheckLoops();
	CheckForwarder();
	</script>		
	";
	
	echo $tpl->_ENGINE_parse_body($html);
}