fix graphs without from or to, also my days only have 24 hours

git-svn-id: http://www.observium.org/svn/observer/trunk@2515 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-09-19 15:27:43 +00:00
parent 441c86304d
commit 9b270dd1e5

View File

@@ -13,8 +13,8 @@ if($_SESSION['widescreen'])
$thumb_width=113;
}
if (is_numeric($vars['from'])) { $from = $vars['from']; } else { $from = $config['time']['day']; }
if (is_numeric($vars['to'])) { $to = $vars['to']; } else { $to = $config['time']['now']; }
if (!is_numeric($vars['from'])) { $vars['from'] = $config['time']['day']; }
if (!is_numeric($vars['to'])) { $vars['to'] = $config['time']['now']; }
preg_match('/^(?P<type>[A-Za-z0-9]+)_(?P<subtype>.+)/', mres($vars['type']), $graphtype);
@@ -52,13 +52,12 @@ if (!$auth)
echo("<div style='margin: auto;'>");
$thumb_array = array('sixhour' => '6 Hours', 'day' => '25 Hours', 'twoday' => '48 Hours', 'week' => 'One Week', 'twoweek' => 'Two Weeks',
$thumb_array = array('sixhour' => '6 Hours', 'day' => '24 Hours', 'twoday' => '48 Hours', 'week' => 'One Week', 'twoweek' => 'Two Weeks',
'month' => 'One Month', 'twomonth' => 'Two Months','year' => 'One Year', 'twoyear' => 'Two Years');
foreach ($thumb_array as $period => $text)
{
$graph_array['from'] = $config['time'][$period];
$link_array = $vars;
@@ -80,7 +79,7 @@ if (!$auth)
$graph_array['height'] = "300";
$graph_array['width'] = $graph_width;
echo generate_graph_js_state($graph_array);
echo("<div style='width: ".$graph_array['width']."; margin: auto;'>");