-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcycle_helpers.php
More file actions
45 lines (40 loc) · 1.51 KB
/
cycle_helpers.php
File metadata and controls
45 lines (40 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2026 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
+-------------------------------------------------------------------------+
*/
if (!function_exists('cycle_get_default_tree_id')) {
function cycle_get_default_tree_id($tree_id) {
if (empty($tree_id)) {
$tree_id = db_fetch_cell('SELECT id
FROM graph_tree
ORDER BY name
LIMIT 1');
}
return $tree_id;
}
}
if (!function_exists('cycle_get_request_context')) {
function cycle_get_request_context() {
$context = array(
'legend' => get_request_var('legend'),
'tree_id' => get_request_var('tree_id'),
'leaf_id' => get_request_var('leaf_id'),
'graphs' => get_request_var('graphs'),
'cols' => get_request_var('cols'),
'rfilter' => get_request_var('rfilter'),
'id' => get_request_var('id'),
'width' => get_request_var('width'),
'height' => get_request_var('height')
);
$context['tree_id'] = cycle_get_default_tree_id($context['tree_id']);
$context['id'] = (empty($context['id']) ? -1 : $context['id']);
return $context;
}
}