本文整理汇总了PHP中networking::Local_interfaces方法的典型用法代码示例。如果您正苦于以下问题:PHP networking::Local_interfaces方法的具体用法?PHP networking::Local_interfaces怎么用?PHP networking::Local_interfaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类networking
的用法示例。
在下文中一共展示了networking::Local_interfaces方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: interface_popup
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);
}
示例2: popup
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);
}
示例3: table
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);
}
示例4: page
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);
}
示例5: provider_popup
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);
}
示例6: parameters
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);
}
示例7: popup
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);
}
示例8: step1
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);
}
示例9: popup
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);
}
示例10: arp_settings
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);
}
示例11: popup
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);
}
示例12: gateway_config
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);
}
示例13: settings
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");
//.........这里部分代码省略.........
示例14: master_service_add_popup
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);
}
示例15: acl_rule_settings
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;
//.........这里部分代码省略.........