function popup()
{
    $ID = $_GET["ID"];
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $q = new mysql();
    if (!$q->FIELD_EXISTS("squid_parents", "WanProxyMemory", "artica_backup")) {
        $q->QUERY_SQL("ALTER TABLE `squid_parents` ADD `WanProxyMemory` SMALLINT(10) NOT NULL DEFAULT '256'", "artica_backup");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    if (!$q->FIELD_EXISTS("squid_parents", "WanProxyCache", "artica_backup")) {
        $q->QUERY_SQL("ALTER TABLE `squid_parents` ADD `WanProxyCache` SMALLINT(10) NOT NULL DEFAULT '1'", "artica_backup");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    $sql = "SELECT * FROM squid_parents WHERE ID={$ID}";
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    $html = "\n<div style='width:98%' class=form>\n<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{memory_cache} (MB):</td>\n\t\t<td style='font-size:18px'>" . field_text("WanProxyMemory-{$t}", $ligne["WanProxyMemory"], "font-size:20px;width:120px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{caches_on_disk} (GB):</td>\n\t\t<td style='font-size:18px'>" . field_text("WanProxyCache-{$t}", $ligne["WanProxyCache"], "font-size:20px;width:120px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\t\t\t\n\t\n\t\n<tr>\n\t<td colspan=2 align='right'><hr>" . button("{apply}", "Save{$t}()", 32) . "</td>\n</tr>\n</table>\n</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){ alert(results); return; }\n\tRefreshTab('main_proxy_listen_ports');\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('WanProxyMemory',document.getElementById('WanProxyMemory-{$t}').value);\n\tXHR.appendData('WanProxyCache',document.getElementById('WanProxyCache-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function rule_time()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $eth = $_GET["eth"];
    $ethC = new system_nic($eth);
    $table = $_GET["table"];
    $ID = $_GET["ID"];
    $t = time();
    $q = new mysql();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM iptables_main WHERE ID='{$ID}'", "artica_backup"));
    $title = "{time_restriction}: {$eth}::" . $tpl->javascript_parse_text($ligne["rulename"]);
    $enabled = $ligne["enabled"];
    $table = $ligne["MOD"];
    $eth = $ligne["eth"];
    $bt = "{apply}";
    $array_days = array(1 => "monday", 2 => "tuesday", 3 => "wednesday", 4 => "thursday", 5 => "friday", 6 => "saturday", 7 => "sunday");
    $TTIME = unserialize($ligne["time_restriction"]);
    $tr[] = "<table>";
    while (list($num, $maks) = each($array_days)) {
        $tr[] = "<tr>\n\t\t<td class=legend style='font-size:22px'>{{$maks}}</td>\n\t\t<td>" . Field_checkbox_design("D{$num}-{$t}", 1, $TTIME["D{$num}"]) . "</td>\n\t\t\t</tr>";
        $jsF[] = "if(document.getElementById('D{$num}-{$t}').checked){XHR.appendData('D{$num}',1); }else{ XHR.appendData('D{$num}',0); }";
        $jsD[] = "document.getElementById('D{$num}-{$t}').disabled=true;";
        $jsE[] = "document.getElementById('D{$num}-{$t}').disabled=false;";
    }
    $tr[] = "</table>";
    if ($TTIME["ftime"] == null) {
        $TTIME["ftime"] = "20:00:00";
    }
    if ($TTIME["ttime"] == null) {
        $TTIME["ttime"] = "23:59:00";
    }
    $html = "\n\t<div style='font-size:18px' class=explain>{fwtime_explain}</div>\n\t<div style='width:98%' class=form>\n\t<div style='font-size:28px;margin-bottom:25px;margin-top:10px;margin-left:5px'>{$title}</div>\n\t<table style='width:100%'>\n\t<tr>\n\t<td class=legend style='font-size:22px'>{enabled}:</td>\n\t<td style='font-size:16px'>" . Field_checkbox_design("enabled-{$t}", 1, $ligne["enablet"], "EnableCK{$t}()") . "\n\t</tr>\n\t<tr>\n\t\t<tr>\n\t\t<td style='font-size:26px;vertical-align:top'>{hours}:<hr></td>\n\t<td>\n\t<table style='width:325px'>\n\t<td class=legend style='font-size:22px'>{from_time}:</td>\n\t<td style='font-size:16px'>" . field_text("ftime-{$t}", $TTIME["ftime"], "font-size:22px;width:130px;text-align:right") . "\n\t</tr>\n\t<tr>\n\t<td class=legend style='font-size:22px'>{to_time}:</td>\n\t<td style='font-size:16px'>" . field_text("ttime-{$t}", $TTIME["ttime"], "font-size:22px;width:130px;text-align:right") . "\n\t</tr>\n\t</table>\n\t</td>\n\t</tr>\n\t<tr>\n\t\t<td style='font-size:26px;vertical-align:top'>{days}:<hr></td>\n\t\t<td>" . @implode("", $tr) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "Save{$t}()", 40) . "</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);}\n\t\$('#FIREWALL_NIC_RULES').flexReload();\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('time-save',  '{$ID}');\n\tXHR.appendData('ttime',  document.getElementById('ttime-{$t}').value);\n\tXHR.appendData('ftime',  document.getElementById('ftime-{$t}').value);\n\tif(document.getElementById('enabled-{$t}').checked){ XHR.appendData('enablet',1); }else{ XHR.appendData('enablet',0); }\n\t" . @implode("\n", $jsF) . "\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n\nfunction EnableCK{$t}(){\n\tif(document.getElementById('enabled-{$t}').checked){\n\t\tdocument.getElementById('ttime-{$t}').disabled=false;\n\t\tdocument.getElementById('ftime-{$t}').disabled=false;\n\t\t" . @implode("\n", $jsE) . "\n\t}else{\n\t\tdocument.getElementById('ttime-{$t}').disabled=true;\n\t\tdocument.getElementById('ftime-{$t}').disabled=true;\n\t\t" . @implode("\n", $jsD) . "\n}\n\n\n}\n\nEnableCK{$t}();\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #3
0
function popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $t = time();
    $sock = new sockets();
    $squid = new squidbee();
    $EnableSS5 = intval($sock->GET_INFO("EnableSS5"));
    $EnableSS5P = Paragraphe_switch_img("{EnableSS5}", "{APP_SS5_ABOUT}", "EnableSS5", $EnableSS5, null, 900);
    $SS5_SOCKS_PORT = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SS5_SOCKS_PORT"));
    $SS5_SOCKS_INTERFACE = @file_get_contents("/etc/artica-postfix/settings/Daemons/SS5_SOCKS_INTERFACE");
    $ip = new networking();
    $interfaces = $ip->Local_interfaces();
    unset($interfaces["lo"]);
    $array[null] = "{all}";
    if ($SS5_SOCKS_PORT == 0) {
        $SS5_SOCKS_PORT = rand(1024, 63000);
    }
    while (list($eth, $none) = each($interfaces)) {
        if (preg_match("#^gre#", $eth)) {
            continue;
        }
        $nic = new system_nic($eth);
        $array[$eth] = "{$eth} {$nic->IPADDR} - {$nic->NICNAME}";
    }
    $html = "\n\t<div style='font-size:32px;margin-bottom:30px'>{APP_SS5}</div>\n\t<div style=width:98% class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t<td style='vertical-align:top;width:285px'><div id='services-ss5-status'></div></td>\n\t<td style='vertical-align:top;width:915px'>\n\t<div style='width:98%' class=form>\n\t{$EnableSS5P}\n\t<hr>\n\t\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:24px;font-wieght:bold'>{listen_interface}:</td>\n\t\t<td style='font-size:20px'>" . Field_array_Hash($array, "SS5_SOCKS_INTERFACE", $SS5_SOCKS_INTERFACE, "style:font-size:24px;font-wieght:bold") . "</td>\n\t\t\n\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:24px;font-wieght:bold'>{listen_port}:</td>\n\t\t<td style='font-size:20px'>" . field_text("SS5_SOCKS_PORT", $SS5_SOCKS_PORT, "font-size:24px;width:90px;font-wieght:bold") . "</td>\n\t</tr>\n\t</table>\n\t\n\t<div style='text-align:right;margin-top:50px'>" . button("{apply}", "Save{$t}()", 40) . "</div>\n\t</div>\n\t</td>\n\t</tr>\n\t</table>\n\t<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\tLoadjs('ss5.progress.php');\n}\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('EnableSS5', document.getElementById('EnableSS5').value);\n\tXHR.appendData('SS5_SOCKS_INTERFACE', document.getElementById('SS5_SOCKS_INTERFACE').value);\n\tXHR.appendData('SS5_SOCKS_PORT', document.getElementById('SS5_SOCKS_PORT').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n\tLoadAjax('services-ss5-status','{$page}?services-ss5-status=yes',false);\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $warn_restore_articadb = $tpl->javascript_parse_text("{warn_restore_articadb}");
    $html = "\n\t<div style='font-size:14px' class=explain>{zarafadb_restore_explain}</div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{backup_file}:</td>\n\t\t<td>" . field_text("backup{$t}", null, "font-size:16px;width:210px") . "</td>\n\t\t<td>" . button("{browse}", "Loadjs('tree.php?target-form=backup{$t}')", 13) . "</td>\n\t</tr>\n\t<tr>\n\t<td colspan=3 align='right'><hr>" . button("{restore}", "Restore{$t}()", 18) . "</td>\n\t</tr>\n\t</table>\t\t\n\t<div id='start-{$t}'></div>\t\t\n\t<script>\n\t\tvar x_Restore{$t}= function (obj) {\n\t      var tempvalue=obj.responseText;\n\t      if(tempvalue.length>3){alert(tempvalue);}\n\t      document.getElementById('start-{$t}').innerHTML='';\n\t      LoadAjax('start-{$t}','{$page}?logs-starter=yes&t={$t}');\n\t      }\t\t\n\t\t\n\t\tfunction Restore{$t}(){\n\t\t\tvar path=document.getElementById('backup{$t}').value;\n\t\t\tif(!confirm('{$warn_restore_articadb}')){return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('restore-path',path);\n\t\t\tAnimateDiv('start-{$t}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_Restore{$t});\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tvar x_GetLogs{$t}= function (obj) {\n\t      var tempvalue=obj.responseText;\n\t      if(tempvalue.length>3){\n\t      \tdocument.getElementById('textToParseCats-{$t}').innerHTML=tempvalue;\n\t       }\n\t      if(!YahooWin3Open()){return;}\n\t      setTimeout(\"GetLogs{$t}()\",1000);\n\t      }\t\n\n\t      \n\t\tfunction GetLogs{$t}(){\n\t\t\tif(!YahooWin3Open()){return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('restore-logs','yes');\n\t\t\tXHR.appendData('t','{$t}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_GetLogs{$t});\t\t\n\t\t\n\t\t}\n\t\t\n\t</script>\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #5
0
function popup()
{
    $q = new mysql_squid_builder();
    $ID = $_GET["ID"];
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    if (!$q->FIELD_EXISTS("proxy_ports", "FTPProxyMaxClients")) {
        $q->QUERY_SQL("ALTER TABLE `proxy_ports` ADD `FTPProxyMaxClients` BIGINT(100) NOT NULL DEFAULT '64'");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    if (!$q->FIELD_EXISTS("proxy_ports", "FTPProxyTimeOuts")) {
        $q->QUERY_SQL("ALTER TABLE `proxy_ports` ADD `FTPProxyTimeOuts` INT(100) NOT NULL DEFAULT '360'");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    if (!$q->FIELD_EXISTS("proxy_ports", "FTPProxyDestinationTransferMode")) {
        $q->QUERY_SQL("ALTER TABLE `proxy_ports` ADD `FTPProxyDestinationTransferMode` VARCHAR(32) NOT NULL DEFAULT 'client'");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    if (!$q->FIELD_EXISTS("proxy_ports", "FTPUserAuthMagic")) {
        $q->QUERY_SQL("ALTER TABLE `proxy_ports` ADD `FTPUserAuthMagic` VARCHAR(128) NOT NULL DEFAULT '@user'");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    if (!$q->FIELD_EXISTS("proxy_ports", "FTPUseMagicChar")) {
        $q->QUERY_SQL("ALTER TABLE `proxy_ports` ADD `FTPUseMagicChar` VARCHAR(32) NOT NULL DEFAULT '@'");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    if (!$q->FIELD_EXISTS("proxy_ports", "FTPAllowMagicUser")) {
        $q->QUERY_SQL("ALTER TABLE `proxy_ports` ADD `FTPAllowMagicUser` SMALLINT(1) NOT NULL DEFAULT '1'");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    $DestinationTransferModeR["client"] = "client";
    $DestinationTransferModeR["passive"] = "passive";
    $DestinationTransferModeR["active"] = "active";
    $ligne = @mysql_fetch_array($q->QUERY_SQL("SELECT * FROM proxy_ports WHERE ID={$ID}"));
    $html = "\n<div style='width:98%' class=form>\n<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{MaxClients}:</td>\n\t\t<td style='font-size:18px'>" . field_text("FTPProxyMaxClients-{$t}", $ligne["FTPProxyMaxClients"], "font-size:20px;width:120px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{timeout2} ({seconds}):</td>\n\t\t<td style='font-size:18px'>" . field_text("FTPProxyTimeOuts-{$t}", $ligne["FTPProxyTimeOuts"], "font-size:20px;width:120px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>" . texttooltip("{FTPProxyDestinationTransferMode}", "{FTPProxyDestinationTransferMode_explain}") . ":</td>\n\t\t<td style='font-size:20px'>" . Field_array_Hash($DestinationTransferModeR, "FTPProxyDestinationTransferMode-{$t}", $ligne["FTPProxyDestinationTransferMode"], "style:font-size:20px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>" . texttooltip("{FTPAllowMagicUser}", "{FTPAllowMagicUser_explain}") . ":</td>\n\t\t\t<td style='font-size:20px'>" . Field_checkbox_design("FTPAllowMagicUser-{$t}", 1, $ligne["FTPAllowMagicUser"]) . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>" . texttooltip("{UserAuthMagic}", "{UserAuthMagic_explain}") . ":</td>\n\t\t<td style='font-size:18px'>" . field_text("FTPUserAuthMagic-{$t}", $ligne["FTPUserAuthMagic"], "font-size:20px;width:220px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>" . texttooltip("{FTPUseMagicChar}", "{FTPUseMagicChar_explain}") . ":</td>\n\t\t<td style='font-size:18px'>" . field_text("FTPUseMagicChar-{$t}", $ligne["FTPUseMagicChar"], "font-size:20px;width:220px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n<tr>\n\t<td colspan=2 align='right'><hr>" . button("{apply}", "Save{$t}()", 32) . "</td>\n</tr>\n</table>\n</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){ alert(results); return; }\n\tRefreshTab('main_proxy_listen_ports');\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('FTPProxyMaxClients',document.getElementById('FTPProxyMaxClients-{$t}').value);\n\tXHR.appendData('FTPProxyTimeOuts',document.getElementById('FTPProxyTimeOuts-{$t}').value);\n\tXHR.appendData('FTPProxyDestinationTransferMode',document.getElementById('FTPProxyDestinationTransferMode-{$t}').value);\n\tXHR.appendData('FTPUserAuthMagic',document.getElementById('FTPUserAuthMagic-{$t}').value);\n\tXHR.appendData('FTPUseMagicChar',document.getElementById('FTPUseMagicChar-{$t}').value);\n\tif(document.getElementById('FTPAllowMagicUser-{$t}').checked){XHR.appendData('FTPAllowMagicUser',1);}else{XHR.appendData('FTPAllowMagicUser',0);}\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #6
0
 function setting_field_render($setting_id)
 {
     $CI =& get_instance();
     $row = $CI->db->get_where('settings', array('id' => $setting_id))->row();
     if (!$row || empty($row)) {
         return FALSE;
     }
     $html = NULL;
     switch ($row->type) {
         case 'text':
             $html .= field_text($row->key, empty($row->value) ? $row->default_value : $row->value);
             break;
         case 'textarea':
             $html .= field_textarea($row->key, empty($row->value) ? $row->default_value : $row->value);
             break;
         case 'date':
             $html .= field_date($row->key, empty($row->value) ? $row->default_value : $row->value);
             break;
         case 'select':
             $options = array();
             if (!empty($row->options)) {
                 $rows = unserialize($row->options);
                 if (isset($rows['value']) && is_array($rows['value']) && count($rows['value'])) {
                     foreach ($rows['value'] as $key => $value) {
                         $options[$value] = isset($rows['title'][$key]) ? $rows['title'][$key] : '';
                     }
                 }
             }
             $html .= field_select($row->key, $options, empty($row->value) ? $row->default_value : $row->value, 'class="input-block-level form-control"');
             break;
         case 'boolen':
             $options = array();
             if (!empty($row->options)) {
                 $rows = unserialize($row->options);
                 if (isset($rows['value']) && is_array($rows['value']) && count($rows['value'])) {
                     foreach ($rows['value'] as $key => $value) {
                         $options[$value] = isset($rows['title'][$key]) ? $rows['title'][$key] : '';
                     }
                 }
             }
             $html .= field_select($row->key, $options, empty($row->value) ? $row->default_value : $row->value, 'class="input-block-level form-control"');
             break;
     }
     return $html;
 }
Example #7
0
function start_4()
{
    $t = $_GET["t"];
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $DHCPWizard = unserialize($sock->GET_INFO("DHCPWizard"));
    $dhcp = new dhcpd(0, 1);
    $nicz = new system_nic($DHCPWizard["NIC"]);
    $dhcp_wizard_4 = $tpl->_ENGINE_parse_body("{dhcp_wizard_4}");
    $dhcp_wizard_4 = str_replace("%i", $DHCPWizard["NIC"], $dhcp_wizard_4);
    $dhcp_wizard_4 = str_replace("%n", "{$DHCPWizard["SUBNET"]}/{$DHCPWizard["NETMASK"]}", $dhcp_wizard_4);
    $dhcp_wizard_4 = str_replace("%t", "{$DHCPWizard["RANGE1"]} - {$DHCPWizard["RANGE2"]}", $dhcp_wizard_4);
    if ($DHCPWizard["GATEWAY"] == null) {
        $DHCPWizard["GATEWAY"] = $nicz->IPADDR;
    }
    if ($DHCPWizard["DNS1"] == null) {
        $DHCPWizard["DNS1"] = $nicz->IPADDR;
    }
    if ($DHCPWizard["DNS2"] == null) {
        $DHCPWizard["DNS2"] = "8.8.8.8";
    }
    $html = "<div style='font-size:26px;margin-bottom:40px'>{network_parameters}</div>\n\t<div style='font-size:18px;margin-bottom:20px'>{$dhcp_wizard_4}<br>{welcome_to_dhcp_wizard_4}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{gateway}:</td>\n\t\t\t<td>" . field_ipv4("gateway-{$t}", $DHCPWizard["GATEWAY"], 'font-size:22px;padding:3px;font-weight:bold') . "&nbsp;</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{ddns_domainname}:</td>\n\t\t\t<td>" . field_text("DOMAINNAME-{$t}", $DHCPWizard["DOMAINNAME"], 'font-size:22px;width:250px;padding:3px;font-weight:bold') . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{DNSServer} 1:</td>\n\t\t\t<td>" . field_ipv4("DNS1-{$t}", $DHCPWizard["DNS1"], 'font-size:22px;padding:3px;font-weight:bold') . "&nbsp;</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{DNSServer} 2:</td>\n\t\t\t<td>" . field_ipv4("DNS2-{$t}", $DHCPWizard["DNS2"], 'font-size:22px;padding:3px;font-weight:bold') . "&nbsp;</td>\n\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t</table>\n<div style='text-align:right;width:100%'><HR>" . button("{build_parameters}", "Start4{$t}()", 30) . "</div>\n</div>\n\n<script>\nvar xStart4{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\tLoadjs('dhcpd.wizard.progress.php');\n}\n\nfunction Start4{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('GATEWAY',document.getElementById('gateway-{$t}').value);\n\tXHR.appendData('DNS1',document.getElementById('DNS1-{$t}').value);\n\tXHR.appendData('DNS2',document.getElementById('DNS2-{$t}').value);\n\tXHR.appendData('DOMAINNAME',document.getElementById('DOMAINNAME-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xStart4{$t});\n}\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function wizard3()
{
    if (!isset($_SESSION["WIZINSTANCE"]["WIZIPADDR"])) {
        wizard2();
        exit;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $ldap = new clladp();
    $ous = $ldap->hash_get_ou(true);
    $ous[null] = "{none}";
    $html = "<strong style='font-size:16px'>{Interface}:{$_SESSION["WIZINSTANCE"]["WIZINTERFACE"]}&nbsp;|&nbsp;{$_SESSION["WIZINSTANCE"]["WIZIPADDR"]}/{$_SESSION["WIZINSTANCE"]["WIZIPMASK"]}</strong>\n\t<div class=explain style='font-size:14px'>{welcome_new_instance_wizard_organdname}</div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{organization}:</td>\n\t\t<td>" . Field_array_Hash($ous, "WIZOU", $_SESSION["WIZINSTANCE"]["WIZOU"], "style:font-size:16px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{hostname}:</td>\n\t\t<td>" . field_text("WIZHOST", $_SESSION["WIZINSTANCE"]["WIZHOST"], "font-size:16px;width:240px;font-weight:bolder") . "</td>\n\t</tr>\t\n\t<tr>\n\t<tr>\n\t\t<td colspan=2><hr></td>\n\t</tr>\n\t<tr>\n\t\n\t\t<td align='left'>" . button("{previous}", "LoadAjax('new_instance_wizard','{$page}?wiz2=yes');", 16) . "</td>\n\t\t<td colspan=2 align='right'>" . button("{next}", "WIZ_WIZHOST()", 16) . "</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t<script>\n\tvar XWIZ_WIZ_WIZHOST= function (obj) {\n\t var results=obj.responseText;\n\t if(results.length>3){alert(results);return;}\n\t \tWIZMULTI4();\n\t}\t\n\t\n\tfunction WIZ_WIZHOST(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('WIZOU',document.getElementById('WIZOU').value);\n\t\tXHR.appendData('WIZHOST',document.getElementById('WIZHOST').value);\n\t\tAnimateDiv('new_instance_wizard');\n\t\tXHR.sendAndLoad('{$page}', 'POST',XWIZ_WIZ_WIZHOST);\t\n\t}\n\t\n\t</script>\t\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #9
0
function vsftpd_settings()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $sock = new sockets();
    $t = time();
    $VsFTPDPassive = $sock->GET_INFO("VsFTPDPassive");
    if (!is_numeric($VsFTPDPassive)) {
        $VsFTPDPassive = 1;
    }
    $VsFTPDPassiveAddr = $sock->GET_INFO("VsFTPDPassiveAddr");
    $pasv_min_port = intval($sock->GET_INFO("VsFTPDPassiveMinPort"));
    $pasv_max_port = intval($sock->GET_INFO("VsFTPDPassiveMaxPort"));
    $VsFTPDFileOpenMode = $sock->GET_INFO("VsFTPDFileOpenMode");
    $VsFTPDLocalUmask = $sock->GET_INFO("VsFTPDLocalUmask");
    if ($VsFTPDFileOpenMode == null) {
        $VsFTPDFileOpenMode = "0666";
    }
    if ($VsFTPDLocalUmask == null) {
        $VsFTPDLocalUmask = "077";
    }
    $ProFTPDRootLogin = intval($sock->GET_INFO("ProFTPDRootLogin"));
    $VsFTPDLocalMaxRate = intval($sock->GET_INFO("VsFTPDLocalMaxRate"));
    $umask["022"] = "{permissive} 755";
    $umask["026"] = "{moderate} 751";
    $umask["027"] = "{moderate} 750";
    $umask["077"] = "{severe}\t700";
    if ($pasv_min_port == 0) {
        $pasv_min_port = 40000;
    }
    if ($pasv_max_port == 0) {
        $pasv_max_port = 40200;
    }
    $html = "\n<div style='width:98%' class=form>\n\t\t" . Paragraphe_switch_img("{enable_passive_mode}", "{enable_passive_mode_explain}", "VsFTPDPassive", $VsFTPDPassive, null, 650) . "\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{pasv_min_port}:</td>\n\t\t\t<td>" . field_text("VsFTPDPassiveMinPort", $pasv_min_port, "explain={pasv_minmax_port_explain};font-size:18px;width:110px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{pasv_max_port}:</td>\n\t\t\t<td>" . field_text("VsFTPDPassiveMaxPort", $pasv_max_port, "explain={pasv_minmax_port_explain};font-size:18px;width:110px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{pasv_address}:</td>\n\t\t\t<td>" . field_ipv4("VsFTPDPassiveAddr", $VsFTPDPassiveAddr, "explain={pasv_address_explain};font-size:18px") . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{files_permissions}:</td>\n\t\t\t<td>" . field_text("VsFTPDFileOpenMode", $VsFTPDFileOpenMode, "explain={VsFTPDFileOpenMode};font-size:18px;width:110px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{directories_permissions}:</td>\n\t\t\t<td>" . Field_array_Hash($umask, "VsFTPDLocalUmask", $VsFTPDLocalUmask, "style:font-size:18px") . "</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{PermitRootLogin}:</td>\n\t\t\t<td style='font-size:18px'>" . Field_checkbox_design("ProFTPDRootLogin", 1, "{$ProFTPDRootLogin}") . "</td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{max_rate}:</td>\n\t\t\t<td style='font-size:18px'>" . field_text("VsFTPDLocalMaxRate", "{$VsFTPDLocalMaxRate}", "font-size:18px;width:110px") . "&nbsp;Ko/s</td>\n\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t</table>\n\t<div style='text-align:right'><hr>" . button("{apply}", "Save{$t}();", 26) . "</div>\n</div>\n<script>\nvar x_Save{$t}= function (obj) {\n\t\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\tif(document.getElementById('vsftpd_tabs')){RefreshTab('vsftpd_tabs');}\n\tLoadjs('proftpd.progress.php');\n}\t\n\t\nfunction Save{$t}(){\n\tvar ProFTPDRootLogin=0;\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('VsFTPDPassive',document.getElementById('VsFTPDPassive').value);\n\tXHR.appendData('VsFTPDPassiveAddr',document.getElementById('VsFTPDPassiveAddr').value);\n\t\n\tXHR.appendData('VsFTPDPassiveMinPort',document.getElementById('VsFTPDPassiveMinPort').value);\n\tXHR.appendData('VsFTPDPassiveMaxPort',document.getElementById('VsFTPDPassiveMaxPort').value);\n\tXHR.appendData('VsFTPDFileOpenMode',document.getElementById('VsFTPDFileOpenMode').value);\n\tXHR.appendData('VsFTPDLocalUmask',document.getElementById('VsFTPDLocalUmask').value);\n\tXHR.appendData('VsFTPDLocalMaxRate',document.getElementById('VsFTPDLocalMaxRate').value);\n\tif(document.getElementById('ProFTPDRootLogin').checked){ProFTPDRootLogin=1;}\n\tXHR.appendData('ProFTPDRootLogin',ProFTPDRootLogin);\n\tXHR.sendAndLoad('{$page}', 'POST',x_Save{$t});\t\n}\n</script>\t\t\t\n\t\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #10
0
function add_form()
{
    $ldap = new clladp();
    $sock = new sockets();
    $page = CurrentPageName();
    $users = new usersMenus();
    $tpl = new templates();
    $t = $_GET["t"];
    if (!is_numeric($t)) {
        $t = 0;
    }
    $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    $title_button = "{add}";
    if (!is_numeric($_GET["ID"])) {
        $_GET["ID"] = 0;
    }
    if ($_GET["ID"] > 0) {
        $sql = "SELECT * FROM nics_vde WHERE ID='{$_GET["ID"]}'";
        $q = new mysql();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $title_button = "{apply}";
    }
    for ($i = 1; $i < 33; $i++) {
        $ports[$i] = $i;
    }
    $vlans[0] = "{none}";
    for ($i = 1; $i < 256; $i++) {
        $vlans[$i] = $i;
    }
    if (isset($_GET["default-datas"])) {
        $default_array = unserialize(base64_decode($_GET["default-datas"]));
        if (is_array($default_array)) {
            $ligne["nic"] = $default_array["NIC"];
            if (preg_match("#(.+?)\\.([0-9]+)\$#", $default_array["IP"], $re)) {
                if ($re[2] > 254) {
                    $re[2] = 1;
                }
                $re[2] = $re[2] + 1;
                $ligne["ipaddr"] = "{$re[1]}.{$re[2]}";
                $ligne["gateway"] = $default_array["GW"];
                $ligne["netmask"] = $default_array["NETMASK"];
            }
        }
    }
    if ($ligne["metric"] == 0) {
        $ligne["metric"] = 100 + $_GET["ID"];
    }
    $styleOfFields = "font-size:16px;padding:3px";
    while (list($num, $val) = each($nics)) {
        if (preg_match("#^virt#", $val)) {
            continue;
        }
        $nics_array[$val] = $val;
    }
    $nics_array[null] = "{select}";
    if (!is_numeric($ligne["port"])) {
        $ligne["port"] = 1;
    }
    $nic_field = Field_array_Hash($nics_array, "nic-{$t}", $ligne["nic"], null, null, 0, "font-size:16px;padding:3px");
    $port_field = Field_array_Hash($ports, "port-{$t}", $ligne["port"], null, null, 0, "font-size:16px;padding:3px");
    $vlan_field = Field_array_Hash($vlans, "vlan-{$t}", $ligne["vlan"], null, null, 0, "font-size:16px;padding:3px");
    $html = "\n<div id='animate-{$t}'></div>\n<div id='virtip'>" . Field_hidden("ID", "{$_GET["ID"]}") . "\n<div style='width:98%' class=form>\n<table style='width:99%'>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{nic}:</td>\n\t\t<td>{$nic_field}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{vlan_id}:</td>\n\t\t<td>{$vlan_field}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{switch_port}:</td>\n\t\t<td>{$port_field}</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{tcp_address}:</td>\n\t\t<td>" . field_ipv4("ipaddr-{$t}", $ligne["ipaddr"], $styleOfFields, false, "CalcCdirVirt{$t}(0)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{netmask}:</td>\n\t\t<td>" . field_ipv4("netmask-{$t}", $ligne["netmask"], $styleOfFields, false, "CalcCdirVirt{$t}(0)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>CDIR:</td>\n\t\t\t<td style='padding:-1px;margin:-1px'>\n\t\t\t<table style='width:99%;padding:-1px;margin:-1px'>\n\t\t\t<tr>\n\t\t\t<td width=1%>\n\t\t\t" . Field_text("cdir-{$t}", $ligne["cdir"], "{$styleOfFields};width:190px", null, null, null, false, null, $DISABLED) . "</td>\n\t\t\t<td align='left'> " . imgtootltip("img_calc_icon.gif", "cdir", "CalcCdirVirt{$t}(1)") . "</td>\n\t\t\t</tr>\n\t\t\t</table></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{gateway}:</td>\n\t\t\t<td>" . field_ipv4("gateway-{$t}", $ligne["gateway"], $styleOfFields, false) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{metric}:</td>\n\t\t\t<td>" . field_text("metric-{$t}", $ligne["metric"], "{$styleOfFields};width:90px", false) . "</td>\n\t\t</tr>\n\t</table>\n\t</div>\n\n\t<div id='infosVirtual' style='font-size:13px'></div>\n\t<div style='text-align:right'><hr>" . button($title_button, "Save{$t}()", 18) . "</div>\n</div>\n<script>\nvar Netid={$_GET["ID"]};\nvar cdir=document.getElementById('cdir-{$t}').value;\nvar netmask=document.getElementById('netmask-{$t}').value;\nif(netmask.length>0){if(cdir.length==0){CalcCdirVirt{$t}(0);}}\n\n\nvar X_CalcCdirVirt{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tdocument.getElementById('cdir-{$t}').value=results;\n}\n\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tdocument.getElementById('animate-{$t}').innerHTML='';\n\tif(results.length>3){alert(results);return;}\n\t\$('#table-{$t}').flexReload();\n\tYahooWin4Hide();\n\t\n}\n\nfunction CalcCdirVirt{$t}(recheck){\n\tvar cdir=document.getElementById('cdir-{$t}').value;\n\tif(recheck==0){if(cdir.length>0){return;}}\n\tvar XHR = new XHRConnection();\n\tXHR.setLockOff();\n\tXHR.appendData('cdir-ipaddr',document.getElementById('ipaddr-{$t}').value);\n\tXHR.appendData('netmask',document.getElementById('netmask-{$t}').value);\n\tXHR.sendAndLoad('artica.settings.php', 'GET',X_CalcCdirVirt{$t});\n}\t\n\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ipaddr',document.getElementById('ipaddr-{$t}').value);\n\tXHR.appendData('netmask',document.getElementById('netmask-{$t}').value);\n\tXHR.appendData('cdir',document.getElementById('cdir-{$t}').value);\n\tXHR.appendData('metric',document.getElementById('metric-{$t}').value);\n\tXHR.appendData('nic',document.getElementById('nic-{$t}').value);\n\tXHR.appendData('gateway',document.getElementById('gateway-{$t}').value);\n\tXHR.appendData('port',document.getElementById('port-{$t}').value);\n\tXHR.appendData('vlan',document.getElementById('vlan-{$t}').value);\n\tXHR.appendData('ID','{$_GET["ID"]}');\n\tMemFlexGrid={$t};\n\tAnimateDiv('animate-{$t}');\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #11
0
function rule_time(){
	$page=CurrentPageName();
	$tpl=new templates();
	$eth=$_GET["eth"];
	$ethC=new system_nic($eth);
	$table=$_GET["table"];
	$ID=$_GET["ID"];
	$t=time();	
	$q=new mysql();
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT * FROM iptables_main WHERE ID='$ID'","artica_backup"));
	$title="{time_restriction}: $eth::".$tpl->javascript_parse_text($ligne["rulename"]);
	$enabled=$ligne["enabled"];
	$table=$ligne["MOD"];
	$eth=$ligne["eth"];
	$bt="{apply}";	
	
	$array_days=array(
			1=>"monday",
			2=>"tuesday",
			3=>"wednesday",
			4=>"thursday",
			5=>"friday",
			6=>"saturday",
			7=>"sunday",
	);
	
	$TTIME=unserialize($ligne["time_restriction"]);
	
	$tr[]="<table>";
	
	while (list ($num, $maks) = each ($array_days)){
		
		$tr[]="<tr>
				<td class=legend style='font-size:16px'>{{$maks}}</td>
				<td>". Field_checkbox("D{$num}-$t", 1,$TTIME["D{$num}"])."</td>
			</tr>";
		$jsF[]="if(document.getElementById('D{$num}-$t').checked){XHR.appendData('D{$num}',1); }else{ XHR.appendData('D{$num}',0); }";
		$jsD[]="document.getElementById('D{$num}-$t').disabled=true;";
		$jsE[]="document.getElementById('D{$num}-$t').disabled=false;";
		
	}
	$tr[]="</table>";
	
	if($TTIME["ftime"]==null){$TTIME["ftime"]="20:00:00";}
	if($TTIME["ttime"]==null){$TTIME["ttime"]="23:59:00";}
	
	$html="
<div style='width:98%' class=form>
	<div style='font-size:18px;margin-bottom:25px;margin-top:10px;margin-left:5px'>[$table] $title</div>
	<table style='width:100%'>
	<tr>
	<td class=legend style='font-size:16px'>{enabled}:</td>
	<td style='font-size:16px'>". Field_checkbox("enabled-$t", 1,$ligne["enablet"],"EnableCK$t()")."
	</tr>
	<tr>
	<td class=legend style='font-size:16px'>{from_time}:</td>
	<td style='font-size:16px'>". field_text("ftime-$t",$TTIME["ftime"],"font-size:16px;width:110px")."
	</tr>
	<tr>
	<td class=legend style='font-size:16px'>{to_time}:</td>
	<td style='font-size:16px'>". field_text("ttime-$t",$TTIME["ttime"],"font-size:16px;width:110px")."
	</tr>	
	<tr>
		<td style='font-size:22px'>{days}:</td>
		<td colspan=2>".@implode("", $tr)."</td>
	</tr>
	<tr>
		<td colspan=2 align='right'><hr>". button("{apply}","Save$t()",22)."</td>
	</tr>	
	</table>
</div>
<script>

var xSave$t= function (obj) {
	var res=obj.responseText;
	if (res.length>3){alert(res);}
	var ID=$ID;
	$('#flexRT{$_GET["t"]}').flexReload();
	ExecuteByClassName('SearchFunction');
}

function Save$t(){
	var XHR = new XHRConnection();
	XHR.appendData('time-save',  '$ID');
	XHR.appendData('ttime',  document.getElementById('ttime-$t').value);
	XHR.appendData('ftime',  document.getElementById('ftime-$t').value);
	if(document.getElementById('enabled-$t').checked){ XHR.appendData('enablet',1); }else{ XHR.appendData('enablet',0); }
	".@implode("\n", $jsF)."
	XHR.sendAndLoad('$page', 'POST',xSave$t);
		
	}
	
function EnableCK$t(){
	if(document.getElementById('enabled-$t').checked){ 
		document.getElementById('ttime-$t').disabled=false;
		document.getElementById('ftime-$t').disabled=false;
		".@implode("\n", $jsE)."
	}else{
		document.getElementById('ttime-$t').disabled=true;
		document.getElementById('ftime-$t').disabled=true;
		".@implode("\n", $jsD)."				
	
	}
	

}
				
EnableCK$t();
</script>";
echo $tpl->_ENGINE_parse_body($html);
	
}
Example #12
0
function ipconfig_nic(){
	$sock=new sockets();
	$tpl=new templates();
	$t=time();
	$page=CurrentPageName();
	$EnableipV6=$sock->GET_INFO("EnableipV6");
	if(!is_numeric($EnableipV6)){$EnableipV6=0;}	
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	$DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement");
	if(!is_numeric($DisableNetworksManagement)){$DisableNetworksManagement=0;}	
	$eth=$_GET["nic"];
	
	$nic=new system_nic($eth);
	$users=new usersMenus();
	if($users->SNORT_INSTALLED){
		$EnableSnort=$sock->GET_INFO("EnableSnort");
		if($EnableSnort<>1){$jsSnort="DisableSnortInterface();";}
		$snortInterfaces=unserialize(base64_decode($sock->GET_INFO("SnortNics")));

	}
	if(!$users->SNORT_INSTALLED){$jsSnort="DisableSnortInterface();";}
	$button="{apply}";
	if($_GET["button"]=="confirm"){$button="{button_i_confirm_nic}";}
	
	$MIITOOLS=unserialize(base64_decode($sock->getFrameWork("system.php?mii-tools=yes&eth=$eth")));
	$form_miitolsA[null]="{select}";
	if(!$MIITOOLS["STATUS"]){
		$form_miitols="<p class=text-error>{hardware_error_nic}<br>{$MIITOOLS["ERROR"]}</p>";
		
	}else{
		$form_miitolsHT["HD"]="Half duplex";
		$form_miitolsHT["FD"]="Full duplex";
		
		while (list ($val, $b) = each ($MIITOOLS["CAP"])){
			$caption=$val;
			if(strpos($MIITOOLS["INFOS"], $val)>0){$MII_DEFAULT=$val;}
			if(preg_match("#([0-9]+)(.*?)-([A-Z]+)#", $val,$re)){
				$caption="{$re[1]} {$re[2]} {$form_miitolsHT[$re[3]]}";
			}
			
			$form_miitolsA[$val]=$caption;
			
		}
		
		if($MIITOOLS["FLOWC"]==1){$explflw=" {flow_control}";}
		$form_miitols="
		<p class=text-info style='font-size:18px;font-weight:bold'>{$MIITOOLS["INFOS"]} $explflw</p>
		<table style='width:100%'>			
		<tr>
			<td class=legend style='font-size:18px'>Autonegotiation:</td>
			<td width=1%>" . Field_checkbox("autonegotiation-$t",1,$MIITOOLS["AUTONEG"])."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:18px'>{flow_control}:</td>
			<td width=1%>" . Field_checkbox("flow-control-$t",1,$MIITOOLS["FLOWC"])."</td>
		</tr>					
					
					
		<tr>
			<td class=legend style='font-size:18px'>{type}:</td>
			<td width=1%>" . Field_array_Hash($form_miitolsA, "media-$t",$MII_DEFAULT,"style:font-size:18px")."</td>
		</tr>
		</table>
		<div style='text-align:right'><hr> ". button("{apply}","SaveMII$t()",22)."</div>";		
	}
	
	
	
	$html="
	<div id='edit-config-$eth'>
	<form name='ffm$eth'>
	<input type='hidden' name='save_nic' id='save_nic' id='save_nic' value='$eth'>
	<table style='width:100%'>
		<tr>
			<td class=legend style='font-size:22px'>{enabled}:</td>
			<td width=1%>" . Field_checkbox_design('enabled',1,$nic->enabled,'SwitchDHCP()')."</td>
		</tr>		
		<tr>
			<td class=legend style='font-size:22px'>{use_dhcp}:</td>
			<td width=1%>" . Field_checkbox_design('dhcp',1,$nic->dhcp,'SwitchDHCP()')."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:22px'>{enable_ids}:</td>
			<td width=1%>" . Field_checkbox_design('UseSnort',1,$snortInterfaces[$eth],'SwitchSnort()')."</td>
		</tr>
	</table>
	
	
	<div style='width:98%' class=form>
	<table style='100%'>
		<tr>
			<td class=legend style='font-size:22px'>{netzone}:</td>
			<td>" . field_text("netzone-$t",$nic->netzone,'padding:3px;font-size:22px;width:325px',null,null,null,false,null,$DISABLED)."</td>
		</tr>				
		<tr>
			<td class=legend style='font-size:22px'>{name}:</td>
			<td>" . field_text("NICNAME-$t",$nic->NICNAME,'padding:3px;font-size:22px',null,null,null,false,null,$DISABLED)."</td>
		</tr>		
		<tr>
			<td class=legend style='font-size:22px'>{tcp_address}:</td>
			<td>" . field_ipv4("IPADDR",$nic->IPADDR,'padding:3px;font-size:22px',null,null,null,false,null,$DISABLED)."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:22px'>{netmask}:</td>
			<td>" . field_ipv4("NETMASK",$nic->NETMASK,'padding:3px;font-size:22px',null,null,null,false,null,$DISABLED)."</td>
		</tr>
			
		<tr>
			<td class=legend style='font-size:22px'>{gateway}:</td>
			<td>" . field_ipv4("GATEWAY",$nic->GATEWAY,'padding:3px;font-size:22px',null,null,null,false,null,$DISABLED)."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:22px'>{default_gateway}:</td>
			<td>" . Field_checkbox_design("defaultroute-$t",1,$nic->defaultroute)."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:22px'>{metric}:</td>
			<td>" . field_text("metric-$t",$nic->metric,'padding:3px;font-size:22px;width:90px',null,null,null,false,null,$DISABLED)."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:22px'>MTU:</td>
			<td>" . field_text("mtu-$t",$nic->mtu,'padding:3px;font-size:22px;width:90px',null,null,null,false,null,$DISABLED)."</td>
		</tr>										
		<tr>
			<td class=legend style='font-size:22px'>{broadcast}:</td>
			<td>" . field_ipv4("BROADCAST",$nic->BROADCAST,'padding:3px;font-size:22px',null,null,null,false,null,$DISABLED)."</td>
		</tr>	
			
	</table>
	<div style='text-align:right'><hr> ". button("$button","SaveNicSettings()",28)."</div>
	</div>
	
	
	</form>
	</div>
	<p>&nbsp;</p>
	<div style='width:98%' class=form>
	<div style='font-size:22px;margin-bottom:12px'>{net_mii_title}</div>
	$form_miitols
	</div>
	
	<script>
	
		var X_SaveNicSettings= function (obj) {
			var results=obj.responseText;
			if(results.length>3){alert(results);}
			if(document.getElementById('main_config_$eth')){RefreshTab('main_config_$eth');}
			if(document.getElementById('wizard-nic-list')){WizardRefreshNics();}
			}

		function logofff(){
			var ipaddr=document.getElementById('IPADDR').value;
			document.location.href='https://'+ipaddr+':{$_SERVER['SERVER_PORT']}';
		}
	
		function SaveNicSettings(){
			var XHR = new XHRConnection();
			var DisableNetworksManagement=$DisableNetworksManagement;
			if(DisableNetworksManagement==1){alert('$ERROR_NO_PRIVS');return;}
			if(document.getElementById('dhcp').checked){XHR.appendData('dhcp','1');}else{XHR.appendData('dhcp','0');}
			if(document.getElementById('enabled').checked){XHR.appendData('enabled','1');}else{XHR.appendData('enabled','0');}
			if(document.getElementById('defaultroute-$t').checked){XHR.appendData('defaultroute','1');}else{XHR.appendData('defaultroute','0');}
			XHR.appendData('NICNAME',encodeURIComponent(document.getElementById('NICNAME-$t').value));
			XHR.appendData('netzone',document.getElementById('netzone-$t').value);
			XHR.appendData('IPADDR',document.getElementById('IPADDR').value);
			XHR.appendData('NETMASK',document.getElementById('NETMASK').value);
			XHR.appendData('GATEWAY',document.getElementById('GATEWAY').value);
			XHR.appendData('mtu',document.getElementById('mtu-$t').value);
			
			
			
			if(document.getElementById('DNS_1')){
				XHR.appendData('DNS_1',document.getElementById('DNS_1').value);
			}
			if(document.getElementById('DNS_2')){
				XHR.appendData('DNS_2',document.getElementById('DNS_2').value);
			}
			XHR.appendData('BROADCAST',document.getElementById('BROADCAST').value);
			XHR.appendData('metric',document.getElementById('metric-$t').value);
			XHR.appendData('save_nic',document.getElementById('save_nic').value);
			XHR.appendData('noreboot','{$_GET["noreboot"]}');
			if(document.getElementById('zlistnic-info-$eth')){AnimateDiv('zlistnic-info-$eth');}
			if(document.getElementById('edit-config-$eth')){AnimateDiv('edit-config-$eth');}
			if(document.getElementById('wizard-nic-list')){AnimateDiv('wizard-nic-list');}
			
			XHR.sendAndLoad('$page', 'GET',X_SaveNicSettings);
			
		}
		
		var x_SwitchSnort= function (obj) {
			var results=obj.responseText;
			if(results.length>3){alert(results);return;}
			RefreshTab('tabs_listnics2');
			}		
		
		
		
		function SwitchSnort(){
			var XHR = new XHRConnection();
			var DisableNetworksManagement=$DisableNetworksManagement;
			if(DisableNetworksManagement==1){alert('$ERROR_NO_PRIVS');return;}	
			if(document.getElementById('UseSnort').checked){XHR.appendData('UseSnort','1');}else{XHR.appendData('UseSnort','0');}
			XHR.appendData('eth','$eth');
			XHR.sendAndLoad('$page', 'POST',x_SwitchSnort);
		}
		
		
		
		function SaveMII$t(){
			var XHR = new XHRConnection();
			var DisableNetworksManagement=$DisableNetworksManagement;
			if(DisableNetworksManagement==1){alert('$ERROR_NO_PRIVS');return;}
			if(document.getElementById('flow-control-$t').checked){XHR.appendData('flow-control','1');}else{XHR.appendData('flow-control','0');}
			if(document.getElementById('autonegotiation-$t').checked){XHR.appendData('autonegotiation','1');}else{XHR.appendData('autonegotiation','0');}
			XHR.appendData('duptype',document.getElementById('media-$t').value);
			XHR.appendData('MII-TOOL','$eth');
			XHR.sendAndLoad('$page', 'POST',X_SaveNicSettings)
		}
		
		
		function LockNic(){
			var DisableNetworksManagement=$DisableNetworksManagement;
			document.getElementById('dhcp').disabled=true;
			document.getElementById('IPADDR').disabled=true;
			document.getElementById('NETMASK').disabled=true;
			document.getElementById('GATEWAY').disabled=true;
			document.getElementById('mtu-$t').disabled=true;
			if(document.getElementById('DNS_1')){document.getElementById('DNS_1').disabled=true;}
			if(document.getElementById('DNS_2')){document.getElementById('DNS_2').disabled=true;}
			document.getElementById('save_nic').disabled=true;
			if(DisableNetworksManagement==1){return;}
			document.getElementById('dhcp').disabled=false;
			document.getElementById('IPADDR').disabled=false;
			document.getElementById('NETMASK').disabled=false;
			document.getElementById('GATEWAY').disabled=false;
			document.getElementById('mtu-$t').disabled=false;
			if(document.getElementById('DNS_1')){document.getElementById('DNS_1').disabled=false;}
			if(document.getElementById('DNS_2')){document.getElementById('DNS_2').disabled=false;}
			document.getElementById('save_nic').disabled=false;	
			if(document.getElementById('zlistnic-info-$eth')){LoadAjax('zlistnic-info-$eth','system.nic.config.php?nic-builder=$eth');}
			SwitchDHCP();		
		
		}
		
	function SwitchDHCP(){
		document.getElementById('IPADDR').disabled=true;
		document.getElementById('NETMASK').disabled=true;
		document.getElementById('GATEWAY').disabled=true;
		document.getElementById('BROADCAST').disabled=true;
		document.getElementById('mtu-$t').disabled=true;
		if(document.getElementById('DNS_1')){document.getElementById('DNS_1').disabled=true;}
		if(document.getElementById('DNS_2')){document.getElementById('DNS_2').disabled=true;}
		document.getElementById('dhcp').disabled=true;
		
		if(document.getElementById('enabled').checked==false){return;}
		
		document.getElementById('dhcp').disabled=false;
		if(document.getElementById('dhcp').checked==true){return;}
		document.getElementById('IPADDR').disabled=false;
		document.getElementById('NETMASK').disabled=false;
		document.getElementById('GATEWAY').disabled=false;
		document.getElementById('BROADCAST').disabled=false;
		document.getElementById('mtu-$t').disabled=false;
		if(document.getElementById('DNS_1')){document.getElementById('DNS_1').disabled=false;}
		if(document.getElementById('DNS_2')){document.getElementById('DNS_2').disabled=false;}
	}		
	
	function DisableSnortInterface(){
		document.getElementById('UseSnort').disabled=true;
	}
		
	$jsSnort	
	LockNic();
	</script>	
	";
	
	
	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html);	
	}
Example #13
0
function virtual_add_form()
{
    $ldap = new clladp();
    $sock = new sockets();
    $page = CurrentPageName();
    $users = new usersMenus();
    $tpl = new templates();
    $t = $_GET["t"];
    if (!is_numeric($_GET["ID"])) {
        $_GET["ID"] = 0;
    }
    if (!is_numeric($t)) {
        $t = time();
    }
    $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    $EnablePostfixMultiInstance = $sock->GET_INFO("EnablePostfixMultiInstance");
    $NoGatewayForVirtualNetWork = $sock->GET_INFO("NoGatewayForVirtualNetWork");
    $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement");
    if (!is_numeric($NoGatewayForVirtualNetWork)) {
        $NoGatewayForVirtualNetWork = 0;
    }
    if (!is_numeric($DisableNetworksManagement)) {
        $DisableNetworksManagement = 0;
    }
    $FailOver = 0;
    $NoGatewayForVirtualNetWorkExplain = $tpl->javascript_parse_text("{NoGatewayForVirtualNetWorkExplain}");
    if ($users->LinuxDistriCode == "DEBIAN") {
        if (preg_match("#Debian\\s+([0-9]+)\\.#", $users->LinuxDistriFullName, $re)) {
            $DEBIAN_MAJOR = $re[1];
            if ($DEBIAN_MAJOR == 6) {
                $FailOver = 1;
            }
        }
    }
    $title_button = "{add}";
    if (!is_numeric($_GET["ID"])) {
        $_GET["ID"] = 0;
    }
    if ($_GET["ID"] > 0) {
        $sql = "SELECT * FROM nics_virtuals WHERE ID='{$_GET["ID"]}'";
        $q = new mysql();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $title_button = "{apply}";
    }
    if (isset($_GET["default-datas"])) {
        $default_array = unserialize(base64_decode($_GET["default-datas"]));
        if (is_array($default_array)) {
            $ligne["nic"] = $default_array["NIC"];
            if (preg_match("#(.+?)\\.([0-9]+)\$#", $default_array["IP"], $re)) {
                if ($re[2] > 254) {
                    $re[2] = 1;
                }
                $re[2] = $re[2] + 1;
                $ligne["ipaddr"] = "{$re[1]}.{$re[2]}";
                $ligne["gateway"] = $default_array["GW"];
                $ligne["netmask"] = $default_array["NETMASK"];
            }
        }
    }
    if ($ligne["metric"] == 0) {
        $ligne["metric"] = 100 + $_GET["ID"];
    }
    $styleOfFields = "font-size:24px;padding:3px";
    $ous = $ldap->hash_get_ou(true);
    $ous["openvpn_service"] = "{APP_OPENVPN}";
    if ($users->crossroads_installed) {
        if ($EnablePostfixMultiInstance == 1) {
            $ous["crossroads"] = "{load_balancer}";
        }
    }
    $AsDebianSystem = 1;
    while (list($num, $val) = each($nics)) {
        $nics_array[$val] = $val;
    }
    if (!$users->AsDebianSystem) {
        $AsDebianSystem = 0;
    }
    $nics_array[null] = "{select}";
    $ous[null] = "{select}";
    $nic_field = Field_array_Hash($nics_array, "nic", $ligne["nic"], null, null, 0, "font-size:24px;padding:3px");
    $ou_fields = Field_array_Hash($ous, "org", $ligne["org"], null, null, 0, "font-size:24px;padding:3px");
    $html = "\n\t<div id='virtip' style='width:98%' class=form>\n\t" . Field_hidden("ID", "{$_GET["ID"]}") . "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{nic}:</td>\n\t\t<td>{$nic_field}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{organization}:</td>\n\t\t<td>{$ou_fields}</td>\n\t</tr>\t\n\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{tcp_address}:</td>\n\t\t\t\n\t\t\t<td>" . field_ipv4("ipaddr-{$t}", $ligne["ipaddr"], $styleOfFields, false, "CalcCdirVirt{$t}(0)") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{netmask}:</td>\n\t\t\t<td>" . field_ipv4("netmask-{$t}", $ligne["netmask"], $styleOfFields, false, "CalcCdirVirt{$t}(0)") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>CDIR:</td>\n\t\t\t<td style='padding:-1px;margin:-1px'>\n\t\t\t<table style='width:99%;padding:-1px;margin:-1px'>\n\t\t\t<tr>\n\t\t\t<td width=1%>\n\t\t\t" . Field_text("cdir-{$t}", $ligne["cdir"], "{$styleOfFields};width:225px", null, null, null, false, null, $DISABLED) . "</td>\n\t\t\t<td align='left'> " . imgtootltip("img_calc_icon.gif", "cdir", "CalcCdirVirt{$t}(1)") . "</td>\n\t\t\t</tr>\n\t\t\t</table></td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{use_a_gateway}:</td>\n\t\t\t<td>" . Field_checkbox_design("ForceGateway-{$t}", 1, $ligne["ForceGateway"], "CheckGateway{$t}()") . "</td>\n\t\t</tr>\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{gateway}:</td>\n\t\t\t<td>" . field_ipv4("gateway_virtual-{$t}", $ligne["gateway"], $styleOfFields, false) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{metric}:</td>\n\t\t\t<td>" . field_text("metric_virtual-{$t}", $ligne["metric"], "{$styleOfFields};width:90px", false) . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>failover:</td>\n\t\t\t<td>" . Field_checkbox_design("failover-{$t}", 1, $ligne["failover"], "FaileOverCheck()") . "</td>\n\t\t</tr>\t\t\n\n\t\t\n\t\t\n\t</table>\n\t</div>\n\t<div id='infosVirtual' style='font-size:24px'></div>\n\t<div style='text-align:right'><hr>" . button($title_button, "VirtualIPAddSave{$t}()", 30) . "</div>\n\t<script>\nvar Netid={$_GET["ID"]};\nvar FailOver={$FailOver};\nvar cdir=document.getElementById('cdir-{$t}').value;\nvar netmask=document.getElementById('netmask-{$t}').value;\nif(netmask.length>0){ if(cdir.length==0){ CalcCdirVirt{$t}(0); } }\nif(Netid>0){ document.getElementById('ipaddr-{$t}').disabled=true; }\n\t\t\n\t\t\nfunction CheckGateway{$t}(){\n\tvar NoGatewayForVirtualNetWork={$NoGatewayForVirtualNetWork};\n\tvar AsDebianSystem={$AsDebianSystem};\n\tdocument.getElementById('gateway_virtual-{$t}').disabled=true;\n\tdocument.getElementById('metric_virtual-{$t}').disabled=true;\n\n\t\n\tif(NoGatewayForVirtualNetWork==1){\n\t\tdocument.getElementById('ForceGateway-{$t}').disabled=true;\n\t\tdocument.getElementById('ForceGateway-{$t}').checked=false;\t\n\t\tdocument.getElementById('infosVirtual-{$t}').innerHTML='{$NoGatewayForVirtualNetWorkExplain}';\t\n\t\treturn;\n\t}\n\tif(document.getElementById('ForceGateway-{$t}').checked){\n\t\tdocument.getElementById('gateway_virtual-{$t}').disabled=false;\n\t\tdocument.getElementById('metric_virtual-{$t}').disabled=false;\n\t}\n\t\t\t\n\tdocument.getElementById('failover-{$t}').disabled=true;\n\tif(FailOver==1){document.getElementById('failover-{$t}').disabled=false;}\n}\n\t\t\nvar XVirtualIPAddSave{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tvar Netid={$_GET["ID"]};\n\tif(results.length>5){alert(results);return;}\t\n\tif(Netid==0){ YahooWin2Hide();}\n\t\$('#SYSTEM_NICS_VIRTUALS_LIST').flexReload();\n}\t\t\t\n\t\t\n\t\t\nfunction VirtualIPAddSave{$t}(){\n\tvar DisableNetworksManagement={$DisableNetworksManagement};\n\tvar NoGatewayForVirtualNetWork={$NoGatewayForVirtualNetWork};\t\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('virt-ipaddr',document.getElementById('ipaddr-{$t}').value);\n\tXHR.appendData('netmask',document.getElementById('netmask-{$t}').value);\n\tXHR.appendData('cdir',document.getElementById('cdir-{$t}').value);\n\tXHR.appendData('metric',document.getElementById('metric_virtual-{$t}').value);\n\n\tif(NoGatewayForVirtualNetWork==0){XHR.appendData('gateway',document.getElementById('gateway_virtual-{$t}').value);}\n\tif(NoGatewayForVirtualNetWork==1){XHR.appendData('gateway','');}\n\tXHR.appendData('nic',document.getElementById('nic').value);\n\tXHR.appendData('org',document.getElementById('org').value);\n\tXHR.appendData('ID',document.getElementById('ID').value);\n\tif(document.getElementById('ForceGateway-{$t}').checked){XHR.appendData('ForceGateway',1);}else{XHR.appendData('ForceGateway',0);}\n\tif(document.getElementById('failover-{$t}')){\n\t\tif(document.getElementById('failover-{$t}').checked){XHR.appendData('failover',1);}else{XHR.appendData('failover',0);}\n\t}\n\tMemFlexGrid={$t};\n\tXHR.sendAndLoad('{$page}', 'GET',XVirtualIPAddSave{$t});\n}\n\nfunction FaileOverCheck(){\n\tdocument.getElementById('netmask-{$t}').disabled=false;\n\tdocument.getElementById('gateway_virtual-{$t}').disabled=false;\n\t\n\tif(document.getElementById('failover-{$t}').checked){\n\t\tdocument.getElementById('netmask-{$t}').disabled=true;\n\t\tdocument.getElementById('gateway_virtual-{$t}').disabled=true;\t\t\t\t\t\n\t}\n}\n\t\t\n\t\tvar X_CalcCdirVirt{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tdocument.getElementById('cdir-{$t}').value=results;\n\t\t}\t\t\n\t\t\n\t\tfunction CalcCdirVirt{$t}(recheck){\n\t\t\tvar cdir=document.getElementById('cdir-{$t}').value;\n\t\t\tif(recheck==0){\n\t\t\t\tif(cdir.length>0){return;}\n\t\t\t}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('cdir-ipaddr',document.getElementById('ipaddr-{$t}').value);\n\t\t\tXHR.appendData('netmask',document.getElementById('netmask-{$t}').value);\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',X_CalcCdirVirt{$t});\n\t\t}\t\t\n\t\t\n\t\tCheckGateway{$t}();\n\t\tFaileOverCheck();\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #14
0
function port_popup(){
	$ldap=new clladp();
	$sock=new sockets();
	$page=CurrentPageName();
	$users=new usersMenus();
	$tpl=new templates();
	$tSource=$_GET["t"];
	$ID=$_GET["ID"];
	$port=$_GET["port"];
	$switch=$_GET["switch"];
	$t=time();
	
	$nics=unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
	$GLOBALS["interfaces"]=unserialize(base64_decode($sock->getFrameWork("cmd.php?TCP_NICS_STATUS_ARRAY=yes")));
	
	
	
	$title_button="{add}";
	if(!is_numeric($_GET["ID"])){$_GET["ID"]=0;}

	if($ID>0){
		$sql="SELECT * FROM nics_switch WHERE ID='{$_GET["ID"]}'";
		$q=new mysql();
		$ligne=@mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup"));
		$title_button="{apply}";
		$switch=$ligne["nic"];
		$port=$ligne["port"];
	}


	for($i=1;$i<33;$i++){
		$ports[$i]=$i;
	}
	$vlans[0]="{none}";
	for($i=1;$i<256;$i++){
		$vlans[$i]=$i;
	}

	if(isset($_GET["default-datas"])){
		$default_array=unserialize(base64_decode($_GET["default-datas"]));
		if(is_array($default_array)){
			$ligne["nic"]=$default_array["NIC"];
			if(preg_match("#(.+?)\.([0-9]+)$#",$default_array["IP"],$re)){
				if($re[2]>254){$re[2]=1;}
				$re[2]=$re[2]+1;
				$ligne["ipaddr"]="{$re[1]}.{$re[2]}";
				$ligne["gateway"]=$default_array["GW"];
				$ligne["netmask"]=$default_array["NETMASK"];
			}
		}
	}

	if($ligne["metric"]==0){$ligne["metric"]=100+$_GET["ID"];}
	
	
	$MAIN_TITLE=$tpl->_ENGINE_parse_body("{switch_port} $port, {virtual_switch} $switch");

	$styleOfFields="font-size:16px;padding:3px";
	$vlan_field=Field_array_Hash($vlans,"vlan-$t",$ligne["vlan"],null,null,0,"font-size:16px;padding:3px");
	$html="
		<div id='animate-$t'></div>
		<div id='virtip'>". Field_hidden("ID","{$_GET["ID"]}").
		Field_hidden("port-$t","$port").Field_hidden("nic-$t","$switch")."
		<div style='width:98%' class=form>
			<table style='width:99%'>
			<tr>
				<td class=legend style='font-size:16px'>{netzone}:</td>
				<td>" . field_text("netzone-$t",$ligne["netzone"],"$styleOfFields;width:190px",false)."</td>
			</tr>
			<tr>
				<td class=legend style='font-size:16px'>VLAN:</td>
				<td>$vlan_field</td>
			</tr>						
			<tr>
				<td class=legend style='font-size:16px'>{tcp_address}:</td>
				<td>" . field_ipv4("ipaddr-$t",$ligne["ipaddr"],$styleOfFields,false,"CalcCdirVirt$t(0)")."</td>
			</tr>			
			<tr>
				<td class=legend style='font-size:16px'>{netmask}:</td>
				<td>" . field_ipv4("netmask-$t",$ligne["netmask"],$styleOfFields,false,"CalcCdirVirt$t(0)")."</td>
			</tr>
			<tr>
			<td class=legend style='font-size:16px'>CDIR:</td>
				<td style='padding:-1px;margin:-1px'>
					<table style='width:99%;padding:-1px;margin:-1px'>
					<tr>
					<td width=1%>
						" . Field_text("cdir-$t",$ligne["cdir"],"$styleOfFields;width:190px",null,null,null,false,null,$DISABLED)."</td>
					<td align='left'> ".imgtootltip("img_calc_icon.gif","cdir","CalcCdirVirt$t(1)") ."</td>
					</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td class=legend style='font-size:16px'>{gateway}:</td>
				<td>" . field_ipv4("gateway-$t",$ligne["gateway"],$styleOfFields,false)."</td>
			</tr>
			<tr>
				<td class=legend style='font-size:16px'>{metric}:</td>
				<td>" . field_text("metric-$t",$ligne["metric"],"$styleOfFields;width:90px",false)."</td>
			</tr>
	</table>
	</div>

	<div id='infosVirtual' style='font-size:13px'></div>
	<div style='text-align:right'><hr>". button($title_button,"Save$t()",18)."</div>
</div>
<script>
var Netid{$t}={$_GET["ID"]};
var cdir=document.getElementById('cdir-$t').value;
var netmask=document.getElementById('netmask-$t').value;
if(netmask.length>0){if(cdir.length==0){CalcCdirVirt$t(0);}}

var X_CalcCdirVirt$t= function (obj) {
	var results=obj.responseText;
	document.getElementById('cdir-$t').value=results;
}

var xSave$t= function (obj) {
	var results=obj.responseText;
	if(results.length>3){alert(results);return;}
	$('#table-$tSource').flexReload();
	if( Netid{$t}==0 ){
		YahooWinHide();
	}
}

function CalcCdirVirt$t(recheck){
	var cdir=document.getElementById('cdir-$t').value;
	if(recheck==0){if(cdir.length>0){return;}}
	var XHR = new XHRConnection();
	
	XHR.setLockOff();
	XHR.appendData('cdir-ipaddr',document.getElementById('ipaddr-$t').value);
	XHR.appendData('netmask',document.getElementById('netmask-$t').value);
	XHR.sendAndLoad('artica.settings.php', 'GET',X_CalcCdirVirt$t);
}


function Save$t(){
	var XHR = new XHRConnection();
	XHR.appendData('nic','$switch');
	XHR.appendData('port','$port');
	XHR.appendData('ID','{$_GET["ID"]}');
	XHR.appendData('netzone',document.getElementById('netzone-$t').value);
	XHR.appendData('ipaddr',document.getElementById('ipaddr-$t').value);
	XHR.appendData('netmask',document.getElementById('netmask-$t').value);
	XHR.appendData('cdir',document.getElementById('cdir-$t').value);
	XHR.appendData('metric',document.getElementById('metric-$t').value);
	XHR.appendData('gateway',document.getElementById('gateway-$t').value);
	XHR.appendData('vlan',document.getElementById('vlan-$t').value);
	XHR.sendAndLoad('$page', 'POST',xSave$t);
}
</script>
";
echo $tpl->_ENGINE_parse_body($html);
}
function popup(){
	$page=CurrentPageName();
	$tpl=new templates();
	$t=time();
	
	$warn_restore_articadb=$tpl->javascript_parse_text("{warn_restore_articadb}");
	
	$html="
	<div style='font-size:14px' class=text-info>{zarafadb_restore_explain}</div>
	<table style='width:99%' class=form>
	<tr>
		<td class=legend>{backup_file}:</td>
		<td>". field_text("backup$t",null,"font-size:16px;width:210px")."</td>
		<td>". button("{browse}","Loadjs('tree.php?target-form=backup$t')",13)."</td>
	</tr>
	<tr>
	<td colspan=3 align='right'><hr>". button("{restore}","Restore$t()",18)."</td>
	</tr>
	</table>		
	<div id='start-$t'></div>		
	<script>
		var x_Restore$t= function (obj) {
	      var tempvalue=obj.responseText;
	      if(tempvalue.length>3){alert(tempvalue);}
	      document.getElementById('start-$t').innerHTML='';
	      LoadAjax('start-$t','$page?logs-starter=yes&t=$t');
	      }		
		
		function Restore$t(){
			var path=document.getElementById('backup$t').value;
			if(!confirm('$warn_restore_articadb')){return;}
			var XHR = new XHRConnection();
			XHR.appendData('restore-path',path);
			AnimateDiv('start-$t');
			XHR.sendAndLoad('$page', 'POST',x_Restore$t);	
		}
		
		
		
		
		var x_GetLogs$t= function (obj) {
	      var tempvalue=obj.responseText;
	      if(tempvalue.length>3){
	      	document.getElementById('textToParseCats-$t').innerHTML=tempvalue;
	       }
	      if(!YahooWin3Open()){return;}
	      setTimeout(\"GetLogs$t()\",1000);
	      }	

	      
		function GetLogs$t(){
			if(!YahooWin3Open()){return;}
			var XHR = new XHRConnection();
			XHR.appendData('restore-logs','yes');
			XHR.appendData('t','$t');
			XHR.sendAndLoad('$page', 'POST',x_GetLogs$t);		
		
		}
		
	</script>		
	";
	
	echo $tpl->_ENGINE_parse_body($html);
	
}
function item_popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $button = "{add}";
    $mil = new milter_greylist();
    $action = $mil->actionlist;
    $sql = "SELECT * FROM miltergreylist_items WHERE ID='{$_GET["ID"]}'";
    $q = new mysql();
    $t = time();
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $explain = $tpl->_ENGINE_parse_body("{" . $action[$_GET["type"]] . "}");
    if ($_GET["ID"] > 0) {
        $button = "{apply}";
    }
    switch ($_GET["type"]) {
        case "addr":
            $field = field_ipv4("src{$t}", $ligne["item"], "font-size:16px");
            break;
        case "dnsrbl":
            $pure = new milter_greylist();
            $field = Field_array_Hash($pure->dnsrbl_class, "src{$t}", $ligne["item"], null, null, 0, "font-size:14px");
            break;
        case "geoip":
            include_once dirname(__FILE__) . "/ressources/class.spamassassin.inc";
            $spam = new spamassassin();
            $spam->CountriesCode[null] = "{select}";
            $field = Field_array_Hash($spam->CountriesCode, "src{$t}", $ligne["item"], null, null, 0, "font-size:14px");
            break;
        default:
            $field = field_text("src{$t}", $ligne["item"], "font-size:16px;width:220px");
            break;
    }
    $html = "\n\t<div class=explain style='font-size:13px'>{{$_GET["type"]}_text}</div>\n\t<div id='{$t}'>\n\t\n\t\t<table style='width:98%' class=form>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td align='right' width=1% nowrap style='font-size:16px'><strong>{{$_GET["type"]}}:</strong></td>\n\t\t\t\t<td>{$field}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align='right' colspan=2><hr>" . button($button, "SaveMilter{$t}GreyListITEM()", 16) . "</td>\n\t\t\t</tr>\t\t\t\t\t\n\t\t\t\n\t\t\t\n\t</tbody>\n\t</table>\t\n<script>\n\tvar SaveMilterGreyListITEM{$t}= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tvar ID={$_GET["ID"]};\n\t\t\tif(tempvalue.length>3){alert(tempvalue);}\n\t\t\tYahooWin4Hide();\n\t\t\tRefreshTableMiltITZ();\n\t\t\tRefreshTableMiltGP();\n\t\t}\t\t\n\n\tfunction SaveMilter{$t}GreyListITEM(){\n\t\tif(!document.getElementById('src{$t}')){alert('src{$t} no such id');return;}\n\t\tvar tt=document.getElementById('src{$t}').value;\n\t\tif(tt.length<2){return;}\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\tXHR.appendData('item-save',document.getElementById('src{$t}').value);\n\t\tXHR.appendData('item',document.getElementById('src{$t}').value);\n\t\tXHR.appendData('gpid','{$_GET["gpid"]}');\n\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\tAnimateDiv('{$t}');\n     \tXHR.sendAndLoad('{$page}', 'POST',SaveMilterGreyListITEM{$t});\n\t}\n\t\n\t\n\t\n</script>\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #17
0
function port_popup(){
	$ID=intval($_GET["ID"]);
	$tpl=new templates();
	$page=CurrentPageName();
	$t=time();
	$btname="{add}";
	$q=new mysql_squid_builder();
	$title=$tpl->javascript_parse_text("{new_port}");
	if(!$q->FIELD_EXISTS("proxy_ports", "transparent")){
		$q->QUERY_SQL("ALTER TABLE `proxy_ports` ADD `transparent` smallint(1) NOT NULL DEFAULT '0'");
		if(!$q->ok){echo $q->mysql_error."\n";}
	}
	
	if($ID>0){
		$ligne=@mysql_fetch_array($q->QUERY_SQL("SELECT * FROM proxy_ports WHERE ID=$ID"));
		$title="{$ligne["ipaddr"]}:{$ligne["port"]}";
		$btname="{apply}";
	}
	
	$ip=new networking();
	$ips=$ip->ALL_IPS_GET_ARRAY();
	$ips["0.0.0.0"]="{all}";

	if($ligne["ipaddr"]==null){$ligne["ipaddr"]="0.0.0.0";}
	if($ligne["port"]==0){$ligne["port"]=rand(1024,63000);}
	if(!is_numeric($ligne["enabled"])){$ligne["enabled"]=1;}
	$html="<div style='width:98%' class=form>
	<table style='width:100%'>
	<tr>
		<td colspan=2><div style='font-size:32px;margin-bottom:15px'>$title</div></td>
	</tr>
	<tr>
		<td class=legend style='font-size:18px'>{enabled}:</td>
		<td style='font-size:18px'>". Field_checkbox("enabled-$t", 1,$ligne["enabled"],"Check$t()")."</td>
	</tr>	
	<tr>
		<td class=legend style='font-size:18px'>{transparent}:</td>
		<td style='font-size:18px'>". Field_checkbox("transparent-$t", 1,$ligne["transparent"])."</td>
	</tr>				
	<tr>
		<td class=legend style='font-size:18px'>{listen_addr}:</td>
		<td style='font-size:18px'>". Field_array_Hash($ips, "ipaddr-$t",$ligne["ipaddr"],"style:font-size:18px")."</td>
	</tr>
	<tr>
		<td class=legend style='font-size:18px'>{listen_port}:</td>
		<td style='font-size:18px'>". field_text("port-$t", $ligne["port"],"font-size:18px;width:90px")."</td>
	</tr>	
	<tr>
		<td class=legend style='font-size:18px'>{info}:</td>
		<td style='font-size:18px'>". field_text("xnote-$t", $ligne["xnote"],"font-size:18px;width:220px")."</td>
	</tr>
	<tr>
		<td colspan=2 align='right'><hr>". button($btname,"Save$t()",28)."</td>
	</tr>						
	</table>
<script>
	var xSave$t=function (obj) {
		var tempvalue=obj.responseText;
		if (tempvalue.length>3){alert(tempvalue);return;}
		var ID=$ID;
		if(ID==0){YahooWin2Hide();}
		if(document.getElementById('TABLE_SQUID_PORTS')){
			$('#'+document.getElementById('TABLE_SQUID_PORTS').value).flexReload();
		}
		
	}	
	
	function Save$t(){
		var XHR = new XHRConnection();
		XHR.appendData('ID','$ID');
		XHR.appendData('ipaddr',document.getElementById('ipaddr-$t').value);
		XHR.appendData('port',document.getElementById('port-$t').value);
		XHR.appendData('xnote',encodeURIComponent(document.getElementById('xnote-$t').value));
		if(document.getElementById('enabled-$t').checked){
				XHR.appendData('enabled',1);
		}else{
			XHR.appendData('enabled',0);
		}
		
		
		if(document.getElementById('transparent-$t').checked){
				XHR.appendData('transparent',1);
		}else{
			XHR.appendData('transparent',0);
		}		
		
		XHR.sendAndLoad('$page', 'POST',xSave$t);	
	}
	
	function Check$t(){
		document.getElementById('ipaddr-$t').disabled=true;
		document.getElementById('port-$t').disabled=true;
		document.getElementById('xnote-$t').disabled=true;
		document.getElementById('transparent-$t').disabled=true;
		
		if(document.getElementById('enabled-$t').checked){
			document.getElementById('transparent-$t').disabled=false;
			document.getElementById('ipaddr-$t').disabled=false;
			document.getElementById('port-$t').disabled=false;
			document.getElementById('xnote-$t').disabled=false;		
		}
	
	}

Check$t();
</script>					
				
				
";
	
	echo $tpl->_ENGINE_parse_body($html);
	
}
Example #18
0
function popup(){
	$page=CurrentPageName();
	$tpl=new templates();
	$t=time();
	$sock=new sockets();
	$PID=0;
	$ISRunAR=unserialize(base64_decode($sock->getFrameWork("zarafa.php?restore-process-array=yes")));
	if(is_array($ISRunAR)){
		$PID=intval($ISRunAR["PID"]);
		$TIME=$ISRunAR["TIME"];
		
	}
	
	$warn_restore_articadb=$tpl->javascript_parse_text("{warn_restore_articadb}");
	
	$html="
	<div style='font-size:18px' class=text-info>{zarafadb_restore_explain}</div>
	<div style='font-size:22px;text-align:center;margin:10px' id='title$t'></div>
	<div style='margin:10px;min-height:75px' id='Status$t'></div>
	<div style='width:98%' class=form>
	<table style='width:99%'>
	<tr>
		<td class=legend style='font-size:26px'>{backup_file}:</td>
		<td>". field_text("backup$t",null,"font-size:26px;width:600px")."</td>
		<td>". button("{browse}","Loadjs('tree.php?target-form=backup$t')",22)."</td>
	</tr>
	<tr>
	<td colspan=3 align='center'><hr>". button("{restore}","Restore$t()",32)."</td>
	</tr>
	</table>		
	<div id='start-$t'></div>		
	<script>
		var PID=$PID;
		var x_Restore$t= function (obj) {
	      var tempvalue=obj.responseText;
	      if(tempvalue.length>3){alert(tempvalue);}
		  document.getElementById('start-$t').innerHTML='';
		  LoadAjax('start-$t','$page?logs-starter=yes&t=$t');
		}		
		
		function Restore$t(){
			var path=document.getElementById('backup$t').value;
			if(!confirm('$warn_restore_articadb'+path)){return;}
			var XHR = new XHRConnection();
			XHR.appendData('restore-path',path);
			XHR.sendAndLoad('$page', 'POST',x_Restore$t);	
		}
		
		
		
		
		var x_GetLogs$t= function (obj) {
	      var tempvalue=obj.responseText;
	      if(tempvalue.length>3){
	      	document.getElementById('textToParseCats-$t').innerHTML=tempvalue;
	       }

	      }	

	      
		function GetLogs$t(){
			var XHR = new XHRConnection();
			XHR.appendData('restore-logs','yes');
			XHR.appendData('t','$t');
			XHR.setLockOff();
			XHR.sendAndLoad('$page', 'POST',x_GetLogs$t);		
		
		}
		$('#Status$t').progressbar({ value: 1 });
		
		if(PID>0){
			LoadAjax('start-$t','$page?logs-starter=yes&t=$t');
		}
		
	</script>		
	";
	
	echo $tpl->_ENGINE_parse_body($html);
	
}
Example #19
0
function port_popup_main()
{
    $ID = intval($_GET["ID"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $btname = "{add}";
    $t = time();
    $q = new mysql_squid_builder();
    $title = $tpl->javascript_parse_text("{new_port}");
    PatchTable();
    if ($ID > 0) {
        $ligne = @mysql_fetch_array($q->QUERY_SQL("SELECT * FROM proxy_ports WHERE ID={$ID}"));
        $title = "{$ligne["nic"]}:{$ligne["port"]}";
        if ($ligne["nic"] == null) {
            $title = "{listen_port}: {$ligne["port"]}";
        }
        $btname = "{apply}";
    }
    $ip = new networking();
    $interfaces = $ip->Local_interfaces();
    unset($interfaces["lo"]);
    $array[null] = "{all}";
    $array2[null] = "{all}";
    while (list($eth, $none) = each($interfaces)) {
        if (preg_match("#^gre#", $eth)) {
            continue;
        }
        $nic = new system_nic($eth);
        $array[$eth] = "{$eth} {$nic->IPADDR} - {$nic->NICNAME}";
        $array2[$eth] = "{$eth} {$nic->IPADDR} - {$nic->NICNAME}";
    }
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    if ($ligne["ipaddr"] == null) {
        $ligne["ipaddr"] = "0.0.0.0";
    }
    if ($ligne["port"] == 0) {
        $ligne["port"] = rand(1024, 63000);
    }
    if (!is_numeric($ligne["enabled"])) {
        $ligne["enabled"] = 1;
    }
    $wanproxy_error = "&nbsp;";
    $users = new usersMenus();
    if (!$users->WANPROXY) {
        $wanproxy_error = "<p class=tex-error>{wanproxy_not_installed}</p>";
    }
    $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=3><div style='font-size:32px;margin-bottom:15px'>{$title}</div></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{enabled}:</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("enabled-{$t}", 1, $ligne["enabled"], "Check{$t}()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{service_name2}:</td>\n\t\t<td style='font-size:20px'>" . field_text("PortName-{$t}", $ligne["PortName"], "font-size:20px;width:361px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{disable_authentication}:</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("NoAuth-{$t}", 1, $ligne["NoAuth"], "CheckTransparentT()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>Transparent Proxy (Tproxy):</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("TProxy-{$t}", 1, $ligne["TProxy"], "CheckTransparentT()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>Transparent Proxy (Mikrotik):</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("MIKROTIK_PORT-{$t}", 1, $ligne["MIKROTIK_PORT"], "CheckMikrotik()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{transparent}:</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("transparent-{$t}", 1, $ligne["transparent"], "CheckTransparent()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>" . texttooltip("{enable_nat_compatibility}", "{squid_enable_nat_compatibility_text}") . ":</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("is_nat-{$t}", 1, $ligne["is_nat"], "CheckNat()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>" . texttooltip("{WCCP_LAYER3}", "{WCCP_LAYER3_EXPLAIN}") . ":</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("WCCP-{$t}", 1, $ligne["WCCP"], "CheckWCCP()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t\t\t\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{parent_proxy}:</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("Parent-{$t}", 1, $ligne["Parent"], "CheckParent()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>" . texttooltip("{WAN_PARENT}", "{WAN_PARENT_EXPLAIN}") . ":</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("WANPROXY-{$t}", 1, $ligne["WANPROXY"], "CheckWANProxy()") . "</td>\n\t\t<td>{$wanproxy_error}</td>\n\t</tr>\t\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{icp_port}:</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("ICP-{$t}", 1, $ligne["ICP"], "CheckICP()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>FTP:</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("FTP-{$t}", 1, $ligne["FTP"], "CheckFTPT()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px;font-wieght:bold'>{listen_interface}:</td>\n\t\t<td style='font-size:20px'>" . Field_array_Hash($array, "nic-{$t}", $ligne["nic"], "style:font-size:20px;font-wieght:bold") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px;font-wieght:bold'>{listen_port}:</td>\n\t\t<td style='font-size:20px'>" . field_text("port-{$t}", $ligne["port"], "font-size:20px;width:90px;font-wieght:bold") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px;font-wieght:bold'>{proxy_port}:</td>\n\t\t<td style='font-size:20px'>" . field_text("WANPROXY_PORT-{$t}", $ligne["WANPROXY_PORT"], "font-size:20px;width:90px;font-wieght:bold") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{forward_interface}:</td>\n\t\t<td style='font-size:20px'>" . Field_array_Hash($array, "outgoing_addr-{$t}", $ligne["outgoing_addr"], "style:font-size:20px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>" . texttooltip("{UseSSL}", "{listen_port_ssl_explain}") . ":</td>\n\t\t<td style='font-size:20px'>" . Field_checkbox_design("UseSSL-{$t}", 1, $ligne["UseSSL"], "CheckUseSSL{$t}()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{use_certificate_from_certificate_center}:</td>\n\t\t<td style='font-size:20px'>\n\t\t\n\t\t\t<div style='float:right'>" . imgtootltip("refresh-24.png", "{refresh}", "LoadAjaxSilent('squid_ports_popup_certificates','{$page}?certificate-refresh=yes&default={$ligne["sslcertificate"]}&t={$t}');") . "</div>\n\t\t\t<span id='squid_ports_popup_certificates'>\n\t\t\t\t<input type='hidden' id='squid_ports_popup_certificates_num' value='{$t}'>\n\t\t\t\t" . Field_array_Hash($sslcertificates, "sslcertificate-{$t}", $ligne["sslcertificate"], "style:font-size:20px") . "</span>\n\t\t\t\t\t\t\n\t\t\t\t</td>\n\t\t<td>" . button("{new_certificate}", "Loadjs('certificates.center.wizard.php')") . "</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{description}:</td>\n\t\t<td style='font-size:18px'>" . field_text("xnote-{$t}", $ligne["xnote"], "font-size:20px;width:361px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button($btname, "Save{$t}()", 32) . "</td>\n\t</tr>\t\t\t\t\t\t\n\t</table>\n\t\n<script>\n\tvar xSave{$t}=function (obj) {\n\t\tvar NextID=0;\n\t\tvar tempvalue=obj.responseText;\n\t\tif (tempvalue.length>5){alert(tempvalue);return;}\n\t\tvar ID={$ID};\n\t\t\n\t\tif(ID==0){\n\t\t\tif(!isNaN(tempvalue)){\n\t\t\t\tID=tempvalue;\n\t\t\t\tNextID=ID;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tif(document.getElementById('UseSSL-{$t}').checked){\n\t\t\tLoadjs('squid.ports.testssl.progress.php?ID='+ID);\n\t\t\t\n\t\t}\n\t\t\n\n\t\t\n\t\tif(NextID>0){\n\t\t\tYahooWin2Hide();\n\t\t\tLoadjs('{$page}?port-js=yes&ID='+NextID+'&t={$_GET["tt"]}');\n\t\t\n\t\t}\n\t\t\n\t\tif(document.getElementById('TABLE_SQUID_PORTS')){\n\t\t\t\$('#'+document.getElementById('TABLE_SQUID_PORTS').value).flexReload();\n\t\t}\n\t\t\n\t\t\n\t\t\n\n\t\t\n\t}\t\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ID','{$ID}');\n\t\tXHR.appendData('nic',document.getElementById('nic-{$t}').value);\n\t\tXHR.appendData('port',document.getElementById('port-{$t}').value);\n\t\tXHR.appendData('xnote',encodeURIComponent(document.getElementById('xnote-{$t}').value));\n\t\tXHR.appendData('outgoing_addr',document.getElementById('outgoing_addr-{$t}').value);\n\t\tXHR.appendData('sslcertificate',document.getElementById('sslcertificate-{$t}').value);\n\t\tXHR.appendData('PortName',encodeURIComponent(document.getElementById('PortName-{$t}').value));\n\t\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n\t\tif(document.getElementById('is_nat-{$t}').checked){XHR.appendData('is_nat',1);}else{XHR.appendData('is_nat',0);}\n\t\tif(document.getElementById('transparent-{$t}').checked){XHR.appendData('transparent',1);}else{XHR.appendData('transparent',0);}\t\t\n\t\tif(document.getElementById('TProxy-{$t}').checked){XHR.appendData('TProxy',1);}else{XHR.appendData('TProxy',0);}\n\t\tif(document.getElementById('UseSSL-{$t}').checked){XHR.appendData('UseSSL',1);}else{XHR.appendData('UseSSL',0);}\n\t\tif(document.getElementById('WCCP-{$t}').checked){XHR.appendData('WCCP',1);}else{XHR.appendData('WCCP',0);}\n\t\tif(document.getElementById('Parent-{$t}').checked){XHR.appendData('Parent',1);}else{XHR.appendData('Parent',0);}\n\t\tif(document.getElementById('ICP-{$t}').checked){XHR.appendData('ICP',1);}else{XHR.appendData('ICP',0);}\n\t\tif(document.getElementById('FTP-{$t}').checked){XHR.appendData('FTP',1);}else{XHR.appendData('FTP',0);}\n\t\tif(document.getElementById('WANPROXY-{$t}').checked){XHR.appendData('WANPROXY',1);}else{XHR.appendData('WANPROXY',0);}\n\t\tif(document.getElementById('NoAuth-{$t}').checked){XHR.appendData('NoAuth',1);}else{XHR.appendData('NoAuth',0);}\n\t\tif(document.getElementById('MIKROTIK_PORT-{$t}').checked){XHR.appendData('MIKROTIK_PORT',1);}else{XHR.appendData('MIKROTIK_PORT',0);}\n\t\t\n\t\t\n\t\t\n\t\tXHR.appendData('WANPROXY_PORT',encodeURIComponent(document.getElementById('WANPROXY_PORT-{$t}').value));\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\t\n\tfunction CheckTransparent(){\n\t\tif(document.getElementById('transparent-{$t}').checked){\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').disabled=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').checked=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=true;\n\t\t\tdocument.getElementById('is_nat-{$t}').checked=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').checked=false;\n\t\t\tdocument.getElementById('Parent-{$t}').checked=false;\n\t\t\tdocument.getElementById('ICP-{$t}').checked=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').checked=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\t\t\n\t\t}else{\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=false;\n\t\t}\n\t\n\t}\n\t\n\tfunction CheckTransparentT(){\n\t\tif(document.getElementById('TProxy-{$t}').checked){\n\t\t\tdocument.getElementById('transparent-{$t}').checked=false;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').checked=false;\n\t\t\tdocument.getElementById('is_nat-{$t}').checked=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').checked=false;\n\t\t\tdocument.getElementById('Parent-{$t}').checked=false;\n\t\t\tdocument.getElementById('ICP-{$t}').checked=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').checked=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('NoAuth-{$t}').checked=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=false;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=false;\n\t\t}\n\t}\n\t\n\tfunction CheckMikrotik(){\n\t\tif(document.getElementById('MIKROTIK_PORT-{$t}').checked){\n\t\t\tdocument.getElementById('transparent-{$t}').checked=false;\n\t\t\t\n\t\t\tdocument.getElementById('TProxy-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').disabled=true;\n\t\t\t\n\t\t\tdocument.getElementById('is_nat-{$t}').checked=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').checked=false;\n\t\t\tdocument.getElementById('Parent-{$t}').checked=false;\n\t\t\tdocument.getElementById('ICP-{$t}').checked=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').checked=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=false;\n\t\t\t\n\t\t\tdocument.getElementById('transparent-{$t}').disabled=true;\n\t\t\tdocument.getElementById('is_nat-{$t}').disabled=true;\n\t\t\tdocument.getElementById('WCCP-{$t}').disabled=true;\n\t\t\tdocument.getElementById('Parent-{$t}').disabled=true;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').disabled=true;\n\t\t\tdocument.getElementById('ICP-{$t}').disabled=true;\n\t\t\tdocument.getElementById('FTP-{$t}').disabled=true;\n\t\t\t\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('NoAuth-{$t}').checked=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').disabled=false;\n\t\t\tdocument.getElementById('transparent-{$t}').disabled=false;\n\t\t\tdocument.getElementById('is_nat-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').disabled=false;\n\t\t\tdocument.getElementById('Parent-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').disabled=false;\n\t\t\tdocument.getElementById('ICP-{$t}').disabled=false;\n\t\t\tdocument.getElementById('FTP-{$t}').disabled=false;\n\t\t}\n\t}\n\t\n\t\n\tfunction CheckWCCP(){\n\t\tif(document.getElementById('WCCP-{$t}').checked){\n\t\t\tdocument.getElementById('FTP-{$t}').disabled=true;\n\t\t\tdocument.getElementById('FTP-{$t}').checked=false;\n\t\t\tdocument.getElementById('transparent-{$t}').checked=false;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').checked=false;\n\t\t\tdocument.getElementById('is_nat-{$t}').checked=false;\n\t\t\tdocument.getElementById('Parent-{$t}').checked=false;\n\t\t\tdocument.getElementById('ICP-{$t}').checked=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').checked=false;\n\t\t\tdocument.getElementById('sslcertificate-{$t}').disabled=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('NoAuth-{$t}').checked=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=false;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=false;\n\t\t}\n\t}\n\t\n\tfunction CheckNat(){\n\t\tif(document.getElementById('is_nat-{$t}').checked){\n\t\t\tdocument.getElementById('FTP-{$t}').disabled=true;\n\t\t\tdocument.getElementById('FTP-{$t}').checked=false;\n\t\t\n\t\t    document.getElementById('MIKROTIK_PORT-{$t}').checked=false;\n\t\t\tdocument.getElementById('transparent-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').checked=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').checked=false;\n\t\t\tdocument.getElementById('Parent-{$t}').checked=false;\n\t\t\tdocument.getElementById('ICP-{$t}').checked=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').checked=false;\n\t\t\tdocument.getElementById('sslcertificate-{$t}').disabled=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('NoAuth-{$t}').checked=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=false;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=false;\n\t\t}\n\t}\n\t\n\tfunction CheckParent(){\n\t\tif(document.getElementById('Parent-{$t}').checked){\n\t\t\tdocument.getElementById('FTP-{$t}').disabled=true;\n\t\t\tdocument.getElementById('FTP-{$t}').checked=false;\n\t\t\n\t\t\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').checked=false;\n\t\t\tdocument.getElementById('transparent-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').checked=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').checked=false;\n\t\t\tdocument.getElementById('is_nat-{$t}').checked=false;\n\t\t\tdocument.getElementById('ICP-{$t}').checked=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').checked=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\t\t\n\t\t}else{\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=false;\n\t\t}\n\t\n\t}\n\t\n\tfunction CheckICP(){\n\t\tif(document.getElementById('ICP-{$t}').checked){\n\t\t\n\t\t\tdocument.getElementById('FTP-{$t}').disabled=true;\n\t\t\tdocument.getElementById('FTP-{$t}').checked=false;\n\t\t\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').checked=false;\n\t\t\tdocument.getElementById('transparent-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').checked=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').checked=false;\n\t\t\tdocument.getElementById('Parent-{$t}').checked=false;\n\t\t\tdocument.getElementById('is_nat-{$t}').checked=false;\n\t\t\tdocument.getElementById('UseSSL-{$t}').checked=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').checked=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=true;\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=false;\n\t\t}\n\t}\n\t\n\tfunction CheckFTPT(){\n\t\tif(document.getElementById('FTP-{$t}').checked){\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').checked=false;\n\t\t\tdocument.getElementById('transparent-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').checked=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').checked=false;\n\t\t\tdocument.getElementById('Parent-{$t}').checked=false;\n\t\t\tdocument.getElementById('is_nat-{$t}').checked=false;\n\t\t\tdocument.getElementById('UseSSL-{$t}').checked=false;\n\t\t\tdocument.getElementById('ICP-{$t}').checked=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').checked=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=true;\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\t\tdocument.getElementById('NoAuth-{$t}').checked=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=true;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\t\t\n\t\t}else{\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=false;\n\t\t}\n\t}\n\t\n\tfunction CheckWANProxy(){\n\t\tif(document.getElementById('WANPROXY-{$t}').checked){\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').checked=false;\n\t\t\tdocument.getElementById('transparent-{$t}').checked=false;\n\t\t\tdocument.getElementById('TProxy-{$t}').checked=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').checked=false;\n\t\t\tdocument.getElementById('Parent-{$t}').checked=false;\n\t\t\tdocument.getElementById('is_nat-{$t}').checked=false;\n\t\t\tdocument.getElementById('UseSSL-{$t}').checked=false;\n\t\t\tdocument.getElementById('ICP-{$t}').checked=false;\n\t\t\tdocument.getElementById('FTP-{$t}').checked=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=true;\n\t\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').checked=false;\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=true;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=false;\n\t\t\t\n\t\t}\t\n\t\n\t}\n\t\n\t\n\tfunction Check{$t}(){\n\t\tdocument.getElementById('nic-{$t}').disabled=true;\n\t\tdocument.getElementById('port-{$t}').disabled=true;\n\t\tdocument.getElementById('xnote-{$t}').disabled=true;\n\t\tdocument.getElementById('transparent-{$t}').disabled=true;\n\t\tdocument.getElementById('TProxy-{$t}').disabled=true;\n\t\tdocument.getElementById('PortName-{$t}').disabled=true;\n\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=true;\n\t\tdocument.getElementById('sslcertificate-{$t}').disabled=true;\n\t\tdocument.getElementById('UseSSL-{$t}').disabled=true;\n\t\tdocument.getElementById('is_nat-{$t}').disabled=true;\n\t\tdocument.getElementById('WCCP-{$t}').disabled=true;\n\t\tdocument.getElementById('Parent-{$t}').disabled=true;\n\t\tdocument.getElementById('ICP-{$t}').disabled=true;\n\t\tdocument.getElementById('WANPROXY_PORT-{$t}').disabled=true;\n\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=true;\n\t\tdocument.getElementById('NoAuth-{$t}').disabled=true;\n\n\t\t\n\t\tif(document.getElementById('enabled-{$t}').checked){\n\t\t\tdocument.getElementById('NoAuth-{$t}').disabled=false;\n\t\t\tdocument.getElementById('transparent-{$t}').disabled=false;\n\t\t\tdocument.getElementById('nic-{$t}').disabled=false;\n\t\t\tdocument.getElementById('port-{$t}').disabled=false;\n\t\t\tdocument.getElementById('xnote-{$t}').disabled=false;\n\t\t\tdocument.getElementById('PortName-{$t}').disabled=false;\t\t\n\t\t\tdocument.getElementById('TProxy-{$t}').disabled=false;\n\t\t\tdocument.getElementById('outgoing_addr-{$t}').disabled=false;\t\t\n\t\t\tdocument.getElementById('sslcertificate-{$t}').disabled=false;\n\t\t\tdocument.getElementById('UseSSL-{$t}').disabled=false;\n\t\t\tdocument.getElementById('is_nat-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WCCP-{$t}').disabled=false;\n\t\t\tdocument.getElementById('Parent-{$t}').disabled=false;\n\t\t\tdocument.getElementById('ICP-{$t}').disabled=false;\n\t\t\tdocument.getElementById('WANPROXY-{$t}').disabled=false;\n\t\t\tdocument.getElementById('MIKROTIK_PORT-{$t}').disabled=false;\n\t\t\tif(document.getElementById('WANPROXY-{$t}').checked){document.getElementById('WANPROXY_PORT-{$t}').disabled=false;}\n\t\t}\n\t\t\n\t\tCheckGlobal{$t}();\n\t\n\t}\n\t\n\tfunction CheckUseSSL{$t}(){\n\t\tdocument.getElementById('sslcertificate-{$t}').disabled=false;\n\t\tif(document.getElementById('UseSSL-{$t}').checked){\n\t\t\tdocument.getElementById('sslcertificate-{$t}').disabled=false;\n\t\t}\n\t}\nfunction CheckGlobal{$t}(){\n\tCheckNat();\n\tCheckWCCP();\n\tCheckParent();\n\tCheckICP();\n\tCheckFTPT();\n\tCheckWANProxy();\n\tCheckUseSSL{$t}();\n\tCheckMikrotik();\n}\nCheck{$t}();\nCheckGlobal{$t}();\n</script>\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n";
    return $tpl->_ENGINE_parse_body($html);
}
Example #20
0
function virtual_add_form(){
	$ldap=new clladp();
	$sock=new sockets();
	$page=CurrentPageName();
	$users=new usersMenus();
	$tpl=new templates();	
	$t=$_GET["t"];
	if(!is_numeric($t)){$t=0;}	
	$nics=unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
	$EnablePostfixMultiInstance=$sock->GET_INFO("EnablePostfixMultiInstance");
	$NoGatewayForVirtualNetWork=$sock->GET_INFO("NoGatewayForVirtualNetWork");
	$DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement");
	if(!is_numeric($NoGatewayForVirtualNetWork)){$NoGatewayForVirtualNetWork=0;}
	if(!is_numeric($DisableNetworksManagement)){$DisableNetworksManagement=0;}
	$FailOver=0;
	$NoGatewayForVirtualNetWorkExplain=$tpl->javascript_parse_text("{NoGatewayForVirtualNetWorkExplain}");	
	if($users->LinuxDistriCode=="DEBIAN"){
		if(preg_match("#Debian\s+([0-9]+)\.#",$users->LinuxDistriFullName,$re)){
			$DEBIAN_MAJOR=$re[1];
			if($DEBIAN_MAJOR==6){$FailOver=1;}
		}
		
	}
	
	
	$title_button="{add}";
	if(!is_numeric($_GET["ID"])){$_GET["ID"]=0;}
	
	if($_GET["ID"]>0){
		$sql="SELECT * FROM nics_virtuals WHERE ID='{$_GET["ID"]}'";
		$q=new mysql();
		$ligne=@mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup"));
		$title_button="{apply}";
	}
	
	if(isset($_GET["default-datas"])){
			$default_array=unserialize(base64_decode($_GET["default-datas"]));
			if(is_array($default_array)){
				$ligne["nic"]=$default_array["NIC"];
			if(preg_match("#(.+?)\.([0-9]+)$#",$default_array["IP"],$re)){
				if($re[2]>254){$re[2]=1;}
				$re[2]=$re[2]+1;
				$ligne["ipaddr"]="{$re[1]}.{$re[2]}";
				$ligne["gateway"]=$default_array["GW"];
				$ligne["netmask"]=$default_array["NETMASK"];
			}
		}
	}

	if($ligne["metric"]==0){$ligne["metric"]=100+$_GET["ID"];}
	
	$styleOfFields="font-size:16px;padding:3px";
	$ous=$ldap->hash_get_ou(true);
	$ous["openvpn_service"]="{APP_OPENVPN}";
	
	if($users->crossroads_installed){
		if($EnablePostfixMultiInstance==1){
			$ous["crossroads"]="{load_balancer}";
		}
	}
	
	$AsDebianSystem=1;
	while (list ($num, $val) = each ($nics) ){$nics_array[$val]=$val;}
	if(!$users->AsDebianSystem){$AsDebianSystem=0;}
	$nics_array[null]="{select}";
	
	$ous[null]="{select}";
	
	$nic_field=Field_array_Hash($nics_array,"nic",$ligne["nic"],null,null,0,"font-size:16px;padding:3px");
	$ou_fields=Field_array_Hash($ous,"org",$ligne["org"],null,null,0,"font-size:16px;padding:3px");
	$html="
	<div id='virtip'>
	". Field_hidden("ID","{$_GET["ID"]}")."
	<table style='width:99%' class=form>
	<tr>
		<td class=legend style='font-size:16px'>{nic}:</td>
		<td>$nic_field</td>
	</tr>
	<tr>
		<td class=legend style='font-size:16px'>{organization}:</td>
		<td>$ou_fields</td>
	</tr>	
	<tr>
			<td class=legend style='font-size:16px'>{tcp_address}:</td>
			
			<td>" . field_ipv4("ipaddr",$ligne["ipaddr"],$styleOfFields,false,"CalcCdirVirt(0)")."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:16px'>{netmask}:</td>
			<td>" . field_ipv4("netmask",$ligne["netmask"],$styleOfFields,false,"CalcCdirVirt(0)")."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:16px'>CDIR:</td>
			<td style='padding:-1px;margin:-1px'>
			<table style='width:99%;padding:-1px;margin:-1px'>
			<tr>
			<td width=1%>
			" . Field_text("cdir",$ligne["cdir"],"$styleOfFields;width:190px",null,null,null,false,null,$DISABLED)."</td>
			<td align='left'> ".imgtootltip("img_calc_icon.gif","cdir","CalcCdirVirt(1)") ."</td>
			</tr>
			</table></td>
		</tr>			
		<tr>
			<td class=legend style='font-size:16px'>{gateway}:</td>
			<td>" . field_ipv4("gateway_virtual",$ligne["gateway"],$styleOfFields,false)."</td>
		</tr>
		<tr>
			<td class=legend style='font-size:16px'>{metric}:</td>
			<td>" . field_text("metric_virtual",$ligne["metric"],"$styleOfFields;width:90px",false)."</td>
		</tr>					
		<tr>
			<td class=legend style='font-size:16px'>failover:</td>
			<td>" . Field_checkbox("failover",1,$ligne["failover"],"FaileOverCheck()")."</td>
		</tr>		
		<tr>
			<td class=legend style='font-size:16px'>{ForceGateway}:</td>
			<td>" . Field_checkbox("ForceGateway",1,$ligne["ForceGateway"])."</td>
		</tr>
		
		
	</table>
	</div>
	<div id='infosVirtual' style='font-size:13px'></div>
	<div style='text-align:right'><hr>". button($title_button,"VirtualIPAddSave()",18)."</div>
	<script>
		var Netid={$_GET["ID"]};
		var FailOver=$FailOver;
		var cdir=document.getElementById('cdir').value;
		var netmask=document.getElementById('netmask').value;
		if(netmask.length>0){
			if(cdir.length==0){
				CalcCdirVirt(0);
				}
			}
		if(Netid>0){
			document.getElementById('ipaddr').disabled=true;
		}
		
		
		function CheckGateway(){
			var NoGatewayForVirtualNetWork=$NoGatewayForVirtualNetWork;
			var AsDebianSystem=$AsDebianSystem;
			if(AsDebianSystem==0){
				document.getElementById('ForceGateway').disabled=true;
				document.getElementById('ForceGateway').checked=false;
			}
			document.getElementById('gateway_virtual').disabled=false;
			if(NoGatewayForVirtualNetWork==1){
				document.getElementById('gateway_virtual').disabled=true;
				document.getElementById('gateway_virtual').value='';
				document.getElementById('ForceGateway').disabled=true;
				document.getElementById('ForceGateway').checked=false;				
				document.getElementById('infosVirtual').innerHTML='$NoGatewayForVirtualNetWorkExplain';
				
			}
			
			document.getElementById('failover').disabled=true;
			if(FailOver==1){document.getElementById('failover').disabled=false;}
			
			
		}
		
		
		function VirtualIPAddSave(){
			var DisableNetworksManagement=$DisableNetworksManagement;
			var NoGatewayForVirtualNetWork=$NoGatewayForVirtualNetWork;
			if(DisableNetworksManagement==1){alert('$ERROR_NO_PRIVS');return;}		
			var XHR = new XHRConnection();
			XHR.appendData('virt-ipaddr',document.getElementById('ipaddr').value);
			XHR.appendData('netmask',document.getElementById('netmask').value);
			XHR.appendData('cdir',document.getElementById('cdir').value);
			XHR.appendData('metric',document.getElementById('metric_virtual').value);
			
			
			
			if(NoGatewayForVirtualNetWork==0){XHR.appendData('gateway',document.getElementById('gateway_virtual').value);}
			if(NoGatewayForVirtualNetWork==1){XHR.appendData('gateway','');}
			XHR.appendData('nic',document.getElementById('nic').value);
			XHR.appendData('org',document.getElementById('org').value);
			XHR.appendData('ID',document.getElementById('ID').value);
			if(document.getElementById('ForceGateway').checked){XHR.appendData('ForceGateway',1);}else{XHR.appendData('ForceGateway',0);}
			if(document.getElementById('failover')){
				if(document.getElementById('failover').checked){XHR.appendData('failover',1);}else{XHR.appendData('failover',0);}
			}
			MemFlexGrid=$t;
			AnimateDiv('virtip');
			XHR.sendAndLoad('$page', 'GET',X_VirtualIPAddSave);
		}

		function FaileOverCheck(){
			document.getElementById('netmask').disabled=false;
			document.getElementById('gateway_virtual').disabled=false;
			
		
			if(document.getElementById('failover').checked){
				document.getElementById('netmask').disabled=true;
				document.getElementById('gateway_virtual').disabled=true;					
			}
			
		
			//post-up /sbin/ifconfig eth0:1 IP.DE.FAIL.OVER1 netmask 255.255.255.255 broadcast IP.DE.FAIL.OVER1
		
		}
		
		CheckGateway();
		FaileOverCheck();
	</script>
	
	";

	echo $tpl->_ENGINE_parse_body($html);
	
	
	
}
Example #21
0
function setup_2()
{
    if ($GLOBALS["VERBOSE"]) {
        echo "<span style='color:#d32d2d'>[" . __LINE__ . "] setup_2()</span><br>\n";
    }
    $GLOBALS["DEBUG_TEMPLATE"] = true;
    include_once dirname(__FILE__) . "/ressources/class.langages.inc";
    if ($GLOBALS["VERBOSE"]) {
        echo "<span style='color:#d32d2d'>[" . __LINE__ . "] articaLang()</span><br>\n";
    }
    $langAutodetect = new articaLang();
    $DetectedLanguage = $langAutodetect->get_languages();
    $GLOBALS["FIXED_LANGUAGE"] = $DetectedLanguage;
    $savedsettings = unserialize(base64_decode($_GET["savedsettings"]));
    $setup_proxy = 0;
    $tpl = new templates();
    $page = CurrentPageName();
    $sock = new sockets();
    $users = new usersMenus();
    if ($GLOBALS["VERBOSE"]) {
        echo "<span style='color:#d32d2d'>[" . __LINE__ . "] OK</span><br>\n";
    }
    $netbiosname_field = $tpl->javascript_parse_text("{netbiosname}");
    $domain_field = $tpl->javascript_parse_text("{domain}");
    if (count($savedsettings) < 3) {
        if ($GLOBALS["VERBOSE"]) {
            echo "<span style='color:#d32d2d'>[" . __LINE__ . "] network.php?fqdn=yes</span><br>\n";
        }
        $hostname = base64_decode($sock->getFrameWork("network.php?fqdn=yes"));
        if ($hostname == null) {
            $users = new usersMenus();
            $hostname = $users->fqdn;
        }
        $arrayNameServers = GetNamesServers();
        if (strpos($hostname, '.') > 0) {
            $Thostname = explode(".", $hostname);
            $netbiosname = $Thostname[0];
            unset($Thostname[0]);
            $domainname = @implode(".", $Thostname);
        } else {
            $netbiosname = $hostname;
        }
        if (preg_match("#[A-Za-z]+\\s+[A-Za-z]+#", $netbiosname)) {
            $netbiosname = null;
        }
    } else {
        $netbiosname = $savedsettings["netbiosname"];
        $domainname = $savedsettings["domain"];
        $arrayNameServers[0] = $savedsettings["DNS1"];
        $arrayNameServers[1] = $savedsettings["DNS2"];
    }
    if ($netbiosname == null) {
        $hostname = base64_decode($sock->getFrameWork("network.php?fqdn=yes"));
        if ($hostname == null) {
            $users = new usersMenus();
            $hostname = $users->fqdn;
        }
        if (strpos($hostname, '.') > 0) {
            $Thostname = explode(".", $hostname);
            $netbiosname = $Thostname[0];
            unset($Thostname[0]);
            $domainname = @implode(".", $Thostname);
        } else {
            $netbiosname = $hostname;
        }
    }
    if ($arrayNameServers[0] == null) {
        $arrayNameServers = GetNamesServers();
    }
    $SetupAD = 0;
    if ($users->SQUID_INSTALLED) {
        if ($users->SAMBA_INSTALLED) {
            $SetupAD = 1;
        }
    }
    if ($users->SQUID_INSTALLED) {
        $setup_proxy = 1;
        if ($users->SQUID_REVERSE_APPLIANCE) {
            $setup_proxy = 0;
            $proxy = "<input type='hidden' id='proxy_listen_port' value='80' name='proxy_listen_port'>";
        }
    }
    $dhcpd = null;
    $SERVICES_TITLE = null;
    //FIRST_WIZARD_NIC2 -> fini -> demande de reboot
    $t = time();
    $IPADDR = $savedsettings["IPADDR"];
    $NETMASK = $savedsettings["NETMASK"];
    $GATEWAY = $savedsettings["GATEWAY"];
    $metric = $savedsettings["metric"];
    $BROADCAST = $savedsettings["BROADCAST"];
    $KEEPNET = $savedsettings["KEEPNET"];
    $NIC = $savedsettings["NIC"];
    $VPS_COMPATIBLE = $savedsettings["VPS_COMPATIBLE"];
    $nic = new system_nic("eth0");
    if ($IPADDR == null) {
        $IPADDR = $nic->IPADDR;
    }
    if ($NETMASK == null) {
        $NETMASK = $nic->NETMASK;
    }
    if ($GATEWAY == null) {
        $GATEWAY = $nic->GATEWAY;
    }
    if ($BROADCAST == null) {
        $BROADCAST = $nic->BROADCAST;
    }
    if ($metric == null) {
        $metric = $nic->metric;
    }
    if (!is_numeric($metric)) {
        $metric = 100;
    }
    if ($metric < 2) {
        $metric = 100;
    }
    $DISABLED = false;
    if (trim($arrayNameServers[1]) == null) {
        $arrayNameServers[1] = "8.8.8.8";
    }
    if (!is_numeric($KEEPNET)) {
        $KEEPNET = 0;
    }
    $NICS = new networking();
    $Local_interfaces = $NICS->Local_interfaces(true);
    if (count($Local_interfaces) == 0) {
        $error = FATAL_ERROR_SHOW_128("{unable_to_retreive_network_information_refresh}");
    }
    $timezone = timezonearray();
    for ($i = 0; $i < count($timezone); $i++) {
        $arrayTime[$timezone[$i]] = $timezone[$i];
    }
    $timezone_def = getLocalTimezone();
    $FORM = "{$error}\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2 style='font-size:50px;'><div style='margin-bottom:35px'>{serveretdom}</div></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:25px;vertical-align:top' nowrap>{timezone}:</td>\n\t\t<td valign='top'>" . Field_array_Hash($arrayTime, "timezones", $timezone_def, null, null, "style:font-size:25px;padding:3px") . "</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:25px' nowrap>{netbiosname}:</td>\n\t\t<td>" . Field_text("hostname_netbios", $netbiosname, "font-size:25px;width:220px", null, null, null, false, "ChangeQuickHostnameCheck(event)") . "</td>\n\t</tr>\n\t</tr>\n\t\t<td class=legend style='font-size:25px' nowrap>{DomainOfThisserver}:</td>\n\t\t<td>" . Field_text("hostname_domain", $domainname, "font-size:25px;width:220px", null, null, null, false, "ChangeQuickHostnameCheck(event)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 style='font-size:50px;padding-top:50px'>{network}</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:18px;font-weight:bolder'><div style='margin-bottom:35px'>{network_settings_will_be_applied_after_reboot}</div></td>\n\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px' nowrap>{keep_current_settings}:</td>\n\t\t\t<td>" . Field_checkbox("KEEPNET", 1, $KEEPNET, 'KeepNetCheck()') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px' nowrap>{VPS_COMPATIBLE}:</td>\n\t\t\t<td>" . Field_checkbox("VPS_COMPATIBLE", 1, $VPS_COMPATIBLE, '') . "</td>\n\t\t</tr>\n\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px' nowrap>{network_interface}:</td>\n\t\t\t<td>" . Field_array_Hash($Local_interfaces, "NIC", "{$NIC}", "ChangeWizardNetInterfaces()", null, 0, "padding:3px;font-size:25px") . "</td>\n\t\t</tr>\n\t</table>\n\t<br>\n\t<span id='INTERFACES_OBJECTS'>\t\n\t<table style='width:100%'>\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px' nowrap>{tcp_address}:</td>\n\t\t\t<td>" . field_ipv4("IPADDR", $IPADDR, 'padding:3px;font-size:25px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px'>{netmask}:</td>\n\t\t\t<td>" . field_ipv4("NETMASK", $NETMASK, 'padding:3px;font-size:25px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px'>{gateway}:</td>\n\t\t\t<td>" . field_ipv4("GATEWAY", $GATEWAY, 'padding:3px;font-size:25px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px'>{metric}:</td>\n\t\t\t<td>" . field_text("metric-{$t}", $metric, 'padding:3px;font-size:25px;width:90px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px'>{broadcast}:</td>\n\t\t\t<td>" . field_ipv4("BROADCAST", $BROADCAST, 'padding:3px;font-size:25px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t</TABLE>\n\t</SPAN>\n\t<br>\n\t<table style='width:100%'>\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:50px;'><div style='margin-bottom:35px'>DNS</div></td>\n\t</tr>\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:25px' nowrap>{primary_dns}:</td>\n\t\t<td>" . field_ipv4("DNS1", $arrayNameServers[0], "padding:3px;font-size:25px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:25px' nowrap>{secondary_dns}:</td>\n\t\t<td>" . field_ipv4("DNS2", $arrayNameServers[1], "padding:3px;font-size:25px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:16px;font-weight:bolder'>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:25px;font-weight:bolder'><div style='text-align:right'><hr>" . button("{next}", "ChangeQuickHostname()", "30px") . "</div></td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t<script>\n\t\tvar X_ChangeQuickHostname= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tUnlockPage();\n\t\t\tvar setup_proxy={$setup_proxy};\n\t\t\tif(setup_proxy==1){\n\t\t\t\tLoadAjax('setup-content','{$page}?setup-proxy-type=yes&savedsettings='+results)\n\t\t\t\treturn;\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\tvar SetupAD={$SetupAD};\n\t\t\tif(SetupAD==1){\n\t\t\t\tLoadAjax('setup-content','{$page}?setup-active-directory=yes&savedsettings='+results)\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\tLoadAjax('setup-content','{$page}?setup-3=yes&savedsettings='+results)\n\t\t\t}\n\t\t\t\n\t\tfunction ChangeQuickHostnameCheck(e){\n\t\t\tif(checkEnter(e)){ChangeQuickHostname();}\n\t\t}\n\t\t\n\t\tfunction ChangeWizardNetInterfaces(){\n\t\t\tvar nic=document.getElementById('NIC').value;\n\t\t\tLoadAjax('INTERFACES_OBJECTS','{$page}?setup-nic=yes&t={$t}&NIC='+nic)\n\t\t\n\t\t}\n\t\t\n\t\tfunction KeepNetCheck(){\n\t\t\tdocument.getElementById('NIC').disabled=false;\n\t\t\tdocument.getElementById('hostname_netbios').disabled=false;\n\t\t\tdocument.getElementById('hostname_domain').disabled=false;\n\t\t\tdocument.getElementById('IPADDR').disabled=false;\n\t\t\tdocument.getElementById('NETMASK').disabled=false;\n\t\t\tdocument.getElementById('GATEWAY').disabled=false;\n\t\t\tdocument.getElementById('BROADCAST').disabled=false;\n\t\t\tdocument.getElementById('metric-{$t}').disabled=false;\t\n\t\t\tdocument.getElementById('DNS1').disabled=false;\n\t\t\tdocument.getElementById('DNS2').disabled=false;\n\t\t\tdocument.getElementById('VPS_COMPATIBLE').disabled=false;\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('KEEPNET').checked){\n\t\t\t\tdocument.getElementById('NIC').disabled=true;\n\t\t\t\tdocument.getElementById('VPS_COMPATIBLE').disabled=true;\n\t\t\t\tdocument.getElementById('IPADDR').disabled=true;\n\t\t\t\tdocument.getElementById('NETMASK').disabled=true;\n\t\t\t\tdocument.getElementById('GATEWAY').disabled=true;\n\t\t\t\tdocument.getElementById('BROADCAST').disabled=true;\n\t\t\t\tdocument.getElementById('metric-{$t}').disabled=true;\t\n\t\t\t\tdocument.getElementById('DNS1').disabled=true;\n\t\t\t\tdocument.getElementById('DNS2').disabled=true;\n\t\t\t\tdocument.getElementById('hostname_netbios').disabled=true;\n\t\t\t\tdocument.getElementById('hostname_domain').disabled=true;\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\n\t\t\n\t\tfunction ChangeQuickHostname(){\n\t\t\tKEEPNET=0;\n\t\t\tVPS_COMPATIBLE=0;\n\t\t\tif(document.getElementById('KEEPNET').checked){KEEPNET=1;}\n\t\t\tif(document.getElementById('VPS_COMPATIBLE').checked){VPS_COMPATIBLE=1;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tvar netbios=document.getElementById('hostname_netbios').value;\n\t\t\tvar dom=document.getElementById('hostname_domain').value;\n\t\t\tif(KEEPNET==0){\n\t\t\t\tif(netbios.length==0){alert('{$netbiosname_field} (Null!)');return;}\n\t\t\t\tif(dom.length==0){alert('{$domain_field} (Null!)');return;}\n\t\t\t\tif(dom=='localhost.localdomain'){alert('localhost.localdomain wrong domain...');return;}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('proxy_listen_port')){\n\t\t\t\tXHR.appendData('proxy_listen_port',document.getElementById('proxy_listen_port').value);\n\t\t\t}\n\t\t\tif(document.getElementById('EnablePDNS')){\n\t\t\t\tvar EnablePDNS=0;\n\t\t\t\tif(document.getElementById('EnablePDNS').checked){EnablePDNS=1;}\n\t\t\t\tXHR.appendData('EnablePDNS',EnablePDNS);\n\t\t\t}\n\n\t\t\tif(document.getElementById('EnableFreeRadius')){\n\t\t\t\tvar EnableFreeRadius=0;\n\t\t\t\tif(document.getElementById('EnableFreeRadius').checked){EnableFreeRadius=1;}\n\t\t\t\tXHR.appendData('EnableFreeRadius',EnableFreeRadius);\n\t\t\t}\n\n\t\t\tif(document.getElementById('EnableDHCPServer')){\n\t\t\t\tXHR.appendData('EnableDHCPServer',document.getElementById('EnableDHCPServer').value);\n\t\t\t}\n\t\t\t\n\n\n\t\t\tif(document.getElementById('EnableWebFiltering')){\n\t\t\t\tXHR.appendData('EnableWebFiltering',document.getElementById('EnableWebFiltering').value);\n\t\t\t}\n\n\t\t\tif(document.getElementById('AsCategoriesAppliance')){\n\t\t\t\tXHR.appendData('AsCategoriesAppliance',document.getElementById('AsCategoriesAppliance').value);\n\t\t\t}\t\t\t\n\t\t\t\n\n\t\t\tif(document.getElementById('timezones')){\n\t\t\t\tXHR.appendData('timezones',document.getElementById('timezones').value);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t \n\t\t\tXHR.appendData('KEEPNET',KEEPNET);\n\t\t\t\n\t\t\tif(KEEPNET==0){ \n\t\t\t\tXHR.appendData('VPS_COMPATIBLE',VPS_COMPATIBLE);\n\t\t\t\tXHR.appendData('NIC',document.getElementById('NIC').value);\n\t\t\t\tXHR.appendData('IPADDR',document.getElementById('IPADDR').value);\n\t\t\t\tXHR.appendData('NETMASK',document.getElementById('NETMASK').value);  \n\t\t\t\tXHR.appendData('GATEWAY',document.getElementById('GATEWAY').value);\n\t\t\t\tXHR.appendData('BROADCAST',document.getElementById('BROADCAST').value);\n\t\t\t\tXHR.appendData('metric',document.getElementById('metric-{$t}').value);          \n\t\t\t\tXHR.appendData('DNS1',document.getElementById('DNS1').value);\n\t\t\t\tXHR.appendData('DNS2',document.getElementById('DNS2').value);\n\t\t\t\tXHR.appendData('netbiosname',netbios);\n\t\t\t\tXHR.appendData('domain',dom);\n\t\t\t}\n\t\t\t\n\t\t\tXHR.appendData('savedsettings','{$_GET["savedsettings"]}');\n\t\t\tAnimateDiv('setup-content');\n\t\t\tLockPage();\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',X_ChangeQuickHostname);\n\t\t\t\n\t\t}\n\t\tKeepNetCheck();\n\t\tdocument.getElementById('content').style.height='1250px';\n\t</script>\n\t\n\t";
    $html = "\n\t<div style='font-size:35px;font-weight:bolder;margin-bottom:10px'>{squid_net_simple}</div>\n\t{$FORM}\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}