function interface_popup() { $tpl = new templates(); $page = CurrentPageName(); $q = new mysql_shorewall(); $bt_title = "{add}"; $ID = $_GET["ID"]; if ($ID == null) { $title = $tpl->javascript_parse_text("{link_interface}"); } if ($ID != null) { $bt_title = "{apply}"; $q = new mysql_shorewall(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT eth FROM fw_interfaces WHERE eth='{$ID}'")); $ip = new system_nic($ID); $title = $tpl->javascript_parse_text("{interface}: {$ip->NICNAME} - " . $ligne["eth"]); } $net = new networking(); $ethz = $net->Local_interfaces(); while (list($num, $ligne) = each($ethz)) { $ip = new system_nic($num); $ethz[$num] = "{$ip->NICNAME} ({$num})"; } $t = time(); $html = "\n\t<div style='font-size:20px'>{$title}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{interface}:</td>\n\t\t<td>" . Field_array_Hash($ethz, "interface-{$t}", $ligne["type"], null, null, 0, "font-size:16px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'>" . button($bt_title, "Save{$t}()", 18) . "</td>\n\t</tr>\t\t\n\t</table>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);}\n\tvar ID='{$ID}';\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n\t\$('#flexRT{$_GET["tt"]}').flexReload();\n\tExecuteByClassName('SearchFunction');\n\tif(ID.length==0){YahooWinHide();}\n}\n\nfunction SaveCHK{$t}(e){\n\tif(!checkEnter(e)){return;}\n\tSave{$t}();\n}\n\t\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('interface-save', encodeURIComponent(document.getElementById('interface-{$t}').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\t"; echo $tpl->_ENGINE_parse_body($html); }
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 table() { $tpl = new templates(); $page = CurrentPageName(); $users = new usersMenus(); $sock = new sockets(); $net = new networking(); $interfaces = $net->Local_interfaces(); unset($interfaces["lo"]); if (!$users->CONNTRACK_INSTALLED) { echo FATAL_ERROR_SHOW_128("{conntrackd_not_installed}"); return; } $network_bridges = $tpl->_ENGINE_parse_body("{network_bridges}"); $from = $tpl->javascript_parse_text("{from}"); $to = $tpl->javascript_parse_text("{to}"); $status = $tpl->_ENGINE_parse_body("{status}"); $source_port = $tpl->javascript_parse_text("{source_port}"); $to = $tpl->_ENGINE_parse_body("{to}"); $t = $_GET["t"]; if (!is_numeric($t)) { $t = time(); } $tablesize = 868; $descriptionsize = 705; $bts = array(); $add = $tpl->_ENGINE_parse_body("{new_network_bridge}"); $delete = $tpl->javascript_parse_text("{delete}"); $destination_port = $tpl->javascript_parse_text("{destination_port}"); $connections_tracking = $tpl->javascript_parse_text("{connections_tracking}"); $bts[] = "{name: '{$add}', bclass: 'add', onpress :RuleAdd{$t}},"; $bts[] = "{name: '{$reconstruct}', bclass: 'apply', onpress : BuildVLANs{$t}},"; $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement"); if ($DisableNetworksManagement == null) { $DisableNetworksManagement = 0; } if (count($bts) > 0) { $buttons = "buttons : [" . @implode("\n", $bts) . " ],"; } $reboot_network_explain = $tpl->_ENGINE_parse_body("{bridges_iptables_explain}<p> </p>{reboot_network_explain}"); $buttons = null; $html = "\n\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:99%'></table>\n\n\t<script>\n\tvar mm{$t}=0;\n\t\$(document).ready(function(){\n\t\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?list=yes&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: 'PROTO', name : 'PROTO', width : 50, sortable : false, align: 'center'},\n\t{display: '{$from}', name : 'from', width : 169, sortable : false, align: 'left'},\n\t{display: ' ', name : 'fromZ', width : 160, sortable : false, align: 'left'},\n\t{display: ' ', name : 'fromT', width : 45, sortable : false, align: 'left'},\n\t{display: ' ', name : 'none1', width : 121, sortable : false, align: 'center'},\n\t{display: '{$to}', name : 'to', width : 169, sortable : false, align: 'left'},\n\t{display: ' ', name : 'ToZ', width : 160, sortable : false, align: 'left'},\n\t{display: ' ', name : 'ToT', width : 45, sortable : false, align: 'left'},\n\t{display: '{$status}', name : 'delete', width : 120, sortable : false, align: 'center'},\n\t],{$buttons}\n\tsearchitems : [\n\t{display: '{$from}', name : 'src'},\n\t{display: '{$source_port}', name : 'sport'},\n\t{display: '{$to}', name : 'dst'},\n\t{display: '{$destination_port}', name : 'dport'},\n\n\n\n\t],\n\tsortname: 'ID',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$connections_tracking}',\n\tuseRp: true,\n\trp: 25,\n\trpOptions: [25,50,100,200,500,1000],\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 400,\n\tsingleSelect: true\n\n});\n});\n\nfunction RuleAdd{$t}(){\nLoadjs('{$page}?network-bridge-js=yes&ID=0&t={$t}',true);\n}\n\nfunction BuildVLANs{$t}(){\nLoadjs('network.restart.php?t={$t}');\n\n}\n\n\n\nfunction EmptyTask{$t}(){\nif(confirm('{$empty}::{$_GET["taskid"]}')){\n\n}\n}\n\n\n</script>\n\n"; echo $tpl->_ENGINE_parse_body($html); }
function page() { $sock = new sockets(); $page = CurrentPageName(); $tpl = new templates(); $MikrotikTransparent = intval($sock->GET_INFO('MikrotikTransparent')); $MikrotikHTTPSquidPort = intval($sock->GET_INFO('MikrotikHTTPSquidPort')); $MikrotikVirtualIP = $sock->GET_INFO('MikrotikVirtualIP'); $MikrotikLocalInterface = $sock->GET_INFO('MikrotikLocalInterface'); $MikrotikNetMask = $sock->GET_INFO('MikrotikNetMask'); $MikrotikIPAddr = $sock->GET_INFO('MikrotikIPAddr'); $MikrotikLAN = $sock->GET_INFO('MikrotikLAN'); $MikrotikSSLTransparent = intval($sock->GET_INFO("MikrotikSSLTransparent")); $MikrotikHTTPSSquidPort = intval($sock->GET_INFO("MikrotikHTTPSSquidPort")); $ip = new networking(); $ipsH = $ip->Local_interfaces(); $t = time(); if ($MikrotikHTTPSquidPort == 0) { $MikrotikHTTPSquidPort = rand(9090, 63000); } if ($MikrotikHTTPSSquidPort == 0) { $MikrotikHTTPSSquidPort = rand(9190, 63000); } if ($MikrotikVirtualIP == null) { $MikrotikVirtualIP = "172.16.24.2"; } if ($MikrotikNetMask == null) { $MikrotikNetMask = "255.255.255.252"; } if ($MikrotikIPAddr == null) { $MikrotikIPAddr = "172.16.24.1"; } if ($MikrotikLAN == null) { $MikrotikLAN = "192.168.1.0/24"; } if ($MikrotikLocalInterface == null) { $MikrotikLocalInterface = "eth0"; } $ARRAYBT["{apply}"] = "Apply{$t}"; $ARRAYBT["{save}"] = "Save{$t}"; $p = Paragraphe_switch_img("{mikrotik_compliance}", "{mikrotik_compliance_explain}", "MikrotikTransparent", $MikrotikTransparent, null, 760); $p2 = Paragraphe_switch_img("{mikrotik_ssl_compliance}", "{mikrotik_ssl_compliance_explain}", "MikrotikSSLTransparent", $MikrotikSSLTransparent, null, 760); $html = "\n\t<div style='text-align:right'><img src='img/mikrotik-150.png'></div>\n\t<div style='width:95%;padding:30px' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;width:220px'><div id='mikrotik-ipface'></div></td>\n\t\t<td style='vertical-align:top;width:99%;padding-left:30px'>\n\t\n\t\t\t{$p}{$p2}\n\t\t</td>\n\t</table>\n\t<table style='width:100%'>\n\t" . Field_text_table("MikrotikHTTPSquidPort", "{proxy_listen_port}", $MikrotikHTTPSquidPort, 22, null) . Field_text_table("MikrotikHTTPSSquidPort", "{proxy_listen_port} (SSL)", $MikrotikHTTPSSquidPort, 22, null) . Field_list_table("MikrotikLocalInterface", "{local_interface}", $MikrotikLocalInterface, 22, $ipsH) . Field_ipv4_table("MikrotikVirtualIP", "{local_ip_address}", $MikrotikVirtualIP, 22, "{MikrotikVirtualIP}", null) . Field_text_table("MikrotikNetMask", "{netmask}", $MikrotikNetMask, 22) . Field_ipv4_table("MikrotikIPAddr", "{mikrotik_address}", $MikrotikIPAddr, 22, "{mikrotik_address_explain}") . Field_area_table("MikrotikLAN", "{your_network}", $MikrotikLAN, 22, null) . Field_buttons_table_autonome($ARRAYBT, 32) . "\n\t</table>\n\t<div id='mikrotik-config'></div>\n</div>\n\n\n<script>\n\n\tvar xSave{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\t\n\t\tdocument.getElementById('mikrotik-config').innerHTML=res;\n\n\t}\t\n\t\n\t\n\t\n\t\n\n\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('MikrotikSSLTransparent',document.getElementById('MikrotikSSLTransparent').value);\n\t\tXHR.appendData('MikrotikLocalInterface',document.getElementById('MikrotikLocalInterface').value);\n\t\tXHR.appendData('MikrotikTransparent',document.getElementById('MikrotikTransparent').value);\n\t\tXHR.appendData('MikrotikHTTPSquidPort',document.getElementById('MikrotikHTTPSquidPort').value);\n\t\tXHR.appendData('MikrotikHTTPSSquidPort',document.getElementById('MikrotikHTTPSSquidPort').value);\n\t\tXHR.appendData('MikrotikVirtualIP',document.getElementById('MikrotikVirtualIP').value);\n\t\tXHR.appendData('MikrotikNetMask',document.getElementById('MikrotikNetMask').value);\n\t\tXHR.appendData('MikrotikIPAddr',document.getElementById('MikrotikIPAddr').value);\n\t\tXHR.appendData('MikrotikLAN',document.getElementById('MikrotikLAN').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\t\nfunction Apply{$t}(){\t\n\tSave{$t}();\n\tLoadjs('squid.compile.progress.php?restart=yes&ask=yes');\n}\n\t\nSave{$t}();\nLoadAjax('mikrotik-ipface','{$page}?mikrotik-ipface=yes');\n</script>\t\t\t\t\t\n\t\n"; echo $tpl->_ENGINE_parse_body($html); }
function provider_popup() { $tpl = new templates(); $page = CurrentPageName(); $q = new mysql_shorewall(); $bt_title = "{add}"; $ID = $_GET["ID"]; if ($ID == null) { $title = $tpl->javascript_parse_text("{new_provider}"); } $tables["main"] = "main"; $tables["local"] = "local"; $tables["default"] = "default"; $sql = "SELECT NAME FROM `fw_providers`"; $results = $q->QUERY_SQL($sql); while ($ligne = mysql_fetch_assoc($results)) { $tables[$ligne["NAME"]] = $ligne["NAME"]; } $net = new networking(); $ethz = $net->Local_interfaces(); while (list($num, $ligne) = each($ethz)) { $ip = new system_nic($num); $ethz[$num] = "{$ip->NICNAME} ({$num})"; } if ($ID > 0) { $bt_title = "{apply}"; $q = new mysql_shorewall(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM fw_providers WHERE ID='{$ID}'")); $ip = new system_nic($ligne["INTERFACE"]); $title = $tpl->javascript_parse_text("{interface}: {$ip->NICNAME} - " . $ligne["NAME"]); } for ($i = 1; $i < 16; $i++) { $table_number[$i] = $i; } if (!is_numeric($ligne["balance"])) { $ligne["balance"] = -1; } if (!is_numeric($ligne["fallback"])) { $ligne["fallback"] = -1; } $t = time(); $html = "\n\t<div style='font-size:20px;margin-bottom:20px'>{$title}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{name}:</td>\n\t\t<td>" . Field_text("NAME-{$t}", $ligne["NAME"], "font-size:18px;width:190px", null, null, null, false, "SaveCHK{$t}(event)") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{interface}:</td>\n\t\t<td>" . Field_array_Hash($ethz, "INTERFACE-{$t}", $ligne["INTERFACE"], null, null, 0, "font-size:16px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{gateway}:</td>\n\t\t<td>" . Field_text("GATEWAY-{$t}", $ligne["GATEWAY"], "font-size:18px;width:190px", null, null, null, false, "SaveCHK{$t}(event)") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{unique_number}:</td>\n\t\t<td>" . Field_array_Hash($table_number, "NUMBER-{$t}", $ligne["NUMBER"], null, null, 0, "font-size:16px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{balance}:</td>\n\t\t<td>" . Field_text("balance-{$t}", $ligne["balance"], "font-size:18px;width:40px", null, null, null, false, "SaveCHK{$t}(event)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{fallback}:</td>\n\t\t<td>" . Field_text("fallback-{$t}", $ligne["fallback"], "font-size:18px;width:40px", null, null, null, false, "SaveCHK{$t}(event)") . "</td>\n\t</tr>\t\t\t\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{routing_table}:</td>\n\t\t<td>" . Field_array_Hash($tables, "DUPLICATE-{$t}", $ligne["DUPLICATE"], null, null, 0, "font-size:16px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{routing_track}:</td>\n\t\t<td>" . Field_checkbox("track-{$t}", 1, $ligne["track"]) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{routing_tproxy}:</td>\n\t\t<td>" . Field_checkbox("tproxy-{$t}", 1, $ligne["tproxy"]) . "</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t\n\t\t\t\t\n\t<tr>\n\t\t<td colspan=2 align='right'>" . button($bt_title, "Save{$t}()", 18) . "</td>\n\t</tr>\t\t\n\t</table>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);}\n\tvar ID='{$ID}';\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n\t\$('#flexRT{$_GET["tt"]}').flexReload();\n\tExecuteByClassName('SearchFunction');\n\tif(ID.length==0){YahooWinHide();}\n}\n\nfunction SaveCHK{$t}(e){\n\tif(!checkEnter(e)){return;}\n\tSave{$t}();\n}\n\t\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('provider-save', '{$ID}');\n\tXHR.appendData('NAME', document.getElementById('NAME-{$t}').value);\n\tXHR.appendData('INTERFACE', document.getElementById('INTERFACE-{$t}').value);\n\tXHR.appendData('DUPLICATE', document.getElementById('DUPLICATE-{$t}').value);\n\tXHR.appendData('GATEWAY', document.getElementById('GATEWAY-{$t}').value);\n\tXHR.appendData('NUMBER', document.getElementById('NUMBER-{$t}').value);\n\t\n\tXHR.appendData('fallback', document.getElementById('fallback-{$t}').value);\n\tXHR.appendData('balance', document.getElementById('balance-{$t}').value);\n\t\n\tif(document.getElementById('track-{$t}').checked){ XHR.appendData('track', 1); }else{ XHR.appendData('track', 0); }\n\tif(document.getElementById('tproxy-{$t}').checked){ XHR.appendData('tproxy', 1); }else{ XHR.appendData('tproxy', 0); }\t\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\t"; echo $tpl->_ENGINE_parse_body($html); }
function parameters() { $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); $t = time(); $ip = new networking(); $interfaces = $ip->Local_interfaces(); unset($interfaces["lo"]); $UnifiListenInterface = $sock->GET_INFO("UnifiListenInterface"); $UnifiHTTPPort = intval($sock->GET_INFO("UnifiHTTPPort")); $UnifiHTTPSPort = intval($sock->GET_INFO("UnifiHTTPSPort")); $UnifiPortalPort = intval($sock->GET_INFO("UnifiPortalPort")); $UnifiPortalSSLPort = intval($sock->GET_INFO("UnifiPortalSSLPort")); $UnifiUDPPort = intval($sock->GET_INFO("UnifiUDPPort")); $UnifiUUID = $sock->GET_INFO("UnifiUUID"); if ($UnifiUUID == null) { $UnifiUUID = $sock->getFrameWork("unifi.php?GetUUID=yes"); } if ($UnifiHTTPPort == 0) { $UnifiHTTPPort = 8088; } if ($UnifiHTTPSPort == 0) { $UnifiHTTPSPort = 8443; } if ($UnifiPortalPort == 0) { $UnifiPortalPort = 8880; } if ($UnifiPortalSSLPort == 0) { $UnifiPortalSSLPort = 8943; } if ($UnifiUDPPort == 0) { $UnifiUDPPort = 3478; } while (list($eth, $none) = each($interfaces)) { $nic = new system_nic($eth); $array[$eth] = "{$eth} {$nic->IPADDR} - {$nic->NICNAME}"; } $array[null] = "{all}"; $EnableUnifiController = intval($sock->GET_INFO("EnableUnifiController")); $p = Paragraphe_switch_img("{ENABLE_UNIFI_CONTROLLER}", "{UNIFI_CONTROLLER_EXPLAIN}", "EnableUnifiController", $EnableUnifiController, null, 890); $html = "<div style='font-size:30px;margin-bottom:20px'>{parameters}</div>\n\t<div style='width:98%' class=form>{$p}\n\t\n\t<div style='font-size:26px;margin-bottom:10px;text-align:right'><a href=\"https://{$_SERVER["SERVER_NAME"]}:{$UnifiHTTPSPort}\" style='text-decoration:underline' target=_new>{web_interface}</a></div>\n\t\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_interface}:</td>\n\t\t<td style='font-size:20px'>" . Field_array_Hash($array, "UnifiListenInterface-{$t}", $UnifiListenInterface, "style:font-size:22px;font-weight:bold") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{UnifiHTTPPort}:</td>\n\t\t<td style='font-size:20px'>" . Field_text("UnifiHTTPPort-{$t}", $UnifiHTTPPort, "font-size:22px;font-weight:bold;width:150px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{UnifiHTTPSPort}:</td>\n\t\t<td style='font-size:20px'>" . Field_text("UnifiHTTPSPort-{$t}", $UnifiHTTPSPort, "font-size:22px;font-weight:bold;width:150px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{UnifiPortalPort}:</td>\n\t\t<td style='font-size:20px'>" . Field_text("UnifiPortalPort-{$t}", $UnifiPortalPort, "font-size:22px;font-weight:bold;width:150px") . "</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{UnifiPortalSSLPort}:</td>\n\t\t<td style='font-size:20px'>" . Field_text("UnifiPortalSSLPort-{$t}", $UnifiPortalSSLPort, "font-size:22px;font-weight:bold;width:150px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{UnifiUDPPort}:</td>\n\t\t<td style='font-size:20px'>" . Field_text("UnifiUDPPort-{$t}", $UnifiUDPPort, "font-size:22px;font-weight:bold;width:150px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{uuid}:</td>\n\t\t<td style='font-size:20px'>" . Field_text("UnifiUUID-{$t}", $UnifiUUID, "font-size:22px;font-weight:bold;width:560px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr style='height:70px'>\n\t\t\t\t<td style=';text-align:right' colspan=2>" . button("{apply}", "Save{$t}()", "32") . "</td>\n\t</tr>\t\n\t\n\t</table>\n<script>\n\tvar xSave{$t}=function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif (tempvalue.length>3){alert(tempvalue);return;}\n\t\tRefreshTab('unifi_tabs');\n\t\tLoadjs('unifi.restart.progress.php');\n\t\t\n\t}\t\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\tXHR.appendData('EnableUnifiController',document.getElementById('EnableUnifiController').value);\n\t\tXHR.appendData('UnifiListenInterface',document.getElementById('UnifiListenInterface-{$t}').value);\n\t\tXHR.appendData('UnifiHTTPPort',document.getElementById('UnifiHTTPPort-{$t}').value);\n\t\tXHR.appendData('UnifiHTTPSPort',encodeURIComponent(document.getElementById('UnifiHTTPSPort-{$t}').value));\n\t\tXHR.appendData('UnifiPortalPort',document.getElementById('UnifiPortalPort-{$t}').value);\n\t\tXHR.appendData('UnifiPortalSSLPort',document.getElementById('UnifiPortalSSLPort-{$t}').value);\n\t\tXHR.appendData('UnifiUDPPort',encodeURIComponent(document.getElementById('UnifiUDPPort-{$t}').value));\n\t\tXHR.appendData('UnifiUUID',encodeURIComponent(document.getElementById('UnifiUUID-{$t}').value));\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\n\t\nLoadAjaxRound('unifi-status','{$page}?status=yes');\t\n\t\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function popup() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $users = new usersMenus(); $SquidNetworkSwitch = $sock->GET_INFO("SquidNetworkSwitch"); $net = new networking(); $interfaces = $net->Local_interfaces(); unset($interfaces["lo"]); $t = $_GET["t"]; $array[null] = "{default}"; while (list($eth, $none) = each($interfaces)) { $nic = new system_nic($eth); $array[$eth] = "{$eth} {$nic->IPADDR} - {$nic->NICNAME}"; } $html = "<div style='width:98%' class=form>\n\t\t<div style='font-size:22px;margin-bottom:20px' class=explain>\n\t\t{squid_network_switch_explain}\n\t\t</div>\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:26px' nowrap>{outgoing_interface}:</td>\n\t\t<td>" . Field_array_Hash($array, "SquidNetworkSwitch-{$t}", $SquidNetworkSwitch, "style:font-size:26px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right' style='padding-top:50px'><hr>" . button("{apply}", "Save{$t}();", "36") . "</td>\n\t</tr>\n\t</table>\n\t</div>\n<script>\nvar xSave{$t}= function (obj) {\t\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tLoadjs('squid.network.switch.progress.php');\n}\t\n\t\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('SquidNetworkSwitch', document.getElementById('SquidNetworkSwitch-{$t}').value);\t\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t}); \t\t\t\n}\n</script>\t\n"; echo $tpl->_ENGINE_parse_body($html); }
function step1() { $q = new mysql(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $net = new networking(); $interfaces = $net->Local_interfaces(); unset($interfaces["lo"]); $t = $_GET["t"]; while (list($eth, $none) = each($interfaces)) { $nic = new system_nic($eth); $array[$eth] = "{$eth} {$nic->IPADDR} - {$nic->NICNAME}"; $array2[$eth] = "{$eth} {$nic->IPADDR} - {$nic->NICNAME}"; } $FireHolConf = unserialize(base64_decode($sock->GET_INFO("FireHolConf"))); $html = "\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td colspan=2><div class=explain style='font-size:20px;margin-bottom:15px'>{select_wan_interface_explain}</div></td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px' nowrap>{interface} WAN:</td>\n\t\t\t<td>" . Field_array_Hash($array, "IF_WAN-{$t}", $FireHolConf["IF_WAN"], "style:font-size:28px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2><hr></td>\n\t\t</tr>\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td colspan=2><div class=explain style='font-size:20px;margin-bottom:15px'>{select_lan_interface_explain}</div></td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px' nowrap>{interface} LAN:</td>\n\t\t\t<td>" . Field_array_Hash($array, "IF_LAN-{$t}", $FireHolConf["IF_LAN"], "style:font-size:28px") . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align=right style='text-align:right;padding-top:20px'><hr>" . button("{next}", "Save{$t}();", "32") . "</td>\n\t\t</tr>\n\t</table>\n<script>\nvar xSave{$t}= function (obj) {\t\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tLoadAjax('{$t}','{$page}?stepfinal=yes&t={$t}');\n}\t\n\t\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('IF_WAN', document.getElementById('IF_WAN-{$t}').value);\n\tXHR.appendData('IF_LAN', document.getElementById('IF_LAN-{$t}').value);\t\t\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t}); \t\t\t\n}\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function popup() { $tpl = new templates(); $sock = new sockets(); $net = new networking(); $page = CurrentPageName(); $MAIN = unserialize(base64_decode($sock->GET_INFO("HASettings"))); $interfaces = $net->Local_interfaces(); while (list($eth, $line) = each($interfaces)) { if ($eth == "lo") { continue; } $ip = new system_nic($eth); $array[$eth] = $ip->IPADDR . " (" . $ip->NICNAME . ")"; } $t = time(); $html = "\n\t<div id='failover-title' style='font-size:22px'></div>\n\t<div id='failover-div'>\t\t\n\t<div style='font-size:16px' class=explain>{welcome_php_failover_explain}</div>\n\t<p> </p>\n\t<div style='font-size:16px' class=explain>{welcome_php_failover_explain_1}</div>\n\t<p> </p>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{interface}:</td>\n\t\t<td>" . Field_array_Hash($array, "eth-{$t}", $MAIN["eth"], null, null, 0, "font-size:16px") . "</td>\n\t</tr>\n\t</table>\n\t<div style='text-align:right'><hr>" . button("{next}", "Step0()", 26) . "</div>\n\t</div>\n<script>\nfunction xStep0(obj){\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n\tLoadAjax('failover-div','{$page}?step1=yes',true);\n\n}\t\t\t\n\t\t\t\nfunction Step0(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('eth',document.getElementById('eth-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xStep0);\t\n}\n\t\t\t\n\t\t\t\n</script>\n\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function arp_settings() { $ID = $_GET["ID"]; $t = $_GET["t"]; if (!is_numeric($t)) { $t = time(); } $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $btname = "{add}"; if ($ID > 0) { $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM arpspoof_rules WHERE ID={$ID}", "artica_backup")); $btname = "{apply}"; $ligne["rulename"] = utf8_encode($ligne["rulename"]); } $nics = new networking(); $array = $nics->Local_interfaces(); unset($array["lo"]); $iface = Field_array_Hash($array, "iface", $ligne["iface"], null, null, 0, "font-size:16px"); $html = "\n\t<div id='animate-{$t}'></div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{enabled}:</td>\n\t\t<td>" . Field_checkbox("enabled-{$t}", 1, $ligne["enabled"], "EnabledCheck{$t}()") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{rule_name}:</td>\n\t\t<td>" . Field_text("rulename", $ligne["rulename"], "font-size:16px;width:220px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{gateway}:</td>\n\t\t<td>" . Field_text("gateway", $ligne["gateway"], "font-size:16px;width:220px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{listen_address}:</td>\n\t\t<td>{$iface}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button($btname, "Save{$t}()", "18") . "</td>\n\t</tr>\n\t</table>\t\n<script>\nvar x_Save{$t}= function (obj) {\n\tvar ID={$ID};\n\tvar results=obj.responseText;\n\tdocument.getElementById('animate-{$t}').innerHTML='';\n\tif(results.length>3){alert(results);return;}\n\tif(document.getElementById('flexRT{$t}')){ \$('#flexRT{$t}').flexReload();}\n\tif(ID==0){YahooWin4Hide();return;}\n\tif(document.getElementById('tabs_arpspoof_edit')){RefreshTab('tabs_arpspoof_edit');}\n}\t\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\t\tvar enabled=0;\n\tif(document.getElementById('enabled-{$t}').checked){enabled=1;}\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('enabled',enabled);\n\tXHR.appendData('rulename',document.getElementById('rulename').value);\n\tXHR.appendData('gateway',document.getElementById('gateway').value);\n\tXHR.appendData('iface',document.getElementById('iface').value);\n\tAnimateDiv('animate-{$t}');\n\tXHR.sendAndLoad('{$page}', 'POST',x_Save{$t});\t\n}\n\nfunction EnabledCheck{$t}(){\n\tvar enabled=0;\n\tif(document.getElementById('enabled-{$t}').checked){enabled=1;}\n\tdocument.getElementById('rulename').disabled=true;\n\tdocument.getElementById('gateway').disabled=true;\n\tdocument.getElementById('iface').disabled=true;\n\tif(enabled==1){\n\tdocument.getElementById('rulename').disabled=false;\n\tdocument.getElementById('gateway').disabled=false;\n\tdocument.getElementById('iface').disabled=false;\t\n\t}\n}\nEnabledCheck{$t}();\n</script>\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function popup() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_squid_builder(); $t = time(); $SquidMikroTikTOS = intval($sock->GET_INFO("SquidMikroTikTOS")); $SquidMikrotikMaskerade = intval($sock->GET_INFO("SquidMikrotikMaskerade")); if ($SquidMikroTikTOS == 0) { $SquidMikroTikTOS = 12; } $ip = new networking(); $interfaces = $ip->Local_interfaces(); $MAIN_INTERFACES = $ip->NETWORK_ALL_INTERFACES(); unset($interfaces["lo"]); $ayDscp = array(0 => '0x00', 8 => '0x20', 10 => '0x28', 12 => '0x30', 14 => '0x38', 16 => '0x40', 18 => '0x48', 20 => '0x50', 22 => '0x58', 24 => '0x60', 26 => '0x68', 28 => '0x70', 30 => '0x78', 32 => '0x80', 34 => '0x88', 36 => '0x90', 38 => '0x98', 40 => '0xA0', 46 => '0xB8', 48 => '0xC0', 56 => '0xE0'); while (list($eth, $none) = each($interfaces)) { if (preg_match("#^gre#", $eth)) { continue; } $nic = new system_nic($eth); $arrayIP[$eth] = "{$nic->IPADDR}"; } $results = $q->QUERY_SQL("SELECT * FROM proxy_ports WHERE MIKROTIK_PORT=1 and enabled=1"); $f[] = "/ip firewall filter add action=reject chain=forward comment=\"Artica: Deny QUIC protocol HTTP/UDP\" dst-address=0.0.0.0 dst-port=80 protocol=udp src-address=0.0.0.0"; $f[] = "/ip firewall nat add action=masquerade chain=srcnat comment=\"Artica: Mandatory masquerade for Proxy\""; while ($ligne = mysql_fetch_assoc($results)) { $ID = $ligne["ID"]; $port = $ligne["port"]; $IPADDR = $arrayIP[$ligne["nic"]]; $MAC = $MAIN_INTERFACES[$ligne["nic"]]["MAC"]; $ALLIP[$IPADDR] = $MAC; $UseSSL = $ligne["UseSSL"]; $f[] = "/queue tree add name=ProxyPort{$port} packet-mark=ProxyCached{$port} parent=global queue=default comment=\"Artica: Full bandwidth for Cached content marked as {$SquidMikroTikTOS} {$ayDscp[$SquidMikroTikTOS]}\""; if ($UseSSL == 0) { $f[] = "/ip firewall mangle add action=mark-routing chain=prerouting comment=\"Artica: HTTP mark ProxyPort{$port}\" dst-port=80 src-mac-address=!{$MAC} new-routing-mark=ProxyPort{$port} passthrough=no protocol=tcp"; } if ($UseSSL == 1) { $f[] = "/ip firewall mangle add action=mark-routing chain=prerouting comment=\"Artica: HTTPS 80 mark ProxyPort{$port}\" dst-port=443 src-mac-address=!{$MAC} new-routing-mark=ProxyPort{$port} passthrough=no protocol=tcp"; } $f[] = "/ip firewall mangle add action=mark-packet chain=forward comment=\"Artica: Marked cached packets from Proxy\" dscp={$SquidMikroTikTOS} new-packet-mark=ProxyPort{$port} passthrough=no"; $f[] = "/ip route add check-gateway=ping distance=1 gateway={$IPADDR} routing-mark=ProxyPort{$port} comment=\"Artica: mark ProxyPort{$port} to proxy gateway\""; if ($SquidMikrotikMaskerade == 0) { if ($UseSSL == 0) { $f[] = "/ip firewall mangle add action=mark-connection chain=prerouting comment=\"Artica: Mark HTTP Connections to Connect{$port}\" dst-port=80 new-connection-mark=Connect{$port} passthrough=no protocol=tcp src-mac-address={$MAC}"; $f[] = "/ip firewall mangle add action=mark-routing chain=prerouting comment=\"Mangle Proxy HTTP to Internet mark Connect{$port}\" connection-mark=Connect{$port} new-routing-mark=ProxyPort{$port} passthrough=no protocol=tcp src-mac-address=!{$MAC} src-port=80"; } if ($UseSSL == 1) { $f[] = "/ip firewall mangle add action=mark-connection chain=prerouting comment=\"Artica: Mark SSL Connections to Connect{$port}\" dst-port=443 new-connection-mark=Connect{$port} passthrough=no protocol=tcp src-mac-address={$MAC}"; $f[] = "/ip firewall mangle add action=mark-routing chain=prerouting comment=\"Mangle Proxy SSL to Internet mark Connect{$port}\" connection-mark=Connect{$port} new-routing-mark=ProxyPort{$port} passthrough=no protocol=tcp src-mac-address=!{$MAC} src-port=443"; } } } while (list($a, $b) = each($ayDscp)) { if ($a == 0) { continue; } $DSCP[$a] = $a; } $description = "<textarea name='category_text'\n\tid='category_text-{$t}' style='height:250px;overflow:auto;font-family:Courier New;width:99%;\n\tfont-size:12px !important'>" . @implode("\n", $f) . "</textarea>"; $html = "\n<div style='font-size:36px'>Mikrotik</div>\n<div style='font-size:18px' class=explain>{mikrotik_cmd_line_explain}</div>\n\t{$description}\t\n\t\t\n<div id='SquidAVParamWCCP' style='width:98%' class=form>\n<table style='width:100%'>\n\t<tr>\n\t\t<td style='font-size:22px' class=legend nowrap>DSCP:</td>\n\t\t<td>" . Field_array_Hash($DSCP, "SquidMikroTikTOS-{$t}", $SquidMikroTikTOS, "style:font-size:22px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td style='font-size:22px' class=legend nowrap>MASQUERADE:</td>\n\t\t<td>" . Field_checkbox_design("SquidMikrotikMaskerade-{$t}", 1, "{$SquidMikrotikMaskerade}") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t\t\n\t<tr>\n\t\t<td colspan=3 align='right'>\n\t\t\t<hr>\n\t\t\t\t" . button("{apply}", "Save{$t}()", 32) . "\n\t\t</td>\n\t</tr>\n\t</table>\n</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);}\n\tYahooWin3Hide();\n\tLoadjs('{$page}');\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar SquidMikrotikMaskerade=0;\n\tXHR.appendData('SquidMikroTikTOS',\n\tdocument.getElementById('SquidMikroTikTOS-{$t}').value);\n\tif( document.getElementById('SquidMikrotikMaskerade-{$t}').checked){SquidMikrotikMaskerade=1;}\n\tXHR.appendData('SquidMikrotikMaskerade',SquidMikrotikMaskerade);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function gateway_config() { $sock = new sockets(); $tpl = new templates(); $page = CurrentPageName(); $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $EnableArticaAsGateway = $sock->GET_INFO("EnableArticaAsGateway"); $HamachiFwInterface = $sock->GET_INFO("HamachiFwInterface"); $HamachiExtDomain = $sock->GET_INFO("HamachiExtDomain"); if (!is_numeric($EnableArticaAsGateway)) { $EnableArticaAsGateway = 0; } $DisableEtcHosts = $sock->GET_INFO("DisableEtcHosts"); if (!is_numeric($DisableEtcHosts)) { $DisableEtcHosts = 0; } $tcp = new networking(); $interfaces = $tcp->Local_interfaces(true); $interfaces[null] = "{none}"; $t = time(); $HAMACHI_DOMAIN_DNS2 = $tpl->_ENGINE_parse_body("{HAMACHI_DOMAIN_DNS2}"); if (strpos($HAMACHI_DOMAIN_DNS2, "}") > 0) { $HAMACHI_DOMAIN_DNS2 = "Hosts database domain"; } $html = "\n\t<div id='{$t}'>\n\t<table style='width:99%' class=form>\n\t<tbody>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{ARTICA_AS_GATEWAY}:</td>\n\t\t<td>" . Field_checkbox("EnableArticaAsGateway", 1, $EnableArticaAsGateway, "SaveHamachiNetCheckForm()") . "</td>\n\t\t<td width=1%>" . help_icon("{ARTICA_AS_GATEWAY_HAMACHI}") . "<td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{FORWARD_LOCALNET_TONIC}:</td>\n\t\t<td>" . Field_array_Hash($interfaces, "HamachiFwInterface", $HamachiFwInterface, "style:font-size:14px") . "</td>\n\t\t<td width=1%>" . help_icon("{FORWARD_LOCALNET_TONIC_EXPLAIN}") . "<td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{$HAMACHI_DOMAIN_DNS2}:</td>\n\t\t<td>" . Field_text("HamachiExtDomain", $HamachiExtDomain, "font-size:14px") . "</td>\n\t\t<td width=1%>" . help_icon("{HAMACHI_DOMAIN_DNS}") . "<td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=3 align=right><hr>" . button("{apply}", "SaveHamachiNetConf()") . "</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>\n\t<script>\n\t\n\tfunction SaveHamachiNetCheckForm(){\n\t\tvar DisableEtcHosts={$DisableEtcHosts};\n\t\tdocument.getElementById('HamachiFwInterface').disabled=true;\n\t\tdocument.getElementById('HamachiExtDomain').disabled=true;\n\t\tdocument.getElementById('HamachiFwInterface').disabled=true;\n\t\tif(document.getElementById('EnableArticaAsGateway').checked){\n\t\t\tdocument.getElementById('EnableArticaAsGateway').disabled=true;\n\t\t\tdocument.getElementById('HamachiFwInterface').disabled=false;\n\t\t\tdocument.getElementById('HamachiExtDomain').disabled=false;\n\t\t\tdocument.getElementById('HamachiFwInterface').disabled=false;\t\t\n\t\t}\n\t\t\n\t\tif(DisableEtcHosts==1){\n\t\t\tdocument.getElementById('HamachiExtDomain').disabled=true;\n\t\t\tdocument.getElementById('HamachiExtDomain').value='';\n\t\t}\n\t}\n\t\nvar X_SaveHamachiNetConf= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n\tRefreshTab('hamashi_config_postfix');\n\t}\t\n\t\t\n\tfunction SaveHamachiNetConf(){\n\t\tvar XHR = new XHRConnection();\n\t\tif(document.getElementById('EnableArticaAsGateway').checked){XHR.appendData('EnableArticaAsGateway',1);}else{XHR.appendData('EnableArticaAsGateway',0);}\n\t\tXHR.appendData('HamachiExtDomain',document.getElementById('HamachiExtDomain').value);\n\t\tXHR.appendData('HamachiFwInterface',document.getElementById('HamachiFwInterface').value);\n\t\tAnimateDiv('{$t}');\n\t\tXHR.sendAndLoad('{$page}', 'POST',X_SaveHamachiNetConf);\t\t\t\t\n\t}\t\t\n\tSaveHamachiNetCheckForm();\n\tLoadAjax('hamachi-status','{$page}?status=yes');\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function settings() { $tpl = new templates(); $sock = new sockets(); $page = CurrentPageName(); $users = new usersMenus(); $influx = new influx(); $t = time(); $ERROR_PERF = null; $InfluxAdminDisabled = intval($sock->GET_INFO("InfluxAdminDisabled")); $InfluxAdminPort = intval($sock->GET_INFO("InfluxAdminPort")); if ($InfluxAdminPort == 0) { $InfluxAdminPort = 8083; } $InfluxAdminEnabled = 1; if ($InfluxAdminDisabled == 1) { $InfluxAdminEnabled = 0; } $InfluxAdminRetentionTime = intval($sock->GET_INFO("InfluxAdminRetentionTime")); $UserAgentsStatistics = intval($sock->GET_INFO("UserAgentsStatistics")); $ResolvIPStatistics = intval($sock->GET_INFO("ResolvIPStatistics")); $EnableQuotasStatistics = intval($sock->GET_INFO("EnableQuotasStatistics")); $QuotasStatisticsInterval = intval($sock->GET_INFO("QuotasStatisticsInterval")); $InfluxListenInterface = intval($sock->GET_INFO("InfluxListenInterface")); if ($InfluxListenInterface == null) { $InfluxListenInterface = "lo"; } $EnableInfluxDB = intval($sock->GET_INFO("EnableInfluxDB")); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); $MySQLStatisticsRetentionDays = intval($sock->GET_INFO("MySQLStatisticsRetentionDays")); if ($MySQLStatisticsRetentionDays == 0) { $MySQLStatisticsRetentionDays = 5; } $bt_disconnect = null; $STATS_APPLIANCE = 0; $sys = new networking(); $influxstop = null; $Local_interfaces = $sys->Local_interfaces(); if (!$users->STATS_APPLIANCE) { $Local_interfaces["lo"] = "loopback"; } else { $STATS_APPLIANCE = 1; } $Local_interfaces["ALL"] = "{all}"; if ($InfluxAdminRetentionTime == 0) { $InfluxAdminRetentionTime = 365; } $users = new usersMenus(); $InfluxAdminRetention[7] = "7 {days}"; $InfluxAdminRetention[15] = "15 {days}"; $InfluxAdminRetention[30] = "1 {month}"; $InfluxAdminRetention[90] = "3 {months}"; $InfluxAdminRetention[180] = "6 {months}"; $InfluxAdminRetention[365] = "1 {year}"; $InfluxAdminRetention[730] = "2 {years}"; $InfluxAdminRetention[1095] = "3 {years}"; $MySQLStatisticsRetention[1] = "1 {day}"; $MySQLStatisticsRetention[2] = "2 {days}"; $MySQLStatisticsRetention[3] = "3 {days}"; $MySQLStatisticsRetention[4] = "4 {days}"; $MySQLStatisticsRetention[5] = "5 {days}"; $MySQLStatisticsRetention[6] = "6 {days}"; $MySQLStatisticsRetention[7] = "7 {days}"; $MySQLStatisticsRetention[8] = "8 {days}"; $MySQLStatisticsRetention[9] = "9 {days}"; $MySQLStatisticsRetention[10] = "10 {days}"; $QuotasStatisticsIntervalA[5] = "5 {minutes}"; $QuotasStatisticsIntervalA[10] = "10 {minutes}"; $QuotasStatisticsIntervalA[15] = "15 {minutes}"; $QuotasStatisticsIntervalA[30] = "30 {minutes}"; if ($QuotasStatisticsInterval == 0) { $QuotasStatisticsInterval = 15; } $CORP_LICENSE = 1; $explain_retention = " "; $field_ret = Field_array_Hash($InfluxAdminRetention, "InfluxAdminRetentionTime", "{$InfluxAdminRetentionTime}", "blur()", null, 0, "font-size:22px"); if (!$users->CORP_LICENSE) { $InfluxAdminRetentionTime = 7; $CORP_LICENSE = 0; $field_ret = Field_hidden("InfluxAdminRetentionTime", 5) . "5 {days}<div><i style='font-size:16px'>{retention_time_limited_license}</i></div>"; } if ($EnableInfluxDB == 0) { $influxstop = "<div class=explain style='font-size:18px'>{influxdb_is_disabled}</div>"; } $InFluxBackupDatabaseDir = $sock->GET_INFO("InFluxBackupDatabaseDir"); if ($InFluxBackupDatabaseDir == null) { $InFluxBackupDatabaseDir = "/home/artica/influx/backup"; } $InFluxBackupDatabaseMaxContainers = intval("InFluxBackupDatabaseMaxContainers"); if ($InFluxBackupDatabaseMaxContainers == 0) { $InFluxBackupDatabaseMaxContainers = 5; } $InFluxBackupDatabaseInterval = intval("InFluxBackupDatabaseInterval"); if ($InFluxBackupDatabaseInterval == 0) { $InFluxBackupDatabaseInterval = 10080; } if ($InFluxBackupDatabaseInterval < 1440) { $InFluxBackupDatabaseInterval = 1440; } $influxdb_snapshotsize = @file_get_contents("{$GLOBALS["BASEDIR"]}/influxdb_snapshotsize"); $InfluxDBAllowBrowse = intval($sock->GET_INFO("InfluxDBAllowBrowse")); $InfluxUseRemote = intval($sock->GET_INFO("InfluxUseRemote")); $InfluxUseRemoteIpaddr = $sock->GET_INFO("InfluxUseRemoteIpaddr"); $InfluxRemoteDB = $sock->GET_INFO("InfluxRemoteDB"); $InfluxUseRemotePort = intval($sock->GET_INFO("InfluxUseRemotePort")); $InfluxUseRemoteArticaPort = intval($sock->GET_INFO("InfluxUseRemoteArticaPort")); if ($InfluxRemoteDB == null) { $InfluxRemoteDB = $influx->db; } if ($InfluxUseRemotePort == 0) { $InfluxUseRemotePort = 8086; } if ($InfluxUseRemoteArticaPort == 0) { $InfluxUseRemoteArticaPort = 9000; } $InfluxDBPassword = $sock->GET_INFO("InfluxDBPassword"); $ArticaInfluxUsername = $sock->GET_INFO("ArticaInfluxUsername"); if ($ArticaInfluxUsername == null) { $ArticaInfluxUsername = "******"; } $InfluxSyslogRemote = intval($sock->GET_INFO("InfluxSyslogRemote")); $NoCompressStatisticsByHour = intval($sock->GET_INFO("NoCompressStatisticsByHour")); $ArticaInfluxPassword = $sock->GET_INFO("ArticaInfluxPassword"); if ($SquidPerformance > 2) { $ERROR_PERF = "<p class=text-error style='font-size:16px'>{INFLUX_DISABLED_PROXY_PERFORMANCE}</p>\n\t\t<div style='margin-top:10px;text-align:right'>" . button("{performance}", "GotoSquidPerformances()", 16) . "</div>"; } if ($InfluxUseRemote == 1) { if ($InfluxUseRemoteIpaddr != null) { $bt_disconnect = "\n\t\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px;text-align:right' colspan=2><p> </p></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px;text-align:right' colspan=2>" . button("{disconnect}", "Loadjs('influxdb.disconnect.progress.php');", 22) . "</td>\n\t\t\t</tr>"; } } $Intervals[1440] = "1 {day}"; $Intervals[2880] = "1 {days}"; $Intervals[7200] = "5 {days}"; $Intervals[10080] = "1 {week}"; $Intervals[20160] = "2 {weeks}"; $password = "******" . Field_password("InfluxDBPassword", $InfluxDBPassword, "font-size:22px;width:310px") . "</td>\n\t\t<td style='font-size:22px;text-decoration:underline'>{username}: «root»</td>\n\t</tr>"; $date_start = $tpl->time_to_date(intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/DATE_START")), true); $date_end = $tpl->time_to_date(intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/DATE_END")), true); $html = "\n\t{$ERROR_PERF}\t\t\n\t<div style='width:98%;margin-top:20px' class=form>\n\t{$influxstop}\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{date_start}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>{$date_start}</td>\n\t\t\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{last_date}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>{$date_end}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'>" . button("{refresh}", "Loadjs('influxdb.refresh.progress.php')") . "</td>\n\t</tr>\n\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{no_hourly_compression}", "{no_hourly_compression_explain}") . ":</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("NoCompressStatisticsByHour", 1, $NoCompressStatisticsByHour, "") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{ResolvIPStatistics}", "{ResolvIPStatistics_explain}") . ":</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("ResolvIPStatistics", 1, $ResolvIPStatistics, "") . "</td>\n\t</tr>\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{MySQLStatisticsRetentionDays}", "{MySQLStatisticsRetentionDays_explain}") . ":</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_array_Hash($MySQLStatisticsRetention, "MySQLStatisticsRetentionDays", "{$MySQLStatisticsRetentionDays}", "blur()", null, 0, "font-size:22px") . "</td>\n\t</tr>\t\n\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{useragents_statistics}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("UserAgentsStatistics", 1, $UserAgentsStatistics, "") . "</td>\n\t\t\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{quota_statistics}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("EnableQuotasStatistics", 1, $EnableQuotasStatistics, "EnableQuotasStatisticsCheck()") . "</td>\n\t\t\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{interval}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_array_Hash($QuotasStatisticsIntervalA, "QuotasStatisticsInterval", "{$QuotasStatisticsInterval}", "blur()", null, 0, "font-size:22px") . "</td>\n\t</tr>\t\n\t</table>\n\t<div id='influx-local-service-id'>\n\t<table style='width:100%'>\n\t<tr style='height:80px;'>\n\t\t<td colspan=3 style='font-size:30px'>{service_parameters}:</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{query_interface}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold'>" . Field_checkbox_design("InfluxAdminEnabled", 1, $InfluxAdminEnabled, "InfluxAdminEnabledCheck()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{listen_interface}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_array_Hash($Local_interfaces, "InfluxListenInterface", "{$InfluxListenInterface}", "blur()", null, 0, "font-size:22px") . "</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$InfluxListenInterface}:8086</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_port}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InfluxAdminPort", $InfluxAdminPort, "font-size:22px;width:120px") . "</td>\n\t\t<td style='font-size:22px;text-decoration:underline'><a href=\"http://{$_SERVER["SERVER_ADDR"]}:{$InfluxAdminPort}\" target=_new>{browse}</a></td>\n\t</tr>\t\n\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{retention_time}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>{$field_ret}{$explain_retention}</td>\n\t</tr>\n\t<tr style='height:80px;'>\n\t\t<td colspan=3 align='right' style='padding-top:30px'><hr>" . button("{apply}", "Save{$t}()", 40) . "</td>\n\t</tr>\t\n\t</table>\n\t</div>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<div id='influx-remote-service-id'>\n\t\t<table style='width:100%'>\n\t\t<tr style='height:80px;'>\n\t\t\t<td colspan=3 style='font-size:30px'>{remote_server}:</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' nowrap>{use_remote_server}:</td>\t\t\n\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_checkbox_design("InfluxUseRemote", 1, $InfluxUseRemote, "InfluxUseRemoteCheck()") . "</td>\n\t\t</tr>\t\n\t\t</table>\n\t\t<div id='influx-remote-service-options'>\n\t\t\t<table style='width:100%'>\n{$bt_disconnect}\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{send_syslog_logs}", "{send_syslog_explain}") . ":</td>\t\t\n\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_checkbox_design("InfluxSyslogRemote", 1, $InfluxSyslogRemote) . "</td>\n\t\t</tr>\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px' nowrap>{remote_server_address}:</td>\t\t\n\t\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InfluxUseRemoteIpaddr", $InfluxUseRemoteIpaddr, "font-size:22px;width:291px") . "</td>\n\t\t\t\t\n\t\t\t</tr>\n\t\t\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px'>{remote_port}:</td>\t\t\n\t\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InfluxUseRemotePort", $InfluxUseRemotePort, "font-size:22px;width:120px") . "</td>\n\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{artica_username}:</td>\n\t\t\t\t\t<td style='font-size:18px'>" . Field_text("ArticaInfluxUsername", $ArticaInfluxUsername, "font-size:22px;width:240px") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{artica_password}:</td>\n\t\t\t\t\t<td style='font-size:18px'>" . Field_password("ArticaInfluxPassword", $ArticaInfluxPassword, "font-size:22px;width:240px") . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px'>{remote_artica_port}:</td>\t\t\n\t\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InfluxUseRemoteArticaPort", $InfluxUseRemoteArticaPort, "font-size:22px;width:120px") . "</td>\n\t\t\t</tr>\t\t\t\t\n\t\t\t<tr style='height:80px;'>\n\t\t\t\t<td colspan=2 align='right' style='padding-top:30px'>\n\t\t\t\t\t\t\t<hr>" . button("{apply}", "SaveRemote{$t}()", 40) . "</td>\n\t\t\t</tr>\n\t\t\t\t\t\t\n\t\t\t</table>\n\t\t</div>\n\t</div>\t\t\t\n\t\t\t\t\n\t<div id='influx-backup-service-id'>\n\t<table style='width:100%'>\n\t<tr style='height:80px;'>\n\t\t<td colspan=3 style='font-size:26px'>{backup}:</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{backup_each}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_array_Hash($Intervals, "InFluxBackupDatabaseInterval", "{$InFluxBackupDatabaseInterval}", "blur()", null, 0, "font-size:22px") . "</td>\n\t\t\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{backup_directory}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InFluxBackupDatabaseDir", $InFluxBackupDatabaseDir, "font-size:22px;width:291px") . "</td>\n\t\t<td>" . button_browse("InFluxBackupDatabaseDir") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap colspan=2 align='right'>\n\t\t\t\t<a href=\"/backup-influx/\" style='text-decoration:underline'>{backup_directory} " . FormatBytes($influxdb_snapshotsize / 1024) . "</a>\n\t\t</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{allow_browse_directory}", "{allow_browse_directory_web_explain}") . ":</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("InfluxDBAllowBrowse", 1, $InfluxDBAllowBrowse, "") . "</td>\n\t\t\t\t\n\t</tr>\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td colspan=3 align='right' style='font-size:18px'>\n\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:GotoSquidNasStorage()\" \n\t\t\t\tstyle='text-decoration:underline;font-size:18px'>{also_see_backup_to_nas}</a>\n\t\t</td>\n\t</tr>\n\t<tr style='height:80px;'>\n\t\t<td colspan=3 align='right' style='padding-top:30px'><hr>" . button("{apply}", "Save{$t}()", 40) . "</td>\n\t</tr>\t\t\t\n\t</table>\n\t</div>\n\t</div>\n<script>\nvar xSave{$t}= function (obj) {\t\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tLoadjs('influxdb.restart.progress.php');\n}\t\nvar xSaveRemote{$t}= function (obj) {\t\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tLoadjs('influxdb.remote.progress.php');\n}\n\nfunction SaveRemote{$t}(){\n\tvar XHR = new XHRConnection();\n\tif(document.getElementById('InfluxUseRemote').checked){XHR.appendData('InfluxUseRemote', 1);}else{XHR.appendData('InfluxUseRemote', 0);}\n\tif(document.getElementById('InfluxSyslogRemote').checked){XHR.appendData('InfluxSyslogRemote', 1);}else{XHR.appendData('InfluxSyslogRemote', 0);}\n\tXHR.appendData('InfluxUseRemoteIpaddr', document.getElementById('InfluxUseRemoteIpaddr').value);\n\tXHR.appendData('InfluxUseRemotePort', document.getElementById('InfluxUseRemotePort').value);\n\tXHR.appendData('InfluxUseRemoteArticaPort', document.getElementById('InfluxUseRemoteArticaPort').value);\n\tXHR.appendData('ArticaInfluxPassword', encodeURIComponent(document.getElementById('ArticaInfluxPassword').value));\n\tXHR.appendData('ArticaInfluxUsername', document.getElementById('ArticaInfluxUsername').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSaveRemote{$t}); \n\n}\n\t\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\t\n\tif(document.getElementById('NoCompressStatisticsByHour').checked){XHR.appendData('NoCompressStatisticsByHour', 1);\t}else{XHR.appendData('NoCompressStatisticsByHour', 0);}\n\tif(document.getElementById('ResolvIPStatistics').checked){XHR.appendData('ResolvIPStatistics', 1);\t}else{XHR.appendData('ResolvIPStatistics', 0);}\n\tif(document.getElementById('InfluxAdminEnabled').checked){XHR.appendData('InfluxAdminEnabled', 1);\t}else{XHR.appendData('InfluxAdminEnabled', 0);}\n\tif(document.getElementById('EnableQuotasStatistics').checked){XHR.appendData('EnableQuotasStatistics', 1);\t}else{XHR.appendData('EnableQuotasStatistics', 0);}\n\tif(document.getElementById('UserAgentsStatistics').checked){XHR.appendData('UserAgentsStatistics', 1);\t}else{XHR.appendData('UserAgentsStatistics', 0);}\n\tif(document.getElementById('InfluxDBAllowBrowse').checked){XHR.appendData('InfluxDBAllowBrowse', 1);\t}else{XHR.appendData('InfluxDBAllowBrowse', 0);}\n \t//XHR.appendData('InfluxDBPassword', encodeURIComponent(document.getElementById('InfluxDBPassword').value));\n\t\n\t\n\tXHR.appendData('MySQLStatisticsRetentionDays', document.getElementById('MySQLStatisticsRetentionDays').value);\n\tXHR.appendData('InfluxAdminPort', document.getElementById('InfluxAdminPort').value);\n\tXHR.appendData('InfluxAdminRetentionTime', document.getElementById('InfluxAdminRetentionTime').value);\t\t\n\tXHR.appendData('QuotasStatisticsInterval', document.getElementById('QuotasStatisticsInterval').value);\n\tXHR.appendData('InfluxListenInterface', document.getElementById('InfluxListenInterface').value);\n\tXHR.appendData('InFluxBackupDatabaseInterval', document.getElementById('InFluxBackupDatabaseInterval').value);\n\tXHR.appendData('InFluxBackupDatabaseDir', document.getElementById('InFluxBackupDatabaseDir').value);\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t}); \t\t\t\n}\n\nfunction EnableQuotasStatisticsCheck(){\n\tdocument.getElementById('QuotasStatisticsInterval').disabled=true;\n\tif(document.getElementById('EnableQuotasStatistics').checked){\n\t\tdocument.getElementById('QuotasStatisticsInterval').disabled=false;\n\t}\n}\n\nfunction InfluxUseRemoteCheck(){\n\tif(document.getElementById('InfluxUseRemote').checked){\n\t\tdocument.getElementById('influx-local-service-id').style.display='none';\n\t\tdocument.getElementById('influx-backup-service-id').style.display='none';\n\t\tdocument.getElementById('influx-remote-service-options').style.display='';\n\t\t\n\t}else{\n\t\tdocument.getElementById('influx-local-service-id').style.display='';\n\t\tdocument.getElementById('influx-backup-service-id').style.display='';\n\t\tdocument.getElementById('influx-remote-service-options').style.display='none';\n\t\n\t}\n\t\n\tvar STATS_APPLIANCE={$STATS_APPLIANCE};\n\tif(STATS_APPLIANCE==1){\n\t\tdocument.getElementById('influx-remote-service-id').style.display='none';\n\t}\n}\n\n\nfunction checkt{$t}(){\n\tvar CORP_LICENSE={$CORP_LICENSE};\n\tdocument.getElementById('InfluxAdminRetentionTime').disabled=true;\n\tif(CORP_LICENSE==1){document.getElementById('InfluxAdminRetentionTime').disabled=false;}\n}\n\nEnableQuotasStatisticsCheck();\ncheckt{$t}();\nInfluxUseRemoteCheck();\nLoadAjaxRound('influx-db-status','{$page}?service-status=yes');\t\t\t\t\n</script>\n\t\t\t\t\n\t\t\t\t\n"; echo $tpl->_ENGINE_parse_body($html); }
function master_service_add_popup(){ $tpl=new templates(); $page=CurrentPageName(); $net=new networking(); $tcp=$net->Local_interfaces(); unset($tcp["lo"]); $qos=new qos_net(); $already=$qos->getSavedNics(); while (list ($num, $ligne) = each ($already) ){unset($tcp[$num]);} $band=array(10240=>"10 Mb/s",102400=>"100 Mb/s",1024000=>"1 Gb/s"); $html=" <div id='qosdivadd'> <div class=explain>{add_qos_service_explain}</div> <table style='width:100%'> <tr> <td class=legend>{qos_service_name}:</td> <td >". Field_text("qos_name","Bandwith Limitation (new)","font-size:13px;padding:3px")."</td> </tr> <tr> <td class=legend>{nic}:</td> <td >". Field_array_Hash($tcp,"qos_nic",null,null,null,0,"font-size:13px;padding:3px")."</td> </tr> <tr> <td class=legend>{nic_bandwith}:</td> <td >". Field_array_Hash($band,"qos_band",102400,null,null,0,"font-size:13px;padding:3px")."</td> </tr> <tr> <td class=legend>{or} {nic_bandwith}:</td> <td style='font-size:13px'>". Field_text("qos_band2","","font-size:13px;padding:3px;width:90px")." Kb/s</td> </tr> <tr> <td colspan=2 align='right'><hr>". button("{add}","SaveQosServiceAdd()")."</td> </tr> </table> </div> <script> var x_SaveQosServiceAdd=function(obj){ var tempvalue=obj.responseText; if(tempvalue.length>0){alert(tempvalue);} QOS_START_POINT(); YahooWin3Hide(); } function SaveQosServiceAdd(){ var XHR = new XHRConnection(); XHR.appendData('master-service-add-add',1); XHR.appendData('qos_name',document.getElementById('qos_name').value); XHR.appendData('qos_nic',document.getElementById('qos_nic').value); var qos_band=document.getElementById('qos_band2').value; if(qos_band.length>0){ XHR.appendData('qos_band',qos_band); }else{ XHR.appendData('qos_nic',document.getElementById('qos_band').value); } document.getElementById('qosdivadd').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>'; XHR.sendAndLoad('$page', 'GET',x_SaveQosServiceAdd); } </script>"; echo $tpl->_ENGINE_parse_body($html); }
function acl_rule_settings() { $tpl = new templates(); $page = CurrentPageName(); $q = new mysql_squid_builder(); $ID = $_GET["ID"]; $t = time(); $results = $q->QUERY_SQL("SELECT aclname,ID FROM webfilters_sqacls WHERE aclgroup=1"); if (mysql_num_rows($results) > 0) { $ACLSGROUPS[0] = "{none}"; while ($ligne = mysql_fetch_assoc($results)) { $aclname = utf8_encode($ligne["aclname"]); $ACLSGROUPS[$ligne["ID"]] = $ligne["aclname"]; } } if (!$q->FIELD_EXISTS("webfilters_sqacls", "PortDirection")) { $q->QUERY_SQL("ALTER TABLE `webfilters_sqacls` ADD `PortDirection` smallint(1) NOT NULL DEFAULT '0',ADD INDEX(`PortDirection`)"); } $please_choose_a_bandwith_rule = $tpl->javascript_parse_text("{please_choose_a_bandwith_rule}"); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT aclname,acltpl,aclgpid,PortDirection FROM webfilters_sqacls WHERE ID='{$ID}'")); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}</p>"; return; } $aclname = utf8_encode($ligne["aclname"]); $acltpl = $ligne["acltpl"]; $aclgpid = $ligne["aclgpid"]; $PortDirection = $ligne["PortDirection"]; if (!is_numeric($PortDirection)) { $PortDirection = 0; } $PortDirectionS[0] = "{all_methods}"; $PortDirectionS[1] = "{standard_method}"; $PortDirectionS[2] = "{transparent_method}"; $PortDirectionS[3] = "{smartphones_port}"; $ip = new networking(); $interfaces = $ip->Local_interfaces(); unset($interfaces["lo"]); $arrayNICZ[null] = "0.0.0.0"; while (list($eth, $none) = each($interfaces)) { if (preg_match("#^gre#", $eth)) { continue; } $nic = new system_nic($eth); $arrayNICZ[$eth] = "{$eth} {$nic->IPADDR} - {$nic->NICNAME}"; } $sql = "SELECT * FROM proxy_ports WHERE enabled=1"; $resultsPorts = $q->QUERY_SQL($sql); while ($lignePorts = mysql_fetch_assoc($resultsPorts)) { $eth = $lignePorts["nic"]; $ipaddr = $arrayNICZ[$eth]; $port = $lignePorts["port"]; $IDPort = $lignePorts["ID"]; $PortDirectionS[$IDPort] = "{port} {$port} [{$ipaddr}]"; } $squid = new squidbee(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='url_rewrite_access_deny'")); $url_rewrite_access_deny = $ligne["httpaccess_value"]; if (!is_numeric($url_rewrite_access_deny)) { $url_rewrite_access_deny = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='url_rewrite_access_allow'")); $url_rewrite_access_allow = $ligne["httpaccess_value"]; if (!is_numeric($url_rewrite_access_allow)) { $url_rewrite_access_allow = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='access_deny'")); $access_deny = $ligne["httpaccess_value"]; if (!is_numeric($access_deny)) { $access_deny = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='adaptation_access_deny'")); $adaptation_access_deny = $ligne["httpaccess_value"]; if (!is_numeric($adaptation_access_deny)) { $adaptation_access_deny = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='cache_deny'")); $cache_deny = $ligne["httpaccess_value"]; if (!is_numeric($cache_deny)) { $cache_deny = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='access_allow'")); $access_allow = $ligne["httpaccess_value"]; if (!is_numeric($access_allow)) { $access_allow = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='http_reply_access_deny'")); $http_reply_access_deny = $ligne["httpaccess_value"]; if (!is_numeric($http_reply_access_deny)) { $http_reply_access_deny = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='http_reply_access_allow'")); $http_reply_access_allow = $ligne["http_reply_access_allow"]; if (!is_numeric($http_reply_access_allow)) { $http_reply_access_allow = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='cache_parent'")); $cache_parent = $ligne["httpaccess_value"]; if (!is_numeric($cache_parent)) { $cache_parent = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='snmp_access_allow'")); $snmp_access_allow = $ligne["httpaccess_value"]; if (!is_numeric($snmp_access_allow)) { $snmp_access_allow = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='log_access'")); $log_access = $ligne["httpaccess_value"]; if (!is_numeric($log_access)) { $log_access = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='deny_access_except'")); $deny_access_except = $ligne["httpaccess_value"]; if (!is_numeric($deny_access_except)) { $deny_access_except = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value,httpaccess_data FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='tcp_outgoing_tos'")); $tcp_outgoing_tos = $ligne["httpaccess_value"]; $tcp_outgoing_tos_value = $ligne["httpaccess_data"]; if (!is_numeric($tcp_outgoing_tos)) { $tcp_outgoing_tos = 0; } if ($tcp_outgoing_tos_value == null) { $tcp_outgoing_tos_value = "0x20"; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='reply_body_max_size'")); $reply_body_max_size = intval($ligne["httpaccess_value"]); $reply_body_max_size_value = intval($ligne["httpaccess_data"]); $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value,httpaccess_data FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='delay_access'")); $delay_access = $ligne["httpaccess_value"]; $delay_access_id = $ligne["httpaccess_data"]; if (!is_numeric($delay_access)) { $delay_access = 0; } if (!is_numeric($delay_access_id)) { $delay_access_id = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value,httpaccess_data FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='tcp_outgoing_address'")); $tcp_outgoing_address = $ligne["httpaccess_value"]; $tcp_outgoing_address_value = $ligne["httpaccess_data"]; if (!is_numeric($tcp_outgoing_address)) { $tcp_outgoing_address = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value,httpaccess_data FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='deny_quota_rule'")); $deny_quota_rule = $ligne["httpaccess_value"]; $deny_quota_rule_id = $ligne["httpaccess_data"]; if (!is_numeric($deny_quota_rule)) { $deny_quota_rule = 0; } if ($deny_quota_rule_id > 0) { $q3 = new mysql(); $ligne3 = mysql_fetch_array($q3->QUERY_SQL("SELECT QuotaName FROM ext_time_quota_acl WHERE ID={$deny_quota_rule_id}", "artica_backup")); $deny_quota_rule_value = $ligne3["QuotaName"]; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value,httpaccess_data FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='deny_log'")); $deny_log = $ligne["httpaccess_value"]; if (!is_numeric($deny_log)) { $deny_log = 0; } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT httpaccess_value,httpaccess_data FROM webfilters_sqaclaccess WHERE aclid='{$ID}' AND httpaccess='request_header_add'")); $request_header_add = $ligne["httpaccess_value"]; $request_header_add_value = unserialize(base64_decode($ligne["httpaccess_data"])); if (!is_numeric($request_header_add)) { $request_header_add = 0; } else { $request_header_add_name = $request_header_add_value["header_name"]; $request_header_add_value = $request_header_add_value["header_value"]; } $is33 = 0; $explain_no33squid = "{explain_no33squid}: {$squid->SQUID_VERSION}"; if ($squid->IS_33) { $is33 = 1; $explain_no33squid = null; } if ($acltpl == null) { $acltpl = "{default}"; } else { $md5 = $acltpl; $sql = "SELECT template_title FROM squidtpls WHERE `zmd5`='{$acltpl}'"; $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql)); $acltpl = addslashes($ligne2["template_title"]); $jstpl = "Loadjs('squid.templates.php?Zoom-js={$md5}&subject=" . base64_encode($acltpl) . "');"; $acltpl = "<a href=\"javascript:blur();\" OnClick=\"{$jstpl}\" style='font-size:14px;text-decoration:underline'>{$acltpl}</a>"; } if (intval($ligne["tplreset"]) == 1) { $acltpl = "<span style='font-size:14px;'>{reset_connection}</span>"; } if ($delay_access_id > 0) { $q2 = new mysql(); $sql = "SELECT rulename FROM squid_pools WHERE ID='{$delay_access_id}'"; $ligne = mysql_fetch_array($q2->QUERY_SQL($sql, "artica_backup")); $delay_access_id_text = $tpl->javascript_parse_text(utf8_encode($ligne["rulename"])); } $ayDscp = array(0 => '0x00', 8 => '0x20', 10 => '0x28', 12 => '0x30', 14 => '0x38', 16 => '0x40', 18 => '0x48', 20 => '0x50', 22 => '0x58', 24 => '0x60', 26 => '0x68', 28 => '0x70', 30 => '0x78', 32 => '0x80', 34 => '0x88', 36 => '0x90', 38 => '0x98', 40 => '0xA0', 46 => '0xB8', 48 => '0xC0', 56 => '0xE0'); $ipz = new networking(); $ipss = $ipz->ALL_IPS_GET_ARRAY(); $t = $_GET["t"]; if (!is_numeric($t)) { $t = time(); } $html = "\n\t<div id='FormToParse{$t}'>\n\t<div id='divid{$t}' ></div> \n\t\n\t<div style='width:98%' class=form>\n\t<table style='width:100%' class=TableRemove>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{rule_name}:</td>\n\t\t<td>" . Field_text("aclrulename", $aclname, "font-size:18px;width:360px", null, null, null, false, "SaveAclRule{$ID}Check(event)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{method}:</td>\n\t\t<td>" . Field_array_Hash($PortDirectionS, "PortDirection-{$t}", $PortDirection, null, null, 0, "font-size:18px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{rule_group}:</td>\n\t\t<td>" . Field_array_Hash($ACLSGROUPS, "aclgpid-{$t}", $aclgpid, null, null, 0, "font-size:18px") . "</td>\n\t</tr>\n\t\t\t\t\n\t\n\t</table>\n\t\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{allow}:</td>\n\t\t<td>" . Field_checkbox_design("access_allow", 1, $access_allow, "access_allow_check()") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{deny_access}:</td>\n\t\t<td>" . Field_checkbox_design("access_deny", 1, $access_deny, "access_deny_check()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{deny_reply_access}:</td>\n\t\t<td>" . Field_checkbox_design("http_reply_access_deny", 1, $http_reply_access_deny, "http_reply_access_deny_check()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{allow_reply_access}:</td>\n\t\t<td>" . Field_checkbox_design("http_reply_access_allow", 1, $http_reply_access_allow, "http_reply_access_allow_check()") . "</td>\n\t</tr>\n\t\t\t\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{deny_access_except}:</td>\n\t\t<td>" . Field_checkbox_design("deny_access_except", 1, $deny_access_except, "deny_access_except_check()") . "</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{pass_trough_thewebfilter_engine}:</td>\n\t\t<td>" . Field_checkbox_design("url_rewrite_access_deny", 1, $url_rewrite_access_deny, "url_rewrite_access_deny_check()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{force_using_thewebfilter_engine}:</td>\n\t\t<td>" . Field_checkbox_design("url_rewrite_access_allow", 1, $url_rewrite_access_allow, "url_rewrite_access_allow_check()") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{pass_trough_antivirus_engine}:</td>\n\t\t<td>" . Field_checkbox_design("adaptation_access_deny", 1, $adaptation_access_deny, "adaptation_access_deny_check()") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{allow_snmp_access}:</td>\n\t\t<td>" . Field_checkbox_design("snmp_access_allow", 1, $snmp_access_allow, "snmp_access_allow_check()") . "</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{do_not_cache}:</td>\n\t\t<td>" . Field_checkbox_design("cache_deny", 1, $cache_deny, "cache_deny_check()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'><a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.acls.proxy.parent.php?aclid={$ID}');\"\n\t\tstyle='text-decoration:underline'>\n\t\t{use_parent_proxy}</a>:</td>\n\t\t<td>" . Field_checkbox_design("cache_parent", 1, $cache_parent, "cache_parent_check()") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{log_to_csv}:</td>\n\t\t<td>" . Field_checkbox_design("log_access", 1, $log_access, "log_access_check()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{deny_logging}:</td>\n\t\t<td>" . Field_checkbox_design("deny_log", 1, $deny_log, "deny_log_check()") . "</td>\n\t</tr>\n\t</table>\n\n\t<hr>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{limit_bandwidth}:</td>\n\t\t\t<td>" . Field_checkbox_design("delay_access", 1, $delay_access, "limit_bandwidth_check()") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{bandwidth}:</td>\n\t\t\t<td>\n\t\t\t\t<span id='delay_access_id_text' style='font-size:18px;font-weight:bold'>{$delay_access_id_text}</span>\n\t\t\t\t<input type='hidden' id='delay_access_id' value='{$delay_access_id}'>\n\t\t\t</td>\n\t\t\t<td width=1%>" . button('{browse}...', "Loadjs('squid.bandwith.php?browser-acl-js=yes&aclruleid={$ID}')") . "</td>\n\t\t</tr>\t\t\t\n\t\t</table>\n\t\n\t\t\t\t\n\t<hr>\t\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{affect_quota_rule}:</td>\n\t\t<td>" . Field_checkbox_design("deny_quota_rule", 1, $deny_quota_rule, "deny_quota_rule_check()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{quota_rule}:</td>\n\t\t<td>\n\t\t\t<span id='deny_quota_rule_id_text' style='font-size:18px;font-weight:bold'>[{$deny_quota_rule_id}]:{$deny_quota_rule_value}</span>\n\t\t\t<input type='hidden' id='deny_quota_rule_id' value='{$deny_quota_rule_id}'>\n\t\t</td>\n\t\t<td width=1%>" . button('{browse}...', "Loadjs('squid.ext_time_quota_acl.php?browser-quota-js=yes&checkbowid=deny_quota_rule&textid=deny_quota_rule_id_text&idnum=deny_quota_rule_id')") . "</td>\n\t</tr>\t\t\t\n\t</table>\t\t\t\t\n\t\n\t\t\t\t\n\t<hr>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{request_header_add}:</td>\n\t\t<td>" . Field_checkbox_design("request_header_add", 1, $request_header_add, "request_header_addCheck()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{header_name}:</td>\n\t\t<td>" . Field_text("request_header_add_name", $request_header_add_name, 'font-size:18px;width:210px') . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{header_value}:</td>\n\t\t<td>" . Field_text("request_header_add_value", $request_header_add_value, 'font-size:18px;width:210px') . "</td>\n\t</tr>\t\t\t\t\t\n\t</table>\n\t<div><i style='font-size:11px'>{$explain_no33squid}</i></div>\t\n\n\t\n\t<hr>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{reply_body_max_size_acl}:</td>\n\t\t\t<td>" . Field_checkbox_design("reply_body_max_size", 1, $reply_body_max_size, "reply_body_max_sizeCheck()") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{max_size}:</td>\n\t\t\t<td style='font-size:18px'>" . Field_text("reply_body_max_size_value", $reply_body_max_size_value, 'font-size:18px;width:90px') . " MB</td>\n\t\t</tr>\t\n\t</table>\n\t\n\t<hr>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{tcp_outgoing_tos}:</td>\n\t\t\t<td>" . Field_checkbox_design("tcp_outgoing_tos", 1, $tcp_outgoing_tos, "tcp_outgoing_tosCheck()") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{tcp_outgoing_tos_value}:</td>\n\t\t\t<td>" . Field_array_Hash($ayDscp, "tcp_outgoing_tos_value", $tcp_outgoing_tos_value, 'style:font-size:18px;') . "</td>\n\t\t</tr>\t\n\t</table>\n\n\n\t\n\t<hr>\n\t<table style='width:100%'>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{acl_tcp_outgoing_address}:</td>\n\t\t<td>" . Field_checkbox_design("tcp_outgoing_address-{$t}", 1, $tcp_outgoing_address, "tcp_outgoing_address_check{$t}()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{ipaddr}:</td>\n\t\t<td>" . Field_array_Hash($ipss, "tcp_outgoing_address_value", $tcp_outgoing_address_value, null, null, 0, "font-size:18px") . "</td>\n\t</tr>\t\n\t</table>\t\n\t\n\t\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "SaveAclRule{$ID}()", 22) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t<script>\n\t\n\t\tvar x_SaveAclRule{$ID}= function (obj) {\n\t\t\tvar res=obj.responseText;\n\t\t\tif(res.length>3){alert(res);return;}\n\t\t\t\$('#table-{$t}').flexReload();\n\t\t\tExecuteByClassName('SearchFunction');\n\t\t}\n\t\t\n\t\tfunction SaveAclRule{$ID}Check(e){\n\t\t\tif(!checkEnter(e)){return;}\n\t\t\tSaveAclRule{$ID}();\n\t\t}\n\t\n\t\tfunction SaveAclRule{$ID}(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('aclrulename', document.getElementById('aclrulename').value);\n\t\t\tXHR.appendData('aclgpid', document.getElementById('aclgpid-{$t}').value);\n\t\t\tXHR.appendData('PortDirection', document.getElementById('PortDirection-{$t}').value);\n\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('tcp_outgoing_tos_value', document.getElementById('tcp_outgoing_tos_value').value);\n\t\t\tXHR.appendData('tcp_outgoing_address_value', document.getElementById('tcp_outgoing_address_value').value);\n\t\t\tvar delay_access_id=document.getElementById('delay_access_id').value;\n\t\t\t\n\t\t\tif(document.getElementById('delay_access').checked){\n\t\t\t\tif(delay_access_id==0){\n\t\t\t\t\talert('{$please_choose_a_bandwith_rule}');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tXHR.appendData('delay_access_id', document.getElementById('delay_access_id').value);\n\t\t\tXHR.appendData('ID', '{$ID}');\n\t\t\tif(document.getElementById('tcp_outgoing_tos').checked){XHR.appendData('tcp_outgoing_tos', '1');}else{XHR.appendData('tcp_outgoing_tos', '0');}\n\t\t\tif(document.getElementById('access_allow').checked){XHR.appendData('access_allow', '1');}else{XHR.appendData('access_allow', '0');}\n\t\t\tif(document.getElementById('deny_access_except').checked){XHR.appendData('deny_access_except', '1');}else{XHR.appendData('deny_access_except', '0');}\n\t\t\tif(document.getElementById('url_rewrite_access_deny').checked){XHR.appendData('url_rewrite_access_deny', '1');}else{XHR.appendData('url_rewrite_access_deny', '0');}\n\t\t\tif(document.getElementById('url_rewrite_access_allow').checked){XHR.appendData('url_rewrite_access_allow', '1');}else{XHR.appendData('url_rewrite_access_allow', '0');}\n\t\t\tif(document.getElementById('access_deny').checked){XHR.appendData('access_deny', '1');}else{XHR.appendData('access_deny', '0');}\n\t\t\tif(document.getElementById('adaptation_access_deny').checked){XHR.appendData('adaptation_access_deny', '1');}else{XHR.appendData('adaptation_access_deny', '0');}\n\t\t\tif(document.getElementById('cache_deny').checked){XHR.appendData('cache_deny', '1');}else{XHR.appendData('cache_deny', '0');}\n\t\t\tif(document.getElementById('delay_access').checked){XHR.appendData('delay_access', '1');}else{XHR.appendData('delay_access', '0');}\n\t\t\tif(document.getElementById('tcp_outgoing_address-{$t}').checked){XHR.appendData('tcp_outgoing_address', '1');}else{XHR.appendData('tcp_outgoing_address', '0');}\n\t\t\tif(document.getElementById('snmp_access_allow').checked){XHR.appendData('snmp_access_allow', '1');}else{XHR.appendData('snmp_access_allow', '0');}\n\t\t\tif(document.getElementById('log_access').checked){XHR.appendData('log_access', '1');}else{XHR.appendData('log_access', '0');}\n\t\t\tif(document.getElementById('request_header_add').checked){XHR.appendData('request_header_add', '1');}else{XHR.appendData('request_header_add', '0');}\n\t\t\tif(document.getElementById('deny_log').checked){XHR.appendData('deny_log', '1');}else{XHR.appendData('deny_log', '0');}\n\t\t\tif(document.getElementById('deny_quota_rule').checked){XHR.appendData('deny_quota_rule', '1');}else{XHR.appendData('deny_quota_rule', '0');}\n\t\t\tif(document.getElementById('cache_parent').checked){XHR.appendData('cache_parent', '1');}else{XHR.appendData('cache_parent', '0');}\n\t\t\t\n\t\t\tif(document.getElementById('http_reply_access_allow').checked){XHR.appendData('http_reply_access_allow', '1');}else{XHR.appendData('http_reply_access_allow', '0');}\n\t\t\tif(document.getElementById('http_reply_access_deny').checked){XHR.appendData('http_reply_access_deny', '1');}else{XHR.appendData('http_reply_access_deny', '0');}\n\t\t\t\n\t\t\tif(document.getElementById('reply_body_max_size').checked){XHR.appendData('reply_body_max_size', '1');}else{XHR.appendData('reply_body_max_size', '0');}\n\t\t\tXHR.appendData('reply_body_max_size_value', document.getElementById('reply_body_max_size_value').value);\n\t\t\t\n\t\t\tXHR.appendData('deny_quota_rule_id', document.getElementById('deny_quota_rule_id').value);\n\t\t\tXHR.appendData('request_header_add_name', document.getElementById('request_header_add_name').value);\n\t\t\tXHR.appendData('request_header_add_value', document.getElementById('request_header_add_value').value);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveAclRule{$ID}); \t\t\n\t\t\n\t\t}\n\t\t\n\t\t\n\n\t\n\tfunction CheckAll(){\n\tvar c=0;\n\t\$('input,select,hidden,textarea', '#FormToParse{$t}').each(function() {\n\t\t \tvar \$t = \$(this);\n\t\t \tvar id=\$t.attr('id');\n\t\t \tvar value=\$t.attr('value');\n\t\t \tvar type=\$t.attr('type');\n\t\t \tif(type=='checkbox'){\n\t\t \t\tif(document.getElementById(id).checked){c=c+1;}\n\t\t \t}\n\t\t \t\n\t\t});\t\t\n\t\t\n\tif(c==0){\n\t\t\$('input,select,hidden,textarea', '#FormToParse{$t}').each(function() {\n\t\t\t \tvar \$t = \$(this);\n\t\t\t \tvar id=\$t.attr('id');\n\t\t\t \tvar value=\$t.attr('value');\n\t\t\t \tvar type=\$t.attr('type');\n\t\t\t \tif(type=='checkbox'){\n\t\t\t \t\tdocument.getElementById(id).disabled=false;\n\t\t\t \t}\n\t\t\t \t\n\t\t\t});\t\t\t\n\t\n\t\t}\n\t\n\t}\n\t\n\tfunction DisableAllInstead(zid){\n\t\t\$('input,select,hidden,textarea', '#FormToParse{$t}').each(function() {\n\t\t \tvar \$t = \$(this);\n\t\t \tvar id=\$t.attr('id');\n\t\t \tif(zid==id){return;}\n\t\t \tvar value=\$t.attr('value');\n\t\t \tvar type=\$t.attr('type');\n\t\t \tif(type=='checkbox'){\n\t\t \t\tdocument.getElementById(id).checked=false;\n\t\t \t\tdocument.getElementById(id).disabled=true;\n\t\t \t}\n\t\t \t\n\t\t});\t\n\t}\n\t\n\tfunction limit_bandwidth_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\n\t\tif(document.getElementById('delay_access').checked){DisableAllInstead('delay_access');}else{CheckAll();}\n\t\t\n\t}\n\t\n\tfunction access_allow_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\n\t\tif(document.getElementById('access_allow').checked){DisableAllInstead('access_allow');}else{CheckAll();}\n\t}\n\t\n\t\n\tfunction access_deny_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\n\t\tif(document.getElementById('access_deny').checked){DisableAllInstead('access_deny');}else{CheckAll();}\n\t}\n\t\n\tfunction http_reply_access_deny_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}(nosave);}\t\n\t\tif(document.getElementById('http_reply_access_deny').checked){DisableAllInstead('http_reply_access_deny');}else{CheckAll();}\n\t}\n\t\n\tfunction http_reply_access_allow_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\t\n\t\tif(document.getElementById('http_reply_access_allow').checked){DisableAllInstead('http_reply_access_allow');}else{CheckAll();}\n\t}\n\t\n\tfunction deny_log_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\t\n\t\tif(document.getElementById('deny_log').checked){DisableAllInstead('deny_log');}else{CheckAll();}\n\t}\n\n\tfunction cache_deny_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\t\n\t\tif(document.getElementById('cache_deny').checked){DisableAllInstead('cache_deny');}else{CheckAll();}\n\t\n\t}\n\t\n\tfunction cache_parent_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\t\n\t\tif(document.getElementById('cache_parent').checked){DisableAllInstead('cache_parent');}else{CheckAll();}\n\t}\n\t\n\tfunction adaptation_access_deny_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\t\n\t\tif(document.getElementById('adaptation_access_deny').checked){DisableAllInstead('adaptation_access_deny');}else{CheckAll();}\n\t}\n\t\n\tfunction url_rewrite_access_deny_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}(nosave);}\t\n\t\tif(document.getElementById('url_rewrite_access_deny').checked){DisableAllInstead('url_rewrite_access_deny');}else{CheckAll();}\n\t}\n\tfunction url_rewrite_access_allow_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}(nosave);}\t\n\t\tif(document.getElementById('url_rewrite_access_allow').checked){DisableAllInstead('url_rewrite_access_allow');}else{CheckAll();}\n\t}\t\n\t\n\t\n\tfunction snmp_access_allow_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}(nosave);}\t\n\t\tif(document.getElementById('snmp_access_allow').checked){DisableAllInstead('snmp_access_allow');}else{CheckAll();}\n\t}\n\t\n\tfunction log_access_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}(nosave);}\t\n\t\tif(document.getElementById('log_access').checked){DisableAllInstead('log_access');}else{CheckAll();}\n\t}\n\t\n\t\n\tfunction deny_quota_rule_check(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\t\n\t\tif(document.getElementById('deny_quota_rule').checked){\n\t\t\tDisableAllInstead('deny_quota_rule');\n\n\n\t\t}else{CheckAll();}\n\t\t\n\t } \n\t\n\t\n\tfunction tcp_outgoing_address_check{$t}(nosave){\n\t\tif(!nosave){SaveAclRule{$ID}();}\n\t\tif(document.getElementById('tcp_outgoing_address-{$t}').checked){\n\t\t\n\t\t\t\n\t\t\tDisableAllInstead('tcp_outgoing_address');\n\t\t\tdocument.getElementById('tcp_outgoing_address_value').disabled=false;\n\t\t\tdocument.getElementById('tcp_outgoing_address-{$t}').checked=true;\n\t\t\tdocument.getElementById('tcp_outgoing_address-{$t}').disabled=false;\n\t\t}else{\n\t\t\tdocument.getElementById('tcp_outgoing_address_value').disabled=true;\n\t\t\tCheckAll();\n\t\t}\n\t}\t\n\t\n\n\tfunction tcp_outgoing_tosCheck(nosave){\n\t\t\t\tif(!nosave){SaveAclRule{$ID}();}\n\t\tif(document.getElementById('tcp_outgoing_tos').checked){\n\t\t\tDisableAllInstead('tcp_outgoing_tos');\n\t\t\tdocument.getElementById('tcp_outgoing_tos_value').disabled=false;\n\t\t}else{\n\t\t\tdocument.getElementById('tcp_outgoing_tos_value').disabled=true;\n\t\t\tCheckAll();\n\t\t}\n\t}\n\t\n\tfunction deny_access_except_check(nosave){\n\t\t\tif(!nosave){SaveAclRule{$ID}();}\n\t\tif(document.getElementById('deny_access_except').checked){DisableAllInstead('deny_access_except');}else{CheckAll();}\n\t}\n\t\n\tfunction request_header_addCheck(nosave){\n\t\tvar is33={$is33};\n\t\tif(is33==0){return;}\n\t\tif(!nosave){SaveAclRule{$ID}();}\n\t\tif(document.getElementById('request_header_add').checked){\n\t\t\tDisableAllInstead('request_header_add');\n\t\t\tdocument.getElementById('request_header_add_name').disabled=false;\n\t\t\tdocument.getElementById('request_header_add_value').disabled=false;\n\t\t}else{\n\t\t\tdocument.getElementById('request_header_add_name').disabled=true;\n\t\t\tdocument.getElementById('request_header_add_value').disabled=true;\t\n\t\t\tCheckAll();\t\n\t\t}\n\t\t\n\t}\n\t\n\t\n\tfunction reply_body_max_sizeCheck(nosave){\n\t\t\tif(!nosave){SaveAclRule{$ID}();}\n\t\tif(document.getElementById('reply_body_max_size').checked){\n\t\t\tDisableAllInstead('reply_body_max_size');\n\t\t\tdocument.getElementById('reply_body_max_size').disabled=false;\n\t\t\tdocument.getElementById('reply_body_max_size_value').disabled=false;\n\t\t}else{\n\t\t\tdocument.getElementById('reply_body_max_size').disabled=true;\n\t\t\tdocument.getElementById('reply_body_max_size_value').disabled=true;\t\n\t\t\tCheckAll();\t\n\t\t}\n\t\n\t}\n\tfunction features33_check(){\n\t\tvar is33={$is33};\n\t\tdocument.getElementById('request_header_add').disabled=true;\n\t\tdocument.getElementById('request_header_add_value').disabled=true;\n\t\tdocument.getElementById('request_header_add_name').disabled=true;\n\t\tif(is33==0){return;}\n\n\t\tdocument.getElementById('request_header_add').disabled=false;\n\t\tif(document.getElementById('request_header_add').checked){\n\t\t\tDisableAllInstead('request_header_add');\n\t\t\tdocument.getElementById('request_header_add_name').disabled=false;\n\t\t\tdocument.getElementById('request_header_add_value').disabled=false;\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t\n\tlimit_bandwidth_check(true);\n\taccess_allow_check(true);\n\taccess_deny_check(true);\n\tdeny_access_except_check(true);\n\ttcp_outgoing_tosCheck(true);\n\tcache_deny_check(true);\n\tadaptation_access_deny_check(true);\n\turl_rewrite_access_deny_check(true);\n\turl_rewrite_access_allow_check(true);\n\ttcp_outgoing_address_check{$t}(true);\n\tsnmp_access_allow_check(true);\n\tlog_access_check(true);\n\tfeatures33_check(true);\n\tdeny_quota_rule_check(true);\n\thttp_reply_access_deny_check(true);\t\n\thttp_reply_access_allow_check(true);\n\tCheckBoxDesignRebuild();\n\t</script>\n\t\n\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function mainroutes_popup() { $zmd5 = $_GET["zmd5"]; $users = new usersMenus(); $page = CurrentPageName(); $tpl = new templates(); $t = time(); $buttonname = "{add}"; $boot = new boostrap_form(); if ($zmd5 != null) { $q = new mysql(); $sql = "SELECT * FROM nic_routes WHERE zmd5='{$zmd5}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $title = $tpl->_ENGINE_parse_body("{$ligne["pattern"]}"); $buttonname = "{apply}"; } else { $boot->set_CloseYahoo("YahooWin2"); } $nics[null] = "{select}"; $types[1] = "{network_nic}"; $types[2] = "{host}"; $ip = new networking(); $Interfaces = $ip->Local_interfaces(); unset($Interfaces["lo"]); $Interfaces[null] = "{select}"; if (!is_numeric($ligne["enable"])) { $ligne["enable"] = 1; } $boot->set_formtitle($title); $boot->set_hidden("zmd5", $zmd5); //$boot->set_checkbox("enable", "{enabled}", $ligne["enable"],array("DISABLEALL"=>true)); $boot->set_list("type", "{type}", $types, $ligne["type"]); $boot->set_field("pattern", "{destination}", $ligne["pattern"]); $boot->set_field("gateway", "{gateway}", $ligne["gateway"]); $boot->set_list("nic", "{interface}", $Interfaces, $ligne["interface"]); $users = new usersMenus(); if (!$users->AsSystemAdministrator) { $boot->set_form_locked(); } $boot->set_button($buttonname); $boot->set_RefreshSearchs(); echo $boot->Compile(); }
function table() { $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); $net = new networking(); $interfaces = $net->Local_interfaces(); unset($interfaces["lo"]); if (count($interfaces) < 2) { echo FATAL_ERROR_SHOW_128("{error_need_at_lease_2_pvinterfaces}"); return; } $network_bridges = $tpl->_ENGINE_parse_body("{routers}"); $nic_from = $tpl->javascript_parse_text("{nic_from}"); $nic_to = $tpl->javascript_parse_text("{nic_to}"); $tcp_address = $tpl->_ENGINE_parse_body("{tcp_address}"); $netmask = $tpl->javascript_parse_text("{netmask}"); $to = $tpl->_ENGINE_parse_body("{to}"); $t = $_GET["t"]; if (!is_numeric($t)) { $t = time(); } $tablesize = 868; $descriptionsize = 705; $bts = array(); $add = $tpl->_ENGINE_parse_body("{new_router}"); $delete = $tpl->javascript_parse_text("{delete}"); $about = $tpl->javascript_parse_text("{about2}"); $reconstruct = $tpl->javascript_parse_text("{apply_firewall_rules}"); $bts[] = "{name: '<strong style=font-size:18px>{$add}</strong>', bclass: 'add', onpress :RuleAdd{$t}},"; $bts[] = "{name: '<strong style=font-size:18px>{$reconstruct}</strong>', bclass: 'apply', onpress : BuildVLANs{$t}},"; $bts[] = "{name: '<strong style=font-size:18px>{$about}</strong>', bclass: 'help', onpress : About{$t}},"; $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement"); if ($DisableNetworksManagement == null) { $DisableNetworksManagement = 0; } if (count($bts) > 0) { $buttons = "buttons : [" . @implode("\n", $bts) . " ],"; } $reboot_network_explain = $tpl->javascript_parse_text("{bridges_iptables_explain}\n\n{reboot_network_explain}"); $html = "\n\t\t\n\t\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:99%'></table>\n\t\t\n\t\t<script>\n\t\tvar mm{$t}=0;\n\t\t\$(document).ready(function(){\n\t\t\$('#flexRT{$t}').flexigrid({\n\t\turl: '{$page}?rules-list=yes&t={$t}',\n\t\tdataType: 'json',\n\t\tcolModel : [\n\t\t{display: 'ID', name : 'ID', width : 31, sortable : true, align: 'center'},\n\t\t{display: '{$nic_from}', name : 'nic_from', width : 514, sortable : false, align: 'left'},\n\t\t{display: ' ', name : 'none1', width : 50, sortable : false, align: 'center'},\n\t\t{display: '{$nic_to}', name : 'nic_to', width : 736, sortable : false, align: 'left'},\n\t\t{display: ' ', name : 'delete', width : 70, sortable : false, align: 'center'},\n\t\t],{$buttons}\n\t\tsearchitems : [\n\t\t{display: '{$nic_from}', name : 'nic_from'},\n\t\t{display: '{$nic_to}', name : 'nic_to'},\n\n\t\t],\n\t\tsortname: 'ID',\n\t\tsortorder: 'desc',\n\t\tusepager: true,\n\t\ttitle: '<span style=font-size:22px>{$network_bridges}</span>',\n\t\tuseRp: true,\n\t\trp: 25,\n\t\tshowTableToggleBtn: false,\n\t\twidth: '99%',\n\t\theight: 400,\n\t\tsingleSelect: true\n\t\n\t});\n\t});\n\t\n\tfunction RuleAdd{$t}(){\n\t\tLoadjs('{$page}?network-bridge-js=yes&ID=0&t={$t}',true);\n\t}\n\t\n\tfunction BuildVLANs{$t}(){\n\t\tLoadjs('firehol.progress.php?t={$t}');\n\t\n\t}\n\t\n\tfunction About{$t}(){\n\t\talert('{$reboot_network_explain}');\n\t}\n\t\n\t\n\t\n\tfunction EmptyTask{$t}(){\n\tif(confirm('{$empty}::{$_GET["taskid"]}')){\n\t\n\t}\n\t}\n\tvar X_VLANDelete{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);return;}\n\t\$('#row'+mm{$t}).remove();\n\t}\n\t\n\t\n\tfunction VLANDelete(id){\n\tif(confirm('{$delete} '+id+'?')){\n\tvar DisableNetworksManagement={$DisableNetworksManagement};\n\tif(DisableNetworksManagement==1){alert('{$ERROR_NO_PRIVS}');return;}\n\tmm{$t}=id;\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('vlan-del',id);\n\tXHR.sendAndLoad('{$page}', 'GET',X_VLANDelete{$t});\n\t}\n\t}\n\t\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function add_interface_popup() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $nic = new networking(); $nicZ = $nic->Local_interfaces(); $NICS[null] = "{select}"; while (list($yinter, $line) = each($nicZ)) { $znic = new system_nic($yinter); if ($znic->Bridged == 1) { continue; } $NICS[$yinter] = "[{$yinter}] - {$znic->NICNAME}"; } $interface_field = "\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{interface}:</td>\n\t\t<td>" . Field_array_Hash($NICS, "eth-{$t}", $_GET["eth"], "style:font-size:22px") . "</td>\n\t</tr>"; if ($_GET["eth"] != null) { $q = new mysql(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM suricata_interfaces WHERE interface='{$_GET["eth"]}'", "artica_backup")); $title = "{$_GET["eth"]}::" . $tpl->javascript_parse_text($ligne["rulename"]); $interface_field = "\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' nowrap>{interface}:</td>\n\t\t\t<td style='font-size:22px;font-weight:bold'>{$NICS[$_GET["eth"]]}\n\t\t\t\t<input type='hidden' id='eth-{$t}' value='{$_GET["eth"]}'>\n\t\t\t</td>\n\t\t</tr>"; } else { $ligne["threads"] = 2; $ligne["enable"] = 1; } $html = "\n<center id='id-{$t}' style='width:98%' class=form>\n\t<table style=width:100%'>\n\t<tbody>\n\t{$interface_field}\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{enabled}:</td>\n\t\t<td>" . Field_checkbox_design("enabled-{$t}", 1, $ligne["enable"]) . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{threads}</td>\n\t\t<td>" . Field_text("threads-{$t}", null, "font-size:22px;padding:3px;width:150px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{add}", "Save{$t}()", 30) . "</td>\n\t</tr>\n\t</tbody>\n</table>\n</center>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n\t\$('#TABLE_SURICATA_INTERFACE').flexReload();\n\tYahooWin4Hide();\n}\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('eth',document.getElementById('eth-{$t}').value);\n\tXHR.appendData('threads',document.getElementById('threads-{$t}').value);\n\tif(document.getElementById('enabled-{$t}').checked){\n\t\tXHR.appendData('enabled',1); }else{ XHR.appendData('enabled',0); \n\t}\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function transparent_HTTP(){ $page=CurrentPageName(); $sock=new sockets(); $KERNEL_CONFIG=unserialize(base64_decode($sock->getFrameWork("services.php?KERNEL_CONFIG=yes"))); $users=new usersMenus(); $KERNEL_CONFIG=unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/KERNEL_CONFIG")); $CONFIG_NETFILTER_TPROXY=$KERNEL_CONFIG["CONFIG_NETFILTER_TPROXY"]; if(!is_numeric($CONFIG_NETFILTER_TPROXY)){$CONFIG_NETFILTER_TPROXY=0;} $UseTProxyMode=intval($sock->GET_INFO("UseTProxyMode")); $squid=new squidbee(); $KernelSendRedirects=$sock->GET_INFO("KernelSendRedirects"); $SquidTransparentMixed=$sock->GET_INFO("SquidTransparentMixed"); $SquidClientDSTPassThru=intval($sock->GET_INFO("SquidClientDSTPassThru")); $SquidTProxyInterface=$sock->GET_INFO("SquidTProxyInterface"); if(!is_numeric($KernelSendRedirects)){$KernelSendRedirects=1;} if(!is_numeric($SquidTransparentMixed)){$SquidTransparentMixed=0;} $EnableRemoteStatisticsAppliance=$sock->GET_INFO("EnableRemoteStatisticsAppliance"); if(!is_numeric($EnableRemoteStatisticsAppliance)){$EnableRemoteStatisticsAppliance=0;} $nics=new networking(); $Z=$nics->Local_interfaces(true); unset($Z["lo"]); while (list ($int, $none) = each ($Z) ){ $nic=new system_nic($int); $ETHZ[$int]="{$int} - $nic->NICNAME - $nic->IPADDR"; } $arpoisonning=" <tr> <td width=1%><img src='img/arrow-right-24-grey.png'></td> <td><a href=\"javascript:blur();\" OnClick=\"javascript:blur()\" style='font-size:16px;text-decoration:underline;color:#949494'>ARP Poisonning</a> </td> </tr> "; if($users->ETTERCAP_INSTALLED){ $arpoisonning=" <tr> <td width=1%><img src='img/arrow-right-24.png'></td> <td><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('arp.spoof.php?js=yes')\" style='font-size:16px;text-decoration:underline;'>ARP Poisoning</a> </td> </tr> "; } $recompile=" <tr> <td width=1%><img src='img/arrow-right-24.png'></td> <td><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.restart.php?firewall=yes')\" style='font-size:16px;text-decoration:underline;'>{reconfigure_transparent_rules}</a> </td> </tr> "; if($squid->hasProxyTransparent==1){ $wizard_transparent_link=button("{wizard_transparent_button}", "Loadjs('squid.transparent.wizard.php')",14); $wizard_transparent_link="<div style='text-align:right;margin-top:-70px;margin-bottom:50px'>$wizard_transparent_link</div>"; $seeiptables=" <tr> <td colspan=2> <table> <tr> <td width=1%><img src='img/arrow-right-24.png'></td> <td><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.transparent.iptables.php');\" style='font-size:16px;text-decoration:underline'>{display_fw_rules}</a> </td> </tr> $arpoisonning $recompile </table> </td> </tr> "; }else{ $wizard_transparent=button("{wizard_transparent_button}", "Loadjs('squid.transparent.wizard.php')",32); $wizard_transparent="<center style='margin:20px'>$wizard_transparent</center>"; } $field=Paragraphe_switch_img('{transparent_mode}','{transparent_mode_text}', 'squid_transparent',$squid->hasProxyTransparent,null,650); $field_tproxy=Paragraphe_switch_img('{use_tproxy_mode} - Beta Mode','{use_tproxy_mode_text}', 'UseTProxyMode',$UseTProxyMode,null,650); if($CONFIG_NETFILTER_TPROXY==0){ $field_tproxy=Paragraphe_switch_disable('{use_tproxy_mode} {disabled}','{use_tproxy_mode_text}<br>{use_tproxy_mode_text_disabled}', 'UseTProxyMode',0,null,650); } $field1=Paragraphe_switch_img('{SquidTransparentMixed}','{SquidTransparentMixed_text}', 'SquidTransparentMixed',$SquidTransparentMixed,null,650); if($users->APP_SQUID27_INSTALLED){ $EnableTransparent27=intval($sock->GET_INFO("EnableTransparent27")); $EnableTransparent27_field=" <tr> <td colspan=2>".Paragraphe_switch_img("{enable_nat_compatibility}", "{squid_enable_nat_compatibility_text}", "EnableTransparent27",$EnableTransparent27,null,700)."</td> </tr>"; }else{ $EnableTransparent27_field=" <tr> <td colspan=2>". Paragraphe_switch_disable("{enable_nat_compatibility}", "{squid_enable_nat_compatibility_text}", "EnableTransparent27",$EnableTransparent27,null,700)."</td> </tr>"; } $image="hotspot-howto.png"; if($EnableTransparent27==1){$image="squid-nat-howto.png";} $html=" <table style='width:100%'> <tr> <td valign=top width=1%><div id='squid-nat-status'></div></td> <td valign=top width=99%> <div id='squid_transparentdiv'></div> <div style='float:right'>". help_icon("{transparent_mode_limitations}")."</div> <div class=text-info style='font-size:18px'>{transparent_mode_explain}</div> <center><img src='img/$image' style='margin:5px'></center> <table style='width:99%' class=form> <tr> <td colspan=2>$wizard_transparent$field$wizard_transparent_link</td> </tr> <tr><td colspan=2>$field_tproxy</td></tr> <tr> <td class=legend style='font-size:26px' nowrap>{interface} (TProxy):</td> <td style='width:99%'>". Field_array_Hash($ETHZ,"SquidTProxyInterface",$SquidTProxyInterface,"style:font-size:26px")."</td> </tr> <tr><td colspan=2><p> </p></td></tr> $EnableTransparent27_field $seeiptables <tr> <td class=legend style='font-size:14px'>{KernelSendRedirects}:</td> <td>". Field_checkbox("KernelSendRedirects", 1,$KernelSendRedirects)."</td> <td>". help_icon("{KernelSendRedirects_explain}")."</td> </tr> <tr> <td class=legend style='font-size:14px'>{SquidClientDSTPassThru}:</td> <td>". Field_checkbox("SquidClientDSTPassThru", 1,$SquidClientDSTPassThru)."</td> <td>". help_icon("{SquidClientDSTPassThru_explain}")."</td> </tr> <tr> <td style='font-size:26px' class=legend>{http_port}:</td> <td><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.popups.php?script=listen_port')\" style='font-size:26px;font-weight:bold;text-decoration:underline'> $squid->listen_port</td> <td> </td> </tr> <tr> <td colspan=2 align='right'><hr>". button("{apply}","SaveTransparentProxy();",35)."</tD> </tr> </table> </div> </td> </tr> </table> <div style='text-align:right'>". imgtootltip("refresh-32.png","{refresh}","RefreshTab('squid_transparent_popup_tabs')")."</div> <script> var x_SaveTransparentProxy= function (obj) { var tempvalue=obj.responseText; if(tempvalue.length>3){alert(tempvalue)}; if(document.getElementById('main_squid_quicklinks_tabs')){RefreshTab('main_squid_quicklinks_tabs');} if(document.getElementById('listen_port_popup_tabs')){RefreshTab('listen_port_popup_tabs');} Loadjs('squid.restart.php?onlySquid=yes&ask=yes'); } function SaveTransparentProxy(){ var XHR = new XHRConnection(); var KernelSendRedirects=0; var SquidClientDSTPassThru=0; var EnableRemoteStatisticsAppliance=$EnableRemoteStatisticsAppliance; if(EnableRemoteStatisticsAppliance==1){Loadjs('$page?error-remote-appliance=yes');return;} XHR.appendData('squid_transparent',document.getElementById('squid_transparent').value); if(document.getElementById('SquidTransparentMixed')){ XHR.appendData('SquidTransparentMixed',document.getElementById('SquidTransparentMixed').value); } XHR.appendData('EnableTransparent27',document.getElementById('EnableTransparent27').value); XHR.appendData('SquidTProxyInterface',document.getElementById('SquidTProxyInterface').value); XHR.appendData('UseTProxyMode',document.getElementById('UseTProxyMode').value); if(document.getElementById('KernelSendRedirects').checked){KernelSendRedirects=1;} if(document.getElementById('SquidClientDSTPassThru').checked){SquidClientDSTPassThru=1;} XHR.appendData('KernelSendRedirects',KernelSendRedirects); XHR.appendData('SquidClientDSTPassThru',SquidClientDSTPassThru); XHR.sendAndLoad('$page', 'GET',x_SaveTransparentProxy); } LoadAjax('squid-nat-status','$page?squid-nat-status=yes',false); </script> "; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html,'squid.index.php'); }
function Networks() { $nics = new networking(); $array = $nics->Local_interfaces(); $array = DetectSubNics($array); while (list($nic, $null) = each($array)) { usleep(35000); $nics->ifconfig($nic); $res = $nics->GetNicInfos($nic); $array_returned[] = $res; } if ($GLOBALS["VERBOSE"]) { print_r($array_returned); } return base64_encode(serialize($array_returned)); }
function route_popup() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $btname = "{add}"; $zmd5 = $_GET["zmd5"]; $t = $_GET["t"]; $title = "{new_route}"; if ($zmd5 != null) { $btname = "{apply}"; $q = new mysql(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nic_routes WHERE zmd5='{$zmd5}'", "artica_backup")); if (!$q->ok) { echo $q->mysql_error_html(); } $title = $ligne["pattern"]; } $net = new networking(); $ETHs = $net->Local_interfaces(); unset($ETHs["lo"]); while (list($int, $none) = each($ETHs)) { $nic = new system_nic($int); $ETHZ[$int] = "{$int} - {$nic->NICNAME} - {$nic->IPADDR}"; } $types[1] = "{network_nic}"; $types[2] = "{host}"; if (!is_numeric($ligne["zOrder"])) { $ligne["zOrder"] = 0; } if (!is_numeric($ligne["metric"])) { $ligne["metric"] = 0; } $html = "\n\t\t<div style='font-size:24px;margin-bottom:20px'>{$ligne["pattern"]}</div>\n\t\t<div style='width:98%' class=form>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{nic}:</td>\n\t\t\t<td>" . Field_array_Hash($ETHZ, "nic-{$t}", $ligne["nic"], "style:font-size:24px") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{type}:</td>\n\t\t\t<td>" . Field_array_Hash($types, "type-{$t}", $ligne["type"], "style:font-size:24px") . "</td>\n\t\t</tr>\t\n\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{item} <span style='font-size:14px'>({address}/{network2})</span>:</td>\n\t\t\t<td>" . Field_text("pattern-{$t}", $ligne["pattern"], "font-size:24px;width:95%") . "</td>\n\t\t</tr>\n\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-{$t}", $ligne["gateway"], "font-size:24px;width:95%") . "</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{order}:</td>\n\t\t\t<td>" . Field_text("zOrder-{$t}", $ligne["zOrder"], "font-size:24px;width:90px") . "</td>\n\t\t</tr>\t\t\t\t\t\t\t\t\t\t\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-{$t}", $ligne["metric"], "font-size:24px;width:90px") . "</td>\n\t\t</tr>\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button($btname, "Save{$t}()", 32) . "</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tvar ID='{$zmd5}';\n\tif(results.length>5){alert(results);return;}\n\tif(ID.length==0){YahooWinHide();}\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('zmd5','{$zmd5}');\n\tXHR.appendData('zOrder',document.getElementById('zOrder-{$t}').value);\n\tXHR.appendData('type',document.getElementById('type-{$t}').value);\n\tXHR.appendData('pattern',document.getElementById('pattern-{$t}').value);\n\tXHR.appendData('gateway',document.getElementById('gateway-{$t}').value);\n\tXHR.appendData('metric',document.getElementById('metric-{$t}').value);\n\tXHR.appendData('nic',document.getElementById('nic-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n}\n\nfunction check{$t}(){\n\tvar ID='{$zmd5}';\n\tif(ID.length==0){return;}\n\tdocument.getElementById('pattern-{$t}').disabled=true;\n\tdocument.getElementById('gateway-{$t}').disabled=true;\n\tdocument.getElementById('nic-{$t}').disabled=true;\n}\ncheck{$t}();\n</script>\n\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function params() { $t = time(); $sock = new sockets(); $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); if ($SquidPerformance > 1) { echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{artica_statistics_disabled_see_performance}")); return; } $DisableArticaProxyStatistics = $sock->GET_INFO("DisableArticaProxyStatistics"); $EnableSquidRemoteMySQL = $sock->GET_INFO("EnableSquidRemoteMySQL"); $CleanArticaSquidDatabases = $sock->GET_INFO("CleanArticaSquidDatabases"); $EnableProxyLogHostnames = $sock->GET_INFO("EnableProxyLogHostnames"); $MacResolvInterface = $sock->GET_INFO("MacResolvInterface"); if (!is_numeric($EnableSquidRemoteMySQL)) { $EnableSquidRemoteMySQL = 0; } if (!is_numeric($DisableArticaProxyStatistics)) { $DisableArticaProxyStatistics = 0; } if (!is_numeric($CleanArticaSquidDatabases)) { $CleanArticaSquidDatabases = 0; } if (!is_numeric($EnableProxyLogHostnames)) { $EnableProxyLogHostnames = 0; } $net = new networking(); $interfaces = $net->Local_interfaces(); $array[null] = "{none}"; while (list($eth, $line) = each($interfaces)) { if ($eth == "lo") { continue; } $ip = new system_nic($eth); $array[$eth] = $ip->IPADDR . " (" . $ip->NICNAME . ")"; } $p = Paragraphe_switch_img("{DisableArticaProxyStatistics}", "{DisableArticaProxyStatistics_explain}", "DisableArticaProxyStatistics", $DisableArticaProxyStatistics, null, 600); $p1 = Paragraphe_switch_img("{CleanArticaSquidDatabases}", "{CleanArticaSquidDatabases_explain}", "CleanArticaSquidDatabases", $CleanArticaSquidDatabases, null, 600); $p2 = Paragraphe_switch_img("{EnableProxyLogHostnames}", "{EnableProxyLogHostnames_explain}", "EnableProxyLogHostnames", $EnableProxyLogHostnames, null, 600); if ($EnableSquidRemoteMySQL == 1) { $TuningParameters = unserialize(base64_decode($sock->GET_INFO("MySQLSyslogParams"))); $error = "<div style='font-size:16px' class=explain>{remote_mysqlsquidserver_text}<br><strong>mysql://{$TuningParameters["mysqlserver"]}:{$TuningParameters["RemotePort"]}</strong></div>"; $p = Paragraphe_switch_disable("{DisableArticaProxyStatistics}", "{DisableArticaProxyStatistics_explain}", null, 600) . "" . Field_hidden("DisableArticaProxyStatistics", 0); } $html = "\n\t<div id={$t}></div>\n\t<div style='width:98%' class=form>\n\t{$error}\n\t<table>\n\t<tr>\n\t\t<td colspan=3>{$p}</td>\n\t</tr>\n\t<tr><td colspan=3><hr></td></tr>\n\t<tr>\n\t\t<td colspan=3>{$p1}</td>\n\t</tr>\n\n\t\n\t<tr>\n\t\t<td colspan=3 align='right'>" . button("{apply}", "SaveStopArticaStats()", 16) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t<div style='width:98%' class=form>\n\t<table>\n\t<tr>\n\t\t<td colspan=3>{$p2}</td>\n\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:16px'>{mac_resolv_interface}:</td>\n\t\t<td>" . Field_array_Hash($array, "MacResolvInterface", $MacResolvInterface, null, null, 0, "font-size:16px") . "</td>\n\t\t<td width=1%>" . help_icon("{mac_resolv_interface_help}") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' colspan=3>" . button("{apply}", "SaveOptions{$t}()", 16) . "</td>\n\t</tr>\t\n\t</table>\n\t</div>\n\t<script>\n\tvar x_SaveStopArticaStats= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\tRefreshTab('artica_stats_tabs');\n\t\tCacheOff();\n\t\tConfigureYourserver();\n\t}\n\n\t\t\n\t\t\n\tfunction SaveStopArticaStats(){\n\t\t\tvar XHR = new XHRConnection();\t\n\t\t\tXHR.appendData('DisableArticaProxyStatistics',document.getElementById('DisableArticaProxyStatistics').value);\n\t\t\tXHR.appendData('CleanArticaSquidDatabases',document.getElementById('CleanArticaSquidDatabases').value);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveStopArticaStats);\n\t\t\t}\n\t\t\t\n\tvar xSaveOptions{$t}= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue)};\n\n\t}\t\t\t\n\t\t\t\n\tfunction SaveOptions{$t}(){\n\t\t\tvar XHR = new XHRConnection();\t\n\t\t\tXHR.appendData('EnableProxyLogHostnames',document.getElementById('EnableProxyLogHostnames').value);\n\t\t\tXHR.appendData('MacResolvInterface',document.getElementById('MacResolvInterface').value);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSaveOptions{$t});\n\t\t\t}\t\t\t\n\t\t\t\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function start() { include_once dirname(__FILE__) . "/ressources/class.system.network.inc"; $page = CurrentPageName(); $tpl = new templates(); $tpc = new networking(); $interfaces = $tpc->Local_interfaces(); unset($interfaces["lo"]); $html = "\n\t<div class=explain style='font-size:14px'>{welcome_new_instance_wizard_intro}</div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{Interface}:</td>\n\t\t<td>" . Field_array_Hash($interfaces, "WIZINTERFACE", $_SESSION["WIZINSTANCE"]["WIZINTERFACE"], "style:font-size:16px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'>" . button("{next}", "WIZ_WIZINTERFACE()", 16) . "</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t\n\t<script>\n\tvar XWIZ_WIZINTERFACE= function (obj) {\n\t var results=obj.responseText;\n\t if(results.length>3){alert(results);return;}\n\t \tWIZMULTI2();\n\t}\t\n\t\n\tfunction WIZ_WIZINTERFACE(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('WIZINTERFACE',document.getElementById('WIZINTERFACE').value);\n\t\tAnimateDiv('new_instance_wizard');\n\t\tXHR.sendAndLoad('{$page}', 'POST',XWIZ_WIZINTERFACE);\t\n\t}\n\t\n\t</script>\n\t\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function table(){ $tpl=new templates(); $page=CurrentPageName(); $sock=new sockets(); $net=new networking(); $interfaces=$net->Local_interfaces(); unset($interfaces["lo"]); if(count($interfaces)<2){ echo FATAL_ERROR_SHOW_128("{error_need_at_lease_2_pvinterfaces}"); return; } $network_bridges=$tpl->_ENGINE_parse_body("{network_bridges}"); $nic_from=$tpl->javascript_parse_text("{nic_from}"); $nic_to=$tpl->javascript_parse_text("{nic_to}"); $tcp_address=$tpl->_ENGINE_parse_body("{tcp_address}"); $netmask=$tpl->javascript_parse_text("{netmask}"); $to=$tpl->_ENGINE_parse_body("{to}"); $t=$_GET["t"]; if(!is_numeric($t)){$t=time();} $tablesize=868; $descriptionsize=705; $bts=array(); $add=$tpl->_ENGINE_parse_body("{new_network_bridge}"); $delete=$tpl->javascript_parse_text("{delete}"); $about=$tpl->javascript_parse_text("{about2}"); $reconstruct=$tpl->javascript_parse_text("{build_the_network}"); $bts[]="{name: '$add', bclass: 'add', onpress :RuleAdd$t},"; $bts[]="{name: '<strong>$reconstruct</strong>', bclass: 'apply', onpress : BuildVLANs$t},"; $bts[]="{name: '$about', bclass: 'help', onpress : About$t},"; $ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement"); if($DisableNetworksManagement==null){$DisableNetworksManagement=0;} if(count($bts)>0){ $buttons="buttons : [".@implode("\n", $bts)." ],"; } $reboot_network_explain=$tpl->javascript_parse_text("{bridges_iptables_explain}\n\n{reboot_network_explain}"); $html=" <table class='flexRT$t' style='display: none' id='flexRT$t' style='width:99%'></table> <script> var mm$t=0; $(document).ready(function(){ $('#flexRT$t').flexigrid({ url: '$page?rules-list=yes&t=$t', dataType: 'json', colModel : [ {display: 'ID', name : 'ID', width : 31, sortable : true, align: 'center'}, {display: '$nic_from', name : 'nic_from', width : 450, sortable : false, align: 'left'}, {display: ' ', name : 'none1', width : 50, sortable : false, align: 'center'}, {display: '$nic_to', name : 'nic_to', width : 450, sortable : false, align: 'left'}, {display: ' ', name : 'delete', width : 50, sortable : false, align: 'center'}, ],$buttons searchitems : [ {display: '$nic_from', name : 'nic_from'}, {display: '$nic_to', name : 'nic_to'}, ], sortname: 'ID', sortorder: 'desc', usepager: true, title: '<span style=font-size:22px>$network_bridges</span>', useRp: true, rp: 25, showTableToggleBtn: false, width: '99%', height: 400, singleSelect: true }); }); function RuleAdd$t(){ Loadjs('$page?network-bridge-js=yes&ID=0&t=$t',true); } function BuildVLANs$t(){ Loadjs('network.restart.php?t=$t'); } function About$t(){ alert('$reboot_network_explain'); } function EmptyTask$t(){ if(confirm('$empty::{$_GET["taskid"]}')){ } } var X_VLANDelete$t=function (obj) { var results=obj.responseText; if(results.length>0){alert(results);return;} $('#row'+mm$t).remove(); } function VLANDelete(id){ if(confirm('$delete '+id+'?')){ var DisableNetworksManagement=$DisableNetworksManagement; if(DisableNetworksManagement==1){alert('$ERROR_NO_PRIVS');return;} mm$t=id; var XHR = new XHRConnection(); XHR.appendData('vlan-del',id); XHR.sendAndLoad('$page', 'GET',X_VLANDelete$t); } } </script> "; echo $tpl->_ENGINE_parse_body($html); }
function Parameters() { $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); $LXCEnabled = $sock->GET_INFO("LXCEnabled"); $LXCInterface = $sock->GET_INFO("LXCInterface"); $LXCVpsDir = $sock->GET_INFO("LXCVpsDir"); if ($LXCVpsDir == null) { $LXCVpsDir = "/home/vps-servers"; } $tcp = new networking(); $Local_interfaces = $tcp->Local_interfaces(); unset($Local_interfaces["br5"]); unset($Local_interfaces["lo"]); if ($LXCInterface != null) { $Local_interfaces[$LXCInterface] = $LXCInterface; } $LXCEthLocked = $sock->GET_INFO("LXCEthLocked"); if (!is_numeric($LXCEthLocked)) { $LXCEthLocked = 0; } $button = button("{install}", "SaveLXCNet()"); if ($LXCEthLocked == 1) { $button = button("{uninstall}", "UnlinkLXCNet()"); } $LXC_NET_RESTART_ASK = $tpl->javascript_parse_text("{LXC_NET_RESTART_ASK}"); $lock_install = 0; $nicClass = new system_nic(); if ($nicClass->unconfigured) { $lock_install = 1; $error = "<div class=explain style='color:red'>{NIC_UNCONFIGURED_ERROR}</div>"; } $html = "\t\n{$error}\n<div style='text-align:right;width:100%'>" . imgtootltip("refresh-32.png", "{refresh}", "RefreshTab('main_config_vpssrv')") . "</div>\n<div style='font-size:16px'>{bridge_setup}</div>\n<div class=explain>{bridge_setup_lxc_explain}</div>\n<div id='lxcnets'>\n<table style='width:100%' class=form>\n\t<tr>\n\t\t<td class=legend>{local_interface_bridge}:</td>\n\t\t<td>" . Field_array_Hash($Local_interfaces, "LXCInterface", $LXCInterface, null, null, 0, "font-size:13px;padding:3px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'>{$button}</td>\n\t</tr>\n</table>\n\n<hr>\n\n<div id='lxcDirsDiv'>\n<table style='width:100%'>\n<tr>\n\t<td class=legend>{vps_directory}:</td>\n\t<td>" . Field_text("LXCVpsDir", $LXCVpsDir, "font-size:13px;padding:3px;width:210px") . "</td>\n</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'>" . button("{apply}", "SaveLXCDir()") . "</td>\n\t</tr>\n</table>\n</div>\n\n</div>\n<script>\nvar x_SaveLXCNet= function (obj) {\n\t\tvar results=trim(obj.responseText);\n\t\tif(results.length>0){alert(results);}\n\t\tRefreshTab('main_config_vpssrv');\n\t}\t\t\n\n\n\tfunction SaveLXCNet(){\n\t\tvar lock_install={$lock_install};\n\t\tif(lock_install==1){return;}\n\t\tif(confirm('{$LXC_NET_RESTART_ASK}')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('LXCEnabled','1');\n\t\t\tXHR.appendData('LXCInstall','1');\n\t\t\tXHR.appendData('LXCInterface',document.getElementById('LXCInterface').value);\n\t\t\tdocument.getElementById('lxcnets').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>'; \n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveLXCNet);\t\t\n\t\t}\n\t}\n\t\n\tfunction UnlinkLXCNet(){\n\t\tif(confirm('{$LXC_NET_RESTART_ASK}')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('LXCEnabled','0');\n\t\t\tXHR.appendData('LXCRemove','yes');\n\t\t\tdocument.getElementById('lxcnets').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>'; \n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveLXCNet);\t\n\t\t}\t\t\n\t}\n\t\n\tfunction CheckLXCNetForm(){\n\t\tvar LXCEthLocked={$LXCEthLocked};\n\t\tdocument.getElementById('LXCInterface').disabled=true;\n\t\tif(LXCEthLocked==0){\n\t\t\tdocument.getElementById('LXCInterface').disabled=false;\t\t\n\t\t}\n\t}\n\t\n\tfunction SaveLXCDir(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('LXCVpsDir',document.getElementById('LXCVpsDir').value);\n\t\tdocument.getElementById('lxcDirsDiv').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>'; \n\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveLXCNet);\t\t\n\t}\n\t\nCheckLXCNetForm();\n</script>\n\n"; echo $tpl->_ENGINE_parse_body($html); }
function ACTION_NETWORK() { $unix = new unix(); $clear = $unix->find_program("clear"); if (is_file($clear)) { system("{$clear}"); } $users = new usersMenus(); $q = new mysql(); if (!$q->BD_CONNECT(true)) { echo "There is an issue while connecting to MySQL\n{$q->mysql_error}\nPress Key to exit.\n"; $line = fgets(STDIN); return; } $DEFAULT = null; $net = new networking(); $interfaces = $net->Local_interfaces(); unset($interfaces["lo"]); if (isset($interfaces["eth0"])) { $DEFAULT = "eth0"; } while (list($num, $letter) = each($interfaces)) { $int[] = "\"{$num}\""; } if ($DEFAULT == null) { $DEFAULT = $int[0]; } $q->BuildTables(); echo "This wizard will help to configure network.\n"; echo "Press q letter to exit or any key to continue:"; $answer = trim(strtolower(fgets(STDIN))); if ($answer == "q") { return; } if (is_file($clear)) { system("{$clear}"); } echo "Give here the interface name of the network interface\n"; echo "you need to setup.\n\n"; echo "Should be one of :" . @implode(", ", $int) . "\n"; echo "Default: [{$DEFAULT}]\n"; $NIC = trim(strtolower(fgets(STDIN))); if ($NIC == null) { $NIC = $DEFAULT; } if (!preg_match("#([a-z])([0-9+)\$#", $NIC)) { $NIC = $DEFAULT; } $ETH_IP = trim(ASK_ETH_IP($NIC)); $GATEWAY = trim(ASK_GATEWAY($NIC)); $NETMASK = trim(ASK_NETMASK($NIC)); $DNS = trim(ASK_DNS1($NIC)); if (is_file($clear)) { system("{$clear}"); } echo "Your Settings:\n"; echo "Interface.........: \"{$NIC}\"\n"; echo "IP address........: \"{$ETH_IP}\"\n"; echo "Gateway...........: \"{$GATEWAY}\"\n"; echo "Netmask...........: \"{$NETMASK}\"\n"; echo "DNS server 1......: \"{$DNS}\"\n"; echo "\n"; //ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null); echo "If your are agree with these settings\n"; echo "Press any key to apply settings or press \"q\" to return to menu.\n"; $answer = trim(strtolower(fgets(STDIN))); if ($answer == "q") { return; } echo "5%] Please Wait, saving configuration...\n"; $nics = new system_nic($NIC); $nics->eth = $NIC; $nics->IPADDR = $ETH_IP; $nics->NETMASK = $NETMASK; $nics->GATEWAY = $GATEWAY; $nics->DNS1 = $DNS; $nics->dhcp = 0; $nics->metric = 1; $nics->defaultroute = 1; $nics->enabled = 1; echo "7%] Please Wait, saving Networks parameters to MySQL DB...\n"; if (!$nics->SaveNic()) { echo "There is an issue while saving your settings\n"; echo "Press any key to exit.\n"; $answer = trim(strtolower(fgets(STDIN))); return; } echo "10%] Please Wait, building configuration....\n"; $php = $unix->LOCATE_PHP5_BIN(); $nohup = $unix->find_program("nohup"); $php5 = $php; shell_exec2("{$php5} " . dirname(__FILE__) . " /exec.virtuals-ip.php --build --force >/dev/null 2>&1"); echo "20%] Please Wait, apply network configuration....\n"; shell_exec2("{$php5} /usr/share/artica-postfix/exec.initslapd.php"); shell_exec2("/etc/init.d/artica-ifup start"); echo "30%] Please Wait, restarting services....\n"; $unix->THREAD_COMMAND_SET("{$php5} /usr/share/artica-postfix/exec.postfix.maincf.php --reconfigure"); $unix->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --reconfigure-cyrus"); shell_exec2("{$nohup} /etc/init.d/artica-status reload >/dev/null 2>&1 &"); shell_exec2("{$nohup} /etc/init.d/nginx restart >/dev/null 2>&1 &"); shell_exec2("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &"); echo "30%] Please Wait, Changing IP address to {$NIC}....\n"; $ifconfig = $unix->find_program("ifconfig"); shell_exec2("{$ifconfig} {$NIC} down"); shell_exec2("{$ifconfig} {$NIC} {$ETH_IP} netmask {$NETMASK} up"); shell_exec2("/bin/ip route add 127.0.0.1 dev lo"); if ($GATEWAY != "0.0.0.0") { echo "31%] Please Wait, Define default gateway to {$GATEWAY}....\n"; shell_exec2("/sbin/route add {$GATEWAY} dev {$NIC}"); $route = $unix->find_program("route"); shell_exec("{$route} add -net 0.0.0.0 gw {$GATEWAY} dev {$NIC} metric 1"); } echo "80%] Please Wait, Changing DNS to {$DNS}....\n"; echo "81%] Please Wait, Loading DNS library\n"; $GLOBALS["PROGRESS"] = true; $resolv = new resolv_conf(); echo "92%] Set DNS1 to {$DNS}\n"; $resolv->MainArray["DNS1"] = $DNS; $resolv->output = true; echo "93%] Saving config\n"; $resolvDatas = $resolv->build(); echo "94%] Saving /etc/resolv.conf\n"; @file_put_contents("/etc/resolv.conf", $resolvDatas); echo "95%] Restarting Web Console\n"; shell_exec2("{$nohup} /etc/init.d/artica-webconsole restart"); echo "100%] Configuration done.\n"; echo "Press any key to return to menu."; $answer = trim(strtolower(fgets(STDIN))); MAIN_MENU(); }
function item_popup2() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql_squid_builder(); $button = "{add}"; $ID = $_GET["ID"]; if ($ID > 0) { $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM transparent_networks WHERE ID='{$ID}'")); $button = "{apply}"; } if (!is_numeric($ligne["transparent"])) { $ligne["transparent"] = 1; } if (!is_numeric($ligne["enabled"])) { $ligne["enabled"] = 1; } if (!is_numeric($ligne["destination_port"])) { $ligne["destination_port"] = 80; } if (!is_numeric($ligne["zOrder"])) { $ligne["zOrder"] = 0; } $nics = new networking(); $Z = $nics->Local_interfaces(true); unset($Z["lo"]); $ETHZ[null] = "{all}"; while (list($int, $none) = each($Z)) { $nic = new system_nic($int); $ETHZ[$int] = "{$int} - {$nic->NICNAME} - {$nic->IPADDR}"; } $t = time(); $html = "<div class=form style='width:95%'>\n\t<div class=explain style='font-size:14.5px'>{transparent_pattern_explain}</div>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{interface}:</td>\n\t\t<td>" . Field_array_Hash($ETHZ, "eth-{$t}", $ligne["eth"], "style:font-size:18px") . "</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{source}:</td>\n\t\t<td>" . Field_text("pattern-{$t}", $ligne["pattern"], "font-size:18px;font-weight:bold;width:300px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{inverse}:</td>\n\t\t<td>" . Field_checkbox("isnot-{$t}", 1, $ligne["isnot"]) . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{destination}:</td>\n\t\t<td>" . Field_text("destination-{$t}", $ligne["destination"], "font-size:18px;font-weight:bold;width:300px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{destination_port}:</td>\n\t\t<td>" . Field_text("destination_port-{$t}", $ligne["destination_port"], "font-size:18px;font-weight:bold;width:90px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{remote_proxy_server}:</td>\n\t\t<td>" . Field_text("remote_proxy-{$t}", $ligne["remote_proxy"], "font-size:18px;font-weight:bold;width:300px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{transparent}:</td>\n\t\t<td>" . Field_checkbox("transparent-{$t}", 1, $ligne["transparent"]) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{deny}:</td>\n\t\t<td>" . Field_checkbox("block-{$t}", 1, $ligne["block"], "ChkDeny{$t}()") . "</td>\n\t</tr>\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{UseSSL}:</td>\n\t\t<td>" . Field_checkbox("ssl-{$t}", 1, $ligne["ssl"]) . "</td>\n\t</tr>\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{enabled}:</td>\n\t\t<td>" . Field_checkbox("enabled-{$t}", 1, $ligne["enabled"], "ChkEna{$t}()") . "</td>\n\t</tr>\t\n<tr>\n\t<td colspan=2 align='right'><hr>" . button($button, "Save{$t}();", 22) . "</td>\n</tr>\n\t\t\t\t\n\t</table></div>\t\n<script>\nvar xSave{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);}\n\tvar ID='{$ID}';\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n\t\$('#flexRT{$_GET["tt"]}').flexReload();\n\tif(document.getElementById('flexRT-refresh-1')){ \$('#'+document.getElementById('flexRT-refresh-1').value).flexReload();}\n\tExecuteByClassName('SearchFunction');\n\tif(ID==0){YahooWin3Hide();}\n}\n\nfunction SaveCHK{$t}(e){\n\tif(!checkEnter(e)){return;}\n\tSave{$t}();\n}\n\nfunction ChkDeny{$t}(){\n\t\n\tif(document.getElementById('block-{$t}').checked){\n\t\tdocument.getElementById('transparent-{$t}').disabled=true;\n\t}else{\n\t\tdocument.getElementById('transparent-{$t}').disabled=false;\n\t}\n\n}\nfunction ChkEna{$t}(){\n\t\n\tif(!document.getElementById('enabled-{$t}').checked){\n\t\tdocument.getElementById('transparent-{$t}').disabled=true;\n\t\tdocument.getElementById('block-{$t}').disabled=true;\n\t\tdocument.getElementById('pattern-{$t}').disabled=true;\n\t\tdocument.getElementById('destination_port-{$t}').disabled=true;\n\t\tdocument.getElementById('remote_proxy-{$t}').disabled=true;\n\t\tdocument.getElementById('ssl-{$t}').disabled=true;\n\t\tdocument.getElementById('eth-{$t}').disabled=true;\n\t\tdocument.getElementById('isnot-{$t}').disabled=true;\n\t\tdocument.getElementById('destination-{$t}').disabled=true;\n\t}else{\n\t\tdocument.getElementById('transparent-{$t}').disabled=false;\n\t\tdocument.getElementById('block-{$t}').disabled=false;\n\t\tdocument.getElementById('pattern-{$t}').disabled=false;\n\t\tdocument.getElementById('destination_port-{$t}').disabled=false;\n\t\tdocument.getElementById('remote_proxy-{$t}').disabled=false;\n\t\tdocument.getElementById('ssl-{$t}').disabled=false;\n\t\tdocument.getElementById('eth-{$t}').disabled=false;\n\t\tdocument.getElementById('isnot-{$t}').disabled=false;\n\t\tdocument.getElementById('destination-{$t}').disabled=false;\n\t\t\n\t\t\n\t\t\n\t}\n\n}\t\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID', '{$ID}');\n\tXHR.appendData('pattern', document.getElementById('pattern-{$t}').value);\n\tXHR.appendData('destination', document.getElementById('destination-{$t}').value);\n\tXHR.appendData('eth', document.getElementById('eth-{$t}').value);\n\tXHR.appendData('destination_port', document.getElementById('destination_port-{$t}').value);\n\tXHR.appendData('remote_proxy', document.getElementById('remote_proxy-{$t}').value);\n\tif(document.getElementById('enabled-{$t}').checked){ XHR.appendData('enabled', 1); }else{ XHR.appendData('enabled', 0); }\n\tif(document.getElementById('transparent-{$t}').checked){ XHR.appendData('transparent', 1); }else{ XHR.appendData('transparent', 0); }\n\tif(document.getElementById('ssl-{$t}').checked){ XHR.appendData('ssl', 1); }else{ XHR.appendData('ssl', 0); }\t\n\tif(document.getElementById('block-{$t}').checked){ XHR.appendData('block', 1); }else{ XHR.appendData('block', 0); }\n\tif(document.getElementById('isnot-{$t}').checked){ XHR.appendData('isnot', 1); }else{ XHR.appendData('isnot', 0); }\n\t\n\t\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n\nChkDeny{$t}();\nChkEna{$t}();\n</script>\t"; echo $tpl->_ENGINE_parse_body($html); }
function rule_popup(){ $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $eth=$_GET["eth"]; $ethC=new system_nic($eth); $table=$_GET["table"]; $ID=$_GET["ID"]; $t=time(); $title="$eth::".$tpl->_ENGINE_parse_body("{new_rule}"); $bt="{add}"; $enabled=1; $LOCKFORWARD=1; $HIDEFORMARK=0; $EnableL7Filter=intval($sock->GET_INFO("EnableL7Filter")); $EnableQOS=intval($sock->GET_INFO("EnableQOS")); if($ID>0){ $q=new mysql(); $ligne=mysql_fetch_array($q->QUERY_SQL("SELECT * FROM iptables_main WHERE ID='$ID'","artica_backup")); $title="$eth::".$tpl->javascript_parse_text($ligne["rulename"]); $enabled=$ligne["enabled"]; $table=$ligne["MOD"]; $eth=$ligne["eth"]; $bt="{apply}"; $jlog=$ligne["jlog"]; } $L7Mark=intval($ligne["L7Mark"]); if($EnableL7Filter==1){ $q=new mysql(); $L7Filters[0]="{select}"; $sql="SELECT ID,keyitem FROM `l7filters_items` WHERE enabled=1"; $resultsL7Filter = $q->QUERY_SQL($sql,"artica_backup"); while ($ligneL7Filter = mysql_fetch_assoc($resultsL7Filter)) { $L7Filters[$ligneL7Filter["ID"]]=strtoupper($ligneL7Filter["keyitem"]); $L7Field="<tr><td colspan=3><div style='height:30px'> </div></td></tr> <tr> <td class=legend style='font-size:22px' nowrap>{applications}:</td> <td colspan=2>". Field_array_Hash($L7Filters,"L7Mark-$t",$L7Mark,"style:font-size:22px")."</td> </tr> "; } } $nic=new networking(); $nicZ=$nic->Local_interfaces(); unset($nicZ[$eth]); $ForwardNICs[null]="{none}"; while (list ($yinter, $line) = each ($nicZ) ){ $znic=new system_nic($yinter); if($znic->Bridged==1){continue;} $ForwardNICs[$yinter]="$yinter - $znic->NICNAME"; } $FORWARD_NIC="<tr> <td class=legend style='font-size:22px' nowrap>{output_interface}:</td> <td>". Field_array_Hash($ForwardNICs,"ForwardNIC-$t",$ligne["ForwardNIC"],"style:font-size:22px")."</td> <td width=1%> </td> </tr>"; if($table=="FORWARD"){$LOCKFORWARD=0;} $rulename=$ligne["rulename"]; $proto=$ligne["proto"]; $accepttype=$ligne["accepttype"]; $source_group=intval($ligne["source_group"]); $dest_group=intval($ligne["dest_group"]); $destport_group=intval($ligne["destport_group"]); if($proto==null){$proto="tcp";} $protos[null]="{all}"; $protos["udp"]="UDP"; $protos["tcp"]="tcp"; $accepttypes["ACCEPT"]="{accept}"; $accepttypes["DROP"]="{drop}"; $accepttypes["RETURN"]="{return}"; $accepttypes["LOG"]="{log_only}"; if($table=="MARK"){ $LOCKFORWARD=1; $HIDEFORMARK=1; $accepttypes=array(); $accepttypes["MARK"]="{MARK}"; if($EnableQOS==1){$containers=containers_from_eth($eth);} $MARK_SECTION=" <table> <tr><td colspan=3> </td></tr> <tr> <td class=legend style='font-size:22px' nowrap>{Q.O.S} {containers}:</td> <td>". Field_array_Hash($containers,"QOS-$t",$ligne ["QOS"],"style:font-size:22px")."</td> <td width=1%> </td> </tr> <tr> <td class=legend style='font-size:22px' nowrap>{or} {MARK_ITEM}:</td> <td>". Field_text("MARK-$t",$ligne["MARK"],"font-size:22px;width:90px")."</td> <td width=1%> </td> </tr>$FORWARD_NIC </table> "; $FORWARD_NIC=null; } $AllSystems=$tpl->javascript_parse_text("{AllSystems}"); $AllPorts=$tpl->javascript_parse_text("{AllPorts}"); if($source_group==0){ $inbound_object=$AllSystems; } if($dest_group==0){ $outbound_object=$AllSystems; } if($destport_group==0){ $destports_object=$AllPorts; } if(!is_numeric($ligne["zOrder"])){$ligne["zOrder"]=1;} if(!is_numeric($ligne["masquerade"])){$ligne["masquerade"]=1;} $jsGroup1="squid.BrowseAclGroups.php?callback=LinkInBoundGroup$t&FilterType=FW-IN"; $jsGroup2="squid.BrowseAclGroups.php?callback=LinkOutbBoundGroup$t&FilterType=FW-OUT"; $jsGroup3="squid.BrowseAclGroups.php?callback=LinkPortGroup$t&FilterType=FW-PORT"; $sDel1=imgtootltip("22-delete.png","{unlink}","Delgroup1$t()"); $sDel2=imgtootltip("22-delete.png","{unlink}","Delgroup2$t()"); $sDel3=imgtootltip("22-delete.png","{unlink}","Delgroup3$t()"); $html=" <div style='width:98%' class=form> ". Field_hidden("source_group-$t", $ligne["source_group"])." ". Field_hidden("dest_group-$t", $ligne["dest_group"])." ". Field_hidden("destport_group-$t", $ligne["destport_group"])." <div style='font-size:26px;margin-bottom:25px;margin-top:10px;margin-left:5px'>[$table] $title</div> <table style='width:100%'> <tr> <td class=legend style='font-size:22px' nowrap>{rulename}:</td> <td>". Field_text("rulename-$t",$rulename,"font-size:22px;width:450px")."</td> <td width=1%> </td> </tr> <tr> <td class=legend style='font-size:22px' nowrap>{order}:</td> <td>". Field_text("zOrder-$t",$ligne["zOrder"],"font-size:22px;width:90px")."</td> <td width=1%> </td> </tr> <tr> <td class=legend style='font-size:22px' nowrap>{enabled}:</td> <td>". Field_checkbox("enabled-$t", 1,$enabled)."</td> <td width=1%> </td> </tr> <tr> <td class=legend style='font-size:22px' nowrap><span id='OverideNet-label-$t'>{OverideNet}:</span></td> <td><span id='OverideNet-field-$t'>". Field_checkbox("OverideNet-$t", 1,$ligne["OverideNet"])."</span></td> <td width=1%><span id='OverideNet-explain-$t'>". help_icon("{OverideNet_explain}")."</span></td> </tr> <tr> <td class=legend style='font-size:22px' nowrap>{log_all_events}:</td> <td>". Field_checkbox("jlog-$t", 1,$jlog)."</td> <td width=1%> </td> </tr> <tr> <td class=legend style='font-size:22px' nowrap>{protocol}:</td> <td>". Field_array_Hash($protos,"proto-$t",$proto,"style:font-size:22px")."</td> <td width=1%> </td> </tr> <tr><td colspan=3> <center style='width:90%;margin:20px;border:1px solid #DDDDDD;border-radius:4px 4px 4px 4px'> <table > <tr><td colspan=4> </td></tr> <tr> <td width=42% align='center' style='font-size:22px;font-weight:bold;'>{inbound_object}</td> <td width=5% align='center'> </td> <td width=42% align='center' style='font-size:22px;font-weight:bold'>{outbound_object}</td> </tr> <tr><td colspan=4> </td></tr> <tr> <td width=42% align='center'><a href=\"javascript:Loadjs('$jsGroup1');\" style='font-size:22px;text-decoration:underline'> <span id='in-$t'>$inbound_object</span></a>$sDel1</td> <td width=5% align='center'><img src='img/arrow-blue-left-64.png'></td> <td width=42% align='center'><a href=\"javascript:Loadjs('$jsGroup2');\" style='font-size:22px;text-decoration:underline'> <span id='out-$t'>$outbound_object</span></a>$sDel2</td> </tr> <tr><td colspan=4> </td></tr> </table> </center> </td> </tr> <tr> <td class=legend style='font-size:22px' nowrap>{dest_ports}:</td> <td><a href=\"javascript:Loadjs('$jsGroup3');\" style='font-size:22px;text-decoration:underline'> <span id='port-$t'>$destports_object</span></a><div style='float:left;margin-right:5px'>$sDel3</div></td> <td width=1%> </td> </tr> $L7Field <tr><td colspan=3><div style='height:30px'> </div></td></tr> <tr> <td class=legend style='font-size:26px' nowrap>{action}:</td> <td colspan=2>". Field_array_Hash($accepttypes,"accepttype-$t",$accepttype,"style:font-size:26px;padding:5px;width:250px;")."</td> </tr> <tr> <td colspan=3> <center style='width:90%;margin:20px;border:1px solid #DDDDDD;border-radius:4px 4px 4px 4px'> $MARK_SECTION <table id='FORWARD-$t'> <tr><td colspan=3> </td></tr> $FORWARD_NIC <tr> <td class=legend style='font-size:22px' nowrap>{forward_to}:</td> <td>". Field_text("ForwardTo-$t",$ligne["ForwardTo"],"font-size:22px;width:450px")."</td> <td width=1%>". help_icon("{forward_to_iptables_explain}")."</td> </tr> <tr> <td class=legend style='font-size:22px' nowrap colspan=2>{rewrite_source_address}:</td> <td>". Field_checkbox("masquerade-$t",1,$ligne["masquerade"])."</td> </tr> <tr><td colspan=3> </td></tr> </table> </center> </td> </tr> <tr> <td colspan=3 align='right'><hr>". button($bt,"Save$t()",30)."</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'); if(ID==0){YahooWinHide();} } function SaveCHK$t(e){ if(!checkEnter(e)){return;} Save$t(); } function LinkInBoundGroup$t(ID){ var RID=$ID; document.getElementById('source_group-$t').value=ID; LoadAjaxTiny('in-$t','$page?groupname=yes&gpid='+ID); if(RID>0){Save$t();} } function LinkOutbBoundGroup$t(ID){ var RID=$ID; document.getElementById('dest_group-$t').value=ID; LoadAjaxTiny('out-$t','$page?groupname=yes&gpid='+ID); if(RID>0){Save$t();} } function LinkPortGroup$t(ID){ var RID=$ID; document.getElementById('destport_group-$t').value=ID; LoadAjaxTiny('port-$t','$page?groupname=yes&gpid='+ID); if(RID>0){Save$t();} } function Delgroup1$t(){ var RID=$ID; document.getElementById('source_group-$t').value=0; document.getElementById('in-$t').innerHTML='$AllSystems'; if(RID>0){Save$t();} } function Delgroup2$t(){ var RID=$ID; document.getElementById('dest_group-$t').value=0; document.getElementById('out-$t').innerHTML='$AllSystems'; if(RID>0){Save$t();} } function Delgroup3$t(){ var RID=$ID; document.getElementById('destport_group-$t').value=0; document.getElementById('port-$t').innerHTML='$AllSystems'; if(RID>0){Save$t();} } function Save$t(){ var XHR = new XHRConnection(); XHR.appendData('rule-save', '$ID'); XHR.appendData('rulename', encodeURIComponent(document.getElementById('rulename-$t').value)); XHR.appendData('proto', document.getElementById('proto-$t').value); XHR.appendData('accepttype', document.getElementById('accepttype-$t').value); XHR.appendData('table', '$table'); XHR.appendData('interface', '$eth'); if(document.getElementById('enabled-$t').checked){ XHR.appendData('enabled',1); }else{ XHR.appendData('enabled',0); } if(document.getElementById('OverideNet-$t').checked){ XHR.appendData('OverideNet',1); }else{ XHR.appendData('OverideNet',0); } if(document.getElementById('jlog-$t').checked){ XHR.appendData('jlog',1); }else{ XHR.appendData('jlog',0); } XHR.appendData('source_group', document.getElementById('source_group-$t').value); XHR.appendData('dest_group', document.getElementById('dest_group-$t').value); XHR.appendData('destport_group', document.getElementById('destport_group-$t').value); XHR.appendData('zOrder', document.getElementById('zOrder-$t').value); XHR.appendData('ForwardTo', document.getElementById('ForwardTo-$t').value); XHR.appendData('ForwardNIC', document.getElementById('ForwardNIC-$t').value); XHR.appendData('masquerade', document.getElementById('masquerade-$t').value); if(document.getElementById('QOS-$t') ){ XHR.appendData('QOS', document.getElementById('QOS-$t').value); } if(document.getElementById('MARK-$t') ){ XHR.appendData('MARK', document.getElementById('MARK-$t').value); } if(document.getElementById('L7Mark-$t') ){ XHR.appendData('L7Mark', document.getElementById('L7Mark-$t').value); } XHR.sendAndLoad('$page', 'POST',xSave$t); } function Dyn$t(){ var RID=$ID; var LOCKFORWARD=$LOCKFORWARD; var HIDEFORMARK=$HIDEFORMARK; var source_group=$source_group; var dest_group={$dest_group}; var destport_group=$destport_group; if(LOCKFORWARD==1){ document.getElementById('ForwardNIC-$t').disabled=true; document.getElementById('ForwardTo-$t').disabled=true; document.getElementById('FORWARD-$t').style.visibility='hidden'; } if(HIDEFORMARK==1){ document.getElementById('OverideNet-label-$t').style.visibility='hidden'; document.getElementById('OverideNet-field-$t').style.visibility='hidden'; document.getElementById('OverideNet-explain-$t').style.visibility='hidden'; document.getElementById('ForwardNIC-$t').disabled=false; } if(RID==0){return;} if(source_group>0){ LoadAjaxTiny('in-$t','$page?groupname=yes&gpid='+source_group); } if(dest_group>0){ LoadAjaxTiny('out-$t','$page?groupname=yes&gpid='+dest_group); } if(destport_group>0){ LoadAjaxTiny('port-$t','$page?groupname=yes&gpid='+destport_group); } } Dyn$t(); </script>"; echo $tpl->_ENGINE_parse_body($html); }
function network_bridge_associates_popup(){ $page=CurrentPageName(); $tpl=new templates(); $net=new networking(); $interfaces=$net->Local_interfaces(); $ID=$_GET["ID"]; $t=time(); $q=new mysql(); $ligne=mysql_fetch_array($q->QUERY_SQL("SELECT name FROM nics_bridge WHERE ID='$ID'","artica_backup")); $title=$tpl->javascript_parse_text("{associate_interface} {$ligne["name"]}"); unset($interfaces["lo"]); $t=$_GET["t"]; while (list ($eth, $none) = each ($interfaces) ){ $nic=new system_nic($eth); if($nic->Bridged==0){ if($nic->BridgedTo==null){ $array[$eth]="$eth $nic->IPADDR - $nic->NICNAME"; $array2[$eth]="$eth $nic->IPADDR - $nic->NICNAME"; } } } $associate_interface_explain=$tpl->_ENGINE_parse_body("{associate_interface_explain}"); $associate_interface_explain=str_replace("%s", $ligne["name"], $associate_interface_explain); $html=" <div style='font-size:32px;margin-bottom:20px'>$title</div> <div class=text-info style='font-size:16px'>$associate_interface_explain</div> <div style='width:98%' class=form> <table style='width:100%'> <tr> <td class=legend style='font-size:18px' nowrap>{nic}:</td> <td>". Field_array_Hash($array, "associates-$t",null,"style:font-size:22px")."</td> </tr> <tr> <td colspan=2 align='right'><hr>". button("{add}","Save$t();","24")."</td> </tr> </table> <script> var xSave$t= function (obj) { var ID='$ID'; var res=obj.responseText; if(res.length>3){alert(res);return;} $('#flexRT{$_GET["t"]}').flexReload(); ExecuteByClassName('SearchFunction'); YahooWin2Hide(); } function Save$t(){ var XHR = new XHRConnection(); XHR.appendData('associates', '$ID'); XHR.appendData('ID', '$ID'); XHR.appendData('eth', document.getElementById('associates-$t').value); XHR.sendAndLoad('$page', 'POST',xSave$t); } </script> "; echo $tpl->_ENGINE_parse_body($html); }
function settings_ad() { $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $sock = new sockets(); $t = time(); $hostname = $sock->getFrameWork("cmd.php?full-hostname=yes"); if (strpos($hostname, ".") > 0) { $tre = explode(".", $hostname); $hostname = $tre[0]; } if (strlen($hostname) > 15) { $hostname_exceed_15 = $tpl->_ENGINE_parse_body("{hostname_exceed_15}"); $hostname_exceed_15 = str_replace("%s", "{$hostname}", $hostname_exceed_15); echo FATAL_ERROR_SHOW_128("{$hostname_exceed_15}\n\t\t\t\t<center style='margin:20px'>" . button("{change_hostname}", "Loadjs('system.nic.config.php?change-hostname-js=yes');", 32) . "</center>\n\t\t\t\t\n\t\t\t\t"); return; } $severtype["WIN_2003"] = "Windows 2000/2003"; $severtype["WIN_2008AES"] = "Windows 2008/2012"; if (isset($_GET["switch-template"])) { $_GET["switch-template"] = null; } $samba_version = $sock->getFrameWork("samba.php?fullversion=yes"); $ldap_parameters = $tpl->_ENGINE_parse_body("{ldap_parameters2}"); $about_this_section = $tpl->_ENGINE_parse_body("{about_this_section}"); $schedule_parameters = $tpl->javascript_parse_text("{schedule_parameters}"); $disconnect = $tpl->_ENGINE_parse_body("{disconnect}"); $samba36 = 0; if (preg_match("#^3\\.6\\.#", $samba_version)) { $samba36 = 1; } $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos"))); $configADSamba = unserialize(base64_decode($sock->GET_INFO("SambaAdInfos"))); $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth"); $ActiveDirectoryEmergency = intval($sock->GET_INFO("ActiveDirectoryEmergency")); $LockKerberosAuthentication = $sock->GET_INFO("LockKerberosAuthentication"); $KerbAuthDisableGroupListing = $sock->GET_INFO("KerbAuthDisableGroupListing"); $KerbAuthDisableNormalizeName = $sock->GET_INFO("KerbAuthDisableNormalizeName"); $KerbAuthMapUntrustedDomain = $sock->GET_INFO("KerbAuthMapUntrustedDomain"); $SquidNTLMKeepAlive = $sock->GET_INFO("SquidNTLMKeepAlive"); $UseADAsNameServer = $sock->GET_INFO("UseADAsNameServer"); $WindowsActiveDirectoryKerberos = intval($sock->GET_INFO("WindowsActiveDirectoryKerberos")); $ActiveDirectorySquidHTTPHostname = $sock->GET_INFO("ActiveDirectorySquidHTTPHostname"); $KerbAuthMethod = $sock->GET_INFO("KerbAuthMethod"); $NtpdateAD = intval($sock->GET_INFO("NtpdateAD")); $arrayAuth[0] = "{all_methods}"; $arrayAuth[1] = "{only_ntlm}"; $arrayAuth[2] = "{only_basic_authentication}"; $arrayAuth[3] = "{only_Kerberos}"; $NTPDATE_INSTALLED = 0; if ($users->NTPDATE) { $NTPDATE_INSTALLED = 1; } $KerbAuthTrusted = $sock->GET_INFO("KerbAuthTrusted"); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); $DisableSpecialCharacters = $sock->GET_INFO("DisableSpecialCharacters"); if (!is_numeric($DisableSpecialCharacters)) { $DisableSpecialCharacters = 0; } if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if ($users->WEBSTATS_APPLIANCE) { $EnableWebProxyStatsAppliance = 1; } if (!is_numeric($KerbAuthMethod)) { $KerbAuthMethod = 0; } if (!is_numeric($KerbAuthTrusted)) { $KerbAuthTrusted = 1; } if (!is_numeric($KerbAuthDisableGroupListing)) { $KerbAuthDisableGroupListing = 0; } if (!is_numeric($KerbAuthDisableNormalizeName)) { $KerbAuthDisableNormalizeName = 1; } if (!is_numeric($KerbAuthMapUntrustedDomain)) { $KerbAuthMapUntrustedDomain = 1; } if (!is_numeric($SquidNTLMKeepAlive)) { $SquidNTLMKeepAlive = 1; } if (!is_numeric($UseADAsNameServer)) { $UseADAsNameServer = 0; } $SambaBindInterface = $sock->GET_INFO("SambaBindInterface"); $net = new networking(); $nics = $net->Local_interfaces(); while (list($interface, $val) = each($nics)) { $ni = new system_nic($interface); if ($ni->NICNAME != null) { $nics[$interface] = "[{$interface}] {$ni->NICNAME} - {$ni->netzone}"; } } $nics[null] = "{all}"; reset($nics); //interfaces = eth0 lo //bind interfaces only = yes if (!is_numeric("{$EnableKerbAuth}")) { $EnableKerbAuth = 0; } if (!is_numeric("{$LockKerberosAuthentication}")) { $LockKerberosAuthentication = 1; } if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } $samba_installed = 1; if (!$users->SAMBA_INSTALLED) { $samba_installed = 0; } if (!isset($array["SAMBA_BACKEND"])) { $array["SAMBA_BACKEND"] = "tdb"; } if (!isset($array["COMPUTER_BRANCH"])) { $array["COMPUTER_BRANCH"] = "CN=Computers"; } if ($array["COMPUTER_BRANCH"] == null) { $array["COMPUTER_BRANCH"] = "CN=Computers"; } if ($samba36 == 1) { $arrayBCK["autorid"] = "autorid"; } $arrayBCK["ad"] = "ad"; $arrayBCK["rid"] = "rid"; $arrayBCK["tdb"] = "tdb"; $char_alert_error = $tpl->javascript_parse_text("{char_alert_error}"); $no_sense_kerb_KerbAuthMethod = $tpl->javascript_parse_text("{no_sense_kerb_KerbAuthMethod}"); if ($samba_installed == 0) { echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{samba_is_not_installed}")); return; } $Myhostname = strtolower($sock->getFrameWork("cmd.php?full-hostname=yes")); $error_dom1 = $tpl->javascript_parse_text("{error}: {WINDOWS_DNS_SUFFIX}"); $error_dom2 = $tpl->javascript_parse_text("{is_not_a_part_of}"); $error_dom3 = $tpl->javascript_parse_text("{ask_change_hostname}"); $do_want_to_perform_connection_to_ad = $tpl->javascript_parse_text("{do_want_to_perform_connection_to_ad}"); $t_tmp = time(); $evaluation_period_days = evaluation_period_days(); if ($EnableKerbAuth == 0) { $button_wizard = "<div style='margin-top:20px;margin-bottom:20px;text-align:right'>\n\t\t\t\t" . button("{quick_connect}", "Loadjs('squid.adker.wizard.php')", 26) . "</div>"; } $jshostname = "Loadjs('system.nic.config.php?change-hostname-js=yes&newinterface=yes');"; $sock = new sockets(); $hostname = $sock->GET_INFO("myhostname"); if ($hostname == null) { $hostname = $sock->getFrameWork("system.php?hostname-g=yes"); } $Thostname = explode(".", $hostname); $TKHOST = $Thostname[0] . "-k"; $TKHOST2 = $Thostname[0]; if ($ActiveDirectorySquidHTTPHostname == null) { $ActiveDirectorySquidHTTPHostname = $hostname; } else { $Thostname = explode(".", $ActiveDirectorySquidHTTPHostname); $TKHOST = $Thostname[0] . "-k"; $TKHOST2 = $Thostname[0]; } $enabled_big_button = Paragraphe_switch_img("{EnableWindowsAuthentication}", "{EnableWindowsAuthentication_text}", "EnableKerbAuth", $EnableKerbAuth, null, 850, "EnableKerbAuthCheck()"); if ($EnableKerbAuth == 1) { $mergencyjs = "Loadjs('squid.ad.emergency.progress.php')"; if ($ActiveDirectoryEmergency == 1) { $mergencyjs = "Loadjs('squid.urgency.php?activedirectory=yes')"; } $enabled_big_button = "\n\t\t<input type='hidden' name=\"EnableKerbAuth\" id=\"EnableKerbAuth\" value='{$EnableKerbAuth}'>\n\t\t<div style='margin-bottom:15px'>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td style='width:50%'><center>\n\t\t\t\t" . button("{disconnect}", "squid.ad.disconnect.progress.php", 28) . "</center></td>\n\t\t\t<td style='font-size:28px'><center> | </center></td>\n\t\t\t<td><center>" . button("{emergency2}", $mergencyjs, 28) . "</center></td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t"; } $html = "\n\n\t\n\t\n\t<div style='width:98%' class=form>\n\t{$button_wizard}\n\t{$enabled_big_button}\n\t\n\t<div style='width:97%;margin:5px;padding:10px;border:1px solid #CCCCCC;border-radius: 5px 5px 5px 5px;'>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' colspan=3>{hostname}:" . texttooltip($hostname, "{edit}", $jshostname) . "</td>\n\t\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{EnableRecursiveGroups}", "{EnableRecursiveGroups_text}") . ":</td>\n\t\t<td>" . Field_checkbox_design("RECURSIVE_GROUPS", 1, $array["RECURSIVE_GROUPS"]) . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{authenticate_from_kerberos}:</td>\n\t\t<td>" . Field_checkbox_design("WindowsActiveDirectoryKerberos", 1, "{$WindowsActiveDirectoryKerberos}") . "</td>\n\t\t<td>" . button("{cached_Kerberos_tickets}", "Loadjs('squid.adker.kerberos-tickets.php')", 16) . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{authentication_method}:</td>\n\t\t<td>" . Field_array_Hash($arrayAuth, "KerbAuthMethod", $KerbAuthMethod, "HideSambaDiv()", null, 0, "font-size:22px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t</table>\n\t</div>\n\t<div id='SAMBA_DIV1' style='width:97%;margin:5px;padding:10px;border:1px solid #CCCCCC;border-radius: 5px 5px 5px 5px;'>\n\t<table style='width:100%'>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{KerbAuthTrusted}:</td>\n\t\t<td>" . Field_checkbox_design("KerbAuthTrusted", 1, "{$KerbAuthTrusted}") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{KerbAuthDisableGroupListing}:</td>\n\t\t<td>" . Field_checkbox_design("KerbAuthDisableGroupListing", 1, "{$KerbAuthDisableGroupListing}") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{KerbAuthDisableNormalizeName}:</td>\n\t\t<td>" . Field_checkbox_design("KerbAuthDisableNormalizeName", 1, "{$KerbAuthDisableNormalizeName}") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{map_untrusted_to_domain}:</td>\n\t\t<td>" . Field_checkbox_design("KerbAuthMapUntrustedDomain", 1, "{$KerbAuthMapUntrustedDomain}") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{interface}:</td>\n\t\t<td>" . Field_array_Hash($nics, "SambaBindInterface", $SambaBindInterface, "style:font-size:22px;padding:3px") . "</td>\n\t\t<td>" . imgtootltip("disk-save-24.png", "{save}", "SaveSambaBindInterface()") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{database_backend}:</td>\n\t\t<td>" . Field_array_Hash($arrayBCK, "SAMBA_BACKEND", $array["SAMBA_BACKEND"], "style:font-size:22px;padding:3px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t\t\t\t\t\t\n\t</table>\n\t</div>\t\n\t<div style='width:97%;margin:5px;padding:10px;border:1px solid #CCCCCC;border-radius: 5px 5px 5px 5px;'>\t\n\t<table style='width:100%'>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{keep_alive}", "{SquidNTLMKeepAlive_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("SquidNTLMKeepAlive", 1, "{$SquidNTLMKeepAlive}") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{synchronize_time_with_ad}:</td>\n\t\t<td>" . Field_checkbox_design("NtpdateAD", 1, "{$NtpdateAD}") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{UseADAsNameServer}:</td>\n\t\t<td>" . Field_checkbox_design("UseADAsNameServer", 1, "{$UseADAsNameServer}") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr style='height:50px'>\n\t\t<td class=legend style='font-size:22px;' nowrap>{proxy_hostname}:</td>\n\t\t<td style='font-size:22px' colspan=2><span id='proxyHostnameKerbDiv'>" . texttooltip("HTTP/{$ActiveDirectorySquidHTTPHostname}", "{kerberos_proxy_hostname_explain}", "Loadjs('{$page}?kerberos-hostname-js=yes')") . "</span></td>\n\t</tr>\n\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{WINDOWS_DNS_SUFFIX}:</td>\n\t\t<td>" . Field_text("WINDOWS_DNS_SUFFIX", $array["WINDOWS_DNS_SUFFIX"], "font-size:22px;padding:3px;width:390px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{WINDOWS_SERVER_NETBIOSNAME}:</td>\n\t\t<td>" . Field_text("WINDOWS_SERVER_NETBIOSNAME", $array["WINDOWS_SERVER_NETBIOSNAME"], "font-size:22px;padding:3px;width:390px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{ADNETBIOSDOMAIN}", "{howto_ADNETBIOSDOMAIN}") . ":</td>\n\t\t<td>" . Field_text("ADNETBIOSDOMAIN", $array["ADNETBIOSDOMAIN"], "font-size:22px;padding:3px;width:390px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{ADNETIPADDR}", "{howto_ADNETIPADDR}") . ":</td>\n\t\t<td>" . field_ipv4("ADNETIPADDR", $array["ADNETIPADDR"], "font-size:22px") . "</td>\n\t\t<td>" . button("{controllers}", "Loadjs('squid.adker.controllers.php')", 22) . "</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{WINDOWS_SERVER_TYPE}:</td>\n\t\t<td>" . Field_array_Hash($severtype, "WINDOWS_SERVER_TYPE", $array["WINDOWS_SERVER_TYPE"], "style:font-size:22px;padding:3px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{COMPUTERS_BRANCH}:</td>\n\t\t<td>" . Field_text("COMPUTER_BRANCH", $array["COMPUTER_BRANCH"], "font-size:22px;padding:3px;width:390px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{administrator}:</td>\n\t\t<td>" . Field_text("WINDOWS_SERVER_ADMIN", $array["WINDOWS_SERVER_ADMIN"], "font-size:22px;padding:3px;width:390px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{password}:</td>\n\t\t<td>" . Field_password("WINDOWS_SERVER_PASS", $array["WINDOWS_SERVER_PASS"], "font-size:22px;padding:3px;width:390px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<td colspan=3 align='right' style='font-size:40px'><p> </p>\n\t\t\t\t\n\t\t\t\t" . button("{apply}", "SaveKERBProxy(0)", 40) . " | " . button("{save_and_connect}", "SaveKERBProxy(1)", 40) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t</div>\n<script>\nvar ButtonXtype{$t};\nfunction HideSambaDiv(){\n\tvar KerbAuthMethod=document.getElementById('KerbAuthMethod').value;\n\tif(KerbAuthMethod==3){\n\t document.getElementById('SAMBA_DIV1').style.display = 'none';\n\t return;\n }\n \n document.getElementById('SAMBA_DIV1').style.display = 'block';\n\n}\n\t\n\t\n\t\nfunction CheckHostname{$t_tmp}(){\n\tvar domainz=trim(document.getElementById('WINDOWS_DNS_SUFFIX').value);\n\tthewhole='{$Myhostname}';\n\tvar regexp = /([^.]+)\\.(.*?)\$/;\n\tvar match = regexp.exec(thewhole);\n\tvar domain = match[1];\n\tvar ext = match[2];\n\tdomainz=domainz.toLowerCase();\n\tdomain=ext.toLowerCase();\n\tif(domain!==domainz){\n\t\tif(confirm('{$error_dom1} '+domainz+' {$error_dom2} ('+domain+')\\n{$error_dom3}')){\n\t\t\tLoadjs('system.nic.config.php?change-hostname-js=yes');\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n}\n\t\t\n\t\t\nfunction EnableKerbAuthCheck(){\n\tvar evalday={$evaluation_period_days};\n\tif(evalday<365){ if(evalday<1){ alert('Evaluation perdiod finish!');return;} }\n\tvar EnableKerbAuth=0;\n\tEnableKerbAuth=document.getElementById('EnableKerbAuth').value;\n\t\t\t\n\t\t\t\n\tvar NTPDATE_INSTALLED={$NTPDATE_INSTALLED};\n\tvar samba_installed={$samba_installed};\n\t\t\t\n\t\t\tif(document.getElementById('WINDOWS_DNS_SUFFIX')){document.getElementById('WINDOWS_DNS_SUFFIX').disabled=true;}\n\t\t\tif(document.getElementById('WINDOWS_SERVER_NETBIOSNAME')){document.getElementById('WINDOWS_SERVER_NETBIOSNAME').disabled=true;}\n\t\t\tif(document.getElementById('WINDOWS_SERVER_TYPE')){document.getElementById('WINDOWS_SERVER_TYPE').disabled=true;}\n\t\t\tif(document.getElementById('WINDOWS_SERVER_ADMIN')){document.getElementById('WINDOWS_SERVER_ADMIN').disabled=true;}\n\t\t\tif(document.getElementById('WINDOWS_SERVER_PASS')){document.getElementById('WINDOWS_SERVER_PASS').disabled=true;}\n\t\t\tif(document.getElementById('ADNETBIOSDOMAIN')){document.getElementById('ADNETBIOSDOMAIN').disabled=true;}\n\t\t\tif(document.getElementById('ADNETIPADDR')){document.getElementById('ADNETIPADDR').disabled=true;}\n\t\t\tif(document.getElementById('SAMBA_BACKEND')){document.getElementById('SAMBA_BACKEND').disabled=true;}\n\t\t\tif(document.getElementById('COMPUTER_BRANCH')){document.getElementById('COMPUTER_BRANCH').disabled=true;}\n\t\t\t\n\t\t\tif(document.getElementById('KerbAuthDisableGroupListing')){document.getElementById('KerbAuthDisableGroupListing').disabled=true;}\n\t\t\tif(document.getElementById('KerbAuthDisableNormalizeName')){document.getElementById('KerbAuthDisableNormalizeName').disabled=true;}\n\t\t\tif(document.getElementById('KerbAuthMapUntrustedDomain')){document.getElementById('KerbAuthMapUntrustedDomain').disabled=true;}\n\t\t\t\n\t\t\tif(document.getElementById('NtpdateAD')){document.getElementById('NtpdateAD').disabled=true;}\n\t\t\tif(document.getElementById('KerbAuthMethod')){document.getElementById('KerbAuthMethod').disabled=true;}\n\t\t\tif(document.getElementById('SquidNTLMKeepAlive')){document.getElementById('SquidNTLMKeepAlive').disabled=true;}\n\t\t\tif(document.getElementById('UseADAsNameServer')){document.getElementById('UseADAsNameServer').disabled=true;}\n\t\t\tif(document.getElementById('SambaBindInterface')){document.getElementById('SambaBindInterface').disabled=true;}\n\t\t\tif(document.getElementById('SAMBA_BACKEND')){document.getElementById('SAMBA_BACKEND').disabled=true;}\n\t\t\tif(document.getElementById('RECURSIVE_GROUPS')){document.getElementById('RECURSIVE_GROUPS').disabled=true;}\n\t\t\tif(document.getElementById('WindowsActiveDirectoryKerberos')){document.getElementById('WindowsActiveDirectoryKerberos').disabled=true;}\n\t\t\tif(document.getElementById('KerbAuthTrusted')){document.getElementById('KerbAuthTrusted').disabled=true;}\n\t\t\t\n\t\t\t\n\n\t\t\tif(EnableKerbAuth==1){\n\t\t\t\tif(document.getElementById('WINDOWS_DNS_SUFFIX')){document.getElementById('WINDOWS_DNS_SUFFIX').disabled=false;}\n\t\t\t\tif(document.getElementById('WINDOWS_SERVER_NETBIOSNAME')){document.getElementById('WINDOWS_SERVER_NETBIOSNAME').disabled=false;}\n\t\t\t\tif(document.getElementById('WINDOWS_SERVER_TYPE')){document.getElementById('WINDOWS_SERVER_TYPE').disabled=false;}\n\t\t\t\tif(document.getElementById('WINDOWS_SERVER_ADMIN')){document.getElementById('WINDOWS_SERVER_ADMIN').disabled=false;}\n\t\t\t\tif(document.getElementById('WINDOWS_SERVER_PASS')){document.getElementById('WINDOWS_SERVER_PASS').disabled=false;}\t\t\t\t\t\t\t\n\t\t\t\tif(document.getElementById('ADNETBIOSDOMAIN')){document.getElementById('ADNETBIOSDOMAIN').disabled=false;}\n\t\t\t\tif(document.getElementById('ADNETIPADDR')){document.getElementById('ADNETIPADDR').disabled=false;}\n\t\t\t\tif(document.getElementById('SAMBA_BACKEND')){document.getElementById('SAMBA_BACKEND').disabled=false;}\n\t\t\t\tif(document.getElementById('COMPUTER_BRANCH')){document.getElementById('COMPUTER_BRANCH').disabled=false;}\n\t\t\t\t\n\t\t\t\tif(document.getElementById('KerbAuthDisableGroupListing')){document.getElementById('KerbAuthDisableGroupListing').disabled=false;}\n\t\t\t\tif(document.getElementById('KerbAuthDisableNormalizeName')){document.getElementById('KerbAuthDisableNormalizeName').disabled=false;}\n\t\t\t\tif(document.getElementById('KerbAuthMapUntrustedDomain')){document.getElementById('KerbAuthMapUntrustedDomain').disabled=false;}\n\t\t\t\tif(document.getElementById('KerbAuthTrusted')){document.getElementById('KerbAuthTrusted').disabled=false;}\n\t\t\t\tif(document.getElementById('KerbAuthMethod')){document.getElementById('KerbAuthMethod').disabled=false;}\n\t\t\t\tif(document.getElementById('SquidNTLMKeepAlive')){document.getElementById('SquidNTLMKeepAlive').disabled=false;}\n\t\t\t\tif(document.getElementById('UseADAsNameServer')){document.getElementById('UseADAsNameServer').disabled=false;}\n\t\t\t\tif(document.getElementById('SambaBindInterface')){document.getElementById('SambaBindInterface').disabled=false;}\n\t\t\t\tif(document.getElementById('SAMBA_BACKEND')){document.getElementById('SAMBA_BACKEND').disabled=false;}\n\t\t\t\tif(document.getElementById('RECURSIVE_GROUPS')){document.getElementById('RECURSIVE_GROUPS').disabled=false;}\n\t\t\t\tif(document.getElementById('WindowsActiveDirectoryKerberos')){document.getElementById('WindowsActiveDirectoryKerberos').disabled=false;}\n\t\t\t\tif(NTPDATE_INSTALLED==1){ if(document.getElementById('KerbAuthTrusted')){document.getElementById('NtpdateAD').disabled=false;} }\n\t\t\t\t\t\n\t\t}\n}\n\t\n\t\t\nfunction RefreshAll(){\n\tRefreshServerKerb();\n}\n\nfunction replaceAll{$t}(string, find, replace) {\n return string.replace(new RegExp(find, 'g'), replace);\n}\n\t\t\n\tvar x_SaveKERBProxy= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\t\n\t\t\n\t\tif(document.getElementById('AdSquidStatusLeft')){RefreshDansguardianMainService();}\n\t\tif(document.getElementById('squid-status')){LoadAjax('squid-status','squid.main.quicklinks.php?status=yes');}\n\t\t\n\t\tif(!document.getElementById('WINDOWS_SERVER_TYPE')){\n\t\t\talert('WINDOWS_SERVER_TYPE???');\n\t\t\treturn;\n\t\t}\n\t\tvar WINDOWS_SERVER_TYPE=document.getElementById('WINDOWS_SERVER_TYPE').value;\n\t\tif(WINDOWS_SERVER_TYPE=='WIN_2003'){WINDOWS_SERVER_TYPE='Windows 2000/2003';}\n\t\tif(WINDOWS_SERVER_TYPE=='WIN_2008AES'){WINDOWS_SERVER_TYPE='Windows 2008/2012';}\n\n\t\t\n\t\t\n\t\tvar xconfirm='{$do_want_to_perform_connection_to_ad}';\n\t\txconfirm=replaceAll{$t}(xconfirm,'%s', WINDOWS_SERVER_TYPE);\n\t\txconfirm=replaceAll{$t}(xconfirm,'%h', '{$TKHOST}/{$TKHOST2}');\n\n\t\t\n\t\tif(ButtonXtype{$t}==0){\n\t\t\tLoadjs('squid.compile.progress.php');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(confirm(xconfirm)){\n\t\t\tRefreshServerKerb();\n\t\t\tLoadjs('squid.ad.progress.php');\n\t\t}\n\t}\t\n\n\tvar x_SaveSambaBindInterface= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\tRefreshServerKerb();\n\t\t\n\t\tif(document.getElementById('AdSquidStatusLeft')){RefreshDansguardianMainService();}\n\t\tif(document.getElementById('squid-status')){LoadAjax('squid-status','squid.main.quicklinks.php?status=yes');}\n\t\t\n\t}\t\n\t\n\tfunction SaveSambaBindInterface(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('SaveSambaBindInterface',document.getElementById('SambaBindInterface').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveSambaBindInterface);\n\t}\n\t\n\t\n\t\tfunction SaveKERBProxy(xTYPE){\n\t\t\tButtonXtype{$t}=xTYPE;\n\t\t\tif(!CheckHostname{$t_tmp}()){return;}\n\t\t\tvar DisableSpecialCharacters={$DisableSpecialCharacters};\n\t\t\tvar EnableRemoteStatisticsAppliance={$EnableRemoteStatisticsAppliance};\n\t\t\tif(EnableRemoteStatisticsAppliance==1){Loadjs('squid.newbee.php?error-remote-appliance=yes');return;}\n\t\t\tvar pp=encodeURIComponent(document.getElementById('WINDOWS_SERVER_PASS').value);\n\t\t\tvar KerbAuthMethod=document.getElementById('KerbAuthMethod').value;\n\t\t\tvar WindowsActiveDirectoryKerberos=0;\n\t\t\tvar XHR = new XHRConnection();\n\t\t\t\n\t\t\tif(document.getElementById('WindowsActiveDirectoryKerberos').checked){\n\t\t\t\tXHR.appendData('WindowsActiveDirectoryKerberos',1);\n\t\t\t\tWindowsActiveDirectoryKerberos=1;\n\t\t\t}else{\n\t\t\t\tXHR.appendData('WindowsActiveDirectoryKerberos',0);\n\t\t\t}\n\t\t\t\n\t\t\tif(KerbAuthMethod==3){\n\t\t\t\tif(WindowsActiveDirectoryKerberos==0){\n\t\t\t\t\talert('{$no_sense_kerb_KerbAuthMethod}');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('KerbAuthDisableGroupListing').checked){XHR.appendData('KerbAuthDisableGroupListing',1);}else{XHR.appendData('KerbAuthDisableGroupListing',0);}\n\t\t\tif(document.getElementById('KerbAuthDisableNormalizeName').checked){XHR.appendData('KerbAuthDisableNormalizeName',1);}else{XHR.appendData('KerbAuthDisableNormalizeName',0);}\n\t\t\tif(document.getElementById('KerbAuthTrusted').checked){XHR.appendData('KerbAuthTrusted',1);}else{XHR.appendData('KerbAuthTrusted',0);}\n\t\t\tif(document.getElementById('KerbAuthMapUntrustedDomain').checked){XHR.appendData('KerbAuthMapUntrustedDomain',1);}else{XHR.appendData('KerbAuthMapUntrustedDomain',0);}\n\t\t\tif(document.getElementById('NtpdateAD').checked){XHR.appendData('NtpdateAD',1);}else{XHR.appendData('NtpdateAD',0);}\n\t\t\tif(document.getElementById('SquidNTLMKeepAlive').checked){XHR.appendData('SquidNTLMKeepAlive',1);}else{XHR.appendData('SquidNTLMKeepAlive',0);}\n\t\t\tif(document.getElementById('UseADAsNameServer').checked){XHR.appendData('UseADAsNameServer',1);}else{XHR.appendData('UseADAsNameServer',0);}\n\t\t\tif(document.getElementById('RECURSIVE_GROUPS').checked){XHR.appendData('RECURSIVE_GROUPS',1); }else{ XHR.appendData('RECURSIVE_GROUPS',0); }\n\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('EnableKerbAuth',document.getElementById('EnableKerbAuth').value);\n\t\t\tXHR.appendData('KerbAuthMethod',document.getElementById('KerbAuthMethod').value);\n\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('SambaBindInterface',document.getElementById('SambaBindInterface').value);\n\t\t\tXHR.appendData('COMPUTER_BRANCH',document.getElementById('COMPUTER_BRANCH').value);\n\t\t\tXHR.appendData('SAMBA_BACKEND',document.getElementById('SAMBA_BACKEND').value);\n\t\t\tXHR.appendData('WINDOWS_DNS_SUFFIX',document.getElementById('WINDOWS_DNS_SUFFIX').value);\n\t\t\tXHR.appendData('WINDOWS_SERVER_NETBIOSNAME',document.getElementById('WINDOWS_SERVER_NETBIOSNAME').value);\n\t\t\tXHR.appendData('WINDOWS_SERVER_TYPE',document.getElementById('WINDOWS_SERVER_TYPE').value);\n\t\t\tXHR.appendData('WINDOWS_SERVER_ADMIN',document.getElementById('WINDOWS_SERVER_ADMIN').value);\n\t\t\tXHR.appendData('WINDOWS_SERVER_PASS',pp);\n\t\t\tXHR.appendData('ADNETBIOSDOMAIN',document.getElementById('ADNETBIOSDOMAIN').value);\n\t\t\tXHR.appendData('ADNETIPADDR',document.getElementById('ADNETIPADDR').value);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveKERBProxy);\n\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tEnableKerbAuthCheck();\n\t\tHideSambaDiv();\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }