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:11.000000000 -0500
3 +++ cacti-0.8.7e/auth_changepassword.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
15 +++ cacti-0.8.7e/auth_login.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
54 +++ cacti-0.8.7e/data_sources.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
124 +++ cacti-0.8.7e/graph_image.php 2009-11-21 23:06:16.000000000 -0600
126 /* flush the headers now */
129 +api_plugin_hook_function('graph_image');
131 session_write_close();
133 $graph_data_array = array();
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-11-21 23:31:26.000000000 -0600
136 +++ cacti-0.8.7e/graph.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
163 +++ cacti-0.8.7e/graphs_new.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
176 +++ cacti-0.8.7e/graphs.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
212 +++ cacti-0.8.7e/host.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
273 +++ cacti-0.8.7e/include/auth.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
313 +++ cacti-0.8.7e/include/bottom_footer.php 2009-11-21 23:06:16.000000000 -0600
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 -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-11-21 23:31:26.000000000 -0600
337 +++ cacti-0.8.7e/include/global_arrays.php 2009-11-21 23:06:16.000000000 -0600
339 +-------------------------------------------------------------------------+
346 "message" => 'Save Successful.',
351 +$plugin_architecture = array(
355 +api_plugin_hook('config_arrays');
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:11.000000000 -0500
360 +++ cacti-0.8.7e/include/global_constants.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
372 +++ cacti-0.8.7e/include/global_form.php 2009-11-21 23:06:16.000000000 -0600
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 -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:11.000000000 -0500
396 +++ cacti-0.8.7e/include/global.php 2009-11-21 23:06:16.000000000 -0600
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 @@ -180,18 +195,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.7e";
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:11.000000000 -0500
467 +++ cacti-0.8.7e/include/global_settings.php 2009-11-21 23:06:16.000000000 -0600
468 @@ -1185,4 +1185,6 @@
472 +api_plugin_hook('config_settings');
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-11-21 23:06:16.000000000 -0600
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 -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-11-21 23:31:26.000000000 -0600
517 +++ cacti-0.8.7e/include/top_graph_header.php 2009-11-21 23:20:04.000000000 -0600
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 /* ==================================================== */
531 $_SESSION["sess_nav_level_cache"][2]["url"] = "graph.php?local_graph_id=" . $_REQUEST["local_graph_id"] . "&rra_id=all";
534 +$page_title = api_plugin_hook_function('page_title', 'Cacti');
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";
545 - print "<meta http-equiv=refresh content='" . htmlspecialchars(read_graph_config_option("page_refresh"),ENT_QUOTES) . "'>\r\n";
546 + $refresh = api_plugin_hook_function('top_graph_refresh', read_graph_config_option('page_refresh'));
547 + print "<meta http-equiv=refresh content='" . $refresh . "'>\r\n";
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'); ?>
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>
575 +<body leftmargin="15" topmargin="15" marginwidth="15" marginheight="15" <?php print api_plugin_hook_function("body_style", "");?>>
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');
591 <td id="gtabs" align="right" nowrap>
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>
599 <tr height="2" colspan="2" bgcolor="#183c8f" class="noprint">
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>
605 <tr height="5" bgcolor="#e9e9e9" class="noprint">
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>)
615 @@ -112,10 +128,10 @@
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 htmlspecialchars(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 htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>" height="2" border="0"><br>
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;">
629 @@ -140,10 +156,10 @@
638 - <?php if ((read_graph_config_option("default_tree_view_mode") == "2") && (($_REQUEST["action"] == "tree") || ((isset($_REQUEST["view_type"]) ? $_REQUEST["view_type"] : "") == "tree"))) { ?>
639 + <?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"))) { ?>
640 <td valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;" bgcolor='#efefef' width='<?php print htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>' class='noprint'>
641 <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>
642 <?php grow_dhtml_trees(); ?>
643 diff -Naur cacti-0.8.7e-old/include/top_header.php cacti-0.8.7e/include/top_header.php
644 --- cacti-0.8.7e-old/include/top_header.php 2009-06-28 11:07:11.000000000 -0500
645 +++ cacti-0.8.7e/include/top_header.php 2009-11-21 23:06:16.000000000 -0600
647 +-------------------------------------------------------------------------+
651 +global $colors, $config;
653 +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE);
654 +if ($oper_mode == OPER_MODE_RESKIN) {
658 +$page_title = api_plugin_hook_function('page_title', 'Cacti');
663 - <title>Cacti</title>
664 - <link href="include/main.css" rel="stylesheet">
665 - <link href="images/favicon.ico" rel="shortcut icon"/>
666 - <script type="text/javascript" src="include/layout.js"></script>
667 + <title><?php echo $page_title; ?></title>
668 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
669 + <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
670 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
671 <?php if (isset($refresh)) {
672 print "<meta http-equiv=refresh content=\"" . $refresh["seconds"] . "; url='" . $refresh["page"] . "'\">";
675 + api_plugin_hook('page_head'); ?>
679 -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif">
680 +<?php if ($oper_mode == OPER_MODE_NATIVE) {?>
681 +<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" <?php print api_plugin_hook_function("body_style", "");?>>
683 +<body leftmargin="15" topmargin="15" marginwidth="15" marginheight="15" <?php print api_plugin_hook_function("body_style", "");?>>
686 <table width="100%" cellspacing="0" cellpadding="0">
687 +<?php if ($oper_mode == OPER_MODE_NATIVE) { ;?>
688 <tr height="1" bgcolor="#a9a9a9">
689 <td valign="bottom" colspan="3" nowrap>
690 <table width="100%" cellspacing="0" cellpadding="0">
691 - <tr style="background: transparent url('images/cacti_backdrop.gif') no-repeat center right;">
692 + <tr style="background: transparent url('<?php echo $config['url_path']; ?>images/cacti_backdrop.gif') no-repeat center right;">
693 <td id="tabs" valign="bottom">
694 - <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>
696 + <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
697 + api_plugin_hook('top_header_tabs');
703 <tr height="2" bgcolor="#183c8f">
705 - <img src="images/transparent_line.gif" height="2" border="0"><br>
706 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" height="2" border="0"><br>
709 <tr height="5" bgcolor="#e9e9e9">
713 <?php if (read_config_option("auth_method") != 0) { ?>
714 - 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>)
715 + 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>)
723 - <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;">
724 - <img src="images/transparent_line.gif" width="135" height="2" border="0"><br>
726 - <td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
727 + <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;">
728 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="2" border="0"><br>
730 + <td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
738 - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
739 - <p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
740 - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
741 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
742 + <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>
743 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
745 <td width="100%" colspan="2" valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;"><?php display_output_messages();?>
749 + <td width="100%" valign="top"><?php display_output_messages();?>
751 diff -Naur cacti-0.8.7e-old/index.php cacti-0.8.7e/index.php
752 --- cacti-0.8.7e-old/index.php 2009-06-28 11:07:11.000000000 -0500
753 +++ cacti-0.8.7e/index.php 2009-11-21 23:06:16.000000000 -0600
755 include("./include/auth.php");
756 include("./include/top_header.php");
758 +api_plugin_hook('console_before');
761 <table width="100%" align="center">
767 +api_plugin_hook('console_after');
769 include("./include/bottom_footer.php");
772 diff -Naur cacti-0.8.7e-old/lib/api_device.php cacti-0.8.7e/lib/api_device.php
773 --- cacti-0.8.7e-old/lib/api_device.php 2009-06-28 11:07:11.000000000 -0500
774 +++ cacti-0.8.7e/lib/api_device.php 2009-11-21 23:06:16.000000000 -0600
776 $save["ping_retries"] = form_input_validate($ping_retries, "ping_retries", "^[0-9]+$", true, 3);
777 $save["max_oids"] = form_input_validate($max_oids, "max_oids", "^[0-9]+$", true, 3);
779 + $save = api_plugin_hook_function('api_device_save', $save);
783 if (!is_error_message()) {
784 diff -Naur cacti-0.8.7e-old/lib/auth.php cacti-0.8.7e/lib/auth.php
785 --- cacti-0.8.7e-old/lib/auth.php 2009-06-28 11:07:11.000000000 -0500
786 +++ cacti-0.8.7e/lib/auth.php 2009-11-21 23:06:16.000000000 -0600
791 + api_plugin_hook_function('copy_user', array('template_id' => $template_id, 'new_id' => $new_id));
797 db_execute("delete from settings_graphs where user_id=" . $user_id);
798 db_execute("delete from settings_tree where user_id=" . $user_id);
800 + api_plugin_hook_function('user_remove', $user_id);
804 diff -Naur cacti-0.8.7e-old/lib/functions.php cacti-0.8.7e/lib/functions.php
805 --- cacti-0.8.7e-old/lib/functions.php 2009-06-28 11:07:11.000000000 -0500
806 +++ cacti-0.8.7e/lib/functions.php 2009-11-21 23:06:16.000000000 -0600
807 @@ -1639,6 +1639,7 @@
808 /* draw_navigation_text - determines the top header navigation text for the current page and displays it to
810 function draw_navigation_text() {
812 $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array());
815 @@ -1651,8 +1652,8 @@
816 "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
817 "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
818 "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"),
819 - "index.php:" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"),
820 - "index.php:login" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"),
821 + "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"),
822 + "index.php:login" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"),
823 "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"),
824 "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"),
825 "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"),
826 @@ -1730,6 +1731,8 @@
827 "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
830 + $nav = api_plugin_hook_function('draw_navigation_text', $nav);
832 $current_page = basename($_SERVER["PHP_SELF"]);
834 input_validate_input_regex(get_request_var_request("action"), "^([a-zA-Z0-9_-]+)$");
835 diff -Naur cacti-0.8.7e-old/lib/html_form.php cacti-0.8.7e/lib/html_form.php
836 --- cacti-0.8.7e-old/lib/html_form.php 2009-11-21 23:31:26.000000000 -0600
837 +++ cacti-0.8.7e/lib/html_form.php 2009-11-21 23:06:16.000000000 -0600
838 @@ -722,11 +722,13 @@
839 on a confirmation form
840 @arg $cancel_url - the url to go to when the user clicks 'cancel'
841 @arg $action_url - the url to go to when the user clicks 'delete' */
842 -function form_confirm_buttons($action_url, $cancel_url) { ?>
843 +function form_confirm_buttons($action_url, $cancel_url) {
847 <td bgcolor="#E1E1E1">
848 - <a href="<?php print $cancel_url;?>"><img src="images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a>
849 - <a href="<?php print $action_url . "&confirm=yes";?>"><img src="images/button_delete.gif" border="0" alt="Delete" align="absmiddle"></a>
850 + <a href="<?php print $cancel_url;?>"><img src="<?php print $config['url_path'] ?>images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a>
851 + <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>
856 @arg $force_type - if specified, will force the 'action' button to be either
857 'save' or 'create'. otherwise this field should be properly auto-detected */
858 function form_save_button($cancel_url, $force_type = "", $key_field = "id") {
860 if (empty($force_type)) {
861 if (empty($_GET[$key_field])) {
862 $img = "button_create.gif";
865 <td bgcolor="#f5f5f5" align="right">
866 <input type='hidden' name='action' value='save'>
867 - <a href='<?php print $cancel_url;?>'><img src='images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
868 - <input type='image' src='images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
869 + <a href='<?php print $cancel_url;?>'><img src='<?php echo $config['url_path']; ?>images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
870 + <input type='image' src='<?php echo $config['url_path']; ?>images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
874 diff -Naur cacti-0.8.7e-old/lib/html.php cacti-0.8.7e/lib/html.php
875 --- cacti-0.8.7e-old/lib/html.php 2009-06-28 11:07:11.000000000 -0500
876 +++ cacti-0.8.7e/lib/html.php 2009-11-21 23:06:16.000000000 -0600
878 @arg $extra_url_args - extra arguments to append to the url
879 @arg $header - html to use as a header */
880 function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
883 if (sizeof($graph_array) > 0) {
885 @@ -142,14 +143,15 @@
886 <table align='center' cellpadding='0'>
889 - <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>
890 + <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>
891 <?php print (read_graph_config_option("show_graph_title") == "on" ? "<p style='font-size: 10;' align='center'><strong>" . $graph["title_cache"] . "</strong></p>" : "");?>
893 <td valign='top' style='align: left; padding: 3px;' class='noprint'>
894 - <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>
895 - <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>
896 - <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>
897 - <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
898 + <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>
899 + <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>
900 + <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>
901 + <?php api_plugin_hook('graph_buttons', array('hook' => 'graphs_thumbnails', 'local_graph_id' => $graph['local_graph_id'], 'rra' => 0, 'view_type' => 'view')); ?>
902 + <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>
907 @arg $extra_url_args - extra arguments to append to the url
908 @arg $header - html to use as a header */
909 function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
911 $i = 0; $k = 0; $j = 0;
913 $num_graphs = sizeof($graph_array);
914 @@ -266,13 +269,14 @@
915 <table align='center' cellpadding='0'>
918 - <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>
919 + <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>
920 <?php print (read_graph_config_option("show_graph_title") == "on" ? "<p style='font-size: 10;' align='center'><strong>" . $graph["title_cache"] . "</strong></p>" : "");?>
922 <td valign='top' style='align: left; padding: 3px;'>
923 - <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>
924 - <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>
925 - <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>
926 + <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>
927 + <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>
928 + <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>
929 + <?php api_plugin_hook('graph_buttons_thumbnails', array('hook' => 'graphs_thumbnails', 'local_graph_id' => $graph['local_graph_id'], 'rra' => 0, 'view_type' => '')); ?>
930 <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
936 while (list($item_sub_url, $item_sub_title) = each($item_title)) {
937 + $item_sub_url = $config['url_path'] . $item_sub_url;
939 /* indent sub-items */
941 $prepend_string = "--- ";
944 /* do not put a line between each sub-item */
945 if (($i == 0) || ($draw_sub_items == false)) {
946 - $background = "images/menu_line.gif";
947 + $background = $config['url_path'] . "images/menu_line.gif";
951 @@ -742,17 +748,18 @@
953 if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) {
954 /* draw normal (non sub-item) menu item */
955 + $item_url = $config['url_path'] . $item_url;
956 if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) {
957 - print "<tr><td class='textMenuItemSelected' background='images/menu_line.gif'><strong><a href='$item_url'>$item_title</a></strong></td></tr>\n";
958 + 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";
960 - print "<tr><td class='textMenuItem' background='images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
961 + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
968 - print "<tr><td class='textMenuItem' background='images/menu_line.gif'></td></tr>\n";
969 + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'></td></tr>\n";
971 print "</table></td></tr>";
973 @@ -762,18 +769,19 @@
974 @arg $actions_array - an array that contains a list of possible actions. this array should
975 be compatible with the form_dropdown() function */
976 function draw_actions_dropdown($actions_array) {
979 <table align='center' width='100%'>
981 <td width='1' valign='top'>
982 - <img src='images/arrow.gif' alt='' align='absmiddle'>
983 + <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'>
987 <?php form_dropdown("drp_action",$actions_array,"","","1","","");?>
989 <td width='1' align='right'>
990 - <input type='image' src='images/button_go.gif' alt='Go'>
991 + <input type='image' src='<?php echo $config['url_path']; ?>images/button_go.gif' alt='Go'>
995 diff -Naur cacti-0.8.7e-old/lib/plugins.php cacti-0.8.7e/lib/plugins.php
996 --- cacti-0.8.7e-old/lib/plugins.php 1969-12-31 17:00:00.000000000 -0700
997 +++ cacti-0.8.7e/lib/plugins.php 2009-11-21 23:06:16.000000000 -0600
1003 +function do_hook ($name) {
1004 + $data = func_get_args();
1005 + $data = api_plugin_hook ($name, $data);
1009 +function do_hook_function($name,$parm=NULL) {
1010 + return api_plugin_hook_function ($name, $parm);
1013 +function api_user_realm_auth ($filename = '') {
1014 + return api_plugin_user_realm_auth ($filename);
1018 + * This function executes a hook.
1019 + * @param string $name Name of hook to fire
1020 + * @return mixed $data
1022 +function api_plugin_hook ($name) {
1023 + global $config, $plugin_hooks;
1024 + $data = func_get_args();
1028 + $result = db_fetch_assoc("SELECT name, file, function FROM plugin_hooks WHERE status = 1 AND hook = '$name'", false);
1029 + if (count($result)) {
1030 + foreach ($result as $hdata) {
1031 + $p[] = $hdata['name'];
1032 + if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
1033 + include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
1035 + $function = $hdata['function'];
1036 + if (function_exists($function)) {
1042 + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
1043 + foreach ($plugin_hooks[$name] as $pname => $function) {
1044 + if (function_exists($function) && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) {
1050 + /* Variable-length argument lists have a slight problem when */
1051 + /* passing values by reference. Pity. This is a workaround. */
1055 +function api_plugin_hook_function ($name, $parm=NULL) {
1056 + global $config, $plugin_hooks;
1059 + $result = db_fetch_assoc("SELECT name, file, function FROM plugin_hooks WHERE status = 1 AND hook = '$name'", false);
1061 + if (count($result)) {
1062 + foreach ($result as $hdata) {
1063 + $p[] = $hdata['name'];
1064 + if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
1065 + include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
1067 + $function = $hdata['function'];
1068 + if (function_exists($function)) {
1069 + $ret = $function($ret);
1074 + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
1075 + foreach ($plugin_hooks[$name] as $pname => $function) {
1076 + if (function_exists($function) && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) {
1077 + $ret = $function($ret);
1082 + /* Variable-length argument lists have a slight problem when */
1083 + /* passing values by reference. Pity. This is a workaround. */
1087 +function api_plugin_db_table_create ($plugin, $table, $data) {
1088 + global $config, $database_default;
1089 + include_once($config["library_path"] . "/database.php");
1091 + $result = db_fetch_assoc("show tables from `" . $database_default . "`") or die (mysql_error());
1092 + $tables = array();
1093 + foreach($result as $index => $arr) {
1094 + foreach ($arr as $t) {
1098 + if (!in_array($table, $tables)) {
1100 + $sql = 'CREATE TABLE `' . $table . "` (\n";
1101 + foreach ($data['columns'] as $column) {
1102 + if (isset($column['name'])) {
1105 + $sql .= '`' . $column['name'] . '`';
1106 + if (isset($column['type']))
1107 + $sql .= ' ' . $column['type'];
1108 + if (isset($column['unsigned']))
1109 + $sql .= ' unsigned';
1110 + if (isset($column['NULL']) && $column['NULL'] == false)
1111 + $sql .= ' NOT NULL';
1112 + if (isset($column['NULL']) && $column['NULL'] == true && !isset($column['default']))
1113 + $sql .= ' default NULL';
1114 + if (isset($column['default']))
1115 + $sql .= ' default ' . (is_numeric($column['default']) ? $column['default'] : "'" . $column['default'] . "'");
1116 + if (isset($column['auto_increment']))
1117 + $sql .= ' auto_increment';
1122 + if (isset($data['primary'])) {
1123 + $sql .= ",\n PRIMARY KEY (`" . $data['primary'] . '`)';
1126 + foreach ($data['keys'] as $key) {
1127 + if (isset($key['name'])) {
1128 + $sql .= ",\n KEY `" . $key['name'] . '` (`' . $key['columns'] . '`)';
1131 + $sql .= ') TYPE = ' . $data['type'];
1133 + if (isset($data['comment'])) {
1134 + $sql .= " COMMENT = '" . $data['comment'] . "'";
1136 + if (db_execute($sql)) {
1137 + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, method) VALUES ('$plugin', '$table', 'create')");
1140 + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, method) VALUES ('$plugin', '$table', 'create')");
1144 +function api_plugin_db_changes_remove ($plugin) {
1145 + // Example: api_plugin_db_changes_remove ('thold');
1147 + $tables = db_fetch_assoc("SELECT `table` FROM plugin_db_changes WHERE plugin = '$plugin' AND method ='create'", false);
1148 + if (count($tables)) {
1149 + foreach ($tables as $table) {
1150 + db_execute("DROP TABLE `" . $table['table'] . "`;");
1152 + db_execute("DELETE FROM plugin_db_changes where plugin = '$plugin' AND method ='create'", false);
1154 + $columns = db_fetch_assoc("SELECT `table`, `column` FROM plugin_db_changes WHERE plugin = '$plugin' AND method ='addcolumn'", false);
1155 + if (count($columns)) {
1156 + foreach ($columns as $column) {
1157 + db_execute('ALTER TABLE `' . $column['table'] . '` DROP `' . $column['column'] . '`');
1159 + db_execute("DELETE FROM plugin_db_changes where plugin = '$plugin' AND method = 'addcolumn'", false);
1163 +function api_plugin_db_add_column ($plugin, $table, $column) {
1164 + // Example: api_plugin_db_add_column ('thold', 'plugin_config', array('name' => 'test' . rand(1, 200), 'type' => 'varchar (255)', 'NULL' => false));
1166 + global $config, $database_default;
1167 + include_once($config['library_path'] . '/database.php');
1169 + $result = db_fetch_assoc('show columns from `' . $table . '`') or die (mysql_error());
1170 + $columns = array();
1171 + foreach($result as $index => $arr) {
1172 + foreach ($arr as $t) {
1176 + if (isset($column['name']) && !in_array($column['name'], $columns)) {
1177 + $sql = 'ALTER TABLE `' . $table . '` ADD `' . $column['name'] . '`';
1178 + if (isset($column['type']))
1179 + $sql .= ' ' . $column['type'];
1180 + if (isset($column['unsigned']))
1181 + $sql .= ' unsigned';
1182 + if (isset($column['NULL']) && $column['NULL'] == false)
1183 + $sql .= ' NOT NULL';
1184 + if (isset($column['NULL']) && $column['NULL'] == true && !isset($column['default']))
1185 + $sql .= ' default NULL';
1186 + if (isset($column['default']))
1187 + $sql .= ' default ' . (is_numeric($column['default']) ? $column['default'] : "'" . $column['default'] . "'");
1188 + if (isset($column['auto_increment']))
1189 + $sql .= ' auto_increment';
1190 + if (isset($column['after']))
1191 + $sql .= ' AFTER ' . $column['after'];
1193 + if (db_execute($sql)) {
1194 + db_execute("INSERT INTO plugin_db_changes (plugin, `table`, `column`, `method`) VALUES ('$plugin', '$table', '" . $column['name'] . "', 'addcolumn')");
1199 +function api_plugin_install ($plugin) {
1201 + include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1203 + $exists = db_fetch_assoc("SELECT id FROM plugin_config WHERE directory = '$plugin'", false);
1204 + if (!count($exists)) {
1205 + db_execute("DELETE FROM plugin_config WHERE directory = '$plugin'");
1208 + $name = $author = $webpage = $version = '';
1209 + $function = 'plugin_' . $plugin . '_version';
1210 + if (function_exists($function)){
1211 + $info = $function();
1212 + $name = $info['longname'];
1213 + $webpage = $info['homepage'];
1214 + $author = $info['author'];
1215 + $version = $info['version'];
1218 + db_execute("INSERT INTO plugin_config (directory, name, author, webpage, version) VALUES ('$plugin', '$name', '$author', '$webpage', '$version')");
1220 + $function = 'plugin_' . $plugin . '_install';
1221 + if (function_exists($function)){
1223 + $ready = api_plugin_check_config ($plugin);
1225 + // Set the plugin as "disabled" so it can go live
1226 + db_execute("UPDATE plugin_config SET status = 4 WHERE directory = '$plugin'");
1228 + // Set the plugin as "needs configuration"
1229 + db_execute("UPDATE plugin_config SET status = 2 WHERE directory = '$plugin'");
1234 +function api_plugin_uninstall ($plugin) {
1236 + include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1237 + // Run the Plugin's Uninstall Function first
1238 + $function = 'plugin_' . $plugin . '_uninstall';
1239 + if (function_exists($function)) {
1242 + api_plugin_remove_hooks ($plugin);
1243 + api_plugin_remove_realms ($plugin);
1244 + db_execute("DELETE FROM plugin_config WHERE directory = '$plugin'");
1245 + api_plugin_db_changes_remove ($plugin);
1248 +function api_plugin_check_config ($plugin) {
1250 + include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1251 + $function = 'plugin_' . $plugin . '_check_config';
1252 + if (function_exists($function)) {
1253 + return $function();
1258 +function api_plugin_enable ($plugin) {
1259 + $ready = api_plugin_check_config ($plugin);
1261 + api_plugin_enable_hooks ($plugin);
1262 + db_execute("UPDATE plugin_config SET status = 1 WHERE directory = '$plugin'");
1266 +function api_plugin_is_enabled ($plugin) {
1267 + $status = db_fetch_cell("SELECT status FROM plugin_config WHERE directory = '$plugin'", false);
1268 + if ($status == '1')
1273 +function api_plugin_disable ($plugin) {
1274 + api_plugin_disable_hooks ($plugin);
1275 + db_execute("UPDATE plugin_config SET status = 4 WHERE directory = '$plugin'");
1278 +function api_plugin_register_hook ($plugin, $hook, $function, $file) {
1279 + $exists = db_fetch_assoc("SELECT id FROM plugin_hooks WHERE name = '$plugin' AND hook = '$hook'", false);
1280 + if (!count($exists)) {
1281 + $settings = array('config_settings', 'config_arrays', 'config_form');
1282 + if (!in_array($hook, $settings)) {
1283 + db_execute("INSERT INTO plugin_hooks (name, hook, function, file) VALUES ('$plugin', '$hook', '$function', '$file')");
1285 + db_execute("INSERT INTO plugin_hooks (name, hook, function, file, status) VALUES ('$plugin', '$hook', '$function', '$file', 1)");
1290 +function api_plugin_remove_hooks ($plugin) {
1291 + db_execute("DELETE FROM plugin_hooks WHERE name = '$plugin'");
1294 +function api_plugin_enable_hooks ($plugin) {
1295 + db_execute("UPDATE plugin_hooks SET status = 1 WHERE name = '$plugin'");
1298 +function api_plugin_disable_hooks ($plugin) {
1299 + db_execute("UPDATE plugin_hooks SET status = 0 WHERE name = '$plugin' AND hook != 'config_settings' AND hook != 'config_arrays' AND hook != 'config_form'");
1302 +function api_plugin_register_realm ($plugin, $file, $display, $admin = false) {
1303 + $exists = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin' AND file = '$file'", false);
1304 + if (!count($exists)) {
1305 + db_execute("INSERT INTO plugin_realms (plugin, file, display) VALUES ('$plugin', '$file', '$display')");
1307 + $realm_id = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin' AND file = '$file'", false);
1308 + $realm_id = $realm_id[0]['id'] + 100;
1309 + $user_id = db_fetch_assoc("SELECT id FROM user_auth WHERE username = 'admin'", false);
1310 + if (count($user_id)) {
1311 + $user_id = $user_id[0]['id'];
1312 + $exists = db_fetch_assoc("SELECT realm_id FROM user_auth_realm WHERE user_id = $user_id and realm_id = $realm_id", false);
1313 + if (!count($exists)) {
1314 + db_execute("INSERT INTO user_auth_realm (user_id, realm_id) VALUES ($user_id, $realm_id)");
1321 +function api_plugin_remove_realms ($plugin) {
1322 + $realms = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin'", false);
1323 + foreach ($realms as $realm) {
1324 + $id = $realm['id'] + 100;
1325 + db_execute("DELETE FROM user_auth_realm WHERE realm_id = '$id'");
1327 + db_execute("DELETE FROM plugin_realms WHERE plugin = '$plugin'");
1330 +function api_plugin_load_realms () {
1331 + global $user_auth_realms, $user_auth_realm_filenames;
1332 + $plugin_realms = db_fetch_assoc("SELECT * FROM plugin_realms ORDER BY plugin, display", false);
1333 + if (count($plugin_realms)) {
1334 + foreach ($plugin_realms as $plugin_realm) {
1335 + $plugin_files = explode(',', $plugin_realm['file']);
1336 + foreach($plugin_files as $plugin_file) {
1337 + $user_auth_realm_filenames[$plugin_file] = $plugin_realm['id'] + 100;
1339 + $user_auth_realms[$plugin_realm['id'] + 100] = $plugin_realm['display'];
1344 +function api_plugin_user_realm_auth ($filename = '') {
1345 + global $user_realms, $user_auth_realms, $user_auth_realm_filenames;
1346 + /* list all realms that this user has access to */
1347 + if (!isset($user_realms)) {
1348 + if (read_config_option('global_auth') == 'on' || read_config_option('auth_method') != 0) {
1349 + $user_realms = db_fetch_assoc("select realm_id from user_auth_realm where user_id=" . $_SESSION["sess_user_id"], false);
1350 + $user_realms = array_rekey($user_realms, "realm_id", "realm_id");
1352 + $user_realms = $user_auth_realms;
1355 + if ($filename != '') {
1356 + if (isset($user_realms[$user_auth_realm_filenames{basename($filename)}]))
1362 +function plugin_config_arrays () {
1364 + $menu['Configuration']['plugins.php'] = 'Plugin Management';
1365 + api_plugin_load_realms ();
1368 +function plugin_draw_navigation_text ($nav) {
1369 + $nav["plugins.php:"] = array("title" => "Plugin Management", "mapping" => "index.php:", "url" => "plugins.php", "level" => "1");
1379 diff -Naur cacti-0.8.7e-old/lib/poller.php cacti-0.8.7e/lib/poller.php
1380 --- cacti-0.8.7e-old/lib/poller.php 2009-06-28 11:07:11.000000000 -0500
1381 +++ cacti-0.8.7e/lib/poller.php 2009-11-21 23:06:16.000000000 -0600
1382 @@ -326,8 +326,11 @@
1386 + api_plugin_hook_function('poller_output', $rrd_update_array);
1388 - $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
1389 + if (api_plugin_hook_function('poller_on_demand', $results)) {
1390 + $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
1394 return $rrds_processed;
1395 diff -Naur cacti-0.8.7e-old/lib/rrd.php cacti-0.8.7e/lib/rrd.php
1396 --- cacti-0.8.7e-old/lib/rrd.php 2009-06-28 11:07:11.000000000 -0500
1397 +++ cacti-0.8.7e/lib/rrd.php 2009-11-21 23:06:16.000000000 -0600
1398 @@ -557,6 +557,10 @@
1402 + $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));
1403 + if (isset($data['return']) && $data['return'] != false)
1404 + return $data['return'];
1406 /* find the step and how often this graph is updated with new data */
1407 $ds_step = db_fetch_cell("select
1408 data_template_data.rrd_step
1409 @@ -1388,6 +1392,13 @@
1413 + $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));
1414 + if (!empty($graph_array)) {
1415 + $graph_defs = $graph_array['graph_defs'];
1416 + $txt_graph_items = $graph_array['txt_graph_items'];
1417 + $graph_opts = $graph_array['graph_opts'];
1420 /* either print out the source or pass the source onto rrdtool to get us a nice PNG */
1421 if (isset($graph_data_array["print_source"])) {
1422 print "<PRE>" . read_config_option("path_rrdtool") . " graph $graph_opts$graph_defs$txt_graph_items</PRE>";
1423 @@ -1396,13 +1407,19 @@
1424 rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrd_struc);
1427 + $graph_data_array = api_plugin_hook_function('prep_graph_array', $graph_data_array);
1429 if (isset($graph_data_array["output_flag"])) {
1430 $output_flag = $graph_data_array["output_flag"];
1432 $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA;
1435 - return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
1436 + $output = rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
1438 + api_plugin_hook_function('rrdtool_function_graph_set_file', array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id));
1444 diff -Naur cacti-0.8.7e-old/lib/variables.php cacti-0.8.7e/lib/variables.php
1445 --- cacti-0.8.7e-old/lib/variables.php 2009-06-28 11:07:11.000000000 -0500
1446 +++ cacti-0.8.7e/lib/variables.php 2009-11-21 23:06:16.000000000 -0600
1448 $string = str_replace($l_escape_string . "host_max_oids" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["max_oids"], $string);
1449 $string = str_replace($l_escape_string . "host_id" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["id"], $string);
1451 + $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));
1452 + $string = $temp['string'];
1457 diff -Naur cacti-0.8.7e-old/plugins/index.php cacti-0.8.7e/plugins/index.php
1458 --- cacti-0.8.7e-old/plugins/index.php 1969-12-31 17:00:00.000000000 -0700
1459 +++ cacti-0.8.7e/plugins/index.php 2009-11-21 23:06:16.000000000 -0600
1463 +header("Location:../index.php");
1466 diff -Naur cacti-0.8.7e-old/plugins.php cacti-0.8.7e/plugins.php
1467 --- cacti-0.8.7e-old/plugins.php 1969-12-31 17:00:00.000000000 -0700
1468 +++ cacti-0.8.7e/plugins.php 2009-11-21 23:06:16.000000000 -0600
1473 +include("./include/auth.php");
1476 +$pluginslist = retrieve_plugin_list ();
1478 +/* tab information */
1480 + "current" => "Installed",
1481 +// "uninstalled" => "Uninstalled",
1482 +// "download" => "Download",
1483 +// "updates" => "Updates",
1487 +$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');
1490 +/* set the default settings category */
1491 +if (!isset($_GET["tab"])) {
1492 + /* there is no selected tab; select the first one */
1493 + $current_tab = array_keys($ptabs);
1494 + $current_tab = $current_tab[0];
1496 + $current_tab = $_GET["tab"];
1500 +// Check to see if we are installing, etc...
1501 +$modes = array('install', 'uninstall', 'disable', 'enable', 'check');
1503 +if (isset($_GET['mode']) && in_array($_GET['mode'], $modes) && isset($_GET['id'])) {
1505 + input_validate_input_regex(get_request_var("id"), "^([a-zA-Z0-9]+)$");
1507 + $mode = $_GET['mode'];
1508 + $id = sanitize_search_string($_GET['id']);
1512 + api_plugin_install($id);
1513 + $pluginslist = retrieve_plugin_list ();
1516 + if (!in_array($id, $pluginslist))
1518 + api_plugin_uninstall($id);
1519 + $pluginslist = retrieve_plugin_list ();
1522 + if (!in_array($id, $pluginslist))
1524 + api_plugin_disable ($id);
1527 + if (!in_array($id, $pluginslist))
1529 + api_plugin_enable ($id);
1532 + if (!in_array($id, $pluginslist))
1538 +function retrieve_plugin_list () {
1539 + $pluginslist = array();
1540 + $temp = db_fetch_assoc('SELECT directory FROM plugin_config ORDER BY name');
1541 + foreach ($temp as $t) {
1542 + $pluginslist[] = $t['directory'];
1544 + return $pluginslist;
1548 + include("./include/top_header.php");
1550 + /* draw the categories tabs on the top of the page */
1552 + print "<table class='tabs' width='98%' cellspacing='0' cellpadding='3' align='center'><tr>\n";
1554 + if (sizeof($ptabs) > 0) {
1555 + foreach (array_keys($ptabs) as $tab_short_name) {
1556 + print "<td " . (($tab_short_name == $current_tab) ? "bgcolor='silver'" : "bgcolor='#DFDFDF'") . " nowrap='nowrap' width='" . (strlen($ptabs[$tab_short_name]) * 9) . "' align='center' class='tab'>
1557 + <span class='textHeader'><a href='plugins.php?tab=$tab_short_name'>$ptabs[$tab_short_name]</a></span>
1559 + <td width='1'></td>\n";
1563 + print "<td></td>\n</tr></table>\n";
1565 + html_start_box("<strong> Plugin Management</strong>", "98%", $colors["header"], "3", "center", "");
1567 + print "<tr><td><table width='100%'>";
1569 + //update_info_table();
1571 + switch ($current_tab) {
1573 + update_show_current();
1575 + case 'uninstalled':
1576 + update_show_uninstalled ();
1579 + print '<br><br><br>';
1583 + $last_check = read_config_option("plugin_update_last_check");
1584 + if ($last_check < 1)
1587 + print "<center>Last Scanned : " . ($last_check > 0 ? date("F j, Y g:i:s a", $last_check) : "Never") . "</center>";
1589 + print "</table></td></tr>";
1593 + include("./include/bottom_footer.php");
1595 +function update_show_updates () {
1596 + global $pluginslist, $colors, $config, $plugin_architecture;
1599 + sort($pluginslist);
1601 + $cinfo = update_get_plugin_info ();
1605 + $info = update_get_cached_plugin_info();
1607 + $cactinew = update_check_if_newer($cinfo['cacti']['version'], $info['cacti']['version']) ;
1608 + if (isset($cinfo['cacti_plugin_arch']['version']))
1609 + $archnew = update_check_if_newer($cinfo['cacti_plugin_arch']['version'], $info['cacti_plugin_arch']['version']);
1615 + print "<tr><td width='25%' valign=top><table width='100%'>";
1616 + html_header(array("Cacti"), 2);
1617 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1618 + print "<td width='25%'><strong>Version:</strong></td><td>" . $config["cacti_version"] . "</td></tr>";
1619 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1620 + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info['cacti']['changes']) . "</td></tr></table>";
1622 + if (isset($plugin_architecture['version']) && $archnew) {
1624 + print "<table width='100%'>";
1625 + html_header(array("Plugin Architecture"), 2);
1626 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1627 + print "<td width='25%'><strong>Version:</strong></td><td>" . $plugin_architecture['version'] . "</td>";
1628 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1629 + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info['cacti_plugin_arch']['changes']) . "</td></tr></table>";
1631 + print "<table width='100%' cellspacing=0 cellpadding=3>";
1633 + foreach ($pluginslist as $plugin) {
1634 + if (isset($cinfo[$plugin]) && update_check_if_newer($cinfo[$plugin]['version'], $info[$plugin]['version'])) {
1636 + print "<table width='100%'>";
1637 + html_header(array((isset($cinfo[$plugin]['longname']) ? $cinfo[$plugin]['longname'] : $plugin)), 2);
1638 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1639 + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>";
1640 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1641 + print "<td><strong>Version:</strong></td><td>" . $info[$plugin]['version'] . "</td>";
1642 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1643 + 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>";
1644 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1645 + 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>";
1646 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1647 + print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info[$plugin]['changes']) . "</td>";
1649 + print "</tr></table>";
1653 + print "<br><center><b>There are currently no Updates!</b></center><br>";
1655 + html_end_box(TRUE);
1658 +function update_check_if_newer() {
1662 +function update_show_current () {
1663 + global $plugins, $pluginslist, $colors, $plugin_architecture, $config, $status_names;
1668 + $cinfo = update_get_plugin_info ();
1670 + sort($pluginslist);
1672 + $path = $config['base_path'] . '/plugins/';
1673 + $dh = opendir($path);
1674 + while (($file = readdir($dh)) !== false) {
1675 + if (is_dir("$path/$file")) {
1676 + if (file_exists("$path/$file/setup.php") && !in_array($file, $pluginslist)) {
1677 + include_once("$path/$file/setup.php");
1678 + if (!function_exists('plugin_' . $file . '_install') && function_exists($file . '_version')) {
1679 + $function = $file . '_version';
1680 + $cinfo[$file] = $function();
1681 + $cinfo[$file]['status'] = -2;
1682 + if (in_array($file, $plugins)) {
1683 + $cinfo[$file]['status'] = -1;
1685 + $pluginslist[] = $file;
1686 + } else if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) {
1687 + $function = $file . '_version';
1688 + $cinfo[$file] = $function();
1689 + $cinfo[$file]['status'] = 0;
1690 + $pluginslist[] = $file;
1697 + print "<table width='100%' cellspacing=0 cellpadding=3>";
1698 + print "<tr><td width='50%'><table width='100%'>";
1699 + html_header(array("Cacti"), 2);
1700 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1701 + print "<td width='50%'><strong>Version:</strong></td><td>" . $config["cacti_version"] . "</td></tr></table>";
1702 + print "</td><td>";
1703 + if (isset($plugin_architecture['version'])) {
1704 + print "<table width='100%'>";
1705 + html_header(array("Plugin Architecture"), 2);
1706 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1707 + print "<td width='50%'><strong>Version:</strong></td><td>" . $plugin_architecture['version'] . "</td></tr></table>";
1709 + print "</td></tr></table>";
1711 + print "<table width='100%' cellspacing=0 cellpadding=3>";
1714 + sort($pluginslist);
1715 + foreach ($pluginslist as $plugin) {
1716 + if (isset($cinfo[$plugin])) {
1719 + print "<tr><td width='50%' valign=top>";
1721 + print "</td><td valign=top>";
1723 + if (!isset($info[$plugin]['version']))
1724 + $info[$plugin]['version'] = '';
1726 + print "<table width='100%'>";
1727 + html_header(array((isset($cinfo[$plugin]['name']) ? $cinfo[$plugin]['name'] : $plugin)), 2);
1728 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1729 + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>";
1730 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1731 + 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>";
1732 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1733 + 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>";
1734 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1735 + 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>";
1736 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1737 + print "<td><strong>Status:</strong></td><td>" . $status_names[$cinfo[$plugin]['status']] . "</td>";
1739 + if ($cinfo[$plugin]['status'] > -1) {
1740 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1742 + $links = array('install' => 'Install', 'uninstall' => 'Uninstall', 'enable' => 'Enable', 'disable' => 'Disable', 'check' => 'Check');
1744 + switch ($cinfo[$plugin]['status']) {
1745 + case 0: //Not Installed
1746 + $links['install'] = "<a href='plugins.php?mode=install&id=$plugin'><b>Install</b></a>";
1748 + case 1: // Currently Active
1749 + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin'><b>Uninstall</b></a>";
1750 + $links['disable'] = "<a href='plugins.php?mode=disable&id=$plugin'><b>Disable</b></a>";
1752 + case 2: // Needs Configuring
1753 + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin'><b>Check</b></a>";
1755 + case 3: // Needs Upgrade
1756 + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin'><b>Check</b></a>";
1758 + case 4: // Installed but not active
1759 + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin'><b>Uninstall</b></a>";
1760 + $links['enable'] = "<a href='plugins.php?mode=enable&id=$plugin'><b>Enable</b></a>";
1764 + print "<td></td><td>";
1766 + foreach ($links as $temp => $link) {
1768 + if ($c < count($links))
1778 + print "</td></tr>";
1781 + if ($x > 1) $x = 0;
1785 + print "</td><td></td></tr>";
1787 + html_end_box(TRUE);
1791 +function update_show_uninstalled () {
1792 + global $pluginslist, $colors, $plugin_architecture, $config, $status_names;
1795 + sort($pluginslist);
1797 + print "<table width='100%' cellspacing=0 cellpadding=3>";
1800 + $newplugins = array();
1801 + $cinfo = array ();
1803 + $path = $config['base_path'] . '/plugins/';
1804 + $dh = opendir($path);
1805 + while (($file = readdir($dh)) !== false) {
1806 + if (is_dir("$path/$file")) {
1807 + if (file_exists("$path/$file/setup.php") && !in_array($file, $pluginslist)) {
1808 + include_once("$path/$file/setup.php");
1809 + if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) {
1810 + $function = 'plugin_' . $file . '_version';
1811 + $cinfo[$file] = $function();
1812 + $cinfo[$file]['status'] = 0;
1813 + $newplugins[] = $file;
1820 + if (count($newplugins)) {
1821 + foreach ($newplugins as $plugin) {
1822 + if (isset($cinfo[$plugin])) {
1825 + print "<tr><td width='50%'>";
1827 + print "</td><td>";
1829 + if (!isset($info[$plugin]['version']))
1830 + $info[$plugin]['version'] = '';
1832 + print "<table width='100%'>";
1833 + html_header(array((isset($cinfo[$plugin]['name']) ? $cinfo[$plugin]['name'] : $plugin)), 2);
1834 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1835 + print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>";
1836 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1837 + 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>";
1838 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1839 + 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>";
1840 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1841 + 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>";
1842 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1843 + print "<td><strong>Status:</strong></td><td>" . $status_names[$cinfo[$plugin]['status']] . "</td>";
1844 + form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1846 + $links = array('install' => 'Install', 'uninstall' => 'Uninstall', 'enable' => 'Enable', 'disable' => 'Disable', 'check' => 'Check');
1848 + switch ($cinfo[$plugin]['status']) {
1849 + case 0: //Not Installed
1850 + $links['install'] = "<a href='plugins.php?mode=install&id=$plugin&tab=uninstalled'><b>Install</b></a>";
1852 + case 1: // Currently Active
1853 + $links['uninstall'] = "<a href='plugins.php?mode=uninstall&id=$plugin&tab=uninstalled'><b>Uninstall</b></a>";
1854 + $links['disable'] = "<a href='plugins.php?mode=disable&id=$plugin&tab=uninstalled'><b>Disable</b></a>";
1856 + case 2: // Needs Configuring
1857 + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin&tab=uninstalled'><b>Check</b></a>";
1859 + case 3: // Needs Upgrade
1860 + $links['check'] = "<a href='plugins.php?mode=check&id=$plugin&tab=uninstalled'><b>Check</b></a>";
1862 + case 4: // Installed but not active
1863 + $links['enable'] = "<a href='plugins.php?mode=enable&id=$plugin&tab=uninstalled'><b>Enable</b></a>";
1867 + print "<td></td><td>";
1869 + foreach ($links as $temp => $link) {
1871 + if ($c < count($links))
1877 + print "</tr></table>";
1879 + print "</td></tr>";
1882 + if ($x > 1) $x = 0;
1886 + print "<center>There are no Uninstalled Plugins</center>";
1889 + print "</td><td></td></tr>";
1891 + html_end_box(TRUE);
1894 +function update_get_plugin_info () {
1896 + $info = db_fetch_assoc("SELECT * from plugin_config");
1897 + if (is_array($info)) {
1898 + foreach($info as $inf) {
1899 + $cinfo[$inf['directory']] = $inf;
1900 + $cinfo[$inf['directory']]['changes']='';
1906 diff -Naur cacti-0.8.7e-old/poller.php cacti-0.8.7e/poller.php
1907 --- cacti-0.8.7e-old/poller.php 2009-06-28 11:07:11.000000000 -0500
1908 +++ cacti-0.8.7e/poller.php 2009-11-21 23:06:16.000000000 -0600
1913 +api_plugin_hook('poller_top');
1915 /* record the start time */
1916 list($micro,$seconds) = split(" ", microtime());
1917 $poller_start = $seconds + $micro;
1919 $total_procs = $concurrent_processes;
1922 + $extra_args = api_plugin_hook_function ('poller_command_args', $extra_args);
1924 /* Populate each execution file with appropriate information */
1925 foreach ($polling_hosts as $item) {
1926 if ($host_count == 1) {
1927 @@ -403,9 +407,11 @@
1929 /* sleep the appripriate amount of time */
1930 if ($poller_runs_completed < $poller_runs) {
1931 + api_plugin_hook('poller_bottom');
1933 usleep($sleep_time * 1000000);
1934 db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);
1935 + api_plugin_hook('poller_top');
1937 }else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM) {
1938 cacti_log("WARNING: Cacti Polling Cycle Exceeded Poller Interval by " . $loop_end-$loop_start-$poller_interval . " seconds", TRUE, "POLLER");
1940 echo " --debug|-d Output debug information. Similar to cacti's DEBUG logging level.\n\n";
1943 +api_plugin_hook('poller_bottom');
1946 diff -Naur cacti-0.8.7e-old/user_admin.php cacti-0.8.7e/user_admin.php
1947 --- cacti-0.8.7e-old/user_admin.php 2009-06-28 11:07:11.000000000 -0500
1948 +++ cacti-0.8.7e/user_admin.php 2009-11-21 23:06:16.000000000 -0600
1953 - include_once("include/top_header.php");
1955 - include_once("include/bottom_footer.php");
1956 + if (!api_plugin_hook_function('user_admin_action', get_request_var_request("action"))) {
1957 + include_once("include/top_header.php");
1959 + include_once("include/bottom_footer.php");
1965 $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);
1966 $save["realm"] = get_request_var_post("realm", 0);
1967 $save["enabled"] = form_input_validate(get_request_var_post("enabled", ""), "enabled", "", true, 3);
1968 + $save = api_plugin_hook_function('user_admin_setup_sql_save', $save);
1970 if (!is_error_message()) {
1971 $user_id = sql_save($save, "user_auth");
1973 policy_hosts = " . get_request_var_post("policy_hosts") . ",
1974 policy_graph_templates = " . get_request_var_post("policy_graph_templates") . "
1975 WHERE id = " . get_request_var_post("id"));
1977 + api_plugin_hook('user_admin_user_save');
1982 $header_label = "[new]";
1985 + api_plugin_hook_function('user_admin_edit', (isset($user) ? get_request_var("id") : 0));
1987 html_start_box("<strong>User Management</strong> $header_label", "100%", $colors["header"], "3", "center", "");
1989 draw_edit_form(array(
1991 <td <?php print ((get_request_var("action") == "graph_settings_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='130' align='center' class='tab'>
1992 <span class='textHeader'><a href='user_admin.php?action=graph_settings_edit&id=<?php print $_GET["id"];?>'>Graph Settings</a></span>
1994 + <?php api_plugin_hook('user_admin_tab');?>
1999 }elseif (get_request_var("action") == "graph_perms_edit") {
2002 - user_realms_edit();
2003 + if (api_plugin_hook_function('user_admin_run_action', get_request_var_request("action"))) {
2004 + user_realms_edit();
2008 form_save_button("user_admin.php");
2009 diff -Naur cacti-0.8.7e-old/utilities.php cacti-0.8.7e/utilities.php
2010 --- cacti-0.8.7e-old/utilities.php 2009-06-28 11:07:11.000000000 -0500
2011 +++ cacti-0.8.7e/utilities.php 2009-11-21 23:06:16.000000000 -0600
2012 @@ -129,11 +129,14 @@
2013 include_once("./include/bottom_footer.php");
2016 - include_once("./include/top_header.php");
2019 + if (!api_plugin_hook_function('utilities_action', $_REQUEST['action'])) {
2020 + include_once('./include/top_header.php');
2022 - include_once("./include/bottom_footer.php");
2025 + include_once('./include/bottom_footer.php');
2030 @@ -1642,6 +1645,8 @@
2034 + api_plugin_hook('utilities_list');