function xstart() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid"; $timefile = "/etc/artica-postfix/pids/exec.ufdb.parse-categories.php.time"; $unix = new unix(); $me = basename(__FILE__); $pid = $unix->get_pid_from_file($pidfile); if (system_is_overloaded()) { die; } if ($unix->process_exists($pid, $me)) { if ($GLOBALS["VERBOSE"]) { echo " {$pid} --> Already executed.. aborting the process\n"; } $time = $unix->PROCCESS_TIME_MIN($pid); die; } @file_put_contents($pidfile, getmypid()); if ($unix->file_time_min($timefile) < 60) { return; } @unlink($timefile); @file_put_contents($timefile, time()); $q = new mysql_squid_builder(); $DirsArtica = $unix->dirdir("/var/lib/ufdbartica"); $sql = "CREATE TABLE IF NOT EXISTS `UPDATE_DBWF_INFOS` ( \n\t`category` varchar(90) NOT NULL, `size_artica` INT UNSIGNED NOT NULL, `date_artica` INT UNSIGNED NOT NULL, `count_artica` INT UNSIGNED NOT NULL, `size_tlse` INT UNSIGNED NOT NULL, `date_tlse` INT UNSIGNED NOT NULL, `count_tlse` INT UNSIGNED NOT NULL, `size_perso` INT UNSIGNED NOT NULL, `date_perso` INT UNSIGNED NOT NULL, `count_perso` INT UNSIGNED NOT NULL, PRIMARY KEY (`category`) \n\t\t\t) ENGINE=MYISAM;"; $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error; return; } $MAX = 144; $c = 0; $UFDB = array(); $UFDBCOUNT = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/ufdbcounts.txt"))); while (list($dir, $line) = each($DirsArtica)) { if (is_link($dir)) { continue; } $database_path = "{$dir}/domains.ufdb"; if (!is_file($database_path)) { continue; } $tablename = basename($dir); $size = @filesize("{$dir}/domains.ufdb"); $time = filemtime("{$dir}/domains.ufdb"); $cat = $q->tablename_tocat($tablename); $MAIN[$cat]["ART"]["SIZE"] = $size; $MAIN[$cat]["ART"]["TIME"] = $time; $MAIN[$cat]["ART"]["COUNT"] = $UFDBCOUNT[$tablename]; } $DirsArtica = $unix->dirdir("/var/lib/ftpunivtlse1fr"); while (list($dir, $line) = each($DirsArtica)) { $database_path = "{$dir}/domains.ufdb"; $sourcefile = "{$dir}/domains"; if (!is_file($database_path)) { continue; } $cat = basename($dir); $cat = $q->filaname_tocat($cat); $size = @filesize("{$dir}/domains.ufdb"); $time = filemtime("{$dir}/domains.ufdb"); $MAIN[$cat]["TLSE"]["SIZE"] = $size; $MAIN[$cat]["TLSE"]["TIME"] = $time; $MAIN[$cat]["TLSE"]["COUNT"] = $unix->COUNT_LINES_OF_FILE($sourcefile); if (system_is_overloaded()) { @unlink("{$timefile}"); die; } } $DirsArtica = $unix->dirdir("/var/lib/squidguard"); while (list($dir, $line) = each($DirsArtica)) { $database_path = "{$dir}/domains.ufdb"; if (!is_file($database_path)) { continue; } $tablename = "category_" . basename($dir); $cat = $q->tablename_tocat($tablename); $size = @filesize("{$dir}/domains.ufdb"); $time = filemtime("{$dir}/domains.ufdb"); $sourcefile = "{$dir}/domains"; $MAIN[$cat]["PERSO"]["SIZE"] = $size; $MAIN[$cat]["PERSO"]["PATH"] = $dir; $MAIN[$cat]["PERSO"]["CATEGORY"] = $cat; $MAIN[$cat]["PERSO"]["TIME"] = $time; $MAIN[$cat]["PERSO"]["COUNT"] = $unix->COUNT_LINES_OF_FILE($sourcefile); if (system_is_overloaded()) { @unlink("{$timefile}"); die; } } $prefix = "INSERT IGNORE INTO `UPDATE_DBWF_INFOS` (`category`,\n\t`size_artica` ,\n\t`date_artica` ,\n\t`count_artica` ,\n\n\t`size_tlse` ,\n\t`date_tlse` ,\n\t`count_tlse` ,\t\t\t\n\t\t\t\n\t`size_perso` ,\n\t`date_perso` ,\n\t`count_perso`) VALUES "; while (list($category, $MAINZ) = each($MAIN)) { $f[] = "('{$category}','{$MAINZ["ART"]["SIZE"]}','{$MAINZ["ART"]["TIME"]}','{$MAINZ["ART"]["COUNT"]}','{$MAINZ["TLSE"]["SIZE"]}','{$MAINZ["TLSE"]["TIME"]}','{$MAINZ["TLSE"]["COUNT"]}','{$MAINZ["PERSO"]["SIZE"]}','{$MAINZ["PERSO"]["TIME"]}','{$MAINZ["PERSO"]["COUNT"]}')"; } $q->QUERY_SQL("TRUNCATE TABLE `UPDATE_DBWF_INFOS`"); $sql = $prefix . @implode(",", $f); $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error . "\n{$sql}\n"; return; } }
function UFDBGUARD_COMPILE_ALL_CATEGORIES() { $sock = new sockets(); if (system_is_overloaded(basename(__FILE__))) { squid_admin_mysql(1, "Overloaded system: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting recompiling personal categories", null, __FILE__, __LINE__); die; } $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } $UseRemoteUfdbguardService = $sock->GET_INFO("UseRemoteUfdbguardService"); if (!is_numeric($UseRemoteUfdbguardService)) { $UseRemoteUfdbguardService = 0; } if ($EnableRemoteStatisticsAppliance == 1) { return; } if ($UseRemoteUfdbguardService == 1) { return; } if ($EnableRemoteStatisticsAppliance == 1) { return; } $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { return; } @file_put_contents($pidfile, getmypid()); $sock = new sockets(); $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } if ($EnableRemoteStatisticsAppliance == 1) { UFDBGUARD_DOWNLOAD_ALL_CATEGORIES(); return; } $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } $q = new mysql_squid_builder(); $t = time(); $cats = $q->LIST_TABLES_CATEGORIES(); $ufdb = new compile_ufdbguard(); while (list($table, $line) = each($cats)) { if (preg_match("#categoryuris_#", $table)) { continue; } $category = $q->tablename_tocat($table); if ($category == null) { squid_admin_mysql(1, "Compilation failed for table {$table}, unable to determine category", null, __FILE__, __LINE__); continue; } $ufdb->compile_category($category); } $ttook = $unix->distanceOfTimeInWords($t, time(), true); squid_admin_mysql(2, "All personal categories are compiled ({$ttook})", @implode("\n", $cats), __FILE__, __LINE__, "global-compile"); if ($EnableWebProxyStatsAppliance == 1) { CompressCategories(); return; } }
function statusDB_list() { $tpl = new templates(); $page = CurrentPageName(); $date = GetLastUpdateDate(); $q = new mysql_squid_builder(); $sql = "SELECT * FROM webfilters_updates WHERE updated=0"; $results = $q->QUERY_SQL($sql); $style = "style='font-size:14px;font-weight:bold'"; $html = "\n\t<div style='height:450px;width:100%;overflow:auto'>\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:99%'>\n<thead class='thead'>\n\t<tr>\n\t\t\n\t\t<th width=99%>{category}</th>\n\t\t<th width=1%>{zDate}</th>\n\t</tr>\n</thead>"; while ($ligne = mysql_fetch_assoc($results)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $ligne["tablename"] = $q->tablename_tocat($ligne["tablename"]); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=99% align='left' {$style}>{$ligne["tablename"]}</td>\n\t\t\t<td width=1% align='left' {$style} nowrap>{$ligne["zDate"]}</td>\n\t\t</tr>\n\t\t"; } $html = $html . "</table></div>"; echo $tpl->_ENGINE_parse_body($html); }
function ArticaWebFilter() { $STATUS = unserialize(@file_get_contents("/etc/artica-postfix/ARTICAUFDB_LAST_DOWNLOAD")); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_SIZE"] = trim(@file_get_contents("/etc/artica-postfix/CAT_ARTICA_DB_SIZE")); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_SINCE"] = $GLOBALS["CLASS_UNIX"]->distanceOfTimeInWords($STATUS["LAST_DOWNLOAD"]["TIME"], time()); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_LAST_CAT"] = $STATUS["LAST_DOWNLOAD"]["CATEGORY"]; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_LAST_SIZE"] = $STATUS["LAST_DOWNLOAD"]["SIZE"]; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_LAST_ERROR"] = $STATUS["LAST_DOWNLOAD"]["FAILED"]; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_LAST_CHECK"] = $STATUS["LAST_DOWNLOAD"]["LAST_CHECK"]; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_MAX"] = 145; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_COUNT"] = 0; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_PRC"] = 0; $REMOTE_CACHE = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/artica-webfilter-db-index.txt"))); $CATZ_ARRAY_FILE = CATZ_ARRAY(); if ($GLOBALS["VERBOSE"]) { echo "CATZ_ARRAY_FILE...{$CATZ_ARRAY_FILE}\n"; } $CATZ_ARRAY = unserialize(base64_decode(@file_get_contents(CATZ_ARRAY()))); $q = new mysql_squid_builder(); $GLOBALS["MAIN_ARRAY"]["ARTICA_DB_TIME"] = $CATZ_ARRAY["TIME"]; $CountDecategories = 0; while (list($table, $items) = each($CATZ_ARRAY)) { $CategoryName = $q->tablename_tocat($table); if (!is_file("/var/lib/ufdbartica/{$table}/domains.ufdb")) { if ($GLOBALS["VERBOSE"]) { echo "{$table} no such db\n"; } continue; } $items = intval($items); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICAT_ARRAY"][$CategoryName]["ITEMS"] = $items; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICAT_ARRAY"][$CategoryName]["SIZE"] = @filesize("/var/lib/ufdbartica/{$table}/domains.ufdb"); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICAT_ARRAY"][$CategoryName]["TIME"] = @filemtime("/var/lib/ufdbartica/{$table}/domains.ufdb"); $CountDecategories = $CountDecategories + $items; if ($GLOBALS["VERBOSE"]) { echo "{$table} - {$items} = {$CountDecategories}\n"; } } $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_ITEMS_NUM"] = $CountDecategories; $WORKDIR = "/var/lib/ufdbartica"; $MAX = count($REMOTE_CACHE); $c = 0; $prc = 0; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_MAX"] = $MAX; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_COUNT"] = 0; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_PRC"] = 0; while (list($tablename, $size) = each($REMOTE_CACHE)) { $destfile = "{$WORKDIR}/{$tablename}/domains.ufdb"; $size = @filesize($destfile); if ($size < 10) { continue; } $c++; $prc = intval($c) / intval($MAX); $prc = round($prc * 100); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_COUNT"] = $c; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_PRC"] = $prc; if ($GLOBALS["VERBOSE"]) { echo "ArticaWebFilter:: {$destfile} {$c} / {$MAX} = {$prc}% {$size}Bytes\n"; } } if ($GLOBALS["CLASS_UNIX"]->file_time_min("/etc/artica-postfix/CAT_ARTICA_DB_SIZE") > 60) { $CAT_ARTICA_DB_SIZE = $GLOBALS["CLASS_UNIX"]->DIRSIZE_KO("/var/lib/ufdbartica"); @unlink("/etc/artica-postfix/CAT_ARTICA_DB_SIZE"); @file_put_contents("/etc/artica-postfix/CAT_ARTICA_DB_SIZE", $CAT_ARTICA_DB_SIZE); } $STATUS = unserialize(@file_get_contents("/etc/artica-postfix/ARTICAUFDB_LAST_DOWNLOAD")); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_SIZE"] = trim(@file_get_contents("/etc/artica-postfix/CAT_ARTICA_DB_SIZE")); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_SINCE"] = $GLOBALS["CLASS_UNIX"]->distanceOfTimeInWords($STATUS["LAST_DOWNLOAD"]["TIME"], time()); $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_LAST_CAT"] = $STATUS["LAST_DOWNLOAD"]["CATEGORY"]; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_LAST_SIZE"] = $STATUS["LAST_DOWNLOAD"]["SIZE"]; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_LAST_ERROR"] = $STATUS["LAST_DOWNLOAD"]["FAILED"]; $GLOBALS["MAIN_ARRAY"]["CAT_ARTICA_LAST_CHECK"] = $STATUS["LAST_DOWNLOAD"]["LAST_CHECK"]; }
function statusDB_list() { $tpl = new templates(); $page = CurrentPageName(); $date = GetLastUpdateDate(); $q = new mysql_squid_builder(); $sql = "SELECT * FROM webfilters_updates WHERE updated=0"; $results = $q->QUERY_SQL($sql); $style = "style='font-size:14px;font-weight:bold'"; if ($_GET["from-ufdbguard"] == "yes") { echo $tpl->_ENGINE_parse_body("\n\t\t\t\t<div style='margin:15px;text-align:right'>\n\t\t\t\t" . button("{back_to_webfiltering}", "AnimateDiv('BodyContent');LoadAjax('BodyContent','dansguardian2.mainrules.php')", 18) . "\n\t\t\t\t</div>"); } $html = "\n\t<div style='height:450px;width:100%;overflow:auto'>\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:99%'>\n<thead class='thead'>\n\t<tr>\n\t\t\n\t\t<th width=99%>{category}</th>\n\t\t<th width=1%>{zDate}</th>\n\t</tr>\n</thead>"; while ($ligne = mysql_fetch_assoc($results)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $ligne["tablename"] = $q->tablename_tocat($ligne["tablename"]); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=99% align='left' {$style}>{$ligne["tablename"]}</td>\n\t\t\t<td width=1% align='left' {$style} nowrap>{$ligne["zDate"]}</td>\n\t\t</tr>\n\t\t"; } $html = $html . "</table></div>"; echo $tpl->_ENGINE_parse_body($html); }
function ufdb_categories_status() { $sock = new sockets(); $tpl = new templates(); $users = new usersMenus(); $ArticaDbCloud = unserialize(base64_decode($sock->GET_INFO("ArticaDbCloud"))); $TLSEDbCloud = unserialize(base64_decode($sock->GET_INFO("TLSEDbCloud"))); $CurrentArticaDbCloud = unserialize($sock->GET_INFO("CurrentArticaDbCloud")); $CurrentTLSEDbCloud = unserialize($sock->GET_INFO("CurrentTLSEDbCloud")); $ProductName = "Artica"; $ProductNamef = dirname(__FILE__) . "/ressources/templates/{$_COOKIE["artica-template"]}/ProducName.conf"; if (is_file($ProductNamef)) { $ProductName = trim(@file_get_contents($ProductNamef)); } $TIME = 0; while (list($table, $MAIN) = each($ArticaDbCloud)) { $xTIME = $MAIN["TIME"]; if ($xTIME > $TIME) { $TIME = $xTIME; } } $CURRENT_TIME = 0; while (list($table, $MAIN) = each($CurrentArticaDbCloud)) { $xTIME = $MAIN["TIME"]; if ($xTIME > $CURRENT_TIME) { $CURRENT_TIME = $xTIME; } } $TIME_TLSE = 0; while (list($table, $MAIN) = each($TLSEDbCloud)) { $xTIME = $MAIN["TIME"]; if ($xTIME > $TIME) { $TIME_TLSE = $xTIME; } } $CURRENT_TIME_TLSE = 0; while (list($table, $MAIN) = each($CurrentTLSEDbCloud)) { $xTIME = $MAIN["TIME"]; if ($xTIME > $CURRENT_TIME_TLSE) { $CURRENT_TIME_TLSE = $xTIME; } } $ARTICA_OFFICIAL_DB = $tpl->time_to_date($TIME, true); $ARTICA_CURRENT_DB = $tpl->time_to_date($CURRENT_TIME, true); $TLSE_OFFICIAL_DB = $tpl->time_to_date($TIME_TLSE, true); $TLSE_CURRENT_DB = $tpl->time_to_date($CURRENT_TIME_TLSE, true); reset($ArticaDbCloud); $q = new mysql_squid_builder(); $tablex[] = "\n\t<table style='widh:100%'>\n\t<tr>\n\t<th style='font-size:18px'>{category}</th>\n\t<th style='font-size:18px'>{items} ({$ProductName})</th>\n\t<th style='font-size:18px'>{status}</th>\n\t<th style='font-size:28px' nowrap> </th>\n\t<th style='font-size:18px'>{items} ({free_databases})</th>\n\t<th style='font-size:18px'>{status}</th>\n\t</tr>\t\t\n\t"; $color = ""; while (list($table, $MAIN) = each($ArticaDbCloud)) { $category = $q->tablename_tocat($table); if ($color == null) { $color = "#F2F0F1"; } else { $color = null; } $ROWS = FormatNumber($MAIN["ROWS"]); $ROWS_TLSE = FormatNumber($CurrentTLSEDbCloud[$category]["ROWS"]); $MD5SRC = $MAIN["MD5SRC"]; $TIME_OFF = $MAIN["TIME"]; $TIME_CUR = $CurrentArticaDbCloud[$table]["TIME"]; $TIME_OFF_TLSE = $TLSEDbCloud[$category]["TIME"]; $TIME_CUR_TLSE = $CurrentTLSEDbCloud[$category]["TIME"]; $icon = "ok32.png"; $icon_tlse = "ok32.png"; $errors = array(); $errors_text = null; $errors_tlse = array(); $errors_tlse_text = null; $TIME_UPDATED = intval($CurrentArticaDbCloud[$table]["UPDATED"]); $TIME_TLS_UPDATED = intval($CurrentTLSEDbCloud[$category]["UPDATED"]); if ($TIME_UPDATED == 0) { $icon = "warning32.png"; $errors[] = "<span style='color:#d32d2d'>{must_be_updated}</span>"; } if ($TIME_TLS_UPDATED == 0) { $icon_tlse = "warning32.png"; $errors_tlse[] = "<span style='color:#d32d2d'>{must_be_updated}</span>"; } $TIME_TLS_UPDATED_text = $tpl->time_to_date($TIME_TLS_UPDATED, true); $TIME_UPDATED_text = $tpl->time_to_date($TIME_UPDATED, true); $SUCCESS = $CurrentArticaDbCloud[$table]["SUCCESS"]; $SUCCESS_TLSE = $CurrentTLSEDbCloud[$category]["SUCCESS"]; $CUR_MD5SRC = $CurrentArticaDbCloud[$table]["MD5SRC"]; if (!$SUCCESS) { $icon = "warning32.png"; $errors[] = "<span style='color:#d32d2d'>{update_error}</span>"; } if (!$SUCCESS_TLSE) { $icon_tlse = "warning32.png"; $errors_tlse[] = "<span style='color:#d32d2d'>{update_error}</span>"; } $TIME_CLOUD = $tpl->time_to_date($TIME_OFF, true); if ($TIME_OFF > $TIME_CUR) { $icon = "warning-32-yellow.png"; $errors[] = "<span style='color:#46a346'>{can_be_updated}: {$TIME_CLOUD}</span>"; } if ($TIME_OFF_TLSE > $TIME_CUR_TLSE) { $TIME_CLOUD_TLSE = $tpl->time_to_date($TIME_OFF_TLSE, true); $icon_tlse = "warning32.png"; $errors_tlse[] = "<span style='color:#46a346'>{can_be_updated}: {$TIME_CLOUD_TLSE}</span>"; } if (!$users->CORP_LICENSE) { $icon = "warning-32-yellow.png"; $errors[] = "<span style='color:#46a346'>{license_error}</span>"; } if (count($errors) > 0) { $errors_text = "<div style='font-size:14px'><i>" . @implode("<br>", $errors) . "</i></div>"; } if (count($errors_tlse) > 0) { $errors_tlse_text = "<div style='font-size:14px'><i>" . @implode("<br>", $errors_tlse) . "</i></div>"; } $TIME_TLS_UPDATED_text_text = "<div style='font-size:14px'>{free_databases} {updated_on}: {$TIME_TLS_UPDATED_text}</div>"; if (!isset($CurrentTLSEDbCloud[$category])) { $ROWS_TLSE = " - "; $errors_tlse_text = null; $icon_tlse = "ok32-grey.png"; $TIME_TLS_UPDATED_text_text = null; } $tablex[] = "<tr style='height:60px;background-color:{$color}'>\n\t\t<td style='font-size:16px;padding:5px' nowrap><span style='font-weight:bold;font-size:18px'>{$category}</span>\n\t\t<div style='font-size:14px'>{updated_on}: {$TIME_UPDATED_text}{$errors_text}</div>\n\t\t{$TIME_TLS_UPDATED_text_text}\n\t\t</td>\n\t\t<td style='font-size:16px;text-align:right'>{$ROWS}</td>\n\t\t<td style='font-size:16px;text-align:right'><center><img src=img/{$icon}></center></td>\n\t\t<td style='font-size:16px;text-align:right'> </td>\n\t\t<td style='font-size:16px;text-align:right'>{$ROWS_TLSE}{$errors_tlse_text}</td>\n\t\t\n\t\t<td style='font-size:16px;text-align:right'><center><img src=img/{$icon_tlse}></center></td>\n\t\t\n\t\t</tr>"; } $PhishTankLastDate = $sock->GET_INFO("PhishTankLastDate"); if ($PhishTankLastDate == null) { $PhishTankLastDate = "-"; } $PhishTankLastCount = FormatNumber(intval($sock->GET_INFO("PhishTankLastCount"))); $tablex[] = "</table>"; $html = "\n\t\t\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:50%'>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td style='font-size:24px;font-weight:bold' colspan=2>{webfiltering_database} ({$ProductName})</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style='font-size:18px;' class=legend>{available}:</td>\n\t\t\t<td style='font-size:18px;font-weight:bold'>{$ARTICA_OFFICIAL_DB}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style='font-size:18px;' class=legend>{current}:</td>\n\t\t\t<td style='font-size:18px;font-weight:bold'>{$ARTICA_CURRENT_DB}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style='font-size:18px;' class=legend>{categories}:</td>\n\t\t\t<td style='font-size:18px;font-weight:bold'>" . count($ArticaDbCloud) . "</td>\n\t\t</tr>\n\t</table>\n\t</td>\n\t\t<td style='width:50%'>\n\t<table style='width:100%'>\n\t\n\t\t<tr>\n\t\t\t<td style='font-size:24px;font-weight:bold' colspan=2>{free_databases}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style='font-size:18px;' class=legend>{available}:</td>\n\t\t\t<td style='font-size:18px;font-weight:bold'>{$TLSE_OFFICIAL_DB}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style='font-size:18px;' class=legend>{current}:</td>\n\t\t\t<td style='font-size:18px;font-weight:bold'>{$TLSE_CURRENT_DB}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style='font-size:18px;' class=legend>{categories}:</td>\n\t\t\t<td style='font-size:18px;font-weight:bold'>" . count($TLSEDbCloud) . "</td>\n\t\t</tr>\n\t\t<tr><td colspan=2><hr></td></tr>\n\t\t<tr>\n\t\t\t<td style='font-size:18px;' class=legend>PhishTank: {version}:</td>\n\t\t\t<td style='font-size:18px;font-weight:bold'>{$PhishTankLastDate}</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td style='font-size:18px;' class=legend>PhishTank: {items}:</td>\n\t\t\t<td style='font-size:18px;font-weight:bold'>{$PhishTankLastCount}</td>\n\t\t</tr>\n\t</table>\n\t</td>\n</tr>\n</table>\t\t\t\t\t\t\t\t\t\t\t\n\t<p> </p>\n\t\t\n\t" . @implode("\n", $tablex); echo $tpl->_ENGINE_parse_body($html); }
function RepairCategoriesBases() { $q = new mysql_squid_builder(); $tables_cats = $q->LIST_TABLES_CATEGORIES(); $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $timeF = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; $pid = @file_get_contents($pidfile); if ($pid < 100) { $pid = null; } $unix = new unix(); if ($unix->process_exists($pid)) { ufdbguard_admin_events("Fatal Already executed pid {$pid}", __FUNCTION__, __FILE__, __LINE__, "stats"); echo "Already executed pid {$pid}\n"; return; } if ($unix->file_time_min($timeF) < 10) { $time = $unix->file_time_min($timeF); ufdbguard_admin_events("Need 10Mn, currently {$time}Mn", __FUNCTION__, __FILE__, __LINE__, "stats"); @unlink($timeF); @file_put_contents($timeF, time()); return; } while (list($num, $tablename) = each($tables_cats)) { $newcat = $q->tablename_tocat($tablename); if ($newcat == null) { continue; } if ($tablename == "category_english_malware") { continue; } if ($tablename == "category_spywmare") { $newcat = "spyware"; } if ($tablename == "category_forum") { $newcat = "forums"; } if ($tablename == "category_housing_reale_state_") { $newcat = "housing/reale_state_office"; } if ($tablename == "category_radio") { $newcat = "webradio"; } if ($tablename == "category_radiotv") { $newcat = "webradio"; } if ($tablename == "category_shopping") { continue; } echo "{$tablename} -> {$newcat}\n"; ufdbguard_admin_events("define {$tablename} to {$newcat} done", __FUNCTION__, __FILE__, __LINE__, "maintenance"); $q->QUERY_SQL("UPDATE `{$tablename}` SET category='{$newcat}' WHERE category='{$ligne["category"]}'"); } }