2009-09-07 11:07:59 +00:00
< ? php
2011-05-12 23:17:44 +00:00
2012-05-09 10:01:42 +00:00
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage webinterface
* @author Adam Armstrong <adama@memetic.org>
* @copyright (C) 2006 - 2012 Adam Armstrong
*
*/
2012-02-06 17:39:31 +00:00
include ( " ../includes/defaults.inc.php " );
include ( " ../config.php " );
2012-05-09 10:01:42 +00:00
include_once ( " ../includes/definitions.inc.php " );
2012-02-06 17:39:31 +00:00
include ( " ../includes/functions.php " );
include ( " includes/functions.inc.php " );
2014-01-15 02:51:25 +00:00
// 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 ;
}
2012-02-06 17:39:31 +00:00
$runtime_start = utime ();
2011-03-17 11:48:03 +00:00
ob_start ();
ini_set ( 'allow_url_fopen' , 0 );
ini_set ( 'display_errors' , 0 );
2007-11-23 11:37:28 +00:00
2011-09-21 09:22:45 +00:00
$_SERVER [ 'PATH_INFO' ] = ( isset ( $_SERVER [ 'PATH_INFO' ]) ? $_SERVER [ 'PATH_INFO' ] : $_SERVER [ 'ORIG_PATH_INFO' ]);
2011-09-21 09:21:30 +00:00
2011-09-17 18:58:58 +00:00
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 );
2011-04-29 22:29:42 +00:00
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-10-03 13:40:37 +00:00
foreach ( $_GET as $key => $get_var )
{
if ( strstr ( $key , " opt " ))
{
2011-09-14 13:38:01 +00:00
list ( $name , $value ) = explode ( " | " , $get_var );
2011-09-20 14:37:54 +00:00
if ( ! isset ( $value )) { $value = " yes " ; }
2011-09-14 13:38:01 +00:00
$vars [ $name ] = $value ;
}
}
2012-04-05 14:02:32 +00:00
$segments = explode ( '/' , trim ( $_SERVER [ 'REQUEST_URI' ], '/' ));
2011-10-03 13:40:37 +00:00
foreach ( $segments as $pos => $segment )
{
2011-09-14 13:38:01 +00:00
$segment = urldecode ( $segment );
2011-09-20 14:37:54 +00:00
if ( $pos == " 0 " )
2011-09-14 13:38:01 +00:00
{
$vars [ 'page' ] = $segment ;
} else {
list ( $name , $value ) = explode ( " = " , $segment );
2011-09-20 14:37:54 +00:00
if ( $value == " " || ! isset ( $value ))
2011-09-14 13:38:01 +00:00
{
$vars [ $name ] = yes ;
} else {
$vars [ $name ] = $value ;
}
}
}
2011-10-04 09:10:21 +00:00
foreach ( $_GET as $name => $value )
2011-09-22 18:18:15 +00:00
{
$vars [ $name ] = $value ;
}
2011-10-04 09:10:21 +00:00
foreach ( $_POST as $name => $value )
2011-09-14 13:38:01 +00:00
{
2011-09-22 18:18:15 +00:00
$vars [ $name ] = $value ;
2011-09-14 13:38:01 +00:00
}
2012-04-27 17:18:26 +00:00
include ( " includes/authenticate.inc.php " );
2012-01-19 17:33:32 +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
# 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
}
2012-04-17 10:53:24 +00:00
# page_title_prefix is displayed, unless page_title is set
if ( $config [ 'page_title' ]) { $config [ 'page_title_prefix' ] = $config [ 'page_title' ]; }
2012-04-17 15:27:17 +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>
2014-01-28 14:59:15 +00:00
<title><?php echo($config['page_title_suffix']); ?></title>
2008-03-15 17:58:15 +00:00
<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" />
2014-01-13 07:59:31 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2008-03-23 21:32:54 +00:00
<?php
2012-04-09 10:53:55 +00:00
if ($config['page_refresh']) { echo(' <meta http-equiv="refresh" content="'.$config['page_refresh'].'" />' . "\n"); }
2008-03-23 21:32:54 +00:00
?>
2014-01-13 07:59:31 +00:00
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
2011-03-26 19:28:39 +00:00
<link href="<?php echo($config['stylesheet']); ?>" rel="stylesheet" type="text/css" />
2014-01-13 07:59:31 +00:00
<link href="css/typeahead.js-bootstrap.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-hover-dropdown.min.js"></script>
<script src="js/typeahead.min.js"></script>
<script src="js/hogan-2.0.0.js"></script>
<script src="js/jquery.cycle2.min.js"></script>
2013-10-29 08:08:23 +10:00
<?php
if ($config['favicon']) { echo(' <link rel="shortcut icon" href="'.$config['favicon'].'" />' . "\n"); }
?>
2014-01-13 07:59:31 +00:00
<!--<link rel="stylesheet" href="css/mktree.css" type="text/css" />-->
2012-05-03 13:52:34 +00:00
<?php
2014-01-13 07:59:31 +00:00
//if ($_SESSION['widescreen']) { echo('<link rel="stylesheet" href="css/styles-wide.css" type="text/css" />'); }
2012-05-03 13:52:34 +00:00
?>
2014-01-13 07:59:31 +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.min.js"></script>-->
<!--<script type="text/javascript" src="js/jquery-checkbox.js"></script>-->
2014-01-13 10:05:19 +00:00
<!--<script type="text/javascript" src="js/bootstrap.min.js"></script>-->
<!--<script type="text/javascript" src="js/qtip/jquery.qtip.min.js"></script>-->
<!--<link rel="stylesheet" href="css/jquery.qtip.min.css" type="text/css">-->
2014-01-13 07:59:31 +00:00
<!--<?php /* html5.js below from http://html5shim.googlecode.com/svn/trunk/html5.js */ ?>-->
2012-05-03 13:52:34 +00:00
<!--[if IE]><script src="js/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]-->
2014-01-13 07:59:31 +00:00
<!--<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.min.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;
});
});
});
2011-09-20 09:55:11 +00:00
2011-09-14 13:38:01 +00:00
//-->
</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>
2011-09-29 12:57:44 +00:00
<script type="text/javascript" src="js/overlib_mini.js"></script>
2014-01-13 07:59:31 +00:00
</head>
<body>
2007-04-03 14:10:23 +00:00
2011-03-26 19:28:39 +00:00
<?php
2007-04-03 14:10:23 +00:00
2012-01-19 17:33:32 +00:00
if (!$vars['bare'] == "yes") {
2011-09-14 13:38:01 +00:00
2014-01-13 07:59:31 +00:00
if ($_SESSION['authenticated']) {
include("includes/print-menubar.php");
} else {
echo('<hr color="#444444" />');
}
2011-09-14 13:38:01 +00:00
}
2007-04-03 14:10:23 +00:00
2011-03-26 19:28:39 +00:00
?>
2014-01-13 07:59:31 +00:00
<br />
2014-02-23 11:57:39 +00:00
<div class="container-fluid">
2014-01-13 07:59:31 +00:00
<div class="row">
<div class="col-md-12">
<br /><br />
</div>
</div>
<div class="row">
2014-02-23 11:57:39 +00:00
<div class="col-md-1">
</div>
<div class="col-md-10">
2007-04-03 14:10:23 +00:00
<?php
2011-09-15 21:18:57 +00:00
2012-05-25 12:24:34 +00:00
// To help debug the new URLs :)
2012-01-19 17:33:32 +00:00
if ($devel || $vars['devel'])
2011-09-15 21:18:57 +00:00
{
echo("<pre>");
print_r($_GET);
print_r($vars);
echo("</pre>");
}
2011-03-17 11:48:03 +00:00
if ($_SESSION['authenticated'])
{
2012-05-25 12:24:34 +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
}
2008-07-22 08:24:34 +00:00
2011-03-17 11:48:03 +00:00
} else {
2012-05-25 12:24:34 +00:00
// Not Authenticated. Print login.
2011-03-23 09:54:56 +00:00
include("pages/logon.inc.php");
2012-04-06 15:01:58 +00:00
2011-03-23 09:54:56 +00:00
exit;
2011-03-17 11:48:03 +00:00
}
2007-04-03 14:10:23 +00:00
?>
2014-02-23 11:57:39 +00:00
</div>
<div class="col-md-1">
</div>
</div>
2007-04-03 14:10:23 +00:00
<?php
2012-02-06 17:39:31 +00:00
$runtime_end = utime(); $runtime = $runtime_end - $runtime_start;
$gentime = substr($runtime, 0, 5);
2010-03-27 22:20:57 +00:00
2013-11-05 10:23:15 +10:00
# FIXME - move this
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-05-19 10:02:55 +00:00
2012-01-19 17:33:32 +00:00
$fullsize = memory_get_usage();
unset($cache);
$cachesize = $fullsize - memory_get_usage();
2012-04-07 17:17:18 +00:00
if ($cachesize < 0) { $cachesize = 0; } // Silly PHP!
2012-01-19 17:33:32 +00:00
echo('<br />Cached data in memory is '.formatStorage($cachesize).'. Page memory usage is '.formatStorage($fullsize).', peaked at '. formatStorage(memory_get_peak_usage()) .'.');
2011-03-17 11:48:03 +00:00
echo('<br />Generated in ' . $gentime . ' seconds.');
}
2007-04-03 14:10:23 +00:00
?>
2011-10-03 13:40:37 +00:00
<script class="content_tooltips" type="text/javascript">
2011-09-14 13:38:01 +00:00
$(document).ready(function() { $('#content a[title]').qtip({ content: { text: false }, style: 'light' }); });
2011-09-19 11:15:01 +00:00
2011-09-20 14:37:54 +00:00
$('INPUT.auto-hint, TEXTAREA.auto-hint').focus(function() {
if ($(this).val() == $(this).attr('title')) {
2011-09-19 11:15:01 +00:00
$(this).val('');
$(this).removeClass('auto-hint');
}
});
2011-10-18 14:27:21 +00:00
2011-10-03 13:40:37 +00:00
</script>
2011-09-19 11:15:01 +00:00
2011-10-18 14:27:21 +00:00
<?php
if (is_array($pagetitle))
{
2012-04-17 10:48:35 +00:00
# if prefix is set, put it in front
if ($config['page_title_prefix']) { array_unshift($pagetitle,$config['page_title_prefix']); }
2012-04-17 15:27:17 +00:00
2012-04-17 10:48:35 +00:00
# if suffix is set, put it in the back
if ($config['page_title_suffix']) { $pagetitle[] = $config['page_title_suffix']; }
2012-04-17 15:27:17 +00:00
2012-04-17 10:48:35 +00:00
# create and set the title
2011-10-18 14:27:21 +00:00
$title = join(" - ",$pagetitle);
echo("<script type=\"text/javascript\">\ndocument.title = '$title';\n</script>");
}
?>
2014-01-13 07:59:31 +00:00
<footer>
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<?php
echo('<br /> <br /> ' . (isset($config['footer']) ? $config['footer'] : ''));
echo('<br />Powered by <a href="' . $config['project_url'] . '" target="_blank">' . $config['project_name_version'].'</a>. ');
echo($config['project_name'].' is <a href="http://www.gnu.org/philosophy/free-sw.html">Free Software</a>, released under the <a href="http://www.gnu.org/copyleft/gpl.html">GNU GPLv3</a>.<br/>');
echo('Copyright © 2006-2012 by Adam Armstrong. Copyright © 2013-'.date("Y").' by the '.$config['project_name'].' Contributors.');
?>
</div>
</div>
</div>
</footer>
2011-10-03 13:40:37 +00:00
</body>
2007-04-03 14:10:23 +00:00
</html>