function report() { if (!is_file("/usr/share/artica-postfix/ressources/logs/categorized.array")) { return; } $ARRAY = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/categorized.array")); $stats_sites = $ARRAY["stats_sites"]; $stats_categorized = $ARRAY["stats_categorized"]; $stats_not_categorized = $ARRAY["stats_not_categorized"]; $SumOflines = $ARRAY["SumOflines"]; $stats_ip = $ARRAY["stats_ip"]; $FIRSTTIME = $ARRAY["firsttime"]; $LASTTIME = $ARRAY["lasttime"]; $rate = $stats_categorized / $stats_sites; $rate = $rate * 100; $rate = round($rate, 2); $stats_not_categorized = FormatNumber($stats_not_categorized); $stats_categorized = FormatNumber($stats_categorized); $stats_sites = FormatNumber($stats_sites); $stats_ip = FormatNumber($stats_ip); $SumOflines = FormatNumber($SumOflines); if ($rate > 60) { $rate_color = "46a346"; } if ($rate < 60) { $rate_color = "d32d2d"; } $tpl = new templates(); $html = "<div style='width:98%' class=form>\n\t\n\t<div style='font-size:18px;margin-bottom:15px'>{from} " . $tpl->time_to_date($FIRSTTIME) . " {to} " . $tpl->time_to_date($LASTTIME) . " (" . distanceOfTimeInWords($FIRSTTIME, $LASTTIME) . ")</div>\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{rate}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong style='font-size:36px;color:{$rate_color}'>{$rate}%</strong></td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{duration}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$ARRAY["DURATION"]}</strong></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{lines}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$SumOflines}</strong></td>\n\t\t<td> </td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{not_categorized}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_not_categorized}</strong></td>\n\t\t<td><a href=\"ressources/logs/notcategorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{categorized}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_categorized}</strong></td>\n\t\t<td><a href=\"ressources/logs/categorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{ipaddresses}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_ip}</strong></td>\n\t\t<td><a href=\"ressources/logs/ipcategorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{websites}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_sites}</strong></td>\n\t\t<td> </td>\n\t\t\n\t</tr>\t\n\t</table>\n\t</div>\t\t\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function DATE_START() { $tpl = new templates(); $q = new mysql_squid_builder(); $table = "dashboard_volume_day"; $sql = "SELECT MIN(TIME) as xmin, MAX(TIME) as xmax FROM {$table} "; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $time1 = $tpl->time_to_date(strtotime($ligne["xmin"]), true); $time2 = $tpl->time_to_date(strtotime($ligne["xmax"]), true); return $tpl->_ENGINE_parse_body("{date_start} {$time1}, {last_date} {$time2}"); }
function popup() { $artica_meta = new mysql_meta(); $LicenseInfos = $artica_meta->LicenseInfos($_GET["uuid"]); $page = CurrentPageName(); $tpl = new templates(); $FINAL_TIME = 0; if (isset($LicenseInfos["FINAL_TIME"])) { $FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]); } $LICT = "Community Edition"; if ($LicenseInfos["CORP_LICENSE"]) { $LICT = "Entreprise Edition"; } if ($LicenseInfos["ExpiresSoon"] > 0) { if ($LicenseInfos["ExpiresSoon"] < 31) { $LICT = "<span style='color:red'>{trial_mode}</span>"; } } if ($FINAL_TIME > 0) { $ExpiresSoon = intval(time_between_day_Web($FINAL_TIME)); if ($ExpiresSoon < 7) { $ExpiresSoon_text = "<strong style='color:red;font-size:16px'> {ExpiresSoon}</strong>"; } $licenseTime = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{expiredate}:</td>\n\t\t\t\t<td style='font-size:24px'>" . $tpl->time_to_date($FINAL_TIME) . " (" . distanceOfTimeInWords(time(), $FINAL_TIME) . "{$ExpiresSoon_text})</td>\n\t\t\t\t\t</tr>"; } if (is_numeric($LicenseInfos["TIME"])) { $tt = distanceOfTimeInWords($LicenseInfos["TIME"], time()); $last_access = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:24px'>{last_update}:</td>\n\t\t<td style='font-size:24px'>{since} {$tt}</td>\n\t\t</tr>"; } $html = "<div style='font-size:30px'>{$LICT}</div><div style='width:98%' class=form>\n<table style='width:100%'>\n\t</tr>\n\t{$last_access}\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{company}:</td>\n\t\t<td><span style='font-size:24px;font-weight:bold'>{$LicenseInfos["COMPANY"]}</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{your_email_address}:</td>\n\t\t\t\t<td><span style='font-size:24px;font-weight:bold'>{$LicenseInfos["EMAIL"]}</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{nb_employees}:</td>\n\t\t\t\t<td><span style='font-size:24px;font-weight:bold'>" . FormatNumber($LicenseInfos["EMPLOYEES"]) . "</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{license_number}:</td>\n\t\t\t\t<td style='font-size:24px'>{$LicenseInfos["license_number"]}</td>\n\t\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{license_status}:</td>\n\t\t\t<td style='font-size:24px;'>{$LicenseInfos["license_status"]}</td>\n\t\t</tr>\n\t\t{$licenseTime}\n\t</table>\n</td>\n</table></div>"; echo $tpl->_ENGINE_parse_body($html); }
function js() { header("content-type: application/x-javascript"); $tpl = new templates(); $page = CurrentPageName(); $title = $tpl->javascript_parse_text("{snapshots}"); $q = new mysql(); $ID = $_GET["ID"]; $sql = "SELECT zDate FROM snapshots WHERE ID='{$ID}'"; $database = "artica_snapshots"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $title = "{restore} " . $tpl->time_to_date(strtotime($ligne["zDate"]), true); $title = $tpl->javascript_parse_text($title); echo "\n\tYahooWinBrowseHide();\t\t\n\tif(confirm('{$title} ?')){\n\t\tRTMMail('800','{$page}?popup=yes&ID={$_GET["ID"]}','{$title}');\n\t\n\t}"; }
function page() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $ARRAY = unserialize(base64_decode($sock->GET_INFO("SquidSiegeConfig"))); if (!is_numeric($ARRAY["GRAB_URLS"])) { $ARRAY["GRAB_URLS"] = 0; } if (!is_numeric($ARRAY["USE_LOCAL_PROXY"])) { $ARRAY["USE_LOCAL_PROXY"] = 1; } if (!is_numeric($ARRAY["SESSIONS"])) { $ARRAY["SESSIONS"] = 150; } if (!is_numeric($ARRAY["MAX_TIME"])) { $ARRAY["MAX_TIME"] = 30; } $REPORT = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/siege.report.txt")); if (isset($REPORT["START_TIME"])) { $duration = distanceOfTimeInWords($REPORT["START_TIME"], $REPORT["STOP_TIME"]); $ttime = $tpl->time_to_date($REPORT["STOP_TIME"], true); unset($REPORT["START_TIME"]); unset($REPORT["STOP_TIME"]); $f[] = "<div style='width:98%' class=form><table style='width:100%'><tr><td style='font-size:26px' nowrap colsspan=2>{last_report}:</td></tr>"; $f[] = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{date}:</td>\n\t\t<td style='font-size:22px'>{$ttime}</td>\n\t\t</tr>"; $f[] = "\n\t\t\t\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{duration}:</td>\n\t\t<td style='font-size:22px'>{$duration}</td>\n\t\t</tr>"; while (list($num, $line) = each($REPORT)) { $f[] = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px' nowrap>{$num}:</td>\n\t\t\t\t<td style='font-size:22px'>{$line}</td>\n\t\t\t</tr>"; } $f[] = "\n\t\t<td style='font-size:26px' nowrap colspan=2 align='right'>" . imgtootltip("delete-42.png", "{delete}", "ReportDelete()") . "</td></tr>\t\t\n\t\t</table></div><p> </p>"; } if (count($f) > 0) { $report_text = @implode("\n", $f); } $t = time(); $html = "\n\t\t\t\n\t<div style='font-size:32px;margin-bottom:30px'>Stress Tool</div>\n\t<div style='font-size:18px;margin-bottom:30px' class=explain>{squid_siege_explain} </div>\n\t\t\t{$report_text}\n<div style='width:98%' class=form>\n\t\t\t\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' nowrap>{get_url_from_lastlogs}:</td>\n\t\t\t<td>" . Field_checkbox_design("GRAB_URLS", 1, $ARRAY["GRAB_URLS"]) . "</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{use_local_proxy}:</td>\n\t\t\t<td>" . Field_checkbox_design("USE_LOCAL_PROXY", 1, $ARRAY["USE_LOCAL_PROXY"], "USE_LOCAL_PROXY_CHECK()") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{remote_proxy}:</td>\n\t\t\t<td style='width:70%;vertical-align:middle;'>\n\t\t\t\t" . Field_text("REMOTE_PROXY", $ARRAY["REMOTE_PROXY"], "font-size:22px;width:300px;") . "\n\t\t\t</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{remote_port}:</td>\n\t\t\t<td style='width:70%;vertical-align:middle;'>\n\t\t\t\t" . Field_text("REMOTE_PROXY_PORT", $ARRAY["REMOTE_PROXY_PORT"], "font-size:22px;width:110px;") . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{username}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("USERNAME", $ARRAY["USERNAME"], "font-size:22px;width:300px") . "\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{password}:</td>\n\t\t\t<td >\n\t\t\t\t" . Field_password("PASSWORD", $ARRAY["PASSWORD"], "font-size:22px;width:300px;") . "\n\t\t\t</td>\n\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{simulate}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("SESSIONS", $ARRAY["SESSIONS"], "font-size:22px;width:110px;") . " {members}\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px' nowrap>{MaxExecutionTime}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("MAX_TIME", $ARRAY["MAX_TIME"], "font-size:22px;width:110px;") . " {seconds}\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding-top:20px;font-size:36px'>\n\t\t\t\t\t\t<hr>" . button("{launch_test}", "Submit{$t}(true)", 36) . " | " . button("{apply}", "Submit{$t}(false)", 36) . "</td>\n\t\t</tr>\n\t</table>\n\t</div>\n<div style='margin-bottom:50px'> </div>\n<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t}\n\tvar xSubmit2{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tLoadjs('squid.siege.progress.php');\n\t}\t\n\tvar xDelete{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tRefreshTab('debug_squid_config');\n\t}\t\n\t\n\tfunction ReportDelete(){\n\t\tvar XHR = new XHRConnection();\t\n\t\tXHR.appendData('report-delete','yes');\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n\t\n\n\n\tfunction Submit{$t}(run){\n\t\tvar XHR = new XHRConnection();\t\n\t\t\n\t\tif(document.getElementById('GRAB_URLS').checked){XHR.appendData('GRAB_URLS',1);}else{XHR.appendData('GRAB_URLS',0);}\n\t\tif(document.getElementById('USE_LOCAL_PROXY').checked){XHR.appendData('USE_LOCAL_PROXY',1);}else{XHR.appendData('USE_LOCAL_PROXY',0);}\n\t\tXHR.appendData('REMOTE_PROXY',document.getElementById('REMOTE_PROXY').value);\n\t\tXHR.appendData('REMOTE_PROXY_PORT',document.getElementById('REMOTE_PROXY_PORT').value);\n\t\t\n\t\tXHR.appendData('USERNAME',encodeURIComponent(document.getElementById('USERNAME').value));\n\t\tXHR.appendData('PASSWORD',encodeURIComponent(document.getElementById('PASSWORD').value));\n\t\t\n\t\t\n\t\tXHR.appendData('SESSIONS',document.getElementById('SESSIONS').value);\n\t\tXHR.appendData('MAX_TIME',document.getElementById('MAX_TIME').value);\n\t\tif(!run){\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t\t}else{\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit2{$t});\n\t\t}\n\t}\n\t\n\t\n\tfunction USE_LOCAL_PROXY_CHECK(){\n\t\tdocument.getElementById('REMOTE_PROXY').disabled=true;\n\t\tdocument.getElementById('REMOTE_PROXY_PORT').disabled=true;\n\t\tif(!document.getElementById('USE_LOCAL_PROXY').checked){\n\t\t\tdocument.getElementById('REMOTE_PROXY').disabled=false;\n\t\t\tdocument.getElementById('REMOTE_PROXY_PORT').disabled=false;\t\t\n\t\t}\n\t\n\t}\n\tUSE_LOCAL_PROXY_CHECK();\n\tLoadAjax('request-{$t}','{$page}?request-tool-status=yes',true);\n</script>\n\t"; 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 restore() { $ARTICAVERSION = @file_get_contents("/usr/share/artica-postfix/VERSION"); $unix = new unix(); $HOSTNAME = $unix->hostname_g(); $DIALOG = $unix->find_program("dialog"); $php = $unix->LOCATE_PHP5_BIN(); $q = new mysql(); $table = "snapshots"; $database = "artica_snapshots"; $sql = "SELECT * FROM {$table}"; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { if ($q->mysql_error != null) { json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1); } } if (mysql_num_rows($results) == 0) { $f[] = "#!/bin/bash"; $f[] = "INPUT=/tmp/menu.sh.\$\$"; $f[] = "OUTPUT=/tmp/output.sh.\$\$"; $f[] = "trap \"rm \$OUTPUT; rm \$INPUT; exit\" SIGHUP SIGINT SIGTERM"; $f[] = "DIALOG=\${DIALOG=dialog}"; $f[] = "\t{$DIALOG} --title \"R E S T O R E\" --msgbox \"Sorry, no snapshot created\" 9 70"; if ($GLOBALS["VERBOSE"]) { echo "Writing /tmp/bash_snapshots_restore.sh\n"; } @file_put_contents("/tmp/bash_snapshots_restore.sh", @implode("\n", $f)); @chmod("/tmp/bash_snapshots_restore.sh", 0755); return; } $diag[] = "{$DIALOG} --clear --nocancel --backtitle \"Software version {$ARTICAVERSION} on {$HOSTNAME}\""; $diag[] = "--title \"[ S N A P S H O T S - R E S T O R E - M E N U ]\""; $diag[] = "--menu \"You can use the UP/DOWN arrow keys\nChoose the TASK\" 20 100 10"; $tpl = new templates(); while ($ligne = mysql_fetch_assoc($results)) { $ID = $ligne["ID"]; $xdate = $ligne["zDate"]; $xtime = strtotime($xdate); $date = $tpl->time_to_date($xtime, true); $diag[] = "Restore{$ID} \"Restore {$xdate} - {$date}\""; $funcs[] = "function restore_{$ID}(){"; $funcs[] = "\t{$DIALOG} --title \"Restore a Snapshot\" --yesno \"Do you need to restore {$xdate} - {$date} operation ? Press 'Yes' to continue, or 'No' to exit\" 0 0"; $funcs[] = "\tcase \$? in"; $funcs[] = "\t\t0)"; $funcs[] = "\tif [ -f /tmp/dns.log ]; then"; $funcs[] = "\t\trm /tmp/dns.log"; $funcs[] = "\tfi"; $funcs[] = "\t{$php} /usr/share/artica-postfix/exec.backup.artica.php --snapshot-id {$ID} >/tmp/dns.log &"; $funcs[] = "\t{$DIALOG} --tailbox /tmp/dns.log 25 150"; $funcs[] = "\t\treturn;;"; $funcs[] = "\t1)"; $funcs[] = "\t\treturn;;"; $funcs[] = "\t255)"; $funcs[] = "\t\treturn;;"; $funcs[] = "\tesac"; $funcs[] = "}"; $funcs[] = ""; $cases[] = "Restore{$ID}) restore_{$ID};;"; } $diag[] = "Quit \"Return to main menu\" 2>\"\${INPUT}\""; $f[] = "#!/bin/bash"; $f[] = "INPUT=/tmp/menu.sh.\$\$"; $f[] = "OUTPUT=/tmp/output.sh.\$\$"; $f[] = "trap \"rm \$OUTPUT; rm \$INPUT; exit\" SIGHUP SIGINT SIGTERM"; $f[] = "DIALOG=\${DIALOG=dialog}"; @implode("\n", $funcs); $f[] = "while true"; $f[] = "do"; $f[] = @implode(" ", $diag); $f[] = "menuitem=\$(<\"\${INPUT}\")"; $f[] = "case \$menuitem in"; $f[] = @implode("\n", $cases); $f[] = "Quit) break;;"; $f[] = "esac"; $f[] = "done\n"; if ($GLOBALS["VERBOSE"]) { echo "Writing /tmp/bash_snapshots_restore.sh\n"; } @file_put_contents("/tmp/bash_snapshots_restore.sh", @implode("\n", $f)); @chmod("/tmp/bash_snapshots_restore.sh", 0755); }
function statusDB() { $tpl = new templates(); $page = CurrentPageName(); $users = new usersMenus(); $sock = new sockets(); $backbutton = null; 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>"); } $q = new mysql_catz(); $sock = new sockets(); $ini = new Bs_IniHandler(); $catz = $q->LIST_TABLES_CATEGORIES(); $sock->getFrameWork('cmd.php?squid-ini-status=yes'); $ini->loadFile("/usr/share/artica-postfix/ressources/databases/ALL_SQUID_STATUS"); $CATZ_ARRAY = unserialize(@file_get_contents("/home/artica/categories_databases/CATZ_ARRAY")); $date = $CATZ_ARRAY["TIME"]; $LOCAL_VERSION = $CATZ_ARRAY["TIME"]; $title = $tpl->_ENGINE_parse_body("{APP_ARTICADB}"); $q = new mysql_catz(); $LOCAL_VERSION_TEXT = $tpl->time_to_date($date); $CountDecategories = intval(@file_get_contents("/usr/share/artica-postfix/ressources/UFDB_ARTICA_COUNT")); $CountDeDatabases = intval(@file_get_contents("/usr/share/artica-postfix/ressources/UFDB_ARTICA_DBS")); if (!is_numeric($CountDecategories)) { $CountDecategories = 0; } $CountDecategories = numberFormat($CountDecategories, 0, "", " "); $APP_SQUID_DB = DAEMON_STATUS_ROUND("APP_SQUID_DB", $ini, null, 1); $APP_UFDBCAT = DAEMON_STATUS_ROUND("APP_UFDBCAT", $ini, null, 1); $DisableCategoriesDatabasesUpdates = intval($sock->GET_INFO("DisableCategoriesDatabasesUpdates")); $CategoriesDatabasesUpdatesAllTimes = intval($sock->GET_INFO("CategoriesDatabasesUpdatesAllTimes")); $CategoriesDatabasesByCron = $sock->GET_INFO("CategoriesDatabasesByCron"); if (!is_numeric($CategoriesDatabasesByCron)) { $CategoriesDatabasesByCron = 1; } $CategoriesDatabasesShowIndex = $sock->GET_INFO("CategoriesDatabasesShowIndex"); if (!is_numeric($CategoriesDatabasesShowIndex)) { $CategoriesDatabasesShowIndex = 1; } $DisableArticaProxyStatistics = $sock->GET_INFO("DisableArticaProxyStatistics"); if (!is_numeric($DisableArticaProxyStatistics)) { $DisableArticaProxyStatistics = 0; } $fbdize = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/categories-db.size.db")); $DBSIZE = FormatBytes($fbdize["DBSIZE"]); $POURC = $fbdize["POURC"]; if (is_numeric($POURC)) { $POURC_TXT = " {$POURC}% {used}"; } $p2 = Paragraphe_switch_img("{disable_udpates}", "{disable_udpates_explain}<br>{APP_ARTICADB_EXPLAIN}", "DisableCategoriesDatabasesUpdates", $DisableCategoriesDatabasesUpdates, null, 700); $p3 = Paragraphe_switch_img("{free_update_during_the_day}", "{free_update_during_the_day_explain}", "CategoriesDatabasesUpdatesAllTimes", $CategoriesDatabasesUpdatesAllTimes, null, 700); $p = Paragraphe_switch_img("{update_only_by_schedule}", "{articadb_update_only_by_schedule}", "CategoriesDatabasesByCron", $CategoriesDatabasesByCron, null, 700); $tt0[] = "<tr><td colspan=2>{$p3}</td></tr>"; $tt0[] = "<tr><td colspan=2>{$p2}</td></tr>"; $tt0[] = "<tr><td colspan=2>{$p}</td></tr>"; $tt0[] = "<tr>\n\t\t\t<td width=1%>" . Field_checkbox_design("CategoriesDatabasesShowIndex", 1, $CategoriesDatabasesShowIndex, "CategoriesDatabasesByCron()") . "</td>\n\t\t\t<td nowrap style='font-size:14px;'>:{display_update_info_index}</a></td>\n\t\t</tr>\n\t\t<tr><td colspan=2 align='right'>" . button("{apply}", "CategoriesDatabasesByCron()", 22) . "</td></tr>\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t"; /*$tt[]="<tr> <td width=1%><img src='img/arrow-right-16.png'> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.catzdb.manual-update.php');\" style='font-size:14px;text-decoration:underline;'>{manual_update}</a></td> </tr>"; */ /*$tt[]="<tr> <td width=1%><img src='img/arrow-right-16.png'> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.catzdb.changedir.php');\" style='font-size:14px;text-decoration:underline;'>{change_directory}</a></td> </tr>"; */ if ($DisableArticaProxyStatistics == 1) { $tt[] = "<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t<td nowrap><a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.artica.statistics.php');\"\n\t\tstyle='font-size:14px;text-decoration:underline;color:#D10000'>{ARTICA_STATISTICS} {disabled}</a></td>\n\t\t</tr>"; } else { $tt[] = "<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t<td nowrap><a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.artica.statistics.php');\"\n\t\tstyle='font-size:14px;text-decoration:underline;color:black'>{ARTICA_STATISTICS}</a></td>\n\t\t</tr>"; } $arrayV = unserialize(base64_decode($sock->getFrameWork("squid.php?articadb-nextversion=yes"))); $REMOTE_VERSION = $arrayV["TIME"]; if ($REMOTE_VERSION > $date) { $REMOTE_VERSION_TEXT = $tpl->time_to_date($REMOTE_VERSION); $newver = "\t<tr>\n\t\t<td colspan=2><div style='font-size:16px;color:#D52210'>{new_version}: {$REMOTE_VERSION} <i style='font-size:11px'>{$REMOTE_VERSION_TEXT}</i> </div></td>\n\t</tr>"; $updaebutton = "<div style='text-align:right'><hr>" . button("{update_now}", "Loadjs('squid.blacklist.upd.php')", 22) . "</div>"; } $nextcheck = $sock->getFrameWork("squid.php?articadb-nextcheck=yes"); $nextcheck = intval($nextcheck); if ($nextcheck > 0) { $nextcheck_text = "\t\n\t<tr>\n\t\t<td colspan=2><div style='font-size:16px'>{next_check_in}: {$nextcheck}Mn</div></td>\n\t</tr>"; } if ($nextcheck < 0) { $nextcheck = str_replace("-", "", $nextcheck); $nextcheckTime = time() - intval($nextcheck) * 60; $nextcheckTimeText = distanceOfTimeInWords($nextcheckTime, time()); $nextcheck_text = "\t\n\t<tr>\n\t\t<td colspan=2><div style='font-size:16px'>{last_check}: {$nextcheckTimeText}</div></td>\n\t</tr>"; } $dbsize = $sock->getFrameWork("squid.php?articadbsize=yes"); $items = numberFormat($q->COUNT_CATEGORIES(), 0, "", " "); $html = "\n\t<div style='width:98%' class=form>\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>{$APP_SQUID_DB}<br>{$APP_UFDBCAT}</td>\n\t<td valign='top'>\n\t<table style='width:100%'>" . @implode("\n", $tt0) . "</table>\n\t<hr>\n\t<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t\t<td colspan=2><div style='font-size:16px'>{pattern_database_version}: {$date} <i style='font-size:11px'>{$LOCAL_VERSION_TEXT}</i> {$POURC_TXT}</div></td>\n\t</tr>\n\t{$newver}\n\t{$nextcheck_text}\n\t<tr>\n\t\t<td colspan=2><div style='font-size:16px'>{categories}: {$CountDeDatabases}</a></div></td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2><div style='font-size:16px'>{categorized_websites}: \n\t\t<a href=\"javascript:Loadjs('squid.catz.php');\" style='font-size:16px;text-decoration:underline'>\n\t\t{$CountDecategories}</a> </div></td>\n\t</tr>\n\t" . @implode("", $tt) . "\n\t</tbody>\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t{$updaebutton}\n\t<div id='database-progress-status'></div>\n<script>\nvar xCategoriesDatabasesByCron= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>1){alert(results);}\n}\n\t\nfunction CategoriesDatabasesByCron(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('CategoriesDatabasesByCron',document.getElementById('CategoriesDatabasesByCron').value);\n\tXHR.appendData('DisableCategoriesDatabasesUpdates',document.getElementById('DisableCategoriesDatabasesUpdates').value);\n\tXHR.appendData('CategoriesDatabasesUpdatesAllTimes',document.getElementById('CategoriesDatabasesUpdatesAllTimes').value);\n\tif(document.getElementById('CategoriesDatabasesShowIndex').checked){XHR.appendData('CategoriesDatabasesShowIndex','1');}else{XHR.appendData('CategoriesDatabasesShowIndex','0');}\n\tXHR.sendAndLoad('{$page}', 'POST',xCategoriesDatabasesByCron);\n}\n\t\n\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function license_status() { $sock = new sockets(); $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $license_number = null; $uuid = base64_decode($sock->getFrameWork("cmd.php?system-unique-id=yes")); $RegisterCloudBadEmail = intval($sock->GET_INFO("RegisterCloudBadEmail")); $LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos"))); $WizardSavedSettings = unserialize(base64_decode($sock->GET_INFO("WizardSavedSettings"))); if ($LicenseInfos["COMPANY"] == null) { $LicenseInfos["COMPANY"] = $WizardSavedSettings["company_name"]; } if ($LicenseInfos["EMAIL"] == null) { $LicenseInfos["EMAIL"] = $WizardSavedSettings["mail"]; } if (!is_numeric($LicenseInfos["EMPLOYEES"])) { $LicenseInfos["EMPLOYEES"] = $WizardSavedSettings["employees"]; } $licenseTime = null; $t = time(); $ASWEB = false; if ($users->SQUID_INSTALLED) { $ASWEB = true; } if ($users->WEBSTATS_APPLIANCE) { $ASWEB = true; } if ($users->KASPERSKY_WEB_APPLIANCE) { $ASWEB = true; } $unlocklick_hidden = null; $your_email_address_color = null; $RegisterCloudBadEmail_text = null; if ($RegisterCloudBadEmail == 1) { $RegisterCloudBadEmail_text = "<p class=text-error style='font-size:18px'>{incorrect_email_address_cloud}</p>"; $your_email_address_color = ";color:#d32d2d !important"; } $License_explain = "<div class=explain style='font-size:20px;margin:20px'>" . $tpl->_ENGINE_parse_body("{artica_license_explain}") . "</div>"; $WhichLicense[null] = "{select}"; $WhichLicense["evaluation"] = "{request_an_evaluation_license}"; $WhichLicense["cotation"] = "{request_an_corporate_license}"; $LICENCE_REQUEST_ERROR = $tpl->javascript_parse_text("{LICENCE_REQUEST_ERROR}"); if (!isset($LicenseInfos["LICENCE_REQUEST"])) { $LicenseInfos["LICENCE_REQUEST"] = null; } $WhichLicense_field = "<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{license_request}:</td>\n\t\t\t\t<td style='font-size:24px;font-weight:bold'>\n\t\t\t\t<input type='hidden' id='LICENCE_REQUEST-{$t}' value='evaluation'>\n\t\t\t{request_an_evaluation_license}</td>\n\t\t\t</tr>"; $unlocklick = "<td>" . Field_text("UNLOCKLIC-{$t}", $LicenseInfos["UNLOCKLIC"], "font-size:24px;width:240px") . "</td>"; if ($LicenseInfos["license_status"] == null) { $step = 1; $LicenseInfos["license_status"] = "{waiting_registration}"; $star = "{explain_license_free}"; $button_text = "{request_an_evaluation_license}"; } else { $step = 2; $step_text = "{waiting_order}"; $button_text = "{update_the_request}"; $star = "{explain_license_order}"; if ($LicenseInfos["LICENCE_REQUEST"] == "evaluation") { $step_text = "{request_an_evaluation_license}"; } } if ($LicenseInfos["license_status"] == "{license_active}") { $users->CORP_LICENSE = true; $WhichLicense_field = null; $titleprice = null; $License_explain = null; if ($LicenseInfos["UNLOCKLIC"] != null) { $unlocklick = "\n\t\t<td style='font-size:24px;font-weight:bold'>\n\t\t\t<input type='hidden' id='UNLOCKLIC-{$t}' value='{$LicenseInfos["UNLOCKLIC"]}'>\n\t\t\t<div style='float:right'>" . imgtootltip("delete-32.png", "{delete}:{unlock_license}", "Loadjs('{$page}?remove-lock-lic-js=yes')") . "</div>\n\t\t\t<span style='font-size:24px'>{$LicenseInfos["UNLOCKLIC"]}</span>\n\t\t</td>"; } else { $unlocklick = null; } } if ($users->CORP_LICENSE) { $star = null; $titleprice = null; $WhichLicense_field = null; $step = 3; $step_text = "{license_active}"; } if (is_numeric($LicenseInfos["TIME"])) { $tt = distanceOfTimeInWords($LicenseInfos["TIME"], time()); $last_access = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{last_update}:</td>\n\t\t\t\t<td style='font-size:24px'>{since} {$tt}</td>\n\t\t\t</tr>"; } if ($LicenseInfos["GoldKey"] != null) { $LicenseInfos["license_number"] = $LicenseInfos["GoldKey"]; } if (trim($LicenseInfos["license_number"]) != null) { $explain = "{explain_license_order}"; } $CORP_LICENSE = 0; $textcolor = "black"; $bt = "<hr>" . button($button_text, "RegisterSave{$t}()", 26); if ($unlocklick != null) { $unlock_license = "<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{unlock_license}:</td>\n\t\t\t\t{$unlocklick}\n\t\t\t</tr>"; } if ($users->CORP_LICENSE) { $CORP_LICENSE = 1; $textcolor = "#23A83E"; $paypal = null; $explain = null; $LicenseInfos["license_status"] = "{license_active}"; } if ($explain != null) { $explain = "<div style='font-size:16px' class=explain>{$titleprice}<br>{$explain}</div>"; } $FINAL_TIME = 0; if (isset($LicenseInfos["FINAL_TIME"])) { $FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]); } if ($FINAL_TIME > 0) { $ExpiresSoon = intval(time_between_day_Web($FINAL_TIME)); $distanceOfTimeInWords = distanceOfTimeInWords(time(), $FINAL_TIME); if ($ExpiresSoon < 7) { $ExpiresSoon_text = "<strong style='color:red;font-size:16px'> {ExpiresSoon}</strong>"; } if ($FINAL_TIME < time()) { $ExpiresSoon_text = "<strong style='color:red;font-size:16px'> {expired} <i>{license_expired_explain}</i></strong>"; $distanceOfTimeInWords = null; } $licenseTime = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{expiredate}:</td>\n\t\t\t\t<td style='font-size:24px'>" . $tpl->time_to_date($FINAL_TIME) . " ({$distanceOfTimeInWords}{$ExpiresSoon_text})</td>\n\t\t\t</tr>"; } if ($LicenseInfos["license_number"] != null) { $license_number = "<tr>\n\t<td class=legend style='font-size:24px'>{license_number}:</td>\n\t<td style='font-size:24px'>{$LicenseInfos["license_number"]}</td>\n\t</tr>"; } $html = "\n{$License_explain}\n<div style='width:98%;min-height:620px' class=form>\n{$RegisterCloudBadEmail_text}\n<table style='width:100%'>\n<tr>\n\t<td valign='top'>\n\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px;vertical-align:middle;'>{step}:</td>\n\t\t\t\t<td style='font-size:28px;font-weight:bold;color:{$textcolor}'>{$step}: {$step_text}<br>\n\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2 align=right'>\n\t\t\t\t\t\t\t\t\t<div style='text-align:right'><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('artica.settings.php?js=yes&func-ProxyInterface=yes');\"\n\t\t\t\tstyle='text-decoration:underline;font-size:16px'>{http_proxy}</a>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t{$last_access}\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{uuid}:</td>\n\t\t\t\t<td style='font-size:24px'>{$uuid}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{company}:</td>\n\t\t\t\t<td>" . Field_text("COMPANY-{$t}", $LicenseInfos["COMPANY"], "font-size:24px;width:450px") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px{$your_email_address_color}'>{your_email_address}:</td>\n\t\t\t\t<td>" . Field_text("EMAIL-{$t}", $LicenseInfos["EMAIL"], "font-size:24px;width:450px{$your_email_address_color}") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{nb_employees}:</td>\n\t\t\t\t<td>" . Field_text("EMPLOYEES-{$t}", FormatNumber($LicenseInfos["EMPLOYEES"]), "font-size:24px;width:80px") . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t{$WhichLicense_field}\n\n\t\t\t{$unlock_license}\n\t\t\t{$unlocklick_hidden}\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{license_status}:</td>\n\t\t\t<td style='font-size:28px;color:{$textcolor}'>{$LicenseInfos["license_status"]}</td>\n\t\t</tr>\n\t\t{$licenseTime}\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'>{$bt}</td>\n\t\t</tr>\n\t</table>\n</td>\n</table>\n\n\t\n<script>\nvar x_RegisterSave{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n\tLoadjs('artica.license.progress.php');\n}\n\t\nfunction RegisterSave{$t}(){\n\tvar XHR = new XHRConnection();\n\t\n\tif(document.getElementById('LICENCE_REQUEST-{$t}')){\n\t\tvar LICENCE_REQUEST=document.getElementById('LICENCE_REQUEST-{$t}').value;\n\t\tif(LICENCE_REQUEST==''){alert('{$LICENCE_REQUEST_ERROR}'); return;}\n\t\tXHR.appendData('LICENCE_REQUEST',LICENCE_REQUEST);\n\t}\n\t\n\tXHR.appendData('COMPANY',document.getElementById('COMPANY-{$t}').value);\n\tXHR.appendData('EMAIL',document.getElementById('EMAIL-{$t}').value);\n\tXHR.appendData('EMPLOYEES',document.getElementById('EMPLOYEES-{$t}').value);\n\t\n\tif( document.getElementById('UNLOCKLIC-{$t}') ){\n\t\tXHR.appendData('UNLOCKLIC',document.getElementById('UNLOCKLIC-{$t}').value);\n\t}\n\tXHR.appendData('REGISTER','1');\n\tXHR.sendAndLoad('{$page}', 'POST',x_RegisterSave{$t});\n}\n\t\nfunction CheckCorpLic(){\n\tvar lic={$CORP_LICENSE};\n}\nCheckCorpLic();\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function content_table() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $new_group = $tpl->javascript_parse_text("{new_group}"); $groups = $tpl->javascript_parse_text("{groups2}"); $memory = $tpl->javascript_parse_text("{memory}"); $load = $tpl->javascript_parse_text("{load}"); $version = $tpl->javascript_parse_text("{version}"); $servername = $tpl->javascript_parse_text("{servername2}"); $status = $tpl->javascript_parse_text("{status}"); $events = $tpl->javascript_parse_text("{events}"); $global_whitelist = $tpl->javascript_parse_text("{whitelist} (Meta)"); $policies = $tpl->javascript_parse_text("{policies}"); $orders = $tpl->javascript_parse_text("{orders}"); $switch = $tpl->javascript_parse_text("{switch}"); $link_host = $tpl->javascript_parse_text("{link_host}"); $link_all_hosts = $tpl->javascript_parse_text("{link_all_hosts}"); $all = $tpl->javascript_parse_text("{all}"); $file = $tpl->javascript_parse_text("{file}"); $size = $tpl->javascript_parse_text("{size}"); $table = "snapshots"; $database = null; $ID = $_GET["ID"]; $q = new mysql_meta(); $sql = "SELECT zDate FROM {$table} WHERE ID='{$ID}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $title = $tpl->time_to_date(strtotime($ligne["zDate"])); $t = time(); $buttons = null; $html = "\n\n\t<table class='ARTICA_SNAPSHOTS_DETAILS_TABLE' style='display: none' id='ARTICA_SNAPSHOTS_DETAILS_TABLE' style='width:100%'></table>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#ARTICA_SNAPSHOTS_DETAILS_TABLE').flexigrid({\n\turl: '{$page}?content-search=yes&ID={$ID}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$file}', name : 'zDate', width : 611, sortable : false, align: 'left'},\n\t{display: '{$size}', name : 'size', width : 150, sortable : false, align: 'right'},\n\t\n\t\n\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$all}', name : 'zDate'},\n\t\n\n\t],\n\tsortname: 'zDate',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<strong style=font-size:22px>{$title}</strong>',\n\tuseRp: true,\n\trpOptions: [10, 20, 30, 50,100,200],\n\trp:200,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 400,\n\tsingleSelect: true\n\n});\n});\n\n\n</script>"; echo $html; }
function rule_popup() { $q = new mysql_squid_builder(); $tpl = new templates(); $page = CurrentPageName(); $ID = $_GET["ID"]; $sock = new sockets(); $ARRAY = unserialize(base64_decode($sock->GET_INFO("SquidDynamicCaches"))); $SquidCacheLevel = $sock->GET_INFO("SquidCacheLevel"); if (!is_numeric($SquidCacheLevel)) { $SquidCacheLevel = 4; } if (!is_numeric($ARRAY["MAX_WWW"])) { $ARRAY["MAX_WWW"] = 100; } if (!is_numeric($ARRAY["ENABLED"])) { if ($SquidCacheLevel > 2) { $ARRAY["ENABLED"] = 1; } } if (!is_numeric($ARRAY["LEVEL"])) { $ARRAY["LEVEL"] = 5; } if (!is_numeric($ARRAY["INTERVAL"])) { $ARRAY["INTERVAL"] = 420; } if (!is_numeric($ARRAY["MAX_TTL"])) { $ARRAY["MAX_TTL"] = 15; } $MAX_TTL = $ARRAY["MAX_TTL"]; $MAX_TTL = $MAX_TTL * 24; $MAX_TTL = $MAX_TTL * 60; $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM main_cache_dyn WHERE familysite='{$ID}'")); $t = time(); for ($i = 1; $i < 11; $i++) { $ENFORCE[$i] = "{level} {$i}"; } $ttime = strtotime($ligne['zDate']); $ttime = strtotime("+{$MAX_TTL} minutes", $ttime); $html = "<div style='font-size:26px;margin-bottom:16px'>{$ID}</div>\n\t<p class=explain style='font-size:16px'>{next_check}:" . $tpl->time_to_date($ttime) . "</p>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{enforce_level}:</td>\n\t\t\t<td>" . Field_array_Hash($ENFORCE, "level-{$t}", $ligne["level"], "style:font-size:18px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{enabled}:</td>\n\t\t\t<td>" . Field_checkbox("enabled-{$t}", $ligne["enabled"], 1, "enabledCheck{$t}()") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{only_pictures}:</td>\n\t\t\t<td>" . Field_checkbox("OnlyImages-{$t}", $ligne["OnlyImages"], 1) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{only_multimedia}:</td>\n\t\t\t<td>" . Field_checkbox("OnlyMultimedia-{$t}", $ligne["OnlyMultimedia"], 1) . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{only_internet_documents}:</td>\n\t\t\t<td>" . Field_checkbox("OnlyeDoc-{$t}", $ARRAY["OnlyeDoc"], 1) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:18px'>{only_files}:</td>\n\t\t\t<td>" . Field_checkbox("OnlyFiles-{$t}", $ARRAY["OnlyFiles"], 1) . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "Save{$t}()", 26) . "</td>\n\t\t</tr>\n</table>\n</div>\n<script>\nvar xSave{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);return;}\n\t\$('#flexRT{$_GET["SourceT"]}').flexReload();\n\tYahooWin2Hide();\n\t\n}\n\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('level',document.getElementById('level-{$t}').value);\n\tXHR.appendData('edit-www','{$ID}');\n\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n\tif(document.getElementById('OnlyImages-{$t}').checked){XHR.appendData('OnlyImages',1);}else{XHR.appendData('OnlyImages',0);}\n\tif(document.getElementById('OnlyeDoc-{$t}').checked){XHR.appendData('OnlyeDoc',1);}else{XHR.appendData('OnlyeDoc',0);}\n\tif(document.getElementById('OnlyFiles-{$t}').checked){XHR.appendData('OnlyFiles',1);}else{XHR.appendData('OnlyFiles',0);}\t\n\tif(document.getElementById('OnlyMultimedia-{$t}').checked){XHR.appendData('OnlyMultimedia',1);}else{XHR.appendData('OnlyMultimedia',0);}\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n\nfunction enabledCheck{$t}(){\n\tdocument.getElementById('level-{$t}').disabled=true;\n\tdocument.getElementById('OnlyImages-{$t}').disabled=true;\n\tdocument.getElementById('OnlyeDoc-{$t}').disabled=true;\n\tdocument.getElementById('OnlyFiles-{$t}').disabled=true;\n\tdocument.getElementById('OnlyMultimedia-{$t}').disabled=true;\n\tif(!document.getElementById('enabled-{$t}').checked){return;}\n\tdocument.getElementById('OnlyImages-{$t}').disabled=false;\n\tdocument.getElementById('OnlyeDoc-{$t}').disabled=false;\n\tdocument.getElementById('OnlyFiles-{$t}').disabled=false;\n\tdocument.getElementById('OnlyMultimedia-{$t}').disabled=false;\n\tdocument.getElementById('level-{$t}').disabled=false;\t\n}\nenabledCheck{$t}();\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function build_graph() { $zmd5 = $_GET["zmd5"]; $page = CurrentPageName(); $tpl = new templates(); $t = time(); $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT params FROM reports_cache WHERE `zmd5`='{$zmd5}'")); $params = unserialize($ligne["params"]); $from = $tpl->time_to_date($params["FROM"], true); $to = $tpl->time_to_date($params["TO"], true); $interval = $params["INTERVAL"]; if ($interval == 0) { $interval = "1h"; } $user = $params["USER"]; $user_data = $params["SEARCH"]; $title = "{user_report}: {from} {$from} {to} {$to} {$interval} {member}:{$user}/{$user_data}"; $html = "\n\t<center style='font-size:20px;margin-bottom:20px'>{$title}</center>\n\t<div style='width:1150px;height:550px;margin-bottom:10px' id='graph-{$t}'></div>\n\t\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=90%>\n\t\t\t<div style='width:800px;height:550px' id='graph2-{$t}'></div>\n\t\t</td>\n\t\t<td style='width:5%;vertical-align:top'>\n\t\t\t<div id='table1-{$t}'></div>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2><p> </p></td>\n\t</tr>\n\n\t\n\t<tr>\n\t\t<td width=90%>\n\t\t\t<div style='width:800px;height:550px' id='graph4-{$t}'></div>\n\t\t</td>\n\t\t<td style='width:5%;vertical-align:top'>\n\t\t\t<div id='table4-{$t}'></div>\n\t\t</td>\n\t</tr>\t\n\t\n\t\n\t</table>\n\t<script>\n\t\tLoadjs('{$page}?graph1=yes&container=graph-{$t}&zmd5={$zmd5}&t={$t}');\n\t</script>\n\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function server_status() { $PHP5_CURRENT_MEMORY = null; if (!$GLOBALS["VERBOSE"]) { if (!isset($_GET["without-cache"])) { unset($_GET["_"]); $md5CacheF = md5("server_status{$_SESSION["uid"]}{$tpl->language}" . serialize($_GET)); $cachefile = "/usr/share/artica-postfix/ressources/interface-cache/{$md5CacheF}"; if (file_time_sec_Web($cachefile) < 10) { return @file_get_contents($cachefile); } } } $BOGOMIPS = 0; if (is_file("/usr/share/artica-postfix/ressources/interface-cache/processor_type")) { $processor_type = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/interface-cache/processor_type")); $BOGOMIPS = intval($processor_type["BOGOMIPS"]); } $icon = "server-128-ok.png"; $os = new os_system(); $sock = new sockets(); $users = new usersMenus(); $Warn = false; $HyperWarn = true; $tpl = new templates(); $EnableMsftncsi = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableMsftncsi")); $EnableIntelCeleron = intval($sock->GET_INFO("EnableIntelCeleron")); $ArticaAutoUpateOfficial = $sock->GET_INFO("ArticaAutoUpateOfficial"); $ArticaAutoUpateNightly = intval($sock->GET_INFO("ArticaAutoUpateNightly")); $ArticaUpdateIntervalAllways = intval($sock->GET_INFO("ArticaUpdateIntervalAllways")); if (!is_numeric($ArticaAutoUpateOfficial)) { $ArticaAutoUpateOfficial = 1; } $RootPasswordChanged = intval($sock->GET_INFO("RootPasswordChanged")); $influxdb_version = @file_get_contents("{$GLOBALS["BASEDIR"]}/influxdb_version"); $influxdbversionBin = $influxdb_version; $RegisterCloudBadEmail = intval($sock->GET_INFO("RegisterCloudBadEmail")); $InfluxUseRemote = intval($sock->GET_INFO("InfluxUseRemote")); $InfluxUseRemoteInfo = intval($sock->GET_INFO("InfluxUseRemoteInfo")); $SessionPathInMemory = intval($sock->GET_INFO("SessionPathInMemory")); $EnableBandwithCalculation = intval($sock->GET_INFO("EnableBandwithCalculation")); $DashBoardDNSPerfsStats = $sock->GET_INFO("DashBoardDNSPerfsStats"); $BigDatav3Read = intval($sock->GET_INFO("BigDatav3Read")); $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient")); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); $ArticaTechNetInfluxRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetInfluxRepo"))); $LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos"))); $EnableArticaMetaServer = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableArticaMetaServer")); if ($EnableArticaMetaServer == 1) { $EnableArticaMetaClient = 0; } if ($EnableArticaMetaClient == 1) { $ArticaMetaHost = $sock->GET_INFO("ArticaMetaHost"); if ($ArticaMetaHost == null) { $err[] = proxy_status_warning("{incorrect_meta_server_address}", "{click_to_edit}", "GotoArticaMeta()"); } } if ($SessionPathInMemory > 0) { exec("/bin/df -h /var/lib/php5 2>&1", $results); while (list($num, $ligne) = each($results)) { if (!preg_match("#tmpfs\\s+(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)%\\s+#", $ligne, $re)) { continue; } $PHP5_CURRENT_MEMORY = $re[4]; $PHP5_CURRENT_MEMORY_SIZE = $re[1]; } } if (!is_file("/usr/share/artica-postfix/ressources/interface-cache/CPU_NUMBER")) { $sock = new sockets(); $CPU_NUMBER = intval($sock->getFrameWork("services.php?CPU-NUMBER=yes")); } else { $CPU_NUMBER = intval(@file_get_contents("/usr/share/artica-postfix/ressources/interface-cache/CPU_NUMBER")); } if ($CPU_NUMBER < 2) { if ($EnableIntelCeleron == 0) { $warn[] = status_important_event("{performance_issue_cpu_number_text}", "{click_to_fix}", "GotoOptimizeSystem()"); } } if ($EnableMsftncsi == 1) { $msftncsiStatus = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/msftncsiStatus")); if ($msftncsiStatus == 3) { $warn[] = status_important_event("{network_awareness} !!", "", "GotoWatchdog()"); } } $results = array(); exec("/usr/bin/pgrep -l -f \"philesight --db\" 2>&1", $results); while (list($num, $ligne) = each($results)) { $ligne = trim($ligne); if ($ligne == null) { continue; } if (preg_match("#pgrep#", $ligne)) { continue; } if (!preg_match("#^([0-9]+)\\s+#", $ligne)) { $warn[] = status_important_event("{APP_PHILESIGHT_INDEXING}", null, "blur()"); break; } } $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\""; $os->html_Memory_usage(); $EnableKerbAuth = intval($sock->GET_INFO("EnableKerbAuth")); $MAIN = $os->meta_array; $PHP5_CURRENT_MEMORY_COLOR = "black"; $LOAD_COLOR = "black"; $ORG_LOAD = $MAIN["LOAD"]["ORG_LOAD"]; $CPU_NUMBER = $MAIN["LOAD"]["CPU_NUMBER"]; $MAXOVER = $MAIN["LOAD"]["MAXOVER"]; $MEM_USED_POURC = $MAIN["MEM"]["MEM_USED_POURC"]; $MEM_USED_COLOR = "black"; $SWAP_POURC = $MAIN["SWAP_POURC"]; $DISKY = array(); $MAXOVER2 = $CPU_NUMBER - 1; if ($MAXOVER2 == 0) { $MAXOVER2 = 1.5; } $EnableIntelCeleronText = null; $CURVER = @file_get_contents("VERSION"); $CURVER_KEY = str_replace(".", "", $CURVER); if ($EnableIntelCeleron == 1) { $EnableIntelCeleronText = "{intel_celeron_support}"; $MAXOVER2 = 2; } $INFO_WORKING_TASK = INFO_WORKING_TASK(); if (is_array($INFO_WORKING_TASK)) { $INFOS = $INFO_WORKING_TASK; } if (!$users->STATS_APPLIANCE) { if ($InfluxUseRemote == 0) { if ($EnableIntelCeleron == 0) { if ($InfluxUseRemoteInfo == 0) { if ($SquidPerformance < 2) { $INFOS[] = status_info_event("{suggest_remote_statistics_appliance}", "{suggest_remote_statistics_appliance}<br>{click_here}", "Loadjs('influx.remote.suggest.php')"); } } } } } if ($ORG_LOAD > $MAXOVER2) { $LOAD_COLOR = "#F59C44"; $Warn = true; $icon = "server-128-warn.png"; $microerror_text = "{overloaded} {$ORG_LOAD} » {$MAXOVER2}"; } $SWAPERR = false; if ($ORG_LOAD > $MAXOVER) { $HyperWarn = true; $LOAD_COLOR = "#D32D2D"; $icon = "server-128-critic.png"; $microerror_text = "{overloaded} {$ORG_LOAD} » {$MAXOVER}"; } if ($MEM_USED_POURC > 79) { $microerror_text = "{memory_warning}"; if (!$HyperWarn) { $icon = "server-128-warn.png"; } $MEM_USED_COLOR = "#F59C44"; $jsOn = "GotoSystemMemory()"; if (!$users->AsArticaAdministrator) { $jsOn = "blur()"; } $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle'>\n\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t<span style='text-decoration:underline' {$curs} OnClick=\"javascript:{$jsOn}\">{overloaded_memory}</span>\n\t\t</td></tr>"; $SWAPERR = true; } if ($MEM_USED_POURC > 90) { $microerror_text = "{memory_alert}"; $icon = "server-128-critic.png"; $MEM_USED_COLOR = "#D32D2D"; if (!$SWAPERR) { $jsOn = "GotoSystemMemory()"; if (!$users->AsArticaAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-warn.png"; $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle'>\n\t\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t\t<span style='text-decoration:underline' {$curs} OnClick=\"javascript:{$jsOn}\">{overloaded_memory}</span>\n\t\t\t</td></tr>"; $SWAPERR = true; } } if ($SWAP_POURC > 20) { if (!$HyperWarn) { $microerror_text = "{swap_warning}"; $icon = "server-128-warn.png"; } $SWAP_COLOR = "#F59C44"; } if ($PHP5_CURRENT_MEMORY > 80) { if (!$HyperWarn) { $microerror_text = "{swap_warning}"; $icon = "server-128-warn.png"; } $PHP5_CURRENT_MEMORY_COLOR = "#F59C44"; } if ($SWAP_POURC > 30) { if (!$HyperWarn) { $microerror_text = "{swap_warning}"; $icon = "server-128-warn.png"; } $SWAP_COLOR = "#D32D2D"; } if ($SWAP_POURC > 50) { $microerror_text = "{swap_alert}"; $icon = "server-128-critic.png"; $SWAP_COLOR = "#D32D2D"; $jsOn = "GotoSystemMemory()"; if (!$users->AsArticaAdministrator) { $jsOn = "blur()"; } $err[] = proxy_status_warning("{high_swap_value}", "{high_swap_value}", $jsOn); } if ($PHP5_CURRENT_MEMORY > 95) { if (!$HyperWarn) { $microerror_text = "{session_memory_warning}"; $icon = "server-128-warn.png"; } $PHP5_CURRENT_MEMORY_COLOR = "#D32D2D"; } if ($EnableIntelCeleron == 0) { $sock->getFrameWork("postgres.php?is-installed=yes"); $PostgresInstalled = intval($sock->GET_INFO("PostgresInstalled")); if ($PostgresInstalled == 0) { $jsOn = "Loadjs('influxdb.install.progress.php');"; if (!$users->AsArticaAdministrator) { $jsOn = "blur()"; } $err[] = proxy_status_warning("{influx_not_installed}", "{click_to_install}", $jsOn); } else { $influxdb_tests = influxdb_tests(); if ($influxdb_tests != null) { $err[] = $influxdb_tests; } } } if (isset($LicenseInfos["FINAL_TIME"])) { if (is_numeric($LicenseInfos["FINAL_TIME"])) { $FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]); $ExpiresSoon = intval(time_between_day_Web($FINAL_TIME)); $jsOn = "GoToArticaLicense()"; $distanceOfTimeInWords = distanceOfTimeInWords(time(), $FINAL_TIME); if (!$users->AsSystemAdministrator) { $jsOn = null; } $corporate_licence_will_expire_explain = $tpl->_ENGINE_parse_body("{corporate_licence_will_expire_explain}"); $corporate_licence_will_expire_explain = str_replace("%d", $ExpiresSoon, $corporate_licence_will_expire_explain); if (time() > $FINAL_TIME) { $err[] = proxy_status_warning("{license2}: {license_expired} !!", "{license_expired_explain}", $jsOn); } if ($FINAL_TIME > time()) { if ($ExpiresSoon < 10) { $err[] = proxy_status_warning("{corporate_licence_will_expire} ({$ExpiresSoon} {days})", "{$corporate_licence_will_expire_explain}", $jsOn); } if ($ExpiresSoon < 31) { $ExpiresSoon = $ExpiresSoon + 1; $warn[] = status_important_event("{license2}: {trial_period} - {$ExpiresSoon} {days} -", "{expiredate}:" . $tpl->time_to_date($FINAL_TIME) . " ({$distanceOfTimeInWords})", $jsOn); } } } } if (!$users->CGROUPS_INSTALLED) { $jsOn = "Loadjs('cgroups.install.progress.php');"; if (!$users->AsArticaAdministrator) { $jsOn = "blur()"; } $warn[] = status_important_event("{cgroups_not_installed}", "{click_to_install}", $jsOn); } if ($RegisterCloudBadEmail == 1) { $warn[] = status_important_event("{incorrect_email_address}", "{incorrect_email_address_cloud}", "GoToArticaLicense()"); } if (!extension_loaded('pgsql')) { $warn[] = status_important_event("{missing_postgres_library}", "{missing_postgres_library_explain}", "Loadjs('admin.pgsql.php')"); } else { if (!function_exists("pg_connect")) { $warn[] = status_important_event("{missing_postgres_library}", "{missing_postgres_library_explain}", "Loadjs('admin.pgsql.php')"); } } if ($BOGOMIPS > 0) { if ($users->CGROUPS_INSTALLED) { if ($BOGOMIPS < 3500) { if ($EnableIntelCeleron == 0) { $jsOn = "Loadjs('system.optimize.celeron.wizard.php');"; $err[] = status_important_event("{low_performance}", "{low_performance_link_explain}", $jsOn); } } } } $q = new mysql(); $perfs_queue = $q->COUNT_ROWS("perfs_queue", "artica_events"); if ($perfs_queue > 0) { $dashboard_perfs_queue = $tpl->_ENGINE_parse_body("{dashboard_perfs_queue}"); $dashboard_perfs_queue = str_replace("%s", $perfs_queue, $dashboard_perfs_queue); $warn[] = status_important_event($dashboard_perfs_queue, "{$dashboard_perfs_queue}", "GotoDashBoardPerfQueue()"); } $HostType = null; if ($users->VMWARE_HOST) { $HostType = "VMWare Edition"; $HostTypejs = "GotoVMWareClient();"; if (trim($sock->getFrameWork("services.php?vmtools_installed=yes")) != "TRUE") { $jsOn = "Loadjs('vmware.install.progress.php');"; if (!$users->AsArticaAdministrator) { $jsOn = "blur()"; } $warn[] = status_important_event("{APP_VMWARE_TOOLS_NOT_INSTALLED}", "{click_to_install}", $jsOn); } } if (is_array($MAIN["DISKS"])) { while (list($disk, $array) = each($MAIN["DISKS"])) { $POURC = $array["POURC"]; $LABEL = $array["LABEL"]; if ($LABEL == null) { $LABEL = $disk; } if ($POURC < 80) { continue; } $DISK_COLOR = "#F59C44"; $icon = "server-128-warn.png"; $microerror_text = "{partition_warning}"; $diskZ = "\t\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px;color:{$DISK_COLOR}'>{$LABEL} {$POURC}% {used}</td>\n\t\t\t</tr>"; if ($POURC > 95) { $DISK_COLOR = "#D32D2D"; $icon = "server-128-critic.png"; $diskZ = "\t<tr>\n\t\t\t<td style='font-size:20px;color:{$DISK_COLOR}'>{$LABEL} {$POURC}% {used}</td>\n\t\t\t</tr>"; } $DISKY[] = $diskZ; } } if ($RootPasswordChanged == 0) { $jsOn = "Loadjs('system.root.pwd.php')"; if (!$users->AsSystemAdministrator) { $jsOn = null; } $err[] = status_important_event("{root_password_not_changed}", "{root_password_not_changed_text}", $jsOn); } if (count($err) > 0) { $errT[] = "<tr><td style='font-size:32px;color:#d32d2d;vertical-align:middle'>" . count($err) . " {issues}</td></tr>\n\t\t<tr><td colspan=2> </td></tr>\n\t\t"; } $GotoSpeedTests = "GotoSpeedTests()"; $GotoBandwidthdStats = "GotoBandwidthdStats()"; $GoToSystem = "GoToSystem()"; $GotToArticaUpdate = "GotToArticaUpdate()"; $GotoOptimizeSystem = "GotoOptimizeSystem()"; $GotoDNSPerfs = "GotoDNSPerfs()"; $GotoSystemMemory = "GotoSystemMemory()"; $GotoStatsSystem = "GotoStatsSystem()"; $GotoStatsSystem_underline = "underline"; $HostTypejs_underline = "underline"; if (!$users->AsSystemAdministrator) { $microerror_text = null; $HostTypejs_underline = "none"; $GotoStatsSystem_underline = "none"; $HostTypejs = "blur();"; $GoToSystem = "blur()"; $GotoStatsSystem = "blur()"; $GotoSystemMemory = "blur()"; $GotoDNSPerfs = "blur()"; $GotoOptimizeSystem = "blur()"; $GotToArticaUpdate = "blur()"; $GotoBandwidthdStats = "blur()"; $GotoSpeedTests = "blur()"; } if ($EnableBandwithCalculation == 1) { $q = new mysql(); $sql = "SELECT * FROM speedtests ORDER BY zDate DESC LIMIT 0,1"; $speedtests = null; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $download = $ligne["download"]; $upload = $ligne["upload"]; $ISP = $ligne["ISP"]; //Kbi/s upload 51.2 Kbi/s if ($download > 0) { $speedtests = "\n\t\t\t\t<tr>\n\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px;'>\n\t\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:{$GotoSpeedTests};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t\t{bandwidth}: <i style='font-size:16px'>{$download}Kbit/sec {download2}</i></td>\n\t\t\t\t</tr><tr>\n\t\t\t\t<td style='font-size:16px;'>\n\t\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:{$GotoSpeedTests};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t\t{bandwidth}: <i style='font-size:16px'>{$upload}Kbit/sec {upload}</a> ({$ISP})</span></i></td>\n\t\t\t\t</tr>"; } } if ($sock->Bandwidthd_enabled() == 1) { $q = new mysql_squid_builder(); $bandwidthd_today = $q->COUNT_ROWS("bandwidthd_today"); if ($bandwidthd_today > 0) { $speedtests = $speedtests . "\n\t\t\t<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td valign='middle' style='width:25px'><img src='img/graph-24.png'></td>\n\t\t\t<td valign='middle'>\n\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$GotoBandwidthdStats};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t<span style='font-size:18px;font-weight:bold'>{$bandwidthd_today}</span> <span style='font-size:18px;'>{nodes}</span></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>"; } } if ($users->AsSystemAdministrator) { if ($EnableArticaMetaClient == 0) { if ($ArticaAutoUpateOfficial == 1) { $ArticaUpdateRepos = unserialize($sock->GET_INFO("ArticaUpdateRepos")); $key_nightly = update_find_latest_nightly($ArticaUpdateRepos); $key_offical = update_find_latest($ArticaUpdateRepos); $OFFICIALS = $ArticaUpdateRepos["OFF"]; $Lastest = $OFFICIALS[$key_offical]["VERSION"]; $MAIN_URI = $OFFICIALS[$key_offical]["URL"]; $MAIN_MD5 = $OFFICIALS[$key_offical]["MD5"]; $MAIN_FILENAME = $OFFICIALS[$key_offical]["FILENAME"]; if ($key_offical > $CURVER_KEY) { $err[] = "<tr><td style='font-size:18px;color:#46a346;vertical-align:middle' nowrap>\n\t\t\t\t<img src='img/32-install-soft.png' style='float:left;margin-right:10px'>\n\t\t\t\t" . texttooltip("{new_version}: {$Lastest}", "{NEW_RELEASE_TEXT}", "{$GotToArticaUpdate}") . "\n\t\t\t\t</td></tr>"; } } } } if ($EnableIntelCeleron == 1) { $EnableIntelCeleron_explain = "<tr><td style='font-size:16px;color:#000000;vertical-align:middle' nowrap>\n\t\t\t\t<i>" . texttooltip("{CELERON_METHOD}", "{CELERON_METHOD_EXPLAIN}", $GotoOptimizeSystem) . "</i>\n\t\t\t\t</td></tr>"; } $EnableDNSPerfs = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableDNSPerfs")); if ($EnableDNSPerfs == 1) { if ($EnableIntelCeleron == 0) { $DNS_COLOR = "black;"; if ($DashBoardDNSPerfsStats != null) { $DashBoardDNSPerfsStats = round($DashBoardDNSPerfsStats, 2); if ($DashBoardDNSPerfsStats < 30) { $DNS_COLOR = "#D32D2D"; } $DashBoardDNSPerfsStats_text = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-size:20px;color:{$DNS_COLOR}'>" . texttooltip("{dns_performance}", "{dnsperf_explain}", "{$GotoDNSPerfs}") . ": {$DashBoardDNSPerfsStats}%</td>\n\t\t\t\t\t</tr>"; } } } if ($microerror_text != null) { $microerror_text = "<center style='margin-top:10px;font-weight:bold;font-size:14px'>{$microerror_text}</center>"; } if ($HostType != null) { $HostType = "<center style='font-size:14px;margin-top:10px;'>\n\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$HostTypejs}\" style='text-decoration:{$HostTypejs_underline}'>\n\t\t{$HostType}</a></center>"; } $html[] = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' style='width:128px' {$curs} OnClick=\"javascript:{$GoToSystem}\">\n\t\t<img src='img/{$icon}'>{$HostType}{$microerror_text}\n\t</td>\n\t<td>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='font-size:30px' {$curs} OnClick=\"javascript:{$GoToSystem}\">{system}</td>\n\t</tr>\t\n\t<tr>\n\t<td style='font-size:30px;color:{$LOAD_COLOR};text-decoration:{$GotoStatsSystem_underline}' {$curs} OnClick=\"javascript:{$GotoStatsSystem};\">{$ORG_LOAD} {load2}</td>\n\t</tr>\n\t{$EnableIntelCeleron_explain}\n\t<tr>\n\t\t<td style='font-size:20px;'>\n\t\t<span style='color:{$MEM_USED_COLOR}'><a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:{$GotoSystemMemory};\" style='text-decoration:{$GotoStatsSystem_underline}'>\t\t\n\t\t{$MEM_USED_POURC}% {memory}</a></span> | \n\t\t<span style='color:{$SWAP_COLOR}'>{$SWAP_POURC}% SWAP</span></td>\n\t</tr>\n\t"; if ($users->AsSystemAdministrator) { if ($PHP5_CURRENT_MEMORY != null) { $html[] = "<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<span style='color:{$PHP5_CURRENT_MEMORY_COLOR}'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$GotoSystemMemory};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t{session_memory}: {$PHP5_CURRENT_MEMORY}%/{$PHP5_CURRENT_MEMORY_SIZE}</a></span></td>\n\t\t\t</tr>"; } } if ($users->AsSystemAdministrator) { if (is_file("/usr/share/artica-postfix/ressources/logs/web/monit.status.all")) { $dataMonit = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/monit.status.all")); $dataMonitCount = count($dataMonit); $html[] = "<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('monit.php');\" style='text-decoration:underline'>\n\t\t\t{monitored_processes}: {$dataMonitCount}</a></span></td>\n\t\t\t</tr>"; } } if (!$users->AsSystemAdministrator) { $INFOS = array(); $errT = array(); $err = array(); $warn = array(); } $html[] = $DashBoardDNSPerfsStats_text; if ($speedtests != null) { $html[] = $speedtests; } if (count($INFOS) > 0) { $html[] = @implode("", $INFOS); $html[] = "<tr><td colspan=2> </td></tr>"; } if (count($DISKY) > 0) { $html[] = @implode("", $DISKY); } $page = CurrentPageName(); $seqfw = "LoadAjaxRound('sequence-firewall','{$page}?sequence-firewall=yes');"; if (isset($_GET["nofw"])) { $seqfw = null; } $html[] = "" . @implode("", $errT) . "\n\t" . @implode("", $err) . @implode("", $warn) . "\n\t\t\t\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\n\tfunction LoadseQuenceProxy(){\n\t\tLoadAjaxSilent('sequence-proxy','{$page}?sequence-proxy=yes&nofw=yes&sequence=yes');\n\t\n\t}\n\t\n\n\tfunction LoadSequenceServer(){\n\t\t\tif( !document.getElementById('sequence-server')){return;}\n\t\t\t\n\t\t\tvar DASHBOARD_SEQUENCE_SERVER=parseInt(document.getElementById('DASHBOARD_SEQUENCE_SERVER').value);\n\t\t\tif(DASHBOARD_SEQUENCE_SERVER<10){\n\t\t\t\tDASHBOARD_SEQUENCE_SERVER=DASHBOARD_SEQUENCE_SERVER+1;\n\t\t\t\tdocument.getElementById('DASHBOARD_SEQUENCE_SERVER').value=DASHBOARD_SEQUENCE_SERVER;\n\t\t\t\tsetTimeout('LoadSequenceServer()',1000);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tdocument.getElementById('DASHBOARD_SEQUENCE_SERVER').value=0;\n\t\t\tLoadAjaxSilent('sequence-server','{$page}?sequence-server=yes&nofw=yes&sequence=yes');\n\t\t\tsetTimeout('LoadseQuenceProxy()',20000);\n\t\t}\n\tsetTimeout('LoadSequenceServer()',5000);\n\t</script>\t\t\n\t"; $html = $tpl->_ENGINE_parse_body(@implode("", $html)); @file_put_contents($cachefile, $html); return $html; }
function events_search() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); //$_POST["rp"]=intval($_POST["rp"])+10; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if ($_POST["query"] != null) { $search = base64_encode($_POST["query"]); $datas = unserialize(base64_decode($sock->getFrameWork("squid.php?cachelogs={$search}&rp={$_POST["rp"]}"))); $total = count($datas); } else { $datas = unserialize(base64_decode($sock->getFrameWork("squid.php?cachelogs=&rp={$_POST["rp"]}"))); $total = count($datas); } $pageStart = ($page - 1) * $rp; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { if ($_POST["sortname"] == "zDate") { if ($_POST["sortorder"] == "asc") { krsort($datas); } } $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (count($datas) == 0) { json_error_show("no data", 1); } $c = 0; $tpl = new templates(); $current = date("Y-m-d"); krsort($datas); while (list($key, $line) = each($datas)) { $date = " "; if (preg_match("#^([0-9\\.\\/\\s+:]+)\\s+#", $line, $re)) { $line = str_replace($re[1], "", $line); $date = strtotime($re[1]); $datetext = $tpl->time_to_date($date, true); } if (preg_match("#You should probably remove#i", $line)) { continue; } if (preg_match("#is ignored to keep splay#i", $line)) { continue; } if (preg_match("#is a subnetwork of#i", $line)) { continue; } if (preg_match("#violates HTTP#i", $line)) { continue; } if (preg_match("#empty ACL#i", $line)) { continue; } if (preg_match("#WARNING#i", $line)) { $line = "<span style='color:#f59c44'>{$line}</line>"; } if (preg_match("#FATAL#i", $line)) { $line = "<span style='color:#680000'>{$line}</line>"; } if (preg_match("#abnormally#i", $line)) { $line = "<span style='color:#680000'>{$line}</line>"; } if (preg_match("#Reconfiguring#i", $line)) { $line = "<span style='color:#003D0D;font-weight:bold'>{$line}</line>"; } if (preg_match("#Accepting HTTP#i", $line)) { $line = "<span style='color:#003D0D;font-weight:bold'>{$line}</line>"; } if (preg_match("#Ready to serve requests#i", $line)) { $line = "<span style='color:#003D0D;font-weight:bold'>{$line}</line>"; } $c++; $data['rows'][] = array('id' => md5($line), 'cell' => array("<span style='font-size:16px'>{$datetext}</span>", "<span style='font-size:16px'>{$line}</span>")); } $data['total'] = $c; echo json_encode($data); }
function node_infos_realtime() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $events = $tpl->_ENGINE_parse_body("{events}"); $zdate = $tpl->_ENGINE_parse_body("{zDate}"); $proto = $tpl->_ENGINE_parse_body("{proto}"); $uri = $tpl->_ENGINE_parse_body("{url}"); $member = $tpl->_ENGINE_parse_body("{member}"); $xtime = $tpl->time_to_date(strtotime('-1 hour'), true); $title = $tpl->_ENGINE_parse_body("{today}: {from} {$xtime} | {$_GET["MAC"]} | {$_GET["ipaddr"]} | {realtime_requests}"); $zoom = $tpl->_ENGINE_parse_body("{zoom}"); $button1 = "{name: 'Zoom', bclass: 'Search', onpress : ZoomSquidAccessLogs},"; $stopRefresh = $tpl->javascript_parse_text("{stop_refresh}"); $logs_container = $tpl->javascript_parse_text("{logs_container}"); $refresh = $tpl->javascript_parse_text("{refresh}"); $items = $tpl->_ENGINE_parse_body("{items}"); $size = $tpl->_ENGINE_parse_body("{size}"); $SaveToDisk = $tpl->_ENGINE_parse_body("{SaveToDisk}"); $addCat = $tpl->_ENGINE_parse_body("{add} {category}"); $date = $tpl->_ENGINE_parse_body("{zDate}"); $task = $tpl->_ENGINE_parse_body("{task}"); $new_schedule = $tpl->_ENGINE_parse_body("{new_rotate}"); $explain = $tpl->_ENGINE_parse_body("{explain_squid_tasks}"); $run = $tpl->_ENGINE_parse_body("{run}"); $task = $tpl->_ENGINE_parse_body("{task}"); $size = $tpl->_ENGINE_parse_body("{size}"); $filename = $tpl->_ENGINE_parse_body("{filename}"); $empty = $tpl->_ENGINE_parse_body("{empty}"); $askdelete = $tpl->javascript_parse_text("{empty_store} ?"); $files = $tpl->_ENGINE_parse_body("{files}"); $ext = $tpl->_ENGINE_parse_body("{extension}"); $back_to_events = $tpl->_ENGINE_parse_body("{back_to_events}"); $Compressedsize = $tpl->_ENGINE_parse_body("{compressed_size}"); $realsize = $tpl->_ENGINE_parse_body("{realsize}"); $delete_file = $tpl->javascript_parse_text("{delete_file}"); $rotate_logs = $tpl->javascript_parse_text("{rotate_logs}"); $table_size = 855; $url_row = 555; $member_row = 276; $table_height = 420; $distance_width = 230; $tableprc = "100%"; $margin = "-10"; $margin_left = "-15"; if (is_numeric($_GET["table-size"])) { $table_size = $_GET["table-size"]; } if (is_numeric($_GET["url-row"])) { $url_row = $_GET["url-row"]; } $hits = $tpl->javascript_parse_text("{hits}"); $ipaddr = $tpl->javascript_parse_text("{ipaddr}"); $error = $tpl->javascript_parse_text("{error}"); $sitename = $tpl->javascript_parse_text("{sitename}"); $html = "\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:100%'></table>\n\t</div>\n\t<script>\n\tvar mem{$t}='';\nfunction StartLogsSquidTable{$t}(){\n\t\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?node-infos-RTIME-LIST=yes&MAC={$_GET["MAC"]}&ipaddr={$_GET["ipaddr"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$zdate}', name : 'zDate', width :95, sortable : false, align: 'left'},\n\t{display: '{$sitename}', name : 'events', width : 746, sortable : false, align: 'left'},\n\t{display: '{$hits}', name : 'hits', width : 110, sortable : false, align: 'right'},\n\t{display: '{$size}', name : 'size', width : 110, sortable : false, align: 'right'},\n\t],\n\t\t\n\t\n\t\n\tsearchitems : [\n\t{display: '{$sitename}', name : 'SITE'},\n\n\t],\n\tsortname: 'zDate',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$title}',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 450,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200,500]\n\t\n\t});\n\t\n}\nsetTimeout('StartLogsSquidTable{$t}()',800);\n</script>\n"; echo $html; }
function mounts_events_query() { $tpl = new templates(); $pattern = base64_encode($_POST["query"]); $sock = new sockets(); $sock->getFrameWork("cmd.php?syslog-query={$pattern}&prefix=automount&rp={$_POST["rp"]}"); $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/syslog.query")); if (!is_array($array)) { json_error_show("no data"); } $fontsize = "16px"; $cs = 0; krsort($array); while (list($ey, $line) = each($array)) { $id = md5($line); if (!preg_match("#^(.+?)\\s+([0-9]+)\\s+([0-9:]+)\\s+.*?\\[[0-9]+\\]:\\s+(.+)#", $line, $re)) { continue; } $xdate = strtotime(date("Y-m") . "-{$re[2]} {$re[3]}"); $zdate = $tpl->time_to_date($xdate, true); $event = $re[4]; $data['rows'][] = array('id' => $id, 'cell' => array("<span style='font-size:{$fontsize}'>{$zdate}</a></span>", "<span style='font-size:{$fontsize}'>{$event}</span>")); $cs++; if ($cs > $_POST["rp"]) { break; } } $data['total'] = $cs; echo json_encode($data); return; }
function DATE_START() { if (isset($_SESSION["APACHE_GRAPH_DATE_START"])) { return $_SESSION["APACHE_GRAPH_DATE_START"]; } $tpl = new templates(); $q = new mysql_squid_builder(); $table = "dashboard_apache_sizes"; $sql = "SELECT MIN(TIME) as xmin, MAX(TIME) as xmax FROM {$table} "; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $time1 = $tpl->time_to_date(strtotime($ligne["xmin"]), true); $time2 = $tpl->time_to_date(strtotime($ligne["xmax"]), true); $_SESSION["APACHE_GRAPH_DATE_START"] = $tpl->javascript_parse_text("{date_start} {$time1}, {last_date} {$time2}"); return $_SESSION["APACHE_GRAPH_DATE_START"]; }
function DATE_START() { $tpl = new templates(); $q = new mysql_squid_builder(); $table = "dashboard_user_day"; if ($q->COUNT_ROWS($table) == 0) { $table = "dashboard_blocked_day"; } $sql = "SELECT MIN(TIME) as xmin, MAX(TIME) as xmax FROM {$table} "; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $time1 = $tpl->time_to_date(strtotime($ligne["xmin"]), true); $time2 = $tpl->time_to_date(strtotime($ligne["xmax"]), true); return $tpl->javascript_parse_text("{date_start} {$time1}, {last_date} {$time2}"); }
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 xqueries() { $page = CurrentPageName(); $tpl = new templates(); $influx = new influx(); $sql = "SELECT MAX(ZDATE) AS MAX FROM access_log"; $main = $influx->QUERY_SQL($sql); $MAX = $main[0]->MAX; $LastEntry = $tpl->time_to_date($MAX, true); if ($GLOBALS["VERBOSE"]) { echo "<p style='color:blue'>{$MAX} -> {$LastEntry}</p>"; } $from_gmt = $tpl->time_to_date($MAX - 300, true); $from = QueryToUTC($MAX - 300); $fromTime = date("Y-m-d H:i:s", $from); $ToTime = date("Y-m-d H:i:s", QueryToUTC($MAX)); $sql = "SELECT * from access_log WHERE time > '{$fromTime}' AND time < '{$ToTime}'"; //echo "<hr>$sql</HR>"; $main = null; $influx2 = new influx(); $QUERY2 = $influx2->QUERY_SQL($sql); $color = null; $ipClass = new IP(); $q = new mysql_squid_builder(); $c = 0; $D = 0; foreach ($QUERY2 as $row) { $USER = trim($row->USERID); $IPADDR = trim($row->IPADDR); $MAC = trim($row->MAC); if ($row->SIZE == 0) { continue; } if (is_numeric($USER)) { continue; } $RQS = $row->RQS; $time = InfluxToTime($row->time); $DATEKEY = date("H:00", $time); $KEYMD5 = md5("{$USER}{$IPADDR}{$MAC}"); $c = $c + $RQS; $D = $D + $row->SIZE; if (!isset($MAIN[$DATEKEY][$KEYMD5])) { $MAIN[$DATEKEY][$KEYMD5]["USER"] = $USER; $MAIN[$DATEKEY][$KEYMD5]["IPADDR"] = $IPADDR; $MAIN[$DATEKEY][$KEYMD5]["MAC"] = $MAC; $MAIN[$DATEKEY][$KEYMD5]["SIZE"] = $row->SIZE; $MAIN[$DATEKEY][$KEYMD5]["RQS"] = $RQS; } else { $MAIN[$DATEKEY][$KEYMD5]["SIZE"] = $MAIN[$DATEKEY][$KEYMD5]["SIZE"] + $row->SIZE; $MAIN[$DATEKEY][$KEYMD5]["RQS"] = $MAIN[$DATEKEY][$KEYMD5]["RQS"] + $RQS; } } $D = FormatBytes($D / 1024); $requests = $tpl->javascript_parse_text("{requests}"); $last_entry_on = $tpl->javascript_parse_text("{last_entry_on}"); $since = $tpl->_ENGINE_parse_body("{since}"); $html[] = "\n\t\n\t<div style='width:98%' class=form>\n\t<div style='margin-top:5px;font-size:16px;text-align:right;margin-bottom:15px;font-weight:bold'>\n\t\t{$since} 5mn ({$c} {$requests} / {$D}) UTC:" . $tpl->time_to_date($from, true) . " - GMT {$from_gmt} / {$last_entry_on}: {$LastEntry}</div>"; $html[] = "\n\t\t\n\t<table style='width:100%'>"; $html[] = $tpl->_ENGINE_parse_body("<tr>\n\t\t\t<th style='font-size:18px'>{time}</th>\n\t\t\t<th style='font-size:18px'>{MAC}</th>\n\t\t\t<th style='font-size:18px'>{ipaddr}</th>\n\t\t\t<th style='font-size:18px'>{uid}</th>\n\t\t\t<th style='font-size:18px'>{requests}</th>\n\t\t\t<th style='font-size:18px'>{size}</th>\n\t\t\t</tr>\n\t\t\t"); while (list($time, $SUBARRAY) = each($MAIN)) { while (list($KEYMD5, $BIGARRAY) = each($SUBARRAY)) { if ($color == null) { $color = "#F2F0F1"; } else { $color = null; } $MAC = $BIGARRAY["MAC"]; $RQS = $BIGARRAY["RQS"]; $SIZE = $BIGARRAY["SIZE"]; $USER = $BIGARRAY["USER"]; $IPADDR = $BIGARRAY["IPADDR"]; $MAC_link = null; if ($SIZE > 1024) { $size = FormatBytes($SIZE / 1024); } else { $size = "{$SIZE}Bytes"; } $RQS = FormatNumber($RQS); if ($ipClass->IsvalidMAC($MAC)) { $MAC_link = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&MAC=" . urlencode($MAC) . "');\"\n\t\t\tstyle='font-size:16px;text-decoration:underline;font-weight:bold'>\t\t\n\t\t\t"; if (trim($USER) == null) { $USER = $q->MacToUid($MAC); } } $html[] = "<tr style='background-color:{$color}'>"; $html[] = "<td style='font-size:16px;width:50px;padding:10px;font-weight:bold'>{$time}</td>"; $html[] = "<td style='font-size:16px;width:50px;padding:10px;font-weight:bold'>{$MAC_link}{$MAC}</a></td>"; $html[] = "<td style='font-size:16px;width:50px;padding:10px;font-weight:bold'>{$IPADDR}</td>"; $html[] = "<td style='font-size:16px;width:50px;padding:10px;font-weight:bold'>{$USER}</td>"; $html[] = "<td style='font-size:16px;width:50px;text-align:right;padding:10px' nowrap>{$RQS}</td>"; $html[] = "<td style='font-size:16px;width:50px;text-align:right;padding:10px' nowrap>{$size}</td>"; $html[] = "</tr>"; } } $html[] = "</table>"; $html[] = "</div>"; $html[] = "\n\t<script>\n\t\tfunction FollowerRefresh(){\n\t\t\tif(!document.getElementById('ZRTRQUESTS_COMPTER')){ return;}\n\t\t\tvar compter=parseInt(document.getElementById('ZRTRQUESTS_COMPTER').value);\n\t\t\tif(compter<10){\n\t\t\t\tcompter=compter+1;\n\t\t\t\tdocument.getElementById('ZRTRQUESTS_COMPTER').value=compter;\n\t\t\t\tsetTimeout(\"FollowerRefresh()\",1000);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tdocument.getElementById('ZRTRQUESTS_COMPTER').value=0;\n\t\t\tif(!document.getElementById('proxy-follower-table')){ return;}\n\t\t\tLoadAjaxSilent('proxy-follower-table','{$page}?follow=yes&t={$_GET["t"]}');\n\t\t}\n\t\t\t\n\t\t\t\n\tsetTimeout(\"FollowerRefresh()\",1000);\n\t</script>"; echo @implode("\n", $html); }
function search() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $database = "artica_events"; $t = $_GET["t"]; $search = '%'; $page = 1; $FORCE_FILTER = null; $total = 0; $table = "last_boot"; 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) { $search = $_POST["query"]; $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if (!is_numeric($rp)) { $rp = 1; } $pageStart = ($page - 1) * $rp; if (!is_numeric($rp)) { $rp = 50; } $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql, $database); $data = array(); $data['page'] = $page; $data['total'] = $total + 1; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error, 0); } if (mysql_num_rows($results) == 0) { json_error_show("no data"); } $fontsize = 20; $tpl = new templates(); while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; //if($ligne["enabled"]==0){$color="#8a8a8a";} $style = "style='font-size:{$fontsize}px;color:{$color};'"; $ms5 = $ligne["zmd5"]; $js = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?sys_alerts-js=yes&md5={$ms5}&t={$t}');\"\n\t\tstyle='font-size:{$fontsize}px;color:{$color};text-decoration:underline'>"; $time = $ligne["ztime"]; $time2 = $ligne["ztime2"]; $date2 = $tpl->javascript_parse_text(distanceOfTimeInWords($time, time(), true)); if ($time2 > 0) { $date2 = $tpl->javascript_parse_text(distanceOfTimeInWords($time2, $time, true)); } $date = $tpl->time_to_date($time, true); $subject = $ligne["subject"]; $data['rows'][] = array('id' => $ms5, 'cell' => array("<span {$style}>{$date}</a></span>", "<span {$style}>{$subject}</a></span>", "<span {$style}>{$date2}</a></span>")); } echo json_encode($data); }
function status() { $sock = new sockets(); $users = new usersMenus(); $UseRemoteUfdbguardService = intval($sock->GET_INFO("UseRemoteUfdbguardService")); if ($UseRemoteUfdbguardService == 1) { status_client(); exit; } $shield_ok = "shield-ok-256.png"; $shield_disabled = "shield-grey-256.png"; $shield_red = "shield-red-256.png"; $shield_warn = "shield-warn-256.png"; $ini = new Bs_IniHandler(); $err = array(); $tpl = new templates(); $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\""; if ($sock->EnableUfdbGuard() == 0) { echo "<center><img src='img/{$shield_disabled}'></center>"; return; } $ini->loadString(base64_decode($sock->getFrameWork("squid.php?ufdbguardd-all-status=yes"))); $c = 0; while (list($key, $array) = each($ini->_params)) { $service_name = $array["service_name"]; $service_disabled = intval($array["service_disabled"]); if ($service_disabled == 0) { continue; } $running = intval($array["running"]); $c++; if ($running == 0) { $icon = "disks-128-warn.png"; $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle' OnClick=\"javascript:GoToServices()\">\n\t\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t\t{{$service_name}} <span style='text-decoration:underline' {$curs}> {stopped}</span></td></tr>"; } } if (count($err) > 0) { echo "<center><img src='img/{$shield_red}'></center>\n\t\t<table>" . @implode("\n", $err) . "</table>"; } else { echo "<center><img src='img/{$shield_ok}'></center>"; } $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient")); if ($EnableArticaMetaClient == 1) { $LOCAL_VERSION_TEXT = $tpl->time_to_date($sock->GET_INFO("UfdbMetaClientVersion")); } else { $MAINARR = unserialize(base64_decode($sock->GET_INFO("CATZ_ARRAY"))); $LOCAL_VERSION_TEXT = $tpl->time_to_date($MAINARR["TIME"]); } echo $tpl->_ENGINE_parse_body("<center style='font-size:22px;margin-top:10px;font-weight:bold'>{running}</center>"); echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{since}: {$ini->_params["APP_UFDBGUARD"]["uptime"]}</center>"); echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{memory}: " . FormatBytes($ini->_params["APP_UFDBGUARD"]["master_memory"]) . "</center>"); echo "<hr>"; echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{version}: {$LOCAL_VERSION_TEXT}</center>"); }
function search() { $MyPage = CurrentPageName(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql(); $table = "backuped_logs"; if (!$q->TABLE_EXISTS("backuped_logs", "artica_events")) { json_error_show("no data (no table)", 1); } $searchstring = string_to_flexquery(); $page = 1; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); if (!$q->ok) { json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1); } $total = $ligne["tcount"]; if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if (!is_numeric($rp)) { $rp = 50; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} "; $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { if ($q->mysql_error != null) { json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1); } } if (mysql_num_rows($results) == 0) { json_error_show("no data", 1); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $fontsize = "18"; $style = " style='font-size:{$fontsize}px'"; $styleHref = " style='font-size:{$fontsize}px;text-decoration:underline'"; $free_text = $tpl->javascript_parse_text("{free}"); $computers = $tpl->javascript_parse_text("{computers}"); $overloaded_text = $tpl->javascript_parse_text("{overloaded}"); $orders_text = $tpl->javascript_parse_text("{orders}"); $directories_monitor = $tpl->javascript_parse_text("{directories_monitor}"); while ($ligne = mysql_fetch_assoc($results)) { $LOGSWHY = array(); $overloaded = null; $loadcolor = "black"; $StatHourColor = "black"; $expl = null; $ColorTime = "black"; $uuid = $ligne["uuid"]; $xdate = strtotime($ligne["zDate"]); $date = $tpl->time_to_date($xdate, true); $basename = basename($ligne["path"]); $size = FormatBytes($ligne["size"] / 1024); $icon_warning_32 = "warning32.png"; $icon_red_32 = "32-red.png"; $icon = "ok-32.png"; $link = "<a href=\"{$MyPage}?download=" . base64_encode($ligne["path"]) . "\"\n\t\t\tstyle='text-decoration:underline;'\n\t\t\t>"; $path_encoded = urlencode($ligne["path"]); if (preg_match("#([0-9]+)-([0-9]+)-([0-9]+)_([0-9]+)-([0-9]+)-([0-9]+)--([0-9]+)-([0-9]+)-([0-9]+)_([0-9]+)-([0-9]+)-([0-9]+)\\.gz\$#", $basename, $re)) { $zdate = "{$re[1]}-{$re[2]}-{$re[3]} {$re[4]}:{$re[5]}:{$re[6]}"; $zdate2 = "{$re[7]}-{$re[8]}-{$re[9]} {$re[10]}:{$re[11]}:{$re[12]}"; $xdate = strtotime($zdate); $datefrom = $tpl->time_to_date($xdate, true); $xdate = strtotime($zdate2); $dateto = $tpl->time_to_date($xdate, true); $expl = $tpl->_ENGINE_parse_body("<br><i style='font-size:12px'>{from}:{$datefrom} {to} {$dateto}</i>"); } $delete = imgtootltip("delete-32.png", null, "Loadjs('{$MyPage}?unlink-js={$path_encoded}')"); if (preg_match("#^\\/mnt\\/", $ligne["path"])) { $link = null; $delete = " "; } $cell = array(); $cell[] = "<span {$style}>{$link}{$date}</a></span>"; $cell[] = "<span {$style}>{$basename}</a>{$expl}</span>"; $cell[] = "<span {$style}>{$size}</a></span>"; $cell[] = "{$delete}"; $data['rows'][] = array('id' => $ligne['zmd5'], 'cell' => $cell); } echo json_encode($data); }
function page() { $t = time(); $tpl = new templates(); $page = CurrentPageName(); $users = new usersMenus(); 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>"); } $ARTICA_DBS_STATUS = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/ARTICA_DBS_STATUS_FULL.db")); $array = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/cache/articatechdb.progress")); $text = $array["TEXT"]; $purc = intval($array["POURC"]); $array = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/cache/toulouse.progress")); $text1 = $array["TEXT"]; $purc1 = intval($array["POURC"]); $array = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/cache/webfilter-artica.progress")); $text2 = $array["TEXT"]; $purc2 = intval($array["POURC"]); $date = $ARTICA_DBS_STATUS["ARTICA_DB_TIME"]; $LOCAL_VERSION = $date; $LOCAL_VERSION_TEXT = $tpl->time_to_date($date); $CountDecategories = $ARTICA_DBS_STATUS["CAT_ARTICA_ITEMS_NUM"]; if (!is_numeric($CountDecategories)) { $CountDecategories = 0; } $CountDecategories = numberFormat($CountDecategories, 0, "", " "); $CAT_STATS_PERCENT = intval($ARTICA_DBS_STATUS["CAT_STATS_PERCENT"]); $CAT_STATS_SIZE = intval($ARTICA_DBS_STATUS["CAT_STATS_SIZE"]); $CAT_STATS_COUNT = intval($ARTICA_DBS_STATUS["CAT_STATS_COUNT"]); $TLSE_PRC = intval($ARTICA_DBS_STATUS["TLSE_PRC"]); $TLSE_STAT_SIZE = intval($ARTICA_DBS_STATUS["TLSE_STAT_SIZE"]); $TLSE_COUNT = intval($ARTICA_DBS_STATUS["TLSE_COUNT"]); $TLSE_STAT_ITEMS = numberFormat(intval($ARTICA_DBS_STATUS["TLSE_STAT_ITEMS"]), 0, "", " "); $TLSE_LAST_SINCE = $ARTICA_DBS_STATUS["TLSE_LAST_SINCE"]; $TLSE_LAST_CAT = $ARTICA_DBS_STATUS["TLSE_LAST_CAT"]; $TLSE_LAST_SIZE = $ARTICA_DBS_STATUS["TLSE_LAST_SIZE"]; $TLSE_LAST_CHECK = $ARTICA_DBS_STATUS["TLSE_LAST_CHECK"]; if ($TLSE_LAST_SINCE == 0) { $TLSE_LAST_SINCE = "-"; } if ($TLSE_LAST_CAT == null) { $TLSE_LAST_CAT = "-"; } if (!is_numeric($TLSE_LAST_SIZE)) { $TLSE_LAST_SIZE = 0; } $CAT_ARTICA_PRC = intval($ARTICA_DBS_STATUS["CAT_ARTICA_PRC"]); $CAT_ARTICA_SIZE = intval($ARTICA_DBS_STATUS["CAT_ARTICA_SIZE"]); $CAT_ARTICA_COUNT = intval($ARTICA_DBS_STATUS["CAT_ARTICA_COUNT"]); $CAT_ARTICA_SINCE = $ARTICA_DBS_STATUS["CAT_ARTICA_SINCE"]; $CAT_ARTICA_LAST_CAT = $ARTICA_DBS_STATUS["CAT_ARTICA_LAST_CAT"]; $CAT_ARTICA_LAST_SIZE = $ARTICA_DBS_STATUS["CAT_ARTICA_LAST_SIZE"]; $CAT_ARTICA_LAST_ERROR = $ARTICA_DBS_STATUS["CAT_ARTICA_LAST_ERROR"]; if ($CAT_ARTICA_SINCE == null) { $CAT_ARTICA_SINCE = "-"; } if ($CAT_ARTICA_LAST_CAT == null) { $CAT_ARTICA_LAST_CAT = "-"; } if (!is_numeric($CAT_ARTICA_LAST_SIZE)) { $CAT_ARTICA_LAST_SIZE = 0; } if (!is_numeric($CAT_ARTICA_LAST_ERROR)) { $CAT_ARTICA_LAST_ERROR = 0; } $CAT_STATS_SINCE = $ARTICA_DBS_STATUS["CAT_STATS_SINCE"]; $CAT_STATS_LAST_CAT = $ARTICA_DBS_STATUS["CAT_STATS_LAST_CAT"]; $CAT_STATS_LAST_SIZE = $ARTICA_DBS_STATUS["CAT_STATS_LAST_SIZE"]; $CAT_STATS_LAST_ERROR = $ARTICA_DBS_STATUS["CAT_STATS_LAST_ERROR"]; $CAT_ARTICA_LAST_CHECK = $ARTICA_DBS_STATUS["CAT_ARTICA_LAST_CHECK"]; if (!is_numeric($CAT_STATS_LAST_SIZE)) { $CAT_STATS_LAST_SIZE = 0; } if (!is_numeric($CAT_STATS_LAST_ERROR)) { $CAT_STATS_LAST_ERROR = 0; } if ($CAT_STATS_SINCE == null) { $CAT_STATS_SINCE = "-"; } if ($CAT_STATS_LAST_CAT == null) { $CAT_STATS_LAST_CAT = "-"; } if ($TLSE_LAST_CHECK > 0) { $TLSE_LAST_CHECK = distanceOfTimeInWords($TLSE_LAST_CHECK, time(), true); } else { $TLSE_LAST_CHECK = "{never}"; } if ($CAT_ARTICA_LAST_CHECK > 0) { $CAT_ARTICA_LAST_CHECK = distanceOfTimeInWords($CAT_ARTICA_LAST_CHECK, time(), true); } else { $CAT_ARTICA_LAST_CHECK = "{never}"; } $ProductName = "Artica"; $ProductNamef = dirname(__FILE__) . "/ressources/templates/{$_COOKIE["artica-template"]}/ProducName.conf"; if (is_file($ProductNamef)) { $ProductName = trim(@file_get_contents($ProductNamef)); } $button_update = button("{update_now}", "Loadjs('dansguardian2.articadb-progress.php')", 32); $button_status = button("{databases_status}", "Loadjs('dansguardian2.databases.artica.php')", 32); if (!$users->CORP_LICENSE) { $license_error = "- «{license_error}»"; $button_update = null; $button_status = null; } $html = "\n\t<div style='margin-top:15px;margin-bottom:15px;text-align:right'>" . imgtootltip("refresh-32.png", null, "RefreshTab('main_webfiltering_updates')") . "</div>\n\n\t\n\t\n\t\n\t<div style='margin:20px;width:98%' class=form>\n\t<p> </p>\t\n\t<div style='margin-top:15px;font-size:26px'>{webfiltering_database} (Toulouse University)</div>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'> </td>\n\t\t<td style='font-size:18px;width:70%'>{$text1}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px;width:30%' nowrap>{download_progress}:</td>\n\t\t<td style='font-size:18px;width:70%'>\n\t\t\t<div id='progress1-{$t}' style='height:25px'></div>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{database_status}:</td>\n\t\t<td><div id='progressdb1-{$t}' style='height:25px'></div></td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{last_check}:</td>\n\t\t<td style='font-size:18px'>{$TLSE_LAST_CHECK}</td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{directory_size}:</td>\n\t\t<td style='font-size:18px'>" . FormatBytes($TLSE_STAT_SIZE) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{databases_number}:</td>\n\t\t<td style='font-size:18px'>{$TLSE_COUNT}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{websites}:</td>\n\t\t<td style='font-size:18px'>{$TLSE_STAT_ITEMS}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{last_download}:</td>\n\t\t<td style='font-size:18px'>{$TLSE_LAST_SINCE}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{last_category}:</td>\n\t\t<td style='font-size:18px'>{$TLSE_LAST_CAT}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{last_downloaded_size}:</td>\n\t\t<td style='font-size:18px'>" . FormatBytes($TLSE_LAST_SIZE) . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{events}:</td>\n\t\t<td style='font-size:18px'><a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('dansguardian2.databases.progress.events.php')\"\n\t\t\t\tstyle='font-size:18px;text-decoration:underline'\n\t\t\t\t>{events}</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td colspan=2 align='right'>" . button("{update_now}", "Loadjs('dansguardian2.univ-toulouse-progress.php')", 32) . "</td>\n\t</tr>\t\n\t\n\t</table>\t\n</div>\t\n\n<p> </p>\n<div style='margin:20px;width:98%' class=form>\n\t<div style='margin-top:15px;font-size:26px'>{webfiltering_database} ({$ProductName}) <span style='color:#BF0000'>{$license_error}</span></div>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'> </td>\n\t\t<td style='font-size:18px;width:70%'>{$text2}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px;width:30%' nowrap>{download_progress}:</td>\n\t\t<td style='font-size:18px;width:70%'>\n\t\t\t<div id='progress2-{$t}' style='height:25px'></div>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{database_status}:</td>\n\t\t<td><div id='progressdb2-{$t}' style='height:25px'></div></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{version}:</td>\n\t\t<td style='font-size:18px'>{$LOCAL_VERSION_TEXT}</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{last_check}:</td>\n\t\t<td style='font-size:18px'>{$CAT_ARTICA_LAST_CHECK}</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{directory_size}:</td>\n\t\t<td style='font-size:18px'>" . FormatBytes($CAT_ARTICA_SIZE) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{databases_number}:</td>\n\t\t<td style='font-size:18px'>{$CAT_ARTICA_COUNT}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{websites}:</td>\n\t\t<td style='font-size:18px'>{$CountDecategories}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{last_download}:</td>\n\t\t<td style='font-size:18px'>{$CAT_ARTICA_SINCE}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{last_category}:</td>\n\t\t<td style='font-size:18px'>{$CAT_ARTICA_LAST_CAT}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{last_downloaded_size}:</td>\n\t\t<td style='font-size:18px'>" . FormatBytes($CAT_ARTICA_LAST_SIZE) . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{errors}:</td>\n\t\t<td style='font-size:18px'>" . $CAT_ARTICA_LAST_ERROR . "</td>\n\t</tr>\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:18px'>{events}:</td>\n\t\t<td style='font-size:18px'><a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('dansguardian2.databases.progress.events.php')\"\n\t\t\t\tstyle='font-size:18px;text-decoration:underline'\n\t\t\t\t>{events}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'>\n\t\t\t{$button_update}</td>\n\t</tr>\n\t</table>\t\n\t\n\t<div id='progress2-{$t}' style='height:50px'></div>\t\n</div>\t\n\t<script>\n\t\t\$('#progress-{$t}').progressbar({ value: {$purc} });\n\t\t\$('#progressdb-{$t}').progressbar({ value: {$CAT_STATS_PERCENT} });\n\t\t\n\t\t\$('#progress1-{$t}').progressbar({ value: {$purc1} });\n\t\t\$('#progressdb1-{$t}').progressbar({ value: {$TLSE_PRC} });\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\$('#progress2-{$t}').progressbar({ value: {$purc2} });\n\t\t\$('#progressdb2-{$t}').progressbar({ value: {$CAT_ARTICA_PRC} });\n\t\t\n\t\t\n\t\n\tvar xToulouseDBUpdateNow= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t \t\n\t\t}\t\n\n\t\tfunction ToulouseDBUpdateNow(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('global-toulouse-status-update','yes');\n\t\t\tXHR.sendAndLoad('dansguardian2.databases.compiled.php', 'POST',xToulouseDBUpdateNow);\n\t\t}\n\n\t\tfunction ArticaDBDBUpdateNow(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('global-artica-filtersdb-update','yes');\n\t\t\tXHR.sendAndLoad('dansguardian2.databases.compiled.php', 'POST',xToulouseDBUpdateNow);\n\t\t}\t\t\t\n\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function search() { $MyPage = CurrentPageName(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_meta(); $table = "snapshots"; $database = null; $uuid = $_GET["uuid"]; $uuidenc = urlencode($uuid); $gpid = intval($_GET["gpid"]); if (!$q->TABLE_EXISTS($table, $database)) { json_error_show("no data - no table"); } $searchstring = string_to_flexquery(); $page = 1; $table = "(SELECT \n\t\tsnapshots.zmd5,snapshots.zDate,\n\t\tsnapshots.size,\n\t\tmetahosts.hostname,\n\t\tmetahosts.hostag\n\t\tFROM snapshots,metahosts WHERE metahosts.uuid=snapshots.uuid) as t"; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); if (!$q->ok) { json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1); } $total = $ligne["tcount"]; if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if (!is_numeric($rp)) { $rp = 50; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} "; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { if ($q->mysql_error != null) { json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1); } } if (mysql_num_rows($results) == 0) { json_error_show("no data", 0); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $fontsize = "14"; $style = " style='font-size:{$fontsize}px'"; $styleHref = " style='font-size:{$fontsize}px;text-decoration:underline'"; $free_text = $tpl->javascript_parse_text("{free}"); $computers = $tpl->javascript_parse_text("{computers}"); $overloaded_text = $tpl->javascript_parse_text("{overloaded}"); $orders_text = $tpl->javascript_parse_text("{orders}"); $directories_monitor = $tpl->javascript_parse_text("{directories_monitor}"); while ($ligne = mysql_fetch_assoc($results)) { $LOGSWHY = array(); $overloaded = null; $loadcolor = "black"; $StatHourColor = "black"; $ColorTime = "black"; $hostname = $ligne["hostname"]; $hostag = utf8_encode($ligne["hostag"]); $zmd5 = $ligne["zmd5"]; $icon_warning_32 = "warning32.png"; $icon_red_32 = "32-red.png"; $icon = "ok-32.png"; $xdate = $ligne["zDate"]; $xtime = strtotime($xdate); $date = $tpl->time_to_date($xtime, true); $size = FormatBytes($ligne["size"] / 1024); $urijs = "Loadjs('{$MyPage}?content-js=yes&ID={$ligne["ID"]}');"; $link = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$urijs}\" {$styleHref}>"; $delete = imgtootltip("delete-32.png", null, "Loadjs('{$MyPage}?unlink-js={$ligne["zmd5"]}')"); $restore = imgtootltip("32-import.png", null, "Loadjs('artica-meta.menus.php?snapshot-restore-js=yes&zmd5={$ligne["zmd5"]}&uuid={$uuidenc}&gpid={$gpid}')"); if ($uuid == null) { if ($gpid == 0) { $restore = " - "; } } $cell = array(); $cell[] = "<span {$style}>{$xdate}<br><i style='font-size:12px'>{$date}</i></a></span>"; $cell[] = "<span {$style}>{$hostname}<br><i style='font-size:12px'>{$hostag}</i></a></span>"; $cell[] = "<span {$style}>{$size}</a></span>"; $cell[] = $restore; $cell[] = "{$delete}"; $data['rows'][] = array('id' => $ligne['uuid'], 'cell' => $cell); } echo json_encode($data); }
function content_search() { $MyPage = CurrentPageName(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_meta(); $table = "snapshots"; $database = null; $ID = $_GET["ID"]; if (!$q->TABLE_EXISTS($table, $database)) { json_error_show("no data - no table"); } $searchstring = string_to_flexquery(); $page = 1; $q = new mysql_meta(); $table = "(SELECT hotspot_members.creationtime, hotspot_members.uid, metahosts.hostname,hotspot_members.uuid FROM \n\thotspot_members,metahosts WHERE hotspot_members.uuid=metahosts.uuid) as t"; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { json_error_show($q->mysql_error_html(), 1); } if (mysql_num_rows($results) == 0) { json_error_show("no data {$sql}"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error); } $fontsize = 22; $c = 1; // //service,server_port,client_port,helper,enabled $style = "style='font-size:18px'"; while ($ligne = mysql_fetch_assoc($results)) { $c++; $creationtime = $ligne["creationtime"]; $zdate = $tpl->time_to_date($creationtime, true); $uid = $ligne["uid"]; $hostname = $ligne["hostname"]; $key = md5(serialize($ligne)); $cell = array(); $cell[] = "<span {$style}>{$zdate}</a></span>"; $cell[] = "<span {$style}>{$uid}</a></span>"; $cell[] = "<span {$style}>{$hostname}</a></span>"; $data['rows'][] = array('id' => $key, 'cell' => $cell); } $data['total'] = $c; echo json_encode($data); }
function settings() { $tpl = new templates(); $sock = new sockets(); $page = CurrentPageName(); $users = new usersMenus(); $influx = new influx(); $t = time(); $ERROR_PERF = null; $InfluxAdminDisabled = intval($sock->GET_INFO("InfluxAdminDisabled")); $InfluxAdminPort = intval($sock->GET_INFO("InfluxAdminPort")); if ($InfluxAdminPort == 0) { $InfluxAdminPort = 8083; } $InfluxAdminEnabled = 1; if ($InfluxAdminDisabled == 1) { $InfluxAdminEnabled = 0; } $InfluxAdminRetentionTime = intval($sock->GET_INFO("InfluxAdminRetentionTime")); $UserAgentsStatistics = intval($sock->GET_INFO("UserAgentsStatistics")); $ResolvIPStatistics = intval($sock->GET_INFO("ResolvIPStatistics")); $EnableQuotasStatistics = intval($sock->GET_INFO("EnableQuotasStatistics")); $QuotasStatisticsInterval = intval($sock->GET_INFO("QuotasStatisticsInterval")); $InfluxListenInterface = intval($sock->GET_INFO("InfluxListenInterface")); if ($InfluxListenInterface == null) { $InfluxListenInterface = "lo"; } $EnableInfluxDB = intval($sock->GET_INFO("EnableInfluxDB")); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); $MySQLStatisticsRetentionDays = intval($sock->GET_INFO("MySQLStatisticsRetentionDays")); if ($MySQLStatisticsRetentionDays == 0) { $MySQLStatisticsRetentionDays = 5; } $bt_disconnect = null; $STATS_APPLIANCE = 0; $sys = new networking(); $influxstop = null; $Local_interfaces = $sys->Local_interfaces(); if (!$users->STATS_APPLIANCE) { $Local_interfaces["lo"] = "loopback"; } else { $STATS_APPLIANCE = 1; } $Local_interfaces["ALL"] = "{all}"; if ($InfluxAdminRetentionTime == 0) { $InfluxAdminRetentionTime = 365; } $users = new usersMenus(); $InfluxAdminRetention[7] = "7 {days}"; $InfluxAdminRetention[15] = "15 {days}"; $InfluxAdminRetention[30] = "1 {month}"; $InfluxAdminRetention[90] = "3 {months}"; $InfluxAdminRetention[180] = "6 {months}"; $InfluxAdminRetention[365] = "1 {year}"; $InfluxAdminRetention[730] = "2 {years}"; $InfluxAdminRetention[1095] = "3 {years}"; $MySQLStatisticsRetention[1] = "1 {day}"; $MySQLStatisticsRetention[2] = "2 {days}"; $MySQLStatisticsRetention[3] = "3 {days}"; $MySQLStatisticsRetention[4] = "4 {days}"; $MySQLStatisticsRetention[5] = "5 {days}"; $MySQLStatisticsRetention[6] = "6 {days}"; $MySQLStatisticsRetention[7] = "7 {days}"; $MySQLStatisticsRetention[8] = "8 {days}"; $MySQLStatisticsRetention[9] = "9 {days}"; $MySQLStatisticsRetention[10] = "10 {days}"; $QuotasStatisticsIntervalA[5] = "5 {minutes}"; $QuotasStatisticsIntervalA[10] = "10 {minutes}"; $QuotasStatisticsIntervalA[15] = "15 {minutes}"; $QuotasStatisticsIntervalA[30] = "30 {minutes}"; if ($QuotasStatisticsInterval == 0) { $QuotasStatisticsInterval = 15; } $CORP_LICENSE = 1; $explain_retention = " "; $field_ret = Field_array_Hash($InfluxAdminRetention, "InfluxAdminRetentionTime", "{$InfluxAdminRetentionTime}", "blur()", null, 0, "font-size:22px"); if (!$users->CORP_LICENSE) { $InfluxAdminRetentionTime = 7; $CORP_LICENSE = 0; $field_ret = Field_hidden("InfluxAdminRetentionTime", 5) . "5 {days}<div><i style='font-size:16px'>{retention_time_limited_license}</i></div>"; } if ($EnableInfluxDB == 0) { $influxstop = "<div class=explain style='font-size:18px'>{influxdb_is_disabled}</div>"; } $InFluxBackupDatabaseDir = $sock->GET_INFO("InFluxBackupDatabaseDir"); if ($InFluxBackupDatabaseDir == null) { $InFluxBackupDatabaseDir = "/home/artica/influx/backup"; } $InFluxBackupDatabaseMaxContainers = intval("InFluxBackupDatabaseMaxContainers"); if ($InFluxBackupDatabaseMaxContainers == 0) { $InFluxBackupDatabaseMaxContainers = 5; } $InFluxBackupDatabaseInterval = intval("InFluxBackupDatabaseInterval"); if ($InFluxBackupDatabaseInterval == 0) { $InFluxBackupDatabaseInterval = 10080; } if ($InFluxBackupDatabaseInterval < 1440) { $InFluxBackupDatabaseInterval = 1440; } $influxdb_snapshotsize = @file_get_contents("{$GLOBALS["BASEDIR"]}/influxdb_snapshotsize"); $InfluxDBAllowBrowse = intval($sock->GET_INFO("InfluxDBAllowBrowse")); $InfluxUseRemote = intval($sock->GET_INFO("InfluxUseRemote")); $InfluxUseRemoteIpaddr = $sock->GET_INFO("InfluxUseRemoteIpaddr"); $InfluxRemoteDB = $sock->GET_INFO("InfluxRemoteDB"); $InfluxUseRemotePort = intval($sock->GET_INFO("InfluxUseRemotePort")); $InfluxUseRemoteArticaPort = intval($sock->GET_INFO("InfluxUseRemoteArticaPort")); if ($InfluxRemoteDB == null) { $InfluxRemoteDB = $influx->db; } if ($InfluxUseRemotePort == 0) { $InfluxUseRemotePort = 8086; } if ($InfluxUseRemoteArticaPort == 0) { $InfluxUseRemoteArticaPort = 9000; } $InfluxDBPassword = $sock->GET_INFO("InfluxDBPassword"); $ArticaInfluxUsername = $sock->GET_INFO("ArticaInfluxUsername"); if ($ArticaInfluxUsername == null) { $ArticaInfluxUsername = "******"; } $InfluxSyslogRemote = intval($sock->GET_INFO("InfluxSyslogRemote")); $NoCompressStatisticsByHour = intval($sock->GET_INFO("NoCompressStatisticsByHour")); $ArticaInfluxPassword = $sock->GET_INFO("ArticaInfluxPassword"); if ($SquidPerformance > 2) { $ERROR_PERF = "<p class=text-error style='font-size:16px'>{INFLUX_DISABLED_PROXY_PERFORMANCE}</p>\n\t\t<div style='margin-top:10px;text-align:right'>" . button("{performance}", "GotoSquidPerformances()", 16) . "</div>"; } if ($InfluxUseRemote == 1) { if ($InfluxUseRemoteIpaddr != null) { $bt_disconnect = "\n\t\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px;text-align:right' colspan=2><p> </p></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px;text-align:right' colspan=2>" . button("{disconnect}", "Loadjs('influxdb.disconnect.progress.php');", 22) . "</td>\n\t\t\t</tr>"; } } $Intervals[1440] = "1 {day}"; $Intervals[2880] = "1 {days}"; $Intervals[7200] = "5 {days}"; $Intervals[10080] = "1 {week}"; $Intervals[20160] = "2 {weeks}"; $password = "******" . Field_password("InfluxDBPassword", $InfluxDBPassword, "font-size:22px;width:310px") . "</td>\n\t\t<td style='font-size:22px;text-decoration:underline'>{username}: «root»</td>\n\t</tr>"; $date_start = $tpl->time_to_date(intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/DATE_START")), true); $date_end = $tpl->time_to_date(intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/DATE_END")), true); $html = "\n\t{$ERROR_PERF}\t\t\n\t<div style='width:98%;margin-top:20px' class=form>\n\t{$influxstop}\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{date_start}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>{$date_start}</td>\n\t\t\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{last_date}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>{$date_end}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'>" . button("{refresh}", "Loadjs('influxdb.refresh.progress.php')") . "</td>\n\t</tr>\n\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{no_hourly_compression}", "{no_hourly_compression_explain}") . ":</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("NoCompressStatisticsByHour", 1, $NoCompressStatisticsByHour, "") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{ResolvIPStatistics}", "{ResolvIPStatistics_explain}") . ":</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("ResolvIPStatistics", 1, $ResolvIPStatistics, "") . "</td>\n\t</tr>\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{MySQLStatisticsRetentionDays}", "{MySQLStatisticsRetentionDays_explain}") . ":</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_array_Hash($MySQLStatisticsRetention, "MySQLStatisticsRetentionDays", "{$MySQLStatisticsRetentionDays}", "blur()", null, 0, "font-size:22px") . "</td>\n\t</tr>\t\n\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{useragents_statistics}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("UserAgentsStatistics", 1, $UserAgentsStatistics, "") . "</td>\n\t\t\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{quota_statistics}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("EnableQuotasStatistics", 1, $EnableQuotasStatistics, "EnableQuotasStatisticsCheck()") . "</td>\n\t\t\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{interval}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_array_Hash($QuotasStatisticsIntervalA, "QuotasStatisticsInterval", "{$QuotasStatisticsInterval}", "blur()", null, 0, "font-size:22px") . "</td>\n\t</tr>\t\n\t</table>\n\t<div id='influx-local-service-id'>\n\t<table style='width:100%'>\n\t<tr style='height:80px;'>\n\t\t<td colspan=3 style='font-size:30px'>{service_parameters}:</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{query_interface}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold'>" . Field_checkbox_design("InfluxAdminEnabled", 1, $InfluxAdminEnabled, "InfluxAdminEnabledCheck()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{listen_interface}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_array_Hash($Local_interfaces, "InfluxListenInterface", "{$InfluxListenInterface}", "blur()", null, 0, "font-size:22px") . "</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$InfluxListenInterface}:8086</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_port}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InfluxAdminPort", $InfluxAdminPort, "font-size:22px;width:120px") . "</td>\n\t\t<td style='font-size:22px;text-decoration:underline'><a href=\"http://{$_SERVER["SERVER_ADDR"]}:{$InfluxAdminPort}\" target=_new>{browse}</a></td>\n\t</tr>\t\n\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{retention_time}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>{$field_ret}{$explain_retention}</td>\n\t</tr>\n\t<tr style='height:80px;'>\n\t\t<td colspan=3 align='right' style='padding-top:30px'><hr>" . button("{apply}", "Save{$t}()", 40) . "</td>\n\t</tr>\t\n\t</table>\n\t</div>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<div id='influx-remote-service-id'>\n\t\t<table style='width:100%'>\n\t\t<tr style='height:80px;'>\n\t\t\t<td colspan=3 style='font-size:30px'>{remote_server}:</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' nowrap>{use_remote_server}:</td>\t\t\n\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_checkbox_design("InfluxUseRemote", 1, $InfluxUseRemote, "InfluxUseRemoteCheck()") . "</td>\n\t\t</tr>\t\n\t\t</table>\n\t\t<div id='influx-remote-service-options'>\n\t\t\t<table style='width:100%'>\n{$bt_disconnect}\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{send_syslog_logs}", "{send_syslog_explain}") . ":</td>\t\t\n\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_checkbox_design("InfluxSyslogRemote", 1, $InfluxSyslogRemote) . "</td>\n\t\t</tr>\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px' nowrap>{remote_server_address}:</td>\t\t\n\t\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InfluxUseRemoteIpaddr", $InfluxUseRemoteIpaddr, "font-size:22px;width:291px") . "</td>\n\t\t\t\t\n\t\t\t</tr>\n\t\t\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px'>{remote_port}:</td>\t\t\n\t\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InfluxUseRemotePort", $InfluxUseRemotePort, "font-size:22px;width:120px") . "</td>\n\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{artica_username}:</td>\n\t\t\t\t\t<td style='font-size:18px'>" . Field_text("ArticaInfluxUsername", $ArticaInfluxUsername, "font-size:22px;width:240px") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{artica_password}:</td>\n\t\t\t\t\t<td style='font-size:18px'>" . Field_password("ArticaInfluxPassword", $ArticaInfluxPassword, "font-size:22px;width:240px") . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px'>{remote_artica_port}:</td>\t\t\n\t\t\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InfluxUseRemoteArticaPort", $InfluxUseRemoteArticaPort, "font-size:22px;width:120px") . "</td>\n\t\t\t</tr>\t\t\t\t\n\t\t\t<tr style='height:80px;'>\n\t\t\t\t<td colspan=2 align='right' style='padding-top:30px'>\n\t\t\t\t\t\t\t<hr>" . button("{apply}", "SaveRemote{$t}()", 40) . "</td>\n\t\t\t</tr>\n\t\t\t\t\t\t\n\t\t\t</table>\n\t\t</div>\n\t</div>\t\t\t\n\t\t\t\t\n\t<div id='influx-backup-service-id'>\n\t<table style='width:100%'>\n\t<tr style='height:80px;'>\n\t\t<td colspan=3 style='font-size:26px'>{backup}:</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{backup_each}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_array_Hash($Intervals, "InFluxBackupDatabaseInterval", "{$InFluxBackupDatabaseInterval}", "blur()", null, 0, "font-size:22px") . "</td>\n\t\t\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{backup_directory}:</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold'>" . Field_text("InFluxBackupDatabaseDir", $InFluxBackupDatabaseDir, "font-size:22px;width:291px") . "</td>\n\t\t<td>" . button_browse("InFluxBackupDatabaseDir") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap colspan=2 align='right'>\n\t\t\t\t<a href=\"/backup-influx/\" style='text-decoration:underline'>{backup_directory} " . FormatBytes($influxdb_snapshotsize / 1024) . "</a>\n\t\t</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>" . texttooltip("{allow_browse_directory}", "{allow_browse_directory_web_explain}") . ":</td>\t\t\n\t\t<td style='font-size:22px;font-weight:bold' colspan=2>" . Field_checkbox_design("InfluxDBAllowBrowse", 1, $InfluxDBAllowBrowse, "") . "</td>\n\t\t\t\t\n\t</tr>\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td colspan=3 align='right' style='font-size:18px'>\n\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:GotoSquidNasStorage()\" \n\t\t\t\tstyle='text-decoration:underline;font-size:18px'>{also_see_backup_to_nas}</a>\n\t\t</td>\n\t</tr>\n\t<tr style='height:80px;'>\n\t\t<td colspan=3 align='right' style='padding-top:30px'><hr>" . button("{apply}", "Save{$t}()", 40) . "</td>\n\t</tr>\t\t\t\n\t</table>\n\t</div>\n\t</div>\n<script>\nvar xSave{$t}= function (obj) {\t\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tLoadjs('influxdb.restart.progress.php');\n}\t\nvar xSaveRemote{$t}= function (obj) {\t\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tLoadjs('influxdb.remote.progress.php');\n}\n\nfunction SaveRemote{$t}(){\n\tvar XHR = new XHRConnection();\n\tif(document.getElementById('InfluxUseRemote').checked){XHR.appendData('InfluxUseRemote', 1);}else{XHR.appendData('InfluxUseRemote', 0);}\n\tif(document.getElementById('InfluxSyslogRemote').checked){XHR.appendData('InfluxSyslogRemote', 1);}else{XHR.appendData('InfluxSyslogRemote', 0);}\n\tXHR.appendData('InfluxUseRemoteIpaddr', document.getElementById('InfluxUseRemoteIpaddr').value);\n\tXHR.appendData('InfluxUseRemotePort', document.getElementById('InfluxUseRemotePort').value);\n\tXHR.appendData('InfluxUseRemoteArticaPort', document.getElementById('InfluxUseRemoteArticaPort').value);\n\tXHR.appendData('ArticaInfluxPassword', encodeURIComponent(document.getElementById('ArticaInfluxPassword').value));\n\tXHR.appendData('ArticaInfluxUsername', document.getElementById('ArticaInfluxUsername').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSaveRemote{$t}); \n\n}\n\t\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\t\n\tif(document.getElementById('NoCompressStatisticsByHour').checked){XHR.appendData('NoCompressStatisticsByHour', 1);\t}else{XHR.appendData('NoCompressStatisticsByHour', 0);}\n\tif(document.getElementById('ResolvIPStatistics').checked){XHR.appendData('ResolvIPStatistics', 1);\t}else{XHR.appendData('ResolvIPStatistics', 0);}\n\tif(document.getElementById('InfluxAdminEnabled').checked){XHR.appendData('InfluxAdminEnabled', 1);\t}else{XHR.appendData('InfluxAdminEnabled', 0);}\n\tif(document.getElementById('EnableQuotasStatistics').checked){XHR.appendData('EnableQuotasStatistics', 1);\t}else{XHR.appendData('EnableQuotasStatistics', 0);}\n\tif(document.getElementById('UserAgentsStatistics').checked){XHR.appendData('UserAgentsStatistics', 1);\t}else{XHR.appendData('UserAgentsStatistics', 0);}\n\tif(document.getElementById('InfluxDBAllowBrowse').checked){XHR.appendData('InfluxDBAllowBrowse', 1);\t}else{XHR.appendData('InfluxDBAllowBrowse', 0);}\n \t//XHR.appendData('InfluxDBPassword', encodeURIComponent(document.getElementById('InfluxDBPassword').value));\n\t\n\t\n\tXHR.appendData('MySQLStatisticsRetentionDays', document.getElementById('MySQLStatisticsRetentionDays').value);\n\tXHR.appendData('InfluxAdminPort', document.getElementById('InfluxAdminPort').value);\n\tXHR.appendData('InfluxAdminRetentionTime', document.getElementById('InfluxAdminRetentionTime').value);\t\t\n\tXHR.appendData('QuotasStatisticsInterval', document.getElementById('QuotasStatisticsInterval').value);\n\tXHR.appendData('InfluxListenInterface', document.getElementById('InfluxListenInterface').value);\n\tXHR.appendData('InFluxBackupDatabaseInterval', document.getElementById('InFluxBackupDatabaseInterval').value);\n\tXHR.appendData('InFluxBackupDatabaseDir', document.getElementById('InFluxBackupDatabaseDir').value);\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t}); \t\t\t\n}\n\nfunction EnableQuotasStatisticsCheck(){\n\tdocument.getElementById('QuotasStatisticsInterval').disabled=true;\n\tif(document.getElementById('EnableQuotasStatistics').checked){\n\t\tdocument.getElementById('QuotasStatisticsInterval').disabled=false;\n\t}\n}\n\nfunction InfluxUseRemoteCheck(){\n\tif(document.getElementById('InfluxUseRemote').checked){\n\t\tdocument.getElementById('influx-local-service-id').style.display='none';\n\t\tdocument.getElementById('influx-backup-service-id').style.display='none';\n\t\tdocument.getElementById('influx-remote-service-options').style.display='';\n\t\t\n\t}else{\n\t\tdocument.getElementById('influx-local-service-id').style.display='';\n\t\tdocument.getElementById('influx-backup-service-id').style.display='';\n\t\tdocument.getElementById('influx-remote-service-options').style.display='none';\n\t\n\t}\n\t\n\tvar STATS_APPLIANCE={$STATS_APPLIANCE};\n\tif(STATS_APPLIANCE==1){\n\t\tdocument.getElementById('influx-remote-service-id').style.display='none';\n\t}\n}\n\n\nfunction checkt{$t}(){\n\tvar CORP_LICENSE={$CORP_LICENSE};\n\tdocument.getElementById('InfluxAdminRetentionTime').disabled=true;\n\tif(CORP_LICENSE==1){document.getElementById('InfluxAdminRetentionTime').disabled=false;}\n}\n\nEnableQuotasStatisticsCheck();\ncheckt{$t}();\nInfluxUseRemoteCheck();\nLoadAjaxRound('influx-db-status','{$page}?service-status=yes');\t\t\t\t\n</script>\n\t\t\t\t\n\t\t\t\t\n"; echo $tpl->_ENGINE_parse_body($html); }
function snapshot_restore_js() { header("content-type: application/x-javascript"); $artica_meta = new mysql_meta(); $tpl = new templates(); if ($_GET["gpid"] == 0) { $hostname = $artica_meta->uuid_to_host($_GET["uuid"]); } else { $hostname = $tpl->javascript_parse_text("{computers}:\\n---------------\\n") . $artica_meta->gpid_to_name($_GET["gpid"]); } $q = new mysql_meta(); $sql = "SELECT zDate FROM snapshots WHERE zmd5='{$_GET["zmd5"]}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $xdate = $tpl->time_to_date(strtotime($ligne["zDate"]), true); $text = $tpl->javascript_parse_text("{$hostname}:\\n{ask_to_restore_a_snapshot_from_meta}\\n[{$xdate}]"); $text = str_replace("%s", $hostname, $text); $page = CurrentPageName(); $t = time(); $html = "\nvar xcall{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);return;}\n\t\$('#ARTICA_META_MAIN_TABLE').flexReload();\n\tYahooWin3Hide();\n}\n\t\nfunction xFunct{$t}(){\n\tif(!confirm('{$text} ?')){return;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('snapshot-restore','{$_GET["zmd5"]}');\n\tXHR.appendData('uuid','{$_GET["uuid"]}');\n\tXHR.appendData('gpid','{$_GET["gpid"]}');\n\tLockPage();\n\tXHR.sendAndLoad('{$page}', 'POST',xcall{$t});\n}\n\t\nxFunct{$t}();\n"; echo $html; }
function build_query_js() { $page = CurrentPageName(); $tpl = new templates(); $from = strtotime("{$_GET["date1"]} {$_GET["time1"]}"); $to = strtotime("{$_GET["date2"]} {$_GET["time2"]}"); $interval = $_GET["interval"]; $t = $_GET["t"]; $user = $_GET["user"]; $md5 = md5("WEBSITES:{$from}{$to}{$interval}{$user}{$_GET["searchsites"]}{$_GET["searchuser"]}"); $_SESSION["SQUID_STATS_DATE1"] = $_GET["date1"]; $_SESSION["SQUID_STATS_TIME1"] = $_GET["time1"]; $_SESSION["SQUID_STATS_DATE2"] = $_GET["date2"]; $_SESSION["SQUID_STATS_TIME2"] = $_GET["time2"]; $timetext1 = $tpl->time_to_date(strtotime("{$_GET["date1"]} {$_GET["time1"]}"), true); $timetext2 = $tpl->time_to_date(strtotime("{$_GET["date2"]} {$_GET["time2"]}"), true); $nextFunction = "LoadAjax('WEBFILTERING_STATS_MAIN_GRAPH','{$page}?main=yes&zmd5={$md5}&t={$t}');"; $nextFunction_encoded = urlencode(base64_encode($nextFunction)); $q = new mysql_squid_builder(); $q->CheckReportTable(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT ID,builded FROM reports_cache WHERE `zmd5`='{$md5}'")); if (intval($ligne["ID"]) == 0) { $array["FROM"] = $from; $array["TO"] = $to; $array["INTERVAL"] = $interval; $array["USER"] = $user; $array["categories"] = $_GET["categories"]; $array["searchuser"] = $_GET["searchuser"]; $serialize = mysql_escape_string2(serialize($array)); $title = "{webfiltering}: {$timetext1} - {to} {$timetext2} and {$user} {is} {$array["searchuser"]}"; $sql = "INSERT IGNORE INTO `reports_cache` (`zmd5`,`title`,`report_type`,`zDate`,`params`) VALUES \n\t\t('{$md5}','{$title}','WEBFILTERING',NOW(),'{$serialize}')"; $q->QUERY_SQL($sql); if (!$q->ok) { echo "alert('" . $tpl->javascript_parse_text($q->mysql_errror) . "')"; return; } echo "Loadjs('squid.statistics.progress.php?zmd5={$md5}&NextFunction={$nextFunction_encoded}')"; return; } if (intval($ligne["builded"] == 0)) { echo "\nfunction Start{$t}(){\n\tLoadjs('squid.statistics.progress.php?zmd5={$md5}&NextFunction={$nextFunction_encoded}&t={$t}');\n}\n\nif(document.getElementById('graph-{$t}')){\n\tdocument.getElementById('graph-{$t}').innerHTML='<center><img src=img/loader-big.gif></center>';\n}\nLockPage();\t\nsetTimeout('Start{$t}()',800);\n"; return; } echo $nextFunction; }
function search() { $MyPage = CurrentPageName(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_squid_builder(); $table = "import_srclogs"; $database = null; if (!$q->TABLE_EXISTS($table, $database)) { json_error_show("no data - no table"); } $searchstring = string_to_flexquery(); $page = 1; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); if (!$q->ok) { json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1); } $total = $ligne["tcount"]; if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if (!is_numeric($rp)) { $rp = 50; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} "; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { if ($q->mysql_error != null) { json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1); } } if (mysql_num_rows($results) == 0) { json_error_show("no data", 0); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $fontsize = "18"; $style = " style='font-size:{$fontsize}px'"; $styleHref = " style='font-size:{$fontsize}px;text-decoration:underline'"; $free_text = $tpl->javascript_parse_text("{free}"); $computers = $tpl->javascript_parse_text("{computers}"); $overloaded_text = $tpl->javascript_parse_text("{overloaded}"); $orders_text = $tpl->javascript_parse_text("{orders}"); $directories_monitor = $tpl->javascript_parse_text("{directories_monitor}"); $icons[0] = "clock-gold-32.png"; $icons[1] = "wait-clock.gif"; $icons[2] = "check-32.png"; $icons[3] = "error-32.png"; while ($ligne = mysql_fetch_assoc($results)) { $LOGSWHY = array(); $overloaded = null; $loadcolor = "black"; $StatHourColor = "black"; $ColorTime = "black"; $uuid = $ligne["uuid"]; $hostname = $ligne["hostname"]; $hostag = utf8_encode($ligne["hostag"]); $zmd5 = $ligne["zmd5"]; $first_time_text = null; $last_time_text = null; $icon_warning_32 = "warning32.png"; $icon_red_32 = "32-red.png"; $icon = "ok-32.png"; $xdate = $ligne["zDate"]; $xtime = strtotime($xdate); $date = $tpl->time_to_date($xtime, true); $size = FormatBytes($ligne["size"] / 1024); $path = basename($ligne["path"]); $percent = $ligne["percent"]; $status = $ligne["status"]; $lastlog = $tpl->javascript_parse_text($ligne["lastlog"]); $icon = $icons[$status]; $first_time = $ligne["first_time"]; $last_time = $ligne["last_time"]; $resetjs = null; if ($first_time > 0) { $first_time_text = date("Y-m-d H:i:s", $first_time); } if ($last_time > 0) { $last_time_text = date("Y-m-d H:i:s", $last_time); } $pathenc = urlencode($path); if ($status == 1) { $resetjs = "Loadjs('{$MyPage}?reset-js={$ligne["md5file"]}&filename={$pathenc}')"; } $urijs = "Loadjs('{$MyPage}?content-js=yes&ID={$ligne["ID"]}');"; $link = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$urijs}\" {$styleHref}>"; $delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?unlink-js={$ligne["md5file"]}&filename={$pathenc}')"); $restore = imgsimple("32-import.png", null, "Loadjs('artica-meta.menus.php?snapshot-restore-js=yes&zmd5={$ligne["zmd5"]}&uuid={$_GET["uuid"]}')"); $cell = array(); $cell[] = "<span {$style}>" . imgsimple($icon, null, $resetjs) . "</a></span>"; $cell[] = "<span {$style}>{$date}</a></span>"; $cell[] = "<span {$style}>{$first_time_text}<br>{$last_time_text}</a></span>"; $cell[] = "<span {$style}>{$path}</a></span><br><i style='font-size:14px'>{$lastlog}</i>"; $cell[] = "<span {$style}>{$size}</a></span>"; $cell[] = "<span {$style}>{$percent}%</a></span>"; $cell[] = "{$delete}"; $data['rows'][] = array('id' => $ligne['md5file'], 'cell' => $cell); } echo json_encode($data); }