예제 #1
0
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 wizard2_ipv4()
{
    if ($_SESSION["WIZINSTANCE"]["WIZINTERFACE"] == null) {
        start();
        exit;
    }
    include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
    $tpc = new networking();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $EnableipV6 = $sock->GET_INFO("EnableipV6");
    if (!is_numeric($EnableipV6)) {
        $EnableipV6 = 0;
    }
    if (!isset($_SESSION["WIZINSTANCE"]["WIZIPADDR"])) {
        $tpc->ifconfig($_SESSION["WIZINSTANCE"]["WIZINTERFACE"]);
        $ipaddr = $tpc->tcp_addr;
        $exploded = explode(".", $ipaddr);
        $lastNumber = $exploded[3];
        $lastNumberPrefix = "{$exploded[0]}.{$exploded[1]}.{$exploded[2]}.";
        $iptrue = true;
        while ($iptrue == true) {
            $lastNumber = $lastNumber + 1;
            $q = new mysql();
            if ($lastNumber > 254) {
                break;
            }
            $newipaddr = $lastNumberPrefix . $lastNumber;
            $sql = "SELECT ip_address FROM postfix_multi WHERE ip_address='{$newipaddr}'";
            $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
            if (trim($ligne["ip_address"] == null)) {
                break;
            }
        }
        $network = $tpc->netmask;
        $gw = $tpc->gateway;
    } else {
        $newipaddr = $_SESSION["WIZINSTANCE"]["WIZIPADDR"];
        $network = $_SESSION["WIZINSTANCE"]["WIZIPMASK"];
        $gw = $_SESSION["WIZINSTANCE"]["WIZIPGW"];
    }
    $html = "<strong style='font-size:16px'>{Interface}:{$_SESSION["WIZINSTANCE"]["WIZINTERFACE"]}</strong>\n\t<div class=explain style='font-size:14px'>{welcome_new_instance_wizard_interface}</div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{ipaddr}:</td>\n\t\t<td>" . field_ipv4("WIZIPADDR", $newipaddr, "font-size:14px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{netmask}:</td>\n\t\t<td>" . field_ipv4("WIZIPMASK", $network, "font-size:14px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{gateway}:</td>\n\t\t<td>" . field_ipv4("WIZIPGW", $gw, "font-size:14px") . "</td>\n\t</tr>\t\n\t\t<tr>\n\t\t<td colspan=2><hr></td>\n\t</tR>\n\t<tr>\n\t\t<td align='left'>" . button("{previous}", "LoadAjax('new_instance_wizard','{$page}?start=yes');", 16) . "</td>\n\t\t<td align='right'>" . button("{next}", "WIZ_WIZIPSAVE()", 16) . "</td>\n\t</tr>\n\t</tbody>\n\t</table>\t\n\t<script>\n\tvar XWIZ_WIZIPSAVE= function (obj) {\n\t var results=obj.responseText;\n\t if(results.length>3){alert(results);return;}\n\t \tWIZMULTI3();\n\t}\t\n\t\n\tfunction WIZ_WIZIPSAVE(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('WIZIPADDR',document.getElementById('WIZIPADDR').value);\n\t\tXHR.appendData('WIZIPMASK',document.getElementById('WIZIPMASK').value);\n\t\tXHR.appendData('WIZIPGW',document.getElementById('WIZIPGW').value);\n\t\tAnimateDiv('new_instance_wizard');\n\t\tXHR.sendAndLoad('{$page}', 'POST',XWIZ_WIZIPSAVE);\t\n\t}\n\t\n\t</script>\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
예제 #3
0
function zlistnics_builder(){
	$sock=new sockets();
	$snortInterfaces=array();
	$LXCEthLocked=$sock->GET_INFO("LXCEthLocked");
	$EnableipV6=$sock->GET_INFO("EnableipV6");
	if(!is_numeric($EnableipV6)){$EnableipV6=0;}
	if(!is_numeric($LXCEthLocked)){$LXCEthLocked=0;}
	$IPBANS=unserialize(base64_decode($sock->GET_INFO("ArticaIpListBanned")));
	$LXCInterface=$sock->GET_INFO("LXCInterface");
	$DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement");
	if(!is_numeric($DisableNetworksManagement)){$DisableNetworksManagement=0;}
	$page=CurrentPageName();
	$tpl=new templates();
	$apply_network_configuration=$tpl->_ENGINE_parse_body("{apply_network_configuration}");
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	$apply_network_configuration_warn=$tpl->javascript_parse_text("{apply_network_configuration_warn}");
	
	$users=new usersMenus();
	if($users->SNORT_INSTALLED){
		$EnableSnort=$sock->GET_INFO("EnableSnort");
		if($EnableSnort==1){
			$snortInterfaces=unserialize(base64_decode($sock->GET_INFO("SnortNics")));
		}
	}	
	
	$tcp=new networking();
	

	
	
		$val=$_GET["nic-builder"];
		writelogs("Found: $val",__FUNCTION__,__FILE__,__LINE__);
		$val=trim($val);
		if(preg_match('#master#',$val)){return;}
		if(preg_match("#^veth.+?#",$val)){return;}
		if(preg_match("#^tunl[0-9]+#",$val)){return;}
		if(preg_match("#^dummy[0-9]+#",$val)){return;}
		if(preg_match("#^gre[0-9]+#",$val)){return;}
		if(preg_match("#^ip6tnl[0-9]+#",$val)){return;}
		if(preg_match("#^sit[0-9]+#",$val)){return;}
		if(preg_match("#^vlan[0-9]+#",$val)){return;}
		
		
		$nic=new system_nic();
		if(!$nic->unconfigured){		
			if($LXCEthLocked==1){if($val==$LXCInterface){
				writelogs("LXCEthLocked:$LXCEthLocked; $val==$LXCInterface -> abort",__FUNCTION__,__FILE__,__LINE__);
				continue;
				}
			}
		}
		
		$NIC_UP=false;
		
		if(trim($val)==null){continue;}
		if($GLOBALS["VERBOSE"]){echo "<strong>tcp->ifconfig($val)</strong><br>\n";}
		$tcp->ifconfig(trim($val));
		
		$jsEdit="Loadjs('system.nic.edit.php?nic=$val')";
		
		if(preg_match("#^br([0-9]+)#", $val,$re)){$jsEdit="Loadjs('system.network.bridges.interfaces.php?network-bridge-js=yess&ID={$re[1]}')";}
		
		$text=listnicinfos(trim($val),$jsEdit);
		
		
		

		
		$ipddr=$GLOBALS[trim($val)]["IP"];
		
		$js="javascript:$jsEdit";
		
		if(!$tcp->linkup){
			$img_on="net-card-64-grey.png";
			
		}else{
			$img_on="net-card-64.png";
			$NIC_UP=true;
			if($snortInterfaces[trim($val)]==1){$img_on="64-win-nic-snort.png";}
		}
		
		$icon1=imgtootltip("service-restart-16.png","{rebuild}","RebuildMyNic$val()");
		$icon2=imgtootltip("plus-16.png","{add_virtual_ip_addr_explain_js}","Loadjs('$page?js-add-nic=$val')");
		
		if($GLOBALS[trim($val)]["HAMACHI"]){
			$img_on="64-win-nic-hamachi.png";
			$js="javascript:Loadjs('hamachi.php')";
			$icon1=null;
			$icon2=null;
		}
		
		if($IPBANS[$ipddr]){
			$img_on="64-win-nic-off.png";
			$icon1=null;
			$icon2=null;
			$js=null;			
		}
		
		$html="
		<table style='width:400px;margin:3px;padding:3px;'
		OnMouseOver=\";this.style.cursor='pointer';this.style.background='#F5F5F5';\"
		OnMouseOut=\";this.style.cursor='default';this.style.background='#FFFFFF';\"
		class=form>
		<tr>
			<td valign='top' width=1%><img src='img/$img_on'></td>
			<td valign='top' style='padding:4px'>
				<div OnClick=\"$js\">$text</div>
				<table style='width:100%'>
					<tr>
						<td width=99%><div style='text-align:right'>$icon1</div></td>
						<td width=99%><div style='text-align:right'>". imgtootltip("16-refresh.png","{refresh}","RefreshMyNic$val()")."</div></td>
						<td width=99%><div style='text-align:right'>$icon2</div></td>
					</tr>
				</table>
			</td>
		</tr>
		</table>
		
		<script>
			function RefreshMyNic$val(){
				LoadAjax('zlistnic-info-$val','$page?nic-builder=$val');
			}

		var X_RebuildMyNic$val= function (obj) {
			var results=obj.responseText;
			if(results.length>3){alert(results);}
			RefreshMyNic$val();
		}		

		function  RebuildMyNic$val(){
			var DisableNetworksManagement=$DisableNetworksManagement;
			if(DisableNetworksManagement==1){alert('$ERROR_NO_PRIVS');return;}	
			if(confirm('$apply_network_configuration_warn')){	
				var XHR = new XHRConnection();
				XHR.appendData('RebuildMyNic','$val');
				AnimateDiv('zlistnic-info-$val');
				XHR.sendAndLoad('$page', 'POST',X_RebuildMyNic$val);
			}
		}
		

		
		</script>
		
		
		";

		echo $tpl->_ENGINE_parse_body($html);

	}
function NicBuildTR($NicRequested)
{
    $val = $NicRequested;
    $val = trim($val);
    if (preg_match('#master#', $val)) {
        return;
    }
    if (preg_match("#^veth.+?#", $val)) {
        return;
    }
    if (preg_match("#^tunl[0-9]+#", $val)) {
        return;
    }
    if (preg_match("#^dummy[0-9]+#", $val)) {
        return;
    }
    if (preg_match("#^gre[0-9]+#", $val)) {
        return;
    }
    if (preg_match("#^ip6tnl[0-9]+#", $val)) {
        return;
    }
    if (preg_match("#^sit[0-9]+#", $val)) {
        return;
    }
    if (preg_match("#^vlan[0-9]+#", $val)) {
        return;
    }
    if (preg_match("#^lxc[0-9]+#", $val)) {
        return;
    }
    $sock = new sockets();
    $snortInterfaces = array();
    $LXCEthLocked = $sock->GET_INFO("LXCEthLocked");
    $EnableipV6 = $sock->GET_INFO("EnableipV6");
    if (!is_numeric($EnableipV6)) {
        $EnableipV6 = 0;
    }
    if (!is_numeric($LXCEthLocked)) {
        $LXCEthLocked = 0;
    }
    $IPBANS = unserialize(base64_decode($sock->GET_INFO("ArticaIpListBanned")));
    $LXCInterface = $sock->GET_INFO("LXCInterface");
    $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement");
    if (!is_numeric($DisableNetworksManagement)) {
        $DisableNetworksManagement = 0;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $apply_network_configuration = $tpl->_ENGINE_parse_body("{apply_network_configuration}");
    $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
    $apply_network_configuration_warn = $tpl->javascript_parse_text("{apply_network_configuration_warn}");
    $users = new usersMenus();
    if ($users->SNORT_INSTALLED) {
        $EnableSnort = $sock->GET_INFO("EnableSnort");
        if ($EnableSnort == 1) {
            $snortInterfaces = unserialize(base64_decode($sock->GET_INFO("SnortNics")));
        }
    }
    $tcp = new networking();
    if (!isset($GLOBALS["ipsZ"])) {
        $GLOBALS["ipsZ"] = $tcp->ALL_IPS_GET_ARRAY();
    }
    $nic = new system_nic($NicRequested);
    if (!$nic->unconfigured) {
        if ($LXCEthLocked == 1) {
            if ($val == $LXCInterface) {
                writelogs("LXCEthLocked:{$LXCEthLocked}; {$val}=={$LXCInterface} -> abort", __FUNCTION__, __FILE__, __LINE__);
                return;
            }
        }
    }
    $NIC_UP = false;
    if (trim($val) == null) {
        continue;
    }
    $tcp->ifconfig(trim($val));
    $array_ipcfg = listnicinfos(trim($val));
    $ipddr = $array_ipcfg["tcp_address"];
    $defaultroute_text = null;
    if ($nic->defaultroute == 1) {
        $defaultroute_text = "<div><i style='color:#C40000;font-size:11px'>{default_route}</i></div>";
    }
    /*		return array(
    				"textColor"=>$textColor,
    				"tcp_address"=>$IPADDR,
    				"IPV6"=>$IPV6,
    				"NETMASK"=>$tbl[2],
    				"gateway"=>$tbl[4],
    				"mac_addr"=>$tbl[1],
    				"HAMACHI"=>$HAMACHI
    		);		
    		*/
    $js = "javascript:Loadjs('system.nic.edit.php?nic={$val}')";
    if (!$tcp->linkup) {
        $img_on = "net-card-64-grey.png";
    } else {
        $img_on = "net-card-64.png";
        $NIC_UP = true;
        if ($snortInterfaces[trim($val)] == 1) {
            $img_on = "64-win-nic-snort.png";
        }
    }
    $icon1 = imgtootltip("service-restart-16.png", "{rebuild}", "RebuildMyNic{$val}()");
    $icon2 = imgtootltip("plus-16.png", "{add_virtual_ip_addr_explain_js}", "Loadjs('{$page}?js-add-nic={$val}')");
    if ($array_ipcfg["HAMACHI"]) {
        $img_on = "64-win-nic-hamachi.png";
        $js = "javascript:Loadjs('hamachi.php')";
        $icon1 = null;
        $icon2 = null;
    }
    if ($IPBANS[$ipddr]) {
        $img_on = "64-win-nic-off.png";
        $icon1 = null;
        $icon2 = null;
        $js = null;
    }
    $boot = new boostrap_form();
    $link = $boot->trswitch("Loadjs('miniadm.network.interfaces.NIC.php?nic={$NicRequested}')");
    if (!$GLOBALS["AsSystemAdministrator"]) {
        $link = null;
    }
    $nic = new system_nic($NicRequested);
    $oldnic = null;
    $oldMac = null;
    $failover_text = null;
    $error = null;
    if ($nic->ucarp_enabled == 0) {
        $failover_text = "{disabled}";
    }
    if ($nic->ucarp_enabled == 1) {
        $oldnic = $ipddr;
        $ipddr = $nic->ucarp_vip;
        if (!isset($GLOBALS["ipsZ"][$nic->ucarp_vip])) {
            $error = "<img src='img/ok24-grey.png' style='marign-right:10px;float-left'>";
        }
        if ($nic->ucarp_master == 1) {
            $failover_text = "{master2}";
        } else {
            $failover_text = "{slave}";
        }
        $failover_text = $error . $failover_text . ":&nbsp;{$oldnic}";
        $nicinfos = $sock->getFrameWork("cmd.php?nicstatus={$NicRequested}:ucarp");
        $tbl = explode(";", $nicinfos);
        $oldMac = "<div style='color:{$array_ipcfg["textColor"]};font-size:12px'><i>{$array_ipcfg["mac_addr"]}</i></div>";
        $array_ipcfg["mac_addr"] = $tbl[1];
    }
    if (!$users->UCARP_INSTALLED) {
        $failover_text = "{not_installed}";
    }
    if ($array_ipcfg["gateway"] == null) {
        $nicz = new system_nic($NicRequested);
        $array_ipcfg["gateway"] = $nicz->GATEWAY;
    }
    return $tpl->_ENGINE_parse_body("\n\t\t<tr style='font-size:18px' {$link}>\n\t\t\t<td><img src='img/{$img_on}'></td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'>{$NicRequested}</td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'><i class='icon-signal'></i>&nbsp;{$ipddr}<div style='color:{$array_ipcfg["textColor"]};font-size:12px'><i>{failover}:{$failover_text}</i><br>{$array_ipcfg["IPV6"]}</td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'><i class='icon-signal'></i>&nbsp;{$array_ipcfg["mac_addr"]}{$oldMac}</td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'>{$array_ipcfg["gateway"]}{$defaultroute_text}</td>\n\t\t\t<td style='color:{$array_ipcfg["textColor"]}'>{$array_ipcfg["NETMASK"]}</td>\n\t\t</tr>");
}
예제 #5
0
function nic_infos()
{
    $sock = new sockets();
    $q = new mysql();
    $tpl = new templates();
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    $tcp = new networking();
    $IPBANS = unserialize(base64_decode($sock->GET_INFO("ArticaIpListBanned")));
    $sql = "SELECT Interface FROM nics";
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $MYSQL_NIC[$ligne["Interface"]] = $ligne["Interface"];
    }
    while (list($num, $val) = each($datas)) {
        writelogs("Found: {$val}", __FUNCTION__, __FILE__, __LINE__);
        $val = trim($val);
        $wire = '';
        $defaultroute_text = null;
        $color = "black";
        $error = null;
        $MUST_CHANGE = false;
        $WCCP_INTERFACE = false;
        $icon = "network-128-ok.png";
        if (preg_match('#master#', $val)) {
            continue;
        }
        if (preg_match("#^veth.+?#", $val)) {
            continue;
        }
        if (preg_match("#^tunl[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^dummy[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^gre[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^ip6tnl[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^sit[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^vlan[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^virt[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#wccp[0-9]+#", $val)) {
            $WCCP_INTERFACE = true;
        }
        $radius = "-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;/* behavior:url(/css/border-radius.htc); */";
        unset($MYSQL_NIC[$val]);
        $nicinfos = $sock->getFrameWork("cmd.php?nicstatus={$val}");
        $tbl = explode(";", $nicinfos);
        if ($IPBANS[$tbl[0]]) {
            continue;
        }
        $nicz = new system_nic($val);
        if (trim($val) == null) {
            continue;
        }
        if ($nicz->Bridged == 1) {
            continue;
        }
        $tcp->ifconfig(trim($val));
        $TCP_NIC_STATUS = $sock->getFrameWork("cmd.php?nicstatus={$val}");
        if (trim($tbl[5]) == "yes") {
            $wire = " (wireless)";
        }
        $gateway = trim($tbl[4]);
        if ($gateway == null) {
            $gateway = $nicz->GATEWAY;
        }
        if ($nicz->defaultroute == 1) {
            $defaultroute_text = "<i style='font-weight:blod;font-size:14px'>{default_route}</i>";
        }
        if ($tbl[0] == null) {
            $error = "<span style='color:#BA0000'>{waiting_network_reload}</span>";
            $icon = "network-128-warn.png";
        }
        if ($nicz->IPADDR != $tbl[0]) {
            $MUST_CHANGE = true;
        }
        if ($nicz->NETMASK != $tbl[2]) {
            $MUST_CHANGE = true;
        }
        if ($nicz->GATEWAY != $gateway) {
            $MUST_CHANGE = true;
        }
        if ($nicz->dhcp == 1) {
            $ip = new IP();
            if ($ip->isValid($tbl[0])) {
                $MUST_CHANGE = false;
            }
        }
        if ($nicz->enabled == 0) {
            $MUST_CHANGE = false;
        }
        if ($MUST_CHANGE) {
            $icon = "network-128-warn.png";
            $error = "<span style='color:#BA0000;font-size:16px'>{need_to_apply_network_settings_interface}</span>";
        }
        if ($nicz->enabled == 0) {
            $icon = "network-128-disabled.png";
            $color = "#8E8E8E";
        }
        if ($tbl[0] == null) {
            $tbl[0] = "<span style='color:#8a8a8a'>{$nicz->IPADDR}</span>";
        }
        if ($tbl[2] == null) {
            $tbl[2] = "<span style='color:#8a8a8a'>{$nicz->NETMASK}</span>";
        }
        $button = button("{modify}", "Loadjs('system.nic.edit.php?nic={$val}')", 16, 150);
        if ($WCCP_INTERFACE) {
            $error = null;
            $button = null;
        }
        $tr[] = "\n\t\t<table style='width:100%;border:2px solid #CCCCCC;margin-bottom:10x;{$radius}'>\n\t\t\n\t\t<tr>\n\t\t\t<td style='font-size:22px;font-weight:bold' colspan=2>\n\t\t\t<div style='margin-top:10px;margin-bottom:10px'>{$nicz->netzone}</span>: {$nicz->NICNAME} ({$val})\n\t\t\t<div style='text-align:right;width:80%;margin-top:-2px;\n\t\t\tpadding-top:5px;margin-bottom:10px'>{$defaultroute_text} {$error}</div>\n\t\t\t</div>\n\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td colspan=2>\n\t\t<table style='width:100%'>\n\t\t<td valign='top'><img src='img/{$icon}'></td>\n\t\t<td valign='top'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px;color:{$color}' class=legend>{tcp_address}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$tbl[0]}</td>\n\t\t\t</tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{netmask}</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$tbl[2]}</a></td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};vertical-align:top;font-size:16px'>{gateway}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$gateway}</a></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};vertical-align:top;font-size:16px'>{metric}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->metric}</a></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{mac_addr}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$tbl[1]}</a></td>\n\t\t\t</tr>\t\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding-bottom:9px'>{$button}</td>\n\t\t</tr>\t\t\n\t\t</table><p>&nbsp;</p>\n\t\t";
    }
    if (count($MYSQL_NIC) > 0) {
        while (list($num, $val) = each($MYSQL_NIC)) {
            $nicz = new system_nic($val);
            $tr[] = "\n\t\t\t<table style='width:100%;border:2px solid #CCCCCC;margin-bottom:10x;{$radius}'>\n\t\t\t\n\t\t\t<tr>\n\t\t\t<td style='font-size:22px;font-weight:bold' colspan=2>\n\t\t\t<div style='margin-top:10px;margin-bottom:10px'>{$nicz->netzone}</span>: {$nicz->NICNAME} ({$val})\n\t\t\t<div style='font-size:18px;color:#d32d2d'>{hardware_error}</div>\n\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td colspan=2>\n\t\t\t<table style='width:100%'>\n\t\t\t<td valign='top'><img src='img/network-128-fatal.png'></td>\n\t\t\t<td valign='top'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td style='font-size:16px;color:{$color}' class=legend>{tcp_address}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->IPADDR}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{netmask}</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->NETMASK}</a></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap style='color:{$color};vertical-align:top;font-size:16px'>{gateway}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->GATEWAY}</a></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap style='color:{$color};vertical-align:top;font-size:16px'>{metric}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->metric}</a></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t\n\t\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding-bottom:9px'>" . button("{delete}", "Loadjs('system.nic.edit.php?nic-delete-js={$val}')", 16, 150) . "</td>\n\t\t\t</tr>\n\t\t\t</table><p>&nbsp;</p>\n\t\t";
        }
    }
    $tr[] = "\n\t<center>" . button("{apply_network_configuration}", "Loadjs('network.restart.php')", 18, 390) . "</center>\n\t<center style='margin-top:10px'>" . button("{network_status}", "Loadjs('network.status.php')", 18, 390) . "</center>";
    $i = 0;
    $datas = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/usb.scan.serialize"));
    while (list($HDS, $MAIN_HD) = each($datas)) {
        if ($HDS == "UUID") {
            continue;
        }
        $HDSENC = urlencode($HDS);
        $tr[] = "\n\t\t<p>&nbsp;</p>\n\t\t<table style='width:100%;border:2px solid #CCCCCC;margin-bottom:10x;{$radius}'>\n\t\t\n\t\t<tr>\n\t\t<td style='font-size:22px;font-weight:bold'>\n\t\t<div style='margin-top:10px;margin-bottom:10px'>{disk} \n\t\t\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('system.internal.disks.php?partinfos-js={$HDSENC}')\"\n\t\tstyle='text-decoration:underline;font-weight:bold'>{$HDS}</a> - {$MAIN_HD["SIZE"]}</div></td>\n\t\t</tr>\n\t\t";
        while (list($dev, $MAIN_PART) = each($MAIN_HD["PARTITIONS"])) {
            $i++;
            $ID_FS_LABEL = $MAIN_PART["ID_FS_LABEL"];
            if ($ID_FS_LABEL == null) {
                $ID_FS_LABEL = $MAIN_PART["MOUNTED"];
            }
            $SIZE = round($MAIN_PART["INFO"]["SIZE"] / 1024);
            if ($SIZE == 0) {
                continue;
            }
            $UTIL = round($MAIN_PART["INFO"]["UTIL"] / 1024);
            $ID_FS_UUID = $MAIN_PART["ID_FS_UUID"];
            $script[] = "\nvar g{$i} = new JustGage({\n\tid: '{$ID_FS_UUID}',\n\tvalue: {$UTIL},\n\tmin: 0,\n\tmax: {$SIZE},\n\ttitle: '{$ID_FS_LABEL}',\n\tlabel: 'MB',\n\tlevelColorsGradient: true\n});";
            $icz[] = "<div style='width:130px;height:100px' id='{$ID_FS_UUID}'></div>\n\t\t\t\t\n\t\t";
        }
        $tr[] = "\n\t\t<tr>\n\t\t<td>" . CompileTr3($icz, true) . "</td>\n\t\t\t\t\n\t\t</table><p>&nbsp;</p>";
    }
    echo $tpl->_ENGINE_parse_body(@implode("\n", $tr)) . "\n\n<script>\n" . @implode("\n", $script) . "\n</script>";
}
예제 #6
0
function zlistnics()
{
    $sock = new sockets();
    $page = CurrentPageName();
    $tcp = new networking();
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    $html = "<table style='width:99%' class=table_form>\n\t<tr>\n\t";
    $count = 0;
    while (list($num, $val) = each($datas)) {
        $val = trim($val);
        if (preg_match('#master#', $val)) {
            continue;
        }
        if (trim($val) == null) {
            continue;
        }
        $tcp->ifconfig(trim($val));
        $text = listnicinfos(trim($val));
        $js = "javascript:Loadjs('{$page}?script=netconfig&nic={$val}')";
        if (!$tcp->linkup) {
            $img_on = "64-win-nic-off.png";
        } else {
            $img_on = "64-win-nic.png";
        }
        $tr_deb = null;
        $tr_fin = null;
        if ($count > 1) {
            $tr_deb = "\n\t\t\t<tr>";
            $tr_fin = "</tr>";
            $count = 0;
        }
        $nic_table = "\n\t\t\n\t\t<table style='width:100%;margin:3px;padding:3px;border:1px solid #CCCCCC' \n\t\tOnMouseOver=\";this.style.cursor='pointer';this.style.background='#F5F5F5';\"\n\t\tOnMouseOut=\";this.style.cursor='default';this.style.background='#FFFFFF';\"\n\t\t>\n\t\t<tr>\n\t\t\t<td valign='top' width=1%><img src='img/{$img_on}'></td>\n\t\t\t<td valign='top' style='padding:4px'>\n\t\t\t\t<div OnClick=\"{$js}\">{$text}</div>\n\t\t\t\t<div style='text-align:right'>" . imgtootltip("plus-16.png", "{add_virtual_ip_addr_explain_js}", "Loadjs('{$page}?js-add-nic={$val}')") . "</div>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t\n\t\t";
        $html = $html . "\n\t\t{$tr_fin}\n\t\t{$tr_deb}\n\t\t\n\t\t<td valign='top'>\n\t\t\t{$nic_table}\n\t\t</td>\n\t\t\n\t\t";
        $count = $count + 1;
    }
    echo "\n\t\n\t{$html}</table>";
}
예제 #7
0
function zlistnics_builder()
{
    $sock = new sockets();
    $snortInterfaces = array();
    $LXCEthLocked = $sock->GET_INFO("LXCEthLocked");
    if (!is_numeric($LXCEthLocked)) {
        $LXCEthLocked = 0;
    }
    $LXCInterface = $sock->GET_INFO("LXCInterface");
    $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement");
    if (!is_numeric($DisableNetworksManagement)) {
        $DisableNetworksManagement = 0;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $apply_network_configuration = $tpl->_ENGINE_parse_body("{apply_network_configuration}");
    $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
    $apply_network_configuration_warn = $tpl->javascript_parse_text("{apply_network_configuration_warn}");
    $users = new usersMenus();
    if ($users->SNORT_INSTALLED) {
        $EnableSnort = $sock->GET_INFO("EnableSnort");
        if ($EnableSnort == 1) {
            $snortInterfaces = unserialize(base64_decode($sock->GET_INFO("SnortNics")));
        }
    }
    $tcp = new networking();
    $val = $_GET["nic-builder"];
    writelogs("Found: {$val}", __FUNCTION__, __FILE__, __LINE__);
    $val = trim($val);
    if (preg_match('#master#', $val)) {
        continue;
    }
    if (preg_match("#^veth.+?#", $val)) {
        continue;
    }
    if (preg_match("#^tunl[0-9]+#", $val)) {
        continue;
    }
    if (preg_match("#^dummy[0-9]+#", $val)) {
        continue;
    }
    if (preg_match("#^gre[0-9]+#", $val)) {
        continue;
    }
    if (preg_match("#^ip6tnl[0-9]+#", $val)) {
        continue;
    }
    if (preg_match("#^sit[0-9]+#", $val)) {
        continue;
    }
    if (preg_match("#^vlan[0-9]+#", $val)) {
        continue;
    }
    $nic = new system_nic();
    if (!$nic->unconfigured) {
        if ($LXCEthLocked == 1) {
            if ($val == $LXCInterface) {
                writelogs("LXCEthLocked:{$LXCEthLocked}; {$val}=={$LXCInterface} -> abort", __FUNCTION__, __FILE__, __LINE__);
                continue;
            }
        }
    }
    if (trim($val) == null) {
        continue;
    }
    $tcp->ifconfig(trim($val));
    $text = listnicinfos(trim($val), "Loadjs('{$page}?script=netconfig&nic={$val}')");
    $js = "javascript:Loadjs('system.nic.edit.php?nic={$val}')";
    if (!$tcp->linkup) {
        $img_on = "64-win-nic-off.png";
    } else {
        $img_on = "64-win-nic.png";
        if ($snortInterfaces[trim($val)] == 1) {
            $img_on = "64-win-nic-snort.png";
        }
    }
    $html = "\n\t\t<table style='width:320px;margin:3px;padding:3px; \n\t\tOnMouseOver=\";this.style.cursor='pointer';this.style.background='#F5F5F5';\"\n\t\tOnMouseOut=\";this.style.cursor='default';this.style.background='#FFFFFF';\"\n\t\tclass=form>\n\t\t<tr>\n\t\t\t<td valign='top' width=1%><img src='img/{$img_on}'></td>\n\t\t\t<td valign='top' style='padding:4px'>\n\t\t\t\t<div OnClick=\"{$js}\">{$text}</div>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width=1% nowrap><i>{$val}</td>\n\t\t\t\t\t\n\t\t\t\t\t<td width=99%><div style='text-align:right'>" . imgtootltip("service-restart-16.png", "{rebuild}", "RebuildMyNic{$val}()") . "</div></td>\n\t\t\t\t\t<td width=99%><div style='text-align:right'>" . imgtootltip("16-refresh.png", "{refresh}", "RefreshMyNic{$val}()") . "</div></td>\n\t\t\t\t\t<td width=99%><div style='text-align:right'>" . imgtootltip("plus-16.png", "{add_virtual_ip_addr_explain_js}", "Loadjs('{$page}?js-add-nic={$val}')") . "</div></td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t\n\t\t<script>\n\t\t\tfunction RefreshMyNic{$val}(){\n\t\t\t\tLoadAjax('zlistnic-info-{$val}','{$page}?nic-builder={$val}');\n\t\t\t}\n\n\t\tvar X_RebuildMyNic{$val}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>3){alert(results);}\n\t\t\tRefreshMyNic{$val}();\n\t\t}\t\t\n\n\t\tfunction  RebuildMyNic{$val}(){\n\t\t\tvar DisableNetworksManagement={$DisableNetworksManagement};\n\t\t\tif(DisableNetworksManagement==1){alert('{$ERROR_NO_PRIVS}');return;}\t\n\t\t\tif(confirm('{$apply_network_configuration_warn}')){\t\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('RebuildMyNic','{$val}');\n\t\t\t\tAnimateDiv('zlistnic-info-{$val}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',X_RebuildMyNic{$val});\n\t\t\t}\n\t\t}\n\t\t\n\n\t\t\n\t\t</script>\n\t\t\n\t\t\n\t\t";
    echo $tpl->_ENGINE_parse_body($html);
}
예제 #8
0
function start_recursor()
{
    $sock = new sockets();
    $unix = new unix();
    $DisablePowerDnsManagement = $sock->GET_INFO("DisablePowerDnsManagement");
    $PowerDNSRecursorQuerLocalAddr = $sock->GET_INFO("PowerDNSRecursorQuerLocalAddr");
    $EnablePDNS = $sock->GET_INFO("EnablePDNS");
    if (!is_numeric($DisablePowerDnsManagement)) {
        $DisablePowerDnsManagement = 0;
    }
    $EnableChilli = 0;
    $chilli = $unix->find_program("chilli");
    if (is_file($chilli)) {
        $EnableChilli = $sock->GET_INFO("EnableChilli");
        if (!is_numeric($EnableChilli)) {
            $EnableChilli = 0;
        }
    }
    if ($EnableChilli == 1) {
        echo "Stopping......: " . date("H:i:s") . "PowerDNS Recursor HotSpot is enabled...\n";
        stop_recursor();
        return;
    }
    if ($PowerDNSRecursorQuerLocalAddr == null) {
        $net = new networking();
        $net->ifconfig("eth0");
        if ($net->tcp_addr != null) {
            if ($net->tcp_addr != "0.0.0.0") {
                $PowerDNSRecursorQuerLocalAddr = $net->tcp_addr;
            }
        }
    }
    if (!is_numeric($EnablePDNS)) {
        $EnablePDNS = 0;
    }
    $nohup = $unix->find_program("nohup");
    $recursorbin = $unix->find_program("pdns_recursor");
    if (!is_file($recursorbin)) {
        echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor Not installed, aborting task\n";
    }
    $pid = pdns_recursor_pid();
    if ($unix->process_exists($pid)) {
        $pidtime = $unix->PROCCESS_TIME_MIN($pid);
        echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor Already running PID {$pid} since {$pidtime}mn\n";
        return;
    }
    if ($DisablePowerDnsManagement == 1) {
        echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor DisablePowerDnsManagement={$DisablePowerDnsManagement}, aborting task\n";
        return;
    }
    if ($EnablePDNS == 0) {
        echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor service is disabled, aborting task\n";
        stop_recursor();
        return;
    }
    $trace = null;
    $quiet = "yes";
    $PowerDNSLogLevel = $sock->GET_INFO("PowerDNSLogLevel");
    $PowerDNSLogsQueries = $sock->GET_INFO("PowerDNSLogsQueries");
    if (!is_numeric($PowerDNSLogLevel)) {
        $PowerDNSLogLevel = 1;
    }
    $query_local_address = " --query-local-address={$PowerDNSRecursorQuerLocalAddr}";
    if ($PowerDNSLogLevel > 8) {
        $trace = ' --trace';
    }
    if ($PowerDNSLogsQueries == 1) {
        $quiet = 'no';
    }
    echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor Network card to send queries {$PowerDNSRecursorQuerLocalAddr}\n";
    echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor Log level [{$PowerDNSLogLevel}]\n";
    echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor Verify MySQL DB...\n";
    checkMysql();
    @mkdir("/var/run/pdns", 0755, true);
    $cmdline = "{$nohup} {$recursorbin} --daemon --export-etc-hosts --socket-dir=/var/run/pdns --quiet={$quiet} --config-dir=/etc/powerdns{$trace} {$query_local_address} >/dev/null 2>&1 &";
    shell_exec($cmdline);
    sleep(1);
    $pid = pdns_recursor_pid();
    if (!$unix->process_exists($pid)) {
        for ($i = 0; $i < 5; $i++) {
            echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor waiting " . ($i + 1) . "/5\n";
            $pid = pdns_recursor_pid();
            if ($unix->process_exists($pid)) {
                break;
            }
        }
    }
    $pid = pdns_recursor_pid();
    if (!$unix->process_exists($pid)) {
        echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor failed\n";
        echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor \"{$cmdline}\"\n";
    } else {
        echo "Starting......: " . date("H:i:s") . " PowerDNS Recursor success PID {$pid}\n";
    }
}
예제 #9
0
파일: pdns.php 프로젝트: BillTheBest/1.6.x
function config_service()
{
    $page = CurrentPageName();
    $user = new usersMenus();
    $sock = new sockets();
    $tpl = new templates();
    $listen_ip = $tpl->javascript_parse_text("{listen_ip}");
    if (!$user->POWER_DNS_INSTALLED) {
        not_installed();
        return null;
    }
    $PDNSRestartIfUpToMB = $sock->GET_INFO("PDNSRestartIfUpToMB");
    $DisablePowerDnsManagement = $sock->GET_INFO("DisablePowerDnsManagement");
    $EnablePDNS = $sock->GET_INFO("EnablePDNS");
    $PowerUseGreenSQL = $sock->GET_INFO("PowerUseGreenSQL");
    $PowerDisableDisplayVersion = $sock->GET_INFO("PowerDisableDisplayVersion");
    $PowerActHasMaster = $sock->GET_INFO("PowerActHasMaster");
    $PowerDNSDNSSEC = $sock->GET_INFO("PowerDNSDNSSEC");
    $PowerDNSDisableLDAP = $sock->GET_INFO("PowerDNSDisableLDAP");
    $PowerChroot = $sock->GET_INFO("PowerChroot");
    $PowerActAsSlave = $sock->GET_INFO("PowerActAsSlave");
    $PowerDNSLogLevel = $sock->GET_INFO("PowerDNSLogLevel");
    $PowerSkipCname = $sock->GET_INFO("PowerSkipCname");
    $PowerDNSRecursorQuerLocalAddr = $sock->GET_INFO("PowerDNSRecursorQuerLocalAddr");
    if (!is_numeric($EnablePDNS)) {
        $EnablePDNS = 0;
    }
    $PowerDNSMySQLEngine = 1;
    if (!is_numeric($PowerActHasMaster)) {
        $PowerActHasMaster = 0;
    }
    if (!is_numeric($PDNSRestartIfUpToMB)) {
        $PDNSRestartIfUpToMB = 700;
    }
    if (!is_numeric($DisablePowerDnsManagement)) {
        $DisablePowerDnsManagement = 0;
    }
    if (!is_numeric($PowerUseGreenSQL)) {
        $PowerUseGreenSQL = 0;
    }
    if (!is_numeric($PowerDisableDisplayVersion)) {
        $PowerDisableDisplayVersion = 0;
    }
    if (!is_numeric($PowerDNSDNSSEC)) {
        $PowerDNSDNSSEC = 0;
    }
    if (!is_numeric($PowerDNSDisableLDAP)) {
        $PowerDNSDisableLDAP = 1;
    }
    if (!is_numeric($PowerChroot)) {
        $PowerChroot = 0;
    }
    if (!is_numeric($PowerActAsSlave)) {
        $PowerActAsSlave = 0;
    }
    if (!is_numeric($PowerDNSLogLevel)) {
        $PowerDNSLogLevel = 1;
    }
    if (!is_numeric($PowerSkipCname)) {
        $PowerSkipCname = 0;
    }
    $net = new networking();
    if ($PowerDNSRecursorQuerLocalAddr == null) {
        $net->ifconfig("eth0");
        if ($net->tcp_addr != null) {
            if ($net->tcp_addr != "0.0.0.") {
                $PowerDNSRecursorQuerLocalAddr = $net->tcp_addr;
            }
        }
    }
    $PowerDNSMySQLType = $sock->GET_INFO("PowerDNSMySQLType");
    $PowerDNSMySQLRemoteServer = $sock->GET_INFO("PowerDNSMySQLRemoteServer");
    $PowerDNSMySQLRemotePort = $sock->GET_INFO("PowerDNSMySQLRemotePort");
    $PowerDNSMySQLRemoteAdmin = $sock->GET_INFO("PowerDNSMySQLRemoteAdmin");
    $PowerDNSMySQLRemotePassw = $sock->GET_INFO("PowerDNSMySQLRemotePassw");
    if (!is_numeric($PowerDNSMySQLType)) {
        $PowerDNSMySQLType = 1;
    }
    if (!is_numeric($PowerDNSMySQLRemotePort)) {
        $PowerDNSMySQLRemotePort = 3306;
    }
    $PowerDNSMySQLTypeA[1] = "{main_mysql_server_2}";
    $PowerDNSMySQLTypeA[2] = "{main_mysql_server_4}";
    $PowerDNSMySQLTypeA[3] = "{main_mysql_server_5}";
    $PowerDNSMySQLTypeF = Field_array_Hash($PowerDNSMySQLTypeA, "PowerDNSMySQLType", $PowerDNSMySQLType, "PowerDNSMySQLTypeCK()", null, 0, "font-size:18px");
    $POWER_DNS_MYSQL = 1;
    $GREENSQL = 1;
    $DNSDNSSEC = 1;
    if (!$user->APP_GREENSQL_INSTALLED) {
        $GREENSQL = 0;
        $PowerUseGreenSQL = 0;
    }
    if (!$user->PDNSSEC_INSTALLED) {
        $PowerDNSDNSSEC = 0;
        $DNSDNSSEC = 0;
    }
    $DisablePowerDnsManagement_text = $tpl->javascript_parse_text("{DisablePowerDnsManagement_text}");
    for ($i = 0; $i < 10; $i++) {
        $loglevels[$i] = $i;
    }
    $ips = $net->ALL_IPS_GET_ARRAY();
    unset($ips["127.0.0.1"]);
    $PowerDNSRecursorQuerLocalAddr = Field_array_Hash($ips, "PowerDNSRecursorQuerLocalAddr", $PowerDNSRecursorQuerLocalAddr, null, null, 0, "font-size:18px");
    $PowerDNSPerfs = unserialize(base64_encode($sock->GET_INFO("PowerDNSPerfs")));
    if (!isset($PowerDNSPerfs["cache-ttl"])) {
        $PowerDNSPerfs["cache-ttl"] = 3600;
    }
    if (!isset($PowerDNSPerfs["negquery-cache-ttl"])) {
        $PowerDNSPerfs["negquery-cache-ttl"] = 7200;
    }
    if (!isset($PowerDNSPerfs["query-cache-ttl"])) {
        $PowerDNSPerfs["query-cache-ttl"] = 300;
    }
    if (!isset($PowerDNSPerfs["recursive-cache-ttl"])) {
        $PowerDNSPerfs["recursive-cache-ttl"] = 7200;
    }
    $PowerDNSLogLevel = Field_array_Hash($loglevels, "PowerDNSLogLevel", $PowerDNSLogLevel, null, null, 0, "font-size:18px");
    $old = "\t\t\t\t<tr>\t\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{pdns-skip-cname}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerSkipCname", 1, $PowerSkipCname) . "</td>\n\t\t\t\t</tr>";
    $html = "\n\t<div id='PowerDNSMAsterConfigDiv'>\n\t\n\t\n<div style='width:98%' class=form>\t\n<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{cache-ttl}:</td>\n\t\t\t\t\t<td width=1% style='font-size:16px'>" . Field_text("cache-ttl", $PowerDNSPerfs["cache-ttl"], "font-size:18px;width:90px") . "&nbsp;{seconds}</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{negquery-cache-ttl}:</td>\n\t\t\t\t\t<td width=1% style='font-size:16px'>" . Field_text("negquery-cache-ttl", $PowerDNSPerfs["negquery-cache-ttl"], "font-size:18px;width:90px") . "&nbsp;{seconds}</td>\n\t\t\t\t</tr>\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{query-cache-ttl}:</td>\n\t\t\t\t\t<td width=1% style='font-size:16px'>" . Field_text("query-cache-ttl", $PowerDNSPerfs["query-cache-ttl"], "font-size:18px;width:90px") . "&nbsp;{seconds}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{recursive-cache-ttl}:</td>\n\t\t\t\t\t<td width=1% style='font-size:16px'>" . Field_text("recursive-cache-ttl", $PowerDNSPerfs["recursive-cache-ttl"], "font-size:18px;width:90px") . "&nbsp;{seconds}</td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{DisablePowerDnsManagement}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("DisablePowerDnsManagement", 1, $DisablePowerDnsManagement, "EnablePowerDNSMySQLEngineCheck()") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{EnablePDNS}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("EnablePDNS", 1, $EnablePDNS, "EnablePDNSCheck()") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{ActHasMaster}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerActHasMaster", 1, $PowerActHasMaster) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{ActHasSlave}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerActAsSlave", 1, $PowerActAsSlave) . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{DisableLDAPDatabase}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerDNSDisableLDAP", 1, $PowerDNSDisableLDAP, "EnablePowerDNSMySQLEngineCheck()") . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{useMySQL}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerDNSMySQLEngine", 1, $PowerDNSMySQLEngine, "EnablePowerDNSMySQLEngineCheck()") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\t\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>DNSSEC:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerDNSDNSSEC", 1, $PowerDNSDNSSEC) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\t\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{outgoing_network_addr}:</td>\n\t\t\t\t\t<td width=1%>{$PowerDNSRecursorQuerLocalAddr}</td>\n\t\t\t\t</tr>\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{useGreenSQL}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerUseGreenSQL", 1, $PowerUseGreenSQL) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{DisableDisplayVersion}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerDisableDisplayVersion", 1, $PowerDisableDisplayVersion) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' class=legend style='font-size:18px' nowrap>{chroot}:</td>\n\t\t\t\t\t<td width=1%>" . Field_checkbox_design("PowerChroot", 1, $PowerChroot) . "</td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:18px' nowrap>{log level}:</td>\n\t\t\t\t\t<td style='font-size:16px;padding:3px;' nowrap>{$PowerDNSLogLevel}</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:18px' nowrap>{RestartServiceifReachMb}:</td>\n\t\t\t\t\t<td style='font-size:16px;padding:3px;' nowrap>" . Field_text("PDNSRestartIfUpToMB", $PDNSRestartIfUpToMB, "font-size:16px;padding:3px;width:60px") . "&nbsp;MB</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=2><hr></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:18px' nowrap>{mysql_database}:</td>\n\t\t\t\t\t<td style='font-size:16px;padding:3px;' nowrap>{$PowerDNSMySQLTypeF}</td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:18px'>{remote_mysql_server}:</td>\n\t\t\t\t\t<td style='font-size:18px'>" . Field_text("PowerDNSMySQLRemoteServer", $PowerDNSMySQLRemoteServer, "font-size:16px;width:190px") . "</td>\n\t\t\t\t\t<td width=1%></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:18px'>{mysql_server_port}:</td>\n\t\t\t\t\t<td style='font-size:16px'>" . Field_text("PowerDNSMySQLRemotePort", $PowerDNSMySQLRemotePort, "font-size:16px;width:90px") . "</td>\n\t\t\t\t\t<td width=1%></td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:18px'>{mysql_admin}:</td>\n\t\t\t\t\t<td style='font-size:18px'>" . Field_text("PowerDNSMySQLRemoteAdmin", $PowerDNSMySQLRemoteAdmin, "font-size:16px;width:190px") . "</td>\n\t\t\t\t\t<td width=1%></td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:18px'>{password}:</td>\n\t\t\t\t\t<td style='font-size:18px'>" . Field_password("PowerDNSMySQLRemotePassw", $PowerDNSMySQLRemotePassw, "font-size:16px;width:190px") . "</td>\n\t\t\t\t\t<td width=1%></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t<tr><td colspan=2 align='right'><hr>" . button("{apply}", "SavePDNSWatchdog()", 26) . "</td></tr>\t\t\t\t\t\t\t\n\t\t\t</table>\n\t\t\t</div>\n\t</div>\n<script>\n\n\t\t\n\tvar x_EnablePowerDNSMySQLEngineCheck=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif (results.length>0){alert(results);}\n\t\t\tRefreshTab('main_config_pdns');\n\t\t}\t\t\t\n\t\t\n\t\tfunction EnablePowerDNSMySQLEngineCheck(){\n\t\t\t\tCheckDNSMysql();\n\t\t}\n\t\t\n\tfunction DisableAllInstead(zid){\n\t\t\$('input,select,hidden,textarea', '#PowerDNSMAsterConfigDiv').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).disabled=true;\n\t\t \t}\n\t\t \t\n\t\t});\t\n\t}\n\n\tfunction EnableAllDiv(){\n\t\t\$('input,select,hidden,textarea', '#PowerDNSMAsterConfigDiv').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\tdocument.getElementById(id).disabled=false;\n\t\t \t}\n\t\t \t\n\t\t});\t\n\t}\t\n\t\t\n\t\t\n\t\tfunction EnablePDNSCheck(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('EnablePDNS').checked){\n\t\t\t\tXHR.appendData('EnablePDNS','1');\n\t\t\t\t}else{\n\t\t\t\t\tXHR.appendData('EnablePDNS','0');\n\t\t\t\t}\n\t\t\t\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_EnablePowerDNSMySQLEngineCheck);\t\t\n\t\t}\n\t\t\n\t\tfunction SavePDNSWatchdog(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('PDNSRestartIfUpToMB',document.getElementById('PDNSRestartIfUpToMB').value);\n\t\t\tXHR.appendData('PowerDNSLogLevel',document.getElementById('PowerDNSLogLevel').value);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('PowerUseGreenSQL').checked){XHR.appendData('PowerUseGreenSQL',1);}else{XHR.appendData('PowerUseGreenSQL',0);}\n\t\t\tif(document.getElementById('PowerDisableDisplayVersion').checked){XHR.appendData('PowerDisableDisplayVersion',1);}else{XHR.appendData('PowerDisableDisplayVersion',0);}\n\t\t\tif(document.getElementById('PowerChroot').checked){XHR.appendData('PowerChroot',1);}else{XHR.appendData('PowerChroot',0);}\n\t\t\tif(document.getElementById('PowerActHasMaster').checked){XHR.appendData('PowerActHasMaster',1);}else{XHR.appendData('PowerActHasMaster',0);}\n\t\t\tif(document.getElementById('PowerActAsSlave').checked){XHR.appendData('PowerActAsSlave',1);}else{XHR.appendData('PowerActAsSlave',0);}\n\t\t\t//if(document.getElementById('PowerSkipCname').checked){XHR.appendData('PowerSkipCname',1);}else{XHR.appendData('PowerSkipCname',0);}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('PowerDNSDNSSEC').checked){XHR.appendData('PowerDNSDNSSEC',1);document.getElementById('PowerDNSDisableLDAP').checked=true;}else{XHR.appendData('PowerDNSDNSSEC',0);}\n\t\t\tif(document.getElementById('PowerDNSMySQLEngine').checked){XHR.appendData('PowerDNSMySQLEngine',1);}else{XHR.appendData('PowerDNSMySQLEngine',0);}\n\t\t\tif(document.getElementById('PowerDNSDisableLDAP').checked){XHR.appendData('PowerDNSDisableLDAP',1);}else{XHR.appendData('PowerDNSDisableLDAP',0);}\n\t\t\tif(document.getElementById('PowerChroot').checked){XHR.appendData('PowerChroot',1);}else{XHR.appendData('PowerChroot',0);}\n\t\t\tXHR.appendData('PowerDNSMySQLType',document.getElementById('PowerDNSMySQLType').value);\n\t\t\tXHR.appendData('PowerDNSMySQLRemoteServer',document.getElementById('PowerDNSMySQLRemoteServer').value);\n\t\t\tXHR.appendData('PowerDNSMySQLRemotePort',document.getElementById('PowerDNSMySQLRemotePort').value);\n\t\t\tXHR.appendData('PowerDNSMySQLRemoteAdmin',document.getElementById('PowerDNSMySQLRemoteAdmin').value);\n\t\t\tXHR.appendData('PowerDNSRecursorQuerLocalAddr',document.getElementById('PowerDNSRecursorQuerLocalAddr').value);\n\t\t\t\n\t\t\tXHR.appendData('cache-ttl',document.getElementById('cache-ttl').value);\n\t\t\tXHR.appendData('negquery-cache-ttl',document.getElementById('negquery-cache-ttl').value);\n\t\t\tXHR.appendData('query-cache-ttl',document.getElementById('query-cache-ttl').value);\n\t\t\tXHR.appendData('recursive-cache-ttl',document.getElementById('recursive-cache-ttl').value);\n\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\n\t\t\tvar pp=encodeURIComponent(document.getElementById('PowerDNSMySQLRemotePassw').value);\n\t\t\tXHR.appendData('PowerDNSMySQLRemotePassw',pp);\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('DisablePowerDnsManagement').checked){\n\t\t\t\tif(confirm('{$DisablePowerDnsManagement_text}')){XHR.appendData('DisablePowerDnsManagement','1');}else{XHR.appendData('DisablePowerDnsManagement','0');}\n\t\t\t}else{\n\t\t\t\tXHR.appendData('DisablePowerDnsManagement','0');\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_EnablePowerDNSMySQLEngineCheck);\t\n\t\t}\n\t\t\n\t\tfunction PowerDNSMySQLTypeCK(){\n\t\t\tvar DisablePowerDnsManagement={$DisablePowerDnsManagement};\n\t\t\tvar EnablePDNS=1;\n\t\t\tif(document.getElementById('DisablePowerDnsManagement').checked){DisablePowerDnsManagement=1;}\n\t\t\tif(!document.getElementById('EnablePDNS').checked){EnablePDNS=0;}\n\t\t\t\n\t\t\t\n\t\t\tdocument.getElementById('PowerDNSMySQLType').disabled=true;\n\t\t\tdocument.getElementById('PowerUseGreenSQL').disabled=true;\n\t\t\tdocument.getElementById('PowerDNSMySQLRemoteServer').disabled=true;\n\t\t\tdocument.getElementById('PowerDNSMySQLRemotePort').disabled=true;\n\t\t\tdocument.getElementById('PowerDNSMySQLRemoteAdmin').disabled=true;\n\t\t\tdocument.getElementById('PowerDNSMySQLRemotePassw').disabled=true;\t\t\t\n\t\t\tif(DisablePowerDnsManagement==1){return;}\n\t\t\tif(EnablePDNS==0){return;}\n\t\t\t\n\t\t\tif(!document.getElementById('PowerDNSMySQLEngine').checked){return;}\n\t\t\tdocument.getElementById('PowerDNSMySQLType').disabled=false;\n\t\t\tPowerDNSMySQLType=document.getElementById('PowerDNSMySQLType').value;\t\n\t\t\t\n\t\t\tif(PowerDNSMySQLType==2){\n\t\t\t\tdocument.getElementById('PowerDNSMySQLRemoteServer').disabled=false;\n\t\t\t\tdocument.getElementById('PowerDNSMySQLRemotePort').disabled=false;\n\t\t\t\tdocument.getElementById('PowerDNSMySQLRemoteAdmin').disabled=false;\n\t\t\t\tdocument.getElementById('PowerDNSMySQLRemotePassw').disabled=false;\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(PowerDNSMySQLType==3){\n\t\t\t\tdocument.getElementById('PowerUseGreenSQL').disabled=false;\n\t\t\t}\n\t\t\n\t\t}\n\n\n\t\t\n\t\tfunction CheckDNSMysql(){\n\t\t\tvar POWER_DNS_MYSQL={$POWER_DNS_MYSQL};\n\t\t\tvar DisablePowerDnsManagement={$DisablePowerDnsManagement};\n\t\t\tvar EnablePDNS={$EnablePDNS};\n\t\t\tvar GREENSQL={$GREENSQL};\n\t\t\tvar DNSDNSSEC={$DNSDNSSEC};\n\t\t\tif(document.getElementById('DisablePowerDnsManagement').checked){DisablePowerDnsManagement=1;}\n\t\t\tif(!document.getElementById('EnablePDNS').checked){EnablePDNS=0;}\n\t\t\tdocument.getElementById('PowerDNSMySQLEngine').disabled=true;\n\t\t\tdocument.getElementById('PowerUseGreenSQL').disabled=true;\n\t\t\tdocument.getElementById('PowerDNSDNSSEC').disabled=true;\n\t\t\t\n\t\t\tDisableAllInstead('DisablePowerDnsManagement');\n\t\t\t\n\t\t\tif(DisablePowerDnsManagement==1){\n\t\t\t\tPowerDNSMySQLTypeCK();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tEnableAllDiv();\n\t\t\tdocument.getElementById('EnablePDNS').disabled=false;\n\t\t\tif(EnablePDNS==0){\n\t\t\t\tDisableAllInstead('EnablePDNS');\n\t\t\t\tPowerDNSMySQLTypeCK();\n\t\t\t\treturn;\n\t\t\t\t\n\t\t\t}\n\t\t\tif(POWER_DNS_MYSQL==1){\n\t\t\t\tdocument.getElementById('PowerDNSMySQLEngine').disabled=false;\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('PowerDNSMySQLEngine').disabled==false){\n\t\t\t\tif(document.getElementById('PowerDNSMySQLEngine').checked){\n\t\t\t\t\tif(GREENSQL==1){document.getElementById('PowerUseGreenSQL').disabled=false;}\n\t\t\t\t\tif(DNSDNSSEC==1){\n\t\t\t\t\t\tdocument.getElementById('PowerDNSDNSSEC').disabled=false;\n\t\t\t\t\t\t\tif(document.getElementById('PowerDNSDNSSEC').checked){\n\t\t\t\t\t\t\t\tdocument.getElementById('PowerDNSDisableLDAP').disabled=true;\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tdocument.getElementById('PowerDNSDisableLDAP').disabled=false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\tPowerDNSMySQLTypeCK();\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\n\t\n\t\n\tCheckDNSMysql();\n\tPowerDNSMySQLTypeCK();\n\t\n\t\t\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
예제 #10
0
function zlistnics(){
	$sock=new sockets();
	$snortInterfaces=array();
	$LXCEthLocked=$sock->GET_INFO("LXCEthLocked");
	
	if(!is_numeric($LXCEthLocked)){$LXCEthLocked=0;}
	
	$LXCInterface=$sock->GET_INFO("LXCInterface");
	$DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement");
	if(!is_numeric($DisableNetworksManagement)){$DisableNetworksManagement=0;}
	$page=CurrentPageName();
	$tpl=new templates();
	$apply_network_configuration=$tpl->_ENGINE_parse_body("{apply_network_configuration}");
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	$apply_network_configuration_warn=$tpl->javascript_parse_text("{apply_network_configuration_warn}");
	
	$users=new usersMenus();
	if($users->SNORT_INSTALLED){
		$EnableSnort=$sock->GET_INFO("EnableSnort");
		if($EnableSnort==1){
			$snortInterfaces=unserialize(base64_decode($sock->GET_INFO("SnortNics")));
		}
	}	
	
	$tcp=new networking();
	
	
	$datas=unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
	
	$count=0;
	writelogs(count($datas). " rows for nic infos",__FUNCTION__,__FILE__,__LINE__);
	
	
	$tr[]=$tpl->_ENGINE_parse_body("
		<table style='width:320px;margin:3px;padding:3px; 
		OnMouseOver=\";this.style.cursor='pointer';this.style.background='#F5F5F5';\"
		OnMouseOut=\";this.style.cursor='default';this.style.background='#FFFFFF';\"
		class=form
		>
		<tr>
			<td valign='top' width=1%><img src='img/ipv6-64.png'></td>
			<td valign='top' style='padding:4px'>
				<div style='font-size:13px'>
					
					<strong style='font-size:14px'>
						<a href=\"javascript:blur()\" 
						OnClick=\"javascript:Loadjs('system.nic.ipv6.php')\" 
						style='text-decoration:underline;font-weight:bold;font-size:16px'>IPv6: {parameters}</a></strong><br>
					<a href=\"javascript:blur()\" OnClick=\"javascript:Loadjs('system.nic.ipv6.php')\" style='text-decoration:underline'>{ipv6_explain_enable_text}</a>
					
				</div>
			</td>
		</tr>
		</table>
		");
	
	
	
	while (list ($num, $val) = each ($datas) ){
		writelogs("Found: $val",__FUNCTION__,__FILE__,__LINE__);
		$val=trim($val);
		if(preg_match('#master#',$val)){continue;}
		if(preg_match("#^veth.+?#",$val)){continue;}
		if(preg_match("#^tunl[0-9]+#",$val)){continue;}
		if(preg_match("#^dummy[0-9]+#",$val)){continue;}
		if(preg_match("#^gre[0-9]+#",$val)){continue;}
		if(preg_match("#^ip6tnl[0-9]+#",$val)){continue;}
		if(preg_match("#^sit[0-9]+#",$val)){continue;}
		if(preg_match("#^vlan[0-9]+#",$val)){continue;}
		
		
		$nic=new system_nic();
		if(!$nic->unconfigured){		
			if($LXCEthLocked==1){if($val==$LXCInterface){
				writelogs("LXCEthLocked:$LXCEthLocked; $val==$LXCInterface -> abort",__FUNCTION__,__FILE__,__LINE__);
				continue;
				}
			}
		}
		
		if(trim($val)==null){continue;}
		$tcp->ifconfig(trim($val));
		$text=listnicinfos(trim($val),"Loadjs('$page?script=netconfig&nic=$val')");
		$js="javascript:Loadjs('system.nic.edit.php?nic=$val')";
		if(!$tcp->linkup){
			$img_on="64-win-nic-off.png";
			
		}else{
			$img_on="64-win-nic.png";
			if($snortInterfaces[trim($val)]==1){$img_on="64-win-nic-snort.png";}
		}
		
		$tr[]="
		<table style='width:320px;margin:3px;padding:3px; 
		OnMouseOver=\";this.style.cursor='pointer';this.style.background='#F5F5F5';\"
		OnMouseOut=\";this.style.cursor='default';this.style.background='#FFFFFF';\"
		class=form>
		<tr>
			<td valign='top' width=1%><img src='img/$img_on'></td>
			<td valign='top' style='padding:4px'>
				<div OnClick=\"$js\">$text</div>
				<table style='width:100%'>
				<tr>
					<td width=1% nowrap><i>$val</td>
					<td width=99%><div style='text-align:right'>". imgtootltip("plus-16.png","{add_virtual_ip_addr_explain_js}","Loadjs('$page?js-add-nic=$val')")."</div></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		";

		}
		
$tables[]="<table style='width:100%'><tr>";
$t=0;
while (list ($key, $line) = each ($tr) ){
		$line=trim($line);
		if($line==null){continue;}
		$t=$t+1;
		$tables[]="<td valign='top'>$line</td>";
		if($t==2){$t=0;$tables[]="</tr><tr>";}
		}

if($t<2){
	for($i=0;$i<=$t;$i++){
		$tables[]="<td valign='top'>&nbsp;</td>";				
	}
}	

	$html=@implode("\n", $tables);
		
	echo "
	<div style='text-align:right'>". button("$apply_network_configuration","BuildNetConf()")."</div>
	<div id='NetworkManager-status'></div>
	$html
	
	

	
	<script>
		LoadAjax('main_config_hostname','$page?popup-hostname=yes');
		LoadAjax('NetworkManager-status','$page?NetworkManager-check=yes');
		
		var X_BuildNetConf= function (obj) {
			var results=obj.responseText;
			if(results.length>0){alert(results);}
			
		}		

		function BuildNetConf(){
			var DisableNetworksManagement=$DisableNetworksManagement;
			if(DisableNetworksManagement==1){alert('$ERROR_NO_PRIVS');return;}	
			if(confirm('$apply_network_configuration_warn')){	
				var XHR = new XHRConnection();
				XHR.appendData('BuildNetConf',1);
				XHR.sendAndLoad('$page', 'GET',X_BuildNetConf);
			}
		}


		
	</script>
	
	";
	}