]>
Commit | Line | Data |
---|---|---|
e4aad445 ER |
1 | diff -Naur cacti-0.8.7e-old/auth_changepassword.php cacti-0.8.7e/auth_changepassword.php |
2 | --- cacti-0.8.7e-old/auth_changepassword.php 2009-06-28 11:07:26.000000000 -0500 | |
3 | +++ cacti-0.8.7e/auth_changepassword.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
4 | @@ -59,6 +59,8 @@ |
5 | header("Location: index.php"); break; | |
6 | case '3': /* default graph page */ | |
7 | header("Location: graph_view.php"); break; | |
8 | + default: | |
9 | + api_plugin_hook_function('login_options_navigate', $user['login_opts']); | |
10 | } | |
11 | }else{ | |
12 | header("Location: graph_view.php"); | |
e4aad445 ER |
13 | diff -Naur cacti-0.8.7e-old/auth_login.php cacti-0.8.7e/auth_login.php |
14 | --- cacti-0.8.7e-old/auth_login.php 2009-06-28 11:07:28.000000000 -0500 | |
15 | +++ cacti-0.8.7e/auth_login.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
16 | @@ -212,6 +212,8 @@ |
17 | header("Location: index.php"); break; | |
18 | case '3': /* default graph page */ | |
19 | header("Location: graph_view.php"); break; | |
20 | + default: | |
21 | + api_plugin_hook_function('login_options_navigate', $user['login_opts']); | |
22 | } | |
23 | exit; | |
24 | ||
25 | @@ -262,9 +264,17 @@ | |
26 | <body bgcolor="#FFFFFF" onload="document.login.login_username.focus()"> | |
27 | <form name="login" method="post" action="<?php print basename($_SERVER["PHP_SELF"]);?>"> | |
28 | <input type="hidden" name="action" value="login"> | |
29 | +<?php | |
30 | + | |
31 | +api_plugin_hook("login_before"); | |
32 | + | |
33 | +$cacti_logo = $config['url_path'] . 'images/auth_login.gif'; | |
34 | +$cacti_logo = api_plugin_hook_function('cacti_image', $cacti_logo); | |
35 | + | |
36 | +?> | |
37 | <table align="center"> | |
38 | <tr> | |
39 | - <td colspan="2"><img src="images/auth_login.gif" border="0" alt=""></td> | |
40 | + <td colspan="2"><center><?php if ($cacti_logo != '') { ?><img src="<?php echo $cacti_logo; ?>" border="0" alt=""><?php } ?></center></td> | |
41 | </tr> | |
42 | <?php | |
43 | ||
44 | @@ -317,6 +327,7 @@ | |
45 | <td><input type="submit" value="Login"></td> | |
46 | </tr> | |
47 | </table> | |
48 | +<?php api_plugin_hook('login_after'); ?> | |
49 | </form> | |
50 | </body> | |
51 | </html> | |
e4aad445 ER |
52 | diff -Naur cacti-0.8.7e-old/data_sources.php cacti-0.8.7e/data_sources.php |
53 | --- cacti-0.8.7e-old/data_sources.php 2009-06-28 11:07:28.000000000 -0500 | |
54 | +++ cacti-0.8.7e/data_sources.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
55 | @@ -44,6 +44,8 @@ |
56 | 7 => "Disable" | |
57 | ); | |
58 | ||
59 | +$ds_actions = api_plugin_hook_function('data_source_action_array', $ds_actions); | |
60 | + | |
61 | /* set default action */ | |
62 | if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; } | |
63 | ||
64 | @@ -402,7 +404,10 @@ | |
65 | api_reapply_suggested_data_source_title($selected_items[$i]); | |
66 | update_data_source_title_cache($selected_items[$i]); | |
67 | } | |
68 | + } else { | |
69 | + api_plugin_hook_function('data_source_action_execute', $_POST['drp_action']); | |
70 | } | |
71 | + | |
72 | header("Location: data_sources.php"); | |
73 | exit; | |
74 | } | |
75 | @@ -533,7 +538,12 @@ | |
76 | <p>$ds_list</p> | |
77 | </td> | |
78 | </tr>\n | |
79 | - "; | |
80 | + "; | |
81 | + } else { | |
82 | + $save['drp_action'] = $_POST['drp_action']; | |
83 | + $save['ds_list'] = $ds_list; | |
84 | + $save['ds_array'] = (isset($ds_array)? $ds_array : array()); | |
85 | + api_plugin_hook_function('data_source_action_prepare', $save); | |
86 | } | |
87 | ||
88 | if (!isset($ds_array)) { | |
89 | @@ -675,6 +685,8 @@ | |
90 | input_validate_input_number(get_request_var("id")); | |
91 | /* ==================================================== */ | |
92 | ||
93 | + api_plugin_hook('data_source_edit_top'); | |
94 | + | |
95 | $use_data_template = true; | |
96 | $host_id = 0; | |
97 | ||
98 | @@ -967,8 +979,9 @@ | |
99 | ||
100 | form_save_button("data_sources.php"); | |
101 | ||
102 | - include_once("./include/bottom_footer.php"); | |
103 | + api_plugin_hook('data_source_edit_bottom'); | |
104 | ||
105 | + include_once("./include/bottom_footer.php"); | |
106 | } | |
107 | ||
108 | function get_poller_interval($seconds) { | |
109 | @@ -1300,6 +1313,7 @@ | |
110 | $i = 0; | |
111 | if (sizeof($data_sources) > 0) { | |
112 | foreach ($data_sources as $data_source) { | |
113 | + $data_source = api_plugin_hook_function('data_sources_table', $data_source); | |
114 | $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]); | |
115 | $data_input_name = ((empty($data_source["data_input_name"])) ? "<em>External</em>" : $data_source["data_input_name"]); | |
116 | $poller_interval = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0); | |
117 | @@ -1328,4 +1342,3 @@ | |
118 | print "</form>\n"; | |
119 | } | |
120 | ?> | |
121 | - | |
e4aad445 ER |
122 | diff -Naur cacti-0.8.7e-old/graph_image.php cacti-0.8.7e/graph_image.php |
123 | --- cacti-0.8.7e-old/graph_image.php 2009-06-28 11:07:28.000000000 -0500 | |
124 | +++ cacti-0.8.7e/graph_image.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
125 | @@ -44,6 +44,8 @@ |
126 | /* flush the headers now */ | |
127 | ob_end_clean(); | |
128 | ||
129 | +api_plugin_hook_function('graph_image'); | |
130 | + | |
131 | session_write_close(); | |
132 | ||
133 | $graph_data_array = array(); | |
e4aad445 ER |
134 | diff -Naur cacti-0.8.7e-old/graph.php cacti-0.8.7e/graph.php |
135 | --- cacti-0.8.7e-old/graph.php 2009-06-28 11:07:28.000000000 -0500 | |
136 | +++ cacti-0.8.7e/graph.php 2009-06-28 22:03:15.000000000 -0500 | |
5cde2610 GS |
137 | @@ -98,6 +98,7 @@ |
138 | <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> | |
139 | <a href='graph_xport.php?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_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br> | |
140 | <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> | |
141 | + <?php api_plugin_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $rra['id'], 'view_type' => $_REQUEST['view_type'])); ?> | |
142 | </td> | |
143 | </tr> | |
144 | <tr> | |
145 | @@ -212,6 +213,7 @@ | |
146 | <td valign='top' style='padding: 3px;' class='noprint'> | |
147 | <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> | |
148 | <a href='graph_xport.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;?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br> | |
e4aad445 | 149 | + <?php api_plugin_hook('graph_buttons', array('hook' => 'zoom', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $_GET['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?> |
5cde2610 GS |
150 | </td> |
151 | </tr> | |
152 | <tr> | |
153 | @@ -244,6 +246,7 @@ | |
154 | <td valign='top' style='padding: 3px;'> | |
155 | <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> | |
156 | <a href='graph_xport.php?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_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br> | |
157 | + <?php api_plugin_hook('graph_buttons', array('hook' => 'properties', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $_GET['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?> | |
158 | </td> | |
159 | </tr> | |
160 | <tr> | |
e4aad445 ER |
161 | diff -Naur cacti-0.8.7e-old/graphs_new.php cacti-0.8.7e/graphs_new.php |
162 | --- cacti-0.8.7e-old/graphs_new.php 2009-06-28 11:07:26.000000000 -0500 | |
163 | +++ cacti-0.8.7e/graphs_new.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
164 | @@ -479,7 +479,8 @@ |
165 | </td> | |
166 | <td nowrap style='white-space: nowrap;' class="textInfo" align="center" valign="top"> | |
167 | <span style="white-space: nowrap; color: #c16921;">*</span><a href="host.php?action=edit&id=<?php print $_REQUEST["host_id"];?>">Edit this Host</a><br> | |
168 | - <span style="white-space: nowrap; color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a> | |
169 | + <span style="white-space: nowrap; color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a><br> | |
170 | + <?php api_plugin_hook('graphs_new_top_links'); ?> | |
171 | </td> | |
172 | </tr> | |
173 | </table> | |
e4aad445 ER |
174 | diff -Naur cacti-0.8.7e-old/graphs.php cacti-0.8.7e/graphs.php |
175 | --- cacti-0.8.7e-old/graphs.php 2009-06-28 11:07:26.000000000 -0500 | |
176 | +++ cacti-0.8.7e/graphs.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
177 | @@ -45,6 +45,8 @@ |
178 | 4 => "Convert to Graph Template" | |
179 | ); | |
180 | ||
181 | +$graph_actions = api_plugin_hook_function('graphs_action_array', $graph_actions); | |
182 | + | |
183 | /* set default action */ | |
184 | if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; } | |
185 | ||
186 | @@ -360,8 +362,10 @@ | |
187 | input_validate_input_number($selected_items[$i]); | |
188 | /* ==================================================== */ | |
189 | ||
190 | - api_resize_graphs($selected_items[$i], $_POST["graph_width"], $_POST["graph_height"]); | |
191 | + api_resize_graphs($selected_items[$i], $_POST['graph_width'], $_POST['graph_height']); | |
192 | } | |
193 | + } else { | |
194 | + api_plugin_hook_function('graphs_action_execute', $_POST['drp_action']); | |
195 | } | |
196 | ||
197 | header("Location: graphs.php"); | |
198 | @@ -502,6 +506,11 @@ | |
199 | </td> | |
200 | </tr>\n | |
201 | "; | |
202 | + } else { | |
203 | + $save['drp_action'] = $_POST['drp_action']; | |
204 | + $save['graph_list'] = $graph_list; | |
205 | + $save['graph_array'] = (isset($graph_array) ? $graph_array : array()); | |
206 | + api_plugin_hook_function('graphs_action_prepare', $save); | |
207 | } | |
208 | ||
209 | if (!isset($graph_array)) { | |
e4aad445 ER |
210 | diff -Naur cacti-0.8.7e-old/host.php cacti-0.8.7e/host.php |
211 | --- cacti-0.8.7e-old/host.php 2009-06-28 11:07:26.000000000 -0500 | |
212 | +++ cacti-0.8.7e/host.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
213 | @@ -44,6 +44,8 @@ |
214 | 6 => "Change Availability Options" | |
215 | ); | |
216 | ||
217 | +$device_actions = api_plugin_hook_function('device_action_array', $device_actions); | |
218 | + | |
219 | /* set default action */ | |
220 | if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; } | |
221 | ||
222 | @@ -309,6 +311,8 @@ | |
223 | ||
224 | 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); | |
225 | } | |
226 | + } else { | |
227 | + api_plugin_hook_function('device_action_execute', $_POST['drp_action']); | |
228 | } | |
229 | ||
230 | header("Location: host.php"); | |
231 | @@ -445,6 +449,11 @@ | |
232 | </tr>\n | |
233 | <input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n | |
234 | "; | |
235 | + } else { | |
236 | + $save['drp_action'] = $_POST['drp_action']; | |
237 | + $save['host_list'] = $host_list; | |
238 | + $save['host_array'] = (isset($host_array)? $host_array : array()); | |
239 | + api_plugin_hook_function('device_action_prepare', $save); | |
240 | } | |
241 | ||
242 | if (!isset($host_array)) { | |
243 | @@ -533,6 +542,8 @@ | |
244 | ||
245 | display_output_messages(); | |
246 | ||
247 | + api_plugin_hook('host_edit_top'); | |
248 | + | |
249 | if (!empty($_GET["id"])) { | |
250 | $host = db_fetch_row("select * from host where id=" . $_GET["id"]); | |
251 | $header_label = "[edit: " . $host["description"] . "]"; | |
252 | @@ -643,7 +654,8 @@ | |
253 | <td class="textInfo" valign="top"> | |
254 | <span style="color: #c16921;">*</span><a href="graphs_new.php?host_id=<?php print $host["id"];?>">Create Graphs for this Host</a><br> | |
255 | <span style="color: #c16921;">*</span><a href="data_sources.php?host_id=<?php print $host["id"];?>&ds_rows=30&filter=&template_id=-1&method_id=-1&page=1">Data Source List</a><br> | |
256 | - <span style="color: #c16921;">*</span><a href="graphs.php?host_id=<?php print $host["id"];?>&graph_rows=30&filter=&template_id=-1&page=1">Graph List</a> | |
257 | + <span style="color: #c16921;">*</span><a href="graphs.php?host_id=<?php print $host["id"];?>&graph_rows=30&filter=&template_id=-1&page=1">Graph List</a><br> | |
258 | + <?php api_plugin_hook('device_edit_top_links'); ?> | |
259 | </td> | |
260 | </tr> | |
261 | </table> | |
262 | @@ -1104,6 +1116,8 @@ | |
263 | } | |
264 | ||
265 | form_save_button("host.php"); | |
266 | + | |
267 | + api_plugin_hook('host_edit_bottom'); | |
268 | } | |
269 | ||
270 | function host() { | |
e4aad445 ER |
271 | diff -Naur cacti-0.8.7e-old/include/auth.php cacti-0.8.7e/include/auth.php |
272 | --- cacti-0.8.7e-old/include/auth.php 2009-06-28 11:07:26.000000000 -0500 | |
273 | +++ cacti-0.8.7e/include/auth.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
274 | @@ -31,6 +31,9 @@ |
275 | } | |
276 | ||
277 | if (read_config_option("auth_method") != 0) { | |
278 | + /* handle alternate authentication realms */ | |
279 | + api_plugin_hook_function('auth_alternate_realms'); | |
280 | + | |
281 | /* handle change password dialog */ | |
282 | if ((isset($_SESSION['sess_change_password'])) && (read_config_option("webbasic_enabled") != "on")) { | |
283 | header ("Location: auth_changepassword.php?ref=" . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "index.php")); | |
284 | @@ -75,7 +78,7 @@ | |
285 | <html> | |
286 | <head> | |
287 | <title>Cacti</title> | |
288 | - <link href="include/main.css" rel="stylesheet"> | |
289 | + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet"> | |
290 | </style> | |
291 | </head> | |
292 | ||
293 | @@ -83,7 +86,7 @@ | |
294 | ||
295 | <table width="450" align='center'> | |
296 | <tr> | |
297 | - <td colspan='2'><img src='images/auth_deny.gif' border='0' alt='Access Denied'></td> | |
298 | + <td colspan='2'><img src='<?php echo $config['url_path']; ?>images/auth_deny.gif' border='0' alt='Access Denied'></td> | |
299 | </tr> | |
300 | <tr height='10'><td></td></tr> | |
301 | <tr> | |
302 | @@ -91,7 +94,7 @@ | |
303 | need access to this particular section, please contact the Cacti administrator.</td> | |
304 | </tr> | |
305 | <tr> | |
306 | - <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='index.php'>Login</a> )</td> | |
307 | + <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='<?php echo $config['url_path']; ?>index.php'>Login</a> )</td> | |
308 | </tr> | |
309 | </table> | |
310 | ||
e4aad445 ER |
311 | diff -Naur cacti-0.8.7e-old/include/bottom_footer.php cacti-0.8.7e/include/bottom_footer.php |
312 | --- cacti-0.8.7e-old/include/bottom_footer.php 2009-06-28 11:07:26.000000000 -0500 | |
313 | +++ cacti-0.8.7e/include/bottom_footer.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
314 | @@ -21,6 +21,10 @@ |
315 | | http://www.cacti.net/ | | |
316 | +-------------------------------------------------------------------------+ | |
317 | */ | |
318 | + | |
319 | +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE); | |
320 | +if (($oper_mode == OPER_MODE_NATIVE) || ($oper_mode == OPER_MODE_IFRAME_NONAV)) { | |
321 | + | |
322 | ?> | |
323 | <br> | |
324 | </td> | |
325 | @@ -31,6 +35,9 @@ | |
326 | </html> | |
327 | ||
328 | <?php | |
329 | + | |
330 | +} | |
331 | + | |
332 | /* we use this session var to store field values for when a save fails, | |
333 | this way we can restore the field's previous values. we reset it here, because | |
334 | they only need to be stored for a single page */ | |
e4aad445 ER |
335 | diff -Naur cacti-0.8.7e-old/include/global_arrays.php cacti-0.8.7e/include/global_arrays.php |
336 | --- cacti-0.8.7e-old/include/global_arrays.php 2009-06-28 11:07:26.000000000 -0500 | |
337 | +++ cacti-0.8.7e/include/global_arrays.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
338 | @@ -22,6 +22,8 @@ |
339 | +-------------------------------------------------------------------------+ | |
340 | */ | |
341 | ||
342 | +global $menu; | |
343 | + | |
344 | $messages = array( | |
345 | 1 => array( | |
346 | "message" => 'Save Successful.', | |
e4aad445 | 347 | @@ -641,4 +643,10 @@ |
5cde2610 GS |
348 | GDC_SLASH => "/" |
349 | ); | |
350 | ||
351 | +$plugin_architecture = array( | |
e4aad445 | 352 | + 'version' => '2.5' |
5cde2610 GS |
353 | + ); |
354 | + | |
355 | +api_plugin_hook('config_arrays'); | |
356 | + | |
357 | ?> | |
e4aad445 ER |
358 | diff -Naur cacti-0.8.7e-old/include/global_constants.php cacti-0.8.7e/include/global_constants.php |
359 | --- cacti-0.8.7e-old/include/global_constants.php 2009-06-28 11:07:26.000000000 -0500 | |
360 | +++ cacti-0.8.7e/include/global_constants.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
361 | @@ -175,4 +175,8 @@ |
362 | define("SNMP_CMDPHP", 1); | |
363 | define("SNMP_WEBUI", 2); | |
364 | ||
365 | +define('OPER_MODE_NATIVE', 0); | |
366 | +define('OPER_MODE_RESKIN', 1); | |
367 | +define('OPER_MODE_IFRAME_NONAV', 2); | |
368 | + | |
369 | ?> | |
e4aad445 ER |
370 | diff -Naur cacti-0.8.7e-old/include/global_form.php cacti-0.8.7e/include/global_form.php |
371 | --- cacti-0.8.7e-old/include/global_form.php 2009-06-28 11:07:26.000000000 -0500 | |
372 | +++ cacti-0.8.7e/include/global_form.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
373 | @@ -22,8 +22,9 @@ |
374 | +-------------------------------------------------------------------------+ | |
375 | */ | |
376 | ||
377 | -if (!defined("VALID_HOST_FIELDS")) { | |
378 | - define("VALID_HOST_FIELDS", "(hostname|snmp_community|snmp_username|snmp_password|snmp_auth_protocol|snmp_priv_passphrase|snmp_priv_protocol|snmp_context|snmp_version|snmp_port|snmp_timeout)"); | |
379 | +if (!defined('VALID_HOST_FIELDS')) { | |
380 | + $string = api_plugin_hook_function('valid_host_fields', '(hostname|snmp_community|snmp_username|snmp_password|snmp_auth_protocol|snmp_priv_passphrase|snmp_priv_protocol|snmp_context|snmp_version|snmp_port|snmp_timeout)'); | |
381 | + define('VALID_HOST_FIELDS', $string); | |
382 | } | |
383 | ||
384 | /* file: cdef.php, action: edit */ | |
385 | @@ -1184,4 +1185,7 @@ | |
386 | "dropdown_sql" => "select id,name from snmp_query order by name" | |
387 | ) | |
388 | ); | |
389 | -?> | |
390 | + | |
391 | + | |
392 | +api_plugin_hook('config_form'); | |
393 | + | |
e4aad445 ER |
394 | diff -Naur cacti-0.8.7e-old/include/global.php cacti-0.8.7e/include/global.php |
395 | --- cacti-0.8.7e-old/include/global.php 2009-06-28 11:07:26.000000000 -0500 | |
396 | +++ cacti-0.8.7e/include/global.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
397 | @@ -41,6 +41,22 @@ |
398 | /* Default session name - Session name must contain alpha characters */ | |
399 | $cacti_session_name = "Cacti"; | |
400 | ||
401 | +$plugins = array(); | |
402 | +//$plugins[] = 'thold'; | |
403 | + | |
404 | +/* Do not edit this line */ | |
405 | +$config = array(); | |
406 | + | |
407 | +/* | |
408 | + Edit this to point to the default URL of your Cacti install | |
409 | + ex: if your cacti install as at http://serverip/cacti/ this | |
410 | + would be set to /cacti/ | |
411 | +*/ | |
412 | + | |
413 | +$config['url_path'] = '/'; | |
414 | + | |
415 | +define('URL_PATH', $config['url_path']); | |
416 | + | |
417 | /* Include configuration */ | |
418 | include(dirname(__FILE__) . "/config.php"); | |
419 | ||
e4aad445 | 420 | @@ -76,7 +92,6 @@ |
5cde2610 GS |
421 | "structure_rra_paths.php" |
422 | ); | |
423 | ||
424 | -$config = array(); | |
425 | $colors = array(); | |
426 | ||
427 | /* this should be auto-detected, set it manually if needed */ | |
e4aad445 | 428 | @@ -180,18 +195,23 @@ |
5cde2610 GS |
429 | /* display ALL errors */ |
430 | error_reporting(E_ALL); | |
431 | ||
432 | +/* current cacti version */ | |
433 | +$config["cacti_version"] = "0.8.7c"; | |
434 | + | |
435 | /* include base modules */ | |
436 | include($config["library_path"] . "/adodb/adodb.inc.php"); | |
437 | include($config["library_path"] . "/database.php"); | |
438 | -include_once($config["library_path"] . "/functions.php"); | |
439 | -include_once($config["include_path"] . "/global_constants.php"); | |
440 | -include_once($config["include_path"] . "/global_arrays.php"); | |
441 | -include_once($config["include_path"] . "/global_settings.php"); | |
442 | ||
443 | /* connect to the database server */ | |
444 | db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port); | |
445 | ||
446 | /* include additional modules */ | |
447 | +include_once($config["library_path"] . "/functions.php"); | |
448 | +include_once($config["include_path"] . "/global_constants.php"); | |
449 | +include_once($config["library_path"] . "/plugins.php"); | |
450 | +include_once($config["include_path"] . "/plugins.php"); | |
451 | +include_once($config["include_path"] . "/global_arrays.php"); | |
452 | +include_once($config["include_path"] . "/global_settings.php"); | |
453 | include_once($config["include_path"] . "/global_form.php"); | |
454 | include_once($config["library_path"] . "/html.php"); | |
455 | include_once($config["library_path"] . "/html_form.php"); | |
e4aad445 | 456 | @@ -200,6 +220,8 @@ |
5cde2610 GS |
457 | include_once($config["library_path"] . "/variables.php"); |
458 | include_once($config["library_path"] . "/auth.php"); | |
459 | ||
460 | +api_plugin_hook("config_insert"); | |
461 | + | |
462 | /* current cacti version */ | |
e4aad445 | 463 | $config["cacti_version"] = "0.8.7e"; |
5cde2610 | 464 | |
e4aad445 ER |
465 | diff -Naur cacti-0.8.7e-old/include/global_settings.php cacti-0.8.7e/include/global_settings.php |
466 | --- cacti-0.8.7e-old/include/global_settings.php 2009-06-28 11:07:26.000000000 -0500 | |
467 | +++ cacti-0.8.7e/include/global_settings.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
468 | @@ -1185,4 +1185,6 @@ |
469 | ) | |
470 | ); | |
471 | ||
472 | +api_plugin_hook('config_settings'); | |
473 | + | |
474 | ?> | |
e4aad445 ER |
475 | diff -Naur cacti-0.8.7e-old/include/plugins.php cacti-0.8.7e/include/plugins.php |
476 | --- cacti-0.8.7e-old/include/plugins.php 1969-12-31 17:00:00.000000000 -0700 | |
477 | +++ cacti-0.8.7e/include/plugins.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
478 | @@ -0,0 +1,36 @@ |
479 | +<?php | |
480 | + | |
481 | +/* | |
482 | + * Copyright (c) 1999-2005 The SquirrelMail Project Team (http://squirrelmail.org) | |
483 | + * Licensed under the GNU GPL. For full terms see the file COPYING. | |
484 | + */ | |
485 | + | |
486 | +global $plugin_hooks; | |
487 | +$plugin_hooks = array(); | |
488 | + | |
489 | +function use_plugin ($name) { | |
490 | + global $config; | |
491 | + if (file_exists($config['base_path'] . "/plugins/$name/setup.php")) { | |
492 | + include_once($config['base_path'] . "/plugins/$name/setup.php"); | |
493 | + $function = "plugin_init_$name"; | |
494 | + if (function_exists($function)) { | |
495 | + $function(); | |
496 | + } | |
497 | + } | |
498 | +} | |
499 | + | |
500 | +/** | |
501 | + * This function executes a hook. | |
502 | + * @param string $name Name of hook to fire | |
503 | + * @return mixed $data | |
504 | + */ | |
505 | + | |
506 | +/* On startup, register all plugins configured for use. */ | |
507 | +if (isset($plugins) && is_array($plugins)) { | |
508 | + foreach ($plugins as $name) { | |
509 | + use_plugin($name); | |
510 | + } | |
511 | +} | |
512 | + | |
513 | + | |
514 | + | |
e4aad445 ER |
515 | diff -Naur cacti-0.8.7e-old/include/top_graph_header.php cacti-0.8.7e/include/top_graph_header.php |
516 | --- cacti-0.8.7e-old/include/top_graph_header.php 2009-06-28 11:07:26.000000000 -0500 | |
517 | +++ cacti-0.8.7e/include/top_graph_header.php 2009-06-28 21:57:49.000000000 -0500 | |
5cde2610 GS |
518 | @@ -25,6 +25,11 @@ |
519 | $using_guest_account = false; | |
520 | $show_console_tab = true; | |
521 | ||
522 | +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE); | |
523 | +if ($oper_mode == OPER_MODE_RESKIN) { | |
524 | + return; | |
525 | +} | |
526 | + | |
527 | /* ================= input validation ================= */ | |
528 | input_validate_input_number(get_request_var_request("local_graph_id")); | |
529 | /* ==================================================== */ | |
e4aad445 | 530 | @@ -50,41 +55,52 @@ |
5cde2610 GS |
531 | $_SESSION["sess_nav_level_cache"][2]["url"] = "graph.php?local_graph_id=" . $_REQUEST["local_graph_id"] . "&rra_id=all"; |
532 | } | |
533 | ||
534 | +$page_title = api_plugin_hook_function('page_title', 'Cacti'); | |
535 | + | |
536 | ?> | |
537 | <html> | |
538 | <head> | |
539 | - <title>Cacti</title> | |
540 | + <title><?php echo $page_title; ?></title> | |
541 | <?php if (isset($_SESSION["custom"])) { | |
542 | if ($_SESSION["custom"]) { | |
543 | print "<meta http-equiv=refresh content='99999'>\r\n"; | |
544 | }else{ | |
545 | - print "<meta http-equiv=refresh content='" . read_graph_config_option("page_refresh") . "'>\r\n"; | |
5cde2610 | 546 | + $refresh = api_plugin_hook_function('top_graph_refresh', read_graph_config_option('page_refresh')); |
e4aad445 ER |
547 | + print "<meta http-equiv=refresh content='" . $refresh . "'>\r\n"; |
548 | } | |
5cde2610 GS |
549 | } |
550 | ?> | |
551 | - <link href="include/main.css" rel="stylesheet"> | |
552 | - <link href="images/favicon.ico" rel="shortcut icon"/> | |
553 | - <script type="text/javascript" src="include/layout.js"></script> | |
554 | - <script type="text/javascript" src="include/treeview/ua.js"></script> | |
555 | - <script type="text/javascript" src="include/treeview/ftiens4.js"></script> | |
556 | - <script type="text/javascript" src="include/jscalendar/calendar.js"></script> | |
557 | - <script type="text/javascript" src="include/jscalendar/lang/calendar-en.js"></script> | |
558 | - <script type="text/javascript" src="include/jscalendar/calendar-setup.js"></script> | |
559 | + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet"> | |
560 | + <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/> | |
561 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script> | |
562 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script> | |
563 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script> | |
564 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script> | |
565 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script> | |
566 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script> | |
567 | + <?php api_plugin_hook('page_head'); ?> | |
568 | </head> | |
569 | ||
570 | -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> | |
571 | +<?php if ($oper_mode == OPER_MODE_NATIVE) {?> | |
572 | +<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" <?php print api_plugin_hook_function("body_style", "");?>> | |
573 | <a name='page_top'></a> | |
574 | +<?php }else{?> | |
575 | +<body leftmargin="15" topmargin="15" marginwidth="15" marginheight="15" <?php print api_plugin_hook_function("body_style", "");?>> | |
576 | +<?php }?> | |
577 | ||
578 | <table width="100%" height="100%" cellspacing="0" cellpadding="0"> | |
579 | +<?php if ($oper_mode == OPER_MODE_NATIVE) { ;?> | |
580 | <tr height="25" bgcolor="#a9a9a9" class="noprint"> | |
581 | <td colspan="2" valign="bottom" nowrap> | |
582 | <table width="100%" cellspacing="0" cellpadding="0"> | |
583 | - <tr style="background: transparent url('images/cacti_backdrop2.gif') no-repeat center right;"> | |
584 | + <tr style="background: transparent url('<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif') no-repeat center right;"> | |
585 | <td id="tabs" nowrap> | |
586 | - <?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<?php if ((substr(basename($_SERVER["PHP_SELF"]),0,5) == "graph") || (basename($_SERVER["PHP_SELF"]) == "graph_settings.php")) { print "_down"; } print ".gif";?>" alt="Graphs" align="absmiddle" border="0"></a> | |
587 | + <?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<?php if ((substr(basename($_SERVER["PHP_SELF"]),0,5) == "graph") || (basename($_SERVER["PHP_SELF"]) == "graph_settings.php")) { print "_down"; } print ".gif";?>" alt="Graphs" align="absmiddle" border="0"></a><?php | |
588 | + api_plugin_hook('top_graph_header_tabs'); | |
e4aad445 | 589 | + ?> |
5cde2610 GS |
590 | </td> |
591 | <td id="gtabs" align="right" nowrap> | |
e4aad445 ER |
592 | - <?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 (isset($_REQUEST["action"]) && $_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 (isset($_REQUEST["action"]) && $_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 (isset($_REQUEST["action"]) && $_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?> <br> |
593 | + <?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 (isset($_REQUEST["action"]) && $_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 (isset($_REQUEST["action"]) && $_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 (isset($_REQUEST["action"]) && $_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?> <br> | |
5cde2610 GS |
594 | </td> |
595 | </tr> | |
596 | </table> | |
e4aad445 | 597 | @@ -92,7 +108,7 @@ |
5cde2610 GS |
598 | </tr> |
599 | <tr height="2" colspan="2" bgcolor="#183c8f" class="noprint"> | |
600 | <td colspan="2"> | |
601 | - <img src="images/transparent_line.gif" width="170" height="2" border="0"><br> | |
602 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br> | |
603 | </td> | |
604 | </tr> | |
605 | <tr height="5" bgcolor="#e9e9e9" class="noprint"> | |
e4aad445 | 606 | @@ -104,7 +120,7 @@ |
5cde2610 GS |
607 | </td> |
608 | <td align="right"> | |
609 | <?php if ((isset($_SESSION["sess_user_id"])) && ($using_guest_account == false)) { ?> | |
610 | - 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>) | |
611 | + 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>) | |
612 | <?php } ?> | |
613 | </td> | |
614 | </tr> | |
e4aad445 | 615 | @@ -112,10 +128,10 @@ |
5cde2610 GS |
616 | </td> |
617 | </tr> | |
618 | <tr class="noprint"> | |
619 | - <td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;"> | |
620 | - <img src="images/transparent_line.gif" width="<?php print read_graph_config_option("default_dual_pane_width");?>" height="2" border="0"><br> | |
621 | + <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;"> | |
622 | + <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> | |
623 | </td> | |
624 | - <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;"> | |
625 | + <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;"> | |
626 | ||
627 | </td> | |
628 | </tr> | |
e4aad445 | 629 | @@ -141,9 +157,10 @@ |
5cde2610 GS |
630 | </td> |
631 | </tr> | |
632 | <?php }?> | |
633 | +<?php } ?> | |
634 | ||
635 | <tr> | |
636 | - <?php if ((read_graph_config_option("default_tree_view_mode") == "2") && (($_REQUEST["action"] == "tree") || ((isset($_REQUEST["view_type"]) ? $_REQUEST["view_type"] : "") == "tree"))) { ?> | |
637 | + <?php if ((read_graph_config_option("default_tree_view_mode") == "2") && (isset($_REQUEST["action"]) && (($_REQUEST["action"] == "tree") || ((isset($_REQUEST["view_type"]) ? $_REQUEST["view_type"] : "") == "tree")))) { ?> | |
638 | <td valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;" bgcolor='#efefef' width='<?php print read_graph_config_option("default_dual_pane_width");?>' class='noprint'> | |
639 | <table border=0 cellpadding=0 cellspacing=0><tr><td><font size=-2><a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></font></td></tr></table> | |
640 | <?php grow_dhtml_trees(); ?> | |
e4aad445 ER |
641 | diff -Naur cacti-0.8.7e-old/include/top_header.php cacti-0.8.7e/include/top_header.php |
642 | --- cacti-0.8.7e-old/include/top_header.php 2009-06-28 11:07:26.000000000 -0500 | |
643 | +++ cacti-0.8.7e/include/top_header.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
644 | @@ -22,37 +22,52 @@ |
645 | +-------------------------------------------------------------------------+ | |
646 | */ | |
647 | ||
648 | -global $colors; | |
649 | +global $colors, $config; | |
650 | + | |
651 | +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE); | |
652 | +if ($oper_mode == OPER_MODE_RESKIN) { | |
653 | + return; | |
654 | +} | |
655 | + | |
656 | +$page_title = api_plugin_hook_function('page_title', 'Cacti'); | |
657 | + | |
658 | ?> | |
659 | <html> | |
660 | <head> | |
661 | - <title>Cacti</title> | |
662 | - <link href="include/main.css" rel="stylesheet"> | |
663 | - <link href="images/favicon.ico" rel="shortcut icon"/> | |
664 | - <script type="text/javascript" src="include/layout.js"></script> | |
665 | + <title><?php echo $page_title; ?></title> | |
666 | + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet"> | |
667 | + <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/> | |
668 | + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script> | |
669 | <?php if (isset($refresh)) { | |
670 | print "<meta http-equiv=refresh content=\"" . $refresh["seconds"] . "; url='" . $refresh["page"] . "'\">"; | |
671 | - }?> | |
672 | + } | |
673 | + api_plugin_hook('page_head'); ?> | |
674 | </style> | |
675 | </head> | |
676 | ||
677 | -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif"> | |
678 | +<?php if ($oper_mode == OPER_MODE_NATIVE) {?> | |
679 | +<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" <?php print api_plugin_hook_function("body_style", "");?>> | |
680 | +<?php }else{?> | |
681 | +<body leftmargin="15" topmargin="15" marginwidth="15" marginheight="15" <?php print api_plugin_hook_function("body_style", "");?>> | |
682 | +<?php }?> | |
683 | ||
684 | <table width="100%" cellspacing="0" cellpadding="0"> | |
685 | +<?php if ($oper_mode == OPER_MODE_NATIVE) { ;?> | |
686 | <tr height="1" bgcolor="#a9a9a9"> | |
687 | <td valign="bottom" colspan="3" nowrap> | |
688 | <table width="100%" cellspacing="0" cellpadding="0"> | |
689 | - <tr style="background: transparent url('images/cacti_backdrop.gif') no-repeat center right;"> | |
690 | + <tr style="background: transparent url('<?php echo $config['url_path']; ?>images/cacti_backdrop.gif') no-repeat center right;"> | |
691 | <td id="tabs" valign="bottom"> | |
692 | - <a href="index.php"><img src="images/tab_console_down.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> | |
693 | - </td> | |
694 | + <a href="<?php echo $config['url_path']; ?>index.php"><img src="<?php echo $config['url_path']; ?>images/tab_console_down.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="Graphs" align="absmiddle" border="0"></a><?php | |
695 | + api_plugin_hook('top_header_tabs'); | |
696 | + ?></td> | |
697 | </tr> | |
698 | </table> | |
699 | </td> | |
700 | </tr> | |
701 | <tr height="2" bgcolor="#183c8f"> | |
702 | <td colspan="3"> | |
703 | - <img src="images/transparent_line.gif" height="2" border="0"><br> | |
704 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" height="2" border="0"><br> | |
705 | </td> | |
706 | </tr> | |
707 | <tr height="5" bgcolor="#e9e9e9"> | |
708 | @@ -64,7 +79,7 @@ | |
709 | </td> | |
710 | <td align="right"> | |
711 | <?php if (read_config_option("auth_method") != 0) { ?> | |
712 | - 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>) | |
713 | + 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>) | |
714 | <?php } ?> | |
715 | </td> | |
716 | </tr> | |
717 | @@ -72,10 +87,10 @@ | |
718 | </td> | |
719 | </tr> | |
720 | <tr> | |
721 | - <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;"> | |
722 | - <img src="images/transparent_line.gif" width="135" height="2" border="0"><br> | |
723 | - </td> | |
724 | - <td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff"> | |
725 | + <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;"> | |
726 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="2" border="0"><br> | |
727 | + </td> | |
728 | + <td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff"> | |
729 | ||
730 | </td> | |
731 | </tr> | |
732 | @@ -85,9 +100,12 @@ | |
733 | <?php draw_menu();?> | |
734 | </table> | |
735 | ||
736 | - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br> | |
737 | - <p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p> | |
738 | - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br> | |
739 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br> | |
740 | + <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> | |
741 | + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br> | |
742 | </td> | |
743 | <td width="100%" colspan="2" valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;"><?php display_output_messages();?> | |
744 | - | |
745 | +<?php }else{ ?> | |
746 | + <tr> | |
747 | + <td width="100%" valign="top"><?php display_output_messages();?> | |
748 | +<?php } ?> | |
e4aad445 ER |
749 | diff -Naur cacti-0.8.7e-old/index.php cacti-0.8.7e/index.php |
750 | --- cacti-0.8.7e-old/index.php 2009-06-28 11:07:26.000000000 -0500 | |
751 | +++ cacti-0.8.7e/index.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
752 | @@ -25,6 +25,8 @@ |
753 | include("./include/auth.php"); | |
754 | include("./include/top_header.php"); | |
755 | ||
756 | +api_plugin_hook('console_before'); | |
757 | + | |
758 | ?> | |
759 | <table width="100%" align="center"> | |
760 | <tr> | |
761 | @@ -46,6 +48,8 @@ | |
762 | ||
763 | <?php | |
764 | ||
765 | +api_plugin_hook('console_after'); | |
766 | + | |
767 | include("./include/bottom_footer.php"); | |
768 | ||
769 | ?> | |
e4aad445 ER |
770 | diff -Naur cacti-0.8.7e-old/lib/api_device.php cacti-0.8.7e/lib/api_device.php |
771 | --- cacti-0.8.7e-old/lib/api_device.php 2009-06-28 11:07:28.000000000 -0500 | |
772 | +++ cacti-0.8.7e/lib/api_device.php 2009-06-28 22:51:07.000000000 -0500 | |
773 | @@ -137,6 +137,8 @@ | |
5cde2610 GS |
774 | $save["ping_retries"] = form_input_validate($ping_retries, "ping_retries", "^[0-9]+$", true, 3); |
775 | $save["max_oids"] = form_input_validate($max_oids, "max_oids", "^[0-9]+$", true, 3); | |
776 | ||
777 | + $save = api_plugin_hook_function('api_device_save', $save); | |
778 | + | |
779 | $host_id = 0; | |
780 | ||
781 | if (!is_error_message()) { | |
e4aad445 ER |
782 | diff -Naur cacti-0.8.7e-old/lib/auth.php cacti-0.8.7e/lib/auth.php |
783 | --- cacti-0.8.7e-old/lib/auth.php 2009-06-28 11:07:26.000000000 -0500 | |
784 | +++ cacti-0.8.7e/lib/auth.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
785 | @@ -122,6 +122,8 @@ |
786 | } | |
787 | } | |
788 | ||
789 | + api_plugin_hook_function('copy_user', array('template_id' => $template_id, 'new_id' => $new_id)); | |
790 | + | |
791 | return true; | |
792 | ||
793 | } | |
794 | @@ -153,6 +155,7 @@ | |
795 | db_execute("delete from settings_graphs where user_id=" . $user_id); | |
796 | db_execute("delete from settings_tree where user_id=" . $user_id); | |
797 | ||
798 | + api_plugin_hook_function('user_remove', $user_id); | |
799 | } | |
800 | ||
801 | ||
e4aad445 ER |
802 | diff -Naur cacti-0.8.7e-old/lib/functions.php cacti-0.8.7e/lib/functions.php |
803 | --- cacti-0.8.7e-old/lib/functions.php 2009-06-28 11:07:28.000000000 -0500 | |
804 | +++ cacti-0.8.7e/lib/functions.php 2009-06-28 22:51:07.000000000 -0500 | |
805 | @@ -1639,6 +1639,7 @@ | |
5cde2610 GS |
806 | /* draw_navigation_text - determines the top header navigation text for the current page and displays it to |
807 | the browser */ | |
808 | function draw_navigation_text() { | |
809 | + global $config; | |
810 | $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array()); | |
811 | ||
812 | $nav = array( | |
e4aad445 | 813 | @@ -1651,8 +1652,8 @@ |
5cde2610 GS |
814 | "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), |
815 | "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), | |
816 | "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"), | |
817 | - "index.php:" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"), | |
818 | - "index.php:login" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"), | |
819 | + "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"), | |
820 | + "index.php:login" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"), | |
821 | "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"), | |
822 | "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"), | |
823 | "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"), | |
e4aad445 | 824 | @@ -1730,6 +1731,8 @@ |
5cde2610 GS |
825 | "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"), |
826 | ); | |
827 | ||
828 | + $nav = api_plugin_hook_function('draw_navigation_text', $nav); | |
829 | + | |
830 | $current_page = basename($_SERVER["PHP_SELF"]); | |
831 | ||
832 | input_validate_input_regex(get_request_var_request("action"), "^([a-zA-Z0-9_-]+)$"); | |
e4aad445 ER |
833 | diff -Naur cacti-0.8.7e-old/lib/html_form.php cacti-0.8.7e/lib/html_form.php |
834 | --- cacti-0.8.7e-old/lib/html_form.php 2009-06-28 11:07:28.000000000 -0500 | |
835 | +++ cacti-0.8.7e/lib/html_form.php 2009-06-28 22:51:07.000000000 -0500 | |
836 | @@ -655,11 +655,13 @@ | |
5cde2610 GS |
837 | on a confirmation form |
838 | @arg $cancel_url - the url to go to when the user clicks 'cancel' | |
839 | @arg $action_url - the url to go to when the user clicks 'delete' */ | |
840 | -function form_confirm_buttons($action_url, $cancel_url) { ?> | |
841 | +function form_confirm_buttons($action_url, $cancel_url) { | |
842 | + global $config; | |
843 | + ?> | |
844 | <tr> | |
845 | <td bgcolor="#E1E1E1"> | |
846 | - <a href="<?php print $cancel_url;?>"><img src="images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a> | |
847 | - <a href="<?php print $action_url . "&confirm=yes";?>"><img src="images/button_delete.gif" border="0" alt="Delete" align="absmiddle"></a> | |
848 | + <a href="<?php print $cancel_url;?>"><img src="<?php print $config['url_path'] ?>images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a> | |
849 | + <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> | |
850 | </td> | |
851 | </tr> | |
852 | <?php } | |
e4aad445 | 853 | @@ -670,6 +672,7 @@ |
5cde2610 GS |
854 | @arg $force_type - if specified, will force the 'action' button to be either |
855 | 'save' or 'create'. otherwise this field should be properly auto-detected */ | |
856 | function form_save_button($cancel_url, $force_type = "", $key_field = "id") { | |
857 | + global $config; | |
858 | if (empty($force_type)) { | |
859 | if (empty($_GET[$key_field])) { | |
860 | $img = "button_create.gif"; | |
e4aad445 | 861 | @@ -690,8 +693,8 @@ |
5cde2610 GS |
862 | <tr> |
863 | <td bgcolor="#f5f5f5" align="right"> | |
864 | <input type='hidden' name='action' value='save'> | |
865 | - <a href='<?php print $cancel_url;?>'><img src='images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a> | |
866 | - <input type='image' src='images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'> | |
867 | + <a href='<?php print $cancel_url;?>'><img src='<?php echo $config['url_path']; ?>images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a> | |
868 | + <input type='image' src='<?php echo $config['url_path']; ?>images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'> | |
869 | </td> | |
870 | </tr> | |
871 | </table> | |
e4aad445 ER |
872 | diff -Naur cacti-0.8.7e-old/lib/html.php cacti-0.8.7e/lib/html.php |
873 | --- cacti-0.8.7e-old/lib/html.php 2009-06-28 11:07:28.000000000 -0500 | |
874 | +++ cacti-0.8.7e/lib/html.php 2009-06-28 22:38:23.000000000 -0500 | |
5cde2610 GS |
875 | @@ -86,6 +86,7 @@ |
876 | @arg $extra_url_args - extra arguments to append to the url | |
877 | @arg $header - html to use as a header */ | |
878 | function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") { | |
879 | + global $config; | |
880 | $i = 0; | |
881 | if (sizeof($graph_array) > 0) { | |
882 | if ($header != "") { | |
883 | @@ -142,14 +143,15 @@ | |
884 | <table align='center' cellpadding='0'> | |
885 | <tr> | |
886 | <td align='center'> | |
e4aad445 ER |
887 | - <div style="min-height: <?php echo (1.6 * read_config_option("export_default_height")) . "px"?>;"><a href='graph.php?action=view&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=all'><img class='graphimage' id='graph_<?php print $graph["local_graph_id"] ?>' 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></div> |
888 | + <div style="min-height: <?php echo (1.6 * read_config_option("export_default_height")) . "px"?>;"><a href='<?php print $config['url_path']; ?>graph.php?action=view&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=all'><img class='graphimage' id='graph_<?php print $graph["local_graph_id"] ?>' src='<?php print $config['url_path']; ?>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></div> | |
5cde2610 GS |
889 | <?php print (read_graph_config_option("show_graph_title") == "on" ? "<p style='font-size: 10;' align='center'><strong>" . $graph["title_cache"] . "</strong></p>" : "");?> |
890 | </td> | |
891 | <td valign='top' style='align: left; padding: 3px;' class='noprint'> | |
892 | - <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> | |
893 | - <a href='graph_xport.php?local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&<?php print $extra_url_args;?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br> | |
894 | - <a href='graph.php?action=properties&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&<?php print $extra_url_args;?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br> | |
895 | - <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br> | |
896 | + <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> | |
897 | + <a href='<?php print $config['url_path']; ?>graph_xport.php?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_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br> | |
898 | + <a href='<?php print $config['url_path']; ?>graph.php?action=properties&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_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br> | |
e4aad445 | 899 | + <?php api_plugin_hook('graph_buttons', array('hook' => 'graphs_thumbnails', 'local_graph_id' => $graph['local_graph_id'], 'rra' => 0, 'view_type' => 'view')); ?> |
5cde2610 GS |
900 | + <a href='#page_top'><img src='<?php print $config['url_path']; ?>images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br> |
901 | </td> | |
902 | </tr> | |
903 | </table> | |
904 | @@ -175,6 +177,7 @@ | |
905 | @arg $extra_url_args - extra arguments to append to the url | |
906 | @arg $header - html to use as a header */ | |
907 | function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") { | |
908 | + global $config; | |
909 | $i = 0; $k = 0; $j = 0; | |
910 | ||
911 | $num_graphs = sizeof($graph_array); | |
e4aad445 | 912 | @@ -266,13 +269,14 @@ |
5cde2610 GS |
913 | <table align='center' cellpadding='0'> |
914 | <tr> | |
915 | <td align='center'> | |
916 | - <a href='graph.php?action=view&rra_id=all&local_graph_id=<?php print $graph["local_graph_id"];?>'><img class='graphimage' id='graph_<?php print $graph["local_graph_id"] ?>' 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> | |
917 | + <a href='<?php print $config['url_path']; ?>graph.php?action=view&rra_id=all&local_graph_id=<?php print $graph["local_graph_id"];?>'><img class='graphimage' id='graph_<?php print $graph["local_graph_id"] ?>' src='<?php print $config['url_path']; ?>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> | |
918 | <?php print (read_graph_config_option("show_graph_title") == "on" ? "<p style='font-size: 10;' align='center'><strong>" . $graph["title_cache"] . "</strong></p>" : "");?> | |
919 | </td> | |
920 | <td valign='top' style='align: left; padding: 3px;'> | |
921 | - <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> | |
922 | - <a href='graph_xport.php?local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&<?php print $extra_url_args;?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br> | |
923 | - <a href='graph.php?action=properties&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=0&<?php print $extra_url_args;?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br> | |
924 | + <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> | |
925 | + <a href='<?php print $config['url_path']; ?>graph_xport.php?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_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br> | |
926 | + <a href='<?php print $config['url_path']; ?>graph.php?action=properties&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_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br> | |
927 | + <?php api_plugin_hook('graph_buttons_thumbnails', array('hook' => 'graphs_thumbnails', 'local_graph_id' => $graph['local_graph_id'], 'rra' => 0, 'view_type' => '')); ?> | |
928 | <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br> | |
929 | </td> | |
930 | </tr> | |
e4aad445 | 931 | @@ -704,6 +708,8 @@ |
5cde2610 GS |
932 | } |
933 | ||
934 | while (list($item_sub_url, $item_sub_title) = each($item_title)) { | |
935 | + $item_sub_url = $config['url_path'] . $item_sub_url; | |
936 | + | |
937 | /* indent sub-items */ | |
938 | if ($i > 0) { | |
939 | $prepend_string = "--- "; | |
e4aad445 | 940 | @@ -713,7 +719,7 @@ |
5cde2610 GS |
941 | |
942 | /* do not put a line between each sub-item */ | |
943 | if (($i == 0) || ($draw_sub_items == false)) { | |
944 | - $background = "images/menu_line.gif"; | |
945 | + $background = $config['url_path'] . "images/menu_line.gif"; | |
946 | }else{ | |
947 | $background = ""; | |
948 | } | |
e4aad445 | 949 | @@ -742,17 +748,18 @@ |
5cde2610 GS |
950 | }else{ |
951 | if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) { | |
952 | /* draw normal (non sub-item) menu item */ | |
953 | + $item_url = $config['url_path'] . $item_url; | |
954 | if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) { | |
955 | - print "<tr><td class='textMenuItemSelected' background='images/menu_line.gif'><strong><a href='$item_url'>$item_title</a></strong></td></tr>\n"; | |
956 | + 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"; | |
957 | }else{ | |
958 | - print "<tr><td class='textMenuItem' background='images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n"; | |
959 | + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n"; | |
960 | } | |
961 | } | |
962 | } | |
963 | } | |
964 | } | |
965 | ||
966 | - print "<tr><td class='textMenuItem' background='images/menu_line.gif'></td></tr>\n"; | |
967 | + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'></td></tr>\n"; | |
968 | ||
969 | print "</table></td></tr>"; | |
970 | } | |
e4aad445 | 971 | @@ -762,18 +769,19 @@ |
5cde2610 GS |
972 | @arg $actions_array - an array that contains a list of possible actions. this array should |
973 | be compatible with the form_dropdown() function */ | |
974 | function draw_actions_dropdown($actions_array) { | |
975 | + global $config; | |
976 | ?> | |
977 | <table align='center' width='100%'> | |
978 | <tr> | |
979 | <td width='1' valign='top'> | |
980 | - <img src='images/arrow.gif' alt='' align='absmiddle'> | |
981 | + <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'> | |
982 | </td> | |
983 | <td align='right'> | |
984 | Choose an action: | |
985 | <?php form_dropdown("drp_action",$actions_array,"","","1","","");?> | |
986 | </td> | |
987 | <td width='1' align='right'> | |
988 | - <input type='image' src='images/button_go.gif' alt='Go'> | |
989 | + <input type='image' src='<?php echo $config['url_path']; ?>images/button_go.gif' alt='Go'> | |
990 | </td> | |
991 | </tr> | |
992 | </table> | |
e4aad445 ER |
993 | diff -Naur cacti-0.8.7e-old/lib/plugins.php cacti-0.8.7e/lib/plugins.php |
994 | --- cacti-0.8.7e-old/lib/plugins.php 1969-12-31 17:00:00.000000000 -0700 | |
995 | +++ cacti-0.8.7e/lib/plugins.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
996 | @@ -0,0 +1,380 @@ |
997 | +<?php | |
998 | + | |
999 | + | |
1000 | + | |
1001 | +function do_hook ($name) { | |
1002 | + $data = func_get_args(); | |
1003 | + $data = api_plugin_hook ($name, $data); | |
1004 | + return $data; | |
1005 | +} | |
1006 | + | |
1007 | +function do_hook_function($name,$parm=NULL) { | |
1008 | + return api_plugin_hook_function ($name, $parm); | |
1009 | +} | |
1010 | + | |
1011 | +function api_user_realm_auth ($filename = '') { | |
1012 | + return api_plugin_user_realm_auth ($filename); | |
1013 | +} | |
1014 | + | |
1015 | +/** | |
1016 | + * This function executes a hook. | |
1017 | + * @param string $name Name of hook to fire | |
1018 | + * @return mixed $data | |
1019 | + */ | |
1020 | +function api_plugin_hook ($name) { | |
1021 | + global $config, $plugin_hooks; | |
1022 | + $data = func_get_args(); | |
1023 | + $ret = ''; | |
1024 | + $p = array(); | |
1025 | + | |
1026 | + $result = db_fetch_assoc("SELECT name, file, function FROM plugin_hooks WHERE status = 1 AND hook = '$name'", false); | |
1027 | + if (count($result)) { | |
1028 | + foreach ($result as $hdata) { | |
1029 | + $p[] = $hdata['name']; | |
1030 | + if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) { | |
1031 | + include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']); | |
1032 | + } | |
1033 | + $function = $hdata['function']; | |
1034 | + if (function_exists($function)) { | |
1035 | + $function($data); | |
1036 | + } | |
1037 | + } | |
1038 | + } | |
1039 | + | |
1040 | + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) { | |
1041 | + foreach ($plugin_hooks[$name] as $pname => $function) { | |
1042 | + if (function_exists($function) && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) { | |
1043 | + $function($data); | |
1044 | + } | |
1045 | + } | |
1046 | + } | |
1047 | + | |
1048 | + /* Variable-length argument lists have a slight problem when */ | |
1049 | + /* passing values by reference. Pity. This is a workaround. */ | |
1050 | + return $data; | |
1051 | +} | |
1052 | + | |
1053 | +function api_plugin_hook_function ($name, $parm=NULL) { | |
1054 | + global $config, $plugin_hooks; | |
1055 | + $ret = $parm; | |
1056 | + $p = array(); | |
1057 | + $result = db_fetch_assoc("SELECT name, file, function FROM plugin_hooks WHERE status = 1 AND hook = '$name'", false); | |
1058 | + | |
1059 | + if (count($result)) { | |
1060 | + foreach ($result as $hdata) { | |
1061 | + $p[] = $hdata['name']; | |
1062 | + if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) { | |
1063 | + include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']); | |
1064 | + } | |
1065 | + $function = $hdata['function']; | |
1066 | + if (function_exists($function)) { | |
1067 | + $ret = $function($ret); | |
1068 | + } | |
1069 | + } | |
1070 | + } | |
1071 | + | |
1072 | + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) { | |
1073 | + foreach ($plugin_hooks[$name] as $pname => $function) { | |
1074 | + if (function_exists($function) && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) { | |
1075 | + $ret = $function($ret); | |
1076 | + } | |
1077 | + } | |
1078 | + } | |
1079 | + | |
1080 | + /* Variable-length argument lists have a slight problem when */ | |
1081 | + /* passing values by reference. Pity. This is a workaround. */ | |
1082 | + return $ret; | |
1083 | +} | |
1084 | + | |
1085 | +function api_plugin_db_table_create ($plugin, $table, $data) { | |
1086 | + global $config, $database_default; | |
1087 | + include_once($config["library_path"] . "/database.php"); | |
1088 | + | |
1089 | + $result = db_fetch_assoc("show tables from `" . $database_default . "`") or die (mysql_error()); | |
1090 | + $tables = array(); | |
1091 | + foreach($result as $index => $arr) { | |
1092 | + foreach ($arr as $t) { | |
1093 | + $tables[] = $t; | |
1094 | + } | |
1095 | + } | |
1096 | + if (!in_array($table, $tables)) { | |
1097 | + $c = 0; | |
1098 | + $sql = 'CREATE TABLE `' . $table . "` (\n"; | |
1099 | + foreach ($data['columns'] as $column) { | |
1100 | + if (isset($column['name'])) { | |
1101 | + if ($c > 0) | |
1102 | + $sql .= ",\n"; | |
1103 | + $sql .= '`' . $column['name'] . '`'; | |
1104 | + if (isset($column['type'])) | |
1105 | + $sql .= ' ' . $column['type']; | |
1106 | + if (isset($column['unsigned'])) | |
1107 | + $sql .= ' unsigned'; | |
1108 | + if (isset($column['NULL']) && $column['NULL'] == false) | |
1109 | + $sql .= ' NOT NULL'; | |
1110 | + if (isset($column['NULL']) && $column['NULL'] == true && !isset($column['default'])) | |
1111 | + $sql .= ' default NULL'; | |
1112 | + if (isset($column['default'])) | |
1113 | + $sql .= ' default ' . (is_numeric($column['default']) ? $column['default'] : "'" . $column['default'] . "'"); | |
1114 | + if (isset($column['auto_increment'])) | |
1115 | + $sql .= ' auto_increment'; | |
1116 | + $c++; | |
1117 | + } | |
1118 | + } | |
1119 | + | |
1120 | + if (isset($data['primary'])) { | |
1121 | + $sql .= ",\n PRIMARY KEY (`" . $data['primary'] . '`)'; | |
1122 | + } | |
1123 | + | |
1124 | + foreach ($data['keys'] as $key) { | |
1125 | + if (isset($key['name'])) { | |
1126 | + $sql .= ",\n KEY `" . $key['name'] . '` (`' . $key['columns'] . '`)'; | |
1127 | + } | |
1128 | + } | |
1129 | + $sql .= ') TYPE = ' . $data['type']; | |
1130 | + | |
1131 | + if (isset($data['comment'])) { | |
1132 | + $sql .= " COMMENT = '" . $data['comment'] . "'"; | |
1133 | + } | |
1134 | + if (db_execute($sql)) { | |
1135 | + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, method) VALUES ('$plugin', '$table', 'create')"); | |
1136 | + } | |
1137 | + } else { | |
1138 | + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, method) VALUES ('$plugin', '$table', 'create')"); | |
1139 | + } | |
1140 | +} | |
1141 | + | |
1142 | +function api_plugin_db_changes_remove ($plugin) { | |
1143 | + // Example: api_plugin_db_changes_remove ('thold'); | |
1144 | + | |
1145 | + $tables = db_fetch_assoc("SELECT `table` FROM plugin_db_changes WHERE plugin = '$plugin' AND method ='create'", false); | |
1146 | + if (count($tables)) { | |
1147 | + foreach ($tables as $table) { | |
1148 | + db_execute("DROP TABLE `" . $table['table'] . "`;"); | |
1149 | + } | |
1150 | + db_execute("DELETE FROM plugin_db_changes where plugin = '$plugin' AND method ='create'", false); | |
1151 | + } | |
1152 | + $columns = db_fetch_assoc("SELECT `table`, `column` FROM plugin_db_changes WHERE plugin = '$plugin' AND method ='addcolumn'", false); | |
1153 | + if (count($columns)) { | |
1154 | + foreach ($columns as $column) { | |
1155 | + db_execute('ALTER TABLE `' . $column['table'] . '` DROP `' . $column['column'] . '`'); | |
1156 | + } | |
1157 | + db_execute("DELETE FROM plugin_db_changes where plugin = '$plugin' AND method = 'addcolumn'", false); | |
1158 | + } | |
1159 | +} | |
1160 | + | |
1161 | +function api_plugin_db_add_column ($plugin, $table, $column) { | |
1162 | + // Example: api_plugin_db_add_column ('thold', 'plugin_config', array('name' => 'test' . rand(1, 200), 'type' => 'varchar (255)', 'NULL' => false)); | |
1163 | + | |
1164 | + global $config, $database_default; | |
1165 | + include_once($config['library_path'] . '/database.php'); | |
1166 | + | |
1167 | + $result = db_fetch_assoc('show columns from `' . $table . '`') or die (mysql_error()); | |
1168 | + $columns = array(); | |
1169 | + foreach($result as $index => $arr) { | |
1170 | + foreach ($arr as $t) { | |
1171 | + $columns[] = $t; | |
1172 | + } | |
1173 | + } | |
1174 | + if (isset($column['name']) && !in_array($column['name'], $columns)) { | |
1175 | + $sql = 'ALTER TABLE `' . $table . '` ADD `' . $column['name'] . '`'; | |
1176 | + if (isset($column['type'])) | |
1177 | + $sql .= ' ' . $column['type']; | |
1178 | + if (isset($column['unsigned'])) | |
1179 | + $sql .= ' unsigned'; | |
1180 | + if (isset($column['NULL']) && $column['NULL'] == false) | |
1181 | + $sql .= ' NOT NULL'; | |
1182 | + if (isset($column['NULL']) && $column['NULL'] == true && !isset($column['default'])) | |
1183 | + $sql .= ' default NULL'; | |
1184 | + if (isset($column['default'])) | |
1185 | + $sql .= ' default ' . (is_numeric($column['default']) ? $column['default'] : "'" . $column['default'] . "'"); | |
1186 | + if (isset($column['auto_increment'])) | |
1187 | + $sql .= ' auto_increment'; | |
1188 | + if (isset($column['after'])) | |
1189 | + $sql .= ' AFTER ' . $column['after']; | |
1190 | + | |
1191 | + if (db_execute($sql)) { | |
1192 | + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, `column`, `method`) VALUES ('$plugin', '$table', '" . $column['name'] . "', 'addcolumn')"); | |
1193 | + } | |
1194 | + } | |
1195 | +} | |
1196 | + | |
1197 | +function api_plugin_install ($plugin) { | |
1198 | + global $config; | |
1199 | + include_once($config['base_path'] . "/plugins/$plugin/setup.php"); | |
1200 | + | |
1201 | + $exists = db_fetch_assoc("SELECT id FROM plugin_config WHERE directory = '$plugin'", false); | |
1202 | + if (!count($exists)) { | |
1203 | + db_execute("DELETE FROM plugin_config WHERE directory = '$plugin'"); | |
1204 | + } | |
1205 | + | |
1206 | + $name = $author = $webpage = $version = ''; | |
1207 | + $function = 'plugin_' . $plugin . '_version'; | |
1208 | + if (function_exists($function)){ | |
1209 | + $info = $function(); | |
1210 | + $name = $info['longname']; | |
1211 | + $webpage = $info['homepage']; | |
1212 | + $author = $info['author']; | |
1213 | + $version = $info['version']; | |
1214 | + } | |
1215 | + | |
1216 | + db_execute("INSERT INTO plugin_config (directory, name, author, webpage, version) VALUES ('$plugin', '$name', '$author', '$webpage', '$version')"); | |
1217 | + | |
1218 | + $function = 'plugin_' . $plugin . '_install'; | |
1219 | + if (function_exists($function)){ | |
1220 | + $function(); | |
1221 | + $ready = api_plugin_check_config ($plugin); | |
1222 | + if ($ready) { | |
1223 | + // Set the plugin as "disabled" so it can go live | |
1224 | + db_execute("UPDATE plugin_config SET status = 4 WHERE directory = '$plugin'"); | |
1225 | + } else { | |
1226 | + // Set the plugin as "needs configuration" | |
1227 | + db_execute("UPDATE plugin_config SET status = 2 WHERE directory = '$plugin'"); | |
1228 | + } | |
1229 | + } | |
1230 | +} | |
1231 | + | |
1232 | +function api_plugin_uninstall ($plugin) { | |
1233 | + global $config; | |
1234 | + include_once($config['base_path'] . "/plugins/$plugin/setup.php"); | |
1235 | + // Run the Plugin's Uninstall Function first | |
1236 | + $function = 'plugin_' . $plugin . '_uninstall'; | |
1237 | + if (function_exists($function)) { | |
1238 | + $function(); | |
1239 | + } | |
1240 | + api_plugin_remove_hooks ($plugin); | |
1241 | + api_plugin_remove_realms ($plugin); | |
1242 | + db_execute("DELETE FROM plugin_config WHERE directory = '$plugin'"); | |
1243 | + api_plugin_db_changes_remove ($plugin); | |
1244 | +} | |
1245 | + | |
1246 | +function api_plugin_check_config ($plugin) { | |
1247 | + global $config; | |
1248 | + include_once($config['base_path'] . "/plugins/$plugin/setup.php"); | |
1249 | + $function = 'plugin_' . $plugin . '_check_config'; | |
1250 | + if (function_exists($function)) { | |
1251 | + return $function(); | |
1252 | + } | |
1253 | + return TRUE; | |
1254 | +} | |
1255 | + | |
1256 | +function api_plugin_enable ($plugin) { | |
1257 | + $ready = api_plugin_check_config ($plugin); | |
1258 | + if ($ready) { | |
1259 | + api_plugin_enable_hooks ($plugin); | |
1260 | + db_execute("UPDATE plugin_config SET status = 1 WHERE directory = '$plugin'"); | |
1261 | + } | |
1262 | +} | |
1263 | + | |
1264 | +function api_plugin_is_enabled ($plugin) { | |
1265 | + $status = db_fetch_cell("SELECT status FROM plugin_config WHERE directory = '$plugin'", false); | |
1266 | + if ($status == '1') | |
1267 | + return true; | |
1268 | + return false; | |
1269 | +} | |
1270 | + | |
1271 | +function api_plugin_disable ($plugin) { | |
1272 | + api_plugin_disable_hooks ($plugin); | |
1273 | + db_execute("UPDATE plugin_config SET status = 4 WHERE directory = '$plugin'"); | |
1274 | +} | |
1275 | + | |
1276 | +function api_plugin_register_hook ($plugin, $hook, $function, $file) { | |
1277 | + $exists = db_fetch_assoc("SELECT id FROM plugin_hooks WHERE name = '$plugin' AND hook = '$hook'", false); | |
1278 | + if (!count($exists)) { | |
1279 | + $settings = array('config_settings', 'config_arrays', 'config_form'); | |
1280 | + if (!in_array($hook, $settings)) { | |
1281 | + db_execute("INSERT INTO plugin_hooks (name, hook, function, file) VALUES ('$plugin', '$hook', '$function', '$file')"); | |
1282 | + } else { | |
1283 | + db_execute("INSERT INTO plugin_hooks (name, hook, function, file, status) VALUES ('$plugin', '$hook', '$function', '$file', 1)"); | |
1284 | + } | |
1285 | + } | |
1286 | +} | |
1287 | + | |
1288 | +function api_plugin_remove_hooks ($plugin) { | |
1289 | + db_execute("DELETE FROM plugin_hooks WHERE name = '$plugin'"); | |
1290 | +} | |
1291 | + | |
1292 | +function api_plugin_enable_hooks ($plugin) { | |
1293 | + db_execute("UPDATE plugin_hooks SET status = 1 WHERE name = '$plugin'"); | |
1294 | +} | |
1295 | + | |
1296 | +function api_plugin_disable_hooks ($plugin) { | |
1297 | + db_execute("UPDATE plugin_hooks SET status = 0 WHERE name = '$plugin' AND hook != 'config_settings' AND hook != 'config_arrays' AND hook != 'config_form'"); | |
1298 | +} | |
1299 | + | |
1300 | +function api_plugin_register_realm ($plugin, $file, $display, $admin = false) { | |
1301 | + $exists = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin' AND file = '$file'", false); | |
1302 | + if (!count($exists)) { | |
1303 | + db_execute("INSERT INTO plugin_realms (plugin, file, display) VALUES ('$plugin', '$file', '$display')"); | |
1304 | + if ($admin) { | |
1305 | + $realm_id = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin' AND file = '$file'", false); | |
1306 | + $realm_id = $realm_id[0]['id'] + 100; | |
1307 | + $user_id = db_fetch_assoc("SELECT id FROM user_auth WHERE username = 'admin'", false); | |
1308 | + if (count($user_id)) { | |
1309 | + $user_id = $user_id[0]['id']; | |
1310 | + $exists = db_fetch_assoc("SELECT realm_id FROM user_auth_realm WHERE user_id = $user_id and realm_id = $realm_id", false); | |
1311 | + if (!count($exists)) { | |
1312 | + db_execute("INSERT INTO user_auth_realm (user_id, realm_id) VALUES ($user_id, $realm_id)"); | |
1313 | + } | |
1314 | + } | |
1315 | + } | |
1316 | + } | |
1317 | +} | |
1318 | + | |
1319 | +function api_plugin_remove_realms ($plugin) { | |
1320 | + $realms = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin'", false); | |
1321 | + foreach ($realms as $realm) { | |
1322 | + $id = $realm['id'] + 100; | |
1323 | + db_execute("DELETE FROM user_auth_realm WHERE realm_id = '$id'"); | |
1324 | + } | |
1325 | + db_execute("DELETE FROM plugin_realms WHERE plugin = '$plugin'"); | |
1326 | +} | |
1327 | + | |
1328 | +function api_plugin_load_realms () { | |
1329 | + global $user_auth_realms, $user_auth_realm_filenames; | |
1330 | + $plugin_realms = db_fetch_assoc("SELECT * FROM plugin_realms ORDER BY plugin, display", false); | |
1331 | + if (count($plugin_realms)) { | |
1332 | + foreach ($plugin_realms as $plugin_realm) { | |
1333 | + $plugin_files = explode(',', $plugin_realm['file']); | |
1334 | + foreach($plugin_files as $plugin_file) { | |
1335 | + $user_auth_realm_filenames[$plugin_file] = $plugin_realm['id'] + 100; | |
1336 | + } | |
1337 | + $user_auth_realms[$plugin_realm['id'] + 100] = $plugin_realm['display']; | |
1338 | + } | |
1339 | + } | |
1340 | +} | |
1341 | + | |
1342 | +function api_plugin_user_realm_auth ($filename = '') { | |
1343 | + global $user_realms, $user_auth_realms, $user_auth_realm_filenames; | |
1344 | + /* list all realms that this user has access to */ | |
1345 | + if (!isset($user_realms)) { | |
1346 | + if (read_config_option('global_auth') == 'on' || read_config_option('auth_method') != 0) { | |
1347 | + $user_realms = db_fetch_assoc("select realm_id from user_auth_realm where user_id=" . $_SESSION["sess_user_id"], false); | |
1348 | + $user_realms = array_rekey($user_realms, "realm_id", "realm_id"); | |
1349 | + }else{ | |
1350 | + $user_realms = $user_auth_realms; | |
1351 | + } | |
1352 | + } | |
1353 | + if ($filename != '') { | |
1354 | + if (isset($user_realms[$user_auth_realm_filenames{basename($filename)}])) | |
1355 | + return TRUE; | |
1356 | + } | |
1357 | + return FALSE; | |
1358 | +} | |
1359 | + | |
1360 | +function plugin_config_arrays () { | |
1361 | + global $menu; | |
1362 | + $menu['Configuration']['plugins.php'] = 'Plugin Management'; | |
1363 | + api_plugin_load_realms (); | |
1364 | +} | |
1365 | + | |
1366 | +function plugin_draw_navigation_text ($nav) { | |
1367 | + $nav["plugins.php:"] = array("title" => "Plugin Management", "mapping" => "index.php:", "url" => "plugins.php", "level" => "1"); | |
1368 | + return $nav; | |
1369 | +} | |
1370 | + | |
1371 | + | |
1372 | + | |
1373 | + | |
1374 | + | |
1375 | + | |
1376 | + | |
e4aad445 ER |
1377 | diff -Naur cacti-0.8.7e-old/lib/poller.php cacti-0.8.7e/lib/poller.php |
1378 | --- cacti-0.8.7e-old/lib/poller.php 2009-06-28 11:07:28.000000000 -0500 | |
1379 | +++ cacti-0.8.7e/lib/poller.php 2009-06-28 22:51:07.000000000 -0500 | |
1380 | @@ -326,8 +326,11 @@ | |
5cde2610 GS |
1381 | } |
1382 | } | |
1383 | } | |
1384 | + api_plugin_hook_function('poller_output', $rrd_update_array); | |
1385 | ||
1386 | - $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe); | |
1387 | + if (api_plugin_hook_function('poller_on_demand', $results)) { | |
1388 | + $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe); | |
1389 | + } | |
1390 | } | |
1391 | ||
1392 | return $rrds_processed; | |
e4aad445 ER |
1393 | diff -Naur cacti-0.8.7e-old/lib/rrd.php cacti-0.8.7e/lib/rrd.php |
1394 | --- cacti-0.8.7e-old/lib/rrd.php 2009-06-28 11:07:28.000000000 -0500 | |
1395 | +++ cacti-0.8.7e/lib/rrd.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
1396 | @@ -557,6 +557,10 @@ |
1397 | } | |
1398 | } | |
1399 | ||
1400 | + $data = api_plugin_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)); | |
1401 | + if (isset($data['return']) && $data['return'] != false) | |
1402 | + return $data['return']; | |
1403 | + | |
1404 | /* find the step and how often this graph is updated with new data */ | |
1405 | $ds_step = db_fetch_cell("select | |
1406 | data_template_data.rrd_step | |
1407 | @@ -1388,6 +1392,13 @@ | |
1408 | } | |
1409 | } | |
1410 | ||
1411 | + $graph_array = api_plugin_hook_function('rrd_graph_graph_options', array('graph_opts' => $graph_opts, 'graph_defs' => $graph_defs, 'txt_graph_items' => $txt_graph_items, 'graph_id' => $local_graph_id, 'start' => $graph_start, 'end' => $graph_end)); | |
1412 | + if (!empty($graph_array)) { | |
1413 | + $graph_defs = $graph_array['graph_defs']; | |
1414 | + $txt_graph_items = $graph_array['txt_graph_items']; | |
1415 | + $graph_opts = $graph_array['graph_opts']; | |
1416 | + } | |
1417 | + | |
1418 | /* either print out the source or pass the source onto rrdtool to get us a nice PNG */ | |
1419 | if (isset($graph_data_array["print_source"])) { | |
1420 | print "<PRE>" . read_config_option("path_rrdtool") . " graph $graph_opts$graph_defs$txt_graph_items</PRE>"; | |
1421 | @@ -1396,13 +1407,19 @@ | |
1422 | rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrd_struc); | |
1423 | return 0; | |
1424 | }else{ | |
1425 | + $graph_data_array = api_plugin_hook_function('prep_graph_array', $graph_data_array); | |
1426 | + | |
1427 | if (isset($graph_data_array["output_flag"])) { | |
1428 | $output_flag = $graph_data_array["output_flag"]; | |
1429 | }else{ | |
1430 | $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA; | |
1431 | } | |
1432 | ||
1433 | - return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc); | |
1434 | + $output = rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc); | |
1435 | + | |
1436 | + api_plugin_hook_function('rrdtool_function_graph_set_file', array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id)); | |
1437 | + | |
1438 | + return $output; | |
1439 | } | |
1440 | } | |
1441 | } | |
e4aad445 ER |
1442 | diff -Naur cacti-0.8.7e-old/lib/variables.php cacti-0.8.7e/lib/variables.php |
1443 | --- cacti-0.8.7e-old/lib/variables.php 2009-06-28 11:07:26.000000000 -0500 | |
1444 | +++ cacti-0.8.7e/lib/variables.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
1445 | @@ -183,6 +183,9 @@ |
1446 | $string = str_replace($l_escape_string . "host_max_oids" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["max_oids"], $string); | |
1447 | $string = str_replace($l_escape_string . "host_id" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["id"], $string); | |
1448 | ||
1449 | + $temp = api_plugin_hook_function('substitute_host_data', array('string' => $string, 'l_escape_string' => $l_escape_string, 'r_escape_string' => $r_escape_string, 'host_id' => $host_id)); | |
1450 | + $string = $temp['string']; | |
1451 | + | |
1452 | return $string; | |
1453 | } | |
1454 | ||
e4aad445 ER |
1455 | diff -Naur cacti-0.8.7e-old/plugins/index.php cacti-0.8.7e/plugins/index.php |
1456 | --- cacti-0.8.7e-old/plugins/index.php 1969-12-31 17:00:00.000000000 -0700 | |
1457 | +++ cacti-0.8.7e/plugins/index.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
1458 | @@ -0,0 +1,5 @@ |
1459 | +<?php | |
1460 | + | |
1461 | +header("Location:../index.php"); | |
1462 | + | |
1463 | +?> | |
e4aad445 ER |
1464 | diff -Naur cacti-0.8.7e-old/plugins.php cacti-0.8.7e/plugins.php |
1465 | --- cacti-0.8.7e-old/plugins.php 1969-12-31 17:00:00.000000000 -0700 | |
1466 | +++ cacti-0.8.7e/plugins.php 2009-06-28 22:43:46.000000000 -0500 | |
1467 | @@ -0,0 +1,436 @@ | |
5cde2610 GS |
1468 | +<?php |
1469 | + | |
1470 | + | |
1471 | +include("./include/auth.php"); | |
1472 | + | |
1473 | + | |
1474 | +$pluginslist = retrieve_plugin_list (); | |
1475 | + | |
1476 | +/* tab information */ | |
1477 | +$ptabs = array( | |
1478 | + "current" => "Installed", | |
1479 | +// "uninstalled" => "Uninstalled", | |
1480 | +// "download" => "Download", | |
1481 | +// "updates" => "Updates", | |
1482 | +); | |
1483 | + | |
1484 | + | |
1485 | +$status_names = array(-2 => 'Old Plugin Architecture', -1 => 'Old Plugin Architecture - Running', 0 => 'Not Installed', 1 => 'Active', 2 => 'Awaiting Configuration', 3 => 'Awaiting Upgrade', 4 => 'Installed'); | |
1486 | + | |
1487 | + | |
1488 | +/* set the default settings category */ | |
1489 | +if (!isset($_GET["tab"])) { | |
1490 | + /* there is no selected tab; select the first one */ | |
1491 | + $current_tab = array_keys($ptabs); | |
1492 | + $current_tab = $current_tab[0]; | |
1493 | +}else{ | |
1494 | + $current_tab = $_GET["tab"]; | |
1495 | +} | |
1496 | + | |
1497 | + | |
1498 | +// Check to see if we are installing, etc... | |
1499 | +$modes = array('install', 'uninstall', 'disable', 'enable', 'check'); | |
1500 | + | |
1501 | +if (isset($_GET['mode']) && in_array($_GET['mode'], $modes) && isset($_GET['id'])) { | |
1502 | + | |
1503 | + input_validate_input_regex(get_request_var("id"), "^([a-zA-Z0-9]+)$"); | |
1504 | + | |
1505 | + $mode = $_GET['mode']; | |
1506 | + $id = sanitize_search_string($_GET['id']); | |
1507 | + | |
1508 | + switch ($mode) { | |
1509 | + case 'install': | |
1510 | + api_plugin_install($id); | |
1511 | + $pluginslist = retrieve_plugin_list (); | |
1512 | + break; | |
1513 | + case 'uninstall': | |
1514 | + if (!in_array($id, $pluginslist)) | |
1515 | + break; | |
1516 | + api_plugin_uninstall($id); | |
1517 | + $pluginslist = retrieve_plugin_list (); | |
1518 | + break; | |
1519 | + case 'disable': | |
1520 | + if (!in_array($id, $pluginslist)) | |
1521 | + break; | |
1522 | + api_plugin_disable ($id); | |
1523 | + break; | |
1524 | + case 'enable': | |
1525 | + if (!in_array($id, $pluginslist)) | |
1526 | + break; | |
1527 | + api_plugin_enable ($id); | |
1528 | + break; | |
1529 | + case 'check': | |
1530 | + if (!in_array($id, $pluginslist)) | |
1531 | + break; | |
1532 | + break; | |
1533 | + } | |
1534 | +} | |
1535 | + | |
1536 | +function retrieve_plugin_list () { | |
1537 | + $pluginslist = array(); | |
1538 | + $temp = db_fetch_assoc('SELECT directory FROM plugin_config ORDER BY name'); | |
1539 | + foreach ($temp as $t) { | |
1540 | + $pluginslist[] = $t['directory']; | |
1541 | + } | |
1542 | + return $pluginslist; | |
1543 | +} | |
1544 | + | |
1545 | + | |
1546 | + include("./include/top_header.php"); | |
1547 | + | |
1548 | + /* draw the categories tabs on the top of the page */ | |
1549 | +/* | |
1550 | + print "<table class='tabs' width='98%' cellspacing='0' cellpadding='3' align='center'><tr>\n"; | |
1551 | + | |
1552 | + if (sizeof($ptabs) > 0) { | |
1553 | + foreach (array_keys($ptabs) as $tab_short_name) { | |
1554 | + print "<td " . (($tab_short_name == $current_tab) ? "bgcolor='silver'" : "bgcolor='#DFDFDF'") . " nowrap='nowrap' width='" . (strlen($ptabs[$tab_short_name]) * 9) . "' align='center' class='tab'> | |
1555 | + <span class='textHeader'><a href='plugins.php?tab=$tab_short_name'>$ptabs[$tab_short_name]</a></span> | |
1556 | + </td>\n | |
1557 | + <td width='1'></td>\n"; | |
1558 | + } | |
1559 | + } | |
1560 | + | |
1561 | + print "<td></td>\n</tr></table>\n"; | |
1562 | +*/ | |
1563 | + html_start_box("<strong> Plugin Management</strong>", "98%", $colors["header"], "3", "center", ""); | |
1564 | + | |
1565 | + print "<tr><td><table width='100%'>"; | |
1566 | + | |
1567 | + //update_info_table(); | |
1568 | + | |
1569 | + switch ($current_tab) { | |
1570 | + case 'current': | |
1571 | + update_show_current(); | |
1572 | + break; | |
1573 | + case 'uninstalled': | |
1574 | + update_show_uninstalled (); | |
1575 | + break; | |
1576 | + default: | |
1577 | + print '<br><br><br>'; | |
1578 | + } | |
1579 | + | |
1580 | +/* | |
1581 | + $last_check = read_config_option("plugin_update_last_check"); | |
1582 | + if ($last_check < 1) | |
1583 | + $last_check = 0; | |
1584 | + | |
1585 | + print "<center>Last Scanned : " . ($last_check > 0 ? date("F j, Y g:i:s a", $last_check) : "Never") . "</center>"; | |
1586 | +*/ | |
1587 | + print "</table></td></tr>"; | |
1588 | + | |
1589 | + html_end_box(); | |
1590 | + | |
1591 | + include("./include/bottom_footer.php"); | |
1592 | + | |
1593 | +function update_show_updates () { | |
1594 | + global $pluginslist, $colors, $config, $plugin_architecture; | |
1595 | + | |
1596 | + $cinfo = array(); | |
1597 | + sort($pluginslist); | |
1598 | + | |
1599 | + $cinfo = update_get_plugin_info (); | |
1600 | + | |
1601 | + $x = 0; | |
1602 | + | |
1603 | + $info = update_get_cached_plugin_info(); | |
1604 | + | |
1605 | + $cactinew = update_check_if_newer($cinfo['cacti']['version'], $info['cacti']['version']) ; | |
1606 | + if (isset($cinfo['cacti_plugin_arch']['version'])) | |
1607 | + $archnew = update_check_if_newer($cinfo['cacti_plugin_arch']['version'], $info['cacti_plugin_arch']['version']); | |
1608 | + else | |
1609 | + $archnew = 0; | |
1610 | + | |
1611 | + if ($cactinew) { | |
1612 | + $x++; | |
1613 | + print "<tr><td width='25%' valign=top><table width='100%'>"; | |
1614 | + html_header(array("Cacti"), 2); | |
1615 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1616 | + print "<td width='25%'><strong>Version:</strong></td><td>" . $config["cacti_version"] . "</td></tr>"; | |
1617 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1618 | + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info['cacti']['changes']) . "</td></tr></table>"; | |
1619 | + } | |
1620 | + if (isset($plugin_architecture['version']) && $archnew) { | |
1621 | + $x++; | |
1622 | + print "<table width='100%'>"; | |
1623 | + html_header(array("Plugin Architecture"), 2); | |
1624 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1625 | + print "<td width='25%'><strong>Version:</strong></td><td>" . $plugin_architecture['version'] . "</td>"; | |
1626 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1627 | + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info['cacti_plugin_arch']['changes']) . "</td></tr></table>"; | |
1628 | + } | |
1629 | + print "<table width='100%' cellspacing=0 cellpadding=3>"; | |
1630 | + | |
1631 | + foreach ($pluginslist as $plugin) { | |
1632 | + if (isset($cinfo[$plugin]) && update_check_if_newer($cinfo[$plugin]['version'], $info[$plugin]['version'])) { | |
1633 | + $x++; | |
1634 | + print "<table width='100%'>"; | |
1635 | + html_header(array((isset($cinfo[$plugin]['longname']) ? $cinfo[$plugin]['longname'] : $plugin)), 2); | |
1636 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1637 | + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>"; | |
1638 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1639 | + print "<td><strong>Version:</strong></td><td>" . $info[$plugin]['version'] . "</td>"; | |
1640 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1641 | + print "<td><strong>Author:</strong></td><td>" . (isset($cinfo[$plugin]['author']) && $cinfo[$plugin]['author'] != '' ? (isset($cinfo[$plugin]['email']) && $cinfo[$plugin]['email'] != '' ? "<a href='mailto:" . $cinfo[$plugin]['email'] . "'>" . $cinfo[$plugin]['author'] . "</a>" : $cinfo[$plugin]['author']) : "") . "</td>"; | |
1642 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1643 | + print "<td><strong>Home Page:</strong></td><td>" . (isset($cinfo[$plugin]['webpage']) && $cinfo[$plugin]['webpage'] != '' ? "<a href='" . $cinfo[$plugin]['webpage'] . "'>" . $cinfo[$plugin]['webpage'] . "</a>" : "") . "</td>"; | |
1644 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1645 | + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info[$plugin]['changes']) . "</td>"; | |
1646 | + | |
1647 | + print "</tr></table>"; | |
1648 | + } | |
1649 | + } | |
1650 | + if ($x == 0) | |
1651 | + print "<br><center><b>There are currently no Updates!</b></center><br>"; | |
1652 | + print "</table>"; | |
1653 | + html_end_box(TRUE); | |
1654 | +} | |
1655 | + | |
1656 | +function update_check_if_newer() { | |
1657 | + return false; | |
1658 | +} | |
1659 | + | |
1660 | +function update_show_current () { | |
1661 | + global $plugins, $pluginslist, $colors, $plugin_architecture, $config, $status_names; | |
1662 | + | |
1663 | + | |
1664 | + | |
1665 | + $cinfo = array(); | |
1666 | + $cinfo = update_get_plugin_info (); | |
1667 | + | |
1668 | + sort($pluginslist); | |
1669 | + | |
1670 | + $path = $config['base_path'] . '/plugins/'; | |
1671 | + $dh = opendir($path); | |
1672 | + while (($file = readdir($dh)) !== false) { | |
1673 | + if (is_dir("$path/$file")) { | |
1674 | + if (file_exists("$path/$file/setup.php") && !in_array($file, $pluginslist)) { | |
1675 | + include_once("$path/$file/setup.php"); | |
1676 | + if (!function_exists('plugin_' . $file . '_install') && function_exists($file . '_version')) { | |
1677 | + $function = $file . '_version'; | |
1678 | + $cinfo[$file] = $function(); | |
1679 | + $cinfo[$file]['status'] = -2; | |
1680 | + if (in_array($file, $plugins)) { | |
1681 | + $cinfo[$file]['status'] = -1; | |
1682 | + } | |
1683 | + $pluginslist[] = $file; | |
1684 | + } else if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) { | |
1685 | + $function = $file . '_version'; | |
1686 | + $cinfo[$file] = $function(); | |
1687 | + $cinfo[$file]['status'] = 0; | |
1688 | + $pluginslist[] = $file; | |
1689 | + } | |
1690 | + } | |
1691 | + } | |
1692 | + } | |
1693 | + closedir($dh); | |
1694 | + | |
1695 | + print "<table width='100%' cellspacing=0 cellpadding=3>"; | |
1696 | + print "<tr><td width='50%'><table width='100%'>"; | |
1697 | + html_header(array("Cacti"), 2); | |
1698 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1699 | + print "<td width='50%'><strong>Version:</strong></td><td>" . $config["cacti_version"] . "</td></tr></table>"; | |
1700 | + print "</td><td>"; | |
1701 | + if (isset($plugin_architecture['version'])) { | |
1702 | + print "<table width='100%'>"; | |
1703 | + html_header(array("Plugin Architecture"), 2); | |
1704 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1705 | + print "<td width='50%'><strong>Version:</strong></td><td>" . $plugin_architecture['version'] . "</td></tr></table>"; | |
1706 | + } | |
1707 | + print "</td></tr></table>"; | |
1708 | + | |
1709 | + print "<table width='100%' cellspacing=0 cellpadding=3>"; | |
1710 | + $x = 0; | |
1711 | + | |
e4aad445 | 1712 | + sort($pluginslist); |
5cde2610 GS |
1713 | + foreach ($pluginslist as $plugin) { |
1714 | + if (isset($cinfo[$plugin])) { | |
1715 | + | |
1716 | + if ($x == 0) { | |
1717 | + print "<tr><td width='50%' valign=top>"; | |
1718 | + } else { | |
1719 | + print "</td><td valign=top>"; | |
1720 | + } | |
1721 | + if (!isset($info[$plugin]['version'])) | |
1722 | + $info[$plugin]['version'] = ''; | |
1723 | + | |
1724 | + print "<table width='100%'>"; | |
1725 | + html_header(array((isset($cinfo[$plugin]['name']) ? $cinfo[$plugin]['name'] : $plugin)), 2); | |
1726 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1727 | + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>"; | |
1728 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1729 | + print "<td><strong>Version:</strong></td><td>" . (isset($cinfo[$plugin]['version']) ? $cinfo[$plugin]['version'] : "") . (update_check_if_newer($cinfo[$plugin]['version'], $info[$plugin]['version']) ? ' - <font color=red><b>(Update Available!)</strong></font>' : '') . "</td>"; | |
1730 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1731 | + print "<td><strong>Author:</strong></td><td>" . (isset($cinfo[$plugin]['author']) && $cinfo[$plugin]['author'] != '' ? (isset($cinfo[$plugin]['email']) && $cinfo[$plugin]['email'] != '' ? "<a href='mailto:" . $cinfo[$plugin]['email'] . "'>" . $cinfo[$plugin]['author'] . "</a>" : $cinfo[$plugin]['author']) : "") . "</td>"; | |
1732 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1733 | + print "<td><strong>Home Page:</strong></td><td>" . (isset($cinfo[$plugin]['webpage']) && $cinfo[$plugin]['webpage'] != '' ? "<a href='" . $cinfo[$plugin]['webpage'] . "'>" . $cinfo[$plugin]['webpage'] . "</a>" : "") . "</td>"; | |
1734 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1735 | + print "<td><strong>Status:</strong></td><td>" . $status_names[$cinfo[$plugin]['status']] . "</td>"; | |
1736 | + | |
1737 | + if ($cinfo[$plugin]['status'] > -1) { | |
1738 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1739 | + | |
1740 | + $links = array('install' => 'Install', 'uninstall' => 'Uninstall', 'enable' => 'Enable', 'disable' => 'Disable', 'check' => 'Check'); | |
1741 | + | |
1742 | + switch ($cinfo[$plugin]['status']) { | |
1743 | + case 0: //Not Installed | |
1744 | + $links['install'] = "<a href='plugins.php?mode=install&id=$plugin'><b>Install</b></a>"; | |
1745 | + break; | |
1746 | + case 1: // Currently Active | |
1747 | + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin'><b>Uninstall</b></a>"; | |
1748 | + $links['disable'] = "<a href='plugins.php?mode=disable&id=$plugin'><b>Disable</b></a>"; | |
1749 | + break; | |
1750 | + case 2: // Needs Configuring | |
1751 | + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin'><b>Check</b></a>"; | |
1752 | + break; | |
1753 | + case 3: // Needs Upgrade | |
1754 | + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin'><b>Check</b></a>"; | |
1755 | + break; | |
1756 | + case 4: // Installed but not active | |
1757 | + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin'><b>Uninstall</b></a>"; | |
1758 | + $links['enable'] = "<a href='plugins.php?mode=enable&id=$plugin'><b>Enable</b></a>"; | |
1759 | + break; | |
1760 | + } | |
1761 | + | |
1762 | + print "<td></td><td>"; | |
1763 | + $c = 1; | |
1764 | + foreach ($links as $temp => $link) { | |
1765 | + print $link; | |
1766 | + if ($c < count($links)) | |
1767 | + print ' | '; | |
1768 | + $c++; | |
1769 | + } | |
1770 | + print "</td>"; | |
1771 | + print "</tr>"; | |
1772 | + } | |
1773 | + | |
1774 | + print "</table>"; | |
1775 | + if ($x == 1) { | |
1776 | + print "</td></tr>"; | |
1777 | + } | |
1778 | + $x++; | |
1779 | + if ($x > 1) $x = 0; | |
1780 | + } | |
1781 | + } | |
1782 | + if ($x == 1) | |
1783 | + print "</td><td></td></tr>"; | |
1784 | + print "</table>"; | |
1785 | + html_end_box(TRUE); | |
1786 | +} | |
1787 | + | |
1788 | + | |
1789 | +function update_show_uninstalled () { | |
1790 | + global $pluginslist, $colors, $plugin_architecture, $config, $status_names; | |
1791 | + | |
1792 | + $cinfo = array(); | |
1793 | + sort($pluginslist); | |
1794 | + | |
1795 | + print "<table width='100%' cellspacing=0 cellpadding=3>"; | |
1796 | + $x = 0; | |
1797 | + | |
1798 | + $newplugins = array(); | |
1799 | + $cinfo = array (); | |
1800 | + | |
1801 | + $path = $config['base_path'] . '/plugins/'; | |
1802 | + $dh = opendir($path); | |
1803 | + while (($file = readdir($dh)) !== false) { | |
1804 | + if (is_dir("$path/$file")) { | |
1805 | + if (file_exists("$path/$file/setup.php") && !in_array($file, $pluginslist)) { | |
1806 | + include_once("$path/$file/setup.php"); | |
1807 | + if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) { | |
1808 | + $function = 'plugin_' . $file . '_version'; | |
1809 | + $cinfo[$file] = $function(); | |
1810 | + $cinfo[$file]['status'] = 0; | |
1811 | + $newplugins[] = $file; | |
1812 | + } | |
1813 | + } | |
1814 | + } | |
1815 | + } | |
1816 | + closedir($dh); | |
1817 | + | |
1818 | + if (count($newplugins)) { | |
1819 | + foreach ($newplugins as $plugin) { | |
1820 | + if (isset($cinfo[$plugin])) { | |
1821 | + | |
1822 | + if ($x == 0) { | |
1823 | + print "<tr><td width='50%'>"; | |
1824 | + } else { | |
1825 | + print "</td><td>"; | |
1826 | + } | |
1827 | + if (!isset($info[$plugin]['version'])) | |
1828 | + $info[$plugin]['version'] = ''; | |
1829 | + | |
1830 | + print "<table width='100%'>"; | |
1831 | + html_header(array((isset($cinfo[$plugin]['name']) ? $cinfo[$plugin]['name'] : $plugin)), 2); | |
1832 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1833 | + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>"; | |
1834 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1835 | + print "<td><strong>Version:</strong></td><td>" . (isset($cinfo[$plugin]['version']) ? $cinfo[$plugin]['version'] : "") . (update_check_if_newer($cinfo[$plugin]['version'], $info[$plugin]['version']) ? ' - <font color=red><b>(Update Available!)</strong></font>' : '') . "</td>"; | |
1836 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1837 | + print "<td><strong>Author:</strong></td><td>" . (isset($cinfo[$plugin]['author']) && $cinfo[$plugin]['author'] != '' ? (isset($cinfo[$plugin]['email']) && $cinfo[$plugin]['email'] != '' ? "<a href='mailto:" . $cinfo[$plugin]['email'] . "'>" . $cinfo[$plugin]['author'] . "</a>" : $cinfo[$plugin]['author']) : "") . "</td>"; | |
1838 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1839 | + print "<td><strong>Home Page:</strong></td><td>" . (isset($cinfo[$plugin]['homepage']) && $cinfo[$plugin]['homepage'] != '' ? "<a href='" . $cinfo[$plugin]['homepage'] . "'>" . $cinfo[$plugin]['homepage'] . "</a>" : "") . "</td>"; | |
1840 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1841 | + print "<td><strong>Status:</strong></td><td>" . $status_names[$cinfo[$plugin]['status']] . "</td>"; | |
1842 | + form_alternate_row_color($colors["alternate"],$colors["light"], 0); | |
1843 | + | |
1844 | + $links = array('install' => 'Install', 'uninstall' => 'Uninstall', 'enable' => 'Enable', 'disable' => 'Disable', 'check' => 'Check'); | |
1845 | + | |
1846 | + switch ($cinfo[$plugin]['status']) { | |
1847 | + case 0: //Not Installed | |
1848 | + $links['install'] = "<a href='plugins.php?mode=install&id=$plugin&tab=uninstalled'><b>Install</b></a>"; | |
1849 | + break; | |
1850 | + case 1: // Currently Active | |
1851 | + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin&tab=uninstalled'><b>Uninstall</b></a>"; | |
1852 | + $links['disable'] = "<a href='plugins.php?mode=disable&id=$plugin&tab=uninstalled'><b>Disable</b></a>"; | |
1853 | + break; | |
1854 | + case 2: // Needs Configuring | |
1855 | + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin&tab=uninstalled'><b>Check</b></a>"; | |
1856 | + break; | |
1857 | + case 3: // Needs Upgrade | |
1858 | + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin&tab=uninstalled'><b>Check</b></a>"; | |
1859 | + break; | |
1860 | + case 4: // Installed but not active | |
1861 | + $links['enable'] = "<a href='plugins.php?mode=enable&id=$plugin&tab=uninstalled'><b>Enable</b></a>"; | |
1862 | + break; | |
1863 | + } | |
1864 | + | |
1865 | + print "<td></td><td>"; | |
1866 | + $c = 1; | |
1867 | + foreach ($links as $temp => $link) { | |
1868 | + print $link; | |
1869 | + if ($c < count($links)) | |
1870 | + print ' | '; | |
1871 | + $c++; | |
1872 | + } | |
1873 | + | |
1874 | + print "</td>"; | |
1875 | + print "</tr></table>"; | |
1876 | + if ($x == 1) { | |
1877 | + print "</td></tr>"; | |
1878 | + } | |
1879 | + $x++; | |
1880 | + if ($x > 1) $x = 0; | |
1881 | + } | |
1882 | + } | |
1883 | + } else { | |
1884 | + print "<center>There are no Uninstalled Plugins</center>"; | |
1885 | + } | |
1886 | + if ($x == 1) | |
1887 | + print "</td><td></td></tr>"; | |
1888 | + print "</table>"; | |
1889 | + html_end_box(TRUE); | |
1890 | +} | |
1891 | + | |
1892 | +function update_get_plugin_info () { | |
1893 | + $cinfo = array(); | |
1894 | + $info = db_fetch_assoc("SELECT * from plugin_config"); | |
1895 | + if (is_array($info)) { | |
1896 | + foreach($info as $inf) { | |
1897 | + $cinfo[$inf['directory']] = $inf; | |
1898 | + $cinfo[$inf['directory']]['changes']=''; | |
1899 | + } | |
1900 | + } | |
1901 | + return $cinfo; | |
1902 | +} | |
1903 | + | |
e4aad445 ER |
1904 | diff -Naur cacti-0.8.7e-old/poller.php cacti-0.8.7e/poller.php |
1905 | --- cacti-0.8.7e-old/poller.php 2009-06-28 11:07:28.000000000 -0500 | |
1906 | +++ cacti-0.8.7e/poller.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
1907 | @@ -73,6 +73,8 @@ |
1908 | } | |
1909 | } | |
1910 | ||
1911 | +api_plugin_hook('poller_top'); | |
1912 | + | |
1913 | /* record the start time */ | |
1914 | list($micro,$seconds) = split(" ", microtime()); | |
1915 | $poller_start = $seconds + $micro; | |
1916 | @@ -261,6 +263,8 @@ | |
1917 | $total_procs = $concurrent_processes; | |
1918 | } | |
1919 | ||
1920 | + $extra_args = api_plugin_hook_function ('poller_command_args', $extra_args); | |
1921 | + | |
1922 | /* Populate each execution file with appropriate information */ | |
1923 | foreach ($polling_hosts as $item) { | |
1924 | if ($host_count == 1) { | |
1925 | @@ -403,9 +407,11 @@ | |
1926 | ||
1927 | /* sleep the appripriate amount of time */ | |
1928 | if ($poller_runs_completed < $poller_runs) { | |
1929 | + api_plugin_hook('poller_bottom'); | |
1930 | db_close(); | |
1931 | usleep($sleep_time * 1000000); | |
1932 | db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port); | |
1933 | + api_plugin_hook('poller_top'); | |
1934 | } | |
1935 | }else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM) { | |
1936 | cacti_log("WARNING: Cacti Polling Cycle Exceeded Poller Interval by " . $loop_end-$loop_start-$poller_interval . " seconds", TRUE, "POLLER"); | |
1937 | @@ -452,4 +458,6 @@ | |
1938 | echo " --debug|-d Output debug information. Similar to cacti's DEBUG logging level.\n\n"; | |
1939 | } | |
1940 | ||
1941 | +api_plugin_hook('poller_bottom'); | |
1942 | + | |
1943 | ?> | |
e4aad445 ER |
1944 | diff -Naur cacti-0.8.7e-old/user_admin.php cacti-0.8.7e/user_admin.php |
1945 | --- cacti-0.8.7e-old/user_admin.php 2009-06-28 11:07:28.000000000 -0500 | |
1946 | +++ cacti-0.8.7e/user_admin.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
1947 | @@ -72,9 +72,11 @@ |
1948 | break; | |
1949 | ||
1950 | default: | |
1951 | - include_once("include/top_header.php"); | |
1952 | - user(); | |
1953 | - include_once("include/bottom_footer.php"); | |
1954 | + if (!api_plugin_hook_function('user_admin_action', get_request_var_request("action"))) { | |
1955 | + include_once("include/top_header.php"); | |
1956 | + user(); | |
1957 | + include_once("include/bottom_footer.php"); | |
1958 | + } | |
1959 | break; | |
1960 | } | |
1961 | ||
1962 | @@ -418,6 +420,7 @@ | |
1963 | $save["policy_graph_templates"] = form_input_validate(get_request_var_post("policy_graph_templates", get_request_var_post("_policy_graph_templates")), "policy_graph_templates", "", true, 3); | |
1964 | $save["realm"] = get_request_var_post("realm", 0); | |
1965 | $save["enabled"] = form_input_validate(get_request_var_post("enabled", ""), "enabled", "", true, 3); | |
1966 | + $save = api_plugin_hook_function('user_admin_setup_sql_save', $save); | |
1967 | ||
1968 | if (!is_error_message()) { | |
1969 | $user_id = sql_save($save, "user_auth"); | |
1970 | @@ -460,6 +463,8 @@ | |
1971 | policy_hosts = " . get_request_var_post("policy_hosts") . ", | |
1972 | policy_graph_templates = " . get_request_var_post("policy_graph_templates") . " | |
1973 | WHERE id = " . get_request_var_post("id")); | |
1974 | + } else { | |
1975 | + api_plugin_hook('user_admin_user_save'); | |
1976 | } | |
1977 | } | |
1978 | } | |
1979 | @@ -910,6 +915,8 @@ | |
1980 | $header_label = "[new]"; | |
1981 | } | |
1982 | ||
1983 | + api_plugin_hook_function('user_admin_edit', (isset($user) ? get_request_var("id") : 0)); | |
1984 | + | |
1985 | html_start_box("<strong>User Management</strong> $header_label", "100%", $colors["header"], "3", "center", ""); | |
1986 | ||
1987 | draw_edit_form(array( | |
1988 | @@ -936,6 +943,7 @@ | |
1989 | <td <?php print ((get_request_var("action") == "graph_settings_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='130' align='center' class='tab'> | |
1990 | <span class='textHeader'><a href='user_admin.php?action=graph_settings_edit&id=<?php print $_GET["id"];?>'>Graph Settings</a></span> | |
1991 | </td> | |
1992 | + <?php api_plugin_hook('user_admin_tab');?> | |
1993 | <td></td> | |
1994 | </tr> | |
1995 | </table> | |
1996 | @@ -949,7 +957,9 @@ | |
1997 | }elseif (get_request_var("action") == "graph_perms_edit") { | |
1998 | graph_perms_edit(); | |
1999 | }else{ | |
2000 | - user_realms_edit(); | |
2001 | + if (api_plugin_hook_function('user_admin_run_action', get_request_var_request("action"))) { | |
2002 | + user_realms_edit(); | |
2003 | + } | |
2004 | } | |
2005 | ||
2006 | form_save_button("user_admin.php"); | |
e4aad445 ER |
2007 | diff -Naur cacti-0.8.7e-old/utilities.php cacti-0.8.7e/utilities.php |
2008 | --- cacti-0.8.7e-old/utilities.php 2009-06-28 11:07:26.000000000 -0500 | |
2009 | +++ cacti-0.8.7e/utilities.php 2009-06-28 22:51:07.000000000 -0500 | |
5cde2610 GS |
2010 | @@ -129,11 +129,14 @@ |
2011 | include_once("./include/bottom_footer.php"); | |
2012 | break; | |
2013 | default: | |
2014 | - include_once("./include/top_header.php"); | |
2015 | ||
2016 | - utilities(); | |
2017 | + if (!api_plugin_hook_function('utilities_action', $_REQUEST['action'])) { | |
2018 | + include_once('./include/top_header.php'); | |
2019 | ||
2020 | - include_once("./include/bottom_footer.php"); | |
2021 | + utilities(); | |
2022 | + | |
2023 | + include_once('./include/bottom_footer.php'); | |
2024 | + } | |
2025 | break; | |
2026 | } | |
2027 | ||
2028 | @@ -1642,6 +1645,8 @@ | |
2029 | ||
2030 | <?php | |
2031 | ||
2032 | + api_plugin_hook('utilities_list'); | |
2033 | + | |
2034 | html_end_box(); | |
2035 | } | |
2036 |