예제 #1
0
function dhcp_form(){
	$ldap=new clladp();
	$domains=$ldap->hash_get_all_domains();
	$dhcp=new dhcpd();
	$page=CurrentPageName();
	
	$users=new usersMenus();
	$sock=new sockets();
	$EnableDHCPServer=$sock->GET_INFO('EnableDHCPServer');
	$EnableDHCPUseHostnameOnFixed=$sock->GET_INFO('EnableDHCPUseHostnameOnFixed');
	
	if(count($domains)==0){$dom=Field_text('ddns_domainname',$dhcp->ddns_domainname,"font-size:13px;");}
	else{
		$domains[null]="{select}";
		$dom=Field_array_Hash($domains,'ddns_domainname',$dhcp->ddns_domainname,null,null,null,";font-size:13px;padding:3px");}
		$nic=$dhcp->array_tcp;
		if($dhcp->listen_nic==null){$dhcp->listen_nic="eth0";
	}
	
	
	while (list ($num, $val) = each ($nic) ){
		if($num==null){continue;}
		if($num=="lo"){continue;}
		$nics[$num]=$num;
	}
	if($dhcp->listen_nic<>null){
		$nics[$dhcp->listen_nic]=$dhcp->listen_nic;
	}
	$nics[null]='{select}';

	
	if(($users->BIND9_INSTALLED) OR ($users->POWER_DNS_INSTALLED) ){
		
		$EnableArticaAsDNSFirst=Field_checkbox("EnableArticaAsDNSFirst",1,$dhcp->EnableArticaAsDNSFirst);
		
		
	}else{
		$EnableArticaAsDNSFirst=Field_numeric_checkbox_img_disabled('EnableArticaAsDNSFirst',0,'{enable_disable}');	
	}
	
	$EnableDHCPUseHostnameOnFixed=Field_checkbox("EnableDHCPUseHostnameOnFixed",1,$EnableDHCPUseHostnameOnFixed);
	
	$html="

			<div id='dhscpsettings' class=form>
			<input type='hidden' id='EnableDHCPServer' value='$EnableDHCPServer' name='EnableDHCPServer'>
			<table style='width:98%'>
			
			<tr>
				<td class=legend style='font-size:13px'>{EnableArticaAsDNSFirst}:</td>
				<td>$EnableArticaAsDNSFirst</td>
				<td>&nbsp;</td>
				<td>". help_icon('{EnableArticaAsDNSFirst_explain}')."</td>
			</tr>	

			<tr>
				<td class=legend style='font-size:13px'>{EnableDHCPUseHostnameOnFixed}:</td>
				<td>$EnableDHCPUseHostnameOnFixed</td>
				<td>&nbsp;</td>
				<td>". help_icon('{EnableDHCPUseHostnameOnFixed_explain}')."</td>
			</tr>			
			
			<tr>
				<td class=legend style='font-size:13px'>{nic}:</td>
				<td>".Field_array_Hash($nics,'dhcp_listen_nic',$dhcp->listen_nic,null,null,null,";font-size:13px;padding:3px")."</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>	
			<tr>
				<td class=legend style='font-size:13px'>{ddns_domainname}:</td>
				<td>$dom</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td class=legend style='font-size:13px'>{max_lease_time}:</td>
				<td style='font-size:13px'>".Field_text('max_lease_time',$dhcp->max_lease_time,'width:60px;font-size:13px;padding:3px')."&nbsp;seconds</td>
				<td>&nbsp;</td>
				<td >".help_icon('{max_lease_time_text}')."</td>
			</tr>	
			
			<tr>
				<td class=legend style='font-size:13px'>{subnet}:</td>
				<td>".field_ipv4('subnet',$dhcp->subnet,null,true)."</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>			
			<tr>
				<td class=legend style='font-size:13px'>{netmask}:</td>
				<td>".field_ipv4('netmask',$dhcp->netmask,'font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td class=legend style='font-size:13px'>{gateway}:</td>
				<td>".field_ipv4('gateway',$dhcp->gateway,'font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td class=legend style='font-size:13px'>{only_use_this} ({gateway})</td>
				<td>".Field_checkbox("OnlySetGateway", 1,$dhcp->OnlySetGateway,"OnlySetGatewayCheck()")."</td>
				<td>&nbsp;</td>
			</tr>			
					
			<tr>
				<td class=legend style='font-size:13px'>{DNSServer} 1:</td>
				<td>".field_ipv4('DNS_1',$dhcp->DNS_1,'font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td class=legend style='font-size:13px'>{DNSServer} 2:</td>
				<td>".field_ipv4('DNS_2',$dhcp->DNS_2,'font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td class=legend style='font-size:13px'>{wins_server}:</td>
				<td>".field_ipv4('WINSDHCPSERV',$dhcp->WINS,'font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>					
			<tr>
				<td class=legend style='font-size:13px'>{ntp_server} <span style='font-size:10px'>({optional})</span>:</td>
				<td>".Field_text('ntp_server',$dhcp->ntp_server,'width:228px;font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>	
			<tr>
				<td class=legend style='font-size:13px'>{range} {from}:</td>
				<td>".field_ipv4('range1',$dhcp->range1,'font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td class=legend style='font-size:13px'>{range} {to}:</td>
				<td>".field_ipv4('range2',$dhcp->range2,'font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>			
			<tr>
				<td class=legend style='font-size:13px'>{broadcast}:</td>
				<td>".field_ipv4('broadcast_dhcp_main',$dhcp->broadcast,'font-size:13px;padding:3px')."&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>					
			<tr>
				<td colspan=4 align='right'><hr>
				". button("{edit}","SaveDHCPSettings()")."
					
				
				</td>
			</tr>		
			</table>
			
			</div><br>
			<script>
				function OnlySetGatewayCheck(){
					if(document.getElementById('OnlySetGateway').checked){
						document.getElementById('EnableArticaAsDNSFirst').disabled=true;
					}else{
						document.getElementById('EnableArticaAsDNSFirst').disabled=false;
					}
				
				}
				
			OnlySetGatewayCheck();
			</script>
			
		
	";

	
	$tpl=new templates();
	return  $tpl->_ENGINE_parse_body($html);		
	
}
예제 #2
0
function dhcp_form()
{
    $ldap = new clladp();
    $domains = $ldap->hash_get_all_domains();
    $dhcp = new dhcpd();
    $page = CurrentPageName();
    $users = new usersMenus();
    $sock = new sockets();
    $EnableDHCPServer = $sock->GET_INFO('EnableDHCPServer');
    if (count($domains) == 0) {
        $dom = Field_text('ddns_domainname', $dhcp->ddns_domainname, "font-size:13px;");
    } else {
        $domains[null] = "{select}";
        $dom = Field_array_Hash($domains, 'ddns_domainname', $dhcp->ddns_domainname, null, null, null, ";font-size:13px;padding:3px");
    }
    $nic = $dhcp->array_tcp;
    if ($dhcp->listen_nic == null) {
        $dhcp->listen_nic = "eth0";
    }
    while (list($num, $val) = each($nic)) {
        if ($num == null) {
            continue;
        }
        if ($num == "lo") {
            continue;
        }
        $nics[$num] = $num;
    }
    if ($dhcp->listen_nic != null) {
        $nics[$dhcp->listen_nic] = $dhcp->listen_nic;
    }
    $nics[null] = '{select}';
    if ($users->BIND9_INSTALLED or $users->POWER_DNS_INSTALLED) {
        $EnableArticaAsDNSFirst = Field_checkbox("EnableArticaAsDNSFirst", 1, $dhcp->EnableArticaAsDNSFirst);
    } else {
        $EnableArticaAsDNSFirst = Field_numeric_checkbox_img_disabled('EnableArticaAsDNSFirst', 0, '{enable_disable}');
    }
    $html = "\n\n\t\t\t<form name='FFM13'><div id='dhscpsettings'>\n\t\t\t<input type='hidden' id='EnableDHCPServer' value='{$EnableDHCPServer}' name='EnableDHCPServer'>\n\t\t\t<table style='width:100%' class=table_form>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{EnableArticaAsDNSFirst}:</td>\n\t\t\t\t<td>{$EnableArticaAsDNSFirst}</td>\n\t\t\t\t<td>" . help_icon('{EnableArticaAsDNSFirst_explain}') . "</td>\n\t\t\t</tr>\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{nic}:</td>\n\t\t\t\t<td>" . Field_array_Hash($nics, 'dhcp_listen_nic', $dhcp->listen_nic, null, null, null, ";font-size:13px;padding:3px") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{ddns_domainname}:</td>\n\t\t\t\t<td>{$dom}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{max_lease_time}:</td>\n\t\t\t\t<td style='font-size:13px'>" . Field_text('max_lease_time', $dhcp->max_lease_time, 'width:60px;font-size:13px;padding:3px') . "&nbsp;seconds</td>\n\t\t\t\t<td >" . help_icon('{max_lease_time_text}') . "</td>\n\t\t\t</tr>\t\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{subnet}:</td>\n\t\t\t\t<td>" . Field_text('netmask', $dhcp->netmask, 'width:110px;font-size:13px;padding:3px') . "&nbsp;</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{gateway}:</td>\n\t\t\t\t<td>" . Field_text('gateway', $dhcp->gateway, 'width:110px;font-size:13px;padding:3px') . "&nbsp;</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{DNSServer} 1:</td>\n\t\t\t\t<td>" . Field_text('DNS_1', $dhcp->DNS_1, 'width:110px;font-size:13px;padding:3px') . "&nbsp;</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{DNSServer} 2:</td>\n\t\t\t\t<td>" . Field_text('DNS_2', $dhcp->DNS_2, 'width:110px;font-size:13px;padding:3px') . "&nbsp;</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t<td class=legend style='font-size:13px'>{range}:</td>\n\t\t\t<td colspan=2>\n\t\t\t<table>\n\t\t\t\t<td class=legend style='font-size:13px'>{from}:</td>\n\t\t\t\t<td>" . Field_text('range1', $dhcp->range1, 'width:110px;font-size:13px;padding:3px') . "&nbsp;</td>\n\t\t\t\t<td class=legend style='font-size:13px'>{to}:</td>\n\t\t\t\t<td>" . Field_text('range2', $dhcp->range2, 'width:110px;font-size:13px;padding:3px') . "&nbsp;</td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td colspan=3 align='right'><hr>\n\t\t\t\t" . button("{edit}", "SaveDHCPSettings()") . "\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t\t</table>\n\t\t\t</form></div><br>\n\t\t\t\n\t\t\n\t";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}