Ejemplo n.º 1
0
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");
}
Ejemplo n.º 2
0
function start()
{
    $unix = new unix();
    $squid = new squidbee();
    $q = new mysql_squid_builder();
    $INCLUDE = false;
    $f = explode("\n", @file_get_contents("/etc/squid3/squid.conf"));
    build_progress_ecap("{ecap_plugins} {analyze}", 20);
    while (list($www, $line) = each($f)) {
        if (!preg_match("#acls_ecap\\.conf#", $line)) {
            continue;
        }
        echo "Include OK\n";
        $INCLUDE = TRUE;
        break;
    }
    if (!$INCLUDE) {
        echo "Include False, reconfigure\n";
        build_progress_ecap("{ecap_plugins} {reconfigure}", 80);
        $php = $unix->LOCATE_PHP5_BIN();
        system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
        build_progress_ecap("{ecap_plugins} {done}", 100);
        return;
    }
    $md51 = md5_file("/etc/squid3/acls_ecap.conf");
    build_progress_ecap("{ecap_plugins} {reconfigure}", 50);
    $band = new squid_ecap_builder();
    if (!$band->compile()) {
        build_progress_ecap("{ecap_plugins} {failed}", 110);
        return;
    }
    build_progress_ecap("{ecap_plugins} {reconfigure} ICAP services", 80);
    $icap = new icap();
    $icap->build_services();
    build_progress_ecap("{ecap_plugins} ICAP services {done}", 85);
    $md52 = md5_file("/etc/squid3/acls_ecap.conf");
    if ($md51 == $md52) {
        build_progress_ecap("{ecap_plugins} {done} {unmodified}", 100);
        return;
    }
    $squidbin = $unix->LOCATE_SQUID_BIN();
    build_progress_ecap("{ecap_plugins} {reloading}", 97);
    system("{$squidbin} -k reconfigure");
    build_progress_ecap("{ecap_plugins} {done} OK", 100);
    // FATAL: No valid signing SSL certificate
}