本文整理汇总了PHP中mysql_squid_builder::CreateCategoryUrisTable方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::CreateCategoryUrisTable方法的具体用法?PHP mysql_squid_builder::CreateCategoryUrisTable怎么用?PHP mysql_squid_builder::CreateCategoryUrisTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_squid_builder
的用法示例。
在下文中一共展示了mysql_squid_builder::CreateCategoryUrisTable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xstart
function xstart()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
return;
}
$TimeExec = $unix->file_time_min($pidtime);
if ($TimeExec < 360) {
return;
}
@unlink($pidtime);
@file_put_contents($pidtime, time());
@file_put_contents($pidfile, getmypid());
$php5 = $unix->LOCATE_PHP5_BIN();
$q = new mysql_squid_builder();
$q->CreateCategoryUrisTable("malware");
$COUNT1 = $q->COUNT_ROWS("categoryuris_malware");
vxvault();
malwareurls_joxeankoret();
clean_mx_de();
$COUNT2 = $q->COUNT_ROWS("categoryuris_malware");
$URLS_ADDED = $COUNT2 - $COUNT1;
if ($URLS_ADDED > 0) {
system("{$php5} /usr/share/artica-postfix/exec.squidguard.php --compile-category malware");
squid_admin_mysql(2, "{$URLS_ADDED} malware URLs added", null, __FILE__, __LINE__);
}
}
示例2: updatev2_adblock
//.........这里部分代码省略.........
// ufdbguard_admin_events("UFDB::Fatal: $malwaregzip failed to download $curl->error",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
if ($GLOBALS["VERBOSE"]) {
echo "{$malwaregzip} failed to download {$curl->error}\n";
}
@unlink($malwaregzip);
}
@unlink($phishgzip);
$curl = new ccurl("{$GLOBALS["MIRROR"]}/categoryuris_phishing.gz");
if (!$curl->GetFile($phishgzip)) {
// ufdbguard_admin_events("UFDB::Fatal: $phishgzip failed to download $curl->error",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
if ($GLOBALS["VERBOSE"]) {
echo "{$phishgzip} failed to download {$curl->error}\n";
}
@unlink($phishgzip);
}
$mdfile1 = md5_file($pubfinal);
if ($GLOBALS["VERBOSE"]) {
echo "{$pubfinal}({$mdfile1})\n";
}
if (is_file($pubgzip)) {
$unix->uncompress($pubgzip, $pubfinal);
$mdfile2 = md5_file($pubfinal);
if ($GLOBALS["VERBOSE"]) {
echo "{$pubfinal}({$mdfile2})\n";
}
if ($mdfile2 != $mdfile1) {
$reload = true;
}
} else {
if ($GLOBALS["VERBOSE"]) {
echo "{$pubgzip} no such file\n";
}
}
$mdfile1 = md5_file($trackerfinal);
if ($GLOBALS["VERBOSE"]) {
echo "{$trackerfinal} -1- ({$mdfile1})\n";
}
if (is_file($trackergzip)) {
$unix->uncompress($trackergzip, $trackerfinal);
$mdfile2 = md5_file($trackerfinal);
if ($GLOBALS["VERBOSE"]) {
echo "{$trackerfinal} -2- ({$mdfile2})\n";
}
if ($mdfile1 != $mdfile2) {
$reload = true;
}
} else {
if ($GLOBALS["VERBOSE"]) {
echo "{$trackergzip} no such file\n";
}
}
if (is_file($malwaregzip)) {
$uris = array();
$q = new mysql_squid_builder();
$unix->uncompress($malwaregzip, $malwarecsv);
$handle = @fopen($malwarecsv, "r");
$q->CreateCategoryUrisTable("malware");
if ($handle) {
$line = @fgets($handle);
$line = trim($line);
if ($line == null) {
continue;
}
$md5 = md5($line);
$date = date("Y-m-d H:i:s");
$url = mysql_escape_string2($line);
$uris[] = "('{$md5}','{$date}','{$url}',1)";
}
if (count($uris) > 0) {
$sql = "INSERT IGNORE INTO categoryuris_malware\n\t\t\t(zmd5,zDate,pattern,enabled) VALUES " . @implode(",", $uris);
$q->QUERY_SQL($sql);
}
}
if (is_file($phishgzip)) {
$uris = array();
$q = new mysql_squid_builder();
$unix->uncompress($phishgzip, $phishcsv);
$handle = @fopen($phishcsv, "r");
$q->CreateCategoryUrisTable("phishing");
if ($handle) {
$line = @fgets($handle);
$line = trim($line);
if ($line == null) {
continue;
}
$md5 = md5($line);
$date = date("Y-m-d H:i:s");
$url = mysql_escape_string2($line);
$uris[] = "('{$md5}','{$date}','{$url}',1)";
}
if (count($uris) > 0) {
$sql = "INSERT IGNORE INTO categoryuris_phishing\n\t\t\t(zmd5,zDate,pattern,enabled) VALUES " . @implode(",", $uris);
$q->QUERY_SQL($sql);
}
}
if ($reload) {
squid_admin_mysql(2, "Ask to reload the Web filtering service", "");
shell_exec("/etc/init.d/ufdb reload");
}
}
示例3: query
function query(){
$category=null;
$tpl=new templates();
$also=$tpl->_ENGINE_parse_body("{also}");
$MyPage=CurrentPageName();
$q=new mysql_squid_builder();
$nowebsites=$tpl->_ENGINE_parse_body("{no_saved_web_site_catz}");
writelogs("Category:$category",__FUNCTION__,__FILE__,__LINE__);
if($category==null){if($_GET["category"]<>null){$category=$_GET["category"];}}
if($category==null){if($_POST["qtype"]<>null){$category=$_POST["qtype"];}}
if($_POST["query"]<>null){if($_GET["website"]<>null){$_POST["query"]=$_GET["website"];}}
if($category==null){json_error_show("Please select a category first");}
if($_POST["sortname"]=="sitename"){$_POST["sortname"]="zDate";$_POST["sortorder"]="desc";}
writelogs("Category:$category",__FUNCTION__,__FILE__,__LINE__);
$table="categoryuris_".$q->category_transform_name($category);
$CategoriesCheckRightsWrite=CategoriesCheckRightsWrite();
$q->CreateCategoryUrisTable(null,$table);
$search='%';
$page=1;
$COUNT_ROWS=$q->COUNT_ROWS($table);
if($COUNT_ROWS==0){json_error_show("no data",1);}
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){
$sql="SELECT COUNT(zmd5) as TCOUNT FROM `$table` WHERE 1 $searchstring";
$ligne=mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup"));
$total = $ligne["TCOUNT"];
}else{
$total = $q->COUNT_ROWS($table);
}
if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
$pageStart = ($page-1)*$rp;
$limitSql = "LIMIT $pageStart, $rp";
$sql="SELECT zDate,zmd5,pattern,enabled FROM `$table` WHERE 1 $searchstring $ORDER $limitSql";
$results = $q->QUERY_SQL($sql);
if(!$q->ok){json_error_show($q->mysql_error,1);}
if(mysql_num_rows($results)==0){json_error_show("$nowebsites",1);}
$disabled_text=$tpl->_ENGINE_parse_body("{disabled}");
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
while ($ligne = mysql_fetch_assoc($results)) {
$delete=imgtootltip("delete-24.png","{delete}","DeleteCategorizedURI('{$ligne["zmd5"]}','$table')");
$enabled=$ligne["enabled"];
$color="color:black";
if($enabled==0){
$color="color:#B6ACAC";
$added=$added."<div><i style='font-size:11px'>$disabled_text</i></div>";
$moveAll=" ";
$move=" ";
}
$jscat="<a href=\"javascript:blur();\"
OnClick=\"javascript:Loadjs('squid.categorize.php?www={$ligne["pattern"]}');\"
style='font-size:14px;text-decoration:underline;$color'>";
if(!$CategoriesCheckRightsWrite){
$jscat=null;
$delete=null;
}
$data['rows'][] = array(
'id' => $ligne['zmd5'],
'cell' => array("
<span style='font-size:14px;$color'>{$ligne['zDate']}</span>",
"<span style='font-size:14px;$color'>$jscat{$ligne['pattern']}</a></span>$added",$delete)
);
}
echo json_encode($data);
}