function xstart() { $unix = new unix(); $php = $unix->LOCATE_PHP5_BIN(); build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 15); $extern = new external_acls_squid(); $extern->Build(); if (!checkIntegrated()) { build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 30); $squid_access_manager = new squid_access_manager(); $squid_access_manager->build_all(); build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 40); $squid = new squidbee(); $icap = new icap(); $icap->build_services(); build_progress("{starting} {reconfigure_proxy_service}", 50); system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force"); if (!checkIntegrated()) { build_progress("Missing CONF files:{failed}", 110); return; } build_progress("{done} {GLOBAL_ACCESS_CENTER}", 100); return; } build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 20); $external_acls_squid = new external_acls_squid(); $external_acls_squid->Build(); build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 30); $GLOBALS["aclGen"] = new squid_acls(); $GLOBALS["aclGen"]->Build_Acls(true); $ACLS_TO_ADD = @implode("\n", $GLOBALS["aclGen"]->acls_array); @file_put_contents("/etc/squid3/acls_center.conf", $ACLS_TO_ADD); build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 50); $squid_access_manager = new squid_access_manager(); $squid_access_manager->build_all(); build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 55); $squid_childs = new squid_childs(); $squid_childs->build(); build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 60); $squid = new squidbee(); $q = new squid_freewebs(); $icap = new icap(); $icap->build_services(); build_progress("{starting} {GLOBAL_ACCESS_CENTER}", 60); if ($GLOBALS["NOCHECK"]) { return true; } if (!Test_config()) { build_progress("{failed}", 90); @file_put_contents("/etc/squid3/GlobalAccessManager_auth.conf", "\n"); @file_put_contents("/etc/squid3/GlobalAccessManager_url_rewrite.conf", "\n"); @file_put_contents("/etc/squid3/GlobalAccessManager_deny_cache.conf", "\n"); @file_put_contents("/etc/squid3/icap.conf", "\n"); build_progress("{failed}", 110); return; } build_progress("{done} {reloading_proxy_service}", 100); $squidbin = $unix->find_program("squid"); system("{$squidbin} -f /etc/squid3/squid.conf -k reconfigure"); }
function output_acls() { $q = new squidbee(); $acls = new squid_acls_groups(); $external_acls_squid = new external_acls_squid(); $squid = new squidbee(); echo "\nexternal_acl_helper_categories\n-----------------\n"; echo $external_acls_squid->external_acl_helper_categories(); echo "\n-----------------\n"; $sock = new sockets(); $refreshpattern = $squid->refresh_pattern_list(); $SquidBubbleMode = $sock->GET_INFO("SquidBubbleMode"); if (!is_numeric($SquidBubbleMode)) { $SquidBubbleMode = 0; } $acl = new squid_acls_quotas_time(); $squid_acls_quotas_time = $acl->build() . "\n"; $acls = new squid_acls(); $acls->Build_Acls(); $aclgroups = new squid_acls_groups(); if (count($acls->acls_array) > 0) { $ACLS_TO_ADD = @implode("\n", $acls->acls_array); } echo "\nAcls\n-----------------\n" . $ACLS_TO_ADD . "\n-----------------\n\n"; echo "\nQuotas Time\n-----------------\n" . $squid_acls_quotas_time . "\n-----------------\n\n"; echo "\n\n-----------------\n" . $aclgroups->buildacls_order(0) . "\n-----------------\n\n"; echo "######\n"; $tcp_outgoing_address = $aclgroups->buildacls_bytype("tcp_outgoing_address"); echo "\n\ntcp_outgoing_address -----------------\n"; if (count($tcp_outgoing_address) > 0) { echo "Starting......: " . date("H:i:s") . " [ACLS]: Engine tcp_outgoing_address " . count($tcp_outgoing_address) . " rules..\n"; while (list($index, $line) = each($tcp_outgoing_address)) { echo "tcp_outgoing_address {$line}\n"; } } else { echo "Starting......: " . date("H:i:s") . " [ACLS]: ACL Engine tcp_outgoing_address No rules..\n"; } echo "\n-----------------\n\n"; echo "######\n"; $q = new mysql_squid_builder(); if ($SquidBubbleMode == 1) { $sql = "SELECT * FROM webfilters_sqaclsports ORDER BY aclport"; $results = $q->QUERY_SQL($sql); while ($ligne = mysql_fetch_assoc($results)) { echo "\n\n#--------- ACLS {$ligne["portname"]}\n\n"; echo "\n\n" . $aclgroups->buildacls_order($ligne["aclport"]) . "\n\n"; } } $bandwith = new squid_bandwith_builder(); echo "\n-----------------\n\n"; echo $bandwith->compile() . "\n"; $acls_rules = $acls->build_http_access(0); echo "\n\n# Builded acls from engine [" . count($acls_rules) . "] items.\n"; if (count($acls_rules) > 0) { echo "\n\n" . @implode("\n", $acls_rules) . "\n"; } if ($SquidBubbleMode == 1) { $sql = "SELECT * FROM webfilters_sqaclsports ORDER BY aclport"; $results = $q->QUERY_SQL($sql); while ($ligne = mysql_fetch_assoc($results)) { $acls_rules = $acls->build_http_access($ligne["aclport"]); echo "\n\n# Builded acls from engine {$ligne["portname"]} [" . count($acls_rules) . "] items.\n"; if (count($acls_rules) > 0) { echo "\n\n" . @implode("\n", $acls_rules) . "\n"; } } } echo "\n\n-----------------\n" . $refreshpattern . "\n-----------------\n\n"; $acls = new squid_acls_groups(); $acls_deny = $acls->buildacls_bytype("url_rewrite_access_deny"); if (count($acls_deny) > 0) { while (list($index, $line) = each($acls_deny)) { $MyStandPort = "MyStandPort"; echo "url_rewrite_access deny {$line}\n"; } } echo "######\n"; echo "######\n"; echo "######\n"; }