Files
librenms-librenms/html/index.php
T

318 lines
9.0 KiB
PHP
Raw Normal View History

2009-09-07 11:07:59 +00:00
<?php
2011-05-12 23:17:44 +00:00
2011-03-17 11:48:03 +00:00
ob_start();
ini_set('allow_url_fopen', 0);
ini_set('display_errors', 0);
if (strpos($_SERVER['PATH_INFO'], "debug"))
2011-03-17 11:48:03 +00:00
{
2011-03-23 09:54:56 +00:00
$debug = "1";
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('log_errors', 1);
ini_set('error_reporting', E_ALL);
2010-08-21 12:54:42 +00:00
} else {
2011-03-23 09:54:56 +00:00
$debug = FALSE;
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
ini_set('log_errors', 0);
ini_set('error_reporting', 0);
2007-04-03 14:10:23 +00:00
}
2011-03-17 11:48:03 +00:00
include("../includes/defaults.inc.php");
include("../config.php");
include("../includes/functions.php");
include("includes/functions.inc.php");
2011-09-04 21:50:48 +00:00
include("includes/authenticate.inc.php");
2011-09-14 13:38:01 +00:00
foreach($_GET as $key=>$get_var) {
if(strstr($key, "opt")) {
list($name, $value) = explode("|", $get_var);
if(!isset($value)) { $value = "yes"; }
$vars[$name] = $value;
}
}
$segments = explode('/', trim($_SERVER['PATH_INFO'], '/'));
2011-09-14 13:38:01 +00:00
foreach($segments as $pos => $segment) {
$segment = urldecode($segment);
if($pos == "0")
{
$vars['page'] = $segment;
} else {
if(TRUE) // do this to keep everything working whilst we fiddle
{
if ($pos == "1")
{
$_GET['opta'] = $segment;
}
if ($pos == "2")
{
$_GET['optb'] = $segment;
}
if ($pos == "3")
{
$_GET['optc'] = $segment;
}
if ($pos == "4")
{
$_GET['optd'] = $segment;
}
if ($pos == "5")
{
$_GET['opte'] = $segment;
}
if ($pos == "6")
{
$_GET['optf'] = $segment;
}
}
list($name, $value) = explode("=", $segment);
if($value == "" || !isset($value))
{
$vars[$name] = yes;
} else {
$vars[$name] = $value;
}
}
}
foreach($_POST as $name => $value)
{
# if($value == "" || !isset($value))
# {
# } else {
$vars[$name] = $value;
# }
}
#print_r($vars);
2011-09-08 16:16:45 +00:00
if(strstr($_SERVER['REQUEST_URI'], 'widescreen=yes')) { $_SESSION['widescreen'] = 1; }
if(strstr($_SERVER['REQUEST_URI'], 'widescreen=no')) { unset($_SESSION['widescreen']); }
2011-09-04 21:50:48 +00:00
2011-03-17 11:48:03 +00:00
$start = utime();
2011-05-17 19:21:20 +00:00
2011-03-17 11:48:03 +00:00
$now = time();
2011-05-17 19:21:20 +00:00
$fourhour = time() - (4 * 60 * 60);
2011-03-17 11:48:03 +00:00
$day = time() - (24 * 60 * 60);
$twoday = time() - (2 * 24 * 60 * 60);
$week = time() - (7 * 24 * 60 * 60);
$month = time() - (31 * 24 * 60 * 60);
$year = time() - (365 * 24 * 60 * 60);
# Load the settings for Multi-Tenancy.
2011-05-05 14:39:50 +00:00
if (isset($config['branding']) && is_array($config['branding']))
2011-03-26 19:12:24 +00:00
{
2011-03-23 09:54:56 +00:00
if ($config['branding'][$_SERVER['SERVER_NAME']])
{
foreach ($config['branding'][$_SERVER['SERVER_NAME']] as $confitem => $confval)
2011-03-17 11:48:03 +00:00
{
2011-03-23 09:54:56 +00:00
eval("\$config['" . $confitem . "'] = \$confval;");
}
} else {
foreach ($config['branding']['default'] as $confitem => $confval)
{
eval("\$config['" . $confitem . "'] = \$confval;");
2011-03-17 11:48:03 +00:00
}
2011-03-23 09:54:56 +00:00
}
2011-03-17 11:48:03 +00:00
}
2007-04-03 14:10:23 +00:00
?>
2011-09-02 19:25:54 +00:00
<!DOCTYPE HTML>
<html>
2007-04-03 14:10:23 +00:00
<head>
2008-10-30 21:27:48 +00:00
<title><?php echo($config['page_title']); ?></title>
<base href="<?php echo($config['base_url']); ?>" />
2009-03-17 20:29:54 +00:00
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="content-language" content="en-us" />
2008-03-23 21:32:54 +00:00
<?php
2011-03-17 11:48:03 +00:00
if ($config['page_refresh']) { echo("<meta http-equiv='refresh' content='".$config['page_refresh']."'>"); }
2008-03-23 21:32:54 +00:00
?>
<link href="<?php echo($config['stylesheet']); ?>" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="<?php echo($config['favicon']); ?>" />
2010-01-09 00:17:02 +00:00
<link rel="stylesheet" href="css/mktree.css" type="text/css" />
2011-09-04 21:50:48 +00:00
<?php
if ($_SESSION['widescreen']) { echo('<link rel="stylesheet" href="css/styles-wide.css" type="text/css" />'); }
?>
2007-04-03 14:10:23 +00:00
</head>
<body>
2010-01-10 18:47:32 +00:00
<script type="text/javascript" src="js/mktree.js"></script>
<script type="text/javascript" src="js/sorttable.js"></script>
<script type="text/javascript" src="js/jquery-1.5.2.min.js"></script>
2011-04-02 12:08:08 +00:00
<script type="text/javascript" src="js/jquery-checkbox.js"></script>
<script type="text/javascript" src="js/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
2011-09-02 19:25:54 +00:00
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="js/jqplot/excanvas.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="js/jqplot/jquery.jqplot.min.js"></script>
<link rel="stylesheet" type="text/css" href="js/jqplot/jquery.jqplot.css" />
<script type="text/javascript" src="js/jqplot/plugins/jqplot.pieRenderer.min.js"></script>
<script type="text/javascript" src="js/jqplot/plugins/jqplot.donutRenderer.min.js"></script>
2011-03-23 09:54:56 +00:00
<script type="text/javascript">
2011-09-14 13:38:01 +00:00
<!--
$(function () {
$('.bubbleInfo').each(function () {
var distance = 10;
var time = 250;
var hideDelay = 500;
var hideDelayTimer = null;
var beingShown = false;
var shown = false;
var trigger = $('.trigger', this);
var info = $('.popup', this).css('opacity', 0);
$([trigger.get(0), info.get(0)]).mouseover(function () {
if (hideDelayTimer) clearTimeout(hideDelayTimer);
if (beingShown || shown) {
// don't trigger the animation again
return;
} else {
// reset position of info box
beingShown = true;
info.css({
top: -90,
left: -33,
display: 'block'
}).animate({
top: '-=' + distance + 'px',
opacity: 1
}, time, 'swing', function() {
beingShown = false;
shown = true;
});
}
return false;
}).mouseout(function () {
if (hideDelayTimer) clearTimeout(hideDelayTimer);
hideDelayTimer = setTimeout(function () {
hideDelayTimer = null;
info.animate({
top: '-=' + distance + 'px',
opacity: 0
}, time, 'swing', function () {
shown = false;
info.css('display', 'none');
});
}, hideDelay);
return false;
});
});
});
//-->
</script>
<script type="text/javascript">
2007-04-03 14:10:23 +00:00
<!-- Begin
2011-03-17 11:48:03 +00:00
function popUp(URL)
{
2011-03-23 09:54:56 +00:00
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600');");
2007-04-03 14:10:23 +00:00
}
// End -->
2011-03-23 09:54:56 +00:00
</script>
2010-01-10 18:47:32 +00:00
<script type="text/javascript" src="js/overlib.js"></script>
<div id="container">
2007-04-03 14:10:23 +00:00
<?php
2007-04-03 14:10:23 +00:00
2011-09-14 13:38:01 +00:00
if(!$vars['bare'] == "yes") {
include("includes/".$config['web_header']);
2009-06-19 10:43:02 +00:00
2011-09-14 13:38:01 +00:00
if ($_SESSION['authenticated']) { include("includes/print-menubar.php"); } else { echo('<hr color="#444444" />'); }
}
2007-04-03 14:10:23 +00:00
?>
2010-01-10 18:47:32 +00:00
<div class="clearer"></div>
<div id="content" style="min-height:650px; width:auto; display:block;">
<div style="clear:both; height:6px; display:block;"></div>
2007-04-03 14:10:23 +00:00
<?php
### To help debug the new URLs :)
if($devel || $vars['devel'])
{
echo("<pre>");
print_r($_GET);
print_r($vars);
echo("</pre>");
}
2011-03-17 11:48:03 +00:00
if ($_SESSION['authenticated'])
{
2011-03-23 09:54:56 +00:00
## Authenticated. Print a page.
2011-09-14 13:38:01 +00:00
if (isset($vars['page']) && !strstr("..", $vars['page']) && is_file("pages/" . $vars['page'] . ".inc.php"))
2011-03-23 09:54:56 +00:00
{
2011-09-14 13:38:01 +00:00
include("pages/" . $vars['page'] . ".inc.php");
2011-03-23 09:54:56 +00:00
} else {
if (isset($config['front_page']) && is_file($config['front_page']))
2011-03-17 11:48:03 +00:00
{
2011-03-23 09:54:56 +00:00
include($config['front_page']);
2011-03-17 11:48:03 +00:00
} else {
2011-03-23 09:54:56 +00:00
include("pages/front/default.php");
2007-04-03 14:10:23 +00:00
}
2011-03-23 09:54:56 +00:00
}
2011-03-17 11:48:03 +00:00
} else {
2011-03-23 09:54:56 +00:00
## Not Authenticated. Print login.
include("pages/logon.inc.php");
exit;
2011-03-17 11:48:03 +00:00
}
2007-04-03 14:10:23 +00:00
?>
</div>
2010-01-10 18:47:32 +00:00
<div class="clearer"></div>
</div>
2007-04-03 14:10:23 +00:00
<?php
2011-03-17 11:48:03 +00:00
$end = utime(); $run = $end - $start;
$gentime = substr($run, 0, 5);
2011-03-17 11:48:03 +00:00
echo('<br /> <br /> <br /> <br /> <div id="footer">' . (isset($config['footer']) ? $config['footer'] : ''));
echo('<br />Powered by <a href="http://www.observium.org" target="_blank">Observium ' . $config['version']);
2011-03-17 11:48:03 +00:00
echo('</a>. Copyright &copy; 2006-'. date("Y"). ' by Adam Armstrong. All rights reserved.');
2011-03-17 11:48:03 +00:00
if ($config['page_gen'])
{
2011-09-14 13:38:01 +00:00
echo('<br />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');
2011-03-17 11:48:03 +00:00
echo('<br />Generated in ' . $gentime . ' seconds.');
}
2011-03-17 11:48:03 +00:00
echo('</div>');
2007-04-03 14:10:23 +00:00
?>
2011-09-14 13:38:01 +00:00
<script class="content_tooltips" type="text/javascript">
$(document).ready(function() { $('#content a[title]').qtip({ content: { text: false }, style: 'light' }); });
2011-09-19 11:15:01 +00:00
$('INPUT.auto-hint, TEXTAREA.auto-hint').focus(function(){
if($(this).val() == $(this).attr('title')){
$(this).val('');
$(this).removeClass('auto-hint');
}
});
2011-09-14 13:38:01 +00:00
</script>
2007-04-03 14:10:23 +00:00
</body>
</html>