コード例 #1
0
function tests_mysql()
{
    $f = new external_categorize(null);
    echo $f->UBoxGoogleSafeBrowsingPhpGsbLookup("abu-farhan.com");
}
コード例 #2
0
 private function GET_CATEGORIES_K9($sitename)
 {
     if (strlen($GLOBALS["BlueCoatKey"]) == 0) {
         return null;
     }
     if (function_exists("debug_mem")) {
         debug_mem();
     }
     $this->cloudlogs("K9({$sitename})");
     $t = time();
     if (!class_exists("external_categorize")) {
         if (!is_file(dirname(__FILE__) . "/class.categorize.externals.inc")) {
             return;
         }
         include_once dirname(__FILE__) . "/class.categorize.externals.inc";
     }
     $ext = new external_categorize($sitename);
     if ($GLOBALS["VERBOSE"]) {
         $took = distanceOfTimeInWords($t, time(), true);
         echo "GET_CATEGORIES_K9({$sitename}) {$took}<br>\n";
     }
     return trim($ext->K9());
 }
コード例 #3
0
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;
        }
    }
}