diff --git a/.gitignore b/.gitignore index eb71606..32791f0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ # +-------------------------------------------------------------------------+ locales/po/*.mo +.omc/ diff --git a/cycle.php b/cycle.php index fc996d1..0081dd0 100644 --- a/cycle.php +++ b/cycle.php @@ -56,6 +56,14 @@ break; } +function cycle_get_timespan() { + $timespan = []; + $first_weekdayid = read_user_setting('first_weekdayid'); + get_timespan($timespan, time(), get_request_var('timespan'), $first_weekdayid); + + return $timespan; +} + function cycle_graphs() { global $graphs_ppage, $graph_cols, $graphs; global $page_refresh_interval, $graph_timespans; @@ -77,9 +85,7 @@ function cycle_graphs() { if (empty($id)) $id = -1; /* get the start and end times for the graph */ - $timespan = array(); - $first_weekdayid = read_user_setting('first_weekdayid'); - get_timespan($timespan, time(), get_request_var('timespan'), $first_weekdayid); + $timespan = cycle_get_timespan(); $graph_tree = $tree_id; $html = ''; @@ -176,9 +182,7 @@ function cycle() { } /* get the start and end times for the graph */ - $timespan = array(); - $first_weekdayid = read_user_setting('first_weekdayid'); - get_timespan($timespan, time(), get_request_var('timespan') , $first_weekdayid); + $timespan = cycle_get_timespan(); $graph_tree = $tree_id; $html = ''; @@ -300,7 +304,7 @@ function cycle() { WHERE title != "" AND graph_tree_id = ? ORDER BY parent, position', - array($graph_tree)); + [$graph_tree]); if (cacti_sizeof($leaves)) { $html .= "