* @copyright (C) 2006 - 2012 Adam Armstrong * */ if (empty($_SERVER['PATH_INFO'])) { if (strstr($_SERVER['SERVER_SOFTWARE'], "nginx") && isset($_SERVER['PATH_TRANSLATED']) && isset($_SERVER['ORIG_SCRIPT_FILENAME'])) { $_SERVER['PATH_INFO'] = str_replace($_SERVER['PATH_TRANSLATED'] . $_SERVER['PHP_SELF'], "", $_SERVER['ORIG_SCRIPT_FILENAME']); } else { $_SERVER['PATH_INFO'] = isset($_SERVER['ORIG_PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : ''; } } function logErrors($errno, $errstr, $errfile, $errline) { global $php_debug; $php_debug[] = array('errno' => $errno, 'errstr' => $errstr, 'errfile' => $errfile, 'errline' => $errline); } function catchFatal() { $last_error = error_get_last(); if ($last_error['type'] == 1) { $log_error = array($last_error['type'],$last_error['message'],$last_error['file'],$last_error['line']); print_r($log_error); } } if (strpos($_SERVER['PATH_INFO'], "debug")) { $debug = "1"; ini_set('display_errors', 0); ini_set('display_startup_errors', 1); ini_set('log_errors', 1); ini_set('error_reporting', E_ALL); set_error_handler('logErrors'); register_shutdown_function('catchFatal'); } else { $debug = false; ini_set('display_errors', 0); ini_set('display_startup_errors', 0); ini_set('log_errors', 0); ini_set('error_reporting', 0); } // Set variables $msg_box = array(); // Check for install.inc.php if (!file_exists('../config.php') && $_SERVER['PATH_INFO'] != '/install.php') { // no config.php does so let's redirect to the install header('Location: install.php'); exit; } require '../includes/defaults.inc.php'; require '../config.php'; require_once '../includes/definitions.inc.php'; require '../includes/functions.php'; require 'includes/functions.inc.php'; require 'includes/vars.inc.php'; require 'includes/plugins.inc.php'; use LibreNMS\Plugins; $config['memcached']['ttl'] = $config['time']['now']+300; Plugins::start(); $runtime_start = microtime(true); ob_start(); ini_set('allow_url_fopen', 0); ini_set('display_errors', 0); require 'includes/authenticate.inc.php'; if (strstr($_SERVER['REQUEST_URI'], 'widescreen=yes')) { $_SESSION['widescreen'] = 1; } if (strstr($_SERVER['REQUEST_URI'], 'widescreen=no')) { unset($_SESSION['widescreen']); } # Load the settings for Multi-Tenancy. if (isset($config['branding']) && is_array($config['branding'])) { if ($config['branding'][$_SERVER['SERVER_NAME']]) { foreach ($config['branding'][$_SERVER['SERVER_NAME']] as $confitem => $confval) { eval("\$config['" . $confitem . "'] = \$confval;"); } } else { foreach ($config['branding']['default'] as $confitem => $confval) { eval("\$config['" . $confitem . "'] = \$confval;"); } } } # page_title_prefix is displayed, unless page_title is set if (isset($config['page_title'])) { $config['page_title_prefix'] = $config['page_title']; } ?> <?php echo($config['page_title_suffix']); ?> ' . "\n"); } ?> updateResolution();"; } if ((isset($vars['bare']) && $vars['bare'] != "yes") || !isset($vars['bare'])) { if ($_SESSION['authenticated']) { require 'includes/print-menubar.php'; } } else { echo ""; } ?>
"); print_r($_GET); print_r($vars); echo(""); } if ($_SESSION['authenticated']) { // Authenticated. Print a page. if (isset($vars['page']) && !strstr("..", $vars['page']) && is_file("pages/" . $vars['page'] . ".inc.php")) { require "pages/" . $vars['page'] . ".inc.php"; } else { if (isset($config['front_page']) && is_file($config['front_page'])) { require $config['front_page']; } else { require 'pages/front/default.php'; } } } else { // Not Authenticated. Show status page if enabled if ($config['public_status'] === true) { if (isset($vars['page']) && strstr("login", $vars['page'])) { require 'pages/logon.inc.php'; } else { echo '
'; require 'pages/public.inc.php'; echo '
'; echo ''; } } else { require 'pages/logon.inc.php'; } } ?>
MySQL: Cell '.($db_stats['fetchcell']+0).'/'.round($db_stats['fetchcell_sec']+0, 3).'s'. ' Row '.($db_stats['fetchrow']+0). '/'.round($db_stats['fetchrow_sec']+0, 3).'s'. ' Rows '.($db_stats['fetchrows']+0).'/'.round($db_stats['fetchrows_sec']+0, 3).'s'. ' Column '.($db_stats['fetchcol']+0). '/'.round($db_stats['fetchcol_sec']+0, 3).'s'); $fullsize = memory_get_usage(); unset($cache); $cachesize = $fullsize - memory_get_usage(); if ($cachesize < 0) { $cachesize = 0; } // Silly PHP! echo('
Cached data in memory is '.formatStorage($cachesize).'. Page memory usage is '.formatStorage($fullsize).', peaked at '. formatStorage(memory_get_peak_usage()) .'.'); echo('
Generated in ' . $gentime . ' seconds.'); } if (isset($pagetitle) && is_array($pagetitle)) { # if prefix is set, put it in front if ($config['page_title_prefix']) { array_unshift($pagetitle, $config['page_title_prefix']); } # if suffix is set, put it in the back if ($config['page_title_suffix']) { $pagetitle[] = $config['page_title_suffix']; } # create and set the title $title = join(" - ", $pagetitle); echo(""); } ?> 0) { $msg_box[] = array('type' => 'warning', 'message' => "It appears as though you have some devices that haven't completed polling within the last 15 minutes, you may want to check that out :)",'title' => 'Devices unpolled'); } if (is_array($msg_box)) { echo(""); } if (is_array($sql_debug) && is_array($php_debug) && $_SESSION['authenticated'] === true) { require_once "includes/print-debug.php"; } if ($no_refresh !== true && $config['page_refresh'] != 0) { $refresh = $config['page_refresh'] * 1000; echo(''); } else { echo(''); } ?>