]>
Commit | Line | Data |
---|---|---|
04176383 GS |
1 | diff -Naur cacti-0.8.6i-old/auth_login.php cacti-0.8.6i/auth_login.php |
2 | --- cacti-0.8.6i-old/auth_login.php 2007-01-23 21:29:26.000000000 -0600 | |
3 | +++ cacti-0.8.6i/auth_login.php 2007-01-02 01:32:14.000000000 -0600 | |
4 | @@ -111,9 +111,16 @@ | |
5 | 'Location' does not work. This seems to fix the bug for me at least... --> | |
6 | <form name="login" method="post" action="<?php print basename($_SERVER["PHP_SELF"]);?>"> | |
7 | ||
8 | +<?php do_hook("login_before"); | |
9 | + | |
10 | +$cacti_logo = $config['url_path'] . 'images/auth_login.gif'; | |
11 | +$cacti_logo = do_hook_function('cacti_image', $cacti_logo); | |
12 | + | |
13 | +?> | |
14 | + | |
15 | <table align="center"> | |
16 | <tr> | |
17 | - <td colspan="2"><img src="images/auth_login.gif" border="0" alt=""></td> | |
18 | + <td colspan="2"><center><?php if ($cacti_logo != '') { ?><img src="<?php echo $cacti_logo; ?>" border="0" alt=""><?php } ?></center></td> | |
19 | </tr> | |
20 | <?php | |
21 | if ($_REQUEST["action"] == "login") {?> | |
22 | @@ -155,6 +162,8 @@ | |
23 | ||
24 | <input type="hidden" name="action" value="login"> | |
25 | ||
26 | +<?php do_hook("login_after"); ?> | |
27 | + | |
28 | </form> | |
29 | ||
30 | </body> | |
31 | diff -Naur cacti-0.8.6i-old/data_sources.php cacti-0.8.6i/data_sources.php | |
32 | --- cacti-0.8.6i-old/data_sources.php 2007-01-23 21:29:26.000000000 -0600 | |
33 | +++ cacti-0.8.6i/data_sources.php 2007-01-23 14:47:07.000000000 -0600 | |
34 | @@ -1072,18 +1072,25 @@ | |
35 | foreach ($data_sources as $data_source) { | |
36 | $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]); | |
37 | form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; | |
38 | + | |
39 | + $ds_table['data_source'] = $data_source; | |
40 | + $ds_table['data_input_name'] = $data_source['data_input_name']; | |
41 | + $ds_table['active'] = (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>"); | |
42 | + $ds_table['template_name'] = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]); | |
43 | + $ds_table = do_hook_function("data_sources_table", $ds_table); | |
44 | + | |
45 | ?> | |
46 | <td> | |
47 | <a class='linkEditMain' href='data_sources.php?action=ds_edit&id=<?php print $data_source["local_data_id"];?>' title='<?php print $data_source["name_cache"];?>'><?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim($data_source["name_cache"], read_config_option("max_title_data_source"))); }else{ print title_trim($data_source["name_cache"], read_config_option("max_title_data_source")); } ?></a> | |
48 | </td> | |
49 | <td> | |
50 | - <?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_source["data_input_name"]); }else{ print $data_source["data_input_name"]; } ?></a> | |
51 | + <?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $ds_table['data_input_name']); }else{ print $ds_table['data_input_name']; } ?></a> | |
52 | </td> | |
53 | <td> | |
54 | - <?php print (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");?> | |
55 | + <?php print $ds_table['active']; ?> | |
56 | </td> | |
57 | <td> | |
58 | - <?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_template_name); }else{ print $data_template_name; } ?></a> | |
59 | + <?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $ds_table['template_name']); }else{ print $ds_table['template_name']; } ?></a> | |
60 | </td> | |
61 | <td style="<?php print get_checkbox_style();?>" width="1%" align="right"> | |
62 | <input type='checkbox' style='margin: 0px;' name='chk_<?php print $data_source["local_data_id"];?>' title="<?php print $data_source["name_cache"];?>"> | |
63 | diff -Naur cacti-0.8.6i-old/graph_image.php cacti-0.8.6i/graph_image.php | |
64 | --- cacti-0.8.6i-old/graph_image.php 2007-01-23 21:29:26.000000000 -0600 | |
65 | +++ cacti-0.8.6i/graph_image.php 2007-01-02 01:32:14.000000000 -0600 | |
66 | @@ -46,6 +46,8 @@ | |
67 | /* flush the headers now */ | |
68 | ob_end_flush(); | |
69 | ||
70 | +do_hook_function('graph_image'); | |
71 | + | |
72 | session_write_close(); | |
73 | ||
74 | $graph_data_array = array(); | |
75 | diff -Naur cacti-0.8.6i-old/graph.php cacti-0.8.6i/graph.php | |
76 | --- cacti-0.8.6i-old/graph.php 2007-01-23 21:29:26.000000000 -0600 | |
77 | +++ cacti-0.8.6i/graph.php 2007-01-02 01:32:14.000000000 -0600 | |
78 | @@ -89,11 +89,12 @@ | |
79 | <table width='1' cellpadding='0'> | |
80 | <tr> | |
81 | <td> | |
82 | - <img src='graph_image.php?local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $rra["id"];?>' border='0' alt='<?php print $graph_title;?>'> | |
83 | + <img src='graph_image.php?action=view&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $rra["id"];?>' border='0' alt='<?php print $graph_title;?>'> | |
84 | </td> | |
85 | <td valign='top' style='padding: 3px;' class='noprint'> | |
86 | <a href='graph.php?action=zoom&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $rra["id"];?>&view_type=<?php print $_REQUEST["view_type"];?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br> | |
87 | <a href='graph.php?action=properties&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $rra["id"];?>&view_type=<?php print $_REQUEST["view_type"];?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a> | |
88 | + <?php do_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => $_GET["local_graph_id"], 'rra' => $rra["id"], 'view_type' => $_REQUEST["view_type"])); ?> | |
89 | </td> | |
90 | </tr> | |
91 | <tr> | |
92 | @@ -204,10 +205,11 @@ | |
93 | <table width='1' cellpadding='0'> | |
94 | <tr> | |
95 | <td> | |
96 | - <img id='zoomGraphImage' src='graph_image.php?local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_REQUEST["view_type"];?>&graph_start=<?php print $graph_start;?>&graph_end=<?php print $graph_end;?>&graph_height=<?php print $graph_height;?>&graph_width=<?php print $graph_width;?>&title_font_size=<?php print $title_font_size ?>' border='0' alt='<?php print $graph_title;?>'> | |
97 | + <img id='zoomGraphImage' src='graph_image.php?action=zoom&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_REQUEST["view_type"];?>&graph_start=<?php print $graph_start;?>&graph_end=<?php print $graph_end;?>&graph_height=<?php print $graph_height;?>&graph_width=<?php print $graph_width;?>&title_font_size=<?php print $title_font_size ?>' border='0' alt='<?php print $graph_title;?>'> | |
98 | </td> | |
99 | <td valign='top' style='padding: 3px;' class='noprint'> | |
100 | - <a href='graph.php?action=properties&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_REQUEST["view_type"];?>&graph_start=<?php print $graph_start;?>&graph_end=<?php print $graph_end;?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a> | |
101 | + <a href='graph.php?action=properties&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_REQUEST["view_type"];?>&graph_start=<?php print $graph_start;?>&graph_end=<?php print $graph_end;?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br> | |
102 | + <?php do_hook('graph_buttons', array('hook' => 'zoom', 'local_graph_id' => $_GET["local_graph_id"], 'rra' => $_GET["rra_id"], 'view_type' => $_REQUEST["view_type"])); ?> | |
103 | </td> | |
104 | </tr> | |
105 | <tr> | |
106 | @@ -235,10 +237,11 @@ | |
107 | <table width='1' cellpadding='0'> | |
108 | <tr> | |
109 | <td> | |
110 | - <img src='graph_image.php?local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&graph_start=<?php print (isset($_GET["graph_start"]) ? $_GET["graph_start"] : 0);?>&graph_end=<?php print (isset($_GET["graph_end"]) ? $_GET["graph_end"] : 0);?>' border='0' alt='<?php print $graph_title;?>'> | |
111 | + <img src='graph_image.php?action=properties&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&graph_start=<?php print (isset($_GET["graph_start"]) ? $_GET["graph_start"] : 0);?>&graph_end=<?php print (isset($_GET["graph_end"]) ? $_GET["graph_end"] : 0);?>' border='0' alt='<?php print $graph_title;?>'> | |
112 | </td> | |
113 | <td valign='top' style='padding: 3px;'> | |
114 | <a href='graph.php?action=zoom&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_REQUEST["view_type"];?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br> | |
115 | + <?php do_hook('graph_buttons', array('hook' => 'properties', 'local_graph_id' => $_GET["local_graph_id"], 'rra' => $_GET["rra_id"], 'view_type' => $_REQUEST["view_type"])); ?> | |
116 | </td> | |
117 | </tr> | |
118 | <tr> | |
119 | @@ -259,4 +262,4 @@ | |
120 | ||
121 | include_once("./include/bottom_footer.php"); | |
122 | ||
123 | -?> | |
124 | +?> | |
125 | \ No newline at end of file | |
126 | diff -Naur cacti-0.8.6i-old/graphs_new.php cacti-0.8.6i/graphs_new.php | |
127 | --- cacti-0.8.6i-old/graphs_new.php 2007-01-23 21:29:26.000000000 -0600 | |
128 | +++ cacti-0.8.6i/graphs_new.php 2007-01-23 14:47:07.000000000 -0600 | |
129 | @@ -399,7 +399,8 @@ | |
130 | </td> | |
131 | <td class="textInfo" rowspan="2" valign="top"> | |
132 | <span style="color: #c16921;">*</span><a href="host.php?action=edit&id=<?php print $_REQUEST["host_id"];?>">Edit this Host</a><br> | |
133 | - <span style="color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a> | |
134 | + <span style="color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a><br> | |
135 | + <?php do_hook("graphs_new_top_links"); ?> | |
136 | </td> | |
137 | </tr> | |
138 | <td> | |
139 | diff -Naur cacti-0.8.6i-old/graphs.php cacti-0.8.6i/graphs.php | |
140 | --- cacti-0.8.6i-old/graphs.php 2007-01-23 21:29:26.000000000 -0600 | |
141 | +++ cacti-0.8.6i/graphs.php 2007-01-23 14:47:07.000000000 -0600 | |
142 | @@ -47,6 +47,8 @@ | |
143 | 4 => "Convert to Graph Template" | |
144 | ); | |
145 | ||
146 | +$graph_actions = do_hook_function('graphs_action_array', $graph_actions); | |
147 | + | |
148 | /* set default action */ | |
149 | if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; } | |
150 | ||
151 | @@ -357,8 +359,10 @@ | |
152 | input_validate_input_number($selected_items[$i]); | |
153 | /* ==================================================== */ | |
154 | ||
155 | - api_resize_graphs($selected_items[$i], $_POST["graph_width"], $_POST["graph_height"]); | |
156 | + api_resize_graphs($selected_items[$i], $_POST['graph_width'], $_POST['graph_height']); | |
157 | } | |
158 | + } else { | |
159 | + do_hook_function('graphs_action_execute', $_POST['drp_action']); | |
160 | } | |
161 | ||
162 | header("Location: graphs.php"); | |
163 | @@ -499,6 +503,11 @@ | |
164 | </td> | |
165 | </tr>\n | |
166 | "; | |
167 | + } else { | |
168 | + $save['drp_action'] = $_POST['drp_action']; | |
169 | + $save['graph_list'] = $graph_list; | |
170 | + $save['graph_array'] = $graph_array; | |
171 | + do_hook_function('graphs_action_prepare', $save); | |
172 | } | |
173 | ||
174 | if (!isset($graph_array)) { | |
175 | @@ -930,7 +939,7 @@ | |
176 | <table width="98%" align="center"> | |
177 | <tr> | |
178 | <td align="center" class="textInfo" colspan="2"> | |
179 | - <img src="graph_image.php?local_graph_id=<?php print $_GET["id"];?>&rra_id=<?php print read_graph_config_option("default_rra_id");?>" alt=""> | |
180 | + <img src="graph_image.php?action=edit&local_graph_id=<?php print $_GET["id"];?>&rra_id=<?php print read_graph_config_option("default_rra_id");?>" alt=""> | |
181 | </td> | |
182 | <?php | |
183 | if ((isset($_SESSION["graph_debug_mode"])) && (isset($_GET["id"]))) { | |
184 | @@ -1149,4 +1158,4 @@ | |
185 | print "</form>\n"; | |
186 | } | |
187 | ||
188 | -?> | |
189 | +?> | |
190 | \ No newline at end of file | |
191 | diff -Naur cacti-0.8.6i-old/host.php cacti-0.8.6i/host.php | |
192 | --- cacti-0.8.6i-old/host.php 2007-01-23 21:29:26.000000000 -0600 | |
193 | +++ cacti-0.8.6i/host.php 2007-01-11 22:18:23.000000000 -0600 | |
194 | @@ -44,6 +44,8 @@ | |
195 | 5 => "Clear Statistics" | |
196 | ); | |
197 | ||
198 | +$device_actions = do_hook_function('device_action_array', $device_actions); | |
199 | + | |
200 | /* set default action */ | |
201 | if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; } | |
202 | ||
203 | @@ -280,6 +282,8 @@ | |
204 | ||
205 | api_tree_item_save(0, $_POST["tree_id"], TREE_ITEM_TYPE_HOST, $_POST["tree_item_id"], "", 0, read_graph_config_option("default_rra_id"), $selected_items[$i], 1, 1, false); | |
206 | } | |
207 | + } else { | |
208 | + do_hook_function('device_action_execute', $_POST['drp_action']); | |
209 | } | |
210 | ||
211 | header("Location: host.php"); | |
212 | @@ -385,6 +389,11 @@ | |
213 | </tr>\n | |
214 | <input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n | |
215 | "; | |
216 | + } else { | |
217 | + $save['drp_action'] = $_POST['drp_action']; | |
218 | + $save['host_list'] = $host_list; | |
219 | + $save['host_array'] = (isset($host_array)? $host_array : array()); | |
220 | + do_hook_function('device_action_prepare', $save); | |
221 | } | |
222 | ||
223 | if (!isset($host_array)) { | |
224 | diff -Naur cacti-0.8.6i-old/include/auth.php cacti-0.8.6i/include/auth.php | |
225 | --- cacti-0.8.6i-old/include/auth.php 2007-01-23 21:29:26.000000000 -0600 | |
226 | +++ cacti-0.8.6i/include/auth.php 2007-01-02 01:32:14.000000000 -0600 | |
227 | @@ -77,7 +77,7 @@ | |
228 | <html> | |
229 | <head> | |
230 | <title>Cacti</title> | |
231 | - <link href="include/main.css" rel="stylesheet"> | |
232 | + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet"> | |
233 | </style> | |
234 | </head> | |
235 | ||
236 | @@ -85,7 +85,7 @@ | |
237 | ||
238 | <table width="450" align='center'> | |
239 | <tr> | |
240 | - <td colspan='2'><img src='images/auth_deny.gif' border='0' alt='Access Denied'></td> | |
241 | + <td colspan='2'><img src='<?php echo $config['url_path']; ?>images/auth_deny.gif' border='0' alt='Access Denied'></td> | |
242 | </tr> | |
243 | <tr height='10'><td></td></tr> | |
244 | <tr> | |
245 | @@ -93,7 +93,7 @@ | |
246 | need access to this particular section, please contact the Cacti administrator.</td> | |
247 | </tr> | |
248 | <tr> | |
249 | - <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='logout.php'>Login</a> )</td> | |
250 | + <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='<?php echo $config['url_path']; ?>logout.php'>Login</a> )</td> | |
251 | </tr> | |
252 | </table> | |
253 | ||
254 | diff -Naur cacti-0.8.6i-old/include/config_arrays.php cacti-0.8.6i/include/config_arrays.php | |
255 | --- cacti-0.8.6i-old/include/config_arrays.php 2007-01-23 21:29:26.000000000 -0600 | |
256 | +++ cacti-0.8.6i/include/config_arrays.php 2007-01-02 01:32:14.000000000 -0600 | |
257 | @@ -24,6 +24,8 @@ | |
258 | +-------------------------------------------------------------------------+ | |
259 | */ | |
260 | ||
261 | +global $menu; | |
262 | + | |
263 | $messages = array( | |
264 | 1 => array( | |
265 | "message" => 'Save Successful.', | |
266 | @@ -451,4 +453,10 @@ | |
267 | GDC_SLASH => "/" | |
268 | ); | |
269 | ||
270 | -?> | |
271 | +$plugin_architecture = array( | |
272 | + "version" => '1.1' | |
273 | + ); | |
274 | + | |
275 | +do_hook("config_arrays"); | |
276 | + | |
277 | +?> | |
278 | \ No newline at end of file | |
279 | diff -Naur cacti-0.8.6i-old/include/config_form.php cacti-0.8.6i/include/config_form.php | |
280 | --- cacti-0.8.6i-old/include/config_form.php 2007-01-23 21:29:26.000000000 -0600 | |
281 | +++ cacti-0.8.6i/include/config_form.php 2007-01-02 01:32:14.000000000 -0600 | |
282 | @@ -25,7 +25,8 @@ | |
283 | */ | |
284 | ||
285 | if (!defined("VALID_HOST_FIELDS")) { | |
286 | - define("VALID_HOST_FIELDS", "(hostname|snmp_community|snmp_username|snmp_password|snmp_version|snmp_port|snmp_timeout)"); | |
287 | + $string = do_hook_function('valid_host_fields', '(hostname|snmp_community|snmp_username|snmp_password|snmp_version|snmp_port|snmp_timeout)'); | |
288 | + define("VALID_HOST_FIELDS", $string); | |
289 | } | |
290 | ||
291 | /* file: cdef.php, action: edit */ | |
292 | @@ -1000,4 +1001,6 @@ | |
293 | ) | |
294 | ); | |
295 | ||
296 | -?> | |
297 | +do_hook("config_form"); | |
298 | + | |
299 | +?> | |
300 | \ No newline at end of file | |
301 | diff -Naur cacti-0.8.6i-old/include/config.php cacti-0.8.6i/include/config.php | |
302 | --- cacti-0.8.6i-old/include/config.php 2007-01-23 21:29:26.000000000 -0600 | |
303 | +++ cacti-0.8.6i/include/config.php 2007-01-02 01:32:14.000000000 -0600 | |
304 | @@ -32,6 +32,22 @@ | |
305 | $database_password = "cactiuser"; | |
306 | $database_port = "3306"; | |
307 | ||
308 | +$plugins = array(); | |
309 | +//$plugins[] = 'thold'; | |
310 | + | |
311 | +/* Do not edit this line */ | |
312 | +$config = array(); | |
313 | + | |
314 | + | |
315 | +/* | |
316 | + This is full URL Path to the Cacti installation | |
317 | + For example, if your cacti was accessible by http://server/cacti/ you would user '/cacti/' | |
318 | + as the url path. For just http://server/ use '/' | |
319 | +*/ | |
320 | + | |
321 | +$config['url_path'] = '/'; | |
322 | + | |
323 | + | |
324 | /* ----- you probably do not need to change anything below this line ----- */ | |
325 | ||
326 | /* Files that do not need http header information - Command line scripts */ | |
327 | @@ -51,7 +67,7 @@ | |
328 | "ss_sql.php" | |
329 | ); | |
330 | ||
331 | -$config = array(); | |
332 | + | |
333 | $colors = array(); | |
334 | ||
335 | /* this should be auto-detected, set it manually if needed */ | |
336 | @@ -65,6 +81,13 @@ | |
337 | $config["library_path"] = ereg_replace("(.*[\/\\])include", "\\1lib", dirname(__FILE__)); | |
338 | $config["include_path"] = dirname(__FILE__); | |
339 | ||
340 | +define('URL_PATH', $config['url_path']); | |
341 | + | |
342 | +/* include the plugin function, we do this before everything else, | |
343 | + incase we want to add hooks to change config options */ | |
344 | + | |
345 | +include_once($config["include_path"] . "/plugins.php"); | |
346 | + | |
347 | /* colors */ | |
348 | $colors["dark_outline"] = "454E53"; | |
349 | $colors["dark_bar"] = "AEB4B7"; | |
350 | @@ -168,4 +191,4 @@ | |
351 | /* current cacti version */ | |
352 | $config["cacti_version"] = "0.8.6i"; | |
353 | ||
354 | -?> | |
355 | +?> | |
356 | \ No newline at end of file | |
357 | diff -Naur cacti-0.8.6i-old/include/config_settings.php cacti-0.8.6i/include/config_settings.php | |
358 | --- cacti-0.8.6i-old/include/config_settings.php 2007-01-23 21:29:26.000000000 -0600 | |
359 | +++ cacti-0.8.6i/include/config_settings.php 2007-01-02 01:32:14.000000000 -0600 | |
360 | @@ -928,4 +928,6 @@ | |
361 | ) | |
362 | ); | |
363 | ||
364 | -?> | |
365 | +do_hook("config_settings"); | |
366 | + | |
367 | +?> | |
368 | \ No newline at end of file | |
369 | diff -Naur cacti-0.8.6i-old/include/plugins.php cacti-0.8.6i/include/plugins.php | |
370 | --- cacti-0.8.6i-old/include/plugins.php 1969-12-31 17:00:00.000000000 -0700 | |
371 | +++ cacti-0.8.6i/include/plugins.php 2007-01-02 01:32:14.000000000 -0600 | |
372 | @@ -0,0 +1,70 @@ | |
373 | +<?php | |
374 | + | |
375 | +/* | |
376 | + * Copyright (c) 1999-2005 The SquirrelMail Project Team (http://squirrelmail.org) | |
377 | + * Licensed under the GNU GPL. For full terms see the file COPYING. | |
378 | + */ | |
379 | + | |
380 | +global $plugin_hooks; | |
381 | +$plugin_hooks = array(); | |
382 | + | |
383 | +function use_plugin ($name) { | |
384 | + global $config; | |
385 | + if (file_exists($config["base_path"] . "/plugins/$name/setup.php")) { | |
386 | + include_once($config["base_path"] . "/plugins/$name/setup.php"); | |
387 | + $function = "plugin_init_$name"; | |
388 | + if (function_exists($function)) { | |
389 | + $function(); | |
390 | + } | |
391 | + } | |
392 | +} | |
393 | + | |
394 | +/** | |
395 | + * This function executes a hook. | |
396 | + * @param string $name Name of hook to fire | |
397 | + * @return mixed $data | |
398 | + */ | |
399 | +function do_hook ($name) { | |
400 | + global $plugin_hooks; | |
401 | + $data = func_get_args(); | |
402 | + $ret = ''; | |
403 | + | |
404 | + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) { | |
405 | + foreach ($plugin_hooks[$name] as $function) { | |
406 | + if (function_exists($function)) { | |
407 | + $function($data); | |
408 | + } | |
409 | + } | |
410 | + } | |
411 | + | |
412 | + /* Variable-length argument lists have a slight problem when */ | |
413 | + /* passing values by reference. Pity. This is a workaround. */ | |
414 | + return $data; | |
415 | +} | |
416 | + | |
417 | +function do_hook_function($name,$parm=NULL) { | |
418 | + global $plugin_hooks; | |
419 | + $ret = $parm; | |
420 | + | |
421 | + if (isset($plugin_hooks[$name]) | |
422 | + && is_array($plugin_hooks[$name])) { | |
423 | + foreach ($plugin_hooks[$name] as $function) { | |
424 | + if (function_exists($function)) { | |
425 | + $ret = $function($ret); | |
426 | + } | |
427 | + } | |
428 | + } | |
429 | + | |
430 | + /* Variable-length argument lists have a slight problem when */ | |
431 | + /* passing values by reference. Pity. This is a workaround. */ | |
432 | + return $ret; | |
433 | +} | |
434 | + | |
435 | +/* On startup, register all plugins configured for use. */ | |
436 | +if (isset($plugins) && is_array($plugins)) { | |
437 | + foreach ($plugins as $name) { | |
438 | + use_plugin($name); | |
439 | + } | |
440 | +} | |
441 | + | |
442 | +?> | |
443 | \ No newline at end of file | |
444 | diff -Naur cacti-0.8.6i-old/include/top_graph_header.php cacti-0.8.6i/include/top_graph_header.php | |
445 | --- cacti-0.8.6i-old/include/top_graph_header.php 2007-01-23 21:29:26.000000000 -0600 | |
446 | +++ cacti-0.8.6i/include/top_graph_header.php 2007-01-02 01:32:14.000000000 -0600 | |
447 | @@ -97,17 +97,18 @@ | |
448 | if ($_SESSION["custom"]) { | |
449 | print "<meta http-equiv=refresh content='99999'>\r\n"; | |
450 | }else{ | |
451 | - print "<meta http-equiv=refresh content='" . read_graph_config_option("page_refresh") . "'>\r\n"; | |
452 | + $refresh = do_hook_function("top_graph_refresh", read_graph_config_option("page_refresh")); | |
453 | + print "<meta http-equiv=refresh content='" . $refresh . "'>\r\n"; | |
454 | } | |
455 | } | |
456 | ?> | |
457 | - <link href="include/main.css" rel="stylesheet"> | |
458 | + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet"> | |
459 | ||
460 | - <script type="text/javascript" src="include/treeview/ua.js"></script> | |
461 | - <script type="text/javascript" src="include/treeview/ftiens4.js"></script> | |
462 | - <script type="text/javascript" src="include/jscalendar/calendar.js"></script> | |
463 | - <script type="text/javascript" src="include/jscalendar/lang/calendar-en.js"></script> | |
464 | - <script type="text/javascript" src="include/jscalendar/calendar-setup.js"></script> | |
465 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script> | |
466 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script> | |
467 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script> | |
468 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script> | |
469 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script> | |
470 | </head> | |
471 | ||
472 | <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> | |
473 | @@ -118,13 +119,14 @@ | |
474 | <table width="100%" cellspacing="0" cellpadding="0"> | |
475 | <tr> | |
476 | <td nowrap> | |
477 | - <?php if ($show_console_tab == true) {?><a href="index.php"><img src="images/tab_console.gif" alt="Console" align="absmiddle" border="0"></a><?php }?><a href="graph_view.php"><img src="images/tab_graphs.gif" alt="Graphs" align="absmiddle" border="0"></a> | |
478 | - </td> | |
479 | + <?php if ($show_console_tab == true) {?><a href="<?php echo $config['url_path']; ?>index.php"><img src="<?php echo $config['url_path']; ?>images/tab_console.gif" alt="Console" align="absmiddle" border="0"></a><?php }?><a href="<?php echo $config['url_path']; ?>graph_view.php"><img src="<?php echo $config['url_path']; ?>images/tab_graphs.gif" alt="Graphs" align="absmiddle" border="0"></a><?php | |
480 | + do_hook("top_graph_header_tabs"); | |
481 | + ?> </td> | |
482 | <td> | |
483 | - <img src="images/cacti_backdrop2.gif" align="absmiddle"> | |
484 | + <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif" align="absmiddle"> | |
485 | </td> | |
486 | <td align="right" nowrap> | |
487 | - <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["graph_settings"] == "on")) { print '<a href="graph_settings.php"><img src="images/tab_settings'; if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; } print '.gif" border="0" alt="Settings" align="absmiddle"></a>';}?> <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="graph_view.php?action=tree"><img src="images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="graph_view.php?action=list"><img src="images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="graph_view.php?action=preview"><img src="images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?> <br> | |
488 | + <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["graph_settings"] == "on")) { print '<a href="' . $config['url_path'] . 'graph_settings.php"><img src="' . $config['url_path'] . 'images/tab_settings'; if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; } print '.gif" border="0" alt="Settings" align="absmiddle"></a>';}?> <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="<?php echo $config['url_path'] ?>graph_view.php?action=tree"><img src="<?php echo $config['url_path'] ?>images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="<?php echo $config['url_path'] ?>graph_view.php?action=list"><img src="<?php echo $config['url_path'] ?>images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="<?php echo $config['url_path'] ?>graph_view.php?action=preview"><img src="<?php echo $config['url_path'] ?>images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?> <br> | |
489 | </td> | |
490 | </tr> | |
491 | </table> | |
492 | @@ -132,7 +134,7 @@ | |
493 | </tr> | |
494 | <tr height="2" colspan="2" bgcolor="#183c8f" class="noprint"> | |
495 | <td colspan="2"> | |
496 | - <img src="images/transparent_line.gif" width="170" height="2" border="0"><br> | |
497 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br> | |
498 | </td> | |
499 | </tr> | |
500 | <tr height="5" bgcolor="#e9e9e9" class="noprint"> | |
501 | @@ -144,7 +146,7 @@ | |
502 | </td> | |
503 | <td align="right"> | |
504 | <?php if ((isset($_SESSION["sess_user_id"])) && ($using_guest_account == false)) { ?> | |
505 | - Logged in as <strong><?php print db_fetch_cell("select username from user_auth where id=" . $_SESSION["sess_user_id"]);?></strong> (<a href="logout.php">Logout</a>) | |
506 | + Logged in as <strong><?php print db_fetch_cell("select username from user_auth where id=" . $_SESSION["sess_user_id"]);?></strong> (<a href="<?php echo $config['url_path']; ?>logout.php">Logout</a>) | |
507 | <?php } ?> | |
508 | </td> | |
509 | </tr> | |
510 | @@ -152,10 +154,10 @@ | |
511 | </td> | |
512 | </tr> | |
513 | <tr class="noprint"> | |
514 | - <td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;"> | |
515 | - <img src="images/transparent_line.gif" width="<?php print read_graph_config_option("default_dual_pane_width");?>" height="2" border="0"><br> | |
516 | + <td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;"> | |
517 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="<?php print read_graph_config_option("default_dual_pane_width");?>" height="2" border="0"><br> | |
518 | </td> | |
519 | - <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;"> | |
520 | + <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;"> | |
521 | ||
522 | </td> | |
523 | </tr> | |
524 | @@ -203,4 +205,4 @@ | |
525 | <?php } ?> | |
526 | </td> | |
527 | <?php } ?> | |
528 | - <td valign="top"> | |
529 | + <td valign="top"> | |
530 | \ No newline at end of file | |
531 | diff -Naur cacti-0.8.6i-old/include/top_header.php cacti-0.8.6i/include/top_header.php | |
532 | --- cacti-0.8.6i-old/include/top_header.php 2007-01-23 21:29:26.000000000 -0600 | |
533 | +++ cacti-0.8.6i/include/top_header.php 2007-01-02 01:32:14.000000000 -0600 | |
534 | @@ -24,20 +24,20 @@ | |
535 | +-------------------------------------------------------------------------+ | |
536 | */ | |
537 | ||
538 | -global $colors; | |
539 | +global $colors, $config; | |
540 | ?> | |
541 | <html> | |
542 | <head> | |
543 | <title>cacti</title> | |
544 | - <link href="include/main.css" rel="stylesheet"> | |
545 | - <script type="text/javascript" src="include/layout.js"></script> | |
546 | + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet"> | |
547 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script> | |
548 | <?php if (isset($refresh)) { | |
549 | print "<meta http-equiv=refresh content=\"" . $refresh["seconds"] . "; url='" . $refresh["page"] . "'\">"; | |
550 | }?> | |
551 | </style> | |
552 | </head> | |
553 | ||
554 | -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif"> | |
555 | +<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="<?php echo $config['url_path']; ?>images/left_border.gif"> | |
556 | ||
557 | <table width="100%" cellspacing="0" cellpadding="0"> | |
558 | <tr height="37" bgcolor="#a9a9a9"> | |
559 | @@ -45,10 +45,11 @@ | |
560 | <table width="100%" cellspacing="0" cellpadding="0"> | |
561 | <tr> | |
562 | <td valign="bottom"> | |
563 | - <a href="index.php"><img src="images/tab_console.gif" alt="Console" align="absmiddle" border="0"></a><a href="graph_view.php"><img src="images/tab_graphs.gif" alt="Graphs" align="absmiddle" border="0"></a> | |
564 | - </td> | |
565 | + <a href="<?php echo $config['url_path']; ?>index.php"><img src="<?php echo $config['url_path']; ?>images/tab_console.gif" alt="Console" align="absmiddle" border="0"></a><a href="<?php echo $config['url_path']; ?>graph_view.php"><img src="<?php echo $config['url_path']; ?>images/tab_graphs.gif" alt="Console" align="absmiddle" border="0"></a><?php | |
566 | + do_hook("top_header_tabs"); | |
567 | + ?></td> | |
568 | <td align="right"> | |
569 | - <img src="images/cacti_backdrop.gif" align="absmiddle"> | |
570 | + <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop.gif" align="absmiddle"> | |
571 | </td> | |
572 | </tr> | |
573 | </table> | |
574 | @@ -56,7 +57,7 @@ | |
575 | </tr> | |
576 | <tr height="2" bgcolor="#183c8f"> | |
577 | <td colspan="3"> | |
578 | - <img src="images/transparent_line.gif" width="170" height="2" border="0"><br> | |
579 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br> | |
580 | </td> | |
581 | </tr> | |
582 | <tr height="5" bgcolor="#e9e9e9"> | |
583 | @@ -68,7 +69,7 @@ | |
584 | </td> | |
585 | <td align="right"> | |
586 | <?php if (read_config_option("global_auth") == "on") { ?> | |
587 | - Logged in as <strong><?php print db_fetch_cell("select username from user_auth where id=" . $_SESSION["sess_user_id"]);?></strong> (<a href="logout.php">Logout</a>) | |
588 | + Logged in as <strong><?php print db_fetch_cell("select username from user_auth where id=" . $_SESSION["sess_user_id"]);?></strong> (<a href="<?php echo $config['url_path']; ?>logout.php">Logout</a>) | |
589 | <?php } ?> | |
590 | </td> | |
591 | </tr> | |
592 | @@ -76,10 +77,10 @@ | |
593 | </td> | |
594 | </tr> | |
595 | <tr> | |
596 | - <td bgcolor="#f5f5f5" colspan="1" height="8" width="135" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;"> | |
597 | - <img src="images/transparent_line.gif" width="135" height="2" border="0"><br> | |
598 | - </td> | |
599 | - <td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff"> | |
600 | + <td bgcolor="#f5f5f5" colspan="1" height="8" width="135" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;"> | |
601 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="2" border="0"><br> | |
602 | + </td> | |
603 | + <td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff"> | |
604 | ||
605 | </td> | |
606 | </tr> | |
607 | @@ -89,9 +90,9 @@ | |
608 | <?php draw_menu();?> | |
609 | </table> | |
610 | ||
611 | - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br> | |
612 | - <p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p> | |
613 | - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br> | |
614 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br> | |
615 | + <p align="center"><a href='<?php echo $config['url_path']; ?>about.php'><img src="<?php echo $config['url_path']; ?>images/cacti_logo.gif" border="0"></a></p> | |
616 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br> | |
617 | </td> | |
618 | <td></td> | |
619 | </tr> | |
620 | diff -Naur cacti-0.8.6i-old/index.php cacti-0.8.6i/index.php | |
621 | --- cacti-0.8.6i-old/index.php 2007-01-23 21:29:26.000000000 -0600 | |
622 | +++ cacti-0.8.6i/index.php 2007-01-02 01:32:14.000000000 -0600 | |
623 | @@ -27,6 +27,8 @@ | |
624 | include("./include/auth.php"); | |
625 | include("./include/top_header.php"); | |
626 | ||
627 | +do_hook("console_before"); | |
628 | + | |
629 | ?> | |
630 | <table width="98%" align="center"> | |
631 | <tr> | |
632 | @@ -44,6 +46,8 @@ | |
633 | </table> | |
634 | <?php | |
635 | ||
636 | +do_hook("console_after"); | |
637 | + | |
638 | include("./include/bottom_footer.php"); | |
639 | ||
640 | ?> | |
641 | diff -Naur cacti-0.8.6i-old/lib/api_device.php cacti-0.8.6i/lib/api_device.php | |
642 | --- cacti-0.8.6i-old/lib/api_device.php 2007-01-23 21:29:26.000000000 -0600 | |
643 | +++ cacti-0.8.6i/lib/api_device.php 2007-01-02 01:32:14.000000000 -0600 | |
644 | @@ -76,6 +76,8 @@ | |
645 | $save["snmp_timeout"] = form_input_validate($snmp_timeout, "snmp_timeout", "^[0-9]+$", false, 3); | |
646 | $save["disabled"] = form_input_validate($disabled, "disabled", "", true, 3); | |
647 | ||
648 | + $save = do_hook_function("api_device_save", $save); | |
649 | + | |
650 | $host_id = 0; | |
651 | ||
652 | if (!is_error_message()) { | |
653 | @@ -123,4 +125,4 @@ | |
654 | return $host_id; | |
655 | } | |
656 | ||
657 | -?> | |
658 | +?> | |
659 | \ No newline at end of file | |
660 | diff -Naur cacti-0.8.6i-old/lib/functions.php cacti-0.8.6i/lib/functions.php | |
661 | --- cacti-0.8.6i-old/lib/functions.php 2007-01-23 21:29:26.000000000 -0600 | |
662 | +++ cacti-0.8.6i/lib/functions.php 2007-01-23 14:47:07.000000000 -0600 | |
663 | @@ -186,9 +186,9 @@ | |
664 | user | |
665 | @returns - (bool) whether the messages array contains an error or not */ | |
666 | function is_error_message() { | |
667 | - global $config; | |
668 | + global $config, $messages; | |
669 | ||
670 | - include($config["include_path"] . "/config_arrays.php"); | |
671 | + include_once($config["include_path"] . "/config_arrays.php"); | |
672 | ||
673 | if (isset($_SESSION["sess_messages"])) { | |
674 | if (is_array($_SESSION["sess_messages"])) { | |
675 | @@ -618,6 +618,8 @@ | |
676 | } | |
677 | } | |
678 | ||
679 | + do_hook_function("update_host_status", array('issue_log_message' => $issue_log_message, 'status' => $status, 'host_id' => $host_id, 'hosts' => $hosts)); | |
680 | + | |
681 | db_execute("update host set | |
682 | status = '" . $hosts[$host_id]["status"] . "', | |
683 | status_event_count = '" . $hosts[$host_id]["status_event_count"] . "', | |
684 | @@ -1321,6 +1323,7 @@ | |
685 | /* draw_navigation_text - determines the top header navigation text for the current page and displays it to | |
686 | the browser */ | |
687 | function draw_navigation_text() { | |
688 | + global $config; | |
689 | $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array()); | |
690 | ||
691 | $nav = array( | |
692 | @@ -1333,7 +1336,7 @@ | |
693 | "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), | |
694 | "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), | |
695 | "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"), | |
696 | - "index.php:" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"), | |
697 | + "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"), | |
698 | "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"), | |
699 | "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"), | |
700 | "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"), | |
701 | @@ -1408,6 +1411,8 @@ | |
702 | "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"), | |
703 | ); | |
704 | ||
705 | + $nav = do_hook_function("draw_navigation_text", $nav); | |
706 | + | |
707 | $current_page = basename($_SERVER["PHP_SELF"]); | |
708 | $current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : ""); | |
709 | ||
710 | @@ -1719,4 +1724,4 @@ | |
711 | return $string; | |
712 | } | |
713 | ||
714 | -?> | |
715 | +?> | |
716 | \ No newline at end of file | |
717 | diff -Naur cacti-0.8.6i-old/lib/html_form.php cacti-0.8.6i/lib/html_form.php | |
718 | --- cacti-0.8.6i-old/lib/html_form.php 2007-01-23 21:29:26.000000000 -0600 | |
719 | +++ cacti-0.8.6i/lib/html_form.php 2007-01-02 01:32:14.000000000 -0600 | |
720 | @@ -419,11 +419,13 @@ | |
721 | on a confirmation form | |
722 | @arg $cancel_url - the url to go to when the user clicks 'cancel' | |
723 | @arg $action_url - the url to go to when the user clicks 'delete' */ | |
724 | -function form_confirm_buttons($action_url, $cancel_url) { ?> | |
725 | +function form_confirm_buttons($action_url, $cancel_url) { | |
726 | + global $config; | |
727 | + ?> | |
728 | <tr> | |
729 | <td bgcolor="#E1E1E1"> | |
730 | - <a href="<?php print $cancel_url;?>"><img src="images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a> | |
731 | - <a href="<?php print $action_url . "&confirm=yes";?>"><img src="images/button_delete.gif" border="0" alt="Delete" align="absmiddle"></a> | |
732 | + <a href="<?php print $cancel_url;?>"><img src="<?php print $config['url_path'] ?>images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a> | |
733 | + <a href="<?php print $action_url . "&confirm=yes";?>"><img src="<?php print $config['url_path'] ?>images/button_delete.gif" border="0" alt="Delete" align="absmiddle"></a> | |
734 | </td> | |
735 | </tr> | |
736 | <?php } | |
737 | @@ -434,6 +436,7 @@ | |
738 | @arg $force_type - if specified, will force the 'action' button to be either | |
739 | 'save' or 'create'. otherwise this field should be properly auto-detected */ | |
740 | function form_save_button($cancel_url, $force_type = "", $key_field = "id") { | |
741 | + global $config; | |
742 | if (empty($force_type)) { | |
743 | if (empty($_GET[$key_field])) { | |
744 | $img = "button_create.gif"; | |
745 | @@ -454,8 +457,8 @@ | |
746 | <tr> | |
747 | <td bgcolor="#f5f5f5" align="right"> | |
748 | <input type='hidden' name='action' value='save'> | |
749 | - <a href='<?php print $cancel_url;?>'><img src='images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a> | |
750 | - <input type='image' src='images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'> | |
751 | + <a href='<?php print $cancel_url;?>'><img src='<?php echo $config['url_path']; ?>images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a> | |
752 | + <input type='image' src='<?php echo $config['url_path']; ?>images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'> | |
753 | </td> | |
754 | </tr> | |
755 | </table> | |
756 | @@ -463,4 +466,4 @@ | |
757 | <?php | |
758 | } | |
759 | ||
760 | -?> | |
761 | +?> | |
762 | \ No newline at end of file | |
763 | diff -Naur cacti-0.8.6i-old/lib/html.php cacti-0.8.6i/lib/html.php | |
764 | --- cacti-0.8.6i-old/lib/html.php 2007-01-23 21:29:26.000000000 -0600 | |
765 | +++ cacti-0.8.6i/lib/html.php 2007-01-23 14:47:07.000000000 -0600 | |
766 | @@ -88,6 +88,7 @@ | |
767 | @arg $extra_url_args - extra arguments to append to the url | |
768 | @arg $header - html to use as a header */ | |
769 | function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") { | |
770 | + global $config; | |
771 | $i = 0; | |
772 | if (sizeof($graph_array) > 0) { | |
773 | if ($header != "") { | |
774 | @@ -101,10 +102,11 @@ | |
775 | <table width='1' cellpadding='0'> | |
776 | <tr> | |
777 | <td> | |
778 | - <a href='graph.php?local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=all'><img src='graph_image.php?local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0<?php print (($extra_url_args == "") ? "" : "&$extra_url_args");?>' border='0' alt='<?php print $graph["title_cache"];?>'></a> | |
779 | + <a href='<?php print $config['url_path']; ?>graph.php?local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=all'><img src='<?php print $config['url_path']; ?>graph_image.php?action=view&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0<?php print (($extra_url_args == "") ? "" : "&$extra_url_args");?>' border='0' alt='<?php print $graph["title_cache"];?>'></a> | |
780 | </td> | |
781 | <td valign='top' style='padding: 3px;' class='noprint'> | |
782 | - <a href='graph.php?action=zoom&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&<?php print $extra_url_args;?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br> | |
783 | + <a href='<?php print $config['url_path']; ?>graph.php?action=zoom&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&<?php print $extra_url_args;?>'><img src='<?php print $config['url_path']; ?>images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br> | |
784 | + <?php do_hook('graph_buttons', array('hook' => 'graphs', 'local_graph_id' => $graph["local_graph_id"], 'rra' => 0, 'view_type' => '')); ?> | |
785 | </td> | |
786 | </tr> | |
787 | </table> | |
788 | @@ -130,6 +132,7 @@ | |
789 | @arg $extra_url_args - extra arguments to append to the url | |
790 | @arg $header - html to use as a header */ | |
791 | function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") { | |
792 | + global $config; | |
793 | $i = 0; $k = 0; | |
794 | if (sizeof($graph_array) > 0) { | |
795 | if ($header != "") { | |
796 | @@ -144,10 +147,11 @@ | |
797 | <table width='1' cellpadding='0'> | |
798 | <tr> | |
799 | <td> | |
800 | - <a href='graph.php?rra_id=all&local_graph_id=<?php print $graph["local_graph_id"];?>'><img src='graph_image.php?local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&graph_height=<?php print read_graph_config_option("default_height");?>&graph_width=<?php print read_graph_config_option("default_width");?>&graph_nolegend=true<?php print (($extra_url_args == "") ? "" : "&$extra_url_args");?>' border='0' alt='<?php print $graph["title_cache"];?>'></a> | |
801 | + <a href='<?php print $config['url_path']; ?>graph.php?rra_id=all&local_graph_id=<?php print $graph["local_graph_id"];?>'><img src='<?php print $config['url_path']; ?>graph_image.php?action=view&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&graph_height=<?php print read_graph_config_option("default_height");?>&graph_width=<?php print read_graph_config_option("default_width");?>&graph_nolegend=true<?php print (($extra_url_args == "") ? "" : "&$extra_url_args");?>' border='0' alt='<?php print $graph["title_cache"];?>'></a> | |
802 | </td> | |
803 | <td valign='top' style='padding: 3px;'> | |
804 | - <a href='graph.php?action=zoom&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&<?php print $extra_url_args;?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br> | |
805 | + <a href='<?php print $config['url_path']; ?>graph.php?action=zoom&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&<?php print $extra_url_args;?>'><img src='<?php print $config['url_path']; ?>images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br> | |
806 | + <?php do_hook('graph_buttons', array('hook' => 'thumbnails', 'local_graph_id' => $graph["local_graph_id"], 'rra' => 0, 'view_type' => '')); ?> | |
807 | </td> | |
808 | </tr> | |
809 | </table> | |
810 | @@ -530,6 +534,8 @@ | |
811 | } | |
812 | ||
813 | while (list($item_sub_url, $item_sub_title) = each($item_title)) { | |
814 | + $item_sub_url = $config['url_path'] . $item_sub_url; | |
815 | + | |
816 | /* indent sub-items */ | |
817 | if ($i > 0) { | |
818 | $prepend_string = "--- "; | |
819 | @@ -539,7 +545,7 @@ | |
820 | ||
821 | /* do not put a line between each sub-item */ | |
822 | if (($i == 0) || ($draw_sub_items == false)) { | |
823 | - $background = "images/menu_line.gif"; | |
824 | + $background = $config['url_path'] . "images/menu_line.gif"; | |
825 | }else{ | |
826 | $background = ""; | |
827 | } | |
828 | @@ -568,17 +574,18 @@ | |
829 | }else{ | |
830 | if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) { | |
831 | /* draw normal (non sub-item) menu item */ | |
832 | + $item_url = $config['url_path'] . $item_url; | |
833 | if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) { | |
834 | - print "<tr><td class='textMenuItemSelected' background='images/menu_line.gif'><strong><a href='$item_url'>$item_title</a></strong></td></tr>\n"; | |
835 | + print "<tr><td class='textMenuItemSelected' background='" . $config['url_path'] . "images/menu_line.gif'><strong><a href='$item_url'>$item_title</a></strong></td></tr>\n"; | |
836 | }else{ | |
837 | - print "<tr><td class='textMenuItem' background='images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n"; | |
838 | + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n"; | |
839 | } | |
840 | } | |
841 | } | |
842 | } | |
843 | } | |
844 | ||
845 | - print "<tr><td class='textMenuItem' background='images/menu_line.gif'></td></tr>\n"; | |
846 | + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'></td></tr>\n"; | |
847 | ||
848 | print '</table></td></tr>'; | |
849 | } | |
850 | @@ -588,18 +595,19 @@ | |
851 | @arg $actions_array - an array that contains a list of possible actions. this array should | |
852 | be compatible with the form_dropdown() function */ | |
853 | function draw_actions_dropdown($actions_array) { | |
854 | + global $config; | |
855 | ?> | |
856 | <table align='center' width='98%'> | |
857 | <tr> | |
858 | <td width='1' valign='top'> | |
859 | - <img src='images/arrow.gif' alt='' align='absmiddle'> | |
860 | + <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'> | |
861 | </td> | |
862 | <td align='right'> | |
863 | Choose an action: | |
864 | <?php form_dropdown("drp_action",$actions_array,"","","1","","");?> | |
865 | </td> | |
866 | <td width='1' align='right'> | |
867 | - <input type='image' src='images/button_go.gif' alt='Go'> | |
868 | + <input type='image' src='<?php echo $config['url_path']; ?>images/button_go.gif' alt='Go'> | |
869 | </td> | |
870 | </tr> | |
871 | </table> | |
872 | @@ -626,4 +634,4 @@ | |
873 | </tr> | |
874 | <?php } | |
875 | ||
876 | -?> | |
877 | +?> | |
878 | \ No newline at end of file | |
879 | diff -Naur cacti-0.8.6i-old/lib/html_tree.php cacti-0.8.6i/lib/html_tree.php | |
880 | --- cacti-0.8.6i-old/lib/html_tree.php 2007-01-23 21:29:26.000000000 -0600 | |
881 | +++ cacti-0.8.6i/lib/html_tree.php 2007-01-23 14:47:07.000000000 -0600 | |
882 | @@ -761,7 +761,7 @@ | |
883 | if (read_graph_config_option("thumbnail_section_tree_1") == "on") { | |
884 | if (read_graph_config_option("timespan_sel") == "on") { | |
885 | print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img align='middle' alt='$graph_title' | |
886 | - src='graph_image.php?local_graph_id=$local_graph_id&rra_id=0&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end() . '&graph_height=' . | |
887 | + src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=0&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end() . '&graph_height=' . | |
888 | read_graph_config_option("default_height") . '&graph_width=' . read_graph_config_option("default_width") . "&graph_nolegend=true' border='0'></a></td>\n"; | |
889 | ||
890 | /* if we are at the end of a row, start a new one */ | |
891 | @@ -770,7 +770,7 @@ | |
892 | } | |
893 | }else{ | |
894 | print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img align='middle' alt='$graph_title' | |
895 | - src='graph_image.php?local_graph_id=$local_graph_id&rra_id=$rra_id&graph_start=" . -(db_fetch_cell("select timespan from rra where id=$rra_id")) . '&graph_height=' . | |
896 | + src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=$rra_id&graph_start=" . -(db_fetch_cell("select timespan from rra where id=$rra_id")) . '&graph_height=' . | |
897 | read_graph_config_option("default_height") . '&graph_width=' . read_graph_config_option("default_width") . "&graph_nolegend=true' border='0'></a></td>\n"; | |
898 | ||
899 | /* if we are at the end of a row, start a new one */ | |
900 | @@ -780,10 +780,10 @@ | |
901 | } | |
902 | }else{ | |
903 | if (read_graph_config_option("timespan_sel") == "on") { | |
904 | - print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img src='graph_image.php?local_graph_id=$local_graph_id&rra_id=0&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end() . "' border='0' alt='$graph_title'></a></td>"; | |
905 | + print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=0&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end() . "' border='0' alt='$graph_title'></a></td>"; | |
906 | print "</tr><tr>\n"; | |
907 | }else{ | |
908 | - print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img src='graph_image.php?local_graph_id=$local_graph_id&rra_id=$rra_id' border='0' alt='$graph_title'></a></td>"; | |
909 | + print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=$rra_id' border='0' alt='$graph_title'></a></td>"; | |
910 | print "</tr><tr>\n"; | |
911 | } | |
912 | } | |
913 | @@ -853,4 +853,4 @@ | |
914 | ||
915 | return $html; | |
916 | } | |
917 | -?> | |
918 | +?> | |
919 | \ No newline at end of file | |
920 | diff -Naur cacti-0.8.6i-old/lib/poller.php cacti-0.8.6i/lib/poller.php | |
921 | --- cacti-0.8.6i-old/lib/poller.php 2007-01-23 21:29:26.000000000 -0600 | |
922 | +++ cacti-0.8.6i/lib/poller.php 2007-01-23 14:47:07.000000000 -0600 | |
923 | @@ -213,7 +213,7 @@ | |
924 | /* process_poller_output - grabs data from the 'poller_output' table and feeds the *completed* | |
925 | results to RRDTool for processing | |
926 | @arg $rrdtool_pipe - the array of pipes containing the file descriptor for rrdtool */ | |
927 | -function process_poller_output($rrdtool_pipe) { | |
928 | +function process_poller_output($rrdtool_pipe, $remainder = FALSE) { | |
929 | global $config; | |
930 | ||
931 | include_once($config["library_path"] . "/rrd.php"); | |
932 | @@ -221,6 +221,12 @@ | |
933 | /* let's count the number of rrd files we processed */ | |
934 | $rrds_processed = 0; | |
935 | ||
936 | + if ($remainder) { | |
937 | + $limit = ""; | |
938 | + }else{ | |
939 | + $limit = "LIMIT 10000"; | |
940 | + } | |
941 | + | |
942 | /* create/update the rrd files */ | |
943 | $results = db_fetch_assoc("select | |
944 | poller_output.output, | |
945 | @@ -231,7 +237,7 @@ | |
946 | poller_item.rrd_num | |
947 | from (poller_output,poller_item) | |
948 | where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) | |
949 | - limit 10000"); | |
950 | + $limit"); | |
951 | ||
952 | if (sizeof($results) > 0) { | |
953 | /* create an array keyed off of each .rrd file */ | |
954 | @@ -289,11 +295,14 @@ | |
955 | } | |
956 | } | |
957 | } | |
958 | + do_hook_function("poller_output", $rrd_update_array); | |
959 | ||
960 | - $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe); | |
961 | + if (do_hook_function("poller_on_demand", $results)) { | |
962 | + $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe); | |
963 | + } | |
964 | } | |
965 | ||
966 | return $rrds_processed; | |
967 | } | |
968 | ||
969 | -?> | |
970 | +?> | |
971 | \ No newline at end of file | |
972 | diff -Naur cacti-0.8.6i-old/lib/rrd.php cacti-0.8.6i/lib/rrd.php | |
973 | --- cacti-0.8.6i-old/lib/rrd.php 2007-01-23 21:29:26.000000000 -0600 | |
974 | +++ cacti-0.8.6i/lib/rrd.php 2007-01-02 01:32:14.000000000 -0600 | |
975 | @@ -471,6 +471,10 @@ | |
976 | } | |
977 | } | |
978 | ||
979 | + $data = do_hook_function("rrdtool_function_graph_cache_check", array('local_graph_id' => $local_graph_id,'rra_id' => $rra_id,'rrd_struc' => $rrd_struc,'graph_data_array' => $graph_data_array, 'return' => false)); | |
980 | + if (isset($data['return']) && $data['return'] != false) | |
981 | + return $data['return']; | |
982 | + | |
983 | /* find the step and how often this graph is updated with new data */ | |
984 | $ds_step = db_fetch_cell("select | |
985 | data_template_data.rrd_step | |
986 | @@ -1145,15 +1149,21 @@ | |
987 | rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrd_struc); | |
988 | return 0; | |
989 | }else{ | |
990 | + $graph_data_array = do_hook_function("prep_graph_array", $graph_data_array); | |
991 | + | |
992 | if (isset($graph_data_array["output_flag"])) { | |
993 | $output_flag = $graph_data_array["output_flag"]; | |
994 | }else{ | |
995 | $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA; | |
996 | } | |
997 | ||
998 | - return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc); | |
999 | + $output = rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc); | |
1000 | + | |
1001 | + do_hook_function("rrdtool_function_graph_set_file", array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id)); | |
1002 | + | |
1003 | + return $output; | |
1004 | } | |
1005 | } | |
1006 | } | |
1007 | ||
1008 | -?> | |
1009 | +?> | |
1010 | \ No newline at end of file | |
1011 | diff -Naur cacti-0.8.6i-old/lib/variables.php cacti-0.8.6i/lib/variables.php | |
1012 | --- cacti-0.8.6i-old/lib/variables.php 2007-01-23 21:29:26.000000000 -0600 | |
1013 | +++ cacti-0.8.6i/lib/variables.php 2007-01-02 01:32:14.000000000 -0600 | |
1014 | @@ -179,6 +179,9 @@ | |
1015 | $string = str_replace($l_escape_string . "host_snmp_timeout" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["snmp_timeout"], $string); | |
1016 | $string = str_replace($l_escape_string . "host_id" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["id"], $string); | |
1017 | ||
1018 | + $temp = do_hook_function('substitute_host_data', array('string' => $string, 'l_escape_string' => $l_escape_string, 'r_escape_string' => $r_escape_string, 'host_id' => $host_id)); | |
1019 | + $string = $temp['string']; | |
1020 | + | |
1021 | return $string; | |
1022 | } | |
1023 | ||
1024 | @@ -207,4 +210,4 @@ | |
1025 | return $string; | |
1026 | } | |
1027 | ||
1028 | -?> | |
1029 | +?> | |
1030 | \ No newline at end of file | |
1031 | diff -Naur cacti-0.8.6i-old/plugins/index.php cacti-0.8.6i/plugins/index.php | |
1032 | --- cacti-0.8.6i-old/plugins/index.php 1969-12-31 17:00:00.000000000 -0700 | |
1033 | +++ cacti-0.8.6i/plugins/index.php 2007-01-02 01:32:14.000000000 -0600 | |
1034 | @@ -0,0 +1,5 @@ | |
1035 | +<?php | |
1036 | + | |
1037 | +header("Location:../index.php"); | |
1038 | + | |
1039 | +?> | |
1040 | diff -Naur cacti-0.8.6i-old/poller.php cacti-0.8.6i/poller.php | |
1041 | --- cacti-0.8.6i-old/poller.php 2007-01-23 21:29:26.000000000 -0600 | |
1042 | +++ cacti-0.8.6i/poller.php 2007-01-23 14:47:07.000000000 -0600 | |
1043 | @@ -40,6 +40,8 @@ | |
1044 | include_once($config["base_path"] . "/lib/graph_export.php"); | |
1045 | include_once($config["base_path"] . "/lib/rrd.php"); | |
1046 | ||
1047 | +do_hook("poller_top"); | |
1048 | + | |
1049 | /* Record Start Time */ | |
1050 | list($micro,$seconds) = split(" ", microtime()); | |
1051 | $start = $seconds + $micro; | |
1052 | @@ -166,7 +168,7 @@ | |
1053 | $polling_items = db_fetch_assoc("select poller_id,end_time from poller_time where poller_id = 0"); | |
1054 | ||
1055 | if (sizeof($polling_items) == $process_file_number) { | |
1056 | - $rrds_processed = $rrds_processed + process_poller_output($rrdtool_pipe); | |
1057 | + $rrds_processed = $rrds_processed + process_poller_output($rrdtool_pipe, TRUE); | |
1058 | ||
1059 | /* take time and log performance data */ | |
1060 | list($micro,$seconds) = split(" ", microtime()); | |
1061 | @@ -194,7 +196,6 @@ | |
1062 | ||
1063 | /* insert poller stats into the settings table */ | |
1064 | db_execute("replace into settings (name,value) values ('stats_poller','$cacti_stats')"); | |
1065 | - db_execute("truncate table poller_output"); | |
1066 | ||
1067 | break; | |
1068 | }else { | |
1069 | @@ -268,4 +269,6 @@ | |
1070 | } | |
1071 | // End Mainline Processing | |
1072 | ||
1073 | -?> | |
1074 | +do_hook("poller_bottom"); | |
1075 | + | |
1076 | +?> | |
1077 | \ No newline at end of file | |
1078 | diff -Naur cacti-0.8.6i-old/user_admin.php cacti-0.8.6i/user_admin.php | |
1079 | --- cacti-0.8.6i-old/user_admin.php 2007-01-23 21:29:26.000000000 -0600 | |
1080 | +++ cacti-0.8.6i/user_admin.php 2007-01-23 15:00:42.000000000 -0600 | |
1081 | @@ -72,11 +72,13 @@ | |
1082 | include_once("include/bottom_footer.php"); | |
1083 | break; | |
1084 | default: | |
1085 | - include_once("include/top_header.php"); | |
1086 | + if (!do_hook_function("user_admin_action", $_REQUEST["action"])) { | |
1087 | + include_once("include/top_header.php"); | |
1088 | ||
1089 | - user(); | |
1090 | + user(); | |
1091 | ||
1092 | - include_once("include/bottom_footer.php"); | |
1093 | + include_once("include/bottom_footer.php"); | |
1094 | + } | |
1095 | break; | |
1096 | } | |
1097 | ||
1098 | @@ -158,6 +160,7 @@ | |
1099 | $save["policy_trees"] = form_input_validate((isset($_POST["policy_trees"]) ? $_POST["policy_trees"] : $_POST["_policy_trees"]), "policy_trees", "", true, 3); | |
1100 | $save["policy_hosts"] = form_input_validate((isset($_POST["policy_hosts"]) ? $_POST["policy_hosts"] : $_POST["_policy_hosts"]), "policy_hosts", "", true, 3); | |
1101 | $save["policy_graph_templates"] = form_input_validate((isset($_POST["policy_graph_templates"]) ? $_POST["policy_graph_templates"] : $_POST["_policy_graph_templates"]), "policy_graph_templates", "", true, 3); | |
1102 | + $save = do_hook_function("user_admin_setup_sql_save", $save); | |
1103 | ||
1104 | if (!is_error_message()) { | |
1105 | $user_id = sql_save($save, "user_auth"); | |
1106 | @@ -200,6 +203,8 @@ | |
1107 | policy_hosts='" . $_POST["policy_hosts"] . "', | |
1108 | policy_graph_templates='" . $_POST["policy_graph_templates"] . "' | |
1109 | where id=" . $_POST["id"]); | |
1110 | + }else{ | |
1111 | + do_hook("user_admin_user_save"); | |
1112 | } | |
1113 | } | |
1114 | } | |
1115 | @@ -695,6 +700,7 @@ | |
1116 | <td <?php print (($_GET["action"] == "graph_settings_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='130' align='center' class='tab'> | |
1117 | <span class='textHeader'><a href='user_admin.php?action=graph_settings_edit&id=<?php print $_GET["id"];?>'>Graph Settings</a></span> | |
1118 | </td> | |
1119 | + <?php do_hook("user_admin_tab");?> | |
1120 | <td></td> | |
1121 | </tr> | |
1122 | </table> | |
1123 | @@ -708,7 +714,9 @@ | |
1124 | }elseif ($_GET["action"] == "graph_perms_edit") { | |
1125 | graph_perms_edit(); | |
1126 | }else{ | |
1127 | - user_realms_edit(); | |
1128 | + if (do_hook_function("user_admin_run_action", $_REQUEST["action"])) { | |
1129 | + user_realms_edit(); | |
1130 | + } | |
1131 | } | |
1132 | ||
1133 | form_save_button("user_admin.php"); | |
1134 | @@ -791,4 +799,4 @@ | |
1135 | } | |
1136 | html_end_box(); | |
1137 | } | |
1138 | -?> | |
1139 | +?> | |
1140 | \ No newline at end of file | |
1141 | diff -Naur cacti-0.8.6i-old/utilities.php cacti-0.8.6i/utilities.php | |
1142 | --- cacti-0.8.6i-old/utilities.php 2007-01-23 21:29:26.000000000 -0600 | |
1143 | +++ cacti-0.8.6i/utilities.php 2007-01-23 14:47:07.000000000 -0600 | |
1144 | @@ -122,11 +122,14 @@ | |
1145 | include_once("./include/bottom_footer.php"); | |
1146 | break; | |
1147 | default: | |
1148 | - include_once("./include/top_header.php"); | |
1149 | ||
1150 | - utilities(); | |
1151 | + if (!do_hook_function("utilities_action", $_REQUEST["action"])) { | |
1152 | + include_once("./include/top_header.php"); | |
1153 | ||
1154 | - include_once("./include/bottom_footer.php"); | |
1155 | + utilities(); | |
1156 | + | |
1157 | + include_once("./include/bottom_footer.php"); | |
1158 | + } | |
1159 | break; | |
1160 | } | |
1161 | ||
1162 | @@ -971,7 +974,9 @@ | |
1163 | </tr> | |
1164 | <?php | |
1165 | ||
1166 | + do_hook("utilities_list"); | |
1167 | + | |
1168 | html_end_box(); | |
1169 | } | |
1170 | ||
1171 | -?> | |
1172 | +?> | |
1173 | \ No newline at end of file |