add default from/to for a graph, allow negative from to subtract time from to/now

git-svn-id: http://www.observium.org/svn/observer/trunk@2905 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-03-20 10:04:00 +00:00
parent c733d589b5
commit 324c4ce304

View File

@@ -1,7 +1,5 @@
<?php
$from = mres($_GET['from']);
$to = mres($_GET['to']);
$width = mres($_GET['width']);
$height = mres($_GET['height']);
$title = mres($_GET['title']);
@@ -9,6 +7,11 @@ $vertical = mres($_GET['vertical']);
$legend = mres($_GET['legend']);
$id = mres($_GET['id']);
$from = (isset($_GET['from']) ? mres($_GET['from']) : time() - 60*60*24);
$to = (isset($_GET['to']) ? mres($_GET['to']) : time());
if ($from < 0) { $from = $to + $from; }
$graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
preg_match('/^(?P<type>[A-Za-z0-9]+)_(?P<subtype>.+)/', mres($_GET['type']), $graphtype);