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;
    }
    if (preg_match("#(.+?)\\/#", $SquidGuardServerName)) {
        $SquidGuardServerName = $re[1];
    }
    if (preg_match("#^\\/(.+)#", $SquidGuardServerName)) {
        $SquidGuardServerName = $re[1];
    }
    $SquidGuardServerName = str_replace("/", "", $SquidGuardServerName);
    $html = "<div style='width:98%' class=form>\n\t<div class=explain style='font-size:18px'>{servername_squidguard_explain}</div>\n\t<table style='width:100%'>\n\t" . Field_text_table("servername_squidguard-{$t}", "{hostname}", $SquidGuardServerName, 35, null, 450) . Field_button_table_autonome("{apply}", "Save{$t}()", 35) . "</table>\t\n\t</div>\n<script>\nvar xSave{$t}=function(obj){\n\t\tYahooWin5Hide();\n\t\tRefreshTab('main_dansguardian_mainrules');\n\t \tLoadjs('dansguardian2.compile.php');\n}\n\nfunction Save{$t}(){\n     var XHR = new XHRConnection();\n\t XHR.appendData('servername_squidguard',document.getElementById('servername_squidguard-{$t}').value);\n     XHR.sendAndLoad('{$page}', 'POST',xSave{$t});     \t\n}\n</script>\t\t\t\n";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
function wizard_certificate_1()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $hostname = $sock->GET_INFO("myhostname");
    $t = time();
    $ENC[1024] = 1024;
    $ENC[2048] = 2048;
    $ENC[4096] = 4096;
    if ($hostname == null) {
        $hostname = $sock->getFrameWork("system.php?hostname-g=yes");
        $sock->SET_INFO($hostname, "myhostname");
    }
    $title = $tpl->_ENGINE_parse_body("{new_certificate}");
    $html[] = "<div class=text-info style='font-size:18px'>{wizard_certificate_1}<br><i>{CSR_MULTIPLE_EXPLAIN}</i></div>";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("wizard-certificate-commonname", "{CommonName}", $hostname, 22, null, 400);
    $html[] = Field_list_table("wizard-certificate-levelenc", "{level_encryption}", 2048, 22, $ENC);
    $html[] = Field_password_table("wizard-certificate-password", "{password}", "secret", 22, null, 300);
    $html[] = Field_button_table_autonome("{add}", "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\nvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);}\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n\tYahooWin6Hide();\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('wizard-certificate-commonname',encodeURIComponent(document.getElementById('wizard-certificate-commonname').value));\n\tXHR.appendData('wizard-certificate-levelenc',document.getElementById('wizard-certificate-levelenc').value);\n\tXHR.appendData('wizard-certificate-password',encodeURIComponent(document.getElementById('wizard-certificate-password').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
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 popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $t = time();
    $SquidEnableParentNTLM = intval($sock->GET_INFO("SquidEnableParentNTLM"));
    $SquidParentNTLMPort = intval($sock->GET_INFO("SquidParentNTLMPort"));
    $SquidParentNTLMProxy = $sock->GET_INFO("SquidParentNTLMProxy");
    $SquidParentNTLMProxyPort = intval($sock->GET_INFO("SquidParentNTLMProxyPort"));
    $SquidParentNTLMUsername = intval($sock->GET_INFO("SquidParentNTLMUsername"));
    $SquidParentNTLMPassword = intval($sock->GET_INFO("SquidParentNTLMPassword"));
    $SquidParentSayHostname = $sock->GET_INFO("SquidParentSayHostname");
    if ($SquidParentNTLMProxyPort == 0) {
        $SquidParentNTLMProxyPort = 8080;
    }
    if ($SquidParentNTLMPort == 0) {
        $SquidParentNTLMPort = rand(8080, 9090);
    }
    if ($SquidParentSayHostname == null) {
        $SquidParentSayHostname = $sock->getFrameWork("cmd.php?full-hostname=yes");
    }
    $p = Paragraphe_switch_img("{SquidEnableParentNTLM}", "{SquidEnableParentNTLM_text}", "SquidEnableParentNTLM-{$t}", $SquidEnableParentNTLM, null, 750);
    $html = "<table style='width:100%' class=form>\n<tr>\n\t<td valign='top' style=width:240px'><div id='parent-ntlm-status'></div>\n\t" . imgtootltip("refresh-32.png", null, "RefreshServ{$t}()", null) . "\n\t\n\t</td>\n\t<td valign='top' style='width:90%'>\n\t{$p}\n\t<table style='width:100%'>\n\t" . Field_text_table("SquidParentNTLMPort", "{local_listen_port}", $SquidParentNTLMPort, 22, null, 150) . Field_text_table("SquidParentSayHostname", "{hostname}", $SquidParentSayHostname, 22, null, 450) . Field_text_table("SquidParentNTLMProxy", "{remote_proxy}", $SquidParentNTLMProxy, 22, null, 450) . Field_text_table("SquidParentNTLMProxyPort", "{remote_port}", $SquidParentNTLMProxyPort, 22, null, 150) . Field_button_table_autonome("{apply}", "Save{$t}()", 36) . "</table>\n\t</td>\n</tr>\n</table>\n<script>\n\nfunction RefreshServ{$t}(){\n\tLoadAjax('parent-ntlm-status','{$page}?parent-ntlm-status=yes');\n}\n\nvar xSave{$t}= function (obj) {\n\tLoadjs('squid.restart.php?onlySquid=yes&onlyreload=yes&ApplyConfToo=yes&ask=yes',true);\n\tRefreshTab('main_squid_prents_tabs');\n}\t\t\t\n\t\t\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('SquidEnableParentNTLM',document.getElementById('SquidEnableParentNTLM-{$t}').value);\n\tXHR.appendData('SquidParentNTLMPort',document.getElementById('SquidParentNTLMPort').value);\n\tXHR.appendData('SquidParentNTLMProxy',document.getElementById('SquidParentNTLMProxy').value);\n\tXHR.appendData('SquidParentNTLMProxyPort',document.getElementById('SquidParentNTLMProxyPort').value);\n\tXHR.appendData('SquidParentSayHostname',document.getElementById('SquidParentSayHostname').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n}\nRefreshServ{$t}();\n</script>\t   \t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function new_member()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $t = time();
    $html = "<div style='width:98%' class=form>\n\t<div class=explain style='font-size:16px'>{sshd_AllowUsers_explain}</div>\n\t<table style='width:100%'>\n\t\t\t\n\t" . Field_text_table("username-{$t}", "{user2}", null, 22, null, 450) . Field_text_table("domain-{$t}", "{domain}", null, 22, null, 450) . Field_button_table_autonome("{add}", "Save{$t}", 26) . "</table>\n\t<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\t\n\t\tif (res.length>3){\n\t\t\talert(res);\n\t\t\treturn;\n\t\t}\n\t\t\$('#SSHD_ALLOW_TABLE').flexReload();\n\t\tYahooWinHide();\n\t\t\n\t}\t\n\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('username',encodeURIComponent(document.getElementById('username-{$t}').value));\n\t\tXHR.appendData('domain',encodeURIComponent(document.getElementById('domain-{$t}').value));\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n</script>\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemple #6
0
function login()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $failed = $tpl->javascript_parse_text("{failed}");
    $t = time();
    $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t" . Field_text_table("username-{$t}", "{username}", null, 26, "script:SaveCheck{$t}(event)", 400) . Field_password_table("password-{$t}", "{password}", null, 26, "script:SaveCheck{$t}(event)", 400) . Field_button_table_autonome("{submit}", "Save{$t}", 32) . "\n\t\t\t\n\t\t\t\n\t</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length==0){alert('FATAL ERROR');return;};\n\tif(results=='FALSE'){\n\t\talert('{$failed}');\n\t\treturn;\n\t}\n\tAjaxTopMenu('template-top-menus','admin.top.menus.php');\n\tYahooWinBrowseHide();\n}\n\nfunction SaveCheck{$t}(e){\n\tif(!checkEnter(e)){return;}\n\tSave{$t}();\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar pp=encodeURIComponent(document.getElementById('password-{$t}').value);\n\tXHR.appendData('artica_password',pp);\n\tXHR.appendData('artica_username',document.getElementById('username-{$t}').value);\n\tXHR.appendData('VIA_API','1');\n\tXHR.sendAndLoad('logon.php', 'POST',xSave{$t});\n}\n</script>\n";
    echo $tpl->_ENGINE_parse_body($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 new_member(){
	$tpl=new templates();
	$page=CurrentPageName();
	$t=time();
	$html="<div style='width:98%' class=form>
	<div class=text-info style='font-size:16px'>{sshd_AllowUsers_explain}</div>
	<table style='width:100%'>
			
	".Field_text_table("username-$t", "{user2}",null,22,null,450).
	Field_text_table("domain-$t", "{domain}",null,22,null,450).
	Field_button_table_autonome("{add}", "Save$t",26).
	"</table>
	<script>
	var xSave$t= function (obj) {
		var res=obj.responseText;
		
		if (res.length>3){
			alert(res);
			return;
		}
		$('#SSHD_ALLOW_TABLE').flexReload();
		YahooWinHide();
		
	}	

	function Save$t(){
		var XHR = new XHRConnection();
		XHR.appendData('username',encodeURIComponent(document.getElementById('username-$t').value));
		XHR.appendData('domain',encodeURIComponent(document.getElementById('domain-$t').value));
		XHR.sendAndLoad('$page', 'POST',xSave$t);	
	}
</script>	
	";
	
echo $tpl->_ENGINE_parse_body($html);
	
	
	
}
function rule_popup(){
	$dans=new dansguardian_rules();
	$md5=$_GET["rule-popup"];
	$tpl=new templates();
	$page=CurrentPageName();
	$fields_size=22;
	$q=new mysql_squid_builder();
	$sock=new sockets();
	$t=time();
	$bt="{add}";
	if($md5<>null){$bt="{apply}";}
	
	$Timez[0]="{default}";
	$Timez[5]="5 {minutes}";
	$Timez[10]="10 {minutes}";
	$Timez[15]="15 {minutes}";
	$Timez[30]="30 {minutes}";
	$Timez[60]="1 {hour}";
	$Timez[120]="2 {hours}";
	$Timez[240]="4 {hours}";
	$Timez[720]="12 {hours}";
	$Timez[2880]="2 {days}";
	
	$cats=$dans->LoadBlackListes();
	while (list ($num, $ligne) = each ($cats) ){$newcat[$num]=$num;}
	$newcat[null]="{none}";
	$newcat["safebrowsing"]="Google Safe Browsing";
	$newcat["blacklist"]="{blacklist}";
	
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT * FROM ufdb_page_rules WHERE zmd5='$md5'"));
	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[]=Field_list_table("category-$t","{category}",$ligne["category"],$fields_size,$newcat,null,450);
	$html[]=Field_list_table("maxtime-$t","{unlock_during}",$ligne["maxtime"],$fields_size,$Timez,null,450);
	$html[]=Field_text_table("adgroup-$t","{active_directory_group}",$ligne["adgroup"],$fields_size,null,450);
	$html[]=Field_text_table("username-$t","{username}",$ligne["username"],$fields_size,null,450);
	$html[]=Field_checkbox_table("deny-$t", "{deny_unlock}",$ligne["deny"],$fields_size,null,"UnCheckAllow$t()");
	$html[]=Field_checkbox_table("allow-$t", "{allow_unlock}",$ligne["allow"],$fields_size,null,"UnCheckDeny$t()");
	$html[]=Field_checkbox_table("noauth-$t", "{not_authenticate}",$ligne["noauth"],$fields_size);
	$html[]=Field_list_table("addTocat-$t","{automatically_add_to}",$ligne["addTocat"],$fields_size,$newcat,null,450);
	
	
	$html[]=Field_button_table_autonome($bt,"Submit$t",30);
	$html[]="</table>";
	$html[]="</div>
	<script>
	var xSubmit$t= function (obj) {
		var results=obj.responseText;
		if(results.length>3){alert(results);}
		$('#UFDB_PAGE_RULE').flexReload();
	
	}
	
	function UnCheckAllow$t(){
		if(document.getElementById('deny-$t').checked){
			document.getElementById('allow-$t').checked=false;
		}else{
			document.getElementById('allow-$t').checked=true;
		
		}
	
	}
	
	function UnCheckDeny$t(){
		if(document.getElementById('allow-$t').checked){
			document.getElementById('deny-$t').checked=false;
		}else{
			document.getElementById('deny-$t').checked=true;
		}
	}
	
	
	function Submit$t(){
		var XHR = new XHRConnection();
		XHR.appendData('rule','$md5');
		XHR.appendData('category',document.getElementById('category-$t').value);
		XHR.appendData('adgroup',document.getElementById('adgroup-$t').value);
		XHR.appendData('username',document.getElementById('username-$t').value);
		XHR.appendData('addTocat',document.getElementById('addTocat-$t').value);
		XHR.appendData('maxtime',document.getElementById('maxtime-$t').value);
		
		
		
		
		if(document.getElementById('deny-$t').checked){
			XHR.appendData('deny','1');	
		}else{
			XHR.appendData('deny','0');	
		
		}
		if(document.getElementById('allow-$t').checked){
			XHR.appendData('allow','1');	
		}else{
			XHR.appendData('allow','0');	
		
		}	

		if(document.getElementById('noauth-$t').checked){
			XHR.appendData('noauth','1');	
		}else{
			XHR.appendData('noauth','0');	
		
		}		

		XHR.sendAndLoad('$page', 'POST',xSubmit$t);
	}
	
	UnCheckAllow$t();
	</script>
		
	";
	echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function rule_popup()
{
    $ID = intval($_GET["ID"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $bt = "{add}";
    if ($ID > 0) {
        $bt = "{apply}";
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM acls_ntlm WHERE ID='{$ID}'"));
    if (!$q->ok) {
        echo FATAL_ERROR_SHOW_128($q->mysql_error);
        return;
    }
    $title = "{rule}: ({$ID}) {$ligne["item"]}";
    $Timez[0] = "{by_hour}";
    if (!is_numeric($ligne["quotasize"])) {
        $ligne["quotasize"] = 250;
    }
    if (!is_numeric($ligne["quotaPeriod"])) {
        $ligne["quotaPeriod"] = 1;
    }
    if ($ID == 0) {
        $title = $tpl->javascript_parse_text("{new_rule}");
        $ligne["enabled"] = 1;
    }
    $q->acl_NTLM[null] = "{select}";
    $html[] = "<div style='width:98%;font-size:28px;margin-bottom:20px'>{$title}</div>\n\t<div style='margin-top:5px;margin-bottom:20px;font-size:18px'>{whitelist_ntlm_explain}</div>\n\t";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_list_table("type-{$t}", "{type}", $ligne["Type"], $fields_size, $q->acl_NTLM, "ShowHelp{$t}()", 450);
    $html[] = Field_text_table("item-{$t}", "{item}", $ligne["item"], $fields_size, null, 450);
    $html[] = Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], $fields_size, null, "CheckEnabled{$t}()");
    $html[] = "<tr><td colspan=2><div id='help-{$t}'></div></td></tr>";
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#SQUID_NTLM_WHITE').flexReload();\n\tvar ID='{$ID}';\n\tif(ID==0){ YahooWin3Hide();return;}\n\t\n}\nfunction CheckEnabled{$t}(){\n\tdocument.getElementById('type-{$t}').disabled=true;\n\tdocument.getElementById('item-{$t}').disabled=true;\n\tif(document.getElementById('enabled-{$t}').checked){\n\t\tdocument.getElementById('type-{$t}').disabled=false;\n\t\tdocument.getElementById('item-{$t}').disabled=false;\n\t}\n}\n\n\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('item',encodeURIComponent(document.getElementById('item-{$t}').value));\n\tXHR.appendData('type',document.getElementById('type-{$t}').value);\n\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled','1');}else{XHR.appendData('enabled','0');}\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n\nfunction ShowHelp{$t}(){\n\tLoadAjaxTiny('help-{$t}','{$page}?help=yes&type='+document.getElementById('type-{$t}').value+'&t={$t}');\n}\n\nCheckEnabled{$t}();\nShowHelp{$t}();\n</script>\n\n";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function popup_ad()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $md5 = $_GET["md5"];
    $title = $tpl->javascript_parse_text("{new_connection}");
    $btname = "{add}";
    $close = 1;
    $ruleid = $_GET["ruleid"];
    if ($md5 != null) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM hotspot_activedirectory WHERE zmd5='{$md5}'"));
        $title = $ligne["hostname"];
        $ruleid = $ligne["ruleid"];
        $btname = "{apply}";
        $close = 0;
    }
    $Timez[0] = "{unlimited}";
    $Timez[30] = "30 {minutes}";
    $Timez[60] = "1 {hour}";
    $Timez[120] = "2 {hours}";
    $Timez[180] = "3 {hours}";
    $Timez[360] = "6 {hours}";
    $Timez[720] = "12 {hours}";
    $Timez[1440] = "1 {day}";
    $Timez[2880] = "2 {days}";
    $Timez[10080] = "1 {week}";
    $Timez[20160] = "2 {weeks}";
    $Timez[40320] = "1 {month}";
    if (!is_numeric($ligne["enabled"])) {
        $ligne["enabled"] = 1;
    }
    $t = time();
    $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>" . Field_text_table("hostname-{$t}", "{hostname}", $ligne["hostname"], 22, null, 350) . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], $fontsize = 22, null) . "<tr>\n\t\t<td colspan=2 align='right'><hr>" . button($btname, "Save{$t}()", 36) . "</td>\n\t</tr>\n\t</table>\n\t</div>\t\t\t\n<script>\n\t\t\t\t\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\tvar close={$close};\n\tif(close==1){YahooWin4Hide();}\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n\tExecuteByClassName('SearchFunction');\n}\n\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('hostname',document.getElementById('hostname-{$t}').value);\n\tXHR.appendData('ruleid','{$ruleid}');\n\tXHR.appendData('md5','{$md5}');\n\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled',1); }else{XHR.appendData('enabled',0);}\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n\t}\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemple #12
0
function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $you_need_to_compile = $tpl->javascript_parse_text("{you_need_to_compile}");
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_www WHERE servername='{$servername}'"));
    if (!is_numeric($ligne["ssl_backend_port"])) {
        $ligne["ssl_backend_port"] = 443;
    }
    $t = time();
    $ssl_use_rcert = 0;
    $to = null;
    $AS_PEER_CERTIFICATE = 0;
    $AS_PEER_CERTIFICATE_EXPLAIN = null;
    $cache_peer_id = $ligne["cache_peer_id"];
    if ($cache_peer_id > 0) {
        if (!$q->FIELD_EXISTS("reverse_sources", "ssl_remotecert")) {
            $q->QUERY_SQL("ALTER TABLE `reverse_sources` ADD `ssl_remotecert` smallint(1) NOT NULL DEFAULT '0'");
            if (!$q->ok) {
                echo $q->mysql_error_html();
            }
        }
        $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT servername,ssl_remotecert FROM reverse_sources WHERE ID='{$cache_peer_id}'"));
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
        $to = " {to} &laquo;{$ligne2["servername"]}&raquo;";
    }
    if (intval($cache_peer_id) > 0) {
        $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT certificate FROM reverse_sources WHERE ID='{$cache_peer_id}'"));
        if (trim($ligne2["certificate"] != null)) {
            $ligne["certificate"] = $ligne2["certificate"];
            $AS_PEER_CERTIFICATE = 1;
        }
    }
    if ($AS_PEER_CERTIFICATE == 1) {
        $AS_PEER_CERTIFICATE_EXPLAIN = "<div class=explain style=font-size:22px>\n\t\t{reverse_proxy_use_destination_server_certificate}</div>";
    }
    if ($ligne["ssl_protocols"] == null) {
        $ligne["ssl_protocols"] = "TLSv1 TLSv1.1 TLSv1.2";
    }
    if ($ligne["ssl_ciphers"] == null) {
        $ligne["ssl_ciphers"] = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK";
    }
    $html[] = "<div style='width:98%' class=form>{$AS_PEER_CERTIFICATE_EXPLAIN}";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:40px;padding-bottom:20px'>{port}:{$ligne["port"]} &laquo;{$servername}&raquo;{$to}</td></tr>";
    $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{reverse_proxy_ssl}", "{NGINX_USE_SSL_EXPLAIN}", "ssl-{$t}", $ligne["ssl"], null, 1400, "SwitchOffCertificate{$t}") . "</td></tr>";
    $html[] = Field_list_table("certificate-{$t}", "{certificate}", $ligne["certificate"], 28, $sslcertificates, null, 450);
    $html[] = Field_text_table("ssl_protocols-{$t}", "{ssl_protocols}", $ligne["ssl_protocols"], 28, '{ssl_protocols_text}', 600);
    $html[] = Field_text_table("ssl_ciphers-{$t}", "{ssl_ciphers}", $ligne["ssl_ciphers"], 28, null, 900);
    $html[] = "<tr><td colspan=2><p>&nbsp;</p></td></tr>";
    if ($cache_peer_id > 0) {
        $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{destination_use_ssl}", "{NGINX_USE_SSL_EXPLAIN2}", "ssl_backend-{$t}", $ligne["ssl_backend"], null, 1400) . "</td></tr>";
        $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{SSL_CLIENT_VERIFICATION}", "{SSL_CLIENT_VERIFICATION_EXPLAIN}", "ssl_client_certificate-{$t}", $ligne["ssl_client_certificate"], null, 1400) . "</td></tr>";
    }
    $html[] = Field_button_table_autonome("{apply}", "Submit{$t}", 40);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\nvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#NGINX_MAIN_TABLE').flexReload();\n\talert('{$you_need_to_compile}');\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar AS_PEER_CERTIFICATE={$AS_PEER_CERTIFICATE};\n\tXHR.appendData('servername','{$servername}');\n\tXHR.appendData('cache_peer_id','{$cache_peer_id}');\n\tXHR.appendData('ssl',document.getElementById('ssl-{$t}').value);\n\tif(document.getElementById('ssl_backend-{$t}')){\n\t\tXHR.appendData('ssl_backend',document.getElementById('ssl_backend-{$t}').value);\n\t}\n\tif(document.getElementById('ssl_client_certificate-{$t}')){\n\t\tXHR.appendData('ssl_client_certificate',document.getElementById('ssl_client_certificate-{$t}').value);\n\t}\t\n\t\n\t\n\tXHR.appendData('ssl_protocols',document.getElementById('ssl_protocols-{$t}').value);\n\tXHR.appendData('certificate',document.getElementById('certificate-{$t}').value);\n\tXHR.appendData('ssl_ciphers',document.getElementById('ssl_ciphers-{$t}').value);\n\t\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n\nfunction SwitchOffCertificate{$t}(){\n\tvar ssl=document.getElementById('ssl-{$t}').value;\n\t\n}\n\nfunction Check{$t}(){\n\tvar AS_PEER_CERTIFICATE={$AS_PEER_CERTIFICATE};\n\tif( AS_PEER_CERTIFICATE==1){\n\t\tdocument.getElementById('certificate-{$t}').disabled=true;\n\t}\n\tSwitchOffCertificate{$t}();\n}\nCheck{$t}();\n</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Exemple #13
0
function mac_popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $MAC = $_GET["MAC"];
    $btname = "{add}";
    $t = time();
    if ($MAC != null) {
        $btname = "{apply}";
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_nodes WHERE MAC='{$MAC}'"));
    $html = "\n\t\t<div style='width:98%' class=form>\n\t\t<table style='width:100%'>\n\t\t" . Field_text_table("MAC-{$t}", "{ComputerMacAddress}", $ligne["MAC"], 22, null, 350) . Field_text_table("uid-{$t}", "{uid}", $ligne["uid"], 22, null, 350) . Field_text_table("hostname-{$t}", "{hostname}", $ligne["hostname"], 22, null, 350) . Field_button_table_autonome("{$btname}", "Save{$t}()", 32) . "\n\t\t</table>\t\n\t\t</div>\n\t\t\t\t\n<script>\nvar xSave{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);return;}\n\tvar MAC='{$MAC}';\n\t\$('#MAC_TO_UID_TABLE').flexReload();\n\tif(MAC.length==0){YahooWin3Hide();}\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('MAC',  document.getElementById('MAC-{$t}').value);\n\tXHR.appendData('uid',  document.getElementById('uid-{$t}').value);\n\tXHR.appendData('hostname',  document.getElementById('hostname-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\t\t\t\t\t\t\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function rule_parameters()
{
    $ID = $_GET["ID"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM artica_caches WHERE ID='{$ID}'", "artica_backup"));
    $t = time();
    if ($ligne["MaxSizeBytes"] == 0) {
        $ligne["MaxSizeBytes"] = 3145728000;
    }
    $ligne["MaxSizeBytes"] = $ligne["MaxSizeBytes"] / 1024;
    $ligne["MaxSizeBytes"] = $ligne["MaxSizeBytes"] / 1024;
    $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>" . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"]) . Field_text_table("rulename-{$t}", "{rulename}", $ligne["rulename"], 18, null, 250) . Field_text_table("sitename-{$t}", "{sitename}", $ligne["sitename"], 18, null, 250) . Field_text_table("MaxSizeBytes-{$t}", "{max_size} MB", $ligne["MaxSizeBytes"], 18, null, 250) . Field_button_table_autonome("{apply}", "Save{$t}", 26) . "\n\t</table>\n</div>\t\t\n<script>\nvar xSave{$t}=function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\t\$('#squid_enforce_rules_table').flexReload();\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar EnableSquidCacheBoosters=0;\n\tif(document.getElementById('enabled-{$t}').checked){\n\tXHR.appendData('enabled',1);\n\t}else{XHR.appendData('enabled',0);}\n\t\n\tXHR.appendData('ID','{$_GET["ID"]}');\n\tXHR.appendData('MaxSizeBytes',document.getElementById('MaxSizeBytes-{$t}').value)\n\tXHR.appendData('rulename',encodeURIComponent(document.getElementById('rulename-{$t}').value));\n\tXHR.appendData('sitename',encodeURIComponent(document.getElementById('rulename-{$t}').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\t\t\t\t\t\n}\n</script>\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function report_main()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $dans = new dansguardian_rules();
    $cats = $dans->LoadBlackListes();
    while (list($num, $ligne) = each($cats)) {
        $newcat[$num] = $num;
    }
    $newcat[null] = "{none}";
    $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1";
    $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql));
    $mindate = $ligne2["tdate"];
    $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1";
    $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql));
    $maxdate = $ligne2["tdate"];
    $ID = $_GET["ID"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM `squid_reports` WHERE ID='{$ID}'"));
    $t = time();
    $report_days[0] = "{date_range}";
    $report_days[2] = "2 {days}";
    $report_days[7] = "1 {week}";
    $report_days[15] = "2 {weeks}";
    $report_days[-1] = "{current_month}";
    $report_days[30] = "1 {month}";
    $report_days[60] = "2 {months}";
    $report_days[90] = "3 {months}";
    $report_days[180] = "6 {months}";
    $report_days[365] = "1 {year}";
    $report_build_time_start = $ligne["report_build_time_start"];
    $report_build_time_end = $ligne["report_build_time_end"];
    if ($report_build_time_start == 0) {
        $report_build_time_start = $mindate;
    } else {
        $report_build_time_start = date("Y-m-d", $report_build_time_start);
    }
    if ($report_build_time_end == 0) {
        $report_build_time_end = $maxdate;
    } else {
        $report_build_time_end = date("Y-m-d", $report_build_time_end);
    }
    if ($ligne["report_name"] == null) {
        $ligne["report_name"] = "New report";
    }
    $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t" . Field_text_table("report_name-{$t}", "{report}", utf8_encode($ligne["report_name"]), 18, null, 350) . Field_text_table("description-{$t}", "{description}", utf8_encode($ligne["description"]), 18, null, 350) . Field_list_table("report_type-{$t}", "{type}", $ligne["report_type"], 18, $q->report_types) . Field_list_table("report_days-{$t}", "{from_the_last_time}", $ligne["report_days"], 18, $report_days, "ReportDaysCheck()") . "<tr>\n\t\t<td style='font-size:18px' class=legend>{from_date}:</td>\n\t\t<td>" . field_date("report_build_time_start-{$t}", $report_build_time_start, "font-size:18px;padding:3px;width:120px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t</tr>\n<tr>\n\t\t<td style='font-size:18px' class=legend>{to_date}:</td>\n\t\t<td>" . field_date("report_build_time_end-{$t}", $report_build_time_end, "font-size:18px;padding:3px;width:120px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t</tr>\t\t" . Field_checkbox_table("recategorize-{$t}", "{recategorize}", $ligne["recategorize"], 18) . Field_checkbox_table("categorize-{$t}", "{categorize}", $ligne["categorize"], 18) . Field_checkbox_table("report_not_categorized-{$t}", "{report_not_categorized}", $ligne["report_not_categorized"], 18) . Field_button_table_autonome("{apply}", "Save{$t}", 26) . "</table>\n\t</div>\t\n<script>\n\n\tvar xSave{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\t\n\t\tif (res.length>3){\n\t\t\talert(res);\n\t\t\treturn;\n\t\t}\n\t\t\$('#SQUID_MAIN_REPORTS').flexReload();\n\t\tRefreshTab('report_single_tab');\n\t}\t\n\t\n\tfunction ReportDaysCheck(){\n\t\tdocument.getElementById('report_build_time_start-{$t}').disabled=true;\n\t\tdocument.getElementById('report_build_time_end-{$t}').disabled=true;\n\t\tvar report_days=document.getElementById('report_days-{$t}').value;\n\t\tif(report_days==0){\n\t\t\tdocument.getElementById('report_build_time_start-{$t}').disabled=false;\n\t\t\tdocument.getElementById('report_build_time_end-{$t}').disabled=false;\t\t\n\t\t}\n\t}\n\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\tXHR.appendData('ID',{$ID});\n\t\tXHR.appendData('report_name',encodeURIComponent(document.getElementById('report_name-{$t}').value));\n\t\tXHR.appendData('description',encodeURIComponent(document.getElementById('description-{$t}').value));\n\t\t\n\t\tXHR.appendData('report_build_time_start',document.getElementById('report_build_time_start-{$t}').value);\n\t\tXHR.appendData('report_build_time_end',document.getElementById('report_build_time_end-{$t}').value);\n\t\t\n\t\tXHR.appendData('report_type',document.getElementById('report_type-{$t}').value);\n\t\tXHR.appendData('report_days',document.getElementById('report_days-{$t}').value);\n\t\tif(document.getElementById('recategorize-{$t}').checked){XHR.appendData('recategorize',1);}else{XHR.appendData('recategorize',0);}\n\t\tif(document.getElementById('categorize-{$t}').checked){XHR.appendData('categorize',1);}else{XHR.appendData('categorize',0);}\n\t\tif(document.getElementById('report_not_categorized-{$t}').checked){XHR.appendData('report_not_categorized',1);}else{XHR.appendData('report_not_categorized',0);}\n\t\t\n\t\t\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\t\nReportDaysCheck();\n</script>\n\t\t\t\n\t\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemple #16
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));
}
function certificate_edit_settings()
{
    $commonName = $_GET["CommonName"];
    $commonNameADD = null;
    $q = new mysql();
    $db = file_get_contents(dirname(__FILE__) . '/ressources/databases/ISO-3166-Codes-Countries.txt');
    $tbl = explode("\n", $db);
    while (list($num, $ligne) = each($tbl)) {
        if (preg_match('#(.+?);\\s+([A-Z]{1,2})#', $ligne, $regs)) {
            $regs[2] = trim($regs[2]);
            $regs[1] = trim($regs[1]);
            $array_country_codes["{$regs[1]}_{$regs[2]}"] = $regs[1];
        }
    }
    $ENC[1024] = 1024;
    $ENC[2048] = 2048;
    $ENC[4096] = 4096;
    if (!$q->FIELD_EXISTS("sslcertificates", "UsePrivKeyCrt", "artica_backup")) {
        $sql = "ALTER TABLE `sslcertificates` ADD `UsePrivKeyCrt` smallint(1) DEFAULT 0";
        $q->QUERY_SQL($sql, 'artica_backup');
    }
    $tpl = new templates();
    $choose_UsePrivKeyCrt = $tpl->javascript_parse_text("{choose_UsePrivKeyCrt}");
    $sql = "SELECT * FROM sslcertificates WHERE CommonName='{$commonName}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if ($ligne["UseGodaddy"] == 1) {
        $ligne["UsePrivKeyCrt"] = 1;
        $commonNameADD = " (Godaddy)";
    }
    if ($ligne["UsePrivKeyCrt"] == 0) {
        if ($ligne["CountryName"] == null) {
            $ligne["CountryName"] = "UNITED STATES_US";
        }
        if ($ligne["stateOrProvinceName"] == null) {
            $ligne["stateOrProvinceName"] = "New York";
        }
        if ($ligne["localityName"] == null) {
            $ligne["localityName"] = "Brooklyn";
        }
        if ($ligne["emailAddress"] == null) {
            $ligne["emailAddress"] = "*****@*****.**";
        }
        if ($ligne["OrganizationName"] == null) {
            $ligne["OrganizationName"] = "MyCompany Ltd";
        }
        if ($ligne["OrganizationalUnit"] == null) {
            $ligne["OrganizationalUnit"] = "IT service";
        }
        if (!is_numeric($ligne["CertificateMaxDays"])) {
            $ligne["CertificateMaxDays"] = 730;
        }
        if (!is_numeric($ligne["levelenc"])) {
            $ligne["levelenc"] = 1024;
        }
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $hostname = $sock->GET_INFO("myhostname");
    $choose_UsePrivKeyCrt = $tpl->javascript_parse_text("{choose_UsePrivKeyCrt}");
    $t = time();
    $ENC[1024] = 1024;
    $ENC[2048] = 2048;
    $ENC[4096] = 4096;
    $commonNameEnc = urlencode($commonName);
    $bt_name = "{apply}";
    if (strlen($ligne["pkcs12"]) > 50) {
        $cleint_certificate = "<div style='float:right;width:30%;text-align:right;margin:5px'>\n\t\t\t<center>\n\t\t\t<a href=\"{$page}?pkcs12=yes&CommonName=" . urlencode($_GET["CommonName"]) . "\">\n\t\t\t\t<img src='img/certificate-128.png'>\n\t\t\t</a><br>\n\t\t\t<span style='font-size:18px'>PKCS12 {client_certificate}</span> \n\t\t\t</center>\n\t\t\t</div>";
    }
    if ($ligne["UsePrivKeyCrt"] == 0) {
        $bt_name = "{generate_x509}";
    }
    $html[] = "<div style='font-size:42px;margin-bottom:15px'>{$commonName}{$commonNameADD}</div>";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    if ($ligne["UsePrivKeyCrt"] == 0) {
        $html[] = "<tr><td colspan=2>{$cleint_certificate}" . Paragraphe_switch_img("{UsePrivKeyCrt}", "{UsePrivKeyCrt_text}", "UsePrivKeyCrt", $ligne["UsePrivKeyCrt"], null, 820) . "</td></tr>";
        $html[] = Field_list_table("CountryName-{$t}", "{countryName}", $ligne["CountryName"], 22, $array_country_codes);
        $html[] = Field_text_table("stateOrProvinceName", "{stateOrProvinceName}", $ligne["stateOrProvinceName"], 22, null, 400);
        $html[] = Field_text_table("localityName", "{localityName}", $ligne["localityName"], 22, null, 400);
        $html[] = Field_text_table("OrganizationName", "{organizationName}", $ligne["OrganizationName"], 22, null, 400);
        $html[] = Field_text_table("OrganizationalUnit", "{organizationalUnitName}", $ligne["OrganizationalUnit"], 22, null, 400);
        $html[] = Field_text_table("emailAddress", "{emailAddress}", $ligne["emailAddress"], 22, null, 400);
        $html[] = Field_text_table("CertificateMaxDays", "{CertificateMaxDays} ({days})", $ligne["CertificateMaxDays"], 22, null, 150);
        $html[] = Field_list_table("levelenc", "{level_encryption}", $ligne["levelenc"], 22, $ENC);
        $html[] = Field_password_table("password-{$t}", "{password}", $ligne["password"], 22, null, 300);
        $html[] = Field_button_table_autonome($bt_name, "Submit{$t}", 30);
    } else {
        $html[] = "<tr>\n\t\t<td class=legend style='font-size:22px'>{countryName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["CountryName"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{stateOrProvinceName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["stateOrProvinceName"]}</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{localityName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["localityName"]}</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{organizationName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["OrganizationName"]}</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{organizationalUnitName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["OrganizationalUnit"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{emailAddress}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["emailAddress"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{level_encryption}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["levelenc"]}</td>\n\t\t</tr>\t\t";
    }
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\t\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\t\$('#TABLE_CERTIFICATE_CENTER_MAIN').flexReload();\n\t\tvar UsePrivKeyCrt=document.getElementById('UsePrivKeyCrt').value;\n\t\tif(UsePrivKeyCrt==1){\n\t\t\tLoadjs('openssl.x509.progress.php?generate-x509={$commonNameEnc}');\n\t\t}else{\n\t\t\tLoadjs('openssl.CSR.progress.php?generate-csr={$commonNameEnc}');\n\t\t}\n\t\tYahooWin6Hide();\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\t\n\tXHR.appendData('CommonName',encodeURIComponent('{$_GET["CommonName"]}'));\n\tXHR.appendData('UsePrivKeyCrt',document.getElementById('UsePrivKeyCrt').value);\n\tXHR.appendData('CountryName',document.getElementById('CountryName-{$t}').value);\n\t\n\tXHR.appendData('CertificateMaxDays',document.getElementById('CertificateMaxDays').value);\n\tXHR.appendData('stateOrProvinceName',document.getElementById('stateOrProvinceName').value);\n\tXHR.appendData('localityName',document.getElementById('localityName').value);\n\tXHR.appendData('OrganizationName',document.getElementById('OrganizationName').value);\n\tXHR.appendData('OrganizationalUnit',document.getElementById('OrganizationalUnit').value);\n\tXHR.appendData('emailAddress',document.getElementById('emailAddress').value);\n\tXHR.appendData('levelenc',document.getElementById('levelenc').value);\n\tXHR.appendData('password',encodeURIComponent(document.getElementById('password-{$t}').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\n\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Exemple #18
0
function main()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $rv = new squid_reverse();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $title = "{new_webserver}";
    $bt = "{add}";
    $t = time();
    FORM_START();
    $q = new mysql_squid_builder();
    $squid_reverse = new squid_reverse();
    $tpl = new templates();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $sources_list = $squid_reverse->sources_list();
    $array = $sources_list[0];
    $array2 = $sources_list[1];
    $CountDeSources = $sources_list[2];
    $nginx_caches = $squid_reverse->caches_list();
    $nginx_pools = $squid_reverse->pool_list();
    $nginx_replaces = $squid_reverse->replace_list();
    $AsFReeWeb = false;
    $EnableFreeWeb = $sock->GET_INFO("EnableFreeWeb");
    if ($servername != null) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_www WHERE servername='{$servername}'"));
        $title = $tpl->_ENGINE_parse_body("{port}:{$ligne["port"]} &laquo;{$servername}&raquo;");
        $bt = "{apply}";
        $Hidden = Field_hidden("servername-edit-{$t}", $servername) . $servername;
    } else {
        $ligne["enabled"] = 1;
        $Hidden = Field_text("servername-edit-{$t}", null, "font-size:18px;width:300px");
        FORM_CLOSE("YahooWin");
    }
    if (!is_numeric($ligne["port"])) {
        $ligne["port"] = 80;
    }
    if (!is_numeric($ligne["ArticaErrors"])) {
        $ligne["ArticaErrors"] = 1;
    }
    if ($servername == null) {
        $ligne["cache_peer_id"] = -1;
    }
    if (!is_numeric($EnableFreeWeb)) {
        $EnableFreeWeb = 0;
    }
    if ($ligne["cache_peer_id"] == 0) {
        if ($EnableFreeWeb == 1) {
            $q2 = new mysql();
            $ligne2 = mysql_fetch_array($q2->QUERY_SQL("SELECT `useSSL`,`sslcertificate` FROM `freeweb` WHERE `servername`='{$servername}'", "artica_backup"));
            $ligne["certificate"] = $ligne2["sslcertificate"];
            $AsFReeWeb = true;
            $title = $tpl->_ENGINE_parse_body("FreeWeb &laquo;{$servername}&raquo;");
        } else {
            $ligne["cache_peer_id"] = -1;
        }
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:22px'>{reverse_proxy}:</td></tr>";
    $html[] = "<tr><td class=legend style='font-size:18px'>{webserver}:</td>";
    $html[] = "<td style='font-size:18px'>{$Hidden}</td></tr>";
    $html[] = Field_checkbox_table("owa-{$t}", "{protect_owa}", $ligne["owa"], 18);
    $html[] = Field_checkbox_table("debug-{$t}", "{debug}", $ligne["debug"], 18);
    $html[] = Field_list_table("cacheid-{$t}", "{cache}", $ligne["cacheid"], 18, $nginx_caches);
    $html[] = Field_list_table("replaceid-{$t}", "{replace_rule}", $ligne["replaceid"], 18, $nginx_replaces);
    if ($ligne["cache_peer_id"] == 0) {
        $html[] = Field_hidden("cache_peer_id-{$t}", 0);
        $html[] = Field_hidden("enabled-{$t}", 1);
        $html[] = Field_hidden("certificate-{$t}", $ligne["certificate"]);
    } else {
        if (!AdminPrivs()) {
            $html[] = Field_hidden("cache_peer_id-{$t}", $ligne["cache_peer_id"]);
            $html[] = Field_hidden("start_directory-{$t}", $ligne["start_directory"]);
        } else {
            $html[] = Field_list_table("cache_peer_id-{$t}", "{destination}", $ligne["cache_peer_id"], 18, $array);
            $html[] = Field_text_table("start_directory-{$t}", "{start_path}", $ligne["start_directory"], 18, null, 300);
        }
        $html[] = Field_list_table("poolid-{$t}", "{pool}", $ligne["poolid"], 18, $nginx_pools);
        $html[] = Field_text_table("RedirectQueries-{$t}", "{RedirectQueries}", $ligne["RedirectQueries"], 18, null, 300);
        $html[] = Field_checkbox_table("ArticaErrors-{$t}", "{enable_template_errors}", $ligne["ArticaErrors"], 18);
        if ($CountDeSources == 0) {
            $html[] = "<tr><td colspan=2><p class=text-error>{you_need_to_define_sources_first}</p></td></tr>";
            FORM_LOCK();
        }
    }
    $html[] = Field_button_table($bt);
    echo $tpl->_ENGINE_parse_body(FORM_END(CurrentPageName(), $html));
}
Exemple #19
0
function cache_popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $title = "{new_cache}";
    $bt = "{add}";
    $ID = $_GET["ID"];
    $sock = new sockets();
    $t = time();
    if (!is_numeric($ID)) {
        $ID = 0;
    }
    $NginxProxyStorePath = $sock->GET_INFO("NginxProxyStorePath");
    if ($NginxProxyStorePath == null) {
        $NginxProxyStorePath = "/home/nginx";
    }
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_caches WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["keys_zone"]}";
    }
    if ($ligne["keys_zone"] == null) {
        $ligne["keys_zone"] = time();
    }
    if (trim($ligne["directory"]) == null) {
        $ligne["directory"] = $NginxProxyStorePath . "/{$ligne["keys_zone"]}";
    }
    if ($ligne["levels"] == null) {
        $ligne["levels"] = "1:2";
    }
    if (!is_numeric($ligne["keys_zone_size"])) {
        $ligne["keys_zone_size"] = 1;
    }
    if (!is_numeric($ligne["max_size"])) {
        $ligne["max_size"] = 2;
    }
    if (!is_numeric($ligne["inactive"])) {
        $ligne["inactive"] = 10;
    }
    if (!is_numeric($ligne["loader_files"])) {
        $ligne["loader_files"] = 100;
    }
    if (!is_numeric($ligne["loader_sleep"])) {
        $ligne["loader_sleep"] = 10;
    }
    if (!is_numeric($ligne["loader_threshold"])) {
        $ligne["loader_threshold"] = 100;
    }
    $fontsize = 22;
    $html[] = "<div style='width:100%;font-size:28px;margin-bottom:20px'>{$title}</div>";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("keys_zone-{$t}", "{name}", $ligne["keys_zone"], $fontsize, null, 450);
    $html[] = Field_text_table("directory-{$t}", "{directory}", $ligne["directory"], $fontsize, null, 450);
    $html[] = Field_text_table("levels-{$t}", "{levels}", $ligne["levels"], $fontsize, null, 110);
    $html[] = Field_text_table("keys_zone_size-{$t}", "{memory_size} (MB)", $ligne["keys_zone_size"], $fontsize, null, 110);
    $html[] = Field_text_table("max_size-{$t}", "{max_size} (GB)", $ligne["max_size"], $fontsize, null, 110);
    $html[] = Field_text_table("inactive-{$t}", "{inactive} ({minutes})", $ligne["inactive"], $fontsize, "{nginx_inactive_explain}", 110);
    $html[] = Field_text_table("loader_files-{$t}", "{loader_files}", $ligne["loader_files"], $fontsize, null, 110);
    $html[] = Field_text_table("loader_sleep-{$t}", "{loader_sleep} {milliseconds}", $ligne["loader_sleep"], $fontsize, null, 110);
    $html[] = Field_text_table("loader_threshold-{$t}", "{loader_threshold} {milliseconds}", $ligne["loader_threshold"], $fontsize, null, 110);
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\nvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tvar ID={$ID};\n\tif(results.length>3){alert(results);}\n\t\$('#NGINX_CACHE_TABLE').flexReload();\n\tif(ID==0){ YahooWin4Hide();}\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('save-cache','{$ID}');\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('keys_zone',document.getElementById('keys_zone-{$t}').value);\n\tXHR.appendData('directory',document.getElementById('directory-{$t}').value);\n\tXHR.appendData('levels',document.getElementById('levels-{$t}').value);\n\tXHR.appendData('keys_zone_size',document.getElementById('keys_zone_size-{$t}').value);\n\tXHR.appendData('max_size',document.getElementById('max_size-{$t}').value);\n\tXHR.appendData('inactive',document.getElementById('inactive-{$t}').value);\n\tXHR.appendData('loader_files',document.getElementById('loader_files-{$t}').value);\n\tXHR.appendData('loader_sleep',document.getElementById('loader_sleep-{$t}').value);\n\tXHR.appendData('loader_threshold',document.getElementById('loader_threshold-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n</script>\n";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function group_popup()
{
    $ID = $_GET["ID"];
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $title = "{new_group}";
    $bt = "{add}";
    $t = time();
    if (!$q->TABLE_EXISTS("nginx_exploits_groups")) {
        $sql = "CREATE TABLE IF NOT EXISTS `nginx_exploits_groups` (\n\t\t\t  `ID` INT NOT NULL AUTO_INCREMENT,\n\t\t\t  `groupname` CHAR(255)  NOT NULL,\n\t\t\t  PRIMARY KEY (`ID`),\n\t\t\t  KEY `groupname` (`groupname`)\n\t\t\t)  ENGINE = MYISAM;";
        if (!$q->QUERY_SQL($sql)) {
            echo $q->mysql_error_html();
        }
    }
    $sock = new sockets();
    if ($ID > 0) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_exploits_groups WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = utf8_encode("{$ligne["groupname"]}");
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr style='height:75px'><td colspan=2 style='font-size:36px;margin-bottom:40px'>{$title}</td></tr>";
    $html[] = Field_checkbox_table("addef-{$t}", "{add_defaults}", 0, 26);
    $html[] = Field_text_table("groupname-{$t}", "{groupname}", $ligne["groupname"], 26, null, 450);
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<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_ANTI_EXPLOITS').flexReload();\n\t\tvar ID={$ID};\n\t\tif(ID==0){ YahooWin5Hide();}\n\t\t\n\t}\n\n\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\t\n\t\tXHR.appendData('editgroupid','{$ID}');\n\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\tXHR.appendData('groupname',encodeURIComponent(document.getElementById('groupname-{$t}').value));\n\t\tif(document.getElementById('addef-{$t}').checked){ XHR.appendData('addef',1); }else{ XHR.appendData('addef',0); }\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\t\n\t}\n</script>";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function rule_popup()
{
    $ID = intval($_GET["ID"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $bt = "{add}";
    if ($ID > 0) {
        $bt = "{apply}";
    }
    $Timez[1] = "{by_hour}";
    $Timez[2] = "{by_day}";
    $Timez[3] = "{by_week}";
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilter_quotas WHERE ID='{$ID}'"));
    if (!$q->ok) {
        echo FATAL_ERROR_SHOW_128($q->mysql_error);
        return;
    }
    $Timez[0] = "{by_hour}";
    if (!is_numeric($ligne["quotasize"])) {
        $ligne["quotasize"] = 250;
    }
    if (!is_numeric($ligne["quotaPeriod"])) {
        $ligne["quotaPeriod"] = 1;
    }
    if ($ligne["groupname"] == null) {
        $ligne["groupname"] = $tpl->javascript_parse_text("{new_rule}");
        $ligne["enabled"] = 1;
        $ligne["zOrder"] = 0;
    }
    $html[] = "<div style='width:98%;font-size:28px;margin-bottom:20px'>{rule}: ({$ID}) {$ligne["groupname"]}</div>";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("groupname-{$t}", "{rulename}", $ligne["groupname"], $fields_size, null, 450);
    $html[] = Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], $fields_size, null, "CheckEnabled{$t}()");
    $html[] = Field_text_table("zorder-{$t}", "{order}", $ligne["zOrder"], $fields_size, null, 110);
    $html[] = Field_text_table("quotasize-{$t}", "{max_size} MB", $ligne["quotasize"], $fields_size, null, 110);
    $html[] = Field_list_table("quotaPeriod-{$t}", "{period}", $ligne["quotaPeriod"], $fields_size, $Timez, null, 450);
    $html[] = Field_checkbox_table("AllSystems-{$t}", "{AllSystems}", $ligne["AllSystems"], $fields_size, null, "blur()");
    $html[] = Field_checkbox_table("UseExternalWebPage-{$t}", "{UseExternalWebPage}", $ligne["UseExternalWebPage"], $fields_size, null, "UnCheckUseExternalWebPage{$t}()");
    $html[] = Field_text_table("ExternalWebPage-{$t}", "{ExternalWebPage}", $ligne["ExternalWebPage"], $fields_size, null, 450);
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\nvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#SQUID_ARTICA_QUOTA_RULES').flexReload();\n\tvar ID='{$ID}';\n\tif(ID==0){ YahooWin3Hide();return;}\n\tRefreshTab('main_quota_rule_{$ID}');\n}\n\t\n\n\t\nfunction UnCheckUseExternalWebPage{$t}(){\n\tif(!document.getElementById('enabled-{$t}').checked){return;}\n\tif(document.getElementById('UseExternalWebPage-{$t}').checked){\n\t\tdocument.getElementById('ExternalWebPage-{$t}').disabled=false;\n\t}else{\n\t\tdocument.getElementById('ExternalWebPage-{$t}').disabled=true;\n\t}\n}\n\nfunction CheckEnabled{$t}(){\n\tdocument.getElementById('ExternalWebPage-{$t}').disabled=true;\n\tdocument.getElementById('UseExternalWebPage-{$t}').disabled=true;\n\tdocument.getElementById('groupname-{$t}').disabled=true;\n\tdocument.getElementById('zorder-{$t}').disabled=true;\n\tdocument.getElementById('quotasize-{$t}').disabled=true;\n\tdocument.getElementById('quotaPeriod-{$t}').disabled=true;\n\tdocument.getElementById('AllSystems-{$t}').disabled=true;\n\tif(document.getElementById('enabled-{$t}').checked){\n\t\tdocument.getElementById('ExternalWebPage-{$t}').disabled=false;\n\t\tdocument.getElementById('UseExternalWebPage-{$t}').disabled=false;\n\t\tdocument.getElementById('groupname-{$t}').disabled=false;\n\t\tdocument.getElementById('quotasize-{$t}').disabled=false;\n\t\tdocument.getElementById('quotaPeriod-{$t}').disabled=false;\n\t\tdocument.getElementById('AllSystems-{$t}').disabled=false;\n\t\tdocument.getElementById('zorder-{$t}').disabled=false;\n\t}\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('groupname',encodeURIComponent(document.getElementById('groupname-{$t}').value));\n\tXHR.appendData('quotasize',document.getElementById('quotasize-{$t}').value);\n\tXHR.appendData('quotaPeriod',document.getElementById('quotaPeriod-{$t}').value);\n\tXHR.appendData('ExternalWebPage',encodeURIComponent(document.getElementById('ExternalWebPage-{$t}').value));\n\tXHR.appendData('zorder',document.getElementById('zorder-{$t}').value);\n\tif(document.getElementById('AllSystems-{$t}').checked){XHR.appendData('AllSystems','1');}else{XHR.appendData('AllSystems','0');}\n\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled','1');}else{XHR.appendData('enabled','0');}\n\tif(document.getElementById('UseExternalWebPage-{$t}').checked){XHR.appendData('UseExternalWebPage','1');}else{XHR.appendData('UseExternalWebPage','0');}\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t\n\t\n\tUnCheckUseExternalWebPage{$t}();\n\tCheckEnabled{$t}();\n</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function websites_popup_webserver_replace_popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $title = "{new_rule}";
    $bt = "{add}";
    $ID = intval($_GET["replaceid"]);
    $boot = new boostrap_form();
    $sock = new sockets();
    $servername = $_GET["servername"];
    $t = time();
    $fields_size = 22;
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_replace_www WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["rulename"]}";
        $ligne["stringtosearch"] = stripslashes($ligne["stringtosearch"]);
        $ligne["replaceby"] = stripslashes($ligne["replaceby"]);
        $servername = $ligne["servername"];
    }
    if ($ligne["tokens"] == null) {
        $ligne["tokens"] = "gir";
    }
    if ($ligne["rulename"] == null) {
        $ligne["rulename"] = time();
    }
    $html[] = "<div style='width:98%' class=form><div style='font-size:30px;margin-bottom:20px'>{$title}</div>\n\t<div class=explain style='font-size:18px'>{nginx_subst_explain}</div>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("rulename-{$t}", "{rulename}", $ligne["rulename"], $fields_size, null, 450);
    $html[] = Field_text_table("zorder-{$t}", "{order}", intval($ligne["zorder"]), $fields_size, null, 110);
    $html[] = Field_area_table("stringtosearch-{$t}", "{search}", $ligne["stringtosearch"], $fields_size, null, 145);
    $html[] = Field_checkbox_table("AsRegex-{$t}", "{regex}", $ligne["AsRegex"], $fields_size, "{replace_regex_explain}");
    $html[] = Field_area_table("replaceby-{$t}", "{replace}", $ligne["replaceby"], $fields_size, null, 145);
    $html[] = Field_text_table("tokens-{$t}", "{flags}", $ligne["tokens"], $fields_size, null);
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\n\tvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);}\n\t\$('#NGINX_MAIN_TABLE').flexReload();\n\t\$('#NGINX_REPLACE_RULES').flexReload();\n\tvar ID={$ID}\n\tif(ID==0){ YahooWin3Hide();}\n\t\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar AsRegex=0\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('replaceid','{$ID}');\n\tif(document.getElementById('AsRegex-{$t}').checked){AsRegex=1;}\n\tXHR.appendData('servername','{$servername}');\n\tXHR.appendData('rulename',encodeURIComponent(document.getElementById('rulename-{$t}').value));\n\tXHR.appendData('zorder',document.getElementById('zorder-{$t}').value);\n\tXHR.appendData('stringtosearch',encodeURIComponent(document.getElementById('stringtosearch-{$t}').value));\n\tXHR.appendData('replaceby',encodeURIComponent(document.getElementById('replaceby-{$t}').value));\n\tXHR.appendData('AsRegex',AsRegex);\n\tXHR.appendData('tokens',document.getElementById('tokens-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function rule_popup()
{
    $dans = new dansguardian_rules();
    $md5 = $_GET["rule-popup"];
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $bt = "{add}";
    if ($md5 != null) {
        $bt = "{apply}";
    }
    $Timez[0] = "{default}";
    $Timez[5] = "5 {minutes}";
    $Timez[10] = "10 {minutes}";
    $Timez[15] = "15 {minutes}";
    $Timez[30] = "30 {minutes}";
    $Timez[60] = "1 {hour}";
    $Timez[120] = "2 {hours}";
    $Timez[240] = "4 {hours}";
    $Timez[720] = "12 {hours}";
    $Timez[2880] = "2 {days}";
    $cats = $dans->LoadBlackListes();
    while (list($num, $ligne) = each($cats)) {
        $newcat[$num] = $num;
    }
    $newcat[null] = "{all_categories}";
    $newcat["safebrowsing"] = "Google Safe Browsing";
    $newcat["blacklist"] = "{blacklist}";
    $newcat["generic"] = "{generic}";
    if (!$q->FIELD_EXISTS("ufdb_page_rules", "ticket")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `ticket` smallint(1) NOT NULL DEFAULT 0, ADD INDEX ( `ticket` )");
    }
    if (!$q->FIELD_EXISTS("ufdb_page_rules", "ticket")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `ticket` smallint(1) NOT NULL DEFAULT 0, ADD INDEX ( `ticket` )");
    }
    if (!$q->FIELD_EXISTS("ufdb_page_rules", "webruleid")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `webruleid` INT(10) NOT NULL NOT NULL DEFAULT 0, ADD INDEX ( `webruleid` )");
    }
    $sql = "SELECT ID,groupname FROM webfilter_rules WHERE enabled=1";
    $results = $q->QUERY_SQL($sql);
    $RULES["0"] = "{all_rules}";
    $btname = "{add}";
    $t = time();
    while ($ligne = mysql_fetch_assoc($results)) {
        $RULES[$ligne["ID"]] = "{$ligne["groupname"]}";
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM ufdb_page_rules WHERE zmd5='{$md5}'"));
    $group_legend = "{active_directory_group}";
    if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
        $group_legend = "{ldap_group}";
    }
    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[] = Field_list_table("webruleid-{$t}", "{rule}", $ligne["webruleid"], $fields_size, $RULES, null, 450);
    $html[] = Field_list_table("category-{$t}", "{category}", $ligne["category"], $fields_size, $newcat, null, 450);
    $html[] = Field_list_table("maxtime-{$t}", "{unlock_during}", $ligne["maxtime"], $fields_size, $Timez, null, 450);
    $html[] = Field_text_table("adgroup-{$t}", "{$group_legend}", $ligne["adgroup"], $fields_size, null, 450);
    if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
        $html[] = Field_button_table_autonome("{browse}", "Loadjs('browse-extldap-groups.php?MainFunction=FdapGroup{$t}')");
    }
    $html[] = Field_text_table("username-{$t}", "{username}", $ligne["username"], $fields_size, null, 450);
    $html[] = Field_checkbox_table("deny-{$t}", "{deny_unlock}", $ligne["deny"], $fields_size, null, "UnCheckAllow{$t}()");
    $html[] = Field_checkbox_table("allow-{$t}", "{allow_unlock}", $ligne["allow"], $fields_size, null, "UnCheckDeny{$t}()");
    $html[] = Field_checkbox_table("ticket-{$t}", "{submit_ticket}", $ligne["ticket"], $fields_size, null, "UnTicket{$t}()");
    $html[] = Field_checkbox_table("noauth-{$t}", "{not_authenticate}", $ligne["noauth"], $fields_size);
    $html[] = Field_list_table("addTocat-{$t}", "{automatically_add_to}", $ligne["addTocat"], $fields_size, $newcat, null, 450);
    $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\$('#UFDB_PAGE_RULE').flexReload();\n\t\n\t}\n\t\n\tfunction UnCheckAllow{$t}(){\n\t\tif(document.getElementById('deny-{$t}').checked){\n\t\t\tdocument.getElementById('allow-{$t}').checked=false;\n\t\t}else{\n\t\t\tdocument.getElementById('allow-{$t}').checked=true;\n\t\t\n\t\t}\n\t\n\t}\n\t\n\tfunction UnCheckDeny{$t}(){\n\t\tif(document.getElementById('allow-{$t}').checked){\n\t\t\tdocument.getElementById('deny-{$t}').checked=false;\n\t\t}else{\n\t\t\tdocument.getElementById('deny-{$t}').checked=true;\n\t\t}\n\t}\n\t\n\tfunction UnTicket{$t}(){\n\t\tif(document.getElementById('ticket-{$t}').checked){\n\t\t\tdocument.getElementById('deny-{$t}').checked=true;\n\t\t\tdocument.getElementById('allow-{$t}').checked=false;\n\t\t\tdocument.getElementById('noauth-{$t}').checked=true;\n\t\t\tdocument.getElementById('deny-{$t}').disabled=true;\n\t\t\tdocument.getElementById('allow-{$t}').disabled=true;\n\t\t\tdocument.getElementById('noauth-{$t}').disabled=true;\n\t\t\tdocument.getElementById('maxtime-{$t}').disabled=true;\n\t\t\tdocument.getElementById('addTocat-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('deny-{$t}').disabled=false;\n\t\t\tdocument.getElementById('allow-{$t}').disabled=false;\n\t\t\tdocument.getElementById('noauth-{$t}').disabled=false;\n\t\t\tdocument.getElementById('maxtime-{$t}').disabled=false;\n\t\t\tdocument.getElementById('addTocat-{$t}').disabled=false;\n\t\t\t}\n\t\t\n\t}\n\t\n\tfunction FdapGroup{$t}(DN){\n\t\tdocument.getElementById('adgroup-{$t}').value='EXTLDAP:'+DN;\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('rule','{$md5}');\n\t\tXHR.appendData('category',document.getElementById('category-{$t}').value);\n\t\tXHR.appendData('adgroup',document.getElementById('adgroup-{$t}').value);\n\t\tXHR.appendData('username',document.getElementById('username-{$t}').value);\n\t\tXHR.appendData('addTocat',document.getElementById('addTocat-{$t}').value);\n\t\tXHR.appendData('maxtime',document.getElementById('maxtime-{$t}').value);\n\t\tXHR.appendData('webruleid',document.getElementById('webruleid-{$t}').value);\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tif(document.getElementById('deny-{$t}').checked){\n\t\t\tXHR.appendData('deny','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('deny','0');\t\n\t\t\n\t\t}\n\t\tif(document.getElementById('allow-{$t}').checked){\n\t\t\tXHR.appendData('allow','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('allow','0');\t\n\t\t\n\t\t}\t\n\n\t\tif(document.getElementById('noauth-{$t}').checked){\n\t\t\tXHR.appendData('noauth','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('noauth','0');\t\n\t\t\n\t\t}\n\n\t\tif(document.getElementById('ticket-{$t}').checked){\n\t\t\tXHR.appendData('ticket','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('ticket','0');\t\n\t\t\n\t\t}\t\t\t\n\t\t\n\t\t\n\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t\n\tUnCheckAllow{$t}();\n\tUnTicket{$t}();\n\t</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function authenticate_ip_ttl_form()
{
    $t = time();
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $authenticate_ip_ttl = intval($sock->GET_INFO("authenticate_ip_ttl"));
    if ($authenticate_ip_ttl == 0) {
        $authenticate_ip_ttl = 60;
    }
    $html = "<div class=explain style='font-size:14px'>{authenticate_ip_ttl}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t" . Field_text_table("authenticate_ip_ttl-{$t}", "{ttl} ({seconds})", $authenticate_ip_ttl, "16", null, 110) . Field_button_table_autonome("{apply}", "Save{$t}", 18) . "</table>\n\t</div>\n\t<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tif(res.length>3){alert(res);return;}\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tfunction Save{$t}(){\n\t\tvar allow_duration=0;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('authenticate_ip_ttl', document.getElementById('authenticate_ip_ttl-{$t}').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});  \t\t\n\t}\n</script>\t\t\t\n\t\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function csr_gen()
{
    $tpl = new templates();
    $users = new usersMenus();
    $page = CurrentPageName();
    $sock = new sockets();
    $ligne = unserialize($sock->GET_INFO("CertificateCenterCSR"));
    $t = time();
    if ($ligne["CountryName"] == null) {
        $ligne["CountryName"] = "US";
    }
    if ($ligne["stateOrProvinceName"] == null) {
        $ligne["stateOrProvinceName"] = "New York";
    }
    if ($ligne["localityName"] == null) {
        $ligne["localityName"] = "Brooklyn";
    }
    if ($ligne["emailAddress"] == null) {
        $ligne["emailAddress"] = "*****@*****.**";
    }
    if ($ligne["OrganizationName"] == null) {
        $ligne["OrganizationName"] = "MyCompany Ltd";
    }
    if ($ligne["OrganizationalUnit"] == null) {
        $ligne["OrganizationalUnit"] = "IT service";
    }
    if (!is_numeric($ligne["CertificateMaxDays"])) {
        $ligne["CertificateMaxDays"] = 730;
    }
    if (!is_numeric($ligne["levelenc"])) {
        $ligne["levelenc"] = 1024;
    }
    $button_save = $tpl->_ENGINE_parse_body(button("{edit}", "Save{$t}()", 30));
    if ($ligne["password"] == null) {
        $ligne["password"] = "******";
    }
    $sock->getFrameWork("openssl.php?copy-csr=yes");
    $data = @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/Myprivkey.csr");
    @unlink("/usr/share/artica-postfix/ressources/logs/web/Myprivkey.csr");
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("CommonName-{$t}", "{CommonName}", $ligne["CommonName"], 22, null, 400);
    $html[] = Field_text_table("CountryName-{$t}", "{countryName}", $ligne["CountryName"], 22, null, 110);
    $html[] = Field_text_table("stateOrProvinceName-{$t}", "{stateOrProvinceName}", $ligne["stateOrProvinceName"], 22, null, 400);
    $html[] = Field_text_table("localityName-{$t}", "{localityName}", $ligne["localityName"], 22, null, 400);
    $html[] = Field_text_table("OrganizationName-{$t}", "{organizationName}", $ligne["OrganizationName"], 22, null, 400);
    $html[] = Field_text_table("OrganizationalUnit-{$t}", "{organizationalUnitName}", $ligne["OrganizationalUnit"], 22, null, 400);
    $html[] = Field_text_table("emailAddress-{$t}", "{emailAddress}", $ligne["emailAddress"], 22, null, 400);
    $html[] = Field_password_table("password-{$t}", "{password}", $ligne["password"], 22, null, 300);
    $html[] = Field_button_table_autonome("{generate_csr}", "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "<hr>\n\t<textarea\n\tstyle='margin-top:5px;font-family:Courier New;\n\tfont-weight:bold;width:100%;height:520px;border:5px solid #8E8E8E;\n\toverflow:auto;font-size:16px !important;width:99%;height:390px' id='csr-{$t}'>{$data}</textarea>\n\t";
    $html[] = "</div>\n<script>\nvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);}\n\tRefreshTab('main_certificates_center_tabs');\n\tif(document.getElementById('squid_ports_popup_certificates')){\n\t\tvar id=document.getElementById('squid_ports_popup_certificates_num').value;\n\t\tvar Common=document.getElementById('CommonName-{$t}').value;\n\t\tLoadAjaxSilent('squid_ports_popup_certificates','squid.ports.php?certificate-refresh=yes&default='+Common+'&t='+id);\n\t}\n\t\n\t\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('GEN-CSR','yes');\n\tXHR.appendData('CommonName',encodeURIComponent(document.getElementById('CommonName-{$t}').value));\n\tXHR.appendData('CountryName',encodeURIComponent(document.getElementById('CountryName-{$t}').value));\n\tXHR.appendData('stateOrProvinceName',encodeURIComponent(document.getElementById('stateOrProvinceName-{$t}').value));\n\tXHR.appendData('localityName',encodeURIComponent(document.getElementById('localityName-{$t}').value));\n\tXHR.appendData('OrganizationName',encodeURIComponent(document.getElementById('OrganizationName-{$t}').value));\n\tXHR.appendData('OrganizationalUnit',encodeURIComponent(document.getElementById('OrganizationalUnit-{$t}').value));\n\tXHR.appendData('emailAddress',encodeURIComponent(document.getElementById('emailAddress-{$t}').value));\n\tXHR.appendData('password',encodeURIComponent(document.getElementById('password-{$t}').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t\n</script>\n";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function step2()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $squid = new squidbee();
    $WizardProxyTransparent = unserialize($sock->GET_INFO("WizardProxyTransparent"));
    $connected_port = intval($WizardProxyTransparent["connected_port"]);
    $transparent_port = intval($WizardProxyTransparent["transparent_port"]);
    $transparent_ssl_port = intval($WizardProxyTransparent["transparent_ssl_port"]);
    $EnableSSLBump = intval($WizardProxyTransparent["EnableSSLBump"]);
    $t = time();
    if (!is_numeric($squid->ssl_port)) {
        $squid->ssl_port = $squid->listen_port + 5;
    }
    if ($squid->ssl_port < 3) {
        $squid->ssl_port = $squid->listen_port + 5;
    }
    if ($squid->ssl_port == 443) {
        $squid->ssl_port = $squid->listen_port + 10;
    }
    if ($transparent_ssl_port == 0) {
        $transparent_ssl_port = $squid->ssl_port;
    }
    if ($transparent_ssl_port == $transparent_port) {
        $transparent_ssl_port = 0;
    }
    if ($transparent_ssl_port == $connected_port) {
        $transparent_ssl_port = 0;
    }
    if ($transparent_ssl_port == 0) {
        $transparent_ssl_port = rand(8080, 9090);
    }
    $enableSSLBump = Paragraphe_switch_img("{activate_ssl_bump}", "{activate_ssl_bump_text2}", "EnableSSLBump-{$t}", $EnableSSLBump, null, 650);
    $html = "<div style='width:98%' class=form>\n\t<div style='font-size:32px;margin-bottom:20px'>{UseSSL}</div>\n\t{$enableSSLBump}\n<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:18px;font-weight:bold'>{connected_port}:</td>\n\t\t<td  style='font-size:18px;font-weight:normal'>{$connected_port}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px;font-weight:bold'>{transparent_port}:</td>\n\t\t<td  style='font-size:18px;font-weight:normal'>{$transparent_port}</td>\n\t</tr>\t\n\t" . Field_text_table("transparent_ssl_port-{$t}", "{ssl_port}", $transparent_ssl_port, 18, "{wizard_transparent_buttonE}", 120) . Field_button_table_autonome("{next}", "Save{$t}", 26) . "</table>\n\t</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue)};\n\tLoadAjax('wizard_transparent_button','{$page}?step3=yes');\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('EnableSSLBump',document.getElementById('EnableSSLBump-{$t}').value);\n\tXHR.appendData('transparent_ssl_port',document.getElementById('transparent_ssl_port-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST', xSave{$t});\n}\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
function wizard_certificate_1()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $hostname = $sock->GET_INFO("myhostname");
    $t = time();
    $ENC[1024] = 1024;
    $ENC[2048] = 2048;
    $ENC[4096] = 4096;
    if ($hostname == null) {
        $hostname = $sock->getFrameWork("system.php?hostname-g=yes");
        $sock->SET_INFO($hostname, "myhostname");
    }
    $title = $tpl->_ENGINE_parse_body("{new_certificate}");
    $html[] = "<div class=explain style='font-size:18px'>{wizard_certificate_1}<br><i>{CSR_MULTIPLE_EXPLAIN}</i></div>";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("wizard-certificate-commonname", "{CommonName}", $hostname, 22, null, 400);
    $html[] = Field_checkbox_table("AsSquidCertificate", "{proxy_certificate}", 0, 22, "{proxy_gen_certificate_explain}");
    $html[] = Field_list_table("wizard-certificate-levelenc", "{level_encryption}", 2048, 22, $ENC);
    $html[] = Field_password_table("wizard-certificate-password", "{password}", "secret", 22, null, 300);
    $html[] = Field_button_table_autonome("{add}", "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\nvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\n\tif(document.getElementById('squid_ports_popup_certificates')){\n\t\tif(document.getElementById('squid_ports_popup_certificates_num')){\n\t\t\tvar id=document.getElementById('squid_ports_popup_certificates_num').value;\n\t\t\tvar Common=document.getElementById('wizard-certificate-commonname').value;\n\t\t\tLoadAjaxSilent('squid_ports_popup_certificates','squid.ports.php?certificate-refresh=yes&default='+Common+'&t='+id);\n\t\t}\n\t}\t\n\t\n\t\n\t\$('#TABLE_CERTIFICATE_CENTER_MAIN').flexReload();\n\t\n\tvar commonName=document.getElementById('wizard-certificate-commonname').value;\n\tLoadjs('openssl.CSR.progress.php?generate-csr='+commonName);\n\tYahooWin6Hide();\n\t\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('wizard-certificate-commonname',encodeURIComponent(document.getElementById('wizard-certificate-commonname').value));\n\tXHR.appendData('wizard-certificate-levelenc',document.getElementById('wizard-certificate-levelenc').value);\n\tXHR.appendData('wizard-certificate-password',encodeURIComponent(document.getElementById('wizard-certificate-password').value));\n\tif(document.getElementById('AsSquidCertificate').checked){\n\t\tXHR.appendData('wizard-certificate-proxy',1);\n\t}else{\n\t\tXHR.appendData('wizard-certificate-proxy',0);\n\t}\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function group_popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql_meta();
    $ID = $_GET["ID"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT groupname FROM metagroups WHERE ID={$_GET["ID"]}"));
    $groupname = $tpl->javascript_parse_text($ligne["groupname"]);
    $t = time();
    $html = "<div style='font-size:22px;margin-bottom:20px'>&nbsp;&laquo;&nbsp;{$groupname}&nbsp;&raquo;</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>" . Field_text_table("groupname-{$t}", "{groupname}", $ligne["groupname"], 22, null, 350) . Field_button_table_autonome("{apply}", "Save{$t}()", 32) . "</table>\n\t<script>\nvar xSave{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);}\n\t\$('#ARTICA_META_GROUP_TABLE').flexReload();\n}\n\nfunction SaveCHK{$t}(e){\n\tif(!checkEnter(e)){return;}\n\tSave{$t}();\n}\n\t\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID',  '{$ID}');\n\tXHR.appendData('groupname',  encodeURIComponent(document.getElementById('groupname-{$t}').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemple #29
0
function parameters_client(){
	$sock=new sockets();
	$tpl=new templates();
	$page=CurrentPageName();
	$RemoteUfdbCat=intval($sock->GET_INFO("RemoteUfdbCat"));
	$ufdbCatPort=intval($sock->GET_INFO("ufdbCatPort"));
	$ufdbCatInterface=$sock->GET_INFO("ufdbCatInterface");
	$EnableLocalUfdbCatService=intval($sock->GET_INFO("EnableLocalUfdbCatService"));
	if($ufdbCatPort==0){$ufdbCatPort=3978;}
	
	$p0=Paragraphe_switch_img("{use_local_categories_services}", "{use_remote_categories_services_explain}<br><strong>{use_local_categories_services_explain_warn}</strong>",
			"EnableLocalUfdbCatService",$EnableLocalUfdbCatService,null,800,"EnableLocalUfdbCatServiceCheck()"
	);
	
	
	$p1=Paragraphe_switch_img("{use_remote_categories_services}", "{use_remote_categories_services_explain}",
			"RemoteUfdbCat",$RemoteUfdbCat,null,800
			);
	
	$ip=new networking();
	$ips=$ip->ALL_IPS_GET_ARRAY();
	$ufdbCatInterface=$sock->GET_INFO("ufdbCatInterface");
	$ufdbCatPort=intval($sock->GET_INFO("ufdbCatPort"));
	$UfdbCatThreads=intval($sock->GET_INFO("UfdbCatThreads"));
	unset($ips["127.0.0.1"]);
	
	for($i=1;$i<65;$i++){
		$threads[$i]=$i;
	}
	
	if($UfdbCatThreads==0){$UfdbCatThreads=4;}
	if($ufdbCatPort==0){$ufdbCatPort=3978;}
	$ips[null]="{none}";
	reset($ips);
	$t=time();

	$html="
<div style='width:98%' class=form>
			$p0
			<table style='width:100%'>".
		Field_list_table("ufdbCatInterface1", "{listen_address}", $ufdbCatInterface,22,$ips).
		Field_text_table("ufdbCatPort1", "{listen_port}", $ufdbCatPort,22,null,120).
		Field_list_table("UfdbCatThreads1", "{threads}", $UfdbCatThreads,22,$threads)."</table>
			<div id='design1-$t'>$p1
	<table style='width:100%'>
	 ". Field_text_table("ufdbCatInterface", "{remote_address}", $ufdbCatInterface,22,null,230).
		Field_text_table("ufdbCatPort", "{listen_port}", $ufdbCatPort,22,null,120).

	"</table>
	</div>"."
			
			
<table style='width:100%'>".
		Field_button_table_autonome("{apply}","Save$t()",32)."
		</table>
		</div>
		<script>
var xSave$t=function (obj) {
	RefreshTab('main_ufdbguard_config');
	Loadjs('squid.reconfigure.simple.php');
}
	
function Save$t(){
	var XHR = new XHRConnection();
	var EnableLocalUfdbCatService=document.getElementById('EnableLocalUfdbCatService').value;
	
	if(EnableLocalUfdbCatService==0){
		XHR.appendData('ufdbCatInterface',document.getElementById('ufdbCatInterface').value);
		XHR.appendData('ufdbCatPort',document.getElementById('ufdbCatPort').value);
		XHR.appendData('RemoteUfdbCat',document.getElementById('RemoteUfdbCat').value);
	}else{
		XHR.appendData('ufdbCatInterface',document.getElementById('ufdbCatInterface1').value);
		XHR.appendData('ufdbCatPort',document.getElementById('ufdbCatPort1').value);
		XHR.appendData('UfdbCatThreads',document.getElementById('UfdbCatThreads1').value);
	
	}
	XHR.appendData('EnableLocalUfdbCatService',document.getElementById('EnableLocalUfdbCatService').value);
	XHR.sendAndLoad('$page', 'POST',xSave$t);
}
	
	
	function EnableLocalUfdbCatServiceCheck(){
	var EnableLocalUfdbCatService=document.getElementById('EnableLocalUfdbCatService').value;
			document.getElementById('ufdbCatInterface').disabled=false;
			document.getElementById('ufdbCatPort').disabled=false;
			document.getElementById('RemoteUfdbCat').disabled=false;
			document.getElementById('ufdbCatInterface1').disabled=true;
			document.getElementById('ufdbCatPort1').disabled=true;
			document.getElementById('UfdbCatThreads1').disabled=true;
			
			document.getElementById('design1-$t').style.visibility='visible';
			
		
		if(EnableLocalUfdbCatService==1){
			document.getElementById('RemoteUfdbCat').disabled=true;
			document.getElementById('ufdbCatInterface').disabled=true;
			document.getElementById('ufdbCatPort').disabled=true;
			document.getElementById('RemoteUfdbCat').disabled=true;
			document.getElementById('ufdbCatInterface1').disabled=false;
			document.getElementById('ufdbCatPort1').disabled=false;
			document.getElementById('UfdbCatThreads1').disabled=false;
			
			document.getElementById('design1-$t').style.visibility='hidden';
		}
		
		CheckBoxDesignHidden();
	}
	EnableLocalUfdbCatServiceCheck();
	</script>
	";	
	echo $tpl->_ENGINE_parse_body($html);
}
Exemple #30
0
function parameters_client()
{
    $sock = new sockets();
    $tpl = new templates();
    $page = CurrentPageName();
    $RemoteUfdbCat = intval($sock->GET_INFO("RemoteUfdbCat"));
    $ufdbCatPort = intval($sock->GET_INFO("ufdbCatPort"));
    $ufdbCatInterface = $sock->GET_INFO("ufdbCatInterface");
    $EnableLocalUfdbCatService = intval($sock->GET_INFO("EnableLocalUfdbCatService"));
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    $EnableIntelCeleron = intval(file_get_contents("/etc/artica-postfix/settings/Daemons/EnableIntelCeleron"));
    if ($SquidPerformance == 0) {
        if ($EnableLocalUfdbCatService == 0) {
            $p00 = Paragraphe_switch_img("{local_categories_services_activated}", "{use_local_categories_services_perf}</strong>", "none", 1, null, 800, "blur()") . "<hr><p>&nbsp;</p>";
        }
    }
    if ($ufdbCatPort == 0) {
        $ufdbCatPort = 3978;
    }
    $p0 = Paragraphe_switch_img("{use_local_categories_services}", "{use_remote_categories_services_explain}<br><strong>{use_local_categories_services_explain_warn}</strong>", "EnableLocalUfdbCatService", $EnableLocalUfdbCatService, null, 800, "EnableLocalUfdbCatServiceCheck()");
    if ($SquidPerformance > 2) {
        $EnableLocalUfdbCatService = 0;
        $p0 = Paragraphe_switch_disable("{use_local_categories_services}", "{use_remote_categories_services_explain}<br><strong>{use_local_categories_services_explain_warn}</strong>", "EnableLocalUfdbCatService", $EnableLocalUfdbCatService, null, 800, "EnableLocalUfdbCatServiceCheck()");
    }
    if ($EnableIntelCeleron == 1) {
        $EnableLocalUfdbCatService = 0;
        $p0 = Paragraphe_switch_disable("{use_local_categories_services}", "{use_remote_categories_services_explain}<br><strong>{CELERON_METHOD_EXPLAIN}</strong>", "EnableLocalUfdbCatService", $EnableLocalUfdbCatService, null, 800, "EnableLocalUfdbCatServiceCheck()");
    }
    $p1 = Paragraphe_switch_img("{use_remote_categories_services}", "{use_remote_categories_services_explain}", "RemoteUfdbCat", $RemoteUfdbCat, null, 800);
    $ip = new networking();
    $ips = $ip->ALL_IPS_GET_ARRAY();
    $ufdbCatInterface = $sock->GET_INFO("ufdbCatInterface");
    $ufdbCatPort = intval($sock->GET_INFO("ufdbCatPort"));
    $UfdbCatThreads = intval($sock->GET_INFO("UfdbCatThreads"));
    unset($ips["127.0.0.1"]);
    for ($i = 1; $i < 65; $i++) {
        $threads[$i] = $i;
    }
    if ($UfdbCatThreads == 0) {
        $UfdbCatThreads = 4;
    }
    if ($ufdbCatPort == 0) {
        $ufdbCatPort = 3978;
    }
    $ips[null] = "{none}";
    reset($ips);
    $t = time();
    $html = "\n<div style='width:98%' class=form>\n\t\t\t{$p00}{$p0}\n\t\t\t<table style='width:100%'>" . Field_list_table("ufdbCatInterface1", "{listen_address}", $ufdbCatInterface, 22, $ips) . Field_text_table("ufdbCatPort1", "{listen_port}", $ufdbCatPort, 22, null, 120) . Field_list_table("UfdbCatThreads1", "{threads}", $UfdbCatThreads, 22, $threads) . "</table>\n\t\t\t<div id='design1-{$t}'>{$p1}\n\t<table style='width:100%'>\n\t " . Field_text_table("ufdbCatInterface", "{remote_address}", $ufdbCatInterface, 22, null, 230) . Field_text_table("ufdbCatPort", "{listen_port}", $ufdbCatPort, 22, null, 120) . "</table>\n\t</div>" . "\n\t\t\t\n\t\t\t\n<table style='width:100%'>" . Field_button_table_autonome("{apply}", "Save{$t}()", 32) . "\n\t\t</table>\n\t\t</div>\n\t\t<script>\nvar xSave{$t}=function (obj) {\n\tRefreshTab('main_ufdbguard_config');\n\tLoadjs('squid.reconfigure.simple.php');\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar EnableLocalUfdbCatService=document.getElementById('EnableLocalUfdbCatService').value;\n\t\n\tif(EnableLocalUfdbCatService==0){\n\t\tXHR.appendData('ufdbCatInterface',document.getElementById('ufdbCatInterface').value);\n\t\tXHR.appendData('ufdbCatPort',document.getElementById('ufdbCatPort').value);\n\t\tXHR.appendData('RemoteUfdbCat',document.getElementById('RemoteUfdbCat').value);\n\t}else{\n\t\tXHR.appendData('ufdbCatInterface',document.getElementById('ufdbCatInterface1').value);\n\t\tXHR.appendData('ufdbCatPort',document.getElementById('ufdbCatPort1').value);\n\t\tXHR.appendData('UfdbCatThreads',document.getElementById('UfdbCatThreads1').value);\n\t\n\t}\n\tXHR.appendData('EnableLocalUfdbCatService',document.getElementById('EnableLocalUfdbCatService').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n\t\n\t\n\tfunction EnableLocalUfdbCatServiceCheck(){\n\tvar EnableLocalUfdbCatService=document.getElementById('EnableLocalUfdbCatService').value;\n\t\t\tdocument.getElementById('ufdbCatInterface').disabled=false;\n\t\t\tdocument.getElementById('ufdbCatPort').disabled=false;\n\t\t\tdocument.getElementById('RemoteUfdbCat').disabled=false;\n\t\t\tdocument.getElementById('ufdbCatInterface1').disabled=true;\n\t\t\tdocument.getElementById('ufdbCatPort1').disabled=true;\n\t\t\tdocument.getElementById('UfdbCatThreads1').disabled=true;\n\t\t\t\n\t\t\tdocument.getElementById('design1-{$t}').style.visibility='visible';\n\t\t\t\n\t\t\n\t\tif(EnableLocalUfdbCatService==1){\n\t\t\tdocument.getElementById('RemoteUfdbCat').disabled=true;\n\t\t\tdocument.getElementById('ufdbCatInterface').disabled=true;\n\t\t\tdocument.getElementById('ufdbCatPort').disabled=true;\n\t\t\tdocument.getElementById('RemoteUfdbCat').disabled=true;\n\t\t\tdocument.getElementById('ufdbCatInterface1').disabled=false;\n\t\t\tdocument.getElementById('ufdbCatPort1').disabled=false;\n\t\t\tdocument.getElementById('UfdbCatThreads1').disabled=false;\n\t\t\t\n\t\t\tdocument.getElementById('design1-{$t}').style.visibility='hidden';\n\t\t}\n\t\t\n\t\tCheckBoxDesignHidden();\n\t}\n\tEnableLocalUfdbCatServiceCheck();\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}