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


PHP mysql_squid_builder::CheckTablesICAP方法代码示例

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


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

示例1: CICAPEnableSquidGuardSave

function CICAPEnableSquidGuardSave()
{
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $q->CheckTablesICAP();
    $sock->SET_INFO("CICAPEnableSquidGuard", $_POST["CICAPEnableSquidGuard"]);
    if ($_POST["CICAPEnableSquidGuard"] == 1) {
        $q->QUERY_SQL("UPDATE c_icap_services SET enabled=1,zOrder=3 WHERE ID=12");
    } else {
        $q->QUERY_SQL("UPDATE c_icap_services SET enabled=0 WHERE ID=12");
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:12,代码来源:c-icap.rules.php

示例2: CicapEnabled

function CicapEnabled()
{
    $sock = new sockets();
    $q = new mysql_squid_builder();
    $q->CheckTablesICAP();
    $EnableClamavInCiCap = $sock->GET_INFO("EnableClamavInCiCap");
    if (!is_numeric($EnableClamavInCiCap)) {
        $EnableClamavInCiCap = 1;
    }
    if ($_POST["CicapEnabled"] == 1) {
        if ($EnableClamavInCiCap == 1) {
            $q->QUERY_SQL("UPDATE c_icap_services SET enabled=1,zOrder=1 WHERE ID=1");
            $q->QUERY_SQL("UPDATE c_icap_services SET enabled=1,zOrder=2 WHERE ID=2");
        }
    } else {
        $q->QUERY_SQL("UPDATE c_icap_services SET enabled=0 WHERE ID=1");
        $q->QUERY_SQL("UPDATE c_icap_services SET enabled=0 WHERE ID=2");
    }
    $sock->SET_INFO("CicapEnabled", $_POST["CicapEnabled"]);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:20,代码来源:c-icap.index.php

示例3: enable_icap

function enable_icap()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        echo basename(__FILE__) . ":Already executed pid {$pid}.. aborting the process\n";
        progress("{failed}", 110);
        return;
    }
    $sock = new sockets();
    $sock->SET_INFO("kavicapserverEnabled", 1);
    $MEM = $unix->MEM_TOTAL_INSTALLEE();
    if ($unix->MEM_TOTAL_INSTALLEE() < 624288) {
        $sock->SET_INFO("kavicapserverEnabled", 0);
        if ($GLOBALS["OUTPUT"]) {
            echo "Not enough memory - {$MEM}\n";
        }
        progress("{failed}", 110);
        return;
    }
    $q = new mysql_squid_builder();
    progress("{verify_icap_center}", 10);
    $q->CheckTablesICAP();
    if ($q->COUNT_ROWS("c_icap_services") == 0) {
        progress("{verify_icap_center} {failed}", 110);
    }
    progress("{hooking_local_service}", 10);
    $q->QUERY_SQL("UPDATE c_icap_services SET `enabled`=1 WHERE ID=6");
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
        progress("{hooking_local_service} {failed}", 110);
    }
    $q->QUERY_SQL("UPDATE c_icap_services SET `enabled`=1 WHERE ID=5");
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
        progress("{hooking_local_service} {failed}", 110);
    }
    progress("{reloading} {APP_KAV4PROXY}", 20);
    build();
    system("/etc/init.d/kav4proxy reload");
    progress("{configuring} {APP_SQUID}", 50);
    $php = $unix->LOCATE_PHP5_BIN();
    system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force --noverifcaches");
    progress("{restarting} {APP_SQUID}", 70);
    system("/etc/init.d/squid restart --force {$GLOBALS["SCRIPT_SUFFIX"]}");
    progress("{restarting} Artica-status", 80);
    system("/etc/init.d/artica-status restart --force");
    progress("{refresh} License", 90);
    $GLOBALS["FORCE"] = true;
    license_infos(true);
    progress("{success} {hooking_local_service}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:53,代码来源:exec.kav4proxy.php

示例4: search

function search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $STATUS_ARRAY[0] = "32-green-grey.png";
    $STATUS_ARRAY[1] = "32-green.png";
    $STATUS_ARRAY[2] = "32-red.png";
    $STATUS_ARRAY[3] = "warning32.png";
    $t = $_GET["t"];
    $search = '%';
    $table = "c_icap_services";
    $page = 1;
    $FORCE_FILTER = 1;
    $total = 0;
    if (isset($_GET["OnlyActive"])) {
        if ($_GET["OnlyActive"] == 1) {
            $FORCE_FILTER = "`enabled`=1";
        }
    }
    $q->CheckTablesICAP();
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $searchstring = string_to_flexquery();
    if ($searchstring != null) {
        $search = $_POST["query"];
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE_FILTER}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM `{$table}` WHERE {$FORCE_FILTER} {$searchstring}  {$ORDER} {$limitSql}";
    $results = $q->QUERY_SQL($sql);
    writelogs($sql . " ==> " . mysql_num_rows($results) . " items", __FUNCTION__, __FILE__, __LINE__);
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total + 1;
    $data['rows'] = array();
    if (!$q->ok) {
        json_error_show($q->mysql_error, 1);
    }
    $fontsize = 22;
    while ($ligne = mysql_fetch_assoc($results)) {
        $CountDeMembers = 0;
        $color = "black";
        if ($ligne["enabled"] == 0) {
            $color = "#8a8a8a";
        }
        $style = "style='font-size:{$fontsize}px;color:{$color};'";
        $delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?service-delete-js=yes&ID={$ligne["ID"]}&t={$t}');");
        $bypass = "&nbsp;";
        $js = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?service-js=yes&ID={$ligne["ID"]}&t={$t}');\"\n\t\tstyle='font-size:{$fontsize}px;color:{$color};text-decoration:underline'>";
        if ($ligne["ID"] < 20) {
            $delete = "&nbsp;";
        }
        $up = imgsimple("arrow-up-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=0&t={$_GET["t"]}')");
        $down = imgsimple("arrow-down-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=1&t={$_GET["t"]}')");
        if (intval($ligne["bypass"]) > 0) {
            $ligne["bypass"] = 1;
        }
        if ($ligne["bypass"] == 1) {
            $bypass = "<img src=img/32-green.png>";
        }
        $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span {$style}>{$js}{$ligne["zOrder"]}</a></span>", "<span {$style}>{$js}{$ligne["service_name"]}</a></span>", "<span {$style}>{$js}{$ligne["ipaddr"]}:{$ligne["listenport"]}</span>", "<span {$style}>{$js}{$ligne["respmod"]}</span>", "<center {$style}>{$js}{$bypass}</center>", "<center {$style}>{$up}</center>", "<center {$style}>{$down}</center>", "<center {$style}>{$delete}</center>", "<center {$style}>" . imgsimple($STATUS_ARRAY[$ligne["status"]]) . "</center>"));
    }
    echo json_encode($data);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:84,代码来源:icap-center.php

示例5: C_ICAP_CLIENTS

function C_ICAP_CLIENTS($aspid = false)
{
    $unix = new unix();
    $PidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if (!$aspid) {
        $pid = $unix->get_pid_from_file($PidFile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $TimeMin = $unix->PROCCESS_TIME_MIN($pid);
            return;
        }
    }
    @file_put_contents($PidFile, getmypid());
    $cicap_client = $unix->find_program("c-icap-client");
    if (!is_file($cicap_client)) {
        return;
    }
    $q = new mysql_squid_builder();
    $q->QUERY_SQL("UPDATE c_icap_services SET `status`=0 WHERE `enabled`=0");
    $q->CheckTablesICAP();
    $sql = "SELECT * FROM c_icap_services WHERE enabled=1";
    $results = $q->QUERY_SQL($sql);
    if (mysql_num_rows($results) == 0) {
        return;
    }
    $METHODS["reqmod_precache"] = "REQMOD";
    $METHODS["respmod_precache"] = "RESPMOD";
    while ($ligne = mysql_fetch_assoc($results)) {
        $service_name_text = $ligne["service_name"];
        $ID = $ligne["ID"];
        $addr = $ligne["ipaddr"];
        $port = $ligne["listenport"];
        $service = $ligne["icap_server"];
        $cmdline = "{$cicap_client} -i {$addr} -p {$port} -s {$service} -method {$METHODS[$ligne["respmod"]]} 2>&1";
        if ($GLOBALS["VERBOSE"]) {
            echo $cmdline . "\n";
        }
        $Mresults = array();
        $FINAL = true;
        exec($cmdline, $Mresults);
        echo @implode("\n", $Mresults);
        $HEADER_LOG = "{$addr}:{$port}/{$service} ({$METHODS[$ligne["respmod"]]})";
        $FOUND = false;
        while (list($index, $line) = each($Mresults)) {
            if (preg_match("#200 OK#i", $line)) {
                $FINAL = true;
                $FOUND = true;
                break;
            }
            if (preg_match("#404 Service not found#i", $line)) {
                $FINAL = false;
                $FOUND = true;
                break;
            }
            if (preg_match("#Failed to connect#i", $line)) {
                $FINAL = false;
                $FOUND = true;
                break;
            }
        }
        if (!$FOUND) {
            squid_admin_mysql(1, "Unknown ICAP {$service} for {$HEADER_LOG}", @implode("\n", $Mresults), __FILE__, __LINE__);
            $q->QUERY_SQL("UPDATE c_icap_services SET `status`=3 WHERE ID={$ID}");
            continue;
        }
        if (!$FINAL) {
            squid_admin_mysql(0, "ICAP {$service} FAILED for {$HEADER_LOG}", @implode("\n", $Mresults), __FILE__, __LINE__);
            $q->QUERY_SQL("UPDATE c_icap_services SET `status`=2 WHERE ID={$ID}");
            continue;
        }
        $q->QUERY_SQL("UPDATE c_icap_services SET `status`=1 WHERE ID={$ID}");
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:72,代码来源:exec.squid.watchdog.php

示例6: checkdatabase

function checkdatabase()
{
    $f["webfilter_aclsdynamic"] = true;
    $f["webfilter_aclsdynlogs"] = true;
    $f["webfilter_assoc_groups"] = true;
    $f["webfilter_avwhitedoms"] = true;
    $f["webfilter_bannedexts"] = true;
    $f["webfilter_bannedextsdoms"] = true;
    $f["webfilter_blkcnt"] = true;
    $f["webfilter_blkgp"] = true;
    $f["webfilter_blklnk"] = true;
    $f["webfilter_blks"] = true;
    $f["webfilter_certs"] = true;
    $f["webfilter_dnsbl"] = true;
    $f["webfilter_group"] = true;
    $f["webfilter_members"] = true;
    $f["webfilter_rules"] = true;
    $f["webfilter_terms"] = true;
    $f["webfilter_termsassoc"] = true;
    $f["webfilter_termsg"] = true;
    $f["webfilter_ufdbexpr"] = true;
    $f["webfilter_ufdbexprassoc"] = true;
    $f["webfilter_updateev"] = true;
    $f["webfilters_backupeddbs"] = true;
    $f["webfilters_bigcatzlogs"] = true;
    $f["webfilters_blkwhlts"] = true;
    $f["webfilters_categories_caches"] = true;
    $f["webfilters_databases_disk"] = true;
    $f["webfilters_dbstats"] = true;
    $f["webfilters_dtimes_blks"] = true;
    $f["webfilters_dtimes_rules"] = true;
    $f["webfilters_ipaddr"] = true;
    $f["webfilters_nodes"] = true;
    $f["webfilters_quotas"] = true;
    $f["webfilters_rewriteitems"] = true;
    $f["webfilters_rewriterules"] = true;
    $f["webfilters_schedules"] = true;
    $f["webfilters_sqaclaccess"] = true;
    $f["webfilters_sqacllinks"] = true;
    $f["webfilters_sqacls"] = true;
    $f["webfilters_sqaclsports"] = true;
    $f["webfilters_sqgroups"] = true;
    $f["webfilters_sqitems"] = true;
    $f["webfilters_sqtimes_assoc"] = true;
    $f["webfilters_sqtimes_rules"] = true;
    $f["webfilters_thumbnails"] = true;
    $f["webfilters_updates"] = true;
    $f["webfilters_usersasks"] = true;
    $f["websites_caches_params"] = true;
    $q = new mysql_squid_builder();
    if (!$q->TestingConnection()) {
        echo "Starting......: " . date("H:i:s") . " [MYSQL]: Connection failed...\n";
        return;
    }
    $build = false;
    while (list($tablename, $DGRULE) = each($f)) {
        if (!$q->TABLE_EXISTS($tablename)) {
            echo "Starting......: " . date("H:i:s") . " [MYSQL]: Missing table `{$tablename}`\n";
            $build = true;
        }
    }
    if ($build) {
        echo "Starting......: " . date("H:i:s") . " [MYSQL]: Construct database\n";
        $q->CheckTables(null, true);
        $q->CheckTablesICAP();
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:67,代码来源:exec.squid.php

示例7: checktables

function checktables()
{
    $q = new mysql_squid_builder();
    $q->CheckTables();
    $q->CheckTablesICAP();
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:6,代码来源:exec.squid-db.php


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