function status() { $page = CurrentPageName(); $tpl = new templates(); $cache_file = dirname(__FILE__) . "/ressources/logs/web/squid.status.html"; $footer = $tpl->_ENGINE_parse_body("\n\t<div class='post'>\n\t<h1 class=\"title\" style='text-transform:capitalize'>{today_downloaded_flow}</h1>\n\t<center>" . squid_events_hours() . "</center>\n\t</div>\n\t\n\t"); $script = "<script>LoadAjax('RightMenu1','{$page}?RightMenu1=yes');</script>"; if (is_file($cache_file)) { echo $tpl->_ENGINE_parse_body("<div class='post'>\n\t<h1 class=\"title\" style='text-transform:capitalize'>{WELCOME_ARTICA_STATS_SQUID}</h1>" . @file_get_contents($cache_file)) . "\n\t</div>{$footer}{$script}"; return; } writelogs("{$cache_file} no such file", __FUNCTION__, __FILE__, __LINE__); $status = new status(); echo $tpl->_ENGINE_parse_body("<div class='post'>\n\t<h1 class=\"title\" style='text-transform:capitalize'>{WELCOME_ARTICA_STATS_SQUID}</h1>\n\t" . $status->Squid_status()) . "\n\t</div>{$footer}{$script}\n\t\n\t\n\t"; }
function status_squid_kav() { $page = CurrentPageName(); $tpl = new templates(); if ($GLOBALS["VERBOSE"]) { echo "{$page} LINE:" . __LINE__ . "\n"; } $status = new status(); if ($GLOBALS["VERBOSE"]) { echo "{$page} LINE:" . __LINE__ . "\n"; } $html = $status->Squid_status(); return $tpl->_ENGINE_parse_body($html); }
function status_squid_left() { if (CACHE_SESSION_GET(__FUNCTION__, __FILE__, 30)) { return; } $tpl = new templates(); $page = CurrentPageName(); include_once dirname(__FILE__) . "/ressources/class.status.inc"; $status = new status(); $squid_status = $status->Squid_status(); $q = new mysql(); $ini = new Bs_IniHandler(); $sock = new sockets(); $ini->loadString(base64_decode($sock->getFrameWork("cmd.php?squid-ini-status=yes"))); $master_version = $ini->_params["SQUID"]["master_version"]; $master_pid = $ini->_params["SQUID"]["master_pid"]; $users = new usersMenus(); $squid = new squidbee(); if ($ini->_params["SQUID"]["running"] == 0) { $img = "status_postfix_bg_failed.png"; $status = "{stopped}"; $start = "<hr><div style='text-align:right'>" . button("{start}", "Loadjs('StartStopServices.php?APP=APP_SQUID&cmd=squid-cache&action=start')") . "</div>"; } else { if (preg_match("#2\\.3.*#", $master_version)) { $img = 'status_postfix_bg_ok23.png'; } if (preg_match("#2\\.5.*#", $master_version)) { $img = 'status_postfix_bg_ok25.png'; } if (preg_match("#2\\.7.*#", $master_version)) { $img = 'status_postfix_bg_ok27.png'; } if (preg_match("#2\\.6.*#", $master_version)) { $img = 'status_postfix_bg_ok26.png'; } if (preg_match("#2\\.8.*#", $master_version)) { $img = 'status_postfix_bg_ok28.png'; } if (preg_match("#2\\.9.*#", $master_version)) { $img = 'status_postfix_bg_ok29.png'; } if (preg_match("#3\\.0.*#", $master_version)) { $img = 'status_postfix_bg_ok30.png'; } if (preg_match("#3\\.1.*#", $master_version)) { $img = 'status_postfix_bg_ok31.png'; } if (preg_match("#3\\.2.*#", $master_version)) { $img = 'status_postfix_bg_ok32.png'; } if (preg_match("#3\\.3.*#", $master_version)) { $img = 'status_postfix_bg_ok33.png'; } $text = "{service_running}<br>{using_version} {$master_version} {pid} {$master_pid}"; } if ($ini->_params["SQUID"]["icap_enabled"] != '1') { $icap = "<table style='width:100%;margin:0px;' " . CellRollOver($js_service) . ">\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/danger16.png'></td>\n\t\t\t<td align='left' nowrap><strong style='color:#D01A1A;font-size:11px'>{no_icap_support}</td>\n\t\t\t<td width=1% align='right'> </td>\n\t\t</tr>\n\t</table>"; } $EnableKavICAPRemote = $sock->GET_INFO("EnableKavICAPRemote"); $KavICAPRemoteAddr = $sock->GET_INFO("KavICAPRemoteAddr"); $KavICAPRemotePort = $sock->GET_INFO("KavICAPRemotePort"); if (!is_numeric($EnableKavICAPRemote)) { $EnableKavICAPRemote = 0; } if ($EnableKavICAPRemote == 1) { $fp = @fsockopen($KavICAPRemoteAddr, $KavICAPRemotePort, $errno, $errstr, 1); if (!$fp) { $text_kavicap_error = "<div>{kavicap_unavailable_text}<br><strong>\n\t\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.kavicap.php');\" style='font-size:12px;color:#D70707;text-decoration:underline'>{$KavICAPRemoteAddr}:{$KavICAPRemotePort}</a><br>{$errstr}</div>"; } @fclose($fp); } $q = new mysql_squid_builder(); if (!$q->TestingConnection()) { $img = "status_postfix_bg_failed.png"; $title = "{MYSQL_ERROR}"; $text_error_sql = "<div><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.mysql.php');\" \n\t\tstyle='font-size:12px;color:#D70707;text-decoration:underline'>{$title}:{$q->mysql_error}</a></div>"; } $q = new mysql_squid_builder(); $requests = $q->EVENTS_SUM(); $requests = numberFormat($requests, 0, "", " "); $tableblock = date('Ymd') . "_blocked"; $ligneW = $q->COUNT_ROWS($tableblock); $blocked_today = numberFormat($ligneW["tcount"], 0, "", " ") . " {blocked_websites} {this_day}"; $q = new mysql_squid_builder(); $websitesnums = $q->COUNT_ROWS("dansguardian_sitesinfos", "artica_backup"); $websitesnums = numberFormat($websitesnums, 0, "", " "); $q = new mysql_squid_builder(); $categories = $q->COUNT_ROWS("dansguardian_community_categories"); $categories = numberFormat($categories, 0, "", " "); $sock = new sockets(); $sock->SET_INFO("squidStatsCategoriesNum", $categories); $sock->SET_INFO("squidStatsWebSitesNum", $websitesnums); $sock->SET_INFO("squidStatsBlockedToday", $blocked_today); $sock->SET_INFO("squidStatsRequestNumber", $requests); $migration_pid = unserialize(base64_decode($sock->getFrameWork("squid.php?migration-stats=yes"))); if (is_array($migration_pid)) { $text_script = "<span style='color:#B80000;font-size:13px'>{migration_script_run_text} PID:{$migration_pid[0]} {since}:{$migration_pid[1]}Mn</span>"; } if ($users->KAV4PROXY_INSTALLED) { $img = "info-18.png"; $text = "{enabled}"; if ($squid->enable_kavproxy != 1) { $text = "{disabled}"; $img = "status_warning.gif"; } $services_enabled = $services_enabled . "\n\t\t\t<tr " . CellRollOver("Loadjs('squid.popups.php?script=plugins')") . ">\n\t\t\t\t<td width=1%><img src='img/{$img}'></td>\n\t\t\t\t<td class=legend style='font-size:13px;' align='left' width=1% nowrap>{APP_KAV4PROXY}:</td>\n\t\t\t\t<td class=legend style='font-size:14px' align='left' width=100%>{$text}</td>\n\t\t\t</tr>\n\t\t\t"; } if ($users->APP_UFDBGUARD_INSTALLED) { $img = "info-18.png"; $text = "{enabled}"; $EnableUfdbGuard = $sock->GET_INFO("EnableUfdbGuard"); if ($EnableUfdbGuard != 1) { $text = "{disabled}"; $img = "status_warning.gif"; } $services_enabled = $services_enabled . "\n\t\t\t<tr " . CellRollOver("Loadjs('squid.popups.php?script=plugins')") . ">\n\t\t\t\t<td width=1%><img src='img/{$img}'></td>\n\t\t\t\t<td class=legend style='font-size:13px;' nowrap width=1% align='left'>{APP_UFDBGUARD}:</td>\n\t\t\t\t<td class=legend style='font-size:14px' width=100% align='left'>{$text}</td>\n\t\t\t</tr>\n\t\t\t"; } $design = "\n\t{$text_error_sql}\n\t{$text_script}\n\t{$text_kavicap_error}\n\t<table style='width:250px;margin-top:10px;' class=form>\n\t<tbody>\n\t\t<tr>\n\t\t\t<td> </td>\n\t\t\t<td class=legend nowrap>{version}:</td>\n\t\t\t<td style='font-size:14px'>{$master_version}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td> </td>\n\t\t\t<td class=legend>PID:</td>\n\t\t\t<td style='font-size:14px'>{$master_pid}</td>\n\t\t</tr>\n\t\t\t{$services_enabled}\n\t\t</tbody>\n\t</table>\t\n\t</table>\n\t<div style='width:100%;text-align:right'>" . imgtootltip("refresh-24.png", "{refresh}", "LoadAjax('squid-status','squid.main.quicklinks.php?status=yes');") . "</div>\n\t\n\t"; $html = "\n\t{$design}\n\t<center>\n\t\n\t\t<div id='squid-status-stats' class=form style='width:90%'></div>\n\t</center>\n\t\n\t\n\t<script>\n\t\tLoadAjax('squid-status-stats','squid.traffic.statistics.php?squid-status-stats=yes');\t\n\t\tLoadAjax('squid-services','{$page}?squid-services=yes');\n\t</script>\n\t"; $html = $tpl->_ENGINE_parse_body($html); CACHE_SESSION_SET(__FUNCTION__, __FILE__, $html); }
function BuildStatusRight() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $minutes = file_time_min($pidfile); if ($minutes < 10) { events("Stopping status, currently {$minutes}Mn need to wait 10Mn", __FUNCTION__, __FILE__, __LINE__); return; } if (!isset($GLOBALS["CLASS_USERS_MENUS"])) { $users = new usersMenus(); $GLOBALS["CLASS_USERS_MENUS"] = $users; } else { $users = $GLOBALS["CLASS_USERS_MENUS"]; } $sock = new sockets(); $tpl = new templates(); $status = new status(); $DisableMessaging = intval($sock->GET_INFO("DisableMessaging")); if ($DisableMessaging == 1) { $users->POSTFIX_INSTALLED = false; } $AsCategoriesAppliance = intval($sock->GET_INFO("AsCategoriesAppliance")); if ($AsCategoriesAppliance == 1) { return $status->CATEGORIES_APPLIANCE(); } $SAMBA_INSTALLED = 0; $SQUID_INSTALLED = 0; $POSTFIX_INSTALLED = 0; if ($users->POSTFIX_INSTALLED) { $POSTFIX_INSTALLED = 1; } if ($users->SQUID_INSTALLED) { $SQUID_INSTALLED = 1; $SQUID_INSTALLED = $sock->GET_INFO("SQUIDEnable"); if ($SQUID_INSTALLED == null) { $SQUID_INSTALLED = 1; } } if ($users->SAMBA_INSTALLED) { $SAMBA_INSTALLED = 1; $SAMBA_INSTALLED = $sock->GET_INFO("SambaEnabled"); if (!is_numeric($SAMBA_INSTALLED)) { $SAMBA_INSTALLED = 1; } } events("POSTFIX_INSTALLED={$POSTFIX_INSTALLED},SQUID_INSTALLED={$SQUID_INSTALLED},SAMBA_INSTALLED={$SAMBA_INSTALLED}"); writelogs("POSTFIX_INSTALLED={$POSTFIX_INSTALLED},SQUID_INSTALLED={$SQUID_INSTALLED},SAMBA_INSTALLED={$SAMBA_INSTALLED}", __FUNCTION__, __FILE__, __LINE__); if ($SQUID_INSTALLED == 1) { $Squid_status = $status->Squid_status(); } if ($POSTFIX_INSTALLED == 0) { if ($SQUID_INSTALLED == 1) { return $Squid_status; } if ($SAMBA_INSTALLED == 1) { return StatusSamba(); } } else { return $status->Postfix_satus(); } }