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


PHP mysql_squid_builder::ADD_CATEGORYZED_WEBSITE方法代码示例

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


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

示例1: ffCatAdd

function ffCatAdd()
{
    $array = unserialize(base64_decode($_POST["ffCatAdd"]));
    if (!is_array($array)) {
        echo "Not an array....";
        return;
    }
    $sitename = $array[0];
    $categories = $array[1];
    if ($sitename == null) {
        echo "Sitename=null";
        return;
    }
    $q = new mysql_squid_builder();
    if (!$q->ADD_CATEGORYZED_WEBSITE($sitename, $categories)) {
        return;
    }
    $q->QUERY_SQL("DELETE FROM webtests WHERE sitename='{$sitename}'");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:19,代码来源:squid.test.categories.php

示例2: CheckWebsites

function CheckWebsites($data, $category)
{
    $founds = array();
    if (!preg_match_all("#Domain:(.*?)<#s", $data, $founds)) {
        echo "NO MATCH scan 1.....\n";
    }
    $count = count($founds[1]);
    if ($count == 0) {
        if (!preg_match_all("#Name:(.*?)<#s", $data, $founds)) {
            echo "NO MATCH scan 2.....\n";
        }
    }
    $count = count($founds[1]);
    if ($count == 0) {
        return;
    }
    echo strlen($curl->data) . " bytes lenth...found: {$count} items\n";
    $q = new mysql_squid_builder();
    if ($count > 0) {
        while (list($id, $www) = each($founds[1])) {
            $www = trim($www);
            $www = str_replace("\t", "", $www);
            $www = str_replace(chr(194), "", $www);
            $www = str_replace(chr(32), "", $www);
            $www = str_replace(chr(160), "", $www);
            if (!preg_match("#([a-z0-9\\-_\\.]+)\\.([a-z]+)\$#i", $www, $re)) {
                echo "{$www} skiped L." . __LINE__ . "\n";
                continue;
            }
            if (strpos($www, ",") > 0) {
                echo "{$www} skiped L." . __LINE__ . "\n";
                continue;
            }
            if (strpos($www, " ") > 0) {
                echo "{$www} skiped L." . __LINE__ . "\n";
                continue;
            }
            if (strpos($www, ":") > 0) {
                echo "{$www} skiped L." . __LINE__ . "\n";
                continue;
            }
            if (strpos($www, "%") > 0) {
                echo "{$www} skiped L." . __LINE__ . "\n";
                continue;
            }
            if (preg_match("#^www\\.(.+)#", $www, $re)) {
                $www = $re[1];
            }
            $articacats = trim($q->GET_CATEGORIES($www, true, true));
            if ($articacats != null) {
                echo "\"{$www}\" already in {$articacats}\n";
            }
            $newsWeb[] = $www;
        }
    }
    while (list($id, $www) = each($newsWeb)) {
        echo "Adding \"{$www}\" -> {$category}\n";
        $q->ADD_CATEGORYZED_WEBSITE($www, $category);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:60,代码来源:exec.cacaweb.com.php

示例3: parseTemplate_unlock_save

function parseTemplate_unlock_save($noauth = false, $ARRAYCMD = array(), $noredirect = false)
{
    include_once dirname(__FILE__) . "/ressources/class.sockets.inc";
    include_once dirname(__FILE__) . "/ressources/class.mysql.squid.builder.php";
    include_once dirname(__FILE__) . "/ressources/class.tcpip.inc";
    include_once dirname(__FILE__) . "/ressources/class.templates.inc";
    $tpl = new templates();
    $cssform = "  -moz-border-radius: 5px;\n  border-radius: 5px;\n  border:1px solid #DDDDDD;\n  background:url(\"/img/gr-greybox.gif\") repeat-x scroll 0 0 #FBFBFA;\n  background:-moz-linear-gradient(center top , #F1F1F1 0px, #FFFFFF 45px) repeat scroll 0 0 transparent;\n  margin:5px;padding:5px;\n  -webkit-border-radius: 5px;\n  -o-border-radius: 5px;\n -moz-box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);\n -webkit-box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);\n box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);";
    if (!$noauth) {
        if (!parseTemplate_unlock_checkcred()) {
            parseTemplate_unlock("{wrong_password_or_username}");
            die;
        }
    }
    $ARRAY = unserialize(base64_decode($_REQUEST["serialize"]));
    $sock = new sockets();
    $sock->BuildTemplatesConfig($ARRAY);
    $q = new mysql_squid_builder();
    $finalhost = $_POST["finalhost"];
    $IPADDR = $_REQUEST["ipaddr"];
    $user = $_REQUEST["username"];
    $url = $_REQUEST["url"];
    $SquidGuardIPWeb = $_REQUEST["SquidGuardIPWeb"];
    if (count($ARRAYCMD) > 3) {
        $IPADDR = $ARRAY["IPADDR"];
        $user = $ARRAY["clientname"];
        $url = $ARRAY["URL"];
        $H = parse_url($url);
        $finalhost = $H["host"];
    }
    $MAX = intval($GLOBALS["UfdbGuardHTTP"]["UnbblockMaxTime"]);
    if (isset($ARRAY["RULE_MAX_TIME"])) {
        if (intval($ARRAY["RULE_MAX_TIME"]) > 0) {
            $MAX = $ARRAY["RULE_MAX_TIME"];
        }
    }
    $sql = "CREATE TABLE IF NOT EXISTS `squidlogs`.`ufdbunlock` (\n\t\t\t`md5` VARCHAR( 90 ) NOT NULL ,\n\t\t\t`logintime` BIGINT UNSIGNED ,\n\t\t\t`finaltime` INT UNSIGNED ,\n\t\t\t`uid` VARCHAR(128) NOT NULL,\n\t\t\t`MAC` VARCHAR( 90 ) NULL,\n\t\t\t`www` VARCHAR( 128 ) NOT NULL ,\n\t\t\t`ipaddr` VARCHAR( 128 ) ,\n\t\t\tPRIMARY KEY ( `md5` ) ,\n\t\t\tKEY `MAC` (`MAC`),\n\t\t\tKEY `logintime` (`logintime`),\n\t\t\tKEY `finaltime` (`finaltime`),\n\t\t\tKEY `uid` (`uid`),\n\t\t\tKEY `www` (`www`),\n\t\t\tKEY `ipaddr` (`ipaddr`)\n\t\t\t)  ENGINE = MEMORY;";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        parseTemplate_unlock($q->mysql_error);
        return;
    }
    if ($MAX == 0) {
        $MAX = 60;
    }
    $familysite = $q->GetFamilySites($finalhost);
    include_once dirname(__FILE__) . "/ressources/class.ufdb.parsetemplate.inc";
    $unlock = new parse_template_ufdb();
    $addTocategory = $unlock->parseTemplate_unlock_privs($ARRAY, "addTocat=1", null);
    if (!isset($ARRAY["RULE_MAX_TIME"])) {
        if (isset($GLOBALS["RULE_MAX_TIME"])) {
            if (intval($GLOBALS["RULE_MAX_TIME"]) > 0) {
                $MAX = $GLOBALS["RULE_MAX_TIME"];
            }
        }
    }
    $md5 = md5($finalhost . $IPADDR . $user);
    $time = time();
    $EnOfLife = strtotime("+{$MAX} minutes", $time);
    $NextLogs = $EnOfLife - $time;
    writelogs("{$finalhost} {$IPADDR} {$user} Alowed for {$MAX} minutes, EndofLife={$EnOfLife} in {$NextLogs} seconds", __FUNCTION__, __FILE__, __LINE__);
    $q->QUERY_SQL("INSERT IGNORE INTO `ufdbunlock` (`md5`,`logintime`,`finaltime`,`uid`,`www`,`ipaddr`)\n\t\t\tVALUES('{$md5}','{$time}','{$EnOfLife}','{$user}','{$familysite}','{$IPADDR}')");
    if (!$q->ok) {
        writelogs($q->mysql_error, __FUNCTION__, __FILE__, __LINE__);
        parseTemplate_unlock($q->mysql_error);
        return;
    }
    if ($addTocategory != null) {
        writelogs("Saving {$familysite}  into {$addTocategory}", __FUNCTION__, __FILE__, __LINE__);
        $q->ADD_CATEGORYZED_WEBSITE($familysite, $addTocategory);
    }
    $q->QUERY_SQL("INSERT IGNORE INTO webfilters_usersasks (zmd5,ipaddr,sitename,uid) \n\t\t\tVALUES ('{$md5}','{$IPADDR}','{$familysite}','{$user}')");
    $function = __FUNCTION__;
    $file = basename(__FILE__);
    $line = __LINE__;
    $subject = "Unlocked website {$finalhost}/{$familysite} from {$user}/{$IPADDR}";
    $redirect = "<META http-equiv=\"refresh\" content=\"10; URL={$url}?ufdbtime=" . time() . "\">";
    $redirecting_text = $tpl->javascript_parse_text("{redirecting}");
    $redirect_text = "{please_wait_redirecting_to}<br>{$url}<br><{for} {$MAX} {minutes}";
    if ($noredirect == true) {
        $redirect = null;
        $redirect_text = "{unlock}<br>{$url}<br><{for} {$MAX} {minutes}";
        $redirecting_text = $tpl->javascript_parse_text("{done}");
    }
    $MAIN_BODY = "<center>\n\t<div id='maincountdown' style='width:100%'>\n\t<center style='margin:20px;padding:20px;{$cssform};color:black;width:80%' >\n\t\t<input type='hidden' id='countdownvalue' value='10'>\n\t\t<span id='countdown' style='font-size:70px'></span>\n\t</center>\n\t</div>\n\t<p style='font-size:22px'>\n\t\t\t<center style='margin:50px;{$cssform};color:black;width:80%'>\n\t\t\t\t{$redirect_text}\n\t\t\t\t<center style='margin:20px;font-size:70px' id='wait_verybig_mini_red'>\n\t\t\t\t\t<img src='img/wait_verybig_mini_red.gif'>\n\t\t\t\t</center>\n\t\t\t</center>\n\t</p> \n\t</center>\n\t<script>\n\n\t\n \nsetInterval(function () {\n\tvar countdown = document.getElementById('countdownvalue').value\n\tcountdown=countdown-1;\n\tif(countdown==0){\n\t\tdocument.getElementById('countdownvalue').value=0;\n\t\tdocument.getElementById('wait_verybig_mini_red').innerHTML='{$redirecting_text}';\n\t\tdocument.getElementById('maincountdown').innerHTML='';\n\t\t\n\t\treturn;\n\t}\n\tdocument.getElementById('countdownvalue').value=countdown;\n\tdocument.getElementById('countdown').innerHTML=countdown\n \n}, 1000);\n</script>";
    $q = new mysql();
    $q->QUERY_SQL("INSERT IGNORE INTO `squid_admin_mysql`\n\t\t\t(`zDate`,`content`,`subject`,`function`,`filename`,`line`,`severity`,`hostname`) VALUES\n\t\t\t(NOW(),'','{$subject}','{$function}','{$file}','{$line}','1','{$_SERVER["SERVER_NAME"]}')", "artica_events");
    if (!$q->ok) {
        $redirect = null;
        $MAIN_BODY = "<center style='margin:20px;padding:20px;{$cssform};color:black;width:80%'>\n\t\t<H1>Oups!</H1><hr>" . $q->mysql_error_html() . "</center>";
    }
    if ($redirect != null) {
        $sock = new sockets();
        if ($GLOBALS["VERBOSE"]) {
            echo "<H1 style='color:white'>squid.php?reconfigure-unlock=yes</H1>";
        }
        $sock->getFrameWork("squid.php?reconfigure-unlock=yes");
    }
    if ($noredirect) {
        $sock = new sockets();
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.squidguard.php

示例4: bright

function bright()
{
    $q = new mysql_squid_builder();
    $sql = "SELECT sitename FROM webtests WHERE checked=0 ORDER BY sitename";
    $results = $q->QUERY_SQL("{$sql}");
    writelogs(mysql_num_rows($results) . " items for {$sql}", __FUNCTION__, __FILE__, __LINE__);
    $heristic = new generic_categorize();
    while ($ligne = mysql_fetch_assoc($results)) {
        $forcedelete = false;
        $www = $ligne["sitename"];
        if (strpos($www, ",") > 0) {
            $forcedelete = true;
        }
        if (strpos($www, " ") > 0) {
            $forcedelete = true;
        }
        if (strpos($www, ":") > 0) {
            $forcedelete = true;
        }
        if (strpos($www, "%") > 0) {
            $forcedelete = true;
        }
        if ($forcedelete) {
            $q->QUERY_SQL("DELETE FROM webtests WHERE sitename='{$www}'");
            continue;
        }
        $articacats = null;
        $ligne["sitename"] = trim(strtolower($ligne["sitename"]));
        $IPADDR = gethostbyname($ligne["sitename"]);
        if ($IPADDR == $ligne["sitename"]) {
            $q->categorize_reaffected($ligne["sitename"]);
            $q->QUERY_SQL("DELETE FROM webtests WHERE sitename='{$www}'");
            continue;
        }
        if (preg_match("#^www\\.(.+)#", $www, $re)) {
            $q->QUERY_SQL("DELETE FROM webtests WHERE sitename='{$www}'");
            $www = $re[1];
            $ligne["sitename"] = $www;
            $q->QUERY_SQL("INSERT IGNORE INTO webtests (sitename) ('{$re[1]}')");
        }
        $delete = false;
        writelogs("CHECK: {$ligne["sitename"]}", __FUNCTION__, __FILE__, __LINE__);
        $q->QUERY_SQL("UPDATE webtests SET checked=1 WHERE sitename='{$ligne["sitename"]}'");
        $category = $heristic->GetCategories($ligne["sitename"]);
        if ($category != null) {
            echo "{$ligne["sitename"]} -> {$category}\n";
            writelogs("SUCCESS: {$ligne["sitename"]} `{$category}` parse next", __FUNCTION__, __FILE__, __LINE__);
            $q->QUERY_SQL("DELETE FROM webtests WHERE sitename='{$ligne["sitename"]}'");
            $q->ADD_CATEGORYZED_WEBSITE($ligne["sitename"], $category);
            continue;
        }
        $f = new external_categorize($ligne["sitename"]);
        $category = $f->K9();
        if ($category != null) {
            echo "{$ligne["sitename"]} -> {$category}\n";
            writelogs("SUCCESS: {$ligne["sitename"]} `{$category}` parse next", __FUNCTION__, __FILE__, __LINE__);
            $q->QUERY_SQL("DELETE FROM webtests WHERE sitename='{$ligne["sitename"]}'");
            $q->ADD_CATEGORYZED_WEBSITE($ligne["sitename"], $category);
            continue;
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:62,代码来源:exec.squid.categorize-tests.php


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