add appendEntity() function to ExtendedDocument - note that it only works for *named...
[php-utility-classes.git] / testbed / rrd / rrd-stat.php
1 <?php
2 date_default_timezone_set("Europe/Vienna");
3 $myfile = $_SERVER['SCRIPT_FILENAME'];
4 while (is_link($myfile)) { $myfile = readlink($myfile); }
5 if (getcwd() != dirname($myfile)) {
6   // change to directory of the script if called from different directory
7   $orig_workingdir = getcwd();
8   chdir(dirname($myfile));
9 }
10
11 include_once('rrdstat.php-class');
12
13 // $GLOBALS['ua'] is required by some page generation routines
14 include_once('useragent.php-class');
15 $ua = new userAgent();
16
17 $rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
18 if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
19 include_once($rrd_config_file);
20
21 // view stats
22 $sname = isset($_GET['stat'])?$_GET['stat']:null;
23 if (is_null($sname) || !strlen($sname)) { $sname = 'index'; }
24
25 // call RRD module
26 $rrds = new rrdstat($rrd_info, $sname);
27
28 $psub = isset($_GET['sub'])?$_GET['sub']:null;
29 print($rrds->page($psub));
30 ?>