コード例 #1
0
ファイル: ufdbgclient.php プロジェクト: articatech/artica
function ufdbconfig()
{
    $quota = new ufdbgquota();
    if (!is_file("/etc/artica-postfix/settings/Daemons/WebFilteringRansomware")) {
        $GLOBALS["WebFilteringRansomware"] = 1;
        @file_put_contents("/etc/artica-postfix/settings/Daemons/WebFilteringRansomware", 1);
    }
    $GLOBALS["EnableITChart"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableITChart"));
    $GLOBALS["HTTrackInSquid"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HTTrackInSquid"));
    $GLOBALS["GoogleSafeBrowsingApiKey"] = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/GoogleSafeBrowsingApiKey"));
    $GLOBALS["EnableGoogleSafeBrowsing"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableGoogleSafeBrowsing"));
    $GLOBALS["GoogleSafeBrowsingCacheTime"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/GoogleSafeBrowsingCacheTime"));
    $GLOBALS["HyperCacheStoragePath"] = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheStoragePath"));
    $GLOBALS["HyperCacheMemEntries"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheMemEntries"));
    $GLOBALS["HyperCacheBuffer"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheBuffer"));
    $GLOBALS["SquidUrgency"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidUrgency"));
    $GLOBALS["UpdateUtilityForceProxy"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/UpdateUtilityForceProxy"));
    $GLOBALS["HyperCacheHTTPListenPort"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheHTTPListenPort"));
    if ($GLOBALS["HyperCacheHTTPListenPort"] == 0) {
        $GLOBALS["HyperCacheHTTPListenPort"] = 8700;
    }
    $GLOBALS["HyperCacheListenAddr"] = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheListenAddr"));
    $GLOBALS["EnableHTTPSURBL"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableHTTPSURBL"));
    $GLOBALS["PHISHTANK"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableSquidPhishTank"));
    $GLOBALS["WindowsUpdateCaching"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/WindowsUpdateCaching"));
    $GLOBALS["WindowsUpdateCachingDir"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/WindowsUpdateCachingDir");
    if ($GLOBALS["WindowsUpdateCachingDir"] == null) {
        $GLOBALS["WindowsUpdateCachingDir"] = "/home/squid/WindowsUpdate";
    }
    $GLOBALS["SquidGuardRedirectSSLBehavior"] = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardRedirectSSLBehavior"));
    $GLOBALS["SquidGuardRedirectBehavior"] = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardRedirectBehavior"));
    $GLOBALS["SquidGuardRedirectHTTPCode"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardRedirectHTTPCode"));
    if ($GLOBALS["SquidGuardRedirectBehavior"] == null) {
        $GLOBALS["SquidGuardRedirectBehavior="] = "url";
    }
    if ($GLOBALS["SquidGuardRedirectSSLBehavior"] == null) {
        $GLOBALS["SquidGuardRedirectSSLBehavior="] = "url";
    }
    if (!is_numeric($GLOBALS["SquidGuardRedirectHTTPCode"])) {
        $GLOBALS["SquidGuardRedirectHTTPCode"] = 302;
    }
    $GLOBALS["SquidGuardWebUseExternalUri"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebUseExternalUri"));
    $GLOBALS["SquidGuardWebExternalUri"] = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebExternalUri"));
    $GLOBALS["SquidGuardWebExternalUriSSL"] = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebExternalUriSSL"));
    $GLOBALS["SquidGuardWebSSLCompatibility"] = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebSSLCompatibility"));
    $GLOBALS["SquidGuardServerName"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardServerName");
    $GLOBALS["SquidGuardApachePort"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardApachePort"));
    $GLOBALS["SquidGuardApacheSSLPort"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardApacheSSLPort"));
    if ($GLOBALS["SquidGuardApachePort"] == 0) {
        $GLOBALS["SquidGuardApachePort"] = 9025;
    }
    if ($GLOBALS["SquidGuardApacheSSLPort"] == 0) {
        $GLOBALS["SquidGuardApacheSSLPort"] = 9020;
    }
    if ($GLOBALS["SquidGuardServerName"] == null) {
        $GLOBALS["SquidGuardServerName"] = php_uname("n");
    }
    if ($GLOBALS["HyperCacheStoragePath"] == null) {
        $GLOBALS["HyperCacheStoragePath"] = "/home/artica/proxy-cache";
    }
    if ($GLOBALS["GoogleSafeBrowsingCacheTime"] == 0) {
        $GLOBALS["GoogleSafeBrowsingCacheTime"] = 10080;
    }
    $GLOBALS["GoogleSafeBrowsingDNS"] = trim(strtolower(@file_get_contents("/etc/artica-postfix/settings/Daemons/GoogleSafeBrowsingDNS")));
    $GLOBALS["GoogleSafeBrowsingInterface"] = trim(strtolower(@file_get_contents("/etc/artica-postfix/settings/Daemons/GoogleSafeBrowsingInterface")));
    if ($GLOBALS["HyperCacheMemEntries"] == 0) {
        $GLOBALS["HyperCacheMemEntries"] = 500000;
    }
    if ($GLOBALS["HyperCacheBuffer"] == 0) {
        $GLOBALS["HyperCacheBuffer"] = 50;
    }
    if ($GLOBALS["GoogleSafeBrowsingDNS"] == null) {
        $GLOBALS["GoogleSafeBrowsingDNS"] = "8.8.8.8,4.4.4.4";
    }
    if ($GLOBALS["GoogleSafeBrowsingDNS"] == "*") {
        $GLOBALS["GoogleSafeBrowsingDNS"] = null;
    }
    if ($GLOBALS["GoogleSafeBrowsingDNS"] == "default") {
        $GLOBALS["GoogleSafeBrowsingDNS"] = null;
    }
    if ($GLOBALS["GOOGLE_SAFE"]) {
        events("ufdbconfig:: /etc/artica-postfix/settings/Daemons/EnableGoogleSafeBrowsing = {$GLOBALS["EnableGoogleSafeBrowsing"]}");
    }
    $GLOBALS["PROXY"] = array();
    $ini = new Bs_IniHandler();
    $datas = @file_get_contents("/etc/artica-postfix/settings/Daemons/ArticaProxySettings");
    if (trim($datas) != null) {
        $ini->loadString($datas);
    }
    if (isset($ini->_params["PROXY"])) {
        $GLOBALS["PROXY"] = $ini->_params["PROXY"];
    }
    $GLOBALS["SquidEnforceRules"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidEnforceRules"));
    $EnableUfdbGuard = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableUfdbGuard"));
    $UseRemoteUfdbguardService = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/UseRemoteUfdbguardService"));
    $EnableRemoteStatisticsAppliance = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableRemoteStatisticsAppliance"));
    $datas = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/ufdbguardConfig")));
    $RemoteStatisticsApplianceSettings = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/RemoteStatisticsApplianceSettings")));
    $SquidGuardIPWeb = unserialize(@file_get_contents("/var/log/squid/SquidGuardIPWeb"));
    if (is_array($SquidGuardIPWeb)) {
        $GLOBALS["SquidGuardIPWeb"] = $SquidGuardIPWeb["SquidGuardIPWeb"];
    }
    $SquidGuardWebUseExternalUri = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebUseExternalUri"));
    if ($SquidGuardWebUseExternalUri == 1) {
        $GLOBALS["SquidGuardIPWeb"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebExternalUri");
        $GLOBALS["SquidGuardIPWeb_SSL"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebExternalUriSSL");
    }
    if ($GLOBALS["SquidEnforceRules"] == 1) {
        HyperCacheRulesLoad();
    }
    if (!isset($datas["url_rewrite_children_concurrency"])) {
        $datas["url_rewrite_children_concurrency"] = 2;
    }
    $GLOBALS["url_rewrite_concurrency"] = $datas["url_rewrite_children_concurrency"];
    $GLOBALS["UfdbgclientSockTimeOut"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/UfdbgclientSockTimeOut"));
    if ($GLOBALS["UfdbgclientSockTimeOut"] == 0) {
        $GLOBALS["UfdbgclientSockTimeOut"] = 2;
    }
    $GLOBALS["UfdbgclientMaxSockTimeOut"] = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/UfdbgclientMaxSockTimeOut"));
    if ($GLOBALS["UfdbgclientMaxSockTimeOut"] == 0) {
        $GLOBALS["UfdbgclientMaxSockTimeOut"] = 5;
    }
    if (!isset($datas["remote_port"])) {
        $datas["remote_port"] = 3977;
    }
    if (!isset($datas["remote_server"])) {
        $datas["remote_server"] = "127.0.0.1";
    }
    if (!is_numeric($datas["remote_port"])) {
        $datas["remote_port"] = 3977;
    }
    if (trim($datas["remote_server"] == null)) {
        $datas["remote_server"] = "127.0.0.1";
    }
    if (!isset($datas["remote_server"])) {
        $datas["remote_server"] = null;
    }
    if (!isset($datas["remote_port"])) {
        $datas["remote_port"] = 3977;
    }
    if ($datas["remote_server"] == "all") {
        $datas["remote_server"] = "127.0.0.1";
    }
    if ($datas["remote_server"] == null) {
        $datas["remote_server"] = "127.0.0.1";
    }
    if (!is_numeric($datas["remote_port"])) {
        $datas["remote_port"] = 3977;
    }
    if ($EnableRemoteStatisticsAppliance == 1) {
        $GLOBALS["EnableUfdbGuard"] = 1;
        $datas["remote_server"] = $RemoteStatisticsApplianceSettings["SERVER"];
        $UseRemoteUfdbguardService = 1;
        $GLOBALS["EnableUfdbGuard"] = 1;
        $datas["remote_port"] = $datas["listen_port"];
        events("Using remote appliance {$RemoteStatisticsApplianceSettings["SERVER"]}:{$datas["listen_port"]} as Web filtering engine");
        $GLOBALS["UFDB_SERVER"] = $RemoteStatisticsApplianceSettings["SERVER"];
        $GLOBALS["UFDB_PORT"] = $datas["listen_port"];
        return;
    }
    if ($UseRemoteUfdbguardService == 1) {
        $GLOBALS["EnableUfdbGuard"] = 1;
        $GLOBALS["UFDB_SERVER"] = $datas["remote_server"];
        $GLOBALS["UFDB_PORT"] = $datas["remote_port"];
        if (!is_numeric($GLOBALS["UFDB_PORT"])) {
            $GLOBALS["UFDB_PORT"] = 3977;
        }
        if (trim($GLOBALS["UFDB_SERVER"] == null)) {
            $GLOBALS["UFDB_SERVER"] = "127.0.0.1";
        }
        if (!isset($GLOBALS["UFDB_SERVER"])) {
            $GLOBALS["UFDB_SERVER"] = null;
        }
        if (!isset($GLOBALS["UFDB_PORT"])) {
            $GLOBALS["UFDB_PORT"] = 3977;
        }
        if ($GLOBALS["UFDB_SERVER"] == "all") {
            $GLOBALS["UFDB_SERVER"] = "127.0.0.1";
        }
        if ($GLOBALS["UFDB_SERVER"] == null) {
            $GLOBALS["UFDB_SERVER"] = "127.0.0.1";
        }
        if (!is_numeric($GLOBALS["UFDB_PORT"])) {
            $GLOBALS["UFDB_PORT"] = 3977;
        }
        events("Using remote service {$datas["remote_server"]}:{$datas["remote_port"]} as Web filtering engine");
        return;
    }
    if ($EnableUfdbGuard == 0) {
        events("Web filtering engine is disabled");
        $GLOBALS["EnableUfdbGuard"] = 0;
        return;
    }
    $effective_port = ufdbguard_value("port");
    $interface = ufdbguard_value("interface");
    $GLOBALS["UFDB_SERVER"] = $interface;
    $GLOBALS["UFDB_PORT"] = $effective_port;
    $GLOBALS["EnableUfdbGuard"] = 1;
    if (!is_numeric($GLOBALS["UFDB_PORT"])) {
        $GLOBALS["UFDB_PORT"] = 3977;
    }
    if (trim($GLOBALS["UFDB_SERVER"] == null)) {
        $GLOBALS["UFDB_SERVER"] = "127.0.0.1";
    }
    if (!isset($GLOBALS["UFDB_SERVER"])) {
        $GLOBALS["UFDB_SERVER"] = null;
    }
    if (!isset($GLOBALS["UFDB_PORT"])) {
        $GLOBALS["UFDB_PORT"] = 3977;
    }
    if ($GLOBALS["UFDB_SERVER"] == "all") {
        $GLOBALS["UFDB_SERVER"] = "127.0.0.1";
    }
    if ($GLOBALS["UFDB_SERVER"] == null) {
        $GLOBALS["UFDB_SERVER"] = "127.0.0.1";
    }
    if (!is_numeric($GLOBALS["UFDB_PORT"])) {
        $GLOBALS["UFDB_PORT"] = 3977;
    }
    events("Using local service {$interface}:{$effective_port} as Web filtering engine");
    events("Redirect engine:{$GLOBALS["SquidGuardRedirectBehavior"]} CODE {$GLOBALS["SquidGuardRedirectHTTPCode"]}");
}
コード例 #2
0
ファイル: exec.pdns.pipe.php プロジェクト: BillTheBest/1.6.x
function ufdbguardConstruct()
{
    $binary = "/usr/bin/ufdbgclient";
    $moinsC = null;
    $moinsd = null;
    $log = "-l /var/log/pdns";
    if ($GLOBALS["VERBOSE"]) {
        $moinsd = " -d ";
    }
    @mkdir("/var/log/pdns", 0755, true);
    $GLOBALS["PDSNInUfdbWebsite"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/PDSNInUfdbWebsite");
    if ($GLOBALS["PDSNInUfdbWebsite"] == null) {
        $GLOBALS["PDSNInUfdbWebsite"] = "www.google.com";
    }
    $datas = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/ufdbguardConfig")));
    if (!isset($datas["UseRemoteUfdbguardService"])) {
        $datas["UseRemoteUfdbguardService"] = 0;
    }
    if (!isset($datas["remote_port"])) {
        $datas["remote_port"] = 3977;
    }
    if (!isset($datas["remote_server"])) {
        $datas["remote_server"] = null;
    }
    if (!isset($datas["listen_addr"])) {
        $datas["listen_addr"] = "127.0.0.1";
    }
    if (!isset($datas["listen_port"])) {
        $datas["listen_port"] = "3977";
    }
    if (!isset($datas["tcpsockets"])) {
        $datas["tcpsockets"] = 1;
    }
    $EnableRemoteStatisticsAppliance = @file_get_contents("/etc/artica-postfix/settings/Daemons/EnableRemoteStatisticsAppliance");
    if (!is_numeric($EnableRemoteStatisticsAppliance)) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    if ($EnableRemoteStatisticsAppliance == 1) {
        $RemoteStatisticsApplianceSettings = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/RemoteStatisticsApplianceSettings")));
        $datas["remote_server"] = $RemoteStatisticsApplianceSettings["SERVER"];
        $datas["UseRemoteUfdbguardService"] = 1;
        $datas["remote_port"] = $datas["listen_port"];
    }
    if ($datas["UseRemoteUfdbguardService"] == 1) {
        if (trim($datas["remote_server"] == null)) {
            $datas["remote_server"] = "127.0.0.1";
        }
        $address = "-S {$datas["remote_server"]} -p {$datas["remote_port"]} ";
        WriteToSyslog("Use remote ufdbguard service: {$datas["remote_server"]}:{$datas["remote_port"]}");
        return "{$binary} {$moinsd}{$moinsC}{$address} {$log}";
    }
    if ($datas["remote_port"] == null) {
        $datas["UseRemoteUfdbguardService"] = 0;
    }
    if ($datas["listen_addr"] == null) {
        $datas["listen_addr"] = "127.0.0.1";
    }
    if ($datas["listen_addr"] == "all") {
        $datas["listen_addr"] = "127.0.0.1";
    }
    $effective_port = ufdbguard_value("port");
    WriteToSyslog("ufdbguardd: Effective port:`{$effective_port}`");
    if (is_numeric($effective_port)) {
        $datas["tcpsockets"] = 1;
    }
    if ($datas["tcpsockets"] == 1) {
        if (trim($datas["listen_addr"] == null)) {
            $datas["listen_addr"] = "127.0.0.1";
        }
        WriteToSyslog("ufdbguardd: Use remote ufdbguard service: {$datas["listen_addr"]}:{$datas["remote_port"]}");
        $address = "-S {$datas["listen_addr"]} -p {$datas["listen_port"]} ";
        return "{$binary} {$moinsd}{$moinsC}{$address} {$log}";
    }
    WriteToSyslog("ufdbguardd: Use remote ufdbguard service: {$binary} {$moinsC}{$log}");
    return "{$binary} {$moinsd}{$moinsC}{$log}";
}
コード例 #3
0
ファイル: ufdbgclient.php プロジェクト: brucewu16899/1.6.x
function ufdbconfig(){
	
	
	$GLOBALS["GoogleSafeBrowsingApiKey"]=trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/GoogleSafeBrowsingApiKey"));
	$GLOBALS["EnableGoogleSafeBrowsing"]=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableGoogleSafeBrowsing"));
	$GLOBALS["GoogleSafeBrowsingCacheTime"]=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/GoogleSafeBrowsingCacheTime"));
	
	$GLOBALS["HyperCacheStoragePath"]=trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheStoragePath"));
	$GLOBALS["HyperCacheMemEntries"]=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheMemEntries"));
	$GLOBALS["HyperCacheBuffer"]=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheBuffer"));
	
	
	$GLOBALS["HyperCacheHTTPListenPort"]=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheHTTPListenPort"));
	if($GLOBALS["HyperCacheHTTPListenPort"]==0){$GLOBALS["HyperCacheHTTPListenPort"]=8700;}
	
	$GLOBALS["HyperCacheListenAddr"]=trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/HyperCacheListenAddr"));
	
	
	
	
	if($GLOBALS["HyperCacheStoragePath"]==null){$GLOBALS["HyperCacheStoragePath"]="/home/artica/proxy-cache";}
	if($GLOBALS["GoogleSafeBrowsingCacheTime"]==0){$GLOBALS["GoogleSafeBrowsingCacheTime"]=10080;}
	$GLOBALS["GoogleSafeBrowsingDNS"]=trim(strtolower(@file_get_contents("/etc/artica-postfix/settings/Daemons/GoogleSafeBrowsingDNS")));
	$GLOBALS["GoogleSafeBrowsingInterface"]=trim(strtolower(@file_get_contents("/etc/artica-postfix/settings/Daemons/GoogleSafeBrowsingInterface")));
	
	
	if($GLOBALS["HyperCacheMemEntries"]==0){$GLOBALS["HyperCacheMemEntries"]=500000;}
	if($GLOBALS["HyperCacheBuffer"]==0){$GLOBALS["HyperCacheBuffer"]=50;}
	
	
	if($GLOBALS["GoogleSafeBrowsingDNS"]==null){$GLOBALS["GoogleSafeBrowsingDNS"]="8.8.8.8,4.4.4.4";}
	if($GLOBALS["GoogleSafeBrowsingDNS"]=="*"){$GLOBALS["GoogleSafeBrowsingDNS"]=null;}
	if($GLOBALS["GoogleSafeBrowsingDNS"]=="default"){$GLOBALS["GoogleSafeBrowsingDNS"]=null;}
	
	
	if($GLOBALS["GOOGLE_SAFE"]){
		events("ufdbconfig:: /etc/artica-postfix/settings/Daemons/EnableGoogleSafeBrowsing = {$GLOBALS["EnableGoogleSafeBrowsing"]}");
	}
	
	$GLOBALS["PROXY"]=array();
	$ini=new Bs_IniHandler();
	
	$datas=@file_get_contents("/etc/artica-postfix/settings/Daemons/ArticaProxySettings");
	if(trim($datas)<>null){$ini->loadString($datas);}
	if(isset($ini->_params["PROXY"])){$GLOBALS["PROXY"]=$ini->_params["PROXY"];}
	
	$GLOBALS["SquidEnforceRules"]=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidEnforceRules"));
	$GLOBALS["EnableStreamCache"]=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableStreamCache"));
	$EnableUfdbGuard=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableUfdbGuard"));
	$UseRemoteUfdbguardService=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/UseRemoteUfdbguardService"));
	$EnableRemoteStatisticsAppliance=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableRemoteStatisticsAppliance"));
	$datas=unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/ufdbguardConfig")));
	$RemoteStatisticsApplianceSettings=unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/RemoteStatisticsApplianceSettings")));
	$SquidGuardIPWeb=unserialize(@file_get_contents("/var/log/squid/SquidGuardIPWeb"));
	if(is_array($SquidGuardIPWeb)){$GLOBALS["SquidGuardIPWeb"]=$SquidGuardIPWeb["SquidGuardIPWeb"];}
	$SquidGuardWebUseExternalUri=intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebUseExternalUri"));
	if($SquidGuardWebUseExternalUri==1){
		$GLOBALS["SquidGuardIPWeb"]=@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebExternalUri");
		$GLOBALS["SquidGuardIPWeb_SSL"]=@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidGuardWebExternalUriSSL");
	}
	
	if($GLOBALS["SquidEnforceRules"]==1){
		HyperCacheRulesLoad();
	}
	
	

	if(!is_numeric($datas["remote_port"])){$datas["remote_port"]=3977;}
	if(trim($datas["remote_server"]==null)){$datas["remote_server"]="127.0.0.1";}
	if(!isset($datas["remote_server"])){$datas["remote_server"]=null;}
	if(!isset($datas["remote_port"])){$datas["remote_port"]=3977;}
	if($datas["remote_server"]=="all"){$datas["remote_server"]="127.0.0.1";}
	if($datas["remote_server"]==null){$datas["remote_server"]="127.0.0.1";}
	if(!is_numeric($datas["remote_port"])){$datas["remote_port"]=3977;}

	
	if($EnableRemoteStatisticsAppliance==1){
		$GLOBALS["EnableUfdbGuard"]=1;
		$datas["remote_server"]=$RemoteStatisticsApplianceSettings["SERVER"];
		$UseRemoteUfdbguardService=1;
		$GLOBALS["EnableUfdbGuard"]=1;
		$datas["remote_port"]=$datas["listen_port"];
		events("Using remote appliance {$RemoteStatisticsApplianceSettings["SERVER"]}:{$datas["listen_port"]} as Web filtering engine");
		$GLOBALS["UFDB_SERVER"]=$RemoteStatisticsApplianceSettings["SERVER"];
		$GLOBALS["UFDB_PORT"]=$datas["listen_port"];
		return;
	}

	
	if($UseRemoteUfdbguardService==1){
		$GLOBALS["EnableUfdbGuard"]=1;
		$GLOBALS["UFDB_SERVER"]=$datas["remote_server"];
		$GLOBALS["UFDB_PORT"]=$datas["remote_port"];
		if(!is_numeric($GLOBALS["UFDB_PORT"])){$GLOBALS["UFDB_PORT"]=3977;}
		if(trim($GLOBALS["UFDB_SERVER"]==null)){$GLOBALS["UFDB_SERVER"]="127.0.0.1";}
		if(!isset($GLOBALS["UFDB_SERVER"])){$GLOBALS["UFDB_SERVER"]=null;}
		if(!isset($GLOBALS["UFDB_PORT"])){$GLOBALS["UFDB_PORT"]=3977;}
		if($GLOBALS["UFDB_SERVER"]=="all"){$GLOBALS["UFDB_SERVER"]="127.0.0.1";}
		if($GLOBALS["UFDB_SERVER"]==null){$GLOBALS["UFDB_SERVER"]="127.0.0.1";}
		if(!is_numeric($GLOBALS["UFDB_PORT"])){$GLOBALS["UFDB_PORT"]=3977;}
		events("Using remote service {$datas["remote_server"]}:{$datas["remote_port"]} as Web filtering engine");
		
		return;
	}
	if($EnableUfdbGuard==0){
		events("Web filtering engine is disabled");
		$GLOBALS["EnableUfdbGuard"]=0;
		return;
	}
	$effective_port=ufdbguard_value("port");
	$interface=ufdbguard_value("interface");
	
	$GLOBALS["UFDB_SERVER"]=$interface;
	$GLOBALS["UFDB_PORT"]=$effective_port;
	$GLOBALS["EnableUfdbGuard"]=1;
	if(!is_numeric($GLOBALS["UFDB_PORT"])){$GLOBALS["UFDB_PORT"]=3977;}
	if(trim($GLOBALS["UFDB_SERVER"]==null)){$GLOBALS["UFDB_SERVER"]="127.0.0.1";}
	if(!isset($GLOBALS["UFDB_SERVER"])){$GLOBALS["UFDB_SERVER"]=null;}
	if(!isset($GLOBALS["UFDB_PORT"])){$GLOBALS["UFDB_PORT"]=3977;}
	if($GLOBALS["UFDB_SERVER"]=="all"){$GLOBALS["UFDB_SERVER"]="127.0.0.1";}
	if($GLOBALS["UFDB_SERVER"]==null){$GLOBALS["UFDB_SERVER"]="127.0.0.1";}
	if(!is_numeric($GLOBALS["UFDB_PORT"])){$GLOBALS["UFDB_PORT"]=3977;}
	events("Using local service {$interface}:{$effective_port} as Web filtering engine");
}