コード例 #1
0
ファイル: exec.squid.php プロジェクト: brucewu16899/1.6.x
function output_acls()
{
    $q = new squidbee();
    $acls = new squid_acls_groups();
    $squid = new squidbee();
    echo "\nexternal_acl_helper_categories\n-----------------\n";
    echo $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";
}