当前位置: 首页>>代码示例>>PHP>>正文


PHP squidbee::BuildBlockedSites方法代码示例

本文整理汇总了PHP中squidbee::BuildBlockedSites方法的典型用法代码示例。如果您正苦于以下问题:PHP squidbee::BuildBlockedSites方法的具体用法?PHP squidbee::BuildBlockedSites怎么用?PHP squidbee::BuildBlockedSites使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在squidbee的用法示例。


在下文中一共展示了squidbee::BuildBlockedSites方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ApplyConfig

function ApplyConfig()
{
    $unix = new unix();
    $squid = new squidbee();
    writelogs("->BuildBlockedSites", __FUNCTION__, __FILE__, __LINE__);
    $squid->BuildBlockedSites();
    if (!is_file("/etc/squid3/squid-block.acl")) {
        @file_put_contents("/etc/squid3/squid-block.acl", "");
    }
    $SQUID_CONFIG_PATH = $unix->SQUID_CONFIG_PATH();
    if (!is_file($SQUID_CONFIG_PATH)) {
        writelogs("Unable to stat squid configuration file \"{$SQUID_CONFIG_PATH}\"", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    echo "Starting......: Squid building main configuration done\n";
    $squid = new squidbee();
    $conf = $squid->BuildSquidConf();
    @file_put_contents("/etc/artica-postfix/settings/Daemons/GlobalSquidConf", $conf);
    @file_put_contents($SQUID_CONFIG_PATH, $conf);
    certificate_generate();
}
开发者ID:brucewu16899,项目名称:artica,代码行数:21,代码来源:exec.squid.php

示例2: ApplyConfig

function ApplyConfig($smooth = false)
{
    if (function_exists("WriteToSyslogMail")) {
        WriteToSyslogMail("Invoke ApplyConfig function", basename(__FILE__));
    }
    $unix = new unix();
    $ulimit = $unix->find_program("ulimit");
    if (is_file($ulimit)) {
        shell_exec("{$ulimit} -HSd unlimited");
    } else {
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid ulimit no such binary...\n";
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid apply kernel settings\n";
    build_progress("{reconfigure} Kernel values", 46);
    kernel_values();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid apply Checks security limits\n";
    build_progress("{reconfigure} Security limits", 47);
    security_limit();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Remote appliances...\n";
    build_progress("{reconfigure} checks remote appliances", 48);
    remote_appliance_restore_tables();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Remote appliances done...\n";
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $squidbin = $unix->find_program("squid");
    $SQUID_CONFIG_PATH = $unix->SQUID_CONFIG_PATH();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid loading libraires...\n";
    $sock = new sockets();
    $squid = new squidbee();
    if (!is_file($squidbin)) {
        $squidbin = $unix->find_program("squid3");
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid binary: `{$squidbin}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Conf..: `{$SQUID_CONFIG_PATH}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid php...: `{$php5}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid nohup.: `{$nohup}`\n";
    $DenySquidWriteConf = $sock->GET_INFO("DenySquidWriteConf");
    if (!is_numeric($DenySquidWriteConf)) {
        $DenySquidWriteConf = 0;
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking `DenySquidWriteConf` = {$DenySquidWriteConf}\n";
    @copy("/etc/artica-postfix/settings/Daemons/SquidNudityScanParams", "/etc/squid3/SquidNudityScanParams");
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking `NudeBooster`\n";
    build_progress("{reconfigure} Nude booster", 49);
    NudeBooster();
    if (!is_dir("/usr/share/squid-langpack")) {
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Templates from MySQL\n";
        $unix->THREAD_COMMAND_SET("{$php5} " . __FILE__ . " --tpl-save");
    }
    $EnableRemoteStatisticsAppliance = 0;
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Build blocked Websites list...\n";
    build_progress("{reconfigure} Whitelisted browsers", 50);
    acl_whitelisted_browsers();
    build_progress("{reconfigure} allowed browsers", 51);
    acl_allowed_browsers();
    echo "Starting......: " . date("H:i:s") . " Checking wrapzap\n";
    build_progress("{reconfigure} wrapzap", 52);
    wrapzap();
    build_progress("{reconfigure} Mime.conf", 53);
    mime_conf();
    build_progress("{reconfigure} Blocked websites", 54);
    $squid->BuildBlockedSites();
    build_progress("{reconfigure} FTP clients ACLs", 55);
    acl_clients_ftp();
    build_progress("{reconfigure} Dynamic rules caches", 56);
    echo "Starting......: " . date("H:i:s") . " [SYS]: Dynamic rules caches...\n";
    dyn_caches();
    build_progress("{reconfigure} Webfiltering whitelisted", 57);
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Build url_rewrite_access deny...\n";
    urlrewriteaccessdeny();
    echo "Starting......: " . date("H:i:s") . " [SYS]:Squid building main configuration done\n";
    if ($GLOBALS["NOAPPLY"]) {
        $DenySquidWriteConf = 0;
    }
    if ($DenySquidWriteConf == 0) {
        @mkdir("/tmp", 0755, true);
        $squid->CURRENT_PROGRESS = 79;
        $squid->MAX_PROGRESS = 79;
        $conf = $squid->BuildSquidConf();
        $conf = str_replace("\n\n", "\n", $conf);
        build_progress("{writing_configuration}", 79);
        @file_put_contents("/tmp/squid.conf", $conf);
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Check validity of the configuration file with /tmp/squid.conf...\n";
        $GLOBALS["SQUID_PATTERN_ERROR"] = array();
        CheckConfig("/tmp/squid.conf");
        if (count($GLOBALS["SQUID_PATTERN_ERROR"]) > 0) {
            echo "Starting......: " . date("H:i:s") . " [SYS]: Some errors are detected and cleaned\n";
            squid_admin_mysql(1, "Some errors has been detected in settings", "Please check theses values:\n" . @implode("\n", $GLOBALS["SQUID_PATTERN_ERROR"]));
            $conf = @file_get_contents("/tmp/squid.conf");
        }
        exec("{$squidbin} -f /tmp/squid.conf -k parse 2>&1", $results);
        while (list($index, $ligne) = each($results)) {
            if (strpos($ligne, "| WARNING:") > 0) {
                continue;
            }
            if (preg_match("#ERROR: Failed#", $ligne)) {
                build_progress("{operation_failed} !!!", 110);
                echo "Starting......: " . date("H:i:s") . " [SYS]: Squid `{$ligne}`, aborting configuration, keep the old one...\n";
                echo "<div style='font-size:16px;font-weight:bold;color:#E71010'>{$ligne}</div>";
                $sock->TOP_NOTIFY("{$ligne}", "error");
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.squid.php

示例3: ApplyConfig

function ApplyConfig($smooth = false)
{
    if (function_exists("WriteToSyslogMail")) {
        WriteToSyslogMail("Invoke ApplyConfig function", basename(__FILE__));
    }
    $unix = new unix();
    $ulimit = $unix->find_program("ulimit");
    if (is_file($ulimit)) {
        shell_exec("{$ulimit} -HSd unlimited");
    } else {
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid ulimit no such binary...\n";
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid apply kernel settings\n";
    build_progress("{reconfigure} Kernel values", 46);
    kernel_values();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid apply Checks security limits\n";
    build_progress("{reconfigure} Security limits", 47);
    security_limit();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Remote appliances...\n";
    build_progress("{reconfigure} checks remote appliances", 48);
    remote_appliance_restore_tables();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Remote appliances done...\n";
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $squidbin = $unix->find_program("squid");
    $SQUID_CONFIG_PATH = $unix->SQUID_CONFIG_PATH();
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid loading libraires...\n";
    $sock = new sockets();
    $squid = new squidbee();
    if (!is_file($squidbin)) {
        $squidbin = $unix->find_program("squid3");
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid binary: `{$squidbin}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Conf..: `{$SQUID_CONFIG_PATH}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid php...: `{$php5}`\n";
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid nohup.: `{$nohup}`\n";
    $DenySquidWriteConf = $sock->GET_INFO("DenySquidWriteConf");
    if (!is_numeric($DenySquidWriteConf)) {
        $DenySquidWriteConf = 0;
    }
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking `DenySquidWriteConf` = {$DenySquidWriteConf}\n";
    @copy("/etc/artica-postfix/settings/Daemons/SquidNudityScanParams", "/etc/squid3/SquidNudityScanParams");
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking `NudeBooster`\n";
    build_progress("{reconfigure} Nude booster", 49);
    NudeBooster();
    if (!is_dir("/usr/share/squid-langpack")) {
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Checking Templates from MySQL\n";
        $unix->THREAD_COMMAND_SET("{$php5} " . __FILE__ . " --tpl-save");
    }
    $EnableRemoteStatisticsAppliance = 0;
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Build blocked Websites list...\n";
    if (!is_dir("/etc/squid3/artica-meta")) {
        @mkdir("/etc/squid3/artica-meta", 0755, true);
    }
    if (!is_file("/etc/squid3/artica-meta/whitelist-net.db")) {
        @touch("/etc/squid3/artica-meta/whitelist-net.db");
    }
    if (!is_file("/etc/squid3/artica-meta/whitelist-domains.db")) {
        @touch("/etc/squid3/artica-meta/whitelist-domains.db");
    }
    build_progress("{reconfigure} Whitelisted browsers", 50);
    acl_whitelisted_browsers();
    build_progress("{reconfigure} allowed browsers", 51);
    acl_allowed_browsers();
    echo "Starting......: " . date("H:i:s") . " Checking wrapzap\n";
    build_progress("{reconfigure} wrapzap", 52);
    wrapzap();
    build_progress("{reconfigure} Mime.conf", 53);
    mime_conf();
    build_progress("{reconfigure} Blocked websites", 54);
    $squid->BuildBlockedSites();
    build_progress("{reconfigure} FTP clients ACLs", 55);
    acl_clients_ftp();
    build_progress("{checking_wccp_mode}", 55);
    system("{$php5} /usr/share/artica-postfix/exec.squid.wccp.php --squid");
    build_progress("{reconfigure} Dynamic rules caches", 56);
    echo "Starting......: " . date("H:i:s") . " [SYS]: Dynamic rules caches...\n";
    dyn_caches();
    build_progress("{reconfigure} Webfiltering whitelisted", 57);
    echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Build url_rewrite_access deny...\n";
    urlrewriteaccessdeny();
    echo "Starting......: " . date("H:i:s") . " [SYS]:Squid building main configuration done\n";
    build_progress("{reconfigure} Check files and security", 58);
    CheckFilesAndSecurity();
    $tar = $unix->find_program("tar");
    if ($GLOBALS["NOAPPLY"]) {
        $DenySquidWriteConf = 0;
    }
    if ($DenySquidWriteConf == 0) {
        @mkdir("/tmp", 0755, true);
        $squid->CURRENT_PROGRESS = 79;
        $squid->MAX_PROGRESS = 79;
        $conf = $squid->BuildSquidConf();
        $conf = str_replace("\n\n", "\n", $conf);
        build_progress("{writing_configuration}", 79);
        @file_put_contents("/tmp/squid.conf", $conf);
        echo "Starting......: " . date("H:i:s") . " [SYS]: Squid Check validity of the configuration file with /tmp/squid.conf...\n";
        $GLOBALS["SQUID_PATTERN_ERROR"] = array();
        $squid_checks = new squid_checks("/tmp/squid.conf");
        if (!$squid_checks->squid_parse()) {
//.........这里部分代码省略.........
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:exec.squid.php


注:本文中的squidbee::BuildBlockedSites方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。