Example #1
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} «{$ligne2["servername"]}»";
    }
    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=text-info>{reverse_proxy_use_destination_server_certificate}</div>";
    }
    $html[] = "<div style='width:98%' class=form>{$AS_PEER_CERTIFICATE_EXPLAIN}";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:28px;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, 700, "SwitchOffCertificate{$t}") . "</td></tr>";
    $html[] = Field_list_table("certificate-{$t}", "{certificate}", $ligne["certificate"], 22, $sslcertificates, null, 450);
    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, 700) . "</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, 700) . "</td></tr>";
    }
    $html[] = Field_button_table_autonome("{apply}", "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\$('#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\t\n\tXHR.appendData('certificate',document.getElementById('certificate-{$t}').value);\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));
}
Example #2
0
function main_ssl()
{
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $sock = new sockets();
    $squid_reverse = new squid_reverse();
    $t = time();
    $tpl = new templates();
    $PostfixEnableMasterCfSSL = intval($sock->GET_INFO("PostfixEnableMasterCfSSL"));
    $PostFixMasterCertificate = $sock->GET_INFO("PostFixMasterCertificate");
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $ENABLE_SMTPS = Paragraphe_switch_img('{ENABLE_SMTPS}', '{SMTPS_TEXT}', 'PostfixEnableMasterCfSSL', $PostfixEnableMasterCfSSL, null, 1400);
    $page = CurrentPageName();
    $ENABLE_SMTPS_CERTIFICATE = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td colspan=2>{$ENABLE_SMTPS}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:26px'>{use_certificate_from_certificate_center}:</td>\n\t\t<td>" . Field_array_Hash($sslcertificates, "certificate-{$t}", $PostFixMasterCertificate, null, null, 0, "font-size:26px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' colspan=2><hr>" . button("{save}", "Save{$t}()", 40) . "</td>\n\t</table>";
    $html = "\n\t<div id='smtps' style='width:98%' class=form>\n\t{$ENABLE_SMTPS_CERTIFICATE}\n\t</div>\n\t<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\tLoadjs('postfix.sasl.progress.php');\n\t}\n\t\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('PostFixMasterCertificate',document.getElementById('certificate-{$t}').value);\n\t\tXHR.appendData('PostfixEnableMasterCfSSL',document.getElementById('PostfixEnableMasterCfSSL').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n\t\n\t}\n\t</script>\t\n\t\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #3
0
function popup(){
	$tpl=new templates();
	$users=new usersMenus();
	$page=CurrentPageName();
	$squid=new squidbee();
	$sock=new sockets();
	$ini=new Bs_IniHandler();
	
	$t=time();
	
	$ArticaSquidParameters=$sock->GET_INFO('ArticaSquidParameters');
	
	$ini->loadString($ArticaSquidParameters);
	
	
	$DisableSSLStandardPort=$sock->GET_INFO("DisableSSLStandardPort");
	if(!is_numeric($DisableSSLStandardPort)){$DisableSSLStandardPort=1;}
	
	if($DisableSSLStandardPort==0){$StandardPortSSL=1;}else{$StandardPortSSL=0;}
	
	$FIELD_StandardPortSSL=Paragraphe_switch_img("{activate_ssl_bump}",
	"{activate_ssl_only_standard_ports_text}","StandardPortSSL-$t",$StandardPortSSL,null,650);
	
	include_once(dirname(__FILE__)."/ressources/class.squid.reverse.inc");
	$squid_reverse=new squid_reverse();
	$sslcertificates=$squid_reverse->ssl_certificates_list();
	
	
	$sslproxy_versions[1]="{default}";
	$sslproxy_versions[2]="SSLv2 {only}";
	$sslproxy_versions[3]="SSLv3 {only}";
	$sslproxy_versions[4]="TLSv1.0 {only}";
	$sslproxy_versions[5]="TLSv1.1 {only}";
	$sslproxy_versions[6]="TLSv1.2 {only}";
	$sslproxy_version=intval($sock->GET_INFO("sslproxy_version"));
	if($sslproxy_version==0){$sslproxy_version=1;}
	
	$SSL_BUMP_WHITE_LIST=Paragraphe_switch_img("{whitelist_all_domains}",
	"{sslbump_whitelist_all_domains_explain}","SSL_BUMP_WHITE_LIST-$t",$squid->SSL_BUMP_WHITE_LIST,null,650);
	

	
	$html="
			
	<div style='width:98%' class=form>		
	<div class=text-info style='font-size:18px'>{SSL_BUMP_CONNECTED_EXPLAIN}</div>
	<div id='SSL_CERTIF_DOWN'></div>
	<table style='width:100%'>
	<tr>
			<td colspan=2>$FIELD_StandardPortSSL</td>
	</tr>
	<tr>
			<td colspan=2>$SSL_BUMP_WHITE_LIST</td>
	</tr>	
	
	
	<tr>
		<td style='font-size:22px;vertical-align:middle' class=legend nowrap>{sslproxy_version}:</td>
		<td>". Field_array_Hash($sslproxy_versions,"sslproxy_version-$t",$sslproxy_version,"style:font-size:22px")."</td>
	</tr>
	<tr>
		<td class=legend nowrap style='font-size:22px'>{use_certificate_from_certificate_center}:</td>
		<td>". Field_array_Hash($sslcertificates, "certificate-$t",$ini->_params["NETWORK"]["certificate_center"],null,null,0,"font-size:22px")."</td>
	</tr>	
	<tr>
		<td colspan=2 align=right><hr>".button("{apply}","Save$t()",36)."</td>
	</tr>
	</table>
	</div>	
<script>
var xSave$t=function(obj){
    var tempvalue=obj.responseText;
    if(tempvalue.length>3){alert(tempvalue);}
	Loadjs('squid.compile.progress.php?restart=yes&ask=yes');
    AnimateDiv('BodyContent');
    LoadAjax('BodyContent','squid.ssl.center.php');
	
}	

function Save$t(){
	var XHR = new XHRConnection();
	XHR.appendData('certificate',document.getElementById('certificate-$t').value);
	XHR.appendData('SSL_BUMP_WHITE_LIST',document.getElementById('SSL_BUMP_WHITE_LIST-$t').value);
	XHR.appendData('StandardPortSSL',document.getElementById('StandardPortSSL-$t').value);
	XHR.appendData('sslproxy_version',document.getElementById('sslproxy_version-$t').value);
	XHR.sendAndLoad('$page', 'POST',xSave$t);		
}

LoadAjax('SSL_CERTIF_DOWN','$page?SSL_CERTIF_DOWN=yes');
</script>						
	";
	
	
echo $tpl->_ENGINE_parse_body($html);	
	

	
}
Example #4
0
function HTTPS_PORT()
{
    $httpd = new httpd();
    $users = new usersMenus();
    $page = CurrentPageName();
    $use_apache = null;
    $sock = new sockets();
    $tpl = new templates();
    $LighttpdUserAndGroup = $sock->GET_INFO("LighttpdUserAndGroup");
    $LighttpdArticaDisabled = $sock->GET_INFO("LighttpdArticaDisabled");
    $LighttpdArticaDisableSSLv2 = $sock->GET_INFO("LighttpdArticaDisableSSLv2");
    $LighttpdArticaListenIP = $sock->GET_INFO("LighttpdArticaListenIP");
    $LighttpdArticaCertificateName = $sock->GET_INFO("LighttpdArticaCertificateName");
    $ConfirmDisableArticaWebConsole = $tpl->javascript_parse_text("{ConfirmDisableArticaWebConsole}");
    if ($LighttpdUserAndGroup == null) {
        $LighttpdUserAndGroup = "www-data:www-data";
    }
    $ArticaHttpsPort = $sock->GET_INFO("ArticaHttpsPort");
    $ArticaHttpUseSSL = $sock->GET_INFO("ArticaHttpUseSSL");
    if (!is_numeric($ArticaHttpUseSSL)) {
        $ArticaHttpUseSSL = 1;
    }
    if (!is_numeric($LighttpdArticaDisabled)) {
        $LighttpdArticaDisabled = 0;
    }
    if (!is_numeric($LighttpdArticaDisableSSLv2)) {
        $LighttpdArticaDisableSSLv2 = 0;
    }
    if (!is_numeric($ArticaHttpsPort)) {
        $ArticaHttpsPort = "9000";
    }
    $ip = new networking();
    $ips = $ip->ALL_IPS_GET_ARRAY();
    $IPAR[null] = "{all}";
    while (list($num, $ligne) = each($ips)) {
        $IPAR[$num] = $num;
    }
    unset($IPAR["127.0.0.1"]);
    $t = time();
    $logon_parameters = unserialize(base64_decode($sock->GET_INFO("LogonPageSettings")));
    $page = CurrentPageName();
    $lang["en"] = "English";
    $lang["fr"] = "Francais";
    $lang["po"] = "Portugues";
    $lang["br"] = "Brazilian";
    $lang["es"] = "Espanol";
    $lang["it"] = "Italiano";
    $lang["de"] = "Deutsch";
    $HTMLTitle = $sock->GET_INFO("HTMLTitle");
    if (trim($HTMLTitle) == null) {
        $HTMLTitle = "%s (%v)";
    }
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $html = $html . "\n<div style='width:98%' class=form>\n<table style='width:100%'>\n\n\t<table style='width:100%'>\n\t\t\n\n\n\t\t<tr>\n\t\t\t<td nowrap nowrap class=legend style='font-size:22px'>{ssl}:</strong></td>\n\t\t\t<td>" . Field_checkbox_design("ArticaHttpUseSSL", 1, $ArticaHttpUseSSL, "WebArticaCheck()") . "</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td nowrap nowrap class=legend style='font-size:22px'>{disableSSLv2}:</strong></td>\n\t\t\t<td>" . Field_checkbox_design("LighttpdArticaDisableSSLv2", 1, $LighttpdArticaDisableSSLv2, "disableSSLv2Check()") . "</td>\n\t\t</tr>\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px;'>{certificate}:</td>\n\t\t<td >" . Field_array_Hash($sslcertificates, "LighttpdArticaCertificateName", $LighttpdArticaCertificateName, null, null, 0, "font-size:22px") . "</td>\n\t</tr>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t<tr>\n\t\t\t\t<td nowrap class=legend style='font-size:22px'>{listen_port}:</strong></td>\n\t\t\t\t<td>" . Field_text('https_port', trim($ArticaHttpsPort), 'width:100px;font-size:22px;padding:3px') . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td nowrap class=legend style='font-size:22px'>{listen_address}:</strong></td>\n\t\t\t\t<td>" . Field_array_Hash($IPAR, 'LighttpdArticaListenIP', trim($LighttpdArticaListenIP), 'style:font-size:22px;padding:3px') . "</td>\n\t\t\t</tr>\t\t\t\n\t\t\t \n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td nowrap class=legend style='font-size:22px'>{username}:</strong></td>\n\t\t\t\t<td>" . Field_text('LighttpdUserAndGroup', trim($LighttpdUserAndGroup), 'width:330px;font-size:22px;padding:3px') . "</td>\n\t\t\t</tr>\n<tr><td colspan=2 style='font-size:22px'>&nbsp;</td></tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{remove_language_selector}</td>\n\t\t<td>" . Field_checkbox_design("LANGUAGE_SELECTOR_REMOVE", 1, $logon_parameters["LANGUAGE_SELECTOR_REMOVE"], "CronLogonApplySelector()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{default_language}</td>\n\t\t<td>" . Field_array_Hash($lang, "DEFAULT_LANGUAGE", $logon_parameters["DEFAULT_LANGUAGE"], null, null, 0, "font-size:22px;padding:3px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{title_pages}:</td>\n\t\t<td>" . Field_text("HTMLTitle", $HTMLTitle, "font-size:22px;padding:3px;width:380px") . "</td>\n\t</tr>\t\t\t\t\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td colspan=2 align='right'>\n\t\t\t\t\t<hr>\n\t\t\t\t\t" . button("{apply}", "Save{$t}()", 36) . "\n\t\t\t\t\t\n\t\t\t\t</td>\n\t\t\t</tr>\n</table>\n</div>\n<script>\n\n\t\n\t\n\tfunction CronLogonApplySelector(){\n\t\tdocument.getElementById('DEFAULT_LANGUAGE').disabled=true;\n\t\tif(document.getElementById('LANGUAGE_SELECTOR_REMOVE').checked){\n\t\t\tdocument.getElementById('DEFAULT_LANGUAGE').disabled=false;\n\t\t}\n\t}\n\t\n\tvar xSave{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>2){alert(results);return;}\n\t\tLoadjs('artica.webinterface.restart.php');\n\t}\t\n\t\t\t\t\t\t\t\n\tfunction Save{$t}(){\n\t\t\t\t// -- > HTTPS_PORT_SAVE\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('LANGUAGE_SELECTOR_REMOVE').checked){XHR.appendData('LANGUAGE_SELECTOR_REMOVE',1);}else{XHR.appendData('LANGUAGE_SELECTOR_REMOVE',0);}\n\t\t\tif(document.getElementById('ArticaHttpUseSSL').checked){XHR.appendData('ArticaHttpUseSSL',1);}else{XHR.appendData('ArticaHttpUseSSL',0);}\n\t\t\tif(document.getElementById('LighttpdArticaDisableSSLv2').checked){XHR.appendData('LighttpdArticaDisableSSLv2',1);}else{XHR.appendData('LighttpdArticaDisableSSLv2',0);}\n\t\t\tif(document.getElementById('LANGUAGE_SELECTOR_REMOVE').checked){XHR.appendData('LANGUAGE_SELECTOR_REMOVE',1);}else{XHR.appendData('LANGUAGE_SELECTOR_REMOVE',0);}\n\t\t\tXHR.appendData('DEFAULT_LANGUAGE',document.getElementById('DEFAULT_LANGUAGE').value);\n\t\t\tXHR.appendData('HTMLTitle',encodeURIComponent(document.getElementById('HTMLTitle').value));\n\t\t\tXHR.appendData('https_port',document.getElementById('https_port').value);\n\t\t\tXHR.appendData('LighttpdArticaListenIP',document.getElementById('LighttpdArticaListenIP').value);\n\t\t\tXHR.appendData('LighttpdUserAndGroup',document.getElementById('LighttpdUserAndGroup').value);\n\t\t\tXHR.appendData('LighttpdArticaCertificateName',document.getElementById('LighttpdArticaCertificateName').value);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n\t}\n\t\t\n\t\tfunction disableSSLv2Check(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('LighttpdArticaDisableSSLv2').checked){\n\t\t\t\tXHR.appendData('LighttpdArticaDisableSSLv2',1);\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\tXHR.appendData('LighttpdArticaDisableSSLv2',0);\n\t\t\t}\n\t\t\tXHR.sendAndLoad('{$page}', 'POST');\n\t\t\n\t\t}\t\t\n\t\t\n\t\t\n\t\t\n\t\tfunction WebArticaCheck(){\n\t\t\tdocument.getElementById('LighttpdArticaDisableSSLv2').disabled=true;\n\t\t\tif(document.getElementById('ArticaHttpUseSSL')){\n\t\t\t\tif(document.getElementById('ArticaHttpUseSSL').checked){\n\t\t\t\t\tdocument.getElementById('LighttpdArticaDisableSSLv2').disabled=false;\t\n\t\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\t\n\tWebArticaCheck();\t\nCronLogonApplySelector();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n</script>\t\t\t\t\t\t\t\n";
    return $html;
}
Example #5
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));
}
function websites_popup()
{
    $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}";
    $boot = new boostrap_form();
    $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}";
        $boot->set_hidden("servername-edit", $servername);
    } else {
        $ligne["enabled"] = 1;
        $boot->set_field("servername-edit", "{website}", null, array("MANDATORY" => true));
    }
    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;
        }
    }
    $boot->set_formtitle($title);
    if (!$AsFReeWeb) {
        $boot->set_field("port", "{inbound_port}", $ligne["port"]);
    }
    $boot->set_checkbox("enabled", "{enabled}", $ligne["enabled"], array("DISABLEALL" => true));
    $boot->set_checkbox("default_server", "{default_server}", $ligne["default_server"], array("TOOLTIP" => "{NGINX_DEFAULT_SERVER}"));
    $boot->set_checkbox("owa", "{protect_owa}", $ligne["owa"]);
    $boot->set_checkbox("debug", "{debug}", $ligne["debug"]);
    $boot->set_list("cacheid", "{cache}", $nginx_caches, $ligne["cacheid"]);
    $boot->set_list("replaceid", "{replace_rule}", $nginx_replaces, $ligne["replaceid"]);
    if ($servername != null) {
        if ($ligne["certificate"] != null) {
            $boot->set_formdescription("{certificate}: {$ligne["certificate"]}");
        }
    }
    if ($ligne["cache_peer_id"] == 0) {
        $boot->set_hidden("cache_peer_id", 0);
        $boot->set_hidden("enabled", 1);
        $boot->set_hidden("certificate", $ligne["certificate"]);
    } else {
        if (!AdminPrivs()) {
            $boot->set_hidden("cache_peer_id", $ligne["cache_peer_id"]);
            $boot->set_hidden("start_directory", $ligne["start_directory"]);
        } else {
            $boot->set_list("cache_peer_id", "{destination}", $array, $ligne["cache_peer_id"]);
            $boot->set_field("start_directory", "{start_path}", $ligne["start_directory"]);
        }
        $boot->set_list("poolid", "{pool}", $nginx_pools, $ligne["poolid"]);
        $boot->set_field("RedirectQueries", "{RedirectQueries}", $ligne["RedirectQueries"]);
        $boot->set_checkbox("ArticaErrors", "{enable_template_errors}", $ligne["ArticaErrors"]);
        $boot->set_checkbox("ssl", "{UseSSL}", $ligne["ssl"], array("TOOLTIP" => "{NGINX_USE_SSL_EXPLAIN}"));
        $boot->set_list("certificate", "{certificate}", $sslcertificates, $ligne["certificate"], array());
        if ($CountDeSources == 0) {
            $boot->set_form_error("{you_need_to_define_sources_first}");
            $boot->set_form_locked();
        }
    }
    $boot->set_button($bt);
    if ($servername == null) {
        $boot->set_CloseYahoo("YahooWin");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Example #7
0
function popup(){
	$page=CurrentPageName();
	$sock=new sockets();
	$users=new usersMenus();
	$t=time();
	$LICENSE=0;
	if($users->CORP_LICENSE){$LICENSE=1;}
	$EnableSquidGuardHTTPService=$sock->GET_INFO("EnableSquidGuardHTTPService");
	if(strlen(trim($EnableSquidGuardHTTPService))==0){$EnableSquidGuardHTTPService=1;}
	
	$SquidGuardApacheSSLPort=$sock->GET_INFO("SquidGuardApacheSSLPort");
	$SquidGuardApachePort=intval($sock->GET_INFO("SquidGuardApachePort"));
	$SquidGuardWebBlankReferer=intval($sock->GET_INFO("SquidGuardWebBlankReferer"));
	$SquidGuardWebSSLCertificate=$sock->GET_INFO("SquidGuardWebSSLCertificate");
	
	if(!is_numeric($SquidGuardApacheSSLPort)){$SquidGuardApacheSSLPort=9025;}
	if($SquidGuardApachePort==0){$SquidGuardApachePort=9020;}
	
	$SquidGuardIPWeb=$sock->GET_INFO("SquidGuardIPWeb");
	$fulluri=$sock->GET_INFO("SquidGuardIPWeb");
	$SquidGuardWebFollowExtensions=$sock->GET_INFO("SquidGuardWebFollowExtensions");
	$SquidGuardWebUseExternalUri=intval($sock->GET_INFO("SquidGuardWebUseExternalUri"));
	
	
	
	$SquidGuardServerName=$sock->GET_INFO("SquidGuardServerName");
	
	
	if($SquidGuardIPWeb==null){
			$SquidGuardIPWeb="http://".$_SERVER['SERVER_ADDR'].':'.$SquidGuardApachePort."/exec.squidguard.php";
			$SquidGuardIPWebSSL="https://".$_SERVER['SERVER_ADDR'].':'.$SquidGuardApacheSSLPort."/exec.squidguard.php";
			$fulluri="http://".$_SERVER['SERVER_ADDR'].':'.$SquidGuardApachePort."/exec.squidguard.php";
			$fulluriSSL="https://".$_SERVER['SERVER_ADDR'].':'.$SquidGuardApacheSSLPort."/exec.squidguard.php";
	}	
	$SquidGuardIPWeb=str_replace("http://",null,$SquidGuardIPWeb);
	$SquidGuardIPWeb=str_replace("https://",null,$SquidGuardIPWeb);
	$fulluriSSL=$SquidGuardIPWeb;
	
	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(!is_numeric($SquidGuardWebFollowExtensions)){$SquidGuardWebFollowExtensions=1;}
	$fulluriSSL=str_replace($SquidGuardApachePort, $SquidGuardApacheSSLPort, $fulluriSSL);
	
	$squid_reverse=new squid_reverse();
	$sslcertificates=$squid_reverse->ssl_certificates_list();
	$button= button("{apply}","SaveSquidGuardHTTPService$t()",32);
	$p1=Paragraphe_switch_img("{enable_http_service}", 
				"{enable_http_service_squidguard}","EnableSquidGuardHTTPService",$EnableSquidGuardHTTPService,null,626,"EnableSquidGuardHTTPService()");
	if($SquidGuardWebUseExternalUri==1){
		$p1=Paragraphe_switch_disable("{enable_http_service}",
				"{enable_http_service_squidguard}","EnableSquidGuardHTTPService",$EnableSquidGuardHTTPService,null,626,"EnableSquidGuardHTTPService()");
		$button=null;
	}
	
	
	$html="
	<div id='EnableSquidGuardHTTPServiceDiv'>
	<div style='width:98%' class=form>
	<table style='width:100%'>
	<tr>
			
		<td style='vertical-align:top'><div id='squid-guard-http-status' style='margin-right:10px'></div></td>
		<td colspan=2>$p1".
				Paragraphe_switch_img("{FollowExtensions}",
				"{SquidGuardWebFollowExtensions_explain}","SquidGuardWebFollowExtensions",$SquidGuardWebFollowExtensions,null,626,"EnableSquidGuardHTTPService()").
				
				Paragraphe_switch_img("{SquidGuardWebBlankReferer}",
				"{SquidGuardWebBlankReferer_explain}","SquidGuardWebBlankReferer",$SquidGuardWebBlankReferer,null,626,"EnableSquidGuardHTTPService()").
								
				
				
				
				"</td>	
							

	<tr>
		<td class=legend style='font-size:22px'>{listen_port}:</td>
		<td>". Field_text("listen_port_squidguard",$SquidGuardApachePort,"font-size:22px;padding:3px;width:110px",null,null,null,false,"")."</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (SSL):</td>
		<td>". Field_text("listen_port_squidguard_ssl",$SquidGuardApacheSSLPort,"font-size:22px;padding:3px;width:110px",null,null,null,false,"")."</td>
		<td>&nbsp;</td>
	</tr>				
	<tr>
		<td class=legend style='font-size:22px'>{certificate}:</td>
		<td>". Field_array_Hash($sslcertificates,"SquidGuardWebSSLCertificate",$SquidGuardWebSSLCertificate,
				"style:font-size:22px;padding:3px;width:75%",null,null,null,false,"")."</td>
		<td>&nbsp;</td>
	</tr>				
				
				
					
	
	<tr>
		<td class=legend style='font-size:22px'>{hostname}:</td>
		<td style='font-size:14px'>". Field_text("servername_squidguard",$SquidGuardServerName,"font-size:22px;padding:3px;width:380px",null,null,null,false,"")."</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{fulluri}:</td>
		<td style='font-size:14px'>". Field_text("fulluri","$fulluri","font-size:22px;padding:3px;width:660px",null,null,null,false,"")."</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{fulluri} (ssl):</td>
		<td style='font-size:14px'>". Field_text("fulluriSSL","$fulluriSSL","font-size:22px;padding:3px;width:660px",null,null,null,false,"")."</td>
		<td>&nbsp;</td>
	</tr>				
	<tr>
		<td colspan=3 align='right'><hr>".$button."</td>
	</tr>	
	</table>
	</div>
<script>
function EnableSquidGuardHTTPService(){
	var LICENSE=$LICENSE;
	 document.getElementById('listen_port_squidguard').disabled=true;
	 document.getElementById('listen_port_squidguard_ssl').disabled=true;
	 document.getElementById('servername_squidguard').disabled=true;
	 document.getElementById('fulluri').disabled=true;
	 document.getElementById('fulluriSSL').disabled=true;
	 document.getElementById('SquidGuardWebFollowExtensions').disabled=true;
	 document.getElementById('SquidGuardWebSSLCertificate').disabled=true;
			 
			 if(document.getElementById('EnableSquidGuardHTTPService').value==1){
				 	document.getElementById('listen_port_squidguard').disabled=false;
				 	document.getElementById('listen_port_squidguard_ssl').disabled=false;
				 	document.getElementById('servername_squidguard').disabled=false;
				 	document.getElementById('SquidGuardWebFollowExtensions').disabled=false;
				 	document.getElementById('SquidGuardWebBlankReferer').disabled=false;
				 	document.getElementById('SquidGuardWebSSLCertificate').disabled=false;
			}
			 
			
		}
		
var x_SaveSquidGuardHTTPService$t=function(obj){
	 	Loadjs('dansguardian2.compile.php');
}

function SaveSquidGuardHTTPService$t(){
     var XHR = new XHRConnection();
  	 XHR.appendData('SquidGuardWebBlankReferer',document.getElementById('SquidGuardWebBlankReferer').value);
     XHR.appendData('SquidGuardWebFollowExtensions',document.getElementById('SquidGuardWebFollowExtensions').value);
     XHR.appendData('EnableSquidGuardHTTPService',document.getElementById('EnableSquidGuardHTTPService').value);
	 XHR.appendData('listen_port_squidguard',document.getElementById('listen_port_squidguard').value);
	 XHR.appendData('listen_port_squidguard_ssl',document.getElementById('listen_port_squidguard_ssl').value);
	 XHR.appendData('SquidGuardWebSSLCertificate',document.getElementById('SquidGuardWebSSLCertificate').value);
	 XHR.appendData('servername_squidguard',document.getElementById('servername_squidguard').value);
     XHR.appendData('fulluri',document.getElementById('fulluri').value);
     XHR.appendData('fulluriSSL',document.getElementById('fulluriSSL').value);
     XHR.sendAndLoad('$page', 'GET',x_SaveSquidGuardHTTPService$t);     	
}
	
EnableSquidGuardHTTPService();
LoadAjaxSilent('squid-guard-http-status','squidguardweb.service.php');
</script>";
	
	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html);
	
	
}
Example #8
0
function sasl_popup_status()
{
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $page = CurrentPageName();
    $ldap = new clladp();
    $main = new smtpd_restrictions();
    $sock = new sockets();
    $PostfixEnableMasterCfSSL = intval($sock->GET_INFO("PostfixEnableMasterCfSSL"));
    $t = time();
    $PostfixEnableSubmission = $sock->GET_INFO("PostfixEnableSubmission");
    $PostFixMasterCertificate = $sock->GET_INFO("PostFixMasterCertificate");
    $PostFixSmtpSaslEnable = $sock->GET_INFO("PostFixSmtpSaslEnable");
    $TrustMyNetwork = $sock->GET_INFO("TrustMyNetwork");
    if (!is_numeric($TrustMyNetwork)) {
        $TrustMyNetwork = 1;
    }
    $enabled = $PostFixSmtpSaslEnable;
    $sasl = Paragraphe_switch_img('{enable_smtp_authentication}', '{sasl_intro}', 'enable_auth', $enabled, '{enable_disable}', 550);
    $smtpd_sasl_exceptions_networks = Paragraphe("64-white-computer.png", "{smtpd_sasl_exceptions_networks}", "{smtpd_sasl_exceptions_networks_text}", "javascript:Loadjs('smtpd_sasl_exceptions_networks.php')");
    $PostfixEnableSubmission_field = Paragraphe_switch_img('{PostfixEnableSubmission}', '{PostfixEnableSubmission_text}', 'PostfixEnableSubmission', $PostfixEnableSubmission, '{enable_disable}', 550);
    $TrustMyNetwork_field = Paragraphe_switch_img('{TrustMyNetwork}', '{TrustMyNetwork_text}', 'TrustMyNetwork', $TrustMyNetwork, '{enable_disable}', 550);
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $ENABLE_SMTPS = Paragraphe_switch_img('{ENABLE_SMTPS}', '{SMTPS_TEXT}', 'PostfixEnableMasterCfSSL', $PostfixEnableMasterCfSSL, null, 550);
    $ENABLE_SMTPS_CERTIFICATE = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2>{$ENABLE_SMTPS}</td>\n\t</tr>\n\t<tr>\n\t<td class=legend nowrap style='font-size:22px'>{use_certificate_from_certificate_center}:</td>\n\t<td>" . Field_array_Hash($sslcertificates, "certificate-{$t}", $PostFixMasterCertificate, null, null, 0, "font-size:22px") . "</td>\n\t</tr>\n\t</table>";
    $html = "\n\t<div id='sasl-id'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:middle'>\n\t\t\t{$sasl}\n\t\t\t<hr>{$TrustMyNetwork_field}\n\t\t\t<hr>{$PostfixEnableSubmission_field}\n\t\t\t<hr>{$ENABLE_SMTPS_CERTIFICATE}\n\t\t\t<div style='text-align:right'>\n\t\t\t<hr>" . button("{apply}", "enable_auth()", 40) . "\n\t\t\t</div>\n\t\t</td>\n\t\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\tvar X_enable_auth= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\tRefreshTab('main_popup_sasl_auth');\n\t\tLoadjs('postfix.sasl.progress.php');\n\t}\t\n\t\t\n\t\n\tfunction enable_auth(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('save_auth',document.getElementById('enable_auth').value);\n\t\tXHR.appendData('PostfixEnableSubmission',document.getElementById('PostfixEnableSubmission').value);\n\t\tXHR.appendData('TrustMyNetwork',document.getElementById('TrustMyNetwork').value);\n\t\tXHR.appendData('PostFixMasterCertificate',document.getElementById('certificate-{$t}').value);\n\t\tXHR.appendData('PostfixEnableMasterCfSSL',document.getElementById('PostfixEnableMasterCfSSL').value);\n\t\tXHR.sendAndLoad('{$page}', 'GET',X_enable_auth);\t\n\t\n\t}\n\t</script>\t\n\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html, 'postfix.sasl.php');
}
Example #9
0
function popup(){
	$squid=new squidbee();
	$page=CurrentPageName();
	$tpl=new templates();
	$sock=new sockets();
	$WCCP=1;
	$arrayParams=unserialize(base64_decode($sock->getFrameWork("squid.php?compile-list=yes")));
	$t=time();
	$ip=new networking();
	for($i=0;$i<255;$i++){
	$ipsH["gre$i"]="gre$i";
	}
	$SquidWCCPL3Enabled=intval($sock->GET_INFO("SquidWCCPL3Enabled"));
	$SquidWCCPL3Addr=$sock->GET_INFO("SquidWCCPL3Addr");
	$SquidWCCPL3Inter=$sock->GET_INFO("SquidWCCPL3Inter");
	$SquidWCCPL3Eth=$sock->GET_INFO("SquidWCCPL3Eth");
	$SquidWCCPL3Route=$sock->GET_INFO("SquidWCCPL3Route");
	$SquidWCCPL3ProxPort=intval($sock->GET_INFO("SquidWCCPL3ProxPort"));
	$SquidWCCPL3SSLEnabled=intval($sock->GET_INFO("SquidWCCPL3SSLEnabled"));
	$SquidWCCPL3SSServiceID=intval($sock->GET_INFO("SquidWCCPL3SSServiceID"));
	$SquidWCCPL3SSCertificate=intval($sock->GET_INFO("SquidWCCPL3SSCertificate"));
	if($SquidWCCPL3SSServiceID==0){$SquidWCCPL3SSServiceID=70;}
	
	$sslproxy_version=intval($sock->GET_INFO("sslproxy_version"));
	if($sslproxy_version==0){$sslproxy_version=1;}
	
	if($SquidWCCPL3ProxPort==0){
		$SquidWCCPL3ProxPort=rand(35000,62680);
		$sock->SET_INFO("SquidWCCPL3ProxPort", $SquidWCCPL3ProxPort);
	}
	
	$ip=new networking();
	$ipsH=$ip->Local_interfaces();
	

	
	$q=new mysql();
	include_once(dirname(__FILE__)."/ressources/class.squid.reverse.inc");
	$squid_reverse=new squid_reverse();
	$sslcertificates=$squid_reverse->ssl_certificates_list();
	
	$sslproxy_versions[1]="{default}";
	$sslproxy_versions[2]="SSLv2 {only}";
	$sslproxy_versions[3]="SSLv3 {only}";
	$sslproxy_versions[4]="TLSv1.0 {only}";
	$sslproxy_versions[5]="TLSv1.1 {only}";
	$sslproxy_versions[6]="TLSv1.2 {only}";
	
	

$html="
<table style='width:100%'>
<tr>
	<td style='width:350px;vertical-align:top'  nowrap align='top'><div id='wccp50'></div></td>
	<td style='width:99%' style='vertical-align:top'>
<div style='font-size:36px'>{WCCP_LAYER3}</div>
<div class=text-info style='font-size:14px'>{WCCP_LAYER3_EXPLAIN}</div>
<div id='SquidAVParamWCCP' style='width:98%' class=form>
<table style='width:100%'>
	<tr>
		<td colspan=3>". Paragraphe_switch_img("{wccp2_enabled}", "{wccp2_gre_enabled_explain}","SquidWCCPL3Enabled-$t","$SquidWCCPL3Enabled",null,650)."</td>
	<tr>
	

	<tr>
		<td style='font-size:22px' class=legend nowrap>{wccp_asa_addr}:</td>
		<td>". field_ipv4("SquidWCCPL3Addr-$t",$SquidWCCPL3Addr,"font-size:22px")."</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td style='font-size:22px' class=legend nowrap>{wccp_asa_int}:</td>
		<td>". field_ipv4("SquidWCCPL3Inter-$t",$SquidWCCPL3Inter,"font-size:22px")."</td>
		<td>&nbsp;</td>
	</tr>				
	<tr>
		<td style='font-size:22px' class=legend nowrap>{wccp_local_gre_interface}:</td>
		<td>". Field_array_Hash($ipsH,"SquidWCCPL3Eth-$t",
		$SquidWCCPL3Eth,"style:font-size:22px")."</td>
		<td></td>
	</tr>
	<tr>
		<td style='font-size:22px' class=legend nowrap>Route:</td>
		<td>". field_ipv4("SquidWCCPL3Route-$t",$SquidWCCPL3Route,"font-size:22px")."</td>
		<td>". help_icon("{gre_route_explain}")."</td>
	</tr>
				
	<tr>
		<td colspan=3>". Paragraphe_switch_img("{wccp2_enabled_ssl}", "{wccp2_gre_enabled_explain_ssl}","SquidWCCPL3SSLEnabled-$t","$SquidWCCPL3SSLEnabled",null,650)."</td>
	<tr>				
	<tr>
		<td style='font-size:22px;vertical-align:middle' class=legend nowrap>{service_id}:</td>
		<td>". Field_text("SquidWCCPL3SSServiceID-$t",$SquidWCCPL3SSServiceID,"font-size:22px;width:110px")."</td>
		<td></td>
	</tr>	
	<tr>
		<td style='font-size:22px;vertical-align:middle' class=legend nowrap>{certificate}:</td>
		<td>". Field_array_Hash($sslcertificates,"SquidWCCPL3SSCertificate-$t",$SquidWCCPL3SSCertificate,"style:font-size:22px")."</td>
		<td></td>
	</tr>	
	<tr>
		<td style='font-size:22px;vertical-align:middle' class=legend nowrap>{sslproxy_version}:</td>
		<td>". Field_array_Hash($sslproxy_versions,"sslproxy_version-$t",$sslproxy_version,"style:font-size:22px")."</td>
		<td></td>
	</tr>
				
			
				
				
	<tr>
		<td colspan=3 align='right'>
			<hr>
				". button("{apply}","Save$t()",32)."
		</td>
	</tr>
	</table>
</div>
</td>
</tr>
</table>
<script>
var xSave$t= function (obj) {
	var results=obj.responseText;
	if(results.length>3){alert(results);}
	Loadjs('squid.reconfigure.php?restart=yes&wccp=yes');
	
}

function Save$t(){
	var XHR = new XHRConnection();
	
	XHR.appendData('SquidWCCPL3Enabled',
	document.getElementById('SquidWCCPL3Enabled-$t').value);

	XHR.appendData('SquidWCCPL3Addr',
	document.getElementById('SquidWCCPL3Addr-$t').value);

	XHR.appendData('SquidWCCPL3Inter',
	document.getElementById('SquidWCCPL3Inter-$t').value);
	
	XHR.appendData('SquidWCCPL3Eth',
	document.getElementById('SquidWCCPL3Eth-$t').value);

	XHR.appendData('SquidWCCPL3SSLEnabled',
	document.getElementById('SquidWCCPL3SSLEnabled-$t').value);
	
	XHR.appendData('SquidWCCPL3SSServiceID',
	document.getElementById('SquidWCCPL3SSServiceID-$t').value);	
	
	XHR.appendData('SquidWCCPL3SSCertificate',
	document.getElementById('SquidWCCPL3SSCertificate-$t').value);	
	
	XHR.appendData('sslproxy_version',
	document.getElementById('sslproxy_version-$t').value);	

	XHR.appendData('SquidWCCPL3Route',
	document.getElementById('SquidWCCPL3Route-$t').value);
	
	XHR.sendAndLoad('$page', 'POST',xSave$t);
}

LoadAjax('wccp50','$page?wccp50=yes');

</script>";
	echo $tpl->_ENGINE_parse_body($html);
}
Example #10
0
function popup()
{
    $tpl = new templates();
    $sock = new sockets();
    $page = CurrentPageName();
    $users = new usersMenus();
    $squid = new squidbee();
    $EnableArticaHotSpot = $sock->GET_INFO("EnableArticaHotSpot");
    $SquidHotSpotPort = intval($sock->GET_INFO("SquidHotSpotPort"));
    $ArticaHotSpotPort = intval($sock->GET_INFO("ArticaHotSpotPort"));
    $ArticaSSLHotSpotPort = $sock->GET_INFO("ArticaSSLHotSpotPort");
    $ArticaSplashHotSpotPort = $sock->GET_INFO("ArticaSplashHotSpotPort");
    $ArticaSplashHotSpotPortSSL = $sock->GET_INFO("ArticaSplashHotSpotPortSSL");
    $ArticaSplashHotSpotCertificate = $sock->GET_INFO("ArticaSplashHotSpotCertificate");
    $SquidHotSpotSSLPort = intval($sock->GET_INFO("SquidHotSpotSSLPort"));
    $WifiDogDebugLevel = intval($sock->GET_INFO("WifiDogDebugLevel"));
    $ArticaHotSpotInterface2 = $sock->GET_INFO("ArticaHotSpotInterface2");
    $WifidogClientTimeout = intval($sock->GET_INFO("WifidogClientTimeout"));
    if ($WifidogClientTimeout < 5) {
        $WifidogClientTimeout = 30;
    }
    $HospotHTTPServerName = trim($sock->GET_INFO("HospotHTTPServerName"));
    $HotSpotDenySSL = intval($sock->GET_INFO("HotSpotDenySSL"));
    $ArticaHotSpotInterface = $sock->GET_INFO("ArticaHotSpotInterface");
    if (!$users->CONNTRACK_INSTALLED) {
        echo FATAL_ERROR_SHOW_128("{conntrackd_not_installed}");
    }
    $WifiDogDebugLevelZ[null] = "{none}";
    for ($i = 0; $i < 11; $i++) {
        $WifiDogDebugLevelZ[$i] = $i;
    }
    $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}";
    $ArticaHotSpotEnableMIT = $sock->GET_INFO("ArticaHotSpotEnableMIT");
    $ArticaHotSpotEnableProxy = $sock->GET_INFO("ArticaHotSpotEnableProxy");
    if (!is_numeric($ArticaHotSpotEnableMIT)) {
        $ArticaHotSpotEnableMIT = 1;
    }
    if (!is_numeric($ArticaHotSpotEnableProxy)) {
        $ArticaHotSpotEnableProxy = 1;
    }
    if (!is_numeric($ArticaHotSpotPort)) {
        $ArticaHotSpotPort = 0;
    }
    if (!is_numeric($ArticaSplashHotSpotPort)) {
        $ArticaSplashHotSpotPort = 16080;
    }
    if (!is_numeric($ArticaSplashHotSpotPortSSL)) {
        $ArticaSplashHotSpotPortSSL = 16443;
    }
    $Params = unserialize($sock->GET_INFO("HotSpotEvasive"));
    $ApacheEvasiveInstalled = intval($sock->GET_INFO("ApacheEvasiveInstalled"));
    if (!is_numeric($Params["DOSEnable"])) {
        $Params["DOSEnable"] = 1;
    }
    if (!is_numeric($Params["DOSHashTableSize"])) {
        $Params["DOSHashTableSize"] = 1024;
    }
    if (!is_numeric($Params["DOSPageCount"])) {
        $Params["DOSPageCount"] = 3;
    }
    if (!is_numeric($Params["DOSSiteCount"])) {
        $Params["DOSSiteCount"] = 20;
    }
    if (!is_numeric($Params["DOSPageInterval"])) {
        $Params["DOSPageInterval"] = 1;
    }
    if (!is_numeric($Params["DOSSiteInterval"])) {
        $Params["DOSSiteInterval"] = 10;
    }
    if (!is_numeric($Params["DOSBlockingPeriod"])) {
        $Params["DOSBlockingPeriod"] = 5;
    }
    $HotSpotErrorRedirect = $sock->GET_INFO("HotSpotErrorRedirect");
    $ArticaSplashHotSpotTitle = $sock->GET_INFO("ArticaSplashHotSpotTitle");
    if ($ArticaSplashHotSpotTitle == null) {
        $ArticaSplashHotSpotTitle = "HotSpot system";
    }
    if ($ArticaHotSpotPort == 0) {
        $ArticaHotSpotPort = rand(38000, 64000);
        $sock->SET_INFO("ArticaHotSpotPort", $ArticaHotSpotPort);
    }
    if ($ArticaSSLHotSpotPort == 0) {
        $ArticaSSLHotSpotPort = rand(38500, 64000);
        $sock->SET_INFO("ArticaSSLHotSpotPort", $ArticaSSLHotSpotPort);
    }
    if ($SquidHotSpotPort == 0) {
        $SquidHotSpotPort = rand(40000, 64000);
        $sock->SET_INFO("SquidHotSpotPort", $SquidHotSpotPort);
    }
    if ($SquidHotSpotSSLPort == 0) {
        $SquidHotSpotSSLPort = rand(40500, 64000);
        $sock->SET_INFO("SquidHotSpotSSLPort", $SquidHotSpotSSLPort);
    }
    $tcp = new networking();
    $interfacesZ = $tcp->Local_interfaces();
    while (list($interface, $line) = each($interfacesZ)) {
        $p = new system_nic($interface);
        if ($p->IsBridged($interface)) {
            continue;
        }
        $interfaces[$interface] = $p->NICNAME;
    }
    $HotSpotUseSSL = 1;
    $HospotNoSSL = intval($sock->GET_INFO("HospotNoSSL"));
    if ($HospotNoSSL == 1) {
        $HotSpotUseSSL = 0;
    }
    if ($HotSpotDenySSL == 1) {
        $HotSpotUseSSL = 0;
    }
    $interfaces[null] = "{none}";
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    if ($HotSpotErrorRedirect == null) {
        $HotSpotErrorRedirect = "http://www.bing.com";
    }
    $t = time();
    $html = "\n\t\n\t\n\t<div id='{$t}' class=explain style='font-size:20px'>{HotSpot_text}<br>{HotSpot_infra_text}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:99%'>\n\t\n\t<tr>\n\t\t<td  style='font-size:42px' colspan=2>{sessions}:</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{session_time}", "{wifidog_disconnect_time}") . ":</td>\n\t\t<td>" . Field_array_Hash($Timez, "WifidogClientTimeout", $WifidogClientTimeout, "style:font-size:22px") . "</td>\n\t</tr>\t\t\n\t\n\t<tr>\n\t\t<td  style='font-size:42px' colspan>{service2}:</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_port}:</td>\n\t\t<td>" . Field_text("ArticaHotSpotPort", $ArticaHotSpotPort, "font-size:22px;width:110px") . "</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{interface} (IN):</td>\n\t\t<td>" . Field_array_Hash($interfaces, "ArticaHotSpotInterface", $ArticaHotSpotInterface, "style:font-size:22px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{interface} (OUT):</td>\n\t\t<td>" . Field_array_Hash($interfaces, "ArticaHotSpotInterface2", $ArticaHotSpotInterface2, "style:font-size:22px") . "</td>\n\t</tr>\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{log_level}:</td>\n\t\t<td>" . Field_array_Hash($WifiDogDebugLevelZ, "WifiDogDebugLevel", $WifiDogDebugLevel, "style:font-size:22px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td  style='font-size:42px' colspan=2>{webserver}:</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{HospotHTTPServerName}", "{HospotHTTPServerName_explain}") . ":</td>\n\t\t<td>" . Field_text("HospotHTTPServerName", $HospotHTTPServerName, "font-size:22px;width:300px") . "</td>\n\t</tr>\n\n\t<tr><td  style='font-size:42px' colspan=2>&nbsp;</td></tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{FreeWebsEnableModEvasive}", "{mod_evasive_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_checkbox_design("DOSEnable", 1, $Params["DOSEnable"], "EvasiveDisabled()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{DOSHashTableSize}", "{DOSHashTableSize_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSHashTableSize", $Params["DOSHashTableSize"], "font-size:22px;width:110px") . "&nbsp;MB</td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{threshold}", "{DOSPageCount_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSPageCount", $Params["DOSPageCount"], "font-size:22px;width:110px") . "</td>\n\t</tr>\n\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{total_threshold}", "{DOSSiteCount_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSSiteCount", $Params["DOSSiteCount"], "font-size:22px;width:110px") . "</td>\n\t</tr>\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{page_interval}", "{DOSPageInterval_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSPageInterval", $Params["DOSPageInterval"], "font-size:22px;width:110px") . "&nbsp;{seconds}</td>\n\t</tr>\t\n\t\n\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{site_interval}", "{DOSSiteInterval_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSSiteInterval", $Params["DOSSiteInterval"], "font-size:22px;width:110px") . "&nbsp;{seconds}</td>\n\t</tr>\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{Blocking_period}", "{DOSBlockingPeriod_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("DOSBlockingPeriod", $Params["DOSBlockingPeriod"], "font-size:22px;width:110px") . "&nbsp;{seconds}</td>\n\t\t\n\t</tr>\n\t<tr><td  style='font-size:42px' colspan=2>&nbsp;</td></tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_authentication_http_port}:</td>\n\t\t<td>" . Field_text("ArticaSplashHotSpotPort", $ArticaSplashHotSpotPort, "font-size:22px;width:110px") . "</td>\n\t</tr>\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_authentication_https_port}:</td>\n\t\t<td>" . Field_text("ArticaSplashHotSpotPortSSL", $ArticaSplashHotSpotPortSSL, "font-size:22px;width:110px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{http_error_redirect}", "{wifidog_http_error_redirect_explain}") . ":</td>\n\t\t<td>" . Field_text("HotSpotErrorRedirect", $HotSpotErrorRedirect, "font-size:22px;width:400px") . "</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{ssl_redirection}", "{wifidog_use_ssl_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("HotSpotUseSSL", 1, $HotSpotUseSSL) . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{deny_ssl}", "{wifidog_deny_ssl_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("HotSpotDenySSL", 1, $HotSpotDenySSL) . "</td>\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px;'>{certificate}:</td>\n\t\t<td >" . Field_array_Hash($sslcertificates, "ArticaSplashHotSpotCertificate", $ArticaSplashHotSpotCertificate, null, null, 0, "font-size:22px") . "</td>\n\t</tr>\n<tr><td style='font-size:16px;text-align:right' colspan=2> " . texttooltip("{see} {certificates_center}", "position:right:{certificate_center_explain}", "GotoCertificatesCenter()") . "</td>\n</tr>\n\t\t\t\t\t\t\n\t<tr>\n\t\t<td  style='font-size:42px' colspan=2>Proxy:</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{transparent_ssl}", "{wifidog_transparent_ssl_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("ArticaHotSpotEnableMIT", 1, $ArticaHotSpotEnableMIT) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>." . texttooltip("{transparent_http}", "{wifidog_transparent_http_explain}") . ":</td>\n\t\t<td>" . Field_checkbox_design("ArticaHotSpotEnableProxy", 1, $ArticaHotSpotEnableProxy) . "</td>\n\t</tr>\t\t\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_proxy_http_port}:</td>\n\t\t<td>" . Field_text("SquidHotSpotPort", $SquidHotSpotPort, "font-size:22px;width:110px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_proxy_https_port}:</td>\n\t\t<td>" . Field_text("SquidHotSpotSSLPort", $SquidHotSpotSSLPort, "font-size:22px;width:110px") . "</td>\n\t</tr>\t\t\t\t\t\n\n\t\t\t\t\t\t\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "SaveHotSpot()", "42px") . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\tvar x_SaveHotSpot= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\tLoadjs('squid.webauth.restart.php');\n\n\t}\n\n\nfunction SaveHotSpot(){\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\tXHR.appendData('ArticaHotSpotPort',document.getElementById('ArticaHotSpotPort').value);\n\t\tXHR.appendData('SquidHotSpotPort',document.getElementById('SquidHotSpotPort').value);\n\t\t\n\t\tXHR.appendData('ArticaSplashHotSpotPort',document.getElementById('ArticaSplashHotSpotPort').value);\n\t\tXHR.appendData('ArticaSplashHotSpotPortSSL',document.getElementById('ArticaSplashHotSpotPortSSL').value);\n\t\tXHR.appendData('ArticaHotSpotInterface',document.getElementById('ArticaHotSpotInterface').value);\n\t\tXHR.appendData('ArticaHotSpotInterface2',document.getElementById('ArticaHotSpotInterface2').value);\n\t\tXHR.appendData('HospotHTTPServerName',document.getElementById('HospotHTTPServerName').value);\n\t\t\n\t\tXHR.appendData('ArticaSplashHotSpotCertificate',document.getElementById('ArticaSplashHotSpotCertificate').value);\n\t\t\n\t\tXHR.appendData('WifiDogDebugLevel',document.getElementById('WifiDogDebugLevel').value);\n\t\tXHR.appendData('WifidogClientTimeout',document.getElementById('WifidogClientTimeout').value);\n\t\t\n\t\t\n\t\tif(document.getElementById('DOSEnable').checked){XHR.appendData('DOSEnable',1);}else{XHR.appendData('DOSEnable',0);}\n\t\tXHR.appendData('DOSHashTableSize',document.getElementById('DOSHashTableSize').value);\n\t\tXHR.appendData('DOSPageCount',document.getElementById('DOSPageCount').value);\n\t\tXHR.appendData('DOSSiteCount',document.getElementById('DOSSiteCount').value);\n\t\tXHR.appendData('DOSPageInterval',document.getElementById('DOSPageInterval').value);\n\t\tXHR.appendData('DOSSiteInterval',document.getElementById('DOSSiteInterval').value);\n\t\tXHR.appendData('DOSBlockingPeriod',document.getElementById('DOSBlockingPeriod').value);\n\t\t\n\t\t\n\t\tif(document.getElementById('ArticaHotSpotEnableMIT').checked){\n\t\t\tXHR.appendData('ArticaHotSpotEnableMIT',1);\n\t\t}else{\n\t\t\tXHR.appendData('ArticaHotSpotEnableMIT',0);\n\t\t}\n\t\tif(document.getElementById('HotSpotUseSSL').checked){\n\t\t\tXHR.appendData('HospotNoSSL',0);\n\t\t}else{\n\t\t\tXHR.appendData('HospotNoSSL',1);\n\t\t}\n\t\tif(document.getElementById('HotSpotDenySSL').checked){\n\t\t\tXHR.appendData('HotSpotDenySSL',1);\n\t\t}else{\n\t\t\tXHR.appendData('HotSpotDenySSL',0);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tif(document.getElementById('ArticaHotSpotEnableProxy').checked){\n\t\t\tXHR.appendData('ArticaHotSpotEnableProxy',1);\n\t\t}else{\n\t\t\tXHR.appendData('ArticaHotSpotEnableProxy',0);\n\t\t}\t\n\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveHotSpot);\n\t}\t\n\n\t\n\t\n\tfunction EvasiveDisabled(){\n\t\tdocument.getElementById('DOSHashTableSize').disabled=true;\n\t\tdocument.getElementById('DOSPageCount').disabled=true;\n\t\tdocument.getElementById('DOSSiteCount').disabled=true;\n\t\tdocument.getElementById('DOSPageInterval').disabled=true;\n\t\tdocument.getElementById('DOSSiteInterval').disabled=true;\n\t\tdocument.getElementById('DOSBlockingPeriod').disabled=true;\n\t\t\n\t\tvar ApacheEvasiveInstalled={$ApacheEvasiveInstalled};\n\t\tif(ApacheEvasiveInstalled==0){\n\t\t\tdocument.getElementById('DOSEnable').checked=false;\n\t\t\tdocument.getElementById('DOSEnable').disabled=true;\n\t\t\treturn;\n\t\t}\n\t\n\t\tif(document.getElementById('DOSEnable').checked){\t\n\t\t\tdocument.getElementById('DOSHashTableSize').disabled=false;\n\t\t\tdocument.getElementById('DOSPageCount').disabled=false;\n\t\t\tdocument.getElementById('DOSSiteCount').disabled=false;\n\t\t\tdocument.getElementById('DOSPageInterval').disabled=false;\n\t\t\tdocument.getElementById('DOSSiteInterval').disabled=false;\n\t\t\tdocument.getElementById('DOSBlockingPeriod').disabled=false;\t\n\t\t\t}\t\t\n\t}\t\n\t\nEvasiveDisabled();\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #11
0
function certificate_refresh()
{
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $t = $_GET["t"];
    $default = $_GET["default"];
    echo Field_array_Hash($sslcertificates, "sslcertificate-{$t}", $default, "style:font-size:20px");
}
Example #12
0
function popup()
{
    $page = CurrentPageName();
    $sock = new sockets();
    $users = new usersMenus();
    $t = time();
    $LICENSE = 0;
    if ($users->CORP_LICENSE) {
        $LICENSE = 1;
    }
    $EnableSquidGuardHTTPService = $sock->GET_INFO("EnableSquidGuardHTTPService");
    if (strlen(trim($EnableSquidGuardHTTPService)) == 0) {
        $EnableSquidGuardHTTPService = 1;
    }
    $EnableUfdbGuard = intval($sock->GET_INFO("EnableUfdbGuard"));
    $SquidGuardApacheSSLPort = $sock->GET_INFO("SquidGuardApacheSSLPort");
    $SquidGuardApachePort = intval($sock->GET_INFO("SquidGuardApachePort"));
    $SquidGuardWebBlankReferer = intval($sock->GET_INFO("SquidGuardWebBlankReferer"));
    $SquidGuardWebSSLCertificate = $sock->GET_INFO("SquidGuardWebSSLCertificate");
    $SquidGuardRedirectBehavior = $sock->GET_INFO("SquidGuardRedirectBehavior");
    $SquidGuardRedirectSSLBehavior = $sock->GET_INFO("SquidGuardRedirectSSLBehavior");
    $SquidGuardRedirectHTTPCode = intval($sock->GET_INFO("SquidGuardRedirectHTTPCode"));
    if ($SquidGuardRedirectBehavior == null) {
        $SquidGuardRedirectBehavior = "url";
    }
    if ($SquidGuardRedirectSSLBehavior == null) {
        $SquidGuardRedirectSSLBehavior = "url";
    }
    if (!is_numeric($SquidGuardRedirectHTTPCode)) {
        $SquidGuardRedirectHTTPCode = 302;
    }
    $HTTP_CODE[301] = "{Moved_Permanently} (301)";
    $HTTP_CODE[302] = "{Moved_Temporarily} (302)";
    $HTTP_CODE[303] = "{http_code_see_other} (303)";
    $HTTP_CODE[307] = "{Moved_Temporarily} (307)";
    if (!is_numeric($SquidGuardApacheSSLPort)) {
        $SquidGuardApacheSSLPort = 9025;
    }
    if ($SquidGuardApachePort == 0) {
        $SquidGuardApachePort = 9020;
    }
    $ALERT = null;
    $SquidGuardIPWeb = $sock->GET_INFO("SquidGuardIPWeb");
    $fulluri = $sock->GET_INFO("SquidGuardIPWeb");
    $SquidGuardWebFollowExtensions = $sock->GET_INFO("SquidGuardWebFollowExtensions");
    $SquidGuardWebUseExternalUri = intval($sock->GET_INFO("SquidGuardWebUseExternalUri"));
    $DisableSquidGuardHTTPCache = intval($sock->GET_INFO("DisableSquidGuardHTTPCache"));
    $EnableSquidGuardHTTPCache = 1;
    if ($DisableSquidGuardHTTPCache == 1) {
        $EnableSquidGuardHTTPCache = 0;
    }
    $SquidGuardDenySSL = intval($sock->GET_INFO("SquidGuardDenySSL"));
    if ($SquidGuardDenySSL == 0) {
        $SquidGuardSSL = 1;
    } else {
        $SquidGuardSSL = 0;
    }
    $SquidGuardServerName = $sock->GET_INFO("SquidGuardServerName");
    $EnableSquidGuardMicrosoftTPL = intval($sock->GET_INFO("EnableSquidGuardMicrosoftTPL"));
    $EnableSquidGuardSearchCategoryNone = intval($sock->GET_INFO("EnableSquidGuardSearchCategoryNone"));
    $SquidGuardServerName = $sock->GET_INFO("SquidGuardServerName");
    if ($SquidGuardIPWeb == null) {
        $SquidGuardIPWeb = "http://" . $_SERVER['SERVER_ADDR'] . ':' . $SquidGuardApachePort . "/exec.squidguard.php";
        $SquidGuardIPWebSSL = "https://" . $_SERVER['SERVER_ADDR'] . ':' . $SquidGuardApacheSSLPort . "/exec.squidguard.php";
        $fulluri = "http://" . $_SERVER['SERVER_ADDR'] . ':' . $SquidGuardApachePort . "/exec.squidguard.php";
        $fulluriSSL = "https://" . $_SERVER['SERVER_ADDR'] . ':' . $SquidGuardApacheSSLPort . "/exec.squidguard.php";
    }
    $SquidGuardIPWeb = str_replace("http://", null, $SquidGuardIPWeb);
    $SquidGuardIPWeb = str_replace("https://", null, $SquidGuardIPWeb);
    $fulluriSSL = $SquidGuardIPWeb;
    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 (!is_numeric($SquidGuardWebFollowExtensions)) {
        $SquidGuardWebFollowExtensions = 1;
    }
    $fulluriSSL = str_replace($SquidGuardApachePort, $SquidGuardApacheSSLPort, $fulluriSSL);
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $button = button("{apply}", "SaveSquidGuardHTTPService{$t}()", 40);
    $p1 = Paragraphe_switch_img("{enable_http_service}", "{enable_http_service_squidguard}", "EnableSquidGuardHTTPService", $EnableSquidGuardHTTPService, null, 1024, "EnableSquidGuardHTTPService()");
    if ($SquidGuardWebUseExternalUri == 1) {
        $p1 = Paragraphe_switch_disable("{enable_http_service}", "<strong style='color:#d32d2d'>{service_disabled_because_external_webpage}<br></strong>{enable_http_service_squidguard}", "EnableSquidGuardHTTPService", $EnableSquidGuardHTTPService, null, 1024, "EnableSquidGuardHTTPService()");
        $button = null;
    }
    if ($EnableUfdbGuard == 0) {
        $p1 = Paragraphe_switch_disable("{enable_http_service}", "<strong style='color:#d32d2d'>{webfiltering_is_disabled}</strong><br>{enable_http_service_squidguard}", "EnableSquidGuardHTTPService", $EnableSquidGuardHTTPService, null, 1024, "EnableSquidGuardHTTPService()");
    }
    $p4 = Paragraphe_switch_img("{EnableSquidGuardSearchCategoryNone}", "{EnableSquidGuardSearchCategoryNone_explain}", "EnableSquidGuardSearchCategoryNone", $EnableSquidGuardSearchCategoryNone, null, 1024, "");
    $p2 = Paragraphe_switch_img("{webfiltering_cache_page}", "{webfiltering_cache_page_explain}", "EnableSquidGuardHTTPCache", $EnableSquidGuardHTTPCache, null, 1024, "");
    $p3 = Paragraphe_switch_img("{SquidTemplatesMicrosoft}", "{SquidTemplatesMicrosoft_explain}", "EnableSquidGuardMicrosoftTPL", $EnableSquidGuardMicrosoftTPL, null, 1024);
    $redirect_behaviorA["url"] = "{redirect_connexion}";
    $redirect_behaviorA["rewrite-url"] = "{rewrite_url}";
    $html = "\n\t<div id='EnableSquidGuardHTTPServiceDiv'>\n\t<div style='width:98%' class=form>\n\t\n\t<div class=explain style='font-size:20px'>{ufdbguard_redirect_ssl_explain}</div>\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t\t\n\t\t<td style='vertical-align:top'><div id='squid-guard-http-status' style='margin-right:10px'></div></td>\n\t\t<td colspan=2>{$p1}" . $p2 . $p3 . $p4 . Paragraphe_switch_img("{FollowExtensions}", "{SquidGuardWebFollowExtensions_explain}", "SquidGuardWebFollowExtensions", $SquidGuardWebFollowExtensions, null, 1024, "EnableSquidGuardHTTPService()") . Paragraphe_switch_img("{SquidGuardWebBlankReferer}", "{SquidGuardWebBlankReferer_explain}", "SquidGuardWebBlankReferer", $SquidGuardWebBlankReferer, null, 1024, "EnableSquidGuardHTTPService()") . Paragraphe_switch_img("{redirect_ssl}", "{ufdb_redirect_ssl_explain}", "SquidGuardSSL", $SquidGuardSSL, null, 1024) . "</td>\t\n\t\t\t\t\t\t\t\n\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{listen_port}:</td>\n\t\t<td>" . Field_text("listen_port_squidguard", $SquidGuardApachePort, "font-size:24px;padding:3px;width:110px", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{listen_port} (SSL):</td>\n\t\t<td>" . Field_text("listen_port_squidguard_ssl", $SquidGuardApacheSSLPort, "font-size:24px;padding:3px;width:110px", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{certificate}:</td>\n\t\t<td>" . Field_array_Hash($sslcertificates, "SquidGuardWebSSLCertificate", $SquidGuardWebSSLCertificate, "style:font-size:24px;padding:3px;width:75%", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{redirect_behavior}:</td>\n\t\t<td>" . Field_array_Hash($redirect_behaviorA, "SquidGuardRedirectBehavior", $SquidGuardRedirectBehavior, "style:font-size:24px;padding:3px;width:75%", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{redirect_behavior} (ssl):</td>\n\t\t<td>" . Field_array_Hash($redirect_behaviorA, "SquidGuardRedirectSSLBehavior", $SquidGuardRedirectSSLBehavior, "style:font-size:24px;padding:3px;width:75%", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{redirect_code}:</td>\n\t\t<td>" . Field_array_Hash($HTTP_CODE, "SquidGuardRedirectHTTPCode", $SquidGuardRedirectHTTPCode, "style:font-size:24px;padding:3px;width:75%", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{hostname}:</td>\n\t\t<td style='font-size:14px'>" . Field_text("servername_squidguard", $SquidGuardServerName, "font-size:24px;padding:3px;width:380px", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{fulluri}:</td>\n\t\t<td style='font-size:24px'>" . Field_text("fulluri", "{$fulluri}", "font-size:22px;padding:3px;width:660px", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{fulluri} (ssl):</td>\n\t\t<td style='font-size:24px'>" . Field_text("fulluriSSL", "{$fulluriSSL}", "font-size:22px;padding:3px;width:660px", null, null, null, false, "") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . $button . "</td>\n\t</tr>\t\n\t</table>\n\t</div>\n<script>\nfunction EnableSquidGuardHTTPService(){\n\tvar LICENSE={$LICENSE};\n\t document.getElementById('listen_port_squidguard').disabled=true;\n\t document.getElementById('listen_port_squidguard_ssl').disabled=true;\n\t document.getElementById('servername_squidguard').disabled=true;\n\t document.getElementById('fulluri').disabled=true;\n\t document.getElementById('fulluriSSL').disabled=true;\n\t document.getElementById('SquidGuardWebFollowExtensions').disabled=true;\n\t document.getElementById('SquidGuardWebSSLCertificate').disabled=true;\n\t document.getElementById('EnableSquidGuardHTTPCache').disabled=true;\n\t document.getElementById('SquidGuardRedirectBehavior').disabled=true;\n\t document.getElementById('SquidGuardRedirectHTTPCode').disabled=true;\n\t document.getElementById('SquidGuardRedirectSSLBehavior').disabled=true;\n\t\t\t \n\tif(document.getElementById('EnableSquidGuardHTTPService').value==1){\n\t\tdocument.getElementById('listen_port_squidguard').disabled=false;\n\t\tdocument.getElementById('listen_port_squidguard_ssl').disabled=false;\n\t\tdocument.getElementById('servername_squidguard').disabled=false;\n\t\tdocument.getElementById('SquidGuardWebFollowExtensions').disabled=false;\n\t\tdocument.getElementById('SquidGuardWebBlankReferer').disabled=false;\n\t\tdocument.getElementById('SquidGuardWebSSLCertificate').disabled=false;\n\t\tdocument.getElementById('EnableSquidGuardHTTPCache').disabled=false;\n\t\tdocument.getElementById('SquidGuardRedirectBehavior').disabled=false;\n\t \tdocument.getElementById('SquidGuardRedirectHTTPCode').disabled=false;\n\t \tdocument.getElementById('SquidGuardRedirectSSLBehavior').disabled=false;\n\t}\n\t\t\t \n\t\t\t\n}\n\t\t\nvar x_SaveSquidGuardHTTPService{$t}=function(obj){\n\t \tLoadjs('dansguardian2.compile.php');\n}\n\nfunction SaveSquidGuardHTTPService{$t}(){\n     var XHR = new XHRConnection();\n     \n     XHR.appendData('EnableSquidGuardMicrosoftTPL',document.getElementById('EnableSquidGuardMicrosoftTPL').value);\n  \t XHR.appendData('SquidGuardWebBlankReferer',document.getElementById('SquidGuardWebBlankReferer').value);\n     XHR.appendData('SquidGuardWebFollowExtensions',document.getElementById('SquidGuardWebFollowExtensions').value);\n     XHR.appendData('EnableSquidGuardHTTPService',document.getElementById('EnableSquidGuardHTTPService').value);\n\t XHR.appendData('listen_port_squidguard',document.getElementById('listen_port_squidguard').value);\n\t XHR.appendData('listen_port_squidguard_ssl',document.getElementById('listen_port_squidguard_ssl').value);\n\t XHR.appendData('SquidGuardWebSSLCertificate',document.getElementById('SquidGuardWebSSLCertificate').value);\n\t XHR.appendData('servername_squidguard',document.getElementById('servername_squidguard').value);\n     XHR.appendData('fulluri',document.getElementById('fulluri').value);\n     XHR.appendData('fulluriSSL',document.getElementById('fulluriSSL').value);\n     XHR.appendData('EnableSquidGuardHTTPCache',document.getElementById('EnableSquidGuardHTTPCache').value);\n     XHR.appendData('SquidGuardRedirectBehavior',document.getElementById('SquidGuardRedirectBehavior').value);\n     XHR.appendData('SquidGuardRedirectHTTPCode',document.getElementById('SquidGuardRedirectHTTPCode').value);\n     XHR.appendData('SquidGuardRedirectSSLBehavior',document.getElementById('SquidGuardRedirectSSLBehavior').value);\n     XHR.appendData('EnableSquidGuardSearchCategoryNone',document.getElementById('EnableSquidGuardSearchCategoryNone').value);\n     \n     \n     \n     XHR.appendData('SquidGuardSSL',document.getElementById('SquidGuardSSL').value);\n     \n     \n     XHR.sendAndLoad('{$page}', 'GET',x_SaveSquidGuardHTTPService{$t});     \t\n}\n\t\nEnableSquidGuardHTTPService();\nLoadAjaxSilent('squid-guard-http-status','squidguardweb.service.php');\n</script>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Example #13
0
function popup(){
	$tpl=new templates();
	$sock=new sockets();
	$page=CurrentPageName();
	$users=new usersMenus();
	$squid=new squidbee();
	$EnableArticaHotSpot=$sock->GET_INFO("EnableArticaHotSpot");
	$SquidHotSpotPort=intval($sock->GET_INFO("SquidHotSpotPort"));
	$ArticaHotSpotPort=intval($sock->GET_INFO("ArticaHotSpotPort"));
	$ArticaSSLHotSpotPort=$sock->GET_INFO("ArticaSSLHotSpotPort");
	$ArticaSplashHotSpotPort=$sock->GET_INFO("ArticaSplashHotSpotPort");
	$ArticaSplashHotSpotPortSSL=$sock->GET_INFO("ArticaSplashHotSpotPortSSL");
	$ArticaSplashHotSpotCacheAuth=$sock->GET_INFO("ArticaSplashHotSpotCacheAuth");
	$ArticaSplashHotSpotCertificate=$sock->GET_INFO("ArticaSplashHotSpotCertificate");
	$ArticaSplashHotSpotEndTime=$sock->GET_INFO("ArticaSplashHotSpotEndTime");
	$SquidHotSpotSSLPort=intval($sock->GET_INFO("SquidHotSpotSSLPort"));
	$WifiDogDebugLevel=intval($sock->GET_INFO("WifiDogDebugLevel"));
	$ArticaHotSpotInterface2=$sock->GET_INFO("ArticaHotSpotInterface2");
	
	
	if(!is_numeric($ArticaSplashHotSpotCacheAuth)){$ArticaSplashHotSpotCacheAuth=60;}
	if(!is_numeric($ArticaSplashHotSpotEndTime)){$ArticaSplashHotSpotEndTime=0;}
	
	$ArticaHotSpotInterface=$sock->GET_INFO("ArticaHotSpotInterface");
	
	if(!$users->CONNTRACK_INSTALLED){
		echo FATAL_WARNING_SHOW_128("{conntrackd_not_installed}");
	}
	
	for($i=0;$i<11;$i++){
		$WifiDogDebugLevelZ[$i]=$i;
	}
	
	$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[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}";
	
	$ArticaHotSpotEnableMIT=$sock->GET_INFO("ArticaHotSpotEnableMIT");
	$ArticaHotSpotEnableProxy=$sock->GET_INFO("ArticaHotSpotEnableProxy");
	
	if(!is_numeric($ArticaHotSpotEnableMIT)){$ArticaHotSpotEnableMIT=1;}
	if(!is_numeric($ArticaHotSpotEnableProxy)){$ArticaHotSpotEnableProxy=1;}
	
	if(!is_numeric($ArticaHotSpotPort)){$ArticaHotSpotPort=0;}
	if(!is_numeric($ArticaSplashHotSpotPort)){$ArticaSplashHotSpotPort=16080;}
	if(!is_numeric($ArticaSplashHotSpotPortSSL)){$ArticaSplashHotSpotPortSSL=16443;}
	
	
	$ArticaSplashHotSpotTitle=$sock->GET_INFO("ArticaSplashHotSpotTitle");
	if($ArticaSplashHotSpotTitle==null){$ArticaSplashHotSpotTitle="HotSpot system";}
	
	if($ArticaHotSpotPort==0){
		$ArticaHotSpotPort=rand(38000, 64000);
		$sock->SET_INFO("ArticaHotSpotPort", $ArticaHotSpotPort);
	}
	
	if($ArticaSSLHotSpotPort==0){
		$ArticaSSLHotSpotPort=rand(38500, 64000);
		$sock->SET_INFO("ArticaSSLHotSpotPort", $ArticaSSLHotSpotPort);
	}
	
	if($SquidHotSpotPort==0){
		$SquidHotSpotPort=rand(40000, 64000);
		$sock->SET_INFO("SquidHotSpotPort", $SquidHotSpotPort);
	}
	
	if($SquidHotSpotSSLPort==0){
		$SquidHotSpotSSLPort=rand(40500, 64000);
		$sock->SET_INFO("SquidHotSpotSSLPort", $SquidHotSpotSSLPort);
	}
	
	
	$tcp=new networking();
	$interfacesZ=$tcp->Local_interfaces();
	while (list ($interface, $line) = each ($interfacesZ) ){
		$p=new system_nic($interface);
		if($p->IsBridged($interface)){continue;}
		$interfaces[$interface]=$p->NICNAME;
		
	}
	
	
	
	
	
	$interfaces[null]="{none}";
	include_once(dirname(__FILE__)."/ressources/class.squid.reverse.inc");
	$squid_reverse=new squid_reverse();
	$sslcertificates=$squid_reverse->ssl_certificates_list();
	
	
	$t=time();
	$html="
	
	
	<div id='$t' class=text-info style='font-size:18px'>{HotSpot_text}</div>
	<div style='width:98%' class=form>
	<table style='width:99%'>
	<tr>
		<td colspan=2>
		<center><img src='img/hotspot-howto.png' align=center></center>
		</td>
	</tr>
	<tr>
		<td  style='font-size:42px' colspan>{service2}:</td>
	</tr>		
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (HotSpot):</td>
		<td>". Field_text("ArticaHotSpotPort",$ArticaHotSpotPort,"font-size:22px;width:110px")."</td>
	</tr>		
	<tr>
		<td class=legend style='font-size:22px'>{interface} (IN):</td>
		<td>". Field_array_Hash($interfaces,"ArticaHotSpotInterface", $ArticaHotSpotInterface,"style:font-size:22px")."</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{interface} (OUT):</td>
		<td>". Field_array_Hash($interfaces,"ArticaHotSpotInterface2", $ArticaHotSpotInterface2,"style:font-size:22px")."</td>
	</tr>
				
	<tr>
		<td class=legend style='font-size:22px'>{log_level}:</td>
		<td>". Field_array_Hash($WifiDogDebugLevelZ,"WifiDogDebugLevel", $WifiDogDebugLevel,"style:font-size:22px")."</td>
	</tr>				
	<tr>
		<td  style='font-size:42px' colspan>{webserver}:</td>
	</tr>	
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (splash):</td>
		<td>". Field_text("ArticaSplashHotSpotPort",$ArticaSplashHotSpotPort,"font-size:22px;width:110px")."</td>
	</tr>							
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (splash/SSL):</td>
		<td>". Field_text("ArticaSplashHotSpotPortSSL",$ArticaSplashHotSpotPortSSL,"font-size:22px;width:110px")."</td>
	</tr>
	<tr>
		<td  style='font-size:42px' colspan>Proxy:</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{transparent_ssl}:</td>
		<td>". Field_checkbox("ArticaHotSpotEnableMIT",1,$ArticaHotSpotEnableMIT)."</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{transparent_http}:</td>
		<td>". Field_checkbox("ArticaHotSpotEnableProxy",1,$ArticaHotSpotEnableProxy)."</td>
	</tr>									
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (Proxy HTTP):</td>
		<td>". Field_text("SquidHotSpotPort",$SquidHotSpotPort,"font-size:22px;width:110px")."</td>
	</tr>	
	<tr>
		<td class=legend style='font-size:22px'>{listen_port} (Proxy SSL):</td>
		<td>". Field_text("SquidHotSpotSSLPort",$SquidHotSpotSSLPort,"font-size:22px;width:110px")."</td>
	</tr>					
	
	<tr>
		<td  style='font-size:42px' colspan>{defaults}:</td>
	</tr>	
	<tr>
		<td class=legend style='font-size:22px;text-transform:capitalize'>{re_authenticate_each} ({default}):</td>
		<td style='font-size:18px'>". Field_array_Hash($Timez,"ArticaSplashHotSpotCacheAuth",
					$ArticaSplashHotSpotCacheAuth,null,null,0,"font-size:22px")."</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px;text-transform:capitalize'>{endtime} ({default}):</td>
		<td style='font-size:18px'>". Field_array_Hash($Timez,"ArticaSplashHotSpotEndTime",
				$ArticaSplashHotSpotEndTime,null,null,0,"font-size:22px")."</td>
	</tr>
				
	<tr>
		<td  style='font-size:42px' colspan>{web_page}:</td>
	</tr>
	<tr>
		<td class=legend style='font-size:22px'>{title2}:</td>
		<td>". Field_text("ArticaSplashHotSpotTitle",$ArticaSplashHotSpotTitle,"font-size:22px;width:390px")."</td>
	</tr>	
	<tr>
		<td class=legend nowrap style='font-size:22px;'>{certificate}:</td>
		<td >". Field_array_Hash($sslcertificates, "ArticaSplashHotSpotCertificate",
				$ArticaSplashHotSpotCertificate,null,null,0,"font-size:22px")."</td>
	</tr>
	<tr>
		<td colspan=2 align='right'><hr>". button("{apply}","SaveHotSpot()","42px")."</td>
	</tr>
	</table>
	</div>
	<script>
	var x_SaveHotSpot= function (obj) {
		var results=obj.responseText;
		if(results.length>3){alert(results);return;}
		Loadjs('squid.webauth.restart.php');

	}


function SaveHotSpot(){
		var XHR = new XHRConnection();
		
		XHR.appendData('ArticaHotSpotPort',document.getElementById('ArticaHotSpotPort').value);
		XHR.appendData('SquidHotSpotPort',document.getElementById('SquidHotSpotPort').value);
		
		XHR.appendData('ArticaSplashHotSpotPort',document.getElementById('ArticaSplashHotSpotPort').value);
		XHR.appendData('ArticaSplashHotSpotPortSSL',document.getElementById('ArticaSplashHotSpotPortSSL').value);
		XHR.appendData('ArticaHotSpotInterface',document.getElementById('ArticaHotSpotInterface').value);
		XHR.appendData('ArticaHotSpotInterface2',document.getElementById('ArticaHotSpotInterface2').value);
		
		XHR.appendData('ArticaSplashHotSpotCacheAuth',document.getElementById('ArticaSplashHotSpotCacheAuth').value);
		XHR.appendData('ArticaSplashHotSpotCertificate',document.getElementById('ArticaSplashHotSpotCertificate').value);
		XHR.appendData('ArticaSplashHotSpotEndTime',document.getElementById('ArticaSplashHotSpotEndTime').value);
		XHR.appendData('WifiDogDebugLevel',document.getElementById('WifiDogDebugLevel').value);
		
		
		if(document.getElementById('ArticaHotSpotEnableMIT').checked){
			XHR.appendData('ArticaHotSpotEnableMIT',1);
		}else{
			XHR.appendData('ArticaHotSpotEnableMIT',0);
		}
		if(document.getElementById('ArticaHotSpotEnableProxy').checked){
			XHR.appendData('ArticaHotSpotEnableProxy',1);
		}else{
			XHR.appendData('ArticaHotSpotEnableProxy',0);
		}		
		
		
		var ArticaSplashHotSpotTitle=encodeURIComponent(document.getElementById('ArticaSplashHotSpotTitle').value);
		XHR.appendData('ArticaSplashHotSpotTitle',document.getElementById('ArticaSplashHotSpotTitle').value);
		XHR.sendAndLoad('$page', 'POST',x_SaveHotSpot);
	}		
	</script>
	";
	
	echo $tpl->_ENGINE_parse_body($html);
	
	
}
function server()
{
    $vpn = new openvpn();
    $nic = new networking();
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $OpenVpnPasswordCert = $sock->GET_INFO("OpenVpnPasswordCert");
    if ($OpenVpnPasswordCert == null) {
        $OpenVpnPasswordCert = "MyKey";
    }
    while (list($num, $ligne) = each($nic->array_TCP)) {
        if ($ligne == null) {
            continue;
        }
        if (preg_match("#^tun[0-9]+#", $num)) {
            continue;
        }
        $ips[$ligne] = "{$ligne} ({$num})";
        $arr[$num] = $num;
        $ipeth[$num] = "{$num} ({$ligne})";
    }
    $ips["127.0.0.1"] = "{loopback}";
    $ips[null] = "{all}";
    $ipeth[null] = "{none}";
    $nics = Field_array_Hash($arr, 'BRIDGE_ETH', $vpn->main_array["GLOBAL"]["BRIDGE_ETH"], 'OpenVPNChangeNIC()');
    $ips = Field_array_Hash($ips, 'LOCAL_BIND', $vpn->main_array["GLOBAL"]["LOCAL_BIND"], null, null, 0, 'font-size:22px;padding:3px');
    $IPTABLES_ETH = Field_array_Hash($ipeth, 'IPTABLES_ETH', $vpn->main_array["GLOBAL"]["IPTABLES_ETH"], null, null, 0, 'font-size:14px;padding:3px');
    $protocol = Field_array_Hash(array("tcp" => "TCP", "udp" => "UDP"), "LISTEN_PROTO", $vpn->main_array["GLOBAL"]["LISTEN_PROTO"], null, null, 0, 'font-size:22px;padding:3px');
    $CLIENT_NAT_PORT = $vpn->main_array["GLOBAL"]["CLIENT_NAT_PORT"];
    if ($CLIENT_NAT_PORT == null) {
        $CLIENT_NAT_PORT = $vpn->main_array["GLOBAL"]["LISTEN_PORT"];
    }
    if (intval($vpn->main_array["GLOBAL"]["LISTEN_PORT"]) == 0) {
        $vpn->main_array["GLOBAL"]["LISTEN_PORT"] = 1194;
    }
    $sql = "SELECT CommonName FROM sslcertificates ORDER BY CommonName";
    $q = new mysql();
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $sslcertificateF = Field_array_Hash($sslcertificates, "OPENVPN_CERTIFICATE", $vpn->main_array["GLOBAL"]["CERTIFICATE"], "style:font-size:22px");
    //
    $html = "\n\n<div id='openvpnserverform'>\n<div style='font-size:32px'><strong>{service_parameters}</strong></div>\n<div style='width:98%' class=form>\n<table style='width:99%'>\n<tr>\n\t\t<td colspan=3>" . Paragraphe_switch_img("{enable_openvpn_server_mode}", "{enable_openvpn_server_mode_text}", "ENABLE_SERVER", $vpn->main_array["GLOBAL"]["ENABLE_SERVER"], null, 850, "DisableOpenVPNFields()") . "</td>\n</tr>\n\n<tr>\n\t<td class=legend style='font-size:22px' id='LOCAL_BIND_FIELD'>{openvpn_local}:</td>\n\t<td>{$ips}</td>\n\t<td>" . help_icon("{openvpn_local_text}") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:22px' id='LISTEN_PORT_FIELD'>{listen_port}:</td>\n\t<td>" . Field_text('LISTEN_PORT', intval($vpn->main_array["GLOBAL"]["LISTEN_PORT"]), 'width:190px;font-size:22px;padding:3px') . "</td>\n\t<td>&nbsp;</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:22px' id='LISTEN_PROTO_FIELD'>{protocol}:</td>\n\t<td>{$protocol}</td>\n\t<td>&nbsp;</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:22px'>{certificate}:</td>\n\t<td>{$sslcertificateF}</td>\n\t<td>&nbsp;</td>\n</tr>\n<tr><td colspan=3 align='right'><hr>" . button("{apply}", "SaveOpenVpnServerParams()", 32) . "</td></tr>\n</table>\n<div style='font-size:32px'><strong>{service_informations}</strong></div>\n<div class=text-info style='font-size:18px'>{openvpn_ippub_explain}</div>\n<table style='width:99%' class=form>\n<tr>\n\t<td class=legend style='font-size:22px' id='PUBLIC_IP_FIELD'>{public_ip_addr}:</td>\n\t<td style='font-size:22px;'>" . Field_text('PUBLIC_IP', $vpn->main_array["GLOBAL"]["PUBLIC_IP"], 'width:220px;;font-size:22px;padding:3px') . "</td>\n\t<td>&nbsp;</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:22px' id='useProxy'>{reverse_proxy}:</td>\n\t<td style='font-size:22px;'>" . Field_checkbox('USE_RPROXY', 1, $vpn->main_array["GLOBAL"]["USE_RPROXY"], "CheckUseProxy()") . "</td>\n\t<td>" . help_icon("{OPENVPN_EXPLAIN_PROXY}") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:22px'>{proxy_addr}:</td>\n\t<td style='font-size:14px;'>" . Field_text('PROXYADDR', $vpn->main_array["GLOBAL"]["PROXYADDR"], 'width:220px;font-size:22px;padding:3px') . "</td>\n\t<td></td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:22px'>{proxy_port}:</td>\n\t<td style='font-size:14px;'>" . Field_text('PROXYPORT', $vpn->main_array["GLOBAL"]["PROXYPORT"], 'width:110px;font-size:22px;padding:3px') . "</td>\n\t<td></td>\n</tr>\n\n<tr>\n\t<td class=legend style='font-size:22px' id='CLIENT_NAT_PORT_FIELD'>{listen_port}:</td>\t\t\t\n\t<td style='font-size:14px;'>" . Field_text('CLIENT_NAT_PORT', $CLIENT_NAT_PORT, 'width:110px;;font-size:22px;padding:3px') . "</td>\n\t<td>&nbsp;</td>\n</tr>\t\n<tr><td colspan=3 align='right'><hr>" . button("{apply}", "SaveOpenVpnServerParams()", 32) . "</td></tr>\n</table>\n</div>\n</div>\n<script>\n\n\t\tvar x_SaveOpenVpnServerParams= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\t\tif(tempvalue.length>3){alert(tempvalue);}\n\t\t\t\tif(document.getElementById('main_openvpn_config2')){RefreshTab('main_openvpn_config2');}\n\t\t\t\tif(document.getElementById('main_openvpn_config')){RefreshTab('main_openvpn_config');}\n\t\t\t}\n\n\n\tfunction SaveOpenVpnServerParams(){\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\tif(document.getElementById('USE_RPROXY').checked){XHR.appendData('USE_RPROXY','1');}else{XHR.appendData('USE_RPROXY','0');}\n\t\tXHR.appendData('ENABLE_SERVER',document.getElementById('ENABLE_SERVER').value);\n\t\tXHR.appendData('CERTIFICATE',document.getElementById('OPENVPN_CERTIFICATE').value);\n\t\tXHR.appendData('LOCAL_BIND',document.getElementById('LOCAL_BIND').value);\t\n\t\tXHR.appendData('LISTEN_PORT',document.getElementById('LISTEN_PORT').value);\t\n\t\tXHR.appendData('LISTEN_PROTO',document.getElementById('LISTEN_PROTO').value);\n\t\tXHR.appendData('PUBLIC_IP',document.getElementById('PUBLIC_IP').value);\n\t\tXHR.appendData('CLIENT_NAT_PORT',document.getElementById('CLIENT_NAT_PORT').value);\n\t\tXHR.appendData('PROXYADDR',document.getElementById('PROXYADDR').value);\n\t\tXHR.appendData('PROXYPORT',document.getElementById('PROXYPORT').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveOpenVpnServerParams);\t\t\t\t\n\t}\n\t\n\tfunction CheckUseProxy(){\n\t\tdocument.getElementById('PROXYADDR').disabled=true;\n\t\tdocument.getElementById('PROXYPORT').disabled=true;\n\t\tif(document.getElementById('USE_RPROXY').checked){\n\t\t\tdocument.getElementById('PROXYADDR').disabled=false;\n\t\t\tdocument.getElementById('PROXYPORT').disabled=false;\n\t\t}\t\t\n\t}\n\t\n\t\n\tfunction DisableOpenVPNFields(){\n\t\tvar ENABLE_SERVER=document.getElementById('ENABLE_SERVER').value;\n\t\tdocument.getElementById('LOCAL_BIND').disabled=true;\n\t\tdocument.getElementById('LISTEN_PORT').disabled=true;\n\t\tdocument.getElementById('LISTEN_PROTO').disabled=true;\n\t\tdocument.getElementById('PUBLIC_IP').disabled=true;\n\t\tdocument.getElementById('CLIENT_NAT_PORT').disabled=true;\n\t\tdocument.getElementById('OPENVPN_CERTIFICATE').disabled=true;\n\t\t\n\t\tdocument.getElementById('LISTEN_PORT_FIELD').style.color='#CCCCCC';\n\t\tdocument.getElementById('LISTEN_PROTO_FIELD').style.color='#CCCCCC';\n\t\tdocument.getElementById('LOCAL_BIND_FIELD').style.color='#CCCCCC';\n\t\tdocument.getElementById('PUBLIC_IP_FIELD').style.color='#CCCCCC';\n\t\tdocument.getElementById('CLIENT_NAT_PORT_FIELD').style.color='#CCCCCC';\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tif(ENABLE_SERVER==1){\n\t\t\tdocument.getElementById('LOCAL_BIND').disabled=false;\n\t\t\tdocument.getElementById('LISTEN_PORT').disabled=false;\n\t\t\tdocument.getElementById('LISTEN_PROTO').disabled=false;\n\t\t\tdocument.getElementById('PUBLIC_IP').disabled=false;\n\t\t\tdocument.getElementById('CLIENT_NAT_PORT').disabled=false;\n\t\t\tdocument.getElementById('OPENVPN_CERTIFICATE').disabled=false;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tdocument.getElementById('LISTEN_PORT_FIELD').style.color='#4C535C';\n\t\t\tdocument.getElementById('LISTEN_PROTO_FIELD').style.color='#4C535C';\n\t\t\tdocument.getElementById('LOCAL_BIND_FIELD').style.color='#4C535C';\n\t\t\tdocument.getElementById('PUBLIC_IP_FIELD').style.color='#4C535C';\n\t\t\tdocument.getElementById('CLIENT_NAT_PORT_FIELD').style.color='#4C535C';\n\t\t\t\n\t\t}\n\t}\nDisableOpenVPNFields();\nCheckUseProxy();\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function parameters()
{
    $users = new usersMenus();
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $squid = new squidbee();
    $squid_reverse = new squid_reverse();
    if (!$users->AsSquidAdministrator) {
        senderror("{ERROR_NO_PRIVS}");
        return;
    }
    $sock = new sockets();
    $SquidReverseDefaultWebSite = $sock->GET_INFO("SquidReverseDefaultWebSite");
    $SquidReverseDefaultCert = $sock->GET_INFO("SquidReverseDefaultWebSite");
    if ($SquidReverseDefaultWebSite == null) {
        $SquidReverseDefaultWebSite = $squid->visible_hostnameF();
    }
    $boot->set_formtitle("{global_parameters}");
    $boot->set_field("SquidReverseDefaultWebSite", "{default_website}", "{$SquidReverseDefaultWebSite}");
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $q = new mysql();
    $boot->set_list("certificate_center", "{default_certificate}", $sslcertificates, $squid->certificate_center);
    $boot->set_button("{apply}");
    echo $boot->Compile();
}
Example #16
0
function webservice()
{
    $sql = "SELECT * FROM freeweb WHERE servername='{$_GET["servername"]}'";
    $page = CurrentPageName();
    $users = new usersMenus();
    $tpl = new templates();
    $q = new mysql();
    $sock = new sockets();
    $APACHE_PROXY_MODE = 0;
    $DNS_INSTALLED = false;
    $remove_sql = false;
    $OnlyWebSite = false;
    $countloops = countloops();
    $no_usersameftpuser = $tpl->javascript_parse_text("{no_usersameftpuser}");
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
    if (!is_numeric($_GET["t"])) {
        $_GET["t"] = 0;
    }
    $error_field_max_length = $tpl->javascript_parse_text("{error_field_max_length}");
    $error_please_fill_field = $tpl->javascript_parse_text("{error_please_fill_field}");
    $acl_dstdomain = $tpl->javascript_parse_text("{acl_dstdomain}");
    $mysql_database = $tpl->javascript_parse_text("{mysql_database}");
    $username = $tpl->javascript_parse_text("{username}");
    $password = $tpl->javascript_parse_text("{password}");
    $vgservices = unserialize(base64_decode($sock->GET_INFO("vgservices")));
    $checkboxes = 1;
    $ButtonName = "{apply}";
    if ($ligne["groupware"] == "cachemgr") {
        $checkboxes = 0;
    }
    $users = new usersMenus();
    $PUREFTP_INSTALLED = 1;
    if (!$users->PUREFTP_INSTALLED) {
        $PUREFTP_INSTALLED = 0;
    }
    $ServerIPVAL = trim($ligne["ServerIP"]);
    $ServerPort = trim($ligne["ServerPort"]);
    $sslcertificate = $ligne["sslcertificate"];
    $UseDefaultPort = 0;
    if ($users->APACHE_PROXY_MODE) {
        $APACHE_PROXY_MODE = 1;
    }
    $parcourir_domaines = button("{browse}...", "Loadjs('browse.domains.php?field=domainname')", 12);
    if ($users->dnsmasq_installed) {
        $DNS_INSTALLED = true;
    }
    if ($users->POWER_DNS_INSTALLED) {
        $DNS_INSTALLED = true;
    }
    $FreeWebDisableSSL = trim($sock->GET_INFO("FreeWebDisableSSL"));
    if (!is_numeric($FreeWebDisableSSL)) {
        $FreeWebDisableSSL = 0;
    }
    $check_configuration = $tpl->_ENGINE_parse_body("{check_configuration}");
    $webservice = $tpl->_ENGINE_parse_body("{webservice}");
    $ServerIPVAL = "{$ServerIPVAL}:{$ServerPort}";
    $freeweb = new freeweb($_GET["servername"]);
    $acl_dstdomain_label = $tpl->_ENGINE_parse_body("{acl_dstdomain}");
    //HTTTRACK ---------------------------------------------------------
    $WebCopyCount = $q->COUNT_ROWS("httrack_sites", "artica_backup");
    if ($WebCopyCount > 0) {
        $sql = "SELECT ID,sitename FROM httrack_sites";
        $results_webcopy = $q->QUERY_SQL($sql, "artica_backup");
        $WebCopyHash[0] = "{none}";
        while ($ligneWebCopy = mysql_fetch_assoc($results_webcopy)) {
            $WebCopyHash[$ligneWebCopy["ID"]] = $ligneWebCopy["sitename"];
        }
        $WebCopyTR = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>WebCopy:</td>\n\t\t\t\t<td>" . Field_array_Hash($WebCopyHash, "WebCopyID", $freeweb->WebCopyID, "style:font-size:18px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_WebCopy_explain") . "</td>\n\t\t\t</tr>";
    }
    if ($ligne["groupware"] == "SUGAR") {
        $additional_infos = sugard_additional_infos();
    }
    if ($vgservices["freewebs"] != null) {
        if (!is_numeric($ligne["lvm_size"])) {
            $ligne["lvm_size"] = 5000;
        }
        if ($ligne["lvm_vg"] == null) {
            $ligne["lvm_vg"] = $vgservices["freewebs"];
        }
        $sizelimit = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{size}:</td>\n\t\t<td style='font-size:14px;'>" . Field_text("vg_size", $ligne["lvm_size"], "font-size:18px;padding:3px;width:60px") . "&nbsp;MB</td>\n\t\t<td>&nbsp;</td>\n\t\t</tr>";
    }
    $groupwarelink = $freeweb->groupwares_InstallLink();
    $groupwares_textintro = $freeweb->groupwares_textintro();
    if ($groupwarelink != null) {
        $explain = "\n\t\t<div class=explain>{$groupwares_textintro}:<br><strong style='font-size:14px'>\n\t\t\t<a href=\"javascript:blur()\" OnClick=\"javascript:s_PopUpFull('{$groupwarelink}',1024,768)\" style='text-decoration:underline;font-weight:bold;color:#969696'>{$groupwarelink}</a></strong></div>\t\t\n\t\t";
    }
    $img = "website-64.png";
    if ($_GET["force-groupware"] != null) {
        $vhosts = new vhosts();
        $img = $vhosts->IMG_ARRAY_64[$_GET["force-groupware"]];
        $imgtitle = "<div style='font-size:18px;font-weight:bold'>{" . $vhosts->TEXT_ARRAY[$_GET["force-groupware"]]["TITLE"] . "}</div>";
        if ($_GET["force-groupware"] == "ZARAFA") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "Z-PUSH") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "ZARAFA_MOBILE") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "ROUNDCUBE") {
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "KLMS") {
            $OnlyWebSite = true;
            $remove_sql = true;
        }
    }
    $servernameenc = urlencode($_GET["servername"]);
    $configure = "&nbsp;|&nbsp;" . button("{reconfigure}", "SaveFreeWebMain();Loadjs('freeweb.rebuild.progress.php?servername={$servernameenc}')", 26);
    if ($_GET["servername"] == null) {
        $ButtonName = "{add}";
        $configure = null;
    }
    if ($ligne["domainname"] == null) {
        $dda = explode(".", $ligne["servername"]);
        $hostname = $dda[0];
        unset($dda[0]);
        $domainname = @implode(".", $dda);
    } else {
        $ff = explode(".", $ligne["servername"]);
        if (count($ff) > 2) {
            $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]);
        } else {
            $hostname = null;
        }
        $domainname = $ligne["domainname"];
        $parcourir_domaines = null;
    }
    if ($hostname == "_default_") {
        $parcourir_domaines = null;
    }
    if ($DNS_INSTALLED) {
        include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
        include_once dirname(__FILE__) . "/ressources/class.pdns.inc";
        $pdns = new pdns();
        if ($ligne["servername"] == null) {
            $ip = new networking();
            $ips = $ip->ALL_IPS_GET_ARRAY();
            $ips[null] = "{none}";
            $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:18px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>";
        } else {
            $hostip = $pdns->GetIp($ligne["servername"]);
            if ($hostip != null) {
                $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{dns_entry}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>{$hostip}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>";
            } else {
                $ip = new networking();
                $ips = $ip->ALL_IPS_GET_ARRAY();
                $ips[null] = "{none}";
                $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:18px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>";
            }
        }
    }
    $domain = "<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:18px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:18px' align='center' width=1%>&nbsp;.&nbsp;</td>\n\t\t\t<td>" . Field_text("domainname", $domainname, "font-size:18px;padding:3px;width:220px;font-weight:bold") . "</td>\n\t\t\t<td>{$parcourir_domaines}</td>\n\t\t</tr>\n\t\t</table>";
    if (!$users->AsSystemAdministrator) {
        if ($ligne["domainname"] == null) {
            $dd = explode(".", $ligne["servername"]);
            $hostname = $dd[0];
            unset($dd[0]);
            $domainname = @implode(".", $dd);
        } else {
            $ff = explode(".", $ligne["servername"]);
            if (count($ff) > 2) {
                $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]);
            } else {
                $hostname = null;
            }
            $domainname = $ligne["domainname"];
        }
        $ldap = new clladp();
        $domains = $ldap->Hash_domains_table($_SESSION["ou"]);
        while (list($a, $b) = each($domains)) {
            $c[$a] = $a;
        }
        $domain = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:18px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:18px' align='center' width=1%>&nbsp;.&nbsp;</td>\n\t\t\t<td>" . Field_array_Hash($c, "domainname", $domainname, "style:font-size:18px;padding:3px;font-weight:bold;width:220px;") . "</td>\n\t\t</tr>\n\t\t</table>";
    }
    $NewServer = 0;
    if (trim($ligne["servername"] == null)) {
        $NewServer = 1;
    }
    if ($NewServer == 0) {
        $domain = "<div style='font-size:22px'>{$ligne["servername"]}</div>\n\t\t\t<input type='hidden' value='{$ligne["servername"]}' id='servername'>\n\t\t\t<input type='hidden' value='{$ligne["domainname"]}' id='domainname'>";
    }
    if ($ligne["groupware"] != null) {
        $apache = new vhosts();
        $img = $apache->IMG_ARRAY_64[$ligne["groupware"]];
        if ($ligne["groupware"] == "ROUNDCUBE") {
            $OnlyWebSite = true;
        }
        if ($ligne["ForceInstanceZarafaID"] > 0) {
            $_GET["ForceInstanceZarafaID"] = $ligne["ForceInstanceZarafaID"];
        }
    }
    if ($OnlyWebSite) {
        $js_OnlyWebSite = "OnlyWebsite()";
    }
    $uid_uri = urlencode(base64_encode($ligne["uid"]));
    $nets = unserialize(base64_decode($sock->GET_INFO("FreeWebsApacheListenTable")));
    $znets[null] = "{default}";
    while (list($num, $ip) = each($nets)) {
        $znets[$num] = $num;
    }
    $ServerIP = Field_array_Hash($znets, 'ServerIP', $ServerIPVAL, null, null, 0, 'font-size:18px;');
    $q = new mysql();
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $sslcertificateF = Field_array_Hash($sslcertificates, "sslcertificate", $sslcertificate, "style:font-size:18px");
    $t = time();
    $html = "\n\t<div id='freewebdiv-{$t}'></div>\n\t<input type='hidden' id='force-groupware' name ='force-groupware' value='{$_GET["force-groupware"]}'>\n\t<table style='width:100%' class=TableRemove>\n\t<tr>\n\t\t<td valign='top' width=1%>\n\t\t\t<center>\n\t\t\t\t<img src='img/{$img}'>{$imgtitle}\n\t\t\t</center><br>\n\t\t\t<div style='width:190px'>\n\t\t\t\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign='top' width=99%>\n\t{$explain}\n\t<div id='freewebdiv'>\n\t\t<div id='block1' style='display:block;'>\n\t\t\t<div style='width:98%' class=form>\n\t\t\t<table>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{$acl_dstdomain_label}:</td>\n\t\t\t\t<td colspan=2>{$domain}</td>\n\t\t\t</tr>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{listen_address}:</td>\n\t\t\t\t<td colspan=2>{$ServerIP}</td>\n\t\t\t</tr>\t\t\t\t\t\n\t\t\t{$dns_field}\n\t\t\t{$WebCopyTR}\t\n\t\t\t\n\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{directory}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("www_dir", $ligne["www_dir"], "font-size:18px;padding:3px;") . "</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . button_browse("www_dir") . "</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{reverse_proxy}:</td>\n\t\t\t\t<td width=1% style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("UseReverseProxy", 1, $ligne["UseReverseProxy"], "CheckUseReverseProxy()") . "</td>\n\t\t\t</tr>\t\t\n\t\t\t\n\t\t\t{$sizelimit}\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{UseLoopDisk}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("UseLoopDisk", 1, $ligne["UseLoopDisk"], "CheckLoops()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr style='height:auto'>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>&nbsp;</td>\n\t\t\t\t<td colspan=2 style='height:auto'><span id='loops-list'></span></td></tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{member}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("www_uid", $ligne["uid"], "font-size:18px;padding:3px;") . "</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'><span id='bb_button'>" . button("{browse}...", "Loadjs('user.browse.php?field=www_uid&YahooWin=6')", 12) . "</span>\n\t\t\t\t<span id='status-uid-www' style='float:right'></span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{group}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("www_group", $ligne["gpid"], "font-size:18px;padding:3px;") . "</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'><span id='bb_button1'>" . button("{browse}...", "Loadjs('MembersBrowse.php?field-user=www_group&OnlyGroups=1&OnlyGUID=1')", 12) . "</span>\n\t\t\t\t\t<span id='status-gpid-www' style='float:right'></span>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{ssl}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("useSSL", 1, $ligne["useSSL"], "useSSLCheckCOnf()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{certificate}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>{$sslcertificateF}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\n\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap style='font-size:18px;vertical-align:middle'>{www_forward}:</td>\n\t\t\t\t<td width=1% style='font-size:18px;vertical-align:middle'>" . Field_checkbox_design("Forwarder", 1, $ligne["Forwarder"], "CheckForwarder()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:18px;vertical-align:middle'>{www_ForwardTo}:</td>\n\t\t\t\t<td style='font-size:18px;vertical-align:middle'>" . Field_text("ForwardTo", $ligne["ForwardTo"], "width:270px;font-size:18px;padding:3px") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t</div>\t\n\t</div>\t\n\t</div>\n\t\n\t<div style='width:100%;text-align:right;font-size:26px'><hr>" . button("{$ButtonName}", "SaveFreeWebMain()", 30) . "{$configure}</div>\n\n\n\n\t\n\t\n\t</td>\n\t</tr>\n\t</table>\n\t\n\t{$additional_infos}\n<script>\n\n\tfunction CheckDatas(){\n\t\tvar APACHE_PROXY_MODE={$APACHE_PROXY_MODE};\n\t\tvar FreeWebDisableSSL={$FreeWebDisableSSL};\n\t\t \n\t\t\n\t\tif(APACHE_PROXY_MODE==0){\n\t\t\tdocument.getElementById('UseReverseProxy').checked=false;\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t}\n\t\t\n\t\tvar x=document.getElementById('servername').value;\n\t\tvar z=document.getElementById('domainname').value;\n\t\tvar w=x.length+z.length;\n\t\tif(w>0){\n\t\t\tdocument.getElementById('servername').disabled=true;\n\t\t\tdocument.getElementById('domainname').disabled=true;\n\t\t\t}\n\t\t\n\t\tif(FreeWebDisableSSL==1){\n\t\t\tdocument.getElementById('useSSL').disabled=true;\n\t\t}\n\t\t\n\t}\n\t\n\n\t\n\n\t\n\tfunction CheckForwarder(){\n\t\tif(document.getElementById('Forwarder').checked){\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\t\tdocument.getElementById('ForwardTo').disabled=false;\n\t\t\t\n\t\t\t\n\t\t}else{\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=false;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t\tdocument.getElementById('ForwardTo').disabled=true;\n\t\t\tCheckLoops();\n\t\t}\n\t\n\t}\n\t\t\n\tfunction FreeWebsRebuildvHosts(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildvHosts','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('freeweb.edit.php', 'POST',x_SaveFreeWebMain{$t});\n\t}\n\t\n\tfunction FreeWebsRebuildGroupware(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildGroupware','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('freeweb.edit.php', 'POST',x_SaveFreeWebMain{$t});\n\t}\t\t\t\n\n\n\tvar x_SaveFreeWebMain{$t}=function (obj) {\n\t\t    var NewServer={$NewServer};\n\t\t\tvar results=obj.responseText;\n\t\t\tdocument.getElementById('freewebdiv-{$t}').innerHTML='';\n\t\t\tif(results.length>0){alert(results);return;}\n\t\t\tvar t={$_GET["t"]};\t\n\t\t\tif(t>0){\n\t\t\t\t\$('#freewebs-table-{$_GET["t"]}').flexReload();\n\t\t\t}else{\n\t\t\t\tif(document.getElementById('container-www-tabs')){RefreshTab('container-www-tabs');}\n\t\t\t\tif(document.getElementById('main_config_freeweb')){FreeWebsRefreshWebServersList();}\n\t\t\t}\n\t\t\tif(NewServer==1){\n\t\t\t\tYahooWin5Hide();\n\t\t\t\tExecuteByClassName('SearchFunction');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(document.getElementById('main_config_freewebMains')){RefreshTab('main_config_freewebMains');}\n\t\t\tExecuteByClassName('SearchFunction');\n\t\t}\t\n\t\t\n\t\tfunction SaveFreeWebMain(){\n\t\t\tvar NewServer={$NewServer};\n\t\t\t\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('SAVE_FREEWEB_MAIN','yes');\n\t\t\t\n\t\t\tif(NewServer==1){\n\t\t\t\tvar sitename=document.getElementById('servername').value;\n\t\t\t\tvar www_a=document.getElementById('domainname').value;\n\t\t\t\tvar www_b=document.getElementById('servername').value;\n\t\t\t\tvar www_t=www_a.length+www_b.length;\n\t\t\t\tif(www_t<2){\n\t\t\t\t\talert('{$error_please_fill_field}:{$acl_dstdomain}'); \n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar x=document.getElementById('domainname').value;\n\t\t\t\t\tif(x.length==0){alert('{$error_please_fill_field}:{$acl_dstdomain}');return;}\n\t\t\t\t}else{\n\t\t\t\t\tdocument.getElementById('domainname').value='';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(document.getElementById('ADD_DNS_ENTRY')){\n\t\t\t\tXHR.appendData('ADD_DNS_ENTRY',document.getElementById('ADD_DNS_ENTRY').value);\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('useSSL').checked){XHR.appendData('useSSL',1);}else{XHR.appendData('useSSL',0);}\n\t\t\t\n\t\t\tif(document.getElementById('WebCopyID')){\n\t\t\t\tXHR.appendData('WebCopyID',document.getElementById('WebCopyID').value);\n\t\t\t}\n\t\t\tif(document.getElementById('www_dir')){\n\t\t\t\tXHR.appendData('www_dir',document.getElementById('www_dir').value);\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('UseDefaultPort',0)\n\t\t\tif(document.getElementById('UseReverseProxy').checked){XHR.appendData('UseReverseProxy',1);}else{XHR.appendData('UseReverseProxy',0);}\n\t\t\tif(document.getElementById('Forwarder').checked){XHR.appendData('Forwarder',1);}else{XHR.appendData('Forwarder',0);}\n\t\t\tXHR.appendData('ForceInstanceZarafaID','{$_GET["ForceInstanceZarafaID"]}');\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('LoopMounts')){\n\t\t\t\tvar LoopMounts=document.getElementById('LoopMounts').value;\n\t\t\t\tif(LoopMounts.length>3){\n\t\t\t\t\tif(document.getElementById('UseLoopDisk').checked){XHR.appendData('UseLoopDisk',1);}else{XHR.appendData('UseLoopDisk',0);}\n\t\t\t\t\tXHR.appendData('LoopMounts',LoopMounts);\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tvar uid=trim(document.getElementById('www_uid').value);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('vg_size')){XHR.appendData('vg_size',document.getElementById('vg_size').value);}\n\t\t\tXHR.appendData('lvm_vg','{$ligne["lvm_vg"]}');\n\t\t\tif(NewServer==1){\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar www_b=document.getElementById('domainname').value;\n\t\t\t\t\tvar www_a=document.getElementById('servername').value;\n\t\t\t\t\tif(www_a.length>0){XHR.appendData('servername',www_a+'.'+www_b);}else{XHR.appendData('servername',www_b);}\n    \t\t\t\t}else{\n    \t\t\t\tXHR.appendData('servername','_default_');\n    \t\t\t}\n    \t\t}\n    \t\tif(NewServer==0){XHR.appendData('servername',document.getElementById('servername').value);}\n    \t\tXHR.appendData('domainname',document.getElementById('domainname').value);\n    \t\tXHR.appendData('uid',uid);\n    \t\tXHR.appendData('gpid',document.getElementById('www_group').value);\n    \t\tXHR.appendData('ForwardTo',document.getElementById('ForwardTo').value);\n    \t\tXHR.appendData('force-groupware',document.getElementById('force-groupware').value);\n    \t\tXHR.appendData('ServerIP',document.getElementById('ServerIP').value);\n    \t\tXHR.appendData('sslcertificate',document.getElementById('sslcertificate').value);\n    \t\t\n    \t\t\n    \t\t\n    \t\tAnimateDiv('freewebdiv-{$t}');\n    \t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain{$t});\n\t\t\t\n\t\t}\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\t\n\n\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){document.getElementById('UseLoopDisk').disabled=false;}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\tfunction CheckUseReverseProxy(){\n\t\tCheckDatas();\n\t\tuseMysqlCheck();\n\t\tCheckLoops();\n\t\t{$js_removesql};\n\t\t{$js_OnlyWebSite};\n\t}\n\t\n\n\t\n\tfunction OnlyWebsite(){\n\t\tif(document.getElementById('Forwarder')){document.getElementById('Forwarder').disabled=true;}\n\t\tif(document.getElementById('UseReverseProxy')){document.getElementById('UseReverseProxy').disabled=true;}\n\t\tif(document.getElementById('useFTP')){document.getElementById('useFTP').disabled=true;}\n\t}\n\t\n\tfunction CheckUId(){\n\t\tLoadAjaxTiny('status-uid-www','freeweb.edit.php?uid-check={$uid_uri}');\n\t}\n\t\n\n\t\n\tfunction useSSLCheckCOnf(){\n\t\tdocument.getElementById('sslcertificate').disabled=true;\n\t\t\tif(document.getElementById('useSSL').checked){\n\t\t\t\tdocument.getElementById('sslcertificate').disabled=false;\n\t\t\t}\n\t}\n\t\n\tCheckDatas();\n\tCheckLoops();\n\tCheckForwarder();\n\tCheckUId();\n\t{$js_removesql};\n\t{$js_OnlyWebSite};\n\tuseSSLCheckCOnf();\n\t\n\t</script>\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #17
0
function parameters_main()
{
    // --enable-ssl-crtd
    $tpl = new templates();
    $sock = new sockets();
    $compilefile = "ressources/logs/squid.compilation.params";
    if (!is_file($compilefile)) {
        $sock->getFrameWork("squid.php?compil-params=yes");
    }
    $COMPILATION_PARAMS = unserialize(base64_decode(@file_get_contents($compilefile)));
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    if (!is_numeric($EnableRemoteStatisticsAppliance)) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    $EnableSquidSSLCRTD = $sock->GET_INFO("EnableSquidSSLCRTD");
    $SSlBumpAllowLogon = intval($sock->GET_INFO("SSlBumpAllowLogon"));
    $LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos")));
    $WizardSavedSettings = unserialize(base64_decode($sock->GET_INFO("WizardSavedSettings")));
    if ($LicenseInfos["COMPANY"] == null) {
        $LicenseInfos["COMPANY"] = $WizardSavedSettings["company_name"];
    }
    if ($LicenseInfos["EMAIL"] == null) {
        $LicenseInfos["EMAIL"] = $WizardSavedSettings["mail"];
    }
    if (!is_numeric($LicenseInfos["EMPLOYEES"])) {
        $LicenseInfos["EMPLOYEES"] = $WizardSavedSettings["employees"];
    }
    if (!is_numeric($EnableSquidSSLCRTD)) {
        $EnableSquidSSLCRTD = 1;
    }
    $DefaultSSLParams = unserialize(base64_decode($sock->GET_INFO("DefaultSSLParams")));
    $SquidSSLUrgency = intval($sock->GET_INFO("SquidSSLUrgency"));
    if ($SquidSSLUrgency == 1) {
        echo FATAL_ERROR_SHOW_128("<div style='font-size:22px'>{proxy_in_ssl_emergency_mode}</div>\n\t\t\t<div style='font-size:18px'>{proxy_in_ssl_emergency_mode_explain}</div>\n\t\t\t<div style='text-align:right;margin-top:20px'><a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.urgency.php?ssl=yes');\"\n\t\t\tstyle='text-decoration:underline;font-size:26px'>{disable_emergency_mode}</a></div>\n\t\t\t");
    }
    $squid = new squidbee();
    $page = CurrentPageName();
    $sslbumb = false;
    $users = new usersMenus();
    $t = $_GET["t"];
    if (!isset($COMPILATION_PARAMS["enable-ssl"])) {
        echo FATAL_ERROR_SHOW_128("{error_squid_ssl_not_compiled}");
        return;
    }
    if (!isset($COMPILATION_PARAMS["enable-ssl-crtd"])) {
        echo $tpl->_ENGINE_parse_body("<p class=text-error>{enable-ssl-crtd-not-compiled}</p>");
    }
    $array_country_codes = LoadCountryCodes();
    $DisableSSLStandardPort = $sock->GET_INFO("DisableSSLStandardPort");
    if (!is_numeric($DisableSSLStandardPort)) {
        $DisableSSLStandardPort = 1;
    }
    if ($DisableSSLStandardPort == 0) {
        $StandardPortSSL = 1;
    } else {
        $StandardPortSSL = 0;
    }
    $DisableSSLStandardPort_warn = null;
    if ($DisableSSLStandardPort == 1) {
        $DisableSSLStandardPort_warn = "<div style='font-size:14px;font-style:italic'>{DisableSSLStandardPort_warn}</div>";
    }
    if (preg_match("#^([0-9]+)\\.([0-9]+)#", $users->SQUID_VERSION, $re)) {
        if ($re[1] >= 3) {
            if ($re[2] >= 1) {
                $sslbumb = true;
            }
        }
    }
    $enableSSLBump = Paragraphe_switch_img("{activate_ssl_bump}", "{activate_ssl_bump_text2}", "EnableSSLBump-{$t}", $squid->SSL_BUMP, null, 650);
    $FIELD_StandardPortSSL = Paragraphe_switch_img("{activate_ssl_on_standard_ports}", "{activate_ssl_on_standard_ports_text}{$DisableSSLStandardPort_warn}", "StandardPortSSL-{$t}", $StandardPortSSL, null, 650);
    $FIELD_certificate_login = Paragraphe_switch_img("{allow_download_certificate_public}", "{allow_download_certificate_public_explain}", "SSlBumpAllowLogon-{$t}", $SSlBumpAllowLogon, null, 650);
    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 ($EnableRemoteStatisticsAppliance == 0) {
        if (!$sslbumb) {
            echo FATAL_ERROR_SHOW_128("{wrong_squid_version}: &laquo;{$users->SQUID_VERSION}&raquo;<hr>{wrong_squid_version_feature_text}");
            return;
        }
    }
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $sslproxy_versions[1] = "{default}";
    $sslproxy_versions[2] = "SSLv2 {only}";
    $sslproxy_versions[3] = "SSLv3 {only}";
    $sslproxy_versions[4] = "TLSv1.0 {only}";
    $sslproxy_versions[5] = "TLSv1.1 {only}";
    $sslproxy_versions[6] = "TLSv1.2 {only}";
    $sslproxy_version = intval($sock->GET_INFO("sslproxy_version"));
    if ($sslproxy_version == 0) {
        $sslproxy_version = 1;
    }
    if ($EnableSquidSSLCRTD == 1) {
        if (is_file("/usr/share/artica-postfix/ressources/squid/certificate.der")) {
            $DownloadDER = "\n\t\t\t<div style='width:650px;border:1px solid #005447;border-radius: 4px 4px 4px 4px;margin-top:15px;margin-bottom:15px'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td style='vertical-align:top;width:128px'>\n\t\t\t\t\t<img src='img/certificate-128.png' align='left'></td>\n\t\t\t\t</td>\n\t\t\t\t<td style='vertical-align:top;padding-top:15px;padding-left:15px'><a href='ressources/squid/certificate.der' \n\t\t\t\t\tstyle='font-size:16px;color:#A91919;font-weight:bold;text-decoration:underline'>\n\t\t\t\t\t\n\t\t\t{certificate_to_deploy_explain}\n\t\t\t</a>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</div>";
        }
    }
    $html = "\n\t<div style='font-size:14px' id='sslbumpdiv{$t}'></div>\n\t\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2>{$enableSSLBump}\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:22px;vertical-align:middle' class=legend nowrap>{sslproxy_version}:</td>\n\t\t\t\t<td>" . Field_array_Hash($sslproxy_versions, "sslproxy_version-{$t}", $sslproxy_version, "style:font-size:22px") . "</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t{$FIELD_StandardPortSSL}\n\t\t\t{$DownloadDER}\n\t\t\t<center style='margin:10px'>\n\t\t\t\t" . button("{generate_certificate}", "Loadjs('{$page}?gen-certif-js=yes')", 18) . "\n\t\t\t</center>\n\t\t\t\n\t\t\t{$FIELD_certificate_login}</td>\n\t</tr>\n\t<tr>\n\t\t<td style='font-size:26px' class=legend>{ssl_port}:</td>\n\t\t<td><a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('squid.popups.php?script=listen_port')\"\n\t\t\tstyle='font-size:26px;font-weight:bold;text-decoration:underline'>\n\t\t\t{$squid->ssl_port}</td>\n\t</tr>\n\t\n\t\n\t<tr>\n\t\t<td colspan=2 align=right><hr>" . button("{apply}", "SaveEnableSSLDump{$t}()", 42) . "</td>\n\t</tr>\n\n\t</table>\n\n\t</div>\n\t<script>\nvar x_SaveEnableSSLDump{$t}=function(obj){\n\tvar tempvalue=obj.responseText;\n    if(tempvalue.length>3){alert(tempvalue);}\n    Loadjs('squid.compile.progress.php?restart=yes&ask=yes');\n    RefreshTab('main_config_sslbump{$t}');\n}\t\n\nfunction SaveEnableSSLDump{$t}(){\n\tvar XHR = new XHRConnection();\n\tif(!document.getElementById('EnableSSLBump-{$t}')){return;}\n\t\n\tXHR.appendData('sslproxy_version',document.getElementById('sslproxy_version-{$t}').value);\n\tXHR.appendData('EnableSSLBump',document.getElementById('EnableSSLBump-{$t}').value);\n\tXHR.appendData('SSlBumpAllowLogon',document.getElementById('SSlBumpAllowLogon-{$t}').value);\n\tXHR.appendData('StandardPortSSL',document.getElementById('StandardPortSSL-{$t}').value);\n\t\n\tif(document.getElementById('SSL_BUMP_WHITE_LIST-{$t}')){\n\t\tif(document.getElementById('SSL_BUMP_WHITE_LIST-{$t}').checked){XHR.appendData('SSL_BUMP_WHITE_LIST',1);}else{XHR.appendData('SSL_BUMP_WHITE_LIST',0);}\n\t}\n\tXHR.sendAndLoad('{$page}', 'POST',x_SaveEnableSSLDump{$t});\t\t\n\t\n\t}\n</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #18
0
function build()
{
    @mkdir("/var/log/artica-postfix/squid-reverse", 0777, true);
    @chmod("/var/log/artica-postfix/squid-reverse", 0777);
    $sock = new sockets();
    $unix = new unix();
    $nginx = $unix->find_program("nginx");
    if (is_file($nginx)) {
        $EnableNginx = $sock->GET_INFO("EnableNginx");
        if (!is_numeric($EnableNginx)) {
            $EnableNginx = 1;
        }
        if ($EnableNginx == 1) {
            echo "Starting......: " . date("H:i:s") . " Building reverse websites with nginx...\n";
            @file_put_contents("/etc/squid3/reverse.conf", "\n");
            return;
        }
    }
    $squid = new squid_reverse();
    echo "Starting......: " . date("H:i:s") . " Building reverse websites...\n";
    $q = new mysql_squid_builder();
    $squidR = new squidbee();
    $conf[] = $squid->acl_by_cache_peer();
    echo @implode("\n", $conf);
    echo "Starting......: " . date("H:i:s") . " Building /etc/squid3/reverse.conf done...\n";
    @file_put_contents("/etc/squid3/reverse.conf", @implode("\n", $conf) . "\n");
    if (!$GLOBALS["NORELOAD"]) {
        squid_admin_mysql(1, "Reconfiguring proxy service", null, __FILE__, __LINE__);
        shell_exec("/etc/init.d/squid reload --force --script=exec.squid-reverse.php/" . __LINE__);
    }
}
Example #19
0
function listen_port_popup()
{
    $q = new mysql();
    $squid = new squidbee();
    $users = new usersMenus();
    if (!is_numeric($squid->second_listen_port)) {
        $squid->second_listen_port = 0;
    }
    if (!is_numeric($squid->ssl_port)) {
        $squid->ssl_port = 0;
    }
    if ($squid->isNGnx()) {
        $users->SQUID_REVERSE_APPLIANCE = false;
    }
    $transparent = null;
    if ($squid->hasProxyTransparent == 1) {
        $transparent = "{transparent}";
    }
    $sock = new sockets();
    $EnableCNTLM = $sock->GET_INFO("EnableCNTLM");
    $CNTLMPort = $sock->GET_INFO("CnTLMPORT");
    $DisableSSLStandardPort = $sock->GET_INFO("DisableSSLStandardPort");
    if (!is_numeric($DisableSSLStandardPort)) {
        $DisableSSLStandardPort = 1;
    }
    if (!is_numeric($EnableCNTLM)) {
        $EnableCNTLM = 0;
    }
    if (!is_numeric($CNTLMPort)) {
        $CNTLMPort = 3155;
    }
    $arrayParams = unserialize(base64_decode($sock->getFrameWork("squid.php?compile-list=yes")));
    $SSL = 1;
    if (!isset($arrayParams["--enable-ssl"])) {
        $SSL = 0;
    }
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    if ($users->SQUID_REVERSE_APPLIANCE) {
        $lock = "lock();";
        if ($SSL == 1) {
            $squid->ssl_port = 443;
        }
    }
    $page = CurrentPageName();
    $t = time();
    $EnableTCPOptimize = $sock->GET_INFO("EnableTCPOptimize");
    if (!is_numeric($EnableTCPOptimize)) {
        $EnableTCPOptimize = 0;
    }
    $form = "<center id='animate-{$t}'></center>\n\t\t<div style='width:98%' class=form>\n\t\t<table style='width:100%' >\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{EnableTCPOptimize}:</td>\n\t\t\t\t<td>" . Field_checkbox("EnableTCPOptimize-{$t}", 1, $EnableTCPOptimize, 'width:95px;font-size:16px;padding:5px') . "</td>\n\t\t\t\t<td width=1% nowrap style='font-weight:bold;color:#C81717;font-size:14px !important'></td>\n\t\t\t\t<td width=1%>" . help_icon("{EnableTCPOptimize_explain}") . "</td>\n\t\t\t</tr>\t\t\n\t\t\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{listen_port}:</td>\n\t\t\t\t<td>" . Field_text("listen_port-{$t}", $squid->listen_port, 'width:95px;font-size:16px;padding:5px') . "</td>\n\t\t\t\t<td width=1% nowrap style='font-weight:bold;color:#C81717;font-size:14px !important'>{$transparent}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{second_port}:</td>\n\t\t\t\t<td>" . Field_text("second_listen_port-{$t}", $squid->second_listen_port, 'width:95px;font-size:16px;padding:5px') . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td width=1%>" . help_icon("{squid_second_port_explain}") . "</td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{smartphones_port}:</td>\n\t\t\t\t<td>" . Field_text("smartphones_port-{$t}", $squid->smartphones_port, 'width:95px;font-size:16px;padding:5px') . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td width=1%>" . help_icon("{smartphones_port_explain}") . "</td>\n\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{cntlm_port}:</td>\n\t\t\t\t<td>" . Field_text("CNTLMPort-{$t}", $CNTLMPort, 'width:95px;font-size:16px;padding:5px') . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td width=1%>" . help_icon("{CnTLMPORT_explain2}") . "</td>\n\t\t\t</tr>\t\t\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{icp_port}:</td>\n\t\t\t\t<td>" . Field_text("icp_port-{$t}", $squid->ICP_PORT, 'width:95px;font-size:16px;padding:5px') . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td width=1%>" . help_icon("{icp_port_explain}") . "</td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{htcp_port}:</td>\n\t\t\t\t<td>" . Field_text("htcp_port-{$t}", $squid->HTCP_PORT, 'width:95px;font-size:16px;padding:5px') . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td width=1%>" . help_icon("{htcp_port_explain}") . "</td>\n\t\t\t</tr>\t\t\t\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{ssl_port}:</td>\n\t\t\t\t<td>" . Field_text("ssl_port-{$t}", $squid->ssl_port, 'width:95px;font-size:16px;padding:5px') . "</td>\n\t\t\t\t<td width=1% nowrap style='font-weight:bold;color:#C81717;font-size:14px !important'>{$transparent}</td>\n\t\t\t\t<td width=1%>" . help_icon("{squid_ssl_port_explain}") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{certificate}:</td>\n\t\t\t\t<td colspan=3>" . Field_array_Hash($sslcertificates, "certificate-{$t}", $squid->certificate_center, null, null, 0, "font-size:16px") . "</td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='font-size:16px;'>{DisableSSLStandardPort}:</td>\n\t\t\t\t<td >" . Field_checkbox("DisableSSLStandardPort-{$t}", $DisableSSLStandardPort, 1) . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td width=1%>" . help_icon("{DisableSSLStandardPort_explain}") . "</td>\t\t\t\t\t\t\n\t\t\t</tr>\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t<td colspan=4 align='right'><hr>" . button("{apply}", "listenport{$t}()", 16) . "</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t<script>\n\t\t\tfunction CheckSSLPort{$t}(){\n\t\t\t\tvar SSL='{$SSL}';\n\t\t\t\tif(SSL==0){\n\t\t\t\t\tdocument.getElementById('ssl_port-{$t}').disabled=true;\n\t\t\t\t\tdocument.getElementById('certificate-{$t}').disabled=true;\n\t\t\t\t\tdocument.getElementById('ssl_port-{$t}').value=0;\n\t\t\t\t}\t\n\t\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tfunction lock(){\n\t\t\t\tdocument.getElementById('listen_port-{$t}').disabled=true;\n\t\t\t\tdocument.getElementById('ssl_port-{$t}').disabled=true;\n\t\t\t}\n\t\t\t\n\t\t\t{$lock}\n\t\t\t\n\t\tvar x_listenport{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>3){alert(results);}\n\t\t\tdocument.getElementById('animate-{$t}').innerHTML='';\n\t\t\tLoadjs('squid.restart.php?ApplyConfToo=yes&ask=yes');\n\t\t\t\n\t\t}\n\t\t\n\t\tfunction listenport{$t}(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('listenport',document.getElementById('listen_port-{$t}').value);\n\t\t\tXHR.appendData('second_listen_port',document.getElementById('second_listen_port-{$t}').value);\n\t\t\tXHR.appendData('icp_port',document.getElementById('icp_port-{$t}').value);\n\t\t\tXHR.appendData('htcp_port',document.getElementById('htcp_port-{$t}').value);\n\t\t\tXHR.appendData('CNTLMPort',document.getElementById('CNTLMPort-{$t}').value);\n\t\t\tXHR.appendData('smartphones_port',document.getElementById('smartphones_port-{$t}').value);\n\t\t\t\n\t\t\t\n\t\t\tif( document.getElementById('EnableTCPOptimize-{$t}').checked){\n\t\t\t\tXHR.appendData('EnableTCPOptimize',1);\n\t\t\t}else{\n\t\t\t\tXHR.appendData('EnableTCPOptimize',0);\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\tif( document.getElementById('DisableSSLStandardPort-{$t}').checked){\n\t\t\t\tXHR.appendData('DisableSSLStandardPort',1);\n\t\t\t}else{\n\t\t\t\tXHR.appendData('DisableSSLStandardPort',0);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('ssl_port',document.getElementById('ssl_port-{$t}').value);\n\t\t\tXHR.appendData('certificate_center',document.getElementById('certificate-{$t}').value);\t\n\t\t\tAnimateDiv('animate-{$t}');\t\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_listenport{$t});\t\n\t\t}\t\t\t\t\n\t\t\t\n\t\t</script>\n\t\t";
    if ($squid->enable_dansguardian == 1) {
        $form = "\n\t\t\n\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap style='font-size:16px;'>DansGuardian {listen_port}:</td>\n\t\t\t<td><strong style='width:16px'>" . Field_text('listen_port', $squid->listen_port, 'width:95px;;font-size:16px;padding:5px') . "</strong></td>\n\t\t\t</tr>\t\t\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap>SQUID {listen_port}:</td>\n\t\t\t<td><strong style='font-size:16px;'>{$squid->alt_listen_port}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "listenport()") . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>";
    }
    $html = "\n\t\t\t<div class=explain style='font-size:14px;'>{listen_port_text}</div>\n\t\t\t\t{$form}\n\t\t\t<br>\n\t\t\t\n\t\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html, 'squid.index.php');
}
function website_popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ID = $_GET["ID"];
    if (!is_numeric($ID)) {
        $ID = 0;
    }
    if ($_GET["ID"] > 0) {
        $q = new mysql();
        $sql = "SELECT * FROM squid_accel WHERE ID='{$_GET["ID"]}'";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $new_webserver = $ligne["website"];
        $certificate = $ligne["certificate"];
    } else {
        $ligne["enabled"] = 1;
    }
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    if (!is_numeric($ligne["website_port"])) {
        $ligne["website_port"] = 80;
    }
    if ($ID == 0) {
        $btname = "{add}";
    } else {
        $btname = "{apply}";
        $VirtualHostLink = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('{$page}?virtualhosts-js=yes&ID={$ID}&t={$t}')\"\n\t\tstyle='font-size:11px;text-decoration:underline;font-weight:bold'>&laquo;&nbsp;{virtualhosts}&nbsp;&raquo;</a>";
    }
    if ($certificate != null) {
        $CertificateLink = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('certificates.center.php?certificate-js=yes&CommonName={$ligne["certificate"]}&YahooWin=YahooWin6');\"\n\t\tstyle='font-size:11px;text-decoration:underline;font-weight:bold'>&laquo;&nbsp;{certificate}:{$ligne["certificate"]}&nbsp;&raquo;</a>";
    }
    //$sql="INSERT INTO squid_accel (website_name,website_ip,website_port,`UseSSL`,`certificate`)
    $html = "\t\n\t<div id='www_accel_list-{$t}'></div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap>{enabled}:</td>\n\t\t<td width=99%>" . Field_checkbox("enabled-{$t}", 1, $ligne["enabled"], "CheckEnabled{$t}()") . "</td>\n\t\t<td class=legend></td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap>{website}:</td>\n\t\t<td width=99%>" . Field_text("website-{$t}", $ligne["website_name"], "font-size:16px;padding:3px;width:350px;font-weight:bold") . "</td>\n\t\t<td class=legend>{example}:www.mydomain.tld</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap>{ip_address}:</td>\n\t\t<td width=99%>" . Field_text("website_ip-{$t}", $ligne["website_ip"], "font-size:16px;padding:3px;;font-weight:bold;width:220px") . "</td>\n\t\t<td class=legend>{example}:192.168.1.24</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap>{listen_port}:</td>\n\t\t<td width=99%>" . Field_text("website_port-{$t}", $ligne["website_port"], "font-size:14px;padding:3px;width:90px") . "</td>\n\t\t<td class=legend>{example}:80</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap>{UseVirtualHosts}:</td>\n\t\t<td width=99%>" . Field_checkbox("UseVirtualHosts-{$t}", 1, $ligne["UseVirtualHosts"]) . "</td>\n\t\t<td class=legend>{$VirtualHostLink}</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap>{UseSSL}:</td>\n\t\t<td width=99%>" . Field_checkbox("UseSSL-{$t}", 1, $ligne["UseSSL"], "UseSSLCHK{$t}()") . "</td>\n\t\t<td class=legend></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap>{certificate}:</td>\n\t\t<td width=99%>" . Field_array_Hash($sslcertificates, "CertID-{$t}", strtolower($certificate), null, null, 0, "font-size:14px") . "</td>\n\t\t<td>{$CertificateLink}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button($btname, "AccelAddReverseSite{$t}()", 18) . "</td>\n\t</tr>\t\n\t</table>\n<script>\n\t\tvar x_AccelAddReverseSite{$t}= function (obj) {\n\t\t\tdocument.getElementById('www_accel_list-{$t}').innerHTML='';\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);return;}\n\t\t\t\$('#flexRT{$t}').flexReload();\n\t\t\tYahooWin4Hide();\n\t\t}\t\t\n\t\t\n\t\tfunction AccelAddReverseSite{$t}(){\n\t\t \tvar XHR = new XHRConnection();\n\t\t \tvar UseSSL=0;\n\t\t \tvar UseVirtualHosts=0;\n\t\t \tvar enabled=0;\n\t\t \tif(document.getElementById('UseSSL-{$t}').checked){UseSSL=1;}\n\t\t \tif(document.getElementById('UseVirtualHosts-{$t}').checked){UseVirtualHosts=1;}\n\t\t \tif(document.getElementById('enabled-{$t}').checked){enabled=1;}\n\t\t \tXHR.appendData('ID','{$ID}');\n\t\t\tXHR.appendData('website',document.getElementById('website-{$t}').value);\n\t\t\tXHR.appendData('website_ip',document.getElementById('website_ip-{$t}').value);\n\t\t\tXHR.appendData('website_port',document.getElementById('website_port-{$t}').value);\n\t\t\tXHR.appendData('certificate',document.getElementById('CertID-{$t}').value);\n\t\t\tXHR.appendData('UseSSL',UseSSL);\n\t\t\tXHR.appendData('UseVirtualHosts',UseVirtualHosts);\n\t\t\tXHR.appendData('enabled',enabled);\n\t\t\tAnimateDiv('www_accel_list-{$t}');\t\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_AccelAddReverseSite{$t});\t\n\t\t}\t\n\t\t\n\t\tfunction UseSSLCHK{$t}(){\n\t\t\tdocument.getElementById('CertID-{$t}').disabled=true;\n\t\t\tif(document.getElementById('UseSSL-{$t}').checked){\n\t\t\t\tdocument.getElementById('CertID-{$t}').disabled=false;\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tfunction CheckEnabled{$t}(){\n\t\t\tdocument.getElementById('website-{$t}').disabled=true;\n\t\t\tdocument.getElementById('website_ip-{$t}').disabled=true;\n\t\t\tdocument.getElementById('website_port-{$t}').disabled=true;\n\t\t\tdocument.getElementById('CertID-{$t}').disabled=true;\n\t\t\tdocument.getElementById('UseSSL-{$t}').disabled=true;\n\t\t\tdocument.getElementById('UseVirtualHosts-{$t}').disabled=true;\n\t\t\tif(document.getElementById('enabled-{$t}').checked){\n\t\t\t\tdocument.getElementById('website-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('website_ip-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('website_port-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('CertID-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('UseSSL-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('UseVirtualHosts-{$t}').disabled=false;\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\tUseSSLCHK{$t}();\n\tCheckEnabled{$t}();\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #21
0
function popup()
{
    $t = time();
    $html = "<div id='{$t}'></div>\n\t<script>\n\t\tLoadAjax('{$t}','freeweb.edit.main.php?servername={$_GET["servername"]}&force-groupware={$_GET["force-groupware"]}&t={$_GET["t"]}');\n\t</script>\n\t\n\t\n\t";
    echo $html;
    return;
    $sql = "SELECT * FROM freeweb WHERE servername='{$_GET["servername"]}'";
    $page = CurrentPageName();
    $users = new usersMenus();
    $tpl = new templates();
    $q = new mysql();
    $sock = new sockets();
    $APACHE_PROXY_MODE = 0;
    $DNS_INSTALLED = false;
    $remove_sql = false;
    $OnlyWebSite = false;
    $countloops = countloops();
    $no_usersameftpuser = $tpl->javascript_parse_text("{no_usersameftpuser}");
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
    $error_field_max_length = $tpl->javascript_parse_text("{error_field_max_length}");
    $error_please_fill_field = $tpl->javascript_parse_text("{error_please_fill_field}");
    $acl_dstdomain = $tpl->javascript_parse_text("{acl_dstdomain}");
    $mysql_database = $tpl->javascript_parse_text("{mysql_database}");
    $username = $tpl->javascript_parse_text("{username}");
    $password = $tpl->javascript_parse_text("{password}");
    $vgservices = unserialize(base64_decode($sock->GET_INFO("vgservices")));
    $checkboxes = 1;
    $ButtonName = "{apply}";
    if ($ligne["groupware"] == "cachemgr") {
        $checkboxes = 0;
    }
    $users = new usersMenus();
    $PUREFTP_INSTALLED = 1;
    if (!$users->PUREFTP_INSTALLED) {
        $PUREFTP_INSTALLED = 0;
    }
    $ServerIPVAL = trim($ligne["ServerIP"]);
    $ServerPort = trim($ligne["ServerPort"]);
    $UseDefaultPort = 0;
    if ($users->APACHE_PROXY_MODE) {
        $APACHE_PROXY_MODE = 1;
    }
    $parcourir_domaines = "<input type='button' OnClick=\"javascript:Loadjs('browse.domains.php?field=domainname')\" value='{browse}...'>";
    if ($users->dnsmasq_installed) {
        $DNS_INSTALLED = true;
    }
    if ($users->POWER_DNS_INSTALLED) {
        $DNS_INSTALLED = true;
    }
    $FreeWebDisableSSL = trim($sock->GET_INFO("FreeWebDisableSSL"));
    if (!is_numeric($FreeWebDisableSSL)) {
        $FreeWebDisableSSL = 0;
    }
    $check_configuration = $tpl->_ENGINE_parse_body("{check_configuration}");
    $webservice = $tpl->_ENGINE_parse_body("{webservice}");
    $ServerIPVAL = "{$ServerIPVAL}:{$ServerPort}";
    if ($vgservices["freewebs"] != null) {
        if (!is_numeric($ligne["lvm_size"])) {
            $ligne["lvm_size"] = 5000;
        }
        if ($ligne["lvm_vg"] == null) {
            $ligne["lvm_vg"] = $vgservices["freewebs"];
        }
        $sizelimit = "\n\t\t<tr>\n\t\t<td class=legend>{size}:</td>\n\t\t<td style='font-size:13px;'>" . Field_text("vg_size", $ligne["lvm_size"], "font-size:13px;padding:3px;width:60px") . "&nbsp;MB</td>\n\t\t<td>&nbsp;</td>\n\t\t</tr>";
    }
    $freeweb = new freeweb($_GET["servername"]);
    $groupwarelink = $freeweb->groupwares_InstallLink();
    $groupwares_textintro = $freeweb->groupwares_textintro();
    if ($groupwarelink != null) {
        $explain = "\n\t\t<div class=explain>{$groupwares_textintro}:<br><strong style='font-size:14px'>\n\t\t\t<a href=\"javascript:blur()\" OnClick=\"javascript:s_PopUpFull('{$groupwarelink}',1024,768)\" style='text-decoration:underline;font-weight:bold;color:#969696'>{$groupwarelink}</a></strong></div>\t\t\n\t\t";
    }
    $img = "website-64.png";
    if ($_GET["force-groupware"] != null) {
        $vhosts = new vhosts();
        $img = $vhosts->IMG_ARRAY_64[$_GET["force-groupware"]];
        $imgtitle = "<div style='font-size:14px;font-weight:bold'>{" . $vhosts->TEXT_ARRAY[$_GET["force-groupware"]]["TITLE"] . "}</div>";
        if ($_GET["force-groupware"] == "ZARAFA") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "Z-PUSH") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "ZARAFA_MOBILE") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($_GET["force-groupware"] == "ROUNDCUBE") {
            $OnlyWebSite = true;
        }
    }
    if ($_GET["servername"] == null) {
        $ButtonName = "{add}";
    }
    $freeweb = new freeweb($_GET["servername"]);
    if ($ligne["domainname"] == null) {
        $dda = explode(".", $ligne["servername"]);
        $hostname = $dda[0];
        unset($dda[0]);
        $domainname = @implode(".", $dda);
    } else {
        $ff = explode(".", $ligne["servername"]);
        if (count($ff) > 2) {
            $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]);
        } else {
            $hostname = null;
        }
        $domainname = $ligne["domainname"];
        $parcourir_domaines = null;
    }
    if ($hostname == "_default_") {
        $parcourir_domaines = null;
    }
    if ($DNS_INSTALLED) {
        include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
        include_once dirname(__FILE__) . "/ressources/class.pdns.inc";
        $pdns = new pdns();
        if ($ligne["servername"] == null) {
            $ip = new networking();
            $ips = $ip->ALL_IPS_GET_ARRAY();
            $ips[null] = "{none}";
            $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:14px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>";
        } else {
            $hostip = $pdns->GetIp($ligne["servername"]);
            if ($hostip != null) {
                $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td style='font-size:14px'>{$hostip}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>";
            } else {
                $ip = new networking();
                $ips = $ip->ALL_IPS_GET_ARRAY();
                $ips[null] = "{none}";
                $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:14px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>";
            }
        }
    }
    $domain = "<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:15px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:14px' align='center' width=1%>&nbsp;.&nbsp;</td>\n\t\t\t<td>" . Field_text("domainname", $domainname, "font-size:15px;padding:3px;width:220px;font-weight:bold") . "</td>\n\t\t\t<td>{$parcourir_domaines}</td>\n\t\t</tr>\n\t\t</table>";
    if (!$users->AsSystemAdministrator) {
        if ($ligne["domainname"] == null) {
            $dd = explode(".", $ligne["servername"]);
            $hostname = $dd[0];
            unset($dd[0]);
            $domainname = @implode(".", $dd);
        } else {
            $ff = explode(".", $ligne["servername"]);
            if (count($ff) > 2) {
                $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]);
            } else {
                $hostname = null;
            }
            $domainname = $ligne["domainname"];
        }
        $ldap = new clladp();
        $domains = $ldap->Hash_domains_table($_SESSION["ou"]);
        while (list($a, $b) = each($domains)) {
            $c[$a] = $a;
        }
        $domain = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:15px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:14px' align='center' width=1%>&nbsp;.&nbsp;</td>\n\t\t\t<td>" . Field_array_Hash($c, "domainname", $domainname, "style:font-size:15px;padding:3px;font-weight:bold;width:220px;") . "</td>\n\t\t</tr>\n\t\t</table>";
    }
    $NewServer = 0;
    $reconfigure = ParagrapheTEXT("48-settings-refresh.png", "{rebuild}", "{rebuild_apache_text}", "javascript:FreeWebsRebuildvHosts()");
    if (trim($ligne["servername"] == null)) {
        $reconfigure = ParagrapheTEXT_disabled("48-settings-refresh.png", "{rebuild}", "{rebuild_apache_text}");
        $NewServer = 1;
    }
    if ($NewServer == 0) {
        $domain = "<div style='font-size:16px'>{$ligne["servername"]}</div>\n\t\t\t<input type='hidden' value='{$ligne["servername"]}' id='servername'>\n\t\t\t<input type='hidden' value='{$ligne["domainname"]}' id='domainname'>";
    }
    if ($ligne["groupware"] != null) {
        $apache = new vhosts();
        $img = $apache->IMG_ARRAY_64[$ligne["groupware"]];
        $rebuild_groupware = ParagrapheTEXT("setup-icon-48.png", "{software}", "{rebuild_apache_groupware_text}", "javascript:FreeWebsRebuildGroupware()");
        $sql = "SELECT ID FROM drupal_queue_orders WHERE `ORDER`='REBUILD_GROUPWARE' AND `servername`='{$servername}'";
        $ligneDrup = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
        if (!is_numeric($ligneDrup["ID"])) {
            $ligneDrup["ID"] = 0;
        }
        if ($ligneDrup["ID"] > 0) {
            $rebuild_groupware = ParagrapheTEXT_disabled("setup-icon-48.png", "{software}", "{rebuild_apache_groupware_text}");
        }
        if ($ligne["groupware"] == "ZARAFA") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($ligne["groupware"] == "Z-PUSH") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($ligne["groupware"] == "ZARAFA_MOBILE") {
            $remove_sql = true;
            $OnlyWebSite = true;
        }
        if ($ligne["groupware"] == "ROUNDCUBE") {
            $OnlyWebSite = true;
        }
        if ($ligne["ForceInstanceZarafaID"] > 0) {
            $_GET["ForceInstanceZarafaID"] = $ligne["ForceInstanceZarafaID"];
        }
    }
    $checksDebug = ParagrapheTEXT("setup-check-icon-48.png", "{check_configuration}", "{check_configuration_text}", "javascript:FreeWebsCheckGroupware()");
    if ($remove_sql) {
        $js_removesql = "HideMysql()";
    }
    if ($OnlyWebSite) {
        $js_OnlyWebSite = "OnlyWebsite()";
    }
    $uid_uri = urlencode(base64_encode($ligne["uid"]));
    $nets = unserialize(base64_decode($sock->GET_INFO("FreeWebsApacheListenTable")));
    $znets[null] = "{default}";
    while (list($num, $ip) = each($nets)) {
        $znets[$num] = $num;
    }
    $ServerIP = Field_array_Hash($znets, 'ServerIP', $ServerIPVAL, null, null, 0, 'font-size:14px;');
    $q = new mysql();
    include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc";
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $sslcertificate = Field_array_Hash($sslcertificates, $ligne["sslcertificate"], "style:font-size:14px");
    $html = "\n\t<input type='hidden' id='force-groupware' name ='force-groupware' value='{$_GET["force-groupware"]}'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%>\n\t\t\t<center>\n\t\t\t\t<img src='img/{$img}'>{$imgtitle}\n\t\t\t</center><br>\n\t\t\t<div style='width:190px'>\n\t\t\t{$reconfigure}{$rebuild_groupware}{$checksDebug}{$see_config}\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign='top' width=99%>\n\t{$explain}\n\t<div style='font-size:16px'><a href=\"javascript:blur();\" style='font-size:18px;text-decoration:underline;margin-bottom:5px' \n\tOnClick=\"javascript:document.getElementById('block2').style.display='none';document.getElementById('block1').style.display='block';\">{$webservice}:</a></div>\n\t\n\t<div id='freewebdiv'>\n\t\t<div id='block1' style='display:block;'>\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{acl_dstdomain}:</td>\n\t\t\t\t<td colspan=2>{$domain}</td>\n\t\t\t</tr>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{listen_address}:</td>\n\t\t\t\t<td colspan=2>{$ServerIP}</td>\n\t\t\t</tr>\t\t\t\t\t\n\t\t\t{$dns_field}\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{www_forward}:</td>\n\t\t\t\t<td width=1%>" . Field_checkbox("Forwarder", 1, $ligne["Forwarder"], "CheckForwarder()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{reverse_proxy}:</td>\n\t\t\t\t<td width=1%>" . Field_checkbox("UseReverseProxy", 1, $ligne["UseReverseProxy"], "CheckUseReverseProxy()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\n\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{directory}:</td>\n\t\t\t\t<td>" . Field_text("www_dir", $ligne["www_dir"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td>" . button_browse("www_dir") . "</td>\n\t\t\t</tr>\t\t\t\n\t\t\t\n\t\t\t{$sizelimit}\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap>{UseLoopDisk}:</td>\n\t\t\t\t<td>" . Field_checkbox("UseLoopDisk", 1, $ligne["UseLoopDisk"], "CheckLoops()") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr style='height:auto'>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td colspan=2 style='height:auto'><span id='loops-list'></span></td></tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{member}:</td>\n\t\t\t\t<td>" . Field_text("www_uid", $ligne["uid"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td><span id='bb_button'><input type='button' OnClick=\"javascript:Loadjs('user.browse.php?field=www_uid&YahooWin=6')\" value='{browse}...'></span>\n\t\t\t\t<span id='status-uid-www' style='float:right'></span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{group}:</td>\n\t\t\t\t<td>" . Field_text("www_group", $ligne["gpid"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td><span id='bb_button1'><input type='button' OnClick=\"javascript:Loadjs('MembersBrowse.php?field-user=www_group&OnlyGroups=1&OnlyGUID=1');\" value='{browse}...'></span>\n\t\t\t\t<span id='status-gpid-www' style='float:right'></span></td>\n\t\t\t</tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{ssl}:</td>\n\t\t\t\t<td>" . Field_checkbox("useSSL", 1, $ligne["useSSL"]) . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{certificate}:</td>\n\t\t\t\t<td>{$sslcertificate}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\t\t\t\n\t\t\t</table>\n\t</div>\n\n\t<div style='font-size:16px'><a href=\"javascript:blur();\" style='font-size:18px;text-decoration:underline;margin-bottom:5px' OnClick=\"javascript:document.getElementById('block2').style.display='block';document.getElementById('block1').style.display='none';\">{mysql_database}:</a></div>\n\t<div id='block2' style='display:none;'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{useMySQL}:</td>\n\t\t<td>" . Field_checkbox("useMysql", 1, $ligne["useMysql"], "useMysqlCheck()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{mysql_instance}:</td>\n\t\t<td><div id='freeweb-mysql-instances'></div></td>\n\t\t<td align='left'>" . imgtootltip("plus-24.png", "{add}:{mysql_instance}", "Loadjs('mysql.multi.php?mysql-server-js=yes&ID=');") . "</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend>{mysql_database}:</td>\n\t\t<td>" . Field_text("mysql_database", $ligne["mysql_database"], "width:150px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{mysql_username}:</td>\n\t\t<td>" . Field_text("mysql_username", $ligne["mysql_username"], "width:120px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{password}:</td>\n\t\t<td>" . Field_password("mysql_password", $ligne["mysql_password"], "width:90px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3><span style='font-size:16px'>{ftp_access}<hr style='border-color:005447'></td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend>{allowftp_access}:</td>\n\t\t<td>" . Field_checkbox("useFTP", 1, $ligne["useFTP"], "useMysqlCheck()") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend>{ftp_user}:</td>\n\t\t<td>" . Field_text("ftpuser", $ligne["ftpuser"], "width:120px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{password}:</td>\n\t\t<td>" . Field_password("ftppassword", $ligne["ftppassword"], "width:90px;font-size:13px;padding:3px") . "</td>\n\t\t<td>&nbsp;</td>\n\t</tr>\t\n\t</table>\n\t\n\n\t\n\t<div id='block3' style='display:none'>\n\t\t<table style='width:99%' class=form>\n\t\t<tr>\n\t\t\t<td class=legend>{www_ForwardTo}:</td>\n\t\t\t<td>" . Field_text("ForwardTo", $ligne["ForwardTo"], "width:270px;font-size:14px;padding:3px") . "</td>\n\t\t\t<td>&nbsp;</td>\n\t\t</tr>\n\t\t</table>\t\n\t</div>\t\n\t</div>\n\t\n\t<div style='width:100%;text-align:right'><hr>" . button("{$ButtonName}", "SaveFreeWebMain()", 18) . "</div>\n\n\n\n\t\n\t\n\t</td>\n\t</tr>\n\t</table>\n<script>\n\n\tfunction CheckDatas(){\n\t\tvar APACHE_PROXY_MODE={$APACHE_PROXY_MODE};\n\t\tvar FreeWebDisableSSL={$FreeWebDisableSSL};\n\t\t \n\t\t\n\t\tif(APACHE_PROXY_MODE==0){\n\t\t\tdocument.getElementById('UseReverseProxy').checked=false;\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t}\n\t\t\n\t\tvar x=document.getElementById('servername').value;\n\t\tvar z=document.getElementById('domainname').value;\n\t\tvar w=x.length+z.length;\n\t\tif(w>0){\n\t\t\tdocument.getElementById('servername').disabled=true;\n\t\t\tdocument.getElementById('domainname').disabled=true;\n\t\t\t}\n\t\tvar x=document.getElementById('mysql_database').value;\n\t\tif(x.length>0){document.getElementById('mysql_database').disabled=true;}\t\n\n\t\tif(FreeWebDisableSSL==1){\n\t\t\tdocument.getElementById('useSSL').disabled=true;\n\t\t}\n\t\t\n\t}\n\t\n\n\t\n\tfunction useMysqlCheck(){\n\t\tvar mysql_instance_id=0;\n\t\tvar checkboxes={$checkboxes};\n\t\tvar PUREFTP_INSTALLED={$PUREFTP_INSTALLED};\n\t\tif(document.getElementById('mysql_instance_id')){mysql_instance_id=document.getElementById('mysql_instance_id').value;}\n\t\tdocument.getElementById('useFTP').disabled=true;\n\t\tdocument.getElementById('useMysql').disabled=true;\n\t\t\n\t\tif(checkboxes==1){\n\t\t\tif(PUREFTP_INSTALLED==1){document.getElementById('useFTP').disabled=false;}\n\t\t\tif(mysql_instance_id==0){document.getElementById('useMysql').disabled=false;}\t\n\t\t}\n\t\tif(PUREFTP_INSTALLED==1){\n\t\t\tdocument.getElementById('useFTP').disabled=false;\n\t\t}else{\n\t\t\tdocument.getElementById('useFTP').disabled=true;\n\t\t\tdocument.getElementById('useFTP').checked=false;\n\t\t}\n\t\t\n\t\tdocument.getElementById('mysql_database').disabled=true;\n\t\tdocument.getElementById('mysql_username').disabled=true;\n\t\tdocument.getElementById('mysql_password').disabled=true;\n\t\tdocument.getElementById('ftpuser').disabled=true;\n\t\tdocument.getElementById('ftppassword').disabled=true;\n\t\tif(mysql_instance_id==0){\n\t\t\tif(document.getElementById('useMysql').checked){\n\t\t\t\tvar mysql_database=document.getElementById('mysql_database').value;\n\t\t\t\tif(mysql_database.length==0){document.getElementById('mysql_database').disabled=false;}\n\t\t\t\tdocument.getElementById('mysql_username').disabled=false;\n\t\t\t\tdocument.getElementById('mysql_password').disabled=false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(mysql_instance_id==1){\n\t\t\tdocument.getElementById('mysql_database').disabled=false;\n\t\t}\n\t\t\n\t\tif(!document.getElementById('useFTP').checked){return;}\n\t\tdocument.getElementById('ftpuser').disabled=false;\n\t\tdocument.getElementById('ftppassword').disabled=false;\t\t\n\t\t\n\t\t\n\t}\n\t\n\tfunction CheckForwarder(){\n\t\tif(document.getElementById('Forwarder').checked){\n\t\t\tdocument.getElementById('block2').style.display='none';\n\t\t\tdocument.getElementById('block3').style.display='block';\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\t}else{\n//\t\t\tdocument.getElementById('block2').style.display='block';\n\t\t\tdocument.getElementById('block3').style.display='none';\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=false;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t\tCheckLoops();\n\t\t}\n\t\n\t}\n\t\t\n\tfunction FreeWebsRebuildvHosts(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildvHosts','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain);\n\t}\n\t\n\tfunction FreeWebsRebuildGroupware(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildGroupware','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain);\n\t}\t\t\t\n\n\n\tvar x_SaveFreeWebMain=function (obj) {\n\t\t    var NewServer={$NewServer};\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\t\t\t\n\t\t\tRefreshTab('main_config_freewebedit');\n\t\t\tif(document.getElementById('container-www-tabs')){RefreshTab('container-www-tabs');}\n\t\t\tif(document.getElementById('main_config_freeweb')){RefreshTab('main_config_freeweb');}\n\t\t\tif(document.getElementById('sarg_tabs')){RefreshTab('sarg_tabs');}\n\t\t\t\n\t\t\tif(NewServer==1){YahooWin5Hide();}\n\t\t\t\n\t\t}\t\n\t\t\n\t\tfunction SaveFreeWebMain(){\n\t\t\tvar NewServer={$NewServer};\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(NewServer==1){\n\t\t\t\tvar sitename=document.getElementById('servername').value;\n\t\t\t\tvar www_a=document.getElementById('domainname').value;\n\t\t\t\tvar www_b=document.getElementById('servername').value;\n\t\t\t\tvar www_t=www_a.length+www_b.length;\n\t\t\t\tif(www_t<2){\n\t\t\t\t\talert('{$error_please_fill_field}:{$acl_dstdomain}'); \n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar x=document.getElementById('domainname').value;\n\t\t\t\t\tif(x.length==0){alert('{$error_please_fill_field}:{$acl_dstdomain}');return;}\n\t\t\t\t}else{\n\t\t\t\t\tdocument.getElementById('domainname').value='';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(document.getElementById('ADD_DNS_ENTRY')){\n\t\t\t\tXHR.appendData('ADD_DNS_ENTRY',document.getElementById('ADD_DNS_ENTRY').value);\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('useMysql').checked){\n\t\t\t\tvar mysql_database=document.getElementById('mysql_database').value;\n\t\t\t\tif(mysql_database.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}');\n\t\t\t\t\treturn;\t\t\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\tvar x=document.getElementById('mysql_password').value;\n\t\t\t\tif(x.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}/{$password}');\n\t\t\t\t\treturn;\n\t\t\t\t}\t\n\t\t\t\tvar x=document.getElementById('mysql_username').value;\n\t\t\t\tif(x.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}/{$username}');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(mysql_database.length>16){\n\t\t\t\t\talert('mysql_database:{$error_field_max_length}: 16');\n\t\t\t\t\tdocument.getElementById('mysql_database').disabled=false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('useSSL').checked){XHR.appendData('useSSL',1);}else{XHR.appendData('useSSL',0);}\n\t\t\tif(document.getElementById('useMysql').checked){XHR.appendData('useMysql',1);}else{XHR.appendData('useMysql',0);}\n\t\t\tif(document.getElementById('useFTP').checked){XHR.appendData('useFTP',1);}else{XHR.appendData('useFTP',0);}\n\t\t\tXHR.appendData('UseDefaultPort',0)\n\t\t\tif(document.getElementById('UseReverseProxy').checked){XHR.appendData('UseReverseProxy',1);}else{XHR.appendData('UseReverseProxy',0);}\n\t\t\tif(document.getElementById('Forwarder').checked){XHR.appendData('Forwarder',1);}else{XHR.appendData('Forwarder',0);}\n\t\t\tXHR.appendData('ForceInstanceZarafaID','{$_GET["ForceInstanceZarafaID"]}');\n\t\t\t\n\t\t\tif(document.getElementById('www_dir')){\n\t\t\t\tXHR.appendData('www_dir',document.getElementById('www_dir').value);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('LoopMounts')){\n\t\t\t\tvar LoopMounts=document.getElementById('LoopMounts').value;\n\t\t\t\tif(LoopMounts.length>3){\n\t\t\t\t\tif(document.getElementById('UseLoopDisk').checked){XHR.appendData('UseLoopDisk',1);}else{XHR.appendData('UseLoopDisk',0);}\n\t\t\t\t\tXHR.appendData('LoopMounts',LoopMounts);\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tvar ftpuser=trim(document.getElementById('ftpuser').value);\n\t\t\tvar uid=trim(document.getElementById('www_uid').value);\n\t\t\tif(document.getElementById('useFTP').checked){\t\n\t\t\t\tif(uid==ftpuser){\n\t\t\t\t\talert('{$no_usersameftpuser}');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('vg_size')){XHR.appendData('vg_size',document.getElementById('vg_size').value);}\n\t\t\tXHR.appendData('lvm_vg','{$ligne["lvm_vg"]}');\n\t\t\tif(NewServer==1){\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar www_b=document.getElementById('domainname').value;\n\t\t\t\t\tvar www_a=document.getElementById('servername').value;\n\t\t\t\t\tif(www_a.length>0){XHR.appendData('servername',www_a+'.'+www_b);}else{XHR.appendData('servername',www_b);}\n    \t\t\t\t}else{\n    \t\t\t\tXHR.appendData('servername','_default_');\n    \t\t\t}\n    \t\t}\n    \t\tif(NewServer==0){XHR.appendData('servername',document.getElementById('servername').value);}\n    \t\tXHR.appendData('domainname',document.getElementById('domainname').value);\n    \t\tXHR.appendData('uid',uid);\n    \t\tXHR.appendData('gpid',document.getElementById('www_group').value);\n    \t\tXHR.appendData('mysql_instance_id',document.getElementById('mysql_instance_id').value);\n    \t\tXHR.appendData('mysql_database',document.getElementById('mysql_database').value);\n    \t\tXHR.appendData('mysql_password',document.getElementById('mysql_password').value);\n    \t\tXHR.appendData('mysql_username',document.getElementById('mysql_username').value);\n    \t\tXHR.appendData('ftpuser',ftpuser);\n    \t\tXHR.appendData('ftppassword',document.getElementById('ftppassword').value);\n    \t\tXHR.appendData('ForwardTo',document.getElementById('ForwardTo').value);\n    \t\tXHR.appendData('force-groupware',document.getElementById('force-groupware').value);\n    \t\tXHR.appendData('mysql_instance_id',document.getElementById('mysql_instance_id').value);\n    \t\tXHR.appendData('ServerIP',document.getElementById('ServerIP').value);\n    \t\tXHR.appendData('sslcertificate',document.getElementById('sslcertificate').value);\n    \t\t\n    \t\t\n    \t\t\n    \t\tAnimateDiv('freewebdiv');\n    \t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveFreeWebMain);\n\t\t\t\n\t\t}\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\t\n\tfunction FreeWebsCheckGroupware(){\n\t\tLoadWinORG2('850','{$page}?FreeWebsCheck=yes&servername={$ligne["servername"]}','{$check_configuration}::{$ligne["servername"]}');\n\t\n\t}\n\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){document.getElementById('UseLoopDisk').disabled=false;}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\tfunction CheckUseReverseProxy(){\n\t\tCheckDatas();\n\t\tuseMysqlCheck();\n\t\tCheckLoops();\n\t\t{$js_removesql};\n\t\t{$js_OnlyWebSite};\n\t}\n\t\n\tfunction HideMysql(){\n\t\tdocument.getElementById('useMysql').disabled=true;\n\t}\n\t\n\tfunction OnlyWebsite(){\n\t\tif(document.getElementById('Forwarder')){document.getElementById('Forwarder').disabled=true;}\n\t\tif(document.getElementById('UseReverseProxy')){document.getElementById('UseReverseProxy').disabled=true;}\n\t\tif(document.getElementById('useFTP')){document.getElementById('useFTP').disabled=true;}\n\t}\n\t\n\tfunction CheckUId(){\n\t\tLoadAjaxTiny('status-uid-www','{$page}?uid-check={$uid_uri}');\n\t}\n\n\t\n\tfunction freeweb_mysql_instances(){\n\t\tLoadAjaxTiny('freeweb-mysql-instances','{$page}?freeweb-mysql-instances-field=yes&servername={$ligne["servername"]}');\n\t\n\t}\n\t\n\tfunction mysql_instance_id_check(){\n\t\t\t\n\t\t\tvar mysql_instance_id=document.getElementById('mysql_instance_id').value;\n\t\t\t\n\t\t\tif(mysql_instance_id>0){\n\t\t\t\tdocument.getElementById('useMysql').disabled=true;\n\t\t\t\tuseMysqlCheck();\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('useMysql').disabled=false;\n\t\t\t\tuseMysqlCheck();\n\t\t\t}\n\t\t}\n\t\t\n\n\t\n\tCheckDatas();\n\tuseMysqlCheck();\n\tCheckLoops();\n\tCheckForwarder();\n\tCheckUId();\n\t{$js_removesql};\n\t{$js_OnlyWebSite};\n\t\n\tfreeweb_mysql_instances();\n\t\n\t</script>\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #22
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));
}
Example #23
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>";
    }
    //javascript:
    $html[] = "\n\t<tr>\n\t\t<td colspan=2 align='right' style='font-size:40px'>\n\t\t\t" . button("{apply_parameters}", "Submit{$t}(1);", 40) . "&nbsp;&nbsp;|&nbsp;&nbsp;" . button("{apply}", "Submit{$t}()", 40) . "</td>\n\t\t</tr>\n\t\t\t\n\t";
    $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}\nvar xSubmitCompile{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#NGINX_MAIN_TABLE').flexReload();\n\tLoadjs('nginx.single.progress.php?servername={$servername}');\n}\n\n\n\n\n\t\n\t\nfunction Submit{$t}(Compile){\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\tif(!Compile){\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}else{\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmitCompile{$t});\n\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));
}