function categories_details() { $tpl = new templates(); $page = CurrentPageName(); $date = GetLastUpdateDate(); $category = $_GET["category-details"]; $categorys = urlencode($category); $md = md5("{$category}"); $html = "\n\t\n\t\n\t<div id='categories-details-title-{$md}' style='font-size:16px;margin:10px'></div>\n\t<div id='categories-details-{$md}'></div>\n\t\n\t\n\t<script>\n\t\tfunction RefreshCategoryDetails(){\n\t\tLoadAjax('categories-details-{$md}','{$page}?category-details-md={$categorys}');\n\t\t\n\t\t}\n\t\t\n\t\tfunction RefreshCategoryDetailsTitle(){\n\t\tif(!document.getElementById('total-cat')){\n\t\t\tLoadAjax('categories-details-title-{$md}','{$page}?category-details-md-title={$categorys}');\n\t\t\t}\n\t\t\n\t\t}\t\t\n\t\n\tRefreshCategoryDetails();\n\t</script>"; echo $tpl->_ENGINE_parse_body($html); }
function categories_details(){ $tpl=new templates(); $page=CurrentPageName(); $date=GetLastUpdateDate(); $category=$_GET["category-details"]; $categorys=urlencode($category); $md=md5("$category"); $html=" <div id='categories-details-title-$md' style='font-size:16px;margin:10px'></div> <div id='categories-details-$md'></div> <script> function RefreshCategoryDetails(){ LoadAjax('categories-details-$md','$page?category-details-md=$categorys'); } function RefreshCategoryDetailsTitle(){ if(!document.getElementById('total-cat')){ LoadAjax('categories-details-title-$md','$page?category-details-md-title=$categorys'); } } RefreshCategoryDetails(); </script>"; echo $tpl->_ENGINE_parse_body($html); }
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 global_status_artica_db() { $tpl = new templates(); $page = CurrentPageName(); $date = GetLastUpdateDate(); $users = new usersMenus(); $sock = new sockets(); $q = new mysql(); $sql = "SELECT avg(progress) as pourcent FROM updates_categories WHERE filesize>0"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if (!is_numeric($ligne["pourcent"])) { $ligne["pourcent"] = 0; } $pourcent = round($ligne["pourcent"], 2); $purc = pourcentage($pourcent); $t = $_GET["t"]; $dateDB = $sock->getFrameWork("squid.php?articadb-version=yes"); $dateDB_text = $tpl->time_to_date($dateDB); $DB_STATUS = unserialize(base64_decode($sock->getFrameWork("ufdbguard.php?databases-percent=yes"))); $DB_STATUS_TIME = $DB_STATUS["ARTICA"]["LAST_TIME"]; $DB_STATUS_MAX = $DB_STATUS["ARTICA"]["MAX"]; $DB_STATUS_COUNT = $DB_STATUS["ARTICA"]["COUNT"]; $DB_STATUS_PERC = round($DB_STATUS_COUNT / $DB_STATUS_MAX * 100); $color = "color:black;"; $sock = new sockets(); $scheduledAR = unserialize(base64_decode($sock->getFrameWork("squid.php?schedule-maintenance-exec=yes"))); $SquidDatabasesArticaEnable = $sock->GET_INFO("SquidDatabasesArticaEnable"); if (!is_numeric($SquidDatabasesArticaEnable)) { $SquidDatabasesArticaEnable = 1; } if ($SquidDatabasesArticaEnable == 1) { $disable_text = "Artica {database}: {enabled}"; } else { $disable_text = "Artica {database}: {disabled}"; $color = "color:#B6ACAC"; } $CORP_LICENSE = 1; if (!$users->CORP_LICENSE) { $CORP_LICENSE = 0; $SquidDatabasesArticaEnable = 0; $disable_text = "Artica {database}: <strong style='color:#BA1010'>{license_inactive}</strong>"; $color = "color:#B6ACAC"; } $running = "<br><i style='font-size:12px'>{update_task_stopped}</i>"; if ($scheduledAR["RUNNING"]) { $running = "<br><i style='font-size:12px;color:#BA0000'>{update_currently_running_since} {$scheduledAR["TIME"]}Mn</i>"; } $q = new mysql_squid_builder(); $SQL_ALL_ITEMS = "SELECT SUM( TABLE_ROWS ) AS tcount FROM information_schema.tables WHERE table_schema = 'squidlogs' AND table_name LIKE 'category_%'"; $ligne = mysql_fetch_array($q->QUERY_SQL($SQL_ALL_ITEMS)); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } $itemsPerso = $ligne["tcount"]; $itemsPerso = numberFormat($itemsPerso, 0, "", " "); $catz = new mysql_catz(); $itemsArtica = numberFormat(intval(@file_get_contents("/usr/share/artica-postfix/ressources/UFDB_ARTICA_COUNT"))); $q = new mysql_squid_builder(); $backuped_items = $q->COUNT_ROWS("webfilters_backupeddbs"); $sql = "SELECT SUM(size) as tszie FROM webfilters_backupeddbs"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $backuped_items_size = FormatBytes($ligne["tszie"] / 1024); $backuped_items_text = "{$backuped_items} {backup_containers} ({$backuped_items_size})"; $tableau = "\n\t<div style='width:95%;min-height:254px' class=form>\n\t<table style='width:99%'>\n\t<tbody>\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:16px;{$color}'>{artica_databases}{$running}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px;font-weight:bold'>{youritems}:</td>\n\t\t\t<td style='font-size:14px;font-weight:bold'>{$itemsPerso}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:14px' align='right'>\n\t\t\t\t<table style='width:2%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('dansguardian2.backuped.databases.php');\" \n\t\t\t\t\t\t\tstyle='font-size:12px;text-decoration:underline'>{$backuped_items_text}</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('dansguardian2.restore.databases.php');\" \n\t\t\t\t\t\t\tstyle='font-size:12px;text-decoration:underline'>{restore_backup}</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png' id='emptypersonaldbdiv'>\n\t\t\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('dansguardian2.restore.databases.php?empty-js=yes');\" \n\t\t\t\t\t\t\tstyle='font-size:12px;text-decoration:underline'>{empty_database}</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('ufdbguard.databases.php?scripts=compile-schedule');\" style='font-size:12px;text-decoration:underline;{$color}'>{compilation_schedule}</a></td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t</table>\n\t\t\t</td>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px;font-weight:bold;{$color}'>{articaitems}:</td>\n\t\t\t<td style='font-size:14px;font-weight:bold;{$color}'>{$itemsArtica} v.{$dateDB} <i style='font-size:11px'>{$dateDB_text}</i></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:12px;font-weight:bold;{$color}'>{update_status}:</td>\n\t\t\t<td>" . pourcentage($DB_STATUS_PERC, 0, "green") . "</td>\n\t\t</tr>\t\t\n\n\t\t\n\n\t\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:14px' align='right'>\n\t\t\t<table style='width:2%'>\n\t\t\t<tbody>\n\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:ArticaDBDisable();\" style='font-size:12px;text-decoration:underline;{$color}'>{$disable_text}</a></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t<td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:ArticaDBUpdateNow();\" style='font-size:12px;text-decoration:underline;{$color}'>{update_now}</a></td>\n\t\t\t</tr>\n\t\n\t\t\t\t\t\t\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t\n\t\t</tr>\n\t\t\t\n\t</tbody>\n\t</table>\n\t</div>\n\t<script>\n\tvar x_ArticaDBUpdateNow= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t \tRefreshArticaDBStatus();\n\t\t}\t\n\n\t\tfunction ArticaDBUpdateNow(){\n\t\t\tvar CORP_LICENSE={$CORP_LICENSE};\n\t\t\tif(CORP_LICENSE==0){alert('license error');return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('global-artica-status-update','yes');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ArticaDBUpdateNow);\n\t\t}\n\t\n\t\t\n\tvar xArticaDBDisable= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t \tRefreshArticaDBStatus();\n\t\t}\t\n\n\t\t\n\t\tfunction ArticaDBDisable(){\n\t\t\tvar CORP_LICENSE={$CORP_LICENSE};\n\t\t\tif(CORP_LICENSE==0){alert('license error');return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('global-artica-enable-update','{$SquidDatabasesArticaEnable}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xArticaDBDisable);\t\t\n\t\t\n\t\t}\t\t\n\t</script>\n\t\n\t\n\t"; $html = "<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t\t<td valign='top' width=1%><img src='img/artica5-64.png'></td>\n\t\t<td valign='top' width=99%>{$tableau}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . imgtootltip("refresh-24.png", "{refresh}", "LoadAjax('artica-status-databases-{$t}','{$page}?global-artica-status-databases=yes&t={$t}');") . "</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t<script>\n\t\t\n\t\tLoadAjax('tlse-status-databases-{$t}','{$page}?global-tlse-status-databases=yes&t={$t}');\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function update() { $myDate = GetLastUpdateDate(); echo "BLACKLISTS: Last update on {$myDate}\n"; $unix = new unix(); $curl = new ccurl("http://www.artica.fr/blacklist/update.ini"); if (!$curl->GetFile("/tmp/update.ini")) { ufdbguard_admin_events("Fatal: unable to download blacklist index file {$curl->error}", __FUNCTION__, __FILE__, __LINE__, "update"); echo "BLACKLISTS: Failed to retreive http://www.artica.fr/blacklist/update.ini ({$curl->error})\n"; return; } $ini = new Bs_IniHandler("/tmp/update.ini"); $date = $ini->_params["settings"]["date"]; echo "BLACKLISTS: Pattern update {$date}\n"; if (!$GLOBALS["FORCE"]) { if ($date == $myDate) { echo "BLACKLISTS: No new updates\n"; return; } } categorize_delete(); while (list($category, $array) = each($ini->_params)) { echo "Saving {$category}\n"; while (list($filename, $size) = each($array)) { if (!is_numeric($size)) { $size = 0; } echo "Saving {$filename} for {$category}\n"; if (!INITCategory($category, $date, $filename, $size)) { echo "Fatal error {$category} {$date} {$filename} {$size}\n"; return; } } } }