Пример #1
0
function main_network(){
	
	if($_GET["hostname"]==null){$hostname=$users->hostname;$_GET["hostname"]=$hostname;}else{$hostname=$_GET["hostname"];}
	
	
	
	$users=new usersMenus($hostname);
	$squid=new squid($hostname);
	
	$squid_ports=$squid->http_port_array[0];
	
if(strpos($squid->http_port_array[0],':')>0){
			$tb=explode(':',$squid->http_port_array[0]);
			$squid_ip_port=$tb[1];
			$squid_http_port=$tb[0];	
			}else{
				$squid_http_port=$squid->http_port_array[0];
			}
			
	
	
	if($squid->is_rules_exists('http_access','password')==true){$auth="yes";}else{$auth="no";}
	
	$my_auth_config=Field_yesno_checkbox("auth_allow",$auth);
	$sys=new systeminfos();
	$sys->array_tcp_addr['']='{all}';	
	
	
	
		if(is_array($squid->acls_rules_array["my_network"]["datas"])){
			$table="<table style='width:60%'>";
			$st=CellRollOver();
			while (list ($num, $line) = each ($squid->acls_rules_array["my_network"]["datas"])){
			$table=$table . "
			<tr $st>
			<td with=1% ><img src='img/fw_bold.gif'></td>
			<td><strong>$line</td>
			<td>{squid_network_ex}</td>
			<td>" . imgtootltip('x.gif','{delete}',"SquidSimpleDelsrc('$hostname','my_network','$num')"). "</td>
			</tr>
			";
			
			
			}
			
			$table=$table . "</table>";
			$table=RoundedLightGrey($table);
		}

	if($users->DANSGUARDIAN_INSTALLED==true){
		$dans=new dansguardian($hostname);
		$dans_port=$dans->Master_array["filterport"];
		
	$form="<table style='width:100%'>

	<tr>
	<td align='right' nowrap><strong>{dansguardian_listen_port}:</strong></td>
	<td>" . Field_text('dans_listen_port',$dans_port,'width:100px') ."</td>
	<td class=caption>{listen_port_text}</td>
	</tr>	
	<tr>
		<td align='right'><strong>{tcp_address}</strong>:</td>
		<td align='left'>" . Field_array_Hash($sys->array_tcp_addr,'dans_http_port_ip',$dans->Master_array["filterip"],null,null,0,'width:150px')."</td>
		<td class=caption>{tcp_address_text}</td>
	</tr>		
	
	<tr>
	<td align='right'><strong>{squid_listen_port}:</strong></td>
	<td>" . Field_text('squid_listen_port',$squid->http_port_array[0],'width:120px') ."</td>
	<td class=caption>{listen_port_chain}</td>
	</tr>
	<tr>
	<td class=caption align='right' colspan=3><input type='button' value='{apply}&nbsp;&raquo;' OnClick=\"javascript:SquidSimpleEditDansPort('$hostname');\"></td>
	</tr>	
	

	
	</table>
	";
	
	$form=RoundedLightGrey($form);
		
	}else{
		$ports=$squid->http_port_array[0];
		if(strpos($squid->http_port_array[0],':')>0){
			$tb=explode(':',$squid->http_port_array[0]);
			$http_port=$tb[1];
			$filterip=$tb[0];
		}else{
			$http_port=$squid->http_port_array[0];
			$filterip=null;
		}
		
		
		
		$form="<table style='width:100%'>
	<tr>
	<td align='right'><strong>{listen_port}:</strong></td>
	<td>" . Field_text('listen_port',$squid_http_port,'width:100px') ."</td>
	<td class=caption>{listen_port_text}<br><code>({$squid_http_port})</code></td>
	</tr>
	<tr>
		<td align='right'><strong>{tcp_address}</strong>:</td>
		<td align='left'>" . Field_array_Hash($sys->array_tcp_addr,'http_port_ip',$squid_ip_port,null,null,0,'width:150px')."</td>
		<td class=caption><input type='button' value='{apply}&nbsp;&raquo;' OnClick=\"javascript:SquidSimpleEditSquidPort('$hostname');\"></td>
	</tr>	
	
	</table>";
	$form=RoundedLightGrey($form);	
	}
	
	
	
	
	
	$html=main_tabs() . "<br>
	<H5>{listen_port}</H5>
	<br>$form<br>
	
	
	<h5>{squid_network}</H5>
	<p class=caption>{squid_network_text} {acl_src_text}</p>
	" . RoundedLightGreen("
	<table style='width:100%'>
	<tr>
	<td align='right' nowrap valign='top'><strong>{squid_ldap_auth}</strong></td>
	<td valign='top'>$my_auth_config</td>
	<td valign='top'><input type='button' value='{add}&nbsp;&raquo;' OnClick=\"javascript:SquidSimpleLdapEnable('$hostname');\"></td>
	<td class='caption' valign='top'>{squid_ldap_auth_text}</td>
	</tr>		
	<tr>
	<tr><td colspan=4>&nbsp;</td></tr>
	<td align='right' valign='top'><strong>{acl_src}</strong></td>
	<td valign='top'>" . Field_text('squid_ip_client',null,'width:120px') . "</td>
	<td valign='top'><input type='button' value='{add}&nbsp;&raquo;' OnClick=\"javascript:SquidSimpleAddsrc('$hostname');\"></td>
	<td class='caption' valign='top'>{squid_ip_client_text}</td>
	</tr>

	</table>") . "<br>$table";
	
	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html,'squid.index.php');
	
}