本文整理汇总了PHP中mysql_squid_builder::categorize方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::categorize方法的具体用法?PHP mysql_squid_builder::categorize怎么用?PHP mysql_squid_builder::categorize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_squid_builder
的用法示例。
在下文中一共展示了mysql_squid_builder::categorize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: inject
//.........这里部分代码省略.........
echo "FALSE: {$www}\n";
continue;
}
if (strpos($www, "'") > 0) {
echo "FALSE: {$www}\n";
continue;
}
if (strpos($www, "{") > 0) {
echo "FALSE: {$www}\n";
continue;
}
if (strpos($www, "(") > 0) {
echo "FALSE: {$www}\n";
continue;
}
if (strpos($www, ")") > 0) {
echo "FALSE: {$www}\n";
continue;
}
if (strpos($www, "%") > 0) {
echo "FALSE: {$www}\n";
continue;
}
$category2 = $catz->GET_CATEGORIES($www);
if ($category2 != null) {
if ($category2 == $category) {
continue;
}
$md5 = md5($category . $www);
if ($category == "porn") {
if ($category2 == "shopping") {
echo date("H:i:s") . " Remove {$www} from shopping and add it to {$category}\n";
$q->QUERY_SQL("DELETE FROM category_shopping WHERE `pattern`='{$www}'");
$q->categorize($www, $category, true);
continue;
}
if ($category2 == "hobby/arts") {
echo date("H:i:s") . " Remove {$www} from hobby/arts and add it to {$category}\n";
$q->QUERY_SQL("DELETE FROM category_hobby_arts WHERE `pattern`='{$www}'");
if (!$q->ok) {
echo "{$q->mysql_error}\n";
die;
}
$q->QUERY_SQL("INSERT IGNORE INTO category_porn (zmd5,zDate,category,pattern,uuid,enabled) VALUES('{$md5}',NOW(),'porn','{$www}','{$uuid}',1)");
if (!$q->ok) {
echo "{$q->mysql_error}\n";
die;
}
continue;
}
if ($category2 == "society") {
echo date("H:i:s") . " Remove {$www} from society and add it to {$category}\n";
$q->QUERY_SQL("DELETE FROM category_society WHERE `pattern`='{$www}'");
if (!$q->ok) {
echo "{$q->mysql_error}\n";
die;
}
$q->QUERY_SQL("INSERT IGNORE INTO category_porn (zmd5,zDate,category,pattern,uuid,enabled) VALUES('{$md5}',NOW(),'porn','{$www}','{$uuid}',1)");
if (!$q->ok) {
echo "{$q->mysql_error}\n";
die;
}
continue;
}
if ($category2 == "finance/realestate") {
echo date("H:i:s") . " Remove {$www} from finance/realestate and add it to {$category}\n";
示例2: websites_uid_not_categorised
function websites_uid_not_categorised($uid = null, $tablename = null, $aspid = false)
{
if (isset($GLOBALS["websites_uid_not_categorised_{$uid}"])) {
return;
}
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$uid}.pid";
if ($aspid) {
$pid = @file_get_contents($pidfile);
$myfile = basename(__FILE__);
if ($unix->process_exists($pid, $myfile)) {
ufdbguard_admin_events("Task already running PID: {$pid}, aborting current task", __FUNCTION__, __FILE__, __LINE__, "stats");
return;
}
}
$mypid = getmypid();
@file_put_contents($pidfile, $mypid);
$q = new mysql_squid_builder();
if ($uid != null) {
$uidtable = $q->uid_to_tablename($uid);
$tablename = "www_{$uidtable}";
}
if (!$q->FIELD_EXISTS($tablename, "category")) {
$q->QUERY_SQL("ALTER TABLE `{$tablename}` ADD `category` varchar(255), ADD INDEX (`category`)");
}
$sql = "SELECT familysite,`category` FROM `{$tablename}` GROUP BY familysite,`category` HAVING `category` IS NULL ";
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
if ($GLOBALS["VERBOSE"]) {
echo "############# ERROR #########\n{$q->mysql_error}\\Line:" . __LINE__ . "\n#############\n";
}
return false;
}
$c = 0;
$mysql_num_rows = mysql_num_rows($results);
if ($mysql_num_rows == 0) {
if ($GLOBALS["VERBOSE"]) {
echo "{$sql} (No rows)\n";
}
return true;
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$sitename = $ligne["familysite"];
$IpClass = new IP();
if ($IpClass->isValid($sitename)) {
if (isset($GLOBALS["IPCACHE"][$sitename])) {
$t = time();
$sitename = gethostbyaddr($sitename);
events("{$tablename}: {$ligne["familysite"]} -> {$sitename} " . $unix->distanceOfTimeInWords($t, time()) . " gethostbyaddr() LINE:" . __LINE__);
$GLOBALS["IPCACHE"][$sitename] = $sitename;
}
}
$category = $q->GET_CATEGORIES($sitename);
if ($IpClass->isValid($sitename)) {
if ($category == null) {
$category = "ipaddr";
}
$q->categorize($sitename, $category);
}
events("{$tablename}: {$ligne["familysite"]} -> {$sitename} [{$category}] LINE:" . __LINE__);
if (strlen($category) > 0) {
$category = mysql_escape_string2($category);
$ligne["familysite"] = mysql_escape_string2($ligne["familysite"]);
$sql = "UPDATE `{$tablename}` SET `category`='{$category}' WHERE familysite='{$ligne["familysite"]}'";
$q->QUERY_SQL($sql);
if (!$q->ok) {
ufdbguard_admin_events("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "stats");
return;
}
}
}
}
示例3: move_domain
function move_domain(){
$q=new mysql_squid_builder();
$domain=$_POST["move-domain"];
$table=$q->cat_totablename($_POST["from_cat"]);
$q->QUERY_SQL("DELETE FROM `$table` WHERE `pattern`='$domain'");
$q->categorize($domain, $_POST["to_cat"],true);
}
示例4: add_to_cat
function add_to_cat()
{
$q = new mysql_squid_builder();
$q->categorize($_POST["add-to-cat"], $_POST["category"], true);
}
示例5: save_category
function save_category()
{
if ($_GET["website"] == null) {
return;
}
$www = trim(strtolower(base64_decode($_GET["website"])));
if (preg_match("#^www\\.(.+?)\$#i", $www, $re)) {
$www = $re[1];
}
$category = $_GET["category"];
$q = new mysql_squid_builder();
$q->categorize($www, $category);
}
示例6: elephantlist_Redirected
function elephantlist_Redirected($data)
{
$CACHE = unserialize(@file_get_contents("/root/porn-cache.db"));
$q = new mysql_squid_builder();
if (preg_match_all("#elephantlist\\.com\\/tp\\/out\\.php\\?to=(.+?)&#is", $data, $re)) {
while (list($num, $ligne) = each($re[1])) {
$sitename = $ligne;
$familysite = $q->GetFamilySites($ligne);
if (!isset($CACHE[$sitename])) {
$q->categorize($sitename, "porn");
$CACHE[$sitename] = true;
}
if (!isset($CACHE[$familysite])) {
$q->categorize($familysite, "porn");
$CACHE[$familysite] = true;
}
$f[] = "http://{$sitename}";
}
} else {
echo "elephantlist_Redirected - nothing found\n";
return array();
}
@file_put_contents("/root/porn-cache.db", serialize($CACHE));
return $f;
}
示例7: import_translated
function import_translated()
{
$q = new mysql_squid_builder();
$MAINZ = unserialize(@file_get_contents("/root/translated"));
$translated_done = unserialize(@file_get_contents("/root/translated_done"));
$max = count($MAINZ);
$gg = new generic_categorize();
$i = 1;
while (list($www, $category) = each($MAINZ)) {
echo "{$i}/{$max} {$www} ";
$i++;
if (isset($translated_done[$www])) {
echo "\n";
continue;
}
$category_artica = $gg->GetCategories($www);
if ($category_artica != null) {
echo "-> ARTICA {$category_artica}\n";
$q->categorize($www, $category_artica);
$translated_done[$www] = true;
@file_put_contents("/root/translated_done", serialize($translated_done));
continue;
}
$category_artica = $q->GET_CATEGORIES($www, true, true, true, true);
if ($category_artica != null) {
echo "-> ARTICA {$category}<>{$category_artica}\n";
$translated_done[$www] = true;
@file_put_contents("/root/translated_done", serialize($translated_done));
continue;
}
echo "{$category}\n";
$q->categorize($www, $category);
$translated_done[$www] = true;
@file_put_contents("/root/translated_done", serialize($translated_done));
}
}
示例8: CATEGORIZE
function CATEGORIZE()
{
$category = $_POST["CATEGORIZE"];
$www = $_POST["WWW"];
$q = new mysql_squid_builder();
$q->categorize($www, $category);
$q->QUERY_SQL("DELETE FROM notcategorized WHERE sitename='{$www}'");
if (!$q->ok) {
echo $q->mysql_error;
}
}
示例9: UBoxGoogleSafeBrowsingGetCurl
if ($sitename == null) {
continue;
}
$category = UBoxGoogleSafeBrowsingGetCurl($sitename);
if ($category == null) {
echo "{$i}] {$sitename} -> NONE\n";
usleep(500);
$q->QUERY_SQL("UPDATE webtests SET SafeBrws=1 WHERE sitename='{$sitename}'");
continue;
}
if (strpos($category, "We're sorry")) {
echo "STOP!\n";
return;
}
echo "{$i}] {$sitename} -> {$category}\n";
$q->categorize($sitename, $category);
$q->QUERY_SQL("DELETE FROM webtests WHERE sitename='{$sitename}'");
}
function UBoxGoogleSafeBrowsingGetCurl($szUrl)
{
$f = new external_categorize(null);
return $f->UBoxGoogleSafeBrowsingPhpGsbLookup($szUrl);
$API_KEY = $GLOBALS["GoogleApiKey"];
$client = "artica";
$appver = "1.5.2";
$pver = "3.0";
$szPath = "https://sb-ssl.google.com/safebrowsing/api/lookup?client=" . $client . "&apikey=" . $API_KEY . "&appver=" . $appver . "&pver=" . $pver . "&url=" . $szUrl;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $szPath);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla");
示例10: trim
if ($familysite == $ligne["sitename"]) {
$familysite = null;
}
if ($GLOBALS["OUTPUT"]) {
echo "{$www} -> STAMP\n";
}
$q->QUERY_SQL("UPDATE webtests SET checked=1 WHERE sitename='{$ligne["sitename"]}'");
if ($GLOBALS["OUTPUT"]) {
echo "{$www} -> GET_CATEGORIES\n";
}
$articacats = trim($q->GET_CATEGORIES($ligne["sitename"], true, false));
if ($GLOBALS["OUTPUT"]) {
echo "{$ligne["sitename"]} -> \"{$articacats}\"\n";
}
if ($articacats != null) {
$q->categorize($ligne["sitename"], $articacats);
$unix->_syslog("{$percent}) {$ligne["sitename"]} = {$articacats}", __FILE__);
continue;
}
if ($familysite != null) {
$articacats = trim($q->GET_CATEGORIES($familysite, true, false));
if ($GLOBALS["OUTPUT"]) {
echo "{$ligne["sitename"]} {$familysite} -> {$articacats}\n";
}
if ($articacats != null) {
$q->categorize($ligne["sitename"], $articacats);
$unix->_syslog("{$percent}) {$ligne["sitename"]} = {$articacats}", __FILE__);
continue;
}
}
$ipaddr = gethostbyname($ligne["sitename"]);