function page()
{
    $ID = intval($_GET["ID"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $rv = new squid_reverse();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $servername = $_GET["servername"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_www WHERE servername='{$servername}'"));
    $cache_peer_id = $ligne["cache_peer_id"];
    $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT cacheid FROM reverse_sources WHERE ID='{$cache_peer_id}'"));
    if (intval($ligne2) == 0) {
        echo FATAL_ERROR_SHOW_128("{nginx_error_no_cache_defined}");
        return;
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:40px;padding-bottom:20px'>{caching}</td></tr>";
    $html[] = Field_checkbox_table("proxy_buffering-{$t}", "{proxy_buffering}", $ligne["proxy_buffering"], $fields_size, "{proxy_buffering_text}");
    $html[] = Field_text_table("proxy_cache_min_uses-{$t}", "{proxy_cache_min_uses}", $ligne["proxy_cache_min_uses"], $fields_size, "{proxy_cache_min_uses_text}", 120);
    $html[] = Field_text_table("proxy_cache_valid-{$t}", "{proxy_cache_valid} ({minutes})", $ligne["proxy_cache_valid"], $fields_size, "{proxy_cache_valid_text}", 120);
    $html[] = Field_ipv4_table("proxy_buffers-{$t}", "{proxy_buffers}", $ligne["proxy_buffers"], $fields_size, "{proxy_buffers_text}", 120);
    $html[] = Field_text_table("proxy_buffer_size-{$t}", "{proxy_buffer_size} (k)", $ligne["proxy_buffer_size"], $fields_size, "{proxy_buffer_size_text}", 110);
    $html[] = Field_text_table("proxy_temp_file_write_size-{$t}", "{proxy_temp_file_write_size} (k)", $ligne["proxy_temp_file_write_size"], $fields_size, "{proxy_temp_file_write_size_text}", 110);
    $html[] = Field_text_table("proxy_max_temp_file_size-{$t}", "{proxy_max_temp_file_size} (MB)", $ligne["proxy_max_temp_file_size"], $fields_size, "{proxy_max_temp_file_size_text}", 110);
    $html[] = Field_button_table_autonome("{apply}", "Submit{$t}", 40);
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\tRefreshTab('main_nginx_server');\n\t\t\$('#NGINX_MAIN_TABLE').flexReload();\n\t\t\$('#NGINX_DESTINATION_MAIN_TABLE').flexReload();\n\t\tvar ID={$ID}\n\t\tif(ID==0){ YahooWin2Hide();}\n\t\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar proxy_buffering=0\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('general-settings','{$servername}');\n\t\tif(document.getElementById('proxy_buffering-{$t}').checked){proxy_buffering=1;}\n\t\tXHR.appendData('proxy_cache_min_uses',document.getElementById('proxy_cache_min_uses-{$t}').value);\n\t\tXHR.appendData('proxy_buffering',proxy_buffering);\n\t\tXHR.appendData('proxy_cache_valid',document.getElementById('proxy_cache_valid-{$t}').value);\n\t\tXHR.appendData('proxy_buffers',document.getElementById('proxy_buffers-{$t}').value);\n\t\tXHR.appendData('proxy_buffer_size',document.getElementById('proxy_buffer_size-{$t}').value);\n\t\t\n\t\tXHR.appendData('proxy_max_temp_file_size',document.getElementById('proxy_max_temp_file_size-{$t}').value);\n\t\tXHR.appendData('proxy_temp_file_write_size',document.getElementById('proxy_temp_file_write_size-{$t}').value);\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function page()
{
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $MikrotikTransparent = intval($sock->GET_INFO('MikrotikTransparent'));
    $MikrotikHTTPSquidPort = intval($sock->GET_INFO('MikrotikHTTPSquidPort'));
    $MikrotikVirtualIP = $sock->GET_INFO('MikrotikVirtualIP');
    $MikrotikLocalInterface = $sock->GET_INFO('MikrotikLocalInterface');
    $MikrotikNetMask = $sock->GET_INFO('MikrotikNetMask');
    $MikrotikIPAddr = $sock->GET_INFO('MikrotikIPAddr');
    $MikrotikLAN = $sock->GET_INFO('MikrotikLAN');
    $MikrotikSSLTransparent = intval($sock->GET_INFO("MikrotikSSLTransparent"));
    $MikrotikHTTPSSquidPort = intval($sock->GET_INFO("MikrotikHTTPSSquidPort"));
    $ip = new networking();
    $ipsH = $ip->Local_interfaces();
    $t = time();
    if ($MikrotikHTTPSquidPort == 0) {
        $MikrotikHTTPSquidPort = rand(9090, 63000);
    }
    if ($MikrotikHTTPSSquidPort == 0) {
        $MikrotikHTTPSSquidPort = rand(9190, 63000);
    }
    if ($MikrotikVirtualIP == null) {
        $MikrotikVirtualIP = "172.16.24.2";
    }
    if ($MikrotikNetMask == null) {
        $MikrotikNetMask = "255.255.255.252";
    }
    if ($MikrotikIPAddr == null) {
        $MikrotikIPAddr = "172.16.24.1";
    }
    if ($MikrotikLAN == null) {
        $MikrotikLAN = "192.168.1.0/24";
    }
    if ($MikrotikLocalInterface == null) {
        $MikrotikLocalInterface = "eth0";
    }
    $ARRAYBT["{apply}"] = "Apply{$t}";
    $ARRAYBT["{save}"] = "Save{$t}";
    $p = Paragraphe_switch_img("{mikrotik_compliance}", "{mikrotik_compliance_explain}", "MikrotikTransparent", $MikrotikTransparent, null, 760);
    $p2 = Paragraphe_switch_img("{mikrotik_ssl_compliance}", "{mikrotik_ssl_compliance_explain}", "MikrotikSSLTransparent", $MikrotikSSLTransparent, null, 760);
    $html = "\n\t<div style='text-align:right'><img src='img/mikrotik-150.png'></div>\n\t<div style='width:95%;padding:30px' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;width:220px'><div id='mikrotik-ipface'></div></td>\n\t\t<td style='vertical-align:top;width:99%;padding-left:30px'>\n\t\n\t\t\t{$p}{$p2}\n\t\t</td>\n\t</table>\n\t<table style='width:100%'>\n\t" . Field_text_table("MikrotikHTTPSquidPort", "{proxy_listen_port}", $MikrotikHTTPSquidPort, 22, null) . Field_text_table("MikrotikHTTPSSquidPort", "{proxy_listen_port} (SSL)", $MikrotikHTTPSSquidPort, 22, null) . Field_list_table("MikrotikLocalInterface", "{local_interface}", $MikrotikLocalInterface, 22, $ipsH) . Field_ipv4_table("MikrotikVirtualIP", "{local_ip_address}", $MikrotikVirtualIP, 22, "{MikrotikVirtualIP}", null) . Field_text_table("MikrotikNetMask", "{netmask}", $MikrotikNetMask, 22) . Field_ipv4_table("MikrotikIPAddr", "{mikrotik_address}", $MikrotikIPAddr, 22, "{mikrotik_address_explain}") . Field_area_table("MikrotikLAN", "{your_network}", $MikrotikLAN, 22, null) . Field_buttons_table_autonome($ARRAYBT, 32) . "\n\t</table>\n\t<div id='mikrotik-config'></div>\n</div>\n\n\n<script>\n\n\tvar xSave{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\t\n\t\tdocument.getElementById('mikrotik-config').innerHTML=res;\n\n\t}\t\n\t\n\t\n\t\n\t\n\n\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('MikrotikSSLTransparent',document.getElementById('MikrotikSSLTransparent').value);\n\t\tXHR.appendData('MikrotikLocalInterface',document.getElementById('MikrotikLocalInterface').value);\n\t\tXHR.appendData('MikrotikTransparent',document.getElementById('MikrotikTransparent').value);\n\t\tXHR.appendData('MikrotikHTTPSquidPort',document.getElementById('MikrotikHTTPSquidPort').value);\n\t\tXHR.appendData('MikrotikHTTPSSquidPort',document.getElementById('MikrotikHTTPSSquidPort').value);\n\t\tXHR.appendData('MikrotikVirtualIP',document.getElementById('MikrotikVirtualIP').value);\n\t\tXHR.appendData('MikrotikNetMask',document.getElementById('MikrotikNetMask').value);\n\t\tXHR.appendData('MikrotikIPAddr',document.getElementById('MikrotikIPAddr').value);\n\t\tXHR.appendData('MikrotikLAN',document.getElementById('MikrotikLAN').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\t\nfunction Apply{$t}(){\t\n\tSave{$t}();\n\tLoadjs('squid.compile.progress.php?restart=yes&ask=yes');\n}\n\t\nSave{$t}();\nLoadAjax('mikrotik-ipface','{$page}?mikrotik-ipface=yes');\n</script>\t\t\t\t\t\n\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function popup(){
	$page=CurrentPageName();
	$sock=new sockets();
	$users=new usersMenus();
	$t=time();
	$SquidGuardIPWeb=$sock->GET_INFO("SquidGuardIPWeb");
	$fulluri=$sock->GET_INFO("SquidGuardIPWeb");
	$SquidGuardServerName=$sock->GET_INFO("SquidGuardServerName");
	
	if(preg_match("#\/(.+?):([0-9]+)\/#",$SquidGuardIPWeb,$re)){$SquidGuardIPWeb="{$re[1]}:{$re[2]}";}
	
	if(preg_match("#(.+?):([0-9]+)#",$SquidGuardIPWeb,$re)){
		$SquidGuardServerName=$re[1];
		$SquidGuardApachePort=$re[2];
	}
	
	if($SquidGuardServerName=="/"){$SquidGuardServerName=null;}
	$html="<div style='width:98%' class=form>
	<table style='width:100%'>
	". Field_ipv4_table("servername_squidguard-$t", "{ipaddr}",$SquidGuardServerName,35).
	Field_button_table_autonome("{apply}", "Save$t()",35)."</table>	
	</div>
<script>
var xSave$t=function(obj){
		YahooWin5Hide();
		RefreshTab('main_dansguardian_mainrules');
	 	Loadjs('dansguardian2.compile.php');
}

function Save$t(){
     var XHR = new XHRConnection();
	 XHR.appendData('servername_squidguard',document.getElementById('servername_squidguard-$t').value);
     XHR.sendAndLoad('$page', 'POST',xSave$t);     	
}
</script>			
";
	
$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html);
	
	
	
}
Exemple #4
0
function general_settings()
{
    $ID = $_GET["ID"];
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $rv = new squid_reverse();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $sslcertificates = $rv->ssl_certificates_list();
    $sslcertificates[null] = "{none}";
    $results = $q->QUERY_SQL("SELECT ID,keys_zone FROM nginx_caches ORDER BY keys_zone LIMIT 0,250");
    $nginx_caches[0] = "{none}";
    while ($ligne2 = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $nginx_caches[$ligne2["ID"]] = $ligne2["keys_zone"];
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_sources WHERE ID='{$ID}'"));
    if (!$q->ok) {
        echo FATAL_ERROR_SHOW_128($q->mysql_error);
        return;
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:28px;padding-bottom:20px'>{main_parameters} {$ligne["ipaddr"]}:{$ligne["port"]}</td></tr>";
    $html[] = Field_text_table("servername-{$t}", "{name}", $ligne["servername"], $fields_size, null, 450);
    $html[] = Field_ipv4_table("ipaddr-{$t}", "{ipaddr}", $ligne["ipaddr"], $fields_size, null, 110);
    $html[] = Field_text_table("port-{$t}", "{inbound_port}", $ligne["port"], $fields_size, null, 110);
    $html[] = Field_text_table("forceddomain-{$t}", "{forceddomain}", $ligne["forceddomain"], $fields_size, null, 450);
    $html[] = Field_text_table("remote_path-{$t}", "{root_directory}", $ligne["remote_path"], $fields_size, null, 450);
    $html[] = Field_list_table("cacheid-{$t}", "{cache_directory}", $ligne["cacheid"], $fields_size, $nginx_caches, null, 450);
    $html[] = Field_list_table("certificate-{$t}", "{certificate}", $ligne["certificate"], $fields_size, $sslcertificates, null, 450);
    $html[] = Field_button_table_autonome("{apply}", "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\t\$('#NGINX_MAIN_TABLE').flexReload();\n\t\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('general-settings','{$ID}');\n\t\tXHR.appendData('servername',document.getElementById('servername-{$t}').value);\n\t\tXHR.appendData('ipaddr',document.getElementById('ipaddr-{$t}').value);\n\t\tXHR.appendData('port',document.getElementById('port-{$t}').value);\n\t\tXHR.appendData('forceddomain',document.getElementById('forceddomain-{$t}').value);\n\t\tvar pp=encodeURIComponent(document.getElementById('remote_path-{$t}').value);\n\t\tXHR.appendData('remote_path',document.getElementById('remote_path-{$t}').value);\n\t\tXHR.appendData('cacheid',document.getElementById('cacheid-{$t}').value);\n\t\tXHR.appendData('certificate',document.getElementById('certificate-{$t}').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Exemple #5
0
function rule_popup()
{
    $md5 = $_GET["md5-id"];
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $rv = new squid_reverse();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $protcols["imap"] = "IMAP";
    $protcols["pop3"] = "POP3";
    $protcols["smtp"] = "SMTP";
    $title = "{new_rule}";
    $bt = "{add}";
    if ($md5 != null) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_mailauth WHERE zmd5='{$md5}'"));
        if (!$q->ok) {
            echo FATAL_ERROR_SHOW_128($q->mysql_error);
            return;
        }
        $title = "{rule} {$ligne["username"]} {$ligne["protocol"]}:{$ligne["backend"]}:{$ligne["port"]}";
        $bt = "{apply}";
    }
    if (!is_numeric($ligne["enabled"])) {
        $ligne["enabled"] = 1;
    }
    if (!is_numeric($ligne["backend_port"])) {
        $ligne["backend_port"] = 143;
    }
    if ($ligne["protocol"] == null) {
        $ligne["protocol"] = "imap";
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:28px;padding-bottom:20px'>{rule} {$ligne["ipaddr"]}:{$ligne["port"]}</td></tr>";
    $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{enable_rule}", "{enable_rule_text}", "enabled-{$t}", $ligne["enabled"], null, 820) . "</td></tr>";
    $html[] = Field_text_table("username-{$t}", "{username}", $ligne["username"], $fields_size, null, 450);
    $html[] = Field_ipv4_table("ipsrc-{$t}", "{src}", $ligne["ipsrc"], $fields_size, null, 110);
    $html[] = Field_text_table("destination-{$t}", "{recipient} SMTP", $ligne["destination"], $fields_size, null, 450);
    $html[] = Field_list_table("protocol-{$t}", "{protocol}", $ligne["protocol"], $fields_size, $protcols, "Check{$t}()");
    $html[] = Field_text_table("backend-{$t}", "{mail_server}", $ligne["backend"], $fields_size, null, 450);
    $html[] = Field_text_table("backend_port-{$t}", "{port}", $ligne["backend_port"], $fields_size, null, 110);
    $html[] = Field_button_table_autonome("{$bt}", "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\t\$('#NGINX_MAIN_MAIL').flexReload();\n\t\tvar md5='{$md5}';\n\t\tif(md5==''){ YahooWinHide();}\n\t\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('zmd5','{$md5}');\n\t\tXHR.appendData('username',encodeURIComponent(document.getElementById('username-{$t}').value));\n\t\tXHR.appendData('ipsrc',encodeURIComponent(document.getElementById('ipsrc-{$t}').value));\n\t\tXHR.appendData('protocol',document.getElementById('protocol-{$t}').value);\n\t\tXHR.appendData('backend',document.getElementById('backend-{$t}').value);\n\t\tXHR.appendData('backend_port',document.getElementById('backend_port-{$t}').value);\n\t\tXHR.appendData('enabled',document.getElementById('enabled-{$t}').value);\n\t\tXHR.appendData('destination',encodeURIComponent(document.getElementById('destination-{$t}').value));\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t\n\tfunction Check{$t}(){\n\t\tvar protocol=document.getElementById('protocol-{$t}').value;\n\t\tif(protocol!=='smtp'){\n\t\t\tdocument.getElementById('destination-{$t}').disabled=true;\n\t\t}else{\n\t\tdocument.getElementById('destination-{$t}').disabled=false;\n\t\t}\n\t\n\t}\n\tCheck{$t}();\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}