1 diff -urN cacti-0.8.7d.orig/auth_changepassword.php cacti-0.8.7d/auth_changepassword.php
2 --- cacti-0.8.7d.orig/auth_changepassword.php 2009-02-12 03:55:50.000000000 +0100
3 +++ cacti-0.8.7d/auth_changepassword.php 2009-02-17 08:57:36.000000000 +0100
5 header("Location: index.php"); break;
6 case '3': /* default graph page */
7 header("Location: graph_view.php"); break;
9 + api_plugin_hook_function('login_options_navigate', $user['login_opts']);
12 header("Location: graph_view.php");
13 diff -urN cacti-0.8.7d.orig/auth_login.php cacti-0.8.7d/auth_login.php
14 --- cacti-0.8.7d.orig/auth_login.php 2009-02-12 03:55:50.000000000 +0100
15 +++ cacti-0.8.7d/auth_login.php 2009-02-17 08:57:36.000000000 +0100
17 header("Location: index.php"); break;
18 case '3': /* default graph page */
19 header("Location: graph_view.php"); break;
21 + api_plugin_hook_function('login_options_navigate', $user['login_opts']);
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">
31 +api_plugin_hook("login_before");
33 +$cacti_logo = $config['url_path'] . 'images/auth_login.gif';
34 +$cacti_logo = api_plugin_hook_function('cacti_image', $cacti_logo);
37 <table align="center">
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>
45 <td><input type="submit" value="Login"></td>
48 +<?php api_plugin_hook('login_after'); ?>
52 diff -urN cacti-0.8.7d.orig/data_sources.php cacti-0.8.7d/data_sources.php
53 --- cacti-0.8.7d.orig/data_sources.php 2009-02-12 03:55:50.000000000 +0100
54 +++ cacti-0.8.7d/data_sources.php 2009-02-17 08:57:36.000000000 +0100
59 +$ds_actions = api_plugin_hook_function('data_source_action_array', $ds_actions);
61 /* set default action */
62 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
65 api_reapply_suggested_data_source_title($selected_items[$i]);
66 update_data_source_title_cache($selected_items[$i]);
69 + api_plugin_hook_function('data_source_action_execute', $_POST['drp_action']);
72 header("Location: data_sources.php");
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);
88 if (!isset($ds_array)) {
90 input_validate_input_number(get_request_var("id"));
91 /* ==================================================== */
93 + api_plugin_hook('data_source_edit_top');
95 $use_data_template = true;
100 form_save_button("data_sources.php");
102 - include_once("./include/bottom_footer.php");
103 + api_plugin_hook('data_source_edit_bottom');
105 + include_once("./include/bottom_footer.php");
108 function get_poller_interval($seconds) {
109 @@ -1300,6 +1313,7 @@
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 @@
122 diff -urN cacti-0.8.7d.orig/graph_image.php cacti-0.8.7d/graph_image.php
123 --- cacti-0.8.7d.orig/graph_image.php 2009-02-12 03:55:50.000000000 +0100
124 +++ cacti-0.8.7d/graph_image.php 2009-02-17 08:57:36.000000000 +0100
126 /* flush the headers now */
129 +api_plugin_hook_function('graph_image');
131 session_write_close();
133 $graph_data_array = array();
134 diff -urN cacti-0.8.7d.orig/graph.php cacti-0.8.7d/graph.php
135 --- cacti-0.8.7d.orig/graph.php 2009-02-12 03:55:50.000000000 +0100
136 +++ cacti-0.8.7d/graph.php 2009-02-17 08:57:36.000000000 +0100
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'])); ?>
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>
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'])); ?>
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'])); ?>
161 diff -urN cacti-0.8.7d.orig/graphs_new.php cacti-0.8.7d/graphs_new.php
162 --- cacti-0.8.7d.orig/graphs_new.php 2009-02-12 03:55:50.000000000 +0100
163 +++ cacti-0.8.7d/graphs_new.php 2009-02-17 08:57:36.000000000 +0100
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'); ?>
174 diff -urN cacti-0.8.7d.orig/graphs.php cacti-0.8.7d/graphs.php
175 --- cacti-0.8.7d.orig/graphs.php 2009-02-12 03:55:50.000000000 +0100
176 +++ cacti-0.8.7d/graphs.php 2009-02-17 08:57:36.000000000 +0100
178 4 => "Convert to Graph Template"
181 +$graph_actions = api_plugin_hook_function('graphs_action_array', $graph_actions);
183 /* set default action */
184 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
187 input_validate_input_number($selected_items[$i]);
188 /* ==================================================== */
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']);
194 + api_plugin_hook_function('graphs_action_execute', $_POST['drp_action']);
197 header("Location: graphs.php");
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);
209 if (!isset($graph_array)) {
210 diff -urN cacti-0.8.7d.orig/host.php cacti-0.8.7d/host.php
211 --- cacti-0.8.7d.orig/host.php 2009-02-12 03:55:50.000000000 +0100
212 +++ cacti-0.8.7d/host.php 2009-02-17 08:57:36.000000000 +0100
214 6 => "Change Availability Options"
217 +$device_actions = api_plugin_hook_function('device_action_array', $device_actions);
219 /* set default action */
220 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
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);
227 + api_plugin_hook_function('device_action_execute', $_POST['drp_action']);
230 header("Location: host.php");
233 <input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n
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);
242 if (!isset($host_array)) {
245 display_output_messages();
247 + api_plugin_hook('host_edit_top');
249 if (!empty($_GET["id"])) {
250 $host = db_fetch_row("select * from host where id=" . $_GET["id"]);
251 $header_label = "[edit: " . $host["description"] . "]";
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'); ?>
262 @@ -1104,6 +1116,8 @@
265 form_save_button("host.php");
267 + api_plugin_hook('host_edit_bottom');
271 diff -urN cacti-0.8.7d.orig/include/auth.php cacti-0.8.7d/include/auth.php
272 --- cacti-0.8.7d.orig/include/auth.php 2009-02-12 03:55:50.000000000 +0100
273 +++ cacti-0.8.7d/include/auth.php 2009-02-17 08:57:36.000000000 +0100
277 if (read_config_option("auth_method") != 0) {
278 + /* handle alternate authentication realms */
279 + api_plugin_hook_function('auth_alternate_realms');
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"));
288 - <link href="include/main.css" rel="stylesheet">
289 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
295 <table width="450" align='center'>
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>
300 <tr height='10'><td></td></tr>
303 need access to this particular section, please contact the Cacti administrator.</td>
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>
311 diff -urN cacti-0.8.7d.orig/include/bottom_footer.php cacti-0.8.7d/include/bottom_footer.php
312 --- cacti-0.8.7d.orig/include/bottom_footer.php 2009-02-12 03:55:50.000000000 +0100
313 +++ cacti-0.8.7d/include/bottom_footer.php 2009-02-17 08:57:36.000000000 +0100
315 | http://www.cacti.net/ |
316 +-------------------------------------------------------------------------+
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)) {
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 */
335 diff -urN cacti-0.8.7d.orig/include/global_arrays.php cacti-0.8.7d/include/global_arrays.php
336 --- cacti-0.8.7d.orig/include/global_arrays.php 2009-02-12 03:55:50.000000000 +0100
337 +++ cacti-0.8.7d/include/global_arrays.php 2009-02-17 08:57:36.000000000 +0100
339 +-------------------------------------------------------------------------+
346 "message" => 'Save Successful.',
351 +$plugin_architecture = array(
355 +api_plugin_hook('config_arrays');
358 diff -urN cacti-0.8.7d.orig/include/global_constants.php cacti-0.8.7d/include/global_constants.php
359 --- cacti-0.8.7d.orig/include/global_constants.php 2009-02-12 03:55:50.000000000 +0100
360 +++ cacti-0.8.7d/include/global_constants.php 2009-02-17 09:55:38.000000000 +0100
362 define("SNMP_CMDPHP", 1);
363 define("SNMP_WEBUI", 2);
365 +define('OPER_MODE_NATIVE', 0);
366 +define('OPER_MODE_RESKIN', 1);
367 +define('OPER_MODE_IFRAME_NONAV', 2);
370 diff -urN cacti-0.8.7d.orig/include/global_form.php cacti-0.8.7d/include/global_form.php
371 --- cacti-0.8.7d.orig/include/global_form.php 2009-02-12 03:55:50.000000000 +0100
372 +++ cacti-0.8.7d/include/global_form.php 2009-02-17 08:57:36.000000000 +0100
374 +-------------------------------------------------------------------------+
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);
384 /* file: cdef.php, action: edit */
385 @@ -1184,4 +1185,7 @@
386 "dropdown_sql" => "select id,name from snmp_query order by name"
392 +api_plugin_hook('config_form');
394 diff -urN cacti-0.8.7d.orig/include/global.php cacti-0.8.7d/include/global.php
395 --- cacti-0.8.7d.orig/include/global.php 2009-02-12 03:55:50.000000000 +0100
396 +++ cacti-0.8.7d/include/global.php 2009-02-17 08:57:36.000000000 +0100
398 /* Default session name - Session name must contain alpha characters */
399 $cacti_session_name = "Cacti";
402 +//$plugins[] = 'thold';
404 +/* Do not edit this line */
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/
413 +$config['url_path'] = '/';
415 +define('URL_PATH', $config['url_path']);
417 /* Include configuration */
418 include(dirname(__FILE__) . "/config.php");
421 "structure_rra_paths.php"
427 /* this should be auto-detected, set it manually if needed */
428 @@ -179,18 +194,23 @@
429 /* display ALL errors */
430 error_reporting(E_ALL);
432 +/* current cacti version */
433 +$config["cacti_version"] = "0.8.7c";
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");
443 /* connect to the database server */
444 db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);
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");
457 include_once($config["library_path"] . "/variables.php");
458 include_once($config["library_path"] . "/auth.php");
460 +api_plugin_hook("config_insert");
462 /* current cacti version */
463 $config["cacti_version"] = "0.8.7d";
465 diff -urN cacti-0.8.7d.orig/include/global_settings.php cacti-0.8.7d/include/global_settings.php
466 --- cacti-0.8.7d.orig/include/global_settings.php 2009-02-12 03:55:50.000000000 +0100
467 +++ cacti-0.8.7d/include/global_settings.php 2009-02-17 08:57:36.000000000 +0100
468 @@ -1185,4 +1185,6 @@
472 +api_plugin_hook('config_settings');
475 diff -urN cacti-0.8.7d.orig/include/plugins.php cacti-0.8.7d/include/plugins.php
476 --- cacti-0.8.7d.orig/include/plugins.php 1970-01-01 01:00:00.000000000 +0100
477 +++ cacti-0.8.7d/include/plugins.php 2009-02-17 08:57:36.000000000 +0100
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.
486 +global $plugin_hooks;
487 +$plugin_hooks = array();
489 +function use_plugin ($name) {
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)) {
501 + * This function executes a hook.
502 + * @param string $name Name of hook to fire
503 + * @return mixed $data
506 +/* On startup, register all plugins configured for use. */
507 +if (isset($plugins) && is_array($plugins)) {
508 + foreach ($plugins as $name) {
515 diff -urN cacti-0.8.7d.orig/include/top_graph_header.php cacti-0.8.7d/include/top_graph_header.php
516 --- cacti-0.8.7d.orig/include/top_graph_header.php 2009-02-12 03:55:50.000000000 +0100
517 +++ cacti-0.8.7d/include/top_graph_header.php 2009-02-17 08:57:36.000000000 +0100
519 $using_guest_account = false;
520 $show_console_tab = true;
522 +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE);
523 +if ($oper_mode == OPER_MODE_RESKIN) {
527 /* ================= input validation ================= */
528 input_validate_input_number(get_request_var_request("local_graph_id"));
529 /* ==================================================== */
533 /* need to correct $_SESSION["sess_nav_level_cache"] in zoom view */
534 -if ($_REQUEST["action"] == "zoom") {
535 +if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "zoom") {
536 $_SESSION["sess_nav_level_cache"][2]["url"] = "graph.php?local_graph_id=" . $_REQUEST["local_graph_id"] . "&rra_id=all";
539 +$page_title = api_plugin_hook_function('page_title', 'Cacti');
544 - <title>Cacti</title>
545 + <title><?php echo $page_title; ?></title>
546 <?php if (isset($_SESSION["custom"])) {
547 if ($_SESSION["custom"]) {
548 print "<meta http-equiv=refresh content='99999'>\r\n";
550 - print "<meta http-equiv=refresh content='" . read_graph_config_option("page_refresh") . "'>\r\n";
552 + $refresh = api_plugin_hook_function('top_graph_refresh', read_graph_config_option('page_refresh'));
553 + print "<meta http-equiv=refresh content='" . $refresh . "'>\r\n"; }
556 - <link href="include/main.css" rel="stylesheet">
557 - <link href="images/favicon.ico" rel="shortcut icon"/>
558 - <script type="text/javascript" src="include/layout.js"></script>
559 - <script type="text/javascript" src="include/treeview/ua.js"></script>
560 - <script type="text/javascript" src="include/treeview/ftiens4.js"></script>
561 - <script type="text/javascript" src="include/jscalendar/calendar.js"></script>
562 - <script type="text/javascript" src="include/jscalendar/lang/calendar-en.js"></script>
563 - <script type="text/javascript" src="include/jscalendar/calendar-setup.js"></script>
564 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
565 + <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
566 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
567 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script>
568 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script>
569 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
570 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
571 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
572 + <?php api_plugin_hook('page_head'); ?>
575 -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
576 +<?php if ($oper_mode == OPER_MODE_NATIVE) {?>
577 +<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" <?php print api_plugin_hook_function("body_style", "");?>>
578 <a name='page_top'></a>
580 +<body leftmargin="15" topmargin="15" marginwidth="15" marginheight="15" <?php print api_plugin_hook_function("body_style", "");?>>
583 <table width="100%" height="100%" cellspacing="0" cellpadding="0">
584 +<?php if ($oper_mode == OPER_MODE_NATIVE) { ;?>
585 <tr height="25" bgcolor="#a9a9a9" class="noprint">
586 <td colspan="2" valign="bottom" nowrap>
587 <table width="100%" cellspacing="0" cellpadding="0">
588 - <tr style="background: transparent url('images/cacti_backdrop2.gif') no-repeat center right;">
589 + <tr style="background: transparent url('<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif') no-repeat center right;">
590 <td id="tabs" nowrap>
591 - <?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>
592 + <?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
593 + api_plugin_hook('top_graph_header_tabs');
596 <td id="gtabs" align="right" nowrap>
597 - <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["graph_settings"] == "on")) { print '<a href="graph_settings.php"><img src="images/tab_settings'; if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; } print '.gif" border="0" alt="Settings" align="absmiddle"></a>';}?> <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="graph_view.php?action=tree"><img src="images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="graph_view.php?action=list"><img src="images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="graph_view.php?action=preview"><img src="images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?> <br>
598 + <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["graph_settings"] == "on")) { print '<a href="'. $config['url_path'] . 'graph_settings.php"><img src="'. $config['url_path'] . 'images/tab_settings'; if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; } print '.gif" border="0" alt="Settings" align="absmiddle"></a>';}?> <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=tree"><img src="<?php echo $config['url_path']; ?>images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=list"><img src="<?php echo $config['url_path']; ?>images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=preview"><img src="<?php echo $config['url_path']; ?>images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?> <br>
604 <tr height="2" colspan="2" bgcolor="#183c8f" class="noprint">
606 - <img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
607 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
610 <tr height="5" bgcolor="#e9e9e9" class="noprint">
614 <?php if ((isset($_SESSION["sess_user_id"])) && ($using_guest_account == false)) { ?>
615 - 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>)
616 + 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>)
620 @@ -112,10 +127,10 @@
624 - <td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
625 - <img src="images/transparent_line.gif" width="<?php print read_graph_config_option("default_dual_pane_width");?>" height="2" border="0"><br>
626 + <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;">
627 + <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>
629 - <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;">
630 + <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;">
641 - <?php if ((read_graph_config_option("default_tree_view_mode") == "2") && (($_REQUEST["action"] == "tree") || ((isset($_REQUEST["view_type"]) ? $_REQUEST["view_type"] : "") == "tree"))) { ?>
642 + <?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")))) { ?>
643 <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'>
644 <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>
645 <?php grow_dhtml_trees(); ?>
646 diff -urN cacti-0.8.7d.orig/include/top_header.php cacti-0.8.7d/include/top_header.php
647 --- cacti-0.8.7d.orig/include/top_header.php 2009-02-12 03:55:50.000000000 +0100
648 +++ cacti-0.8.7d/include/top_header.php 2009-02-17 08:57:36.000000000 +0100
650 +-------------------------------------------------------------------------+
654 +global $colors, $config;
656 +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE);
657 +if ($oper_mode == OPER_MODE_RESKIN) {
661 +$page_title = api_plugin_hook_function('page_title', 'Cacti');
666 - <title>Cacti</title>
667 - <link href="include/main.css" rel="stylesheet">
668 - <link href="images/favicon.ico" rel="shortcut icon"/>
669 - <script type="text/javascript" src="include/layout.js"></script>
670 + <title><?php echo $page_title; ?></title>
671 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
672 + <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
673 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
674 <?php if (isset($refresh)) {
675 print "<meta http-equiv=refresh content=\"" . $refresh["seconds"] . "; url='" . $refresh["page"] . "'\">";
678 + api_plugin_hook('page_head'); ?>
682 -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif">
683 +<?php if ($oper_mode == OPER_MODE_NATIVE) {?>
684 +<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" <?php print api_plugin_hook_function("body_style", "");?>>
686 +<body leftmargin="15" topmargin="15" marginwidth="15" marginheight="15" <?php print api_plugin_hook_function("body_style", "");?>>
689 <table width="100%" cellspacing="0" cellpadding="0">
690 +<?php if ($oper_mode == OPER_MODE_NATIVE) { ;?>
691 <tr height="1" bgcolor="#a9a9a9">
692 <td valign="bottom" colspan="3" nowrap>
693 <table width="100%" cellspacing="0" cellpadding="0">
694 - <tr style="background: transparent url('images/cacti_backdrop.gif') no-repeat center right;">
695 + <tr style="background: transparent url('<?php echo $config['url_path']; ?>images/cacti_backdrop.gif') no-repeat center right;">
696 <td id="tabs" valign="bottom">
697 - <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>
699 + <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
700 + api_plugin_hook('top_header_tabs');
706 <tr height="2" bgcolor="#183c8f">
708 - <img src="images/transparent_line.gif" height="2" border="0"><br>
709 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" height="2" border="0"><br>
712 <tr height="5" bgcolor="#e9e9e9">
716 <?php if (read_config_option("auth_method") != 0) { ?>
717 - 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>)
718 + 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>)
726 - <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;">
727 - <img src="images/transparent_line.gif" width="135" height="2" border="0"><br>
729 - <td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
730 + <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;">
731 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="2" border="0"><br>
733 + <td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
741 - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
742 - <p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
743 - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
744 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
745 + <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>
746 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
748 <td width="100%" colspan="2" valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;"><?php display_output_messages();?>
752 + <td width="100%" valign="top"><?php display_output_messages();?>
754 diff -urN cacti-0.8.7d.orig/index.php cacti-0.8.7d/index.php
755 --- cacti-0.8.7d.orig/index.php 2009-02-12 03:55:50.000000000 +0100
756 +++ cacti-0.8.7d/index.php 2009-02-17 08:57:36.000000000 +0100
758 include("./include/auth.php");
759 include("./include/top_header.php");
761 +api_plugin_hook('console_before');
764 <table width="100%" align="center">
770 +api_plugin_hook('console_after');
772 include("./include/bottom_footer.php");
775 diff -urN cacti-0.8.7d.orig/lib/api_device.php cacti-0.8.7d/lib/api_device.php
776 --- cacti-0.8.7d.orig/lib/api_device.php 2009-02-12 03:55:50.000000000 +0100
777 +++ cacti-0.8.7d/lib/api_device.php 2009-02-17 08:57:36.000000000 +0100
779 $save["ping_retries"] = form_input_validate($ping_retries, "ping_retries", "^[0-9]+$", true, 3);
780 $save["max_oids"] = form_input_validate($max_oids, "max_oids", "^[0-9]+$", true, 3);
782 + $save = api_plugin_hook_function('api_device_save', $save);
786 if (!is_error_message()) {
787 diff -urN cacti-0.8.7d.orig/lib/auth.php cacti-0.8.7d/lib/auth.php
788 --- cacti-0.8.7d.orig/lib/auth.php 2009-02-12 03:55:50.000000000 +0100
789 +++ cacti-0.8.7d/lib/auth.php 2009-02-17 08:57:36.000000000 +0100
794 + api_plugin_hook_function('copy_user', array('template_id' => $template_id, 'new_id' => $new_id));
800 db_execute("delete from settings_graphs where user_id=" . $user_id);
801 db_execute("delete from settings_tree where user_id=" . $user_id);
803 + api_plugin_hook_function('user_remove', $user_id);
807 diff -urN cacti-0.8.7d.orig/lib/functions.php cacti-0.8.7d/lib/functions.php
808 --- cacti-0.8.7d.orig/lib/functions.php 2009-02-12 03:55:50.000000000 +0100
809 +++ cacti-0.8.7d/lib/functions.php 2009-02-17 08:57:36.000000000 +0100
810 @@ -1640,6 +1640,7 @@
811 /* draw_navigation_text - determines the top header navigation text for the current page and displays it to
813 function draw_navigation_text() {
815 $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array());
818 @@ -1652,8 +1653,8 @@
819 "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
820 "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
821 "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"),
822 - "index.php:" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"),
823 - "index.php:login" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"),
824 + "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"),
825 + "index.php:login" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"),
826 "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"),
827 "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"),
828 "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"),
829 @@ -1731,6 +1732,8 @@
830 "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
833 + $nav = api_plugin_hook_function('draw_navigation_text', $nav);
835 $current_page = basename($_SERVER["PHP_SELF"]);
837 input_validate_input_regex(get_request_var_request("action"), "^([a-zA-Z0-9_-]+)$");
838 diff -urN cacti-0.8.7d.orig/lib/html_form.php cacti-0.8.7d/lib/html_form.php
839 --- cacti-0.8.7d.orig/lib/html_form.php 2009-02-12 03:55:50.000000000 +0100
840 +++ cacti-0.8.7d/lib/html_form.php 2009-02-17 08:57:36.000000000 +0100
841 @@ -661,11 +661,13 @@
842 on a confirmation form
843 @arg $cancel_url - the url to go to when the user clicks 'cancel'
844 @arg $action_url - the url to go to when the user clicks 'delete' */
845 -function form_confirm_buttons($action_url, $cancel_url) { ?>
846 +function form_confirm_buttons($action_url, $cancel_url) {
850 <td bgcolor="#E1E1E1">
851 - <a href="<?php print $cancel_url;?>"><img src="images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a>
852 - <a href="<?php print $action_url . "&confirm=yes";?>"><img src="images/button_delete.gif" border="0" alt="Delete" align="absmiddle"></a>
853 + <a href="<?php print $cancel_url;?>"><img src="<?php print $config['url_path'] ?>images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a>
854 + <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>
859 @arg $force_type - if specified, will force the 'action' button to be either
860 'save' or 'create'. otherwise this field should be properly auto-detected */
861 function form_save_button($cancel_url, $force_type = "", $key_field = "id") {
863 if (empty($force_type)) {
864 if (empty($_GET[$key_field])) {
865 $img = "button_create.gif";
868 <td bgcolor="#f5f5f5" align="right">
869 <input type='hidden' name='action' value='save'>
870 - <a href='<?php print $cancel_url;?>'><img src='images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
871 - <input type='image' src='images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
872 + <a href='<?php print $cancel_url;?>'><img src='<?php echo $config['url_path']; ?>images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
873 + <input type='image' src='<?php echo $config['url_path']; ?>images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
877 diff -urN cacti-0.8.7d.orig/lib/html.php cacti-0.8.7d/lib/html.php
878 --- cacti-0.8.7d.orig/lib/html.php 2009-02-12 03:55:50.000000000 +0100
879 +++ cacti-0.8.7d/lib/html.php 2009-02-17 08:57:36.000000000 +0100
881 @arg $extra_url_args - extra arguments to append to the url
882 @arg $header - html to use as a header */
883 function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
886 if (sizeof($graph_array) > 0) {
888 @@ -142,14 +143,15 @@
889 <table align='center' cellpadding='0'>
892 - <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>
893 + <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>
894 <?php print (read_graph_config_option("show_graph_title") == "on" ? "<p style='font-size: 10;' align='center'><strong>" . $graph["title_cache"] . "</strong></p>" : "");?>
896 <td valign='top' style='align: left; padding: 3px;' class='noprint'>
897 - <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>
898 - <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>
899 - <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>
900 - <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
901 + <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>
902 + <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>
903 + <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>
904 + <?php api_plugin_hook('graph_buttons', array('hook' => 'graphs', 'local_graph_id' => $graph['local_graph_id'], 'rra' => 0, 'view_type' => '')); ?>
905 + <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>
910 @arg $extra_url_args - extra arguments to append to the url
911 @arg $header - html to use as a header */
912 function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
914 $i = 0; $k = 0; $j = 0;
916 $num_graphs = sizeof($graph_array);
917 @@ -260,13 +263,14 @@
918 <table align='center' cellpadding='0'>
921 - <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>
922 + <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>
923 <?php print (read_graph_config_option("show_graph_title") == "on" ? "<p style='font-size: 10;' align='center'><strong>" . $graph["title_cache"] . "</strong></p>" : "");?>
925 <td valign='top' style='align: left; padding: 3px;'>
926 - <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>
927 - <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>
928 - <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>
929 + <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>
930 + <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>
931 + <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>
932 + <?php api_plugin_hook('graph_buttons_thumbnails', array('hook' => 'graphs_thumbnails', 'local_graph_id' => $graph['local_graph_id'], 'rra' => 0, 'view_type' => '')); ?>
933 <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
939 while (list($item_sub_url, $item_sub_title) = each($item_title)) {
940 + $item_sub_url = $config['url_path'] . $item_sub_url;
942 /* indent sub-items */
944 $prepend_string = "--- ";
947 /* do not put a line between each sub-item */
948 if (($i == 0) || ($draw_sub_items == false)) {
949 - $background = "images/menu_line.gif";
950 + $background = $config['url_path'] . "images/menu_line.gif";
954 @@ -736,17 +742,18 @@
956 if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) {
957 /* draw normal (non sub-item) menu item */
958 + $item_url = $config['url_path'] . $item_url;
959 if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) {
960 - print "<tr><td class='textMenuItemSelected' background='images/menu_line.gif'><strong><a href='$item_url'>$item_title</a></strong></td></tr>\n";
961 + 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";
963 - print "<tr><td class='textMenuItem' background='images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
964 + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
971 - print "<tr><td class='textMenuItem' background='images/menu_line.gif'></td></tr>\n";
972 + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'></td></tr>\n";
974 print "</table></td></tr>";
976 @@ -756,18 +763,19 @@
977 @arg $actions_array - an array that contains a list of possible actions. this array should
978 be compatible with the form_dropdown() function */
979 function draw_actions_dropdown($actions_array) {
982 <table align='center' width='100%'>
984 <td width='1' valign='top'>
985 - <img src='images/arrow.gif' alt='' align='absmiddle'>
986 + <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'>
990 <?php form_dropdown("drp_action",$actions_array,"","","1","","");?>
992 <td width='1' align='right'>
993 - <input type='image' src='images/button_go.gif' alt='Go'>
994 + <input type='image' src='<?php echo $config['url_path']; ?>images/button_go.gif' alt='Go'>
998 diff -urN cacti-0.8.7d.orig/lib/plugins.php cacti-0.8.7d/lib/plugins.php
999 --- cacti-0.8.7d.orig/lib/plugins.php 1970-01-01 01:00:00.000000000 +0100
1000 +++ cacti-0.8.7d/lib/plugins.php 2009-02-17 08:57:36.000000000 +0100
1006 +function do_hook ($name) {
1007 + $data = func_get_args();
1008 + $data = api_plugin_hook ($name, $data);
1012 +function do_hook_function($name,$parm=NULL) {
1013 + return api_plugin_hook_function ($name, $parm);
1016 +function api_user_realm_auth ($filename = '') {
1017 + return api_plugin_user_realm_auth ($filename);
1021 + * This function executes a hook.
1022 + * @param string $name Name of hook to fire
1023 + * @return mixed $data
1025 +function api_plugin_hook ($name) {
1026 + global $config, $plugin_hooks;
1027 + $data = func_get_args();
1031 + $result = db_fetch_assoc("SELECT name, file, function FROM plugin_hooks WHERE status = 1 AND hook = '$name'", false);
1032 + if (count($result)) {
1033 + foreach ($result as $hdata) {
1034 + $p[] = $hdata['name'];
1035 + if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
1036 + include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
1038 + $function = $hdata['function'];
1039 + if (function_exists($function)) {
1045 + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
1046 + foreach ($plugin_hooks[$name] as $pname => $function) {
1047 + if (function_exists($function) && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) {
1053 + /* Variable-length argument lists have a slight problem when */
1054 + /* passing values by reference. Pity. This is a workaround. */
1058 +function api_plugin_hook_function ($name, $parm=NULL) {
1059 + global $config, $plugin_hooks;
1062 + $result = db_fetch_assoc("SELECT name, file, function FROM plugin_hooks WHERE status = 1 AND hook = '$name'", false);
1064 + if (count($result)) {
1065 + foreach ($result as $hdata) {
1066 + $p[] = $hdata['name'];
1067 + if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
1068 + include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
1070 + $function = $hdata['function'];
1071 + if (function_exists($function)) {
1072 + $ret = $function($ret);
1077 + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
1078 + foreach ($plugin_hooks[$name] as $pname => $function) {
1079 + if (function_exists($function) && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) {
1080 + $ret = $function($ret);
1085 + /* Variable-length argument lists have a slight problem when */
1086 + /* passing values by reference. Pity. This is a workaround. */
1090 +function api_plugin_db_table_create ($plugin, $table, $data) {
1091 + global $config, $database_default;
1092 + include_once($config["library_path"] . "/database.php");
1094 + $result = db_fetch_assoc("show tables from `" . $database_default . "`") or die (mysql_error());
1095 + $tables = array();
1096 + foreach($result as $index => $arr) {
1097 + foreach ($arr as $t) {
1101 + if (!in_array($table, $tables)) {
1103 + $sql = 'CREATE TABLE `' . $table . "` (\n";
1104 + foreach ($data['columns'] as $column) {
1105 + if (isset($column['name'])) {
1108 + $sql .= '`' . $column['name'] . '`';
1109 + if (isset($column['type']))
1110 + $sql .= ' ' . $column['type'];
1111 + if (isset($column['unsigned']))
1112 + $sql .= ' unsigned';
1113 + if (isset($column['NULL']) && $column['NULL'] == false)
1114 + $sql .= ' NOT NULL';
1115 + if (isset($column['NULL']) && $column['NULL'] == true && !isset($column['default']))
1116 + $sql .= ' default NULL';
1117 + if (isset($column['default']))
1118 + $sql .= ' default ' . (is_numeric($column['default']) ? $column['default'] : "'" . $column['default'] . "'");
1119 + if (isset($column['auto_increment']))
1120 + $sql .= ' auto_increment';
1125 + if (isset($data['primary'])) {
1126 + $sql .= ",\n PRIMARY KEY (`" . $data['primary'] . '`)';
1129 + foreach ($data['keys'] as $key) {
1130 + if (isset($key['name'])) {
1131 + $sql .= ",\n KEY `" . $key['name'] . '` (`' . $key['columns'] . '`)';
1134 + $sql .= ') TYPE = ' . $data['type'];
1136 + if (isset($data['comment'])) {
1137 + $sql .= " COMMENT = '" . $data['comment'] . "'";
1139 + if (db_execute($sql)) {
1140 + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, method) VALUES ('$plugin', '$table', 'create')");
1143 + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, method) VALUES ('$plugin', '$table', 'create')");
1147 +function api_plugin_db_changes_remove ($plugin) {
1148 + // Example: api_plugin_db_changes_remove ('thold');
1150 + $tables = db_fetch_assoc("SELECT `table` FROM plugin_db_changes WHERE plugin = '$plugin' AND method ='create'", false);
1151 + if (count($tables)) {
1152 + foreach ($tables as $table) {
1153 + db_execute("DROP TABLE `" . $table['table'] . "`;");
1155 + db_execute("DELETE FROM plugin_db_changes where plugin = '$plugin' AND method ='create'", false);
1157 + $columns = db_fetch_assoc("SELECT `table`, `column` FROM plugin_db_changes WHERE plugin = '$plugin' AND method ='addcolumn'", false);
1158 + if (count($columns)) {
1159 + foreach ($columns as $column) {
1160 + db_execute('ALTER TABLE `' . $column['table'] . '` DROP `' . $column['column'] . '`');
1162 + db_execute("DELETE FROM plugin_db_changes where plugin = '$plugin' AND method = 'addcolumn'", false);
1166 +function api_plugin_db_add_column ($plugin, $table, $column) {
1167 + // Example: api_plugin_db_add_column ('thold', 'plugin_config', array('name' => 'test' . rand(1, 200), 'type' => 'varchar (255)', 'NULL' => false));
1169 + global $config, $database_default;
1170 + include_once($config['library_path'] . '/database.php');
1172 + $result = db_fetch_assoc('show columns from `' . $table . '`') or die (mysql_error());
1173 + $columns = array();
1174 + foreach($result as $index => $arr) {
1175 + foreach ($arr as $t) {
1179 + if (isset($column['name']) && !in_array($column['name'], $columns)) {
1180 + $sql = 'ALTER TABLE `' . $table . '` ADD `' . $column['name'] . '`';
1181 + if (isset($column['type']))
1182 + $sql .= ' ' . $column['type'];
1183 + if (isset($column['unsigned']))
1184 + $sql .= ' unsigned';
1185 + if (isset($column['NULL']) && $column['NULL'] == false)
1186 + $sql .= ' NOT NULL';
1187 + if (isset($column['NULL']) && $column['NULL'] == true && !isset($column['default']))
1188 + $sql .= ' default NULL';
1189 + if (isset($column['default']))
1190 + $sql .= ' default ' . (is_numeric($column['default']) ? $column['default'] : "'" . $column['default'] . "'");
1191 + if (isset($column['auto_increment']))
1192 + $sql .= ' auto_increment';
1193 + if (isset($column['after']))
1194 + $sql .= ' AFTER ' . $column['after'];
1196 + if (db_execute($sql)) {
1197 + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, `column`, `method`) VALUES ('$plugin', '$table', '" . $column['name'] . "', 'addcolumn')");
1202 +function api_plugin_install ($plugin) {
1204 + include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1206 + $exists = db_fetch_assoc("SELECT id FROM plugin_config WHERE directory = '$plugin'", false);
1207 + if (!count($exists)) {
1208 + db_execute("DELETE FROM plugin_config WHERE directory = '$plugin'");
1211 + $name = $author = $webpage = $version = '';
1212 + $function = 'plugin_' . $plugin . '_version';
1213 + if (function_exists($function)){
1214 + $info = $function();
1215 + $name = $info['longname'];
1216 + $webpage = $info['homepage'];
1217 + $author = $info['author'];
1218 + $version = $info['version'];
1221 + db_execute("INSERT INTO plugin_config (directory, name, author, webpage, version) VALUES ('$plugin', '$name', '$author', '$webpage', '$version')");
1223 + $function = 'plugin_' . $plugin . '_install';
1224 + if (function_exists($function)){
1226 + $ready = api_plugin_check_config ($plugin);
1228 + // Set the plugin as "disabled" so it can go live
1229 + db_execute("UPDATE plugin_config SET status = 4 WHERE directory = '$plugin'");
1231 + // Set the plugin as "needs configuration"
1232 + db_execute("UPDATE plugin_config SET status = 2 WHERE directory = '$plugin'");
1237 +function api_plugin_uninstall ($plugin) {
1239 + include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1240 + // Run the Plugin's Uninstall Function first
1241 + $function = 'plugin_' . $plugin . '_uninstall';
1242 + if (function_exists($function)) {
1245 + api_plugin_remove_hooks ($plugin);
1246 + api_plugin_remove_realms ($plugin);
1247 + db_execute("DELETE FROM plugin_config WHERE directory = '$plugin'");
1248 + api_plugin_db_changes_remove ($plugin);
1251 +function api_plugin_check_config ($plugin) {
1253 + include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1254 + $function = 'plugin_' . $plugin . '_check_config';
1255 + if (function_exists($function)) {
1256 + return $function();
1261 +function api_plugin_enable ($plugin) {
1262 + $ready = api_plugin_check_config ($plugin);
1264 + api_plugin_enable_hooks ($plugin);
1265 + db_execute("UPDATE plugin_config SET status = 1 WHERE directory = '$plugin'");
1269 +function api_plugin_is_enabled ($plugin) {
1270 + $status = db_fetch_cell("SELECT status FROM plugin_config WHERE directory = '$plugin'", false);
1271 + if ($status == '1')
1276 +function api_plugin_disable ($plugin) {
1277 + api_plugin_disable_hooks ($plugin);
1278 + db_execute("UPDATE plugin_config SET status = 4 WHERE directory = '$plugin'");
1281 +function api_plugin_register_hook ($plugin, $hook, $function, $file) {
1282 + $exists = db_fetch_assoc("SELECT id FROM plugin_hooks WHERE name = '$plugin' AND hook = '$hook'", false);
1283 + if (!count($exists)) {
1284 + $settings = array('config_settings', 'config_arrays', 'config_form');
1285 + if (!in_array($hook, $settings)) {
1286 + db_execute("INSERT INTO plugin_hooks (name, hook, function, file) VALUES ('$plugin', '$hook', '$function', '$file')");
1288 + db_execute("INSERT INTO plugin_hooks (name, hook, function, file, status) VALUES ('$plugin', '$hook', '$function', '$file', 1)");
1293 +function api_plugin_remove_hooks ($plugin) {
1294 + db_execute("DELETE FROM plugin_hooks WHERE name = '$plugin'");
1297 +function api_plugin_enable_hooks ($plugin) {
1298 + db_execute("UPDATE plugin_hooks SET status = 1 WHERE name = '$plugin'");
1301 +function api_plugin_disable_hooks ($plugin) {
1302 + db_execute("UPDATE plugin_hooks SET status = 0 WHERE name = '$plugin' AND hook != 'config_settings' AND hook != 'config_arrays' AND hook != 'config_form'");
1305 +function api_plugin_register_realm ($plugin, $file, $display, $admin = false) {
1306 + $exists = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin' AND file = '$file'", false);
1307 + if (!count($exists)) {
1308 + db_execute("INSERT INTO plugin_realms (plugin, file, display) VALUES ('$plugin', '$file', '$display')");
1310 + $realm_id = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin' AND file = '$file'", false);
1311 + $realm_id = $realm_id[0]['id'] + 100;
1312 + $user_id = db_fetch_assoc("SELECT id FROM user_auth WHERE username = 'admin'", false);
1313 + if (count($user_id)) {
1314 + $user_id = $user_id[0]['id'];
1315 + $exists = db_fetch_assoc("SELECT realm_id FROM user_auth_realm WHERE user_id = $user_id and realm_id = $realm_id", false);
1316 + if (!count($exists)) {
1317 + db_execute("INSERT INTO user_auth_realm (user_id, realm_id) VALUES ($user_id, $realm_id)");
1324 +function api_plugin_remove_realms ($plugin) {
1325 + $realms = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin'", false);
1326 + foreach ($realms as $realm) {
1327 + $id = $realm['id'] + 100;
1328 + db_execute("DELETE FROM user_auth_realm WHERE realm_id = '$id'");
1330 + db_execute("DELETE FROM plugin_realms WHERE plugin = '$plugin'");
1333 +function api_plugin_load_realms () {
1334 + global $user_auth_realms, $user_auth_realm_filenames;
1335 + $plugin_realms = db_fetch_assoc("SELECT * FROM plugin_realms ORDER BY plugin, display", false);
1336 + if (count($plugin_realms)) {
1337 + foreach ($plugin_realms as $plugin_realm) {
1338 + $plugin_files = explode(',', $plugin_realm['file']);
1339 + foreach($plugin_files as $plugin_file) {
1340 + $user_auth_realm_filenames[$plugin_file] = $plugin_realm['id'] + 100;
1342 + $user_auth_realms[$plugin_realm['id'] + 100] = $plugin_realm['display'];
1347 +function api_plugin_user_realm_auth ($filename = '') {
1348 + global $user_realms, $user_auth_realms, $user_auth_realm_filenames;
1349 + /* list all realms that this user has access to */
1350 + if (!isset($user_realms)) {
1351 + if (read_config_option('global_auth') == 'on' || read_config_option('auth_method') != 0) {
1352 + $user_realms = db_fetch_assoc("select realm_id from user_auth_realm where user_id=" . $_SESSION["sess_user_id"], false);
1353 + $user_realms = array_rekey($user_realms, "realm_id", "realm_id");
1355 + $user_realms = $user_auth_realms;
1358 + if ($filename != '') {
1359 + if (isset($user_realms[$user_auth_realm_filenames{basename($filename)}]))
1365 +function plugin_config_arrays () {
1367 + $menu['Configuration']['plugins.php'] = 'Plugin Management';
1368 + api_plugin_load_realms ();
1371 +function plugin_draw_navigation_text ($nav) {
1372 + $nav["plugins.php:"] = array("title" => "Plugin Management", "mapping" => "index.php:", "url" => "plugins.php", "level" => "1");
1382 diff -urN cacti-0.8.7d.orig/lib/poller.php cacti-0.8.7d/lib/poller.php
1383 --- cacti-0.8.7d.orig/lib/poller.php 2009-02-12 03:55:50.000000000 +0100
1384 +++ cacti-0.8.7d/lib/poller.php 2009-02-17 08:57:36.000000000 +0100
1385 @@ -324,8 +324,11 @@
1389 + api_plugin_hook_function('poller_output', $rrd_update_array);
1391 - $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
1392 + if (api_plugin_hook_function('poller_on_demand', $results)) {
1393 + $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
1397 return $rrds_processed;
1398 diff -urN cacti-0.8.7d.orig/lib/rrd.php cacti-0.8.7d/lib/rrd.php
1399 --- cacti-0.8.7d.orig/lib/rrd.php 2009-02-12 03:55:50.000000000 +0100
1400 +++ cacti-0.8.7d/lib/rrd.php 2009-02-17 08:57:36.000000000 +0100
1401 @@ -557,6 +557,10 @@
1405 + $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));
1406 + if (isset($data['return']) && $data['return'] != false)
1407 + return $data['return'];
1409 /* find the step and how often this graph is updated with new data */
1410 $ds_step = db_fetch_cell("select
1411 data_template_data.rrd_step
1412 @@ -1388,6 +1392,13 @@
1416 + $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));
1417 + if (!empty($graph_array)) {
1418 + $graph_defs = $graph_array['graph_defs'];
1419 + $txt_graph_items = $graph_array['txt_graph_items'];
1420 + $graph_opts = $graph_array['graph_opts'];
1423 /* either print out the source or pass the source onto rrdtool to get us a nice PNG */
1424 if (isset($graph_data_array["print_source"])) {
1425 print "<PRE>" . read_config_option("path_rrdtool") . " graph $graph_opts$graph_defs$txt_graph_items</PRE>";
1426 @@ -1396,13 +1407,19 @@
1427 rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrd_struc);
1430 + $graph_data_array = api_plugin_hook_function('prep_graph_array', $graph_data_array);
1432 if (isset($graph_data_array["output_flag"])) {
1433 $output_flag = $graph_data_array["output_flag"];
1435 $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA;
1438 - return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
1439 + $output = rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
1441 + api_plugin_hook_function('rrdtool_function_graph_set_file', array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id));
1447 diff -urN cacti-0.8.7d.orig/lib/variables.php cacti-0.8.7d/lib/variables.php
1448 --- cacti-0.8.7d.orig/lib/variables.php 2009-02-12 03:55:50.000000000 +0100
1449 +++ cacti-0.8.7d/lib/variables.php 2009-02-17 08:57:36.000000000 +0100
1451 $string = str_replace($l_escape_string . "host_max_oids" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["max_oids"], $string);
1452 $string = str_replace($l_escape_string . "host_id" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["id"], $string);
1454 + $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));
1455 + $string = $temp['string'];
1460 diff -urN cacti-0.8.7d.orig/plugins/index.php cacti-0.8.7d/plugins/index.php
1461 --- cacti-0.8.7d.orig/plugins/index.php 1970-01-01 01:00:00.000000000 +0100
1462 +++ cacti-0.8.7d/plugins/index.php 2009-02-17 08:57:36.000000000 +0100
1466 +header("Location:../index.php");
1469 diff -urN cacti-0.8.7d.orig/plugins.php cacti-0.8.7d/plugins.php
1470 --- cacti-0.8.7d.orig/plugins.php 1970-01-01 01:00:00.000000000 +0100
1471 +++ cacti-0.8.7d/plugins.php 2009-02-17 08:57:36.000000000 +0100
1476 +include("./include/auth.php");
1479 +$pluginslist = retrieve_plugin_list ();
1481 +/* tab information */
1483 + "current" => "Installed",
1484 +// "uninstalled" => "Uninstalled",
1485 +// "download" => "Download",
1486 +// "updates" => "Updates",
1490 +$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');
1493 +/* set the default settings category */
1494 +if (!isset($_GET["tab"])) {
1495 + /* there is no selected tab; select the first one */
1496 + $current_tab = array_keys($ptabs);
1497 + $current_tab = $current_tab[0];
1499 + $current_tab = $_GET["tab"];
1503 +// Check to see if we are installing, etc...
1504 +$modes = array('install', 'uninstall', 'disable', 'enable', 'check');
1506 +if (isset($_GET['mode']) && in_array($_GET['mode'], $modes) && isset($_GET['id'])) {
1508 + input_validate_input_regex(get_request_var("id"), "^([a-zA-Z0-9]+)$");
1510 + $mode = $_GET['mode'];
1511 + $id = sanitize_search_string($_GET['id']);
1515 + api_plugin_install($id);
1516 + $pluginslist = retrieve_plugin_list ();
1519 + if (!in_array($id, $pluginslist))
1521 + api_plugin_uninstall($id);
1522 + $pluginslist = retrieve_plugin_list ();
1525 + if (!in_array($id, $pluginslist))
1527 + api_plugin_disable ($id);
1530 + if (!in_array($id, $pluginslist))
1532 + api_plugin_enable ($id);
1535 + if (!in_array($id, $pluginslist))
1541 +function retrieve_plugin_list () {
1542 + $pluginslist = array();
1543 + $temp = db_fetch_assoc('SELECT directory FROM plugin_config ORDER BY name');
1544 + foreach ($temp as $t) {
1545 + $pluginslist[] = $t['directory'];
1547 + return $pluginslist;
1551 + include("./include/top_header.php");
1553 + /* draw the categories tabs on the top of the page */
1555 + print "<table class='tabs' width='98%' cellspacing='0' cellpadding='3' align='center'><tr>\n";
1557 + if (sizeof($ptabs) > 0) {
1558 + foreach (array_keys($ptabs) as $tab_short_name) {
1559 + print "<td " . (($tab_short_name == $current_tab) ? "bgcolor='silver'" : "bgcolor='#DFDFDF'") . " nowrap='nowrap' width='" . (strlen($ptabs[$tab_short_name]) * 9) . "' align='center' class='tab'>
1560 + <span class='textHeader'><a href='plugins.php?tab=$tab_short_name'>$ptabs[$tab_short_name]</a></span>
1562 + <td width='1'></td>\n";
1566 + print "<td></td>\n</tr></table>\n";
1568 + html_start_box("<strong> Plugin Management</strong>", "98%", $colors["header"], "3", "center", "");
1570 + print "<tr><td><table width='100%'>";
1572 + //update_info_table();
1574 + switch ($current_tab) {
1576 + update_show_current();
1578 + case 'uninstalled':
1579 + update_show_uninstalled ();
1582 + print '<br><br><br>';
1586 + $last_check = read_config_option("plugin_update_last_check");
1587 + if ($last_check < 1)
1590 + print "<center>Last Scanned : " . ($last_check > 0 ? date("F j, Y g:i:s a", $last_check) : "Never") . "</center>";
1592 + print "</table></td></tr>";
1596 + include("./include/bottom_footer.php");
1598 +function update_show_updates () {
1599 + global $pluginslist, $colors, $config, $plugin_architecture;
1602 + sort($pluginslist);
1604 + $cinfo = update_get_plugin_info ();
1608 + $info = update_get_cached_plugin_info();
1610 + $cactinew = update_check_if_newer($cinfo['cacti']['version'], $info['cacti']['version']) ;
1611 + if (isset($cinfo['cacti_plugin_arch']['version']))
1612 + $archnew = update_check_if_newer($cinfo['cacti_plugin_arch']['version'], $info['cacti_plugin_arch']['version']);
1618 + print "<tr><td width='25%' valign=top><table width='100%'>";
1619 + html_header(array("Cacti"), 2);
1620 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1621 + print "<td width='25%'><strong>Version:</strong></td><td>" . $config["cacti_version"] . "</td></tr>";
1622 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1623 + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info['cacti']['changes']) . "</td></tr></table>";
1625 + if (isset($plugin_architecture['version']) && $archnew) {
1627 + print "<table width='100%'>";
1628 + html_header(array("Plugin Architecture"), 2);
1629 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1630 + print "<td width='25%'><strong>Version:</strong></td><td>" . $plugin_architecture['version'] . "</td>";
1631 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1632 + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info['cacti_plugin_arch']['changes']) . "</td></tr></table>";
1634 + print "<table width='100%' cellspacing=0 cellpadding=3>";
1636 + foreach ($pluginslist as $plugin) {
1637 + if (isset($cinfo[$plugin]) && update_check_if_newer($cinfo[$plugin]['version'], $info[$plugin]['version'])) {
1639 + print "<table width='100%'>";
1640 + html_header(array((isset($cinfo[$plugin]['longname']) ? $cinfo[$plugin]['longname'] : $plugin)), 2);
1641 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1642 + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>";
1643 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1644 + print "<td><strong>Version:</strong></td><td>" . $info[$plugin]['version'] . "</td>";
1645 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1646 + 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>";
1647 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1648 + 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>";
1649 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1650 + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info[$plugin]['changes']) . "</td>";
1652 + print "</tr></table>";
1656 + print "<br><center><b>There are currently no Updates!</b></center><br>";
1658 + html_end_box(TRUE);
1661 +function update_check_if_newer() {
1665 +function update_show_current () {
1666 + global $plugins, $pluginslist, $colors, $plugin_architecture, $config, $status_names;
1671 + $cinfo = update_get_plugin_info ();
1673 + sort($pluginslist);
1675 + $path = $config['base_path'] . '/plugins/';
1676 + $dh = opendir($path);
1677 + while (($file = readdir($dh)) !== false) {
1678 + if (is_dir("$path/$file")) {
1679 + if (file_exists("$path/$file/setup.php") && !in_array($file, $pluginslist)) {
1680 + include_once("$path/$file/setup.php");
1681 + if (!function_exists('plugin_' . $file . '_install') && function_exists($file . '_version')) {
1682 + $function = $file . '_version';
1683 + $cinfo[$file] = $function();
1684 + $cinfo[$file]['status'] = -2;
1685 + if (in_array($file, $plugins)) {
1686 + $cinfo[$file]['status'] = -1;
1688 + $pluginslist[] = $file;
1689 + } else if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) {
1690 + $function = $file . '_version';
1691 + $cinfo[$file] = $function();
1692 + $cinfo[$file]['status'] = 0;
1693 + $pluginslist[] = $file;
1700 + print "<table width='100%' cellspacing=0 cellpadding=3>";
1701 + print "<tr><td width='50%'><table width='100%'>";
1702 + html_header(array("Cacti"), 2);
1703 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1704 + print "<td width='50%'><strong>Version:</strong></td><td>" . $config["cacti_version"] . "</td></tr></table>";
1705 + print "</td><td>";
1706 + if (isset($plugin_architecture['version'])) {
1707 + print "<table width='100%'>";
1708 + html_header(array("Plugin Architecture"), 2);
1709 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1710 + print "<td width='50%'><strong>Version:</strong></td><td>" . $plugin_architecture['version'] . "</td></tr></table>";
1712 + print "</td></tr></table>";
1714 + print "<table width='100%' cellspacing=0 cellpadding=3>";
1717 + foreach ($pluginslist as $plugin) {
1718 + if (isset($cinfo[$plugin])) {
1721 + print "<tr><td width='50%' valign=top>";
1723 + print "</td><td valign=top>";
1725 + if (!isset($info[$plugin]['version']))
1726 + $info[$plugin]['version'] = '';
1728 + print "<table width='100%'>";
1729 + html_header(array((isset($cinfo[$plugin]['name']) ? $cinfo[$plugin]['name'] : $plugin)), 2);
1730 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1731 + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>";
1732 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1733 + 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>";
1734 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1735 + 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>";
1736 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1737 + 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>";
1738 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1739 + print "<td><strong>Status:</strong></td><td>" . $status_names[$cinfo[$plugin]['status']] . "</td>";
1741 + if ($cinfo[$plugin]['status'] > -1) {
1742 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1744 + $links = array('install' => 'Install', 'uninstall' => 'Uninstall', 'enable' => 'Enable', 'disable' => 'Disable', 'check' => 'Check');
1746 + switch ($cinfo[$plugin]['status']) {
1747 + case 0: //Not Installed
1748 + $links['install'] = "<a href='plugins.php?mode=install&id=$plugin'><b>Install</b></a>";
1750 + case 1: // Currently Active
1751 + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin'><b>Uninstall</b></a>";
1752 + $links['disable'] = "<a href='plugins.php?mode=disable&id=$plugin'><b>Disable</b></a>";
1754 + case 2: // Needs Configuring
1755 + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin'><b>Check</b></a>";
1757 + case 3: // Needs Upgrade
1758 + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin'><b>Check</b></a>";
1760 + case 4: // Installed but not active
1761 + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin'><b>Uninstall</b></a>";
1762 + $links['enable'] = "<a href='plugins.php?mode=enable&id=$plugin'><b>Enable</b></a>";
1766 + print "<td></td><td>";
1768 + foreach ($links as $temp => $link) {
1770 + if ($c < count($links))
1780 + print "</td></tr>";
1783 + if ($x > 1) $x = 0;
1787 + print "</td><td></td></tr>";
1789 + html_end_box(TRUE);
1793 +function update_show_uninstalled () {
1794 + global $pluginslist, $colors, $plugin_architecture, $config, $status_names;
1797 + sort($pluginslist);
1799 + print "<table width='100%' cellspacing=0 cellpadding=3>";
1802 + $newplugins = array();
1803 + $cinfo = array ();
1805 + $path = $config['base_path'] . '/plugins/';
1806 + $dh = opendir($path);
1807 + while (($file = readdir($dh)) !== false) {
1808 + if (is_dir("$path/$file")) {
1809 + if (file_exists("$path/$file/setup.php") && !in_array($file, $pluginslist)) {
1810 + include_once("$path/$file/setup.php");
1811 + if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) {
1812 + $function = 'plugin_' . $file . '_version';
1813 + $cinfo[$file] = $function();
1814 + $cinfo[$file]['status'] = 0;
1815 + $newplugins[] = $file;
1822 + if (count($newplugins)) {
1823 + foreach ($newplugins as $plugin) {
1824 + if (isset($cinfo[$plugin])) {
1827 + print "<tr><td width='50%'>";
1829 + print "</td><td>";
1831 + if (!isset($info[$plugin]['version']))
1832 + $info[$plugin]['version'] = '';
1834 + print "<table width='100%'>";
1835 + html_header(array((isset($cinfo[$plugin]['name']) ? $cinfo[$plugin]['name'] : $plugin)), 2);
1836 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1837 + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>";
1838 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1839 + 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>";
1840 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1841 + 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>";
1842 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1843 + 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>";
1844 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1845 + print "<td><strong>Status:</strong></td><td>" . $status_names[$cinfo[$plugin]['status']] . "</td>";
1846 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1848 + $links = array('install' => 'Install', 'uninstall' => 'Uninstall', 'enable' => 'Enable', 'disable' => 'Disable', 'check' => 'Check');
1850 + switch ($cinfo[$plugin]['status']) {
1851 + case 0: //Not Installed
1852 + $links['install'] = "<a href='plugins.php?mode=install&id=$plugin&tab=uninstalled'><b>Install</b></a>";
1854 + case 1: // Currently Active
1855 + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin&tab=uninstalled'><b>Uninstall</b></a>";
1856 + $links['disable'] = "<a href='plugins.php?mode=disable&id=$plugin&tab=uninstalled'><b>Disable</b></a>";
1858 + case 2: // Needs Configuring
1859 + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin&tab=uninstalled'><b>Check</b></a>";
1861 + case 3: // Needs Upgrade
1862 + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin&tab=uninstalled'><b>Check</b></a>";
1864 + case 4: // Installed but not active
1865 + $links['enable'] = "<a href='plugins.php?mode=enable&id=$plugin&tab=uninstalled'><b>Enable</b></a>";
1869 + print "<td></td><td>";
1871 + foreach ($links as $temp => $link) {
1873 + if ($c < count($links))
1879 + print "</tr></table>";
1881 + print "</td></tr>";
1884 + if ($x > 1) $x = 0;
1888 + print "<center>There are no Uninstalled Plugins</center>";
1891 + print "</td><td></td></tr>";
1893 + html_end_box(TRUE);
1896 +function update_get_plugin_info () {
1898 + $info = db_fetch_assoc("SELECT * from plugin_config");
1899 + if (is_array($info)) {
1900 + foreach($info as $inf) {
1901 + $cinfo[$inf['directory']] = $inf;
1902 + $cinfo[$inf['directory']]['changes']='';
1908 diff -urN cacti-0.8.7d.orig/poller.php cacti-0.8.7d/poller.php
1909 --- cacti-0.8.7d.orig/poller.php 2009-02-12 03:55:50.000000000 +0100
1910 +++ cacti-0.8.7d/poller.php 2009-02-17 08:57:36.000000000 +0100
1915 +api_plugin_hook('poller_top');
1917 /* record the start time */
1918 list($micro,$seconds) = split(" ", microtime());
1919 $poller_start = $seconds + $micro;
1921 $total_procs = $concurrent_processes;
1924 + $extra_args = api_plugin_hook_function ('poller_command_args', $extra_args);
1926 /* Populate each execution file with appropriate information */
1927 foreach ($polling_hosts as $item) {
1928 if ($host_count == 1) {
1929 @@ -403,9 +407,11 @@
1931 /* sleep the appripriate amount of time */
1932 if ($poller_runs_completed < $poller_runs) {
1933 + api_plugin_hook('poller_bottom');
1935 usleep($sleep_time * 1000000);
1936 db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);
1937 + api_plugin_hook('poller_top');
1939 }else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM) {
1940 cacti_log("WARNING: Cacti Polling Cycle Exceeded Poller Interval by " . $loop_end-$loop_start-$poller_interval . " seconds", TRUE, "POLLER");
1942 echo " --debug|-d Output debug information. Similar to cacti's DEBUG logging level.\n\n";
1945 +api_plugin_hook('poller_bottom');
1948 diff -urN cacti-0.8.7d.orig/user_admin.php cacti-0.8.7d/user_admin.php
1949 --- cacti-0.8.7d.orig/user_admin.php 2009-02-12 03:55:50.000000000 +0100
1950 +++ cacti-0.8.7d/user_admin.php 2009-02-17 08:57:36.000000000 +0100
1955 - include_once("include/top_header.php");
1957 - include_once("include/bottom_footer.php");
1958 + if (!api_plugin_hook_function('user_admin_action', get_request_var_request("action"))) {
1959 + include_once("include/top_header.php");
1961 + include_once("include/bottom_footer.php");
1967 $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);
1968 $save["realm"] = get_request_var_post("realm", 0);
1969 $save["enabled"] = form_input_validate(get_request_var_post("enabled", ""), "enabled", "", true, 3);
1970 + $save = api_plugin_hook_function('user_admin_setup_sql_save', $save);
1972 if (!is_error_message()) {
1973 $user_id = sql_save($save, "user_auth");
1975 policy_hosts = " . get_request_var_post("policy_hosts") . ",
1976 policy_graph_templates = " . get_request_var_post("policy_graph_templates") . "
1977 WHERE id = " . get_request_var_post("id"));
1979 + api_plugin_hook('user_admin_user_save');
1984 $header_label = "[new]";
1987 + api_plugin_hook_function('user_admin_edit', (isset($user) ? get_request_var("id") : 0));
1989 html_start_box("<strong>User Management</strong> $header_label", "100%", $colors["header"], "3", "center", "");
1991 draw_edit_form(array(
1993 <td <?php print ((get_request_var("action") == "graph_settings_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='130' align='center' class='tab'>
1994 <span class='textHeader'><a href='user_admin.php?action=graph_settings_edit&id=<?php print $_GET["id"];?>'>Graph Settings</a></span>
1996 + <?php api_plugin_hook('user_admin_tab');?>
2001 }elseif (get_request_var("action") == "graph_perms_edit") {
2004 - user_realms_edit();
2005 + if (api_plugin_hook_function('user_admin_run_action', get_request_var_request("action"))) {
2006 + user_realms_edit();
2010 form_save_button("user_admin.php");
2011 diff -urN cacti-0.8.7d.orig/utilities.php cacti-0.8.7d/utilities.php
2012 --- cacti-0.8.7d.orig/utilities.php 2009-02-12 03:55:50.000000000 +0100
2013 +++ cacti-0.8.7d/utilities.php 2009-02-17 08:57:36.000000000 +0100
2014 @@ -129,11 +129,14 @@
2015 include_once("./include/bottom_footer.php");
2018 - include_once("./include/top_header.php");
2021 + if (!api_plugin_hook_function('utilities_action', $_REQUEST['action'])) {
2022 + include_once('./include/top_header.php');
2024 - include_once("./include/bottom_footer.php");
2027 + include_once('./include/bottom_footer.php');
2032 @@ -1642,6 +1645,8 @@
2036 + api_plugin_hook('utilities_list');