当前位置: 首页>>代码示例>>PHP>>正文


PHP networking::ifconfig方法代码示例

本文整理汇总了PHP中networking::ifconfig方法的典型用法代码示例。如果您正苦于以下问题:PHP networking::ifconfig方法的具体用法?PHP networking::ifconfig怎么用?PHP networking::ifconfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在networking的用法示例。


在下文中一共展示了networking::ifconfig方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Networks

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));
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:16,代码来源:exec.artica.meta.php

示例2: wizard2_ipv4

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:45,代码来源:postfix.multiple.instances.wizard.php

示例3: zlistnics_builder

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;'
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:system.nic.config.php

示例4: NicBuildTR

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) {
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:miniadm.network.interfaces.php

示例5: nic_infos

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;
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:admin.dashboard.system.php

示例6: zlistnics

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>";
}
开发者ID:brucewu16899,项目名称:artica,代码行数:37,代码来源:system.nic.config.php

示例7: zlistnics_builder

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);
}
开发者ID:,项目名称:,代码行数:79,代码来源:

示例8: start_recursor

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";
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:95,代码来源:exec.pdns.php

示例9: config_service

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;
    }
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:pdns.php

示例10: zlistnics

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'>
//.........这里部分代码省略.........
开发者ID:rsd,项目名称:artica-1.5,代码行数:101,代码来源:system.nic.config.php


注:本文中的networking::ifconfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。