コード例 #1
0
ファイル: freeweb.edit.php プロジェクト: articatech/artica
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);
}
コード例 #2
0
function mysql_settings()
{
    $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")));
    $uid = $ligne["uid"];
    $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;
    }
    $webservice = $tpl->_ENGINE_parse_body("{webservice}");
    $ServerIPVAL = "{$ServerIPVAL}:{$ServerPort}";
    $t = time();
    if ($ligne["mysql_database"] != null) {
        $DatabaseText = $ligne["mysql_database"];
    }
    $html = "\t\n\t<div id='{$t}'></div>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><div id='{$t}-tool'></div></td>\n\t<td valign='top' width=99%>\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{useMySQL}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("useMysql", 1, $ligne["useMysql"], "useMysqlCheck()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{mysql_instance}:</td>\n\t\t\t\t<td><div id='freeweb-mysql-instances'></div></td>\n\t\t\t\t<td align='left'>" . imgtootltip("plus-24.png", "{add}:{mysql_instance}", "Loadjs('mysql.multi.php?mysql-server-js=yes&ID=');") . "</td>\n\t\t\t</tr>\t\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{mysql_database_name}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("mysql_database", $ligne["mysql_database"], "width:300px;font-size:18px;padding:3px") . "&nbsp;<span style='font-size:11px'>{$DatabaseText}</span></td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{mysql_username}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("mysql_username", $ligne["mysql_username"], "width:220px;font-size:18px;padding:3px") . "</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'>{password}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_password("mysql_password", $ligne["mysql_password"], "width:120px;font-size:14px;padding:3px") . "</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 colspan=3 align='right'><hr>" . button("{apply}", "SaveFreeWebMySQL()", 26) . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\n\tvar x_SaveFreeWebMain{$t}=function (obj) {\n\t\t   \tdocument.getElementById('{$t}').innerHTML='';\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);return;}\t\t\t\n\t\t\t\n\t\t}\t\t\n\t\n\tfunction SaveFreeWebMySQL(){\n\t\tvar uid='{$uid}';\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\t\n\t\tif(document.getElementById('useMysql').checked){XHR.appendData('useMysql',1);}else{XHR.appendData('useMysql',0);}\n\t\tif(document.getElementById('useMysql').checked){\n\t\t\tvar mysql_database=document.getElementById('mysql_database').value;\n\t\t\tif(mysql_database.length==0){\n\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}');\n\t\t\t\treturn;\t\t\t\t\t\t\n\t\t\t}\t\n\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\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\tif(mysql_database.length>16){\n\t\t\t\talert('mysql_database:{$error_field_max_length}: 16');\n\t\t\t\tdocument.getElementById('mysql_database').disabled=false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\tXHR.appendData('SAVE_FREEWEB_MYSQL','yes');\n\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\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('mysql_instance_id',document.getElementById('mysql_instance_id').value);\n    \t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain{$t});\t\t\n\t\t\n\t\t\n\t\n\t}\n\t\n\t\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\t\t\n\t\t\n\t\tif(checkboxes==1){\n\t\t\t\n\t\t\tif(mysql_instance_id==0){document.getElementById('useMysql').disabled=false;}\t\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\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\t\t\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}\t\n\t\n\tfunction freeweb_mysql_instances(){\n\t\tLoadAjaxTiny('freeweb-mysql-instances','freeweb.edit.php?freeweb-mysql-instances-field=yes&servername={$ligne["servername"]}');\n\t\n\t}\t\n\tfreeweb_mysql_instances();\n\tuseMysqlCheck();\n\tLoadAjax('{$t}-tool','{$page}?mysql-toolbox=yes&servername={$ligne["servername"]}');\n\t</script>\t\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #3
0
ファイル: freeweb.edit.php プロジェクト: rsd/artica-1.5
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);
}