1 diff -Nuar cacti-0.8.7a-old/auth_changepassword.php cacti-0.8.7a/auth_changepassword.php
2 --- cacti-0.8.7a-old/auth_changepassword.php 2007-11-17 12:11:52.000000000 -0600
3 +++ cacti-0.8.7a/auth_changepassword.php 2007-11-18 09:38:25.000000000 -0600
5 header("Location: index.php"); break;
6 case '3': /* default graph page */
7 header("Location: graph_view.php"); break;
9 + do_hook_function('login_options_navigate', $user['login_opts']);
12 header("Location: graph_view.php");
13 diff -Nuar cacti-0.8.7a-old/auth_login.php cacti-0.8.7a/auth_login.php
14 --- cacti-0.8.7a-old/auth_login.php 2007-11-17 12:11:52.000000000 -0600
15 +++ cacti-0.8.7a/auth_login.php 2007-11-18 09:38:25.000000000 -0600
17 header("Location: index.php"); break;
18 case '3': /* default graph page */
19 header("Location: graph_view.php"); break;
21 + do_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 +do_hook("login_before");
33 +$cacti_logo = $config['url_path'] . 'images/auth_login.gif';
34 +$cacti_logo = do_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>
46 <td><input type="submit" value="Login"></td>
49 +<?php do_hook('login_after'); ?>
53 diff -Nuar cacti-0.8.7a-old/data_sources.php cacti-0.8.7a/data_sources.php
54 --- cacti-0.8.7a-old/data_sources.php 2007-11-17 12:11:52.000000000 -0600
55 +++ cacti-0.8.7a/data_sources.php 2007-11-18 09:38:25.000000000 -0600
58 if (sizeof($data_sources) > 0) {
59 foreach ($data_sources as $data_source) {
60 + $data_source = do_hook_function('data_sources_table', $data_source);
61 $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
62 $data_input_name = ((empty($data_source["data_input_name"])) ? "<em>External</em>" : $data_source["data_input_name"]);
63 $poller_interval = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0);
64 diff -Nuar cacti-0.8.7a-old/graph_image.php cacti-0.8.7a/graph_image.php
65 --- cacti-0.8.7a-old/graph_image.php 2007-11-17 12:11:52.000000000 -0600
66 +++ cacti-0.8.7a/graph_image.php 2007-11-18 09:38:25.000000000 -0600
68 /* flush the headers now */
71 +do_hook_function('graph_image');
73 session_write_close();
75 $graph_data_array = array();
76 diff -Nuar cacti-0.8.7a-old/graph.php cacti-0.8.7a/graph.php
77 --- cacti-0.8.7a-old/graph.php 2007-11-17 12:11:52.000000000 -0600
78 +++ cacti-0.8.7a/graph.php 2007-11-18 09:39:31.000000000 -0600
80 <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>
81 <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>
82 <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>
83 + <?php do_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $rra['id'], 'view_type' => $_REQUEST['view_type'])); ?>
88 <td valign='top' style='padding: 3px;' class='noprint'>
89 <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>
90 <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"];?>&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>
91 + <?php do_hook('graph_buttons', array('hook' => 'zoom', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $_GET['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?>
96 <td valign='top' style='padding: 3px;'>
97 <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>
98 <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>
99 + <?php do_hook('graph_buttons', array('hook' => 'properties', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $_GET['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?>
103 diff -Nuar cacti-0.8.7a-old/graphs_new.php cacti-0.8.7a/graphs_new.php
104 --- cacti-0.8.7a-old/graphs_new.php 2007-11-17 12:11:52.000000000 -0600
105 +++ cacti-0.8.7a/graphs_new.php 2007-11-18 09:38:25.000000000 -0600
108 <td nowrap style='white-space: nowrap;' class="textInfo" align="center" valign="top">
109 <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>
110 - <span style="white-space: nowrap; color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a>
111 + <span style="white-space: nowrap; color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a><br>
112 + <?php do_hook('graphs_new_top_links'); ?>
116 diff -Nuar cacti-0.8.7a-old/graphs.php cacti-0.8.7a/graphs.php
117 --- cacti-0.8.7a-old/graphs.php 2007-11-17 12:11:52.000000000 -0600
118 +++ cacti-0.8.7a/graphs.php 2007-11-18 09:38:25.000000000 -0600
120 4 => "Convert to Graph Template"
123 +$graph_actions = do_hook_function('graphs_action_array', $graph_actions);
125 /* set default action */
126 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
129 input_validate_input_number($selected_items[$i]);
130 /* ==================================================== */
132 - api_resize_graphs($selected_items[$i], $_POST["graph_width"], $_POST["graph_height"]);
133 + api_resize_graphs($selected_items[$i], $_POST['graph_width'], $_POST['graph_height']);
136 + do_hook_function('graphs_action_execute', $_POST['drp_action']);
139 header("Location: graphs.php");
145 + $save['drp_action'] = $_POST['drp_action'];
146 + $save['graph_list'] = $graph_list;
147 + $save['graph_array'] = $graph_array;
148 + do_hook_function('graphs_action_prepare', $save);
151 if (!isset($graph_array)) {
152 diff -Nuar cacti-0.8.7a-old/host.php cacti-0.8.7a/host.php
153 --- cacti-0.8.7a-old/host.php 2007-11-17 12:11:52.000000000 -0600
154 +++ cacti-0.8.7a/host.php 2007-11-18 09:38:25.000000000 -0600
156 6 => "Change Availability Options"
159 +$device_actions = do_hook_function('device_action_array', $device_actions);
161 /* set default action */
162 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
166 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);
169 + do_hook_function('device_action_execute', $_POST['drp_action']);
172 header("Location: host.php");
175 <input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n
178 + $save['drp_action'] = $_POST['drp_action'];
179 + $save['host_list'] = $host_list;
180 + $save['host_array'] = (isset($host_array)? $host_array : array());
181 + do_hook_function('device_action_prepare', $save);
184 if (!isset($host_array)) {
185 diff -Nuar cacti-0.8.7a-old/include/auth.php cacti-0.8.7a/include/auth.php
186 --- cacti-0.8.7a-old/include/auth.php 2007-11-17 12:11:52.000000000 -0600
187 +++ cacti-0.8.7a/include/auth.php 2007-11-18 09:38:25.000000000 -0600
192 - <link href="include/main.css" rel="stylesheet">
193 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
199 <table width="450" align='center'>
201 - <td colspan='2'><img src='images/auth_deny.gif' border='0' alt='Access Denied'></td>
202 + <td colspan='2'><img src='<?php echo $config['url_path']; ?>images/auth_deny.gif' border='0' alt='Access Denied'></td>
204 <tr height='10'><td></td></tr>
207 need access to this particular section, please contact the Cacti administrator.</td>
210 - <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='index.php'>Login</a> )</td>
211 + <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>
215 diff -Nuar cacti-0.8.7a-old/include/global_arrays.php cacti-0.8.7a/include/global_arrays.php
216 --- cacti-0.8.7a-old/include/global_arrays.php 2007-11-17 12:11:52.000000000 -0600
217 +++ cacti-0.8.7a/include/global_arrays.php 2007-11-18 09:40:22.000000000 -0600
219 +-------------------------------------------------------------------------+
226 "message" => 'Save Successful.',
231 +$plugin_architecture = array(
235 +do_hook('config_arrays');
238 diff -Nuar cacti-0.8.7a-old/include/global_form.php cacti-0.8.7a/include/global_form.php
239 --- cacti-0.8.7a-old/include/global_form.php 2007-11-17 12:11:52.000000000 -0600
240 +++ cacti-0.8.7a/include/global_form.php 2007-11-18 09:38:25.000000000 -0600
242 +-------------------------------------------------------------------------+
245 -if (!defined("VALID_HOST_FIELDS")) {
246 - 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)");
247 +if (!defined('VALID_HOST_FIELDS')) {
248 + $string = do_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)');
249 + define('VALID_HOST_FIELDS', $string);
252 /* file: cdef.php, action: edit */
253 @@ -1153,4 +1154,6 @@
257 +do_hook('config_form');
260 diff -Nuar cacti-0.8.7a-old/include/global.php cacti-0.8.7a/include/global.php
261 --- cacti-0.8.7a-old/include/global.php 2007-11-17 12:11:52.000000000 -0600
262 +++ cacti-0.8.7a/include/global.php 2007-11-18 09:38:25.000000000 -0600
264 /* Default session name - Session name must contain alpha characters */
265 $cacti_session_name = "Cacti";
268 +//$plugins[] = 'thold';
270 +/* Do not edit this line */
274 + This is full URL Path to the Cacti installation
275 + For example, if your cacti was accessible by http://server/cacti/ you would user '/cacti/'
276 + as the url path. For just http://server/ use '/'
279 +$config['url_path'] = '/';
282 /* Include configuration */
283 include(dirname(__FILE__) . "/config.php");
286 "rebuild_poller_cache.php"
292 /* this should be auto-detected, set it manually if needed */
294 $config["include_path"] = dirname(__FILE__);
295 $config["rra_path"] = $config["base_path"] . '/rra';
297 +define('URL_PATH', $config['url_path']);
299 +/* include the plugin function, we do this before everything else,
300 + incase we want to add hooks to change config options */
302 +include_once($config['include_path'] . '/plugins.php');
305 $colors["dark_outline"] = "454E53";
306 $colors["dark_bar"] = "AEB4B7";
307 diff -Nuar cacti-0.8.7a-old/include/global_settings.php cacti-0.8.7a/include/global_settings.php
308 --- cacti-0.8.7a-old/include/global_settings.php 2007-11-17 12:11:52.000000000 -0600
309 +++ cacti-0.8.7a/include/global_settings.php 2007-11-18 09:38:25.000000000 -0600
310 @@ -1083,4 +1083,6 @@
314 +do_hook('config_settings');
317 diff -Nuar cacti-0.8.7a-old/include/plugins.php cacti-0.8.7a/include/plugins.php
318 --- cacti-0.8.7a-old/include/plugins.php 1969-12-31 17:00:00.000000000 -0700
319 +++ cacti-0.8.7a/include/plugins.php 2007-11-18 09:38:25.000000000 -0600
324 + * Copyright (c) 1999-2005 The SquirrelMail Project Team (http://squirrelmail.org)
325 + * Licensed under the GNU GPL. For full terms see the file COPYING.
328 +global $plugin_hooks;
329 +$plugin_hooks = array();
331 +function use_plugin ($name) {
333 + if (file_exists($config['base_path'] . "/plugins/$name/setup.php")) {
334 + include_once($config['base_path'] . "/plugins/$name/setup.php");
335 + $function = "plugin_init_$name";
336 + if (function_exists($function)) {
343 + * This function executes a hook.
344 + * @param string $name Name of hook to fire
345 + * @return mixed $data
347 +function do_hook ($name) {
348 + global $plugin_hooks;
349 + $data = func_get_args();
352 + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
353 + foreach ($plugin_hooks[$name] as $function) {
354 + if (function_exists($function)) {
360 + /* Variable-length argument lists have a slight problem when */
361 + /* passing values by reference. Pity. This is a workaround. */
365 +function do_hook_function($name,$parm=NULL) {
366 + global $plugin_hooks;
369 + if (isset($plugin_hooks[$name])
370 + && is_array($plugin_hooks[$name])) {
371 + foreach ($plugin_hooks[$name] as $function) {
372 + if (function_exists($function)) {
373 + $ret = $function($ret);
378 + /* Variable-length argument lists have a slight problem when */
379 + /* passing values by reference. Pity. This is a workaround. */
383 +function api_user_realm_auth ($filename = '') {
384 + global $user_realms, $user_auth_realm_filenames, $user_auth_realms;
385 + /* list all realms that this user has access to */
387 + if (!isset($user_realms)) {
388 + if (read_config_option('global_auth') == 'on') {
389 + $user_realms = db_fetch_assoc('select realm_id from user_auth_realm where user_id=' . $_SESSION['sess_user_id']);
390 + $user_realms = array_rekey($user_realms, 'realm_id', 'realm_id');
392 + $user_realms = $user_auth_realms;
396 + if ($filename != '') {
397 + if (isset($user_realms[$user_auth_realm_filenames{basename($filename)}]))
403 +/* On startup, register all plugins configured for use. */
404 +if (isset($plugins) && is_array($plugins)) {
405 + foreach ($plugins as $name) {
410 diff -Nuar cacti-0.8.7a-old/include/top_graph_header.php cacti-0.8.7a/include/top_graph_header.php
411 --- cacti-0.8.7a-old/include/top_graph_header.php 2007-11-17 12:11:52.000000000 -0600
412 +++ cacti-0.8.7a/include/top_graph_header.php 2007-11-18 09:38:25.000000000 -0600
417 +$page_title = do_hook_function('page_title', 'Cacti');
422 - <title>Cacti</title>
423 + <title><?php echo $page_title; ?></title>
424 <?php if (isset($_SESSION["custom"])) {
425 if ($_SESSION["custom"]) {
426 print "<meta http-equiv=refresh content='99999'>\r\n";
428 - print "<meta http-equiv=refresh content='" . read_graph_config_option("page_refresh") . "'>\r\n";
429 + $refresh = do_hook_function('top_graph_refresh', read_graph_config_option('page_refresh'));
430 + print "<meta http-equiv=refresh content='" . $refresh . "'>\r\n";
434 - <link href="include/main.css" rel="stylesheet">
435 - <link href="images/favicon.ico" rel="shortcut icon"/>
436 - <script type="text/javascript" src="include/layout.js"></script>
437 - <script type="text/javascript" src="include/treeview/ua.js"></script>
438 - <script type="text/javascript" src="include/treeview/ftiens4.js"></script>
439 - <script type="text/javascript" src="include/jscalendar/calendar.js"></script>
440 - <script type="text/javascript" src="include/jscalendar/lang/calendar-en.js"></script>
441 - <script type="text/javascript" src="include/jscalendar/calendar-setup.js"></script>
442 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
443 + <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
444 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
445 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script>
446 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script>
447 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
448 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
449 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
450 + <?php do_hook('page_head'); ?>
453 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
454 @@ -123,13 +127,15 @@
455 <table width="100%" cellspacing="0" cellpadding="0">
458 - <?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>
459 + <?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
460 + do_hook('top_graph_header_tabs');
464 - <img src="images/cacti_backdrop2.gif" align="absmiddle">
465 + <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif" align="absmiddle">
467 <td align="right" nowrap>
468 - <?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>
469 + <?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>
475 <tr height="2" colspan="2" bgcolor="#183c8f" class="noprint">
477 - <img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
478 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
481 <tr height="5" bgcolor="#e9e9e9" class="noprint">
485 <?php if ((isset($_SESSION["sess_user_id"])) && ($using_guest_account == false)) { ?>
486 - 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>)
487 + 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>)
491 @@ -157,10 +163,10 @@
495 - <td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
496 - <img src="images/transparent_line.gif" width="<?php print read_graph_config_option("default_dual_pane_width");?>" height="2" border="0"><br>
497 + <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;">
498 + <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>
500 - <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;">
501 + <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;">
505 diff -Nuar cacti-0.8.7a-old/include/top_header.php cacti-0.8.7a/include/top_header.php
506 --- cacti-0.8.7a-old/include/top_header.php 2007-11-17 12:11:52.000000000 -0600
507 +++ cacti-0.8.7a/include/top_header.php 2007-11-18 09:38:25.000000000 -0600
509 +-------------------------------------------------------------------------+
513 +global $colors, $config;
515 +$page_title = do_hook_function('page_title', 'Cacti');
520 - <title>Cacti</title>
521 - <link href="include/main.css" rel="stylesheet">
522 - <link href="images/favicon.ico" rel="shortcut icon"/>
523 - <script type="text/javascript" src="include/layout.js"></script>
524 + <title><?php echo $page_title; ?></title>
525 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
526 + <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
527 + <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
528 <?php if (isset($refresh)) {
529 print "<meta http-equiv=refresh content=\"" . $refresh["seconds"] . "; url='" . $refresh["page"] . "'\">";
532 + do_hook('page_head'); ?>
536 -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif">
537 +<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="<?php echo $config['url_path']; ?>images/left_border.gif">
539 <table width="100%" cellspacing="0" cellpadding="0">
540 <tr height="37" bgcolor="#a9a9a9">
542 <table width="100%" cellspacing="0" cellpadding="0">
545 - <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>
547 + <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
548 + do_hook('top_header_tabs');
551 - <img src="images/cacti_backdrop.gif" align="absmiddle">
552 + <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop.gif" align="absmiddle">
558 <tr height="2" bgcolor="#183c8f">
560 - <img src="images/transparent_line.gif" height="2" border="0"><br>
561 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" height="2" border="0"><br>
564 <tr height="5" bgcolor="#e9e9e9">
568 <?php if (read_config_option("auth_method") != 0) { ?>
569 - 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>)
570 + 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>)
578 - <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;">
579 - <img src="images/transparent_line.gif" width="135" height="2" border="0"><br>
581 - <td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
582 + <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;">
583 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="2" border="0"><br>
585 + <td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
593 - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
594 - <p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
595 - <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
596 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
597 + <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>
598 + <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
600 <td width="100%" colspan="2" valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;"><?php display_output_messages();?>
602 diff -Nuar cacti-0.8.7a-old/index.php cacti-0.8.7a/index.php
603 --- cacti-0.8.7a-old/index.php 2007-11-17 12:11:52.000000000 -0600
604 +++ cacti-0.8.7a/index.php 2007-11-18 09:38:25.000000000 -0600
606 include("./include/auth.php");
607 include("./include/top_header.php");
609 +do_hook('console_before');
612 <table width="100%" align="center">
618 +do_hook('console_after');
620 include("./include/bottom_footer.php");
623 diff -Nuar cacti-0.8.7a-old/lib/api_device.php cacti-0.8.7a/lib/api_device.php
624 --- cacti-0.8.7a-old/lib/api_device.php 2007-11-17 12:11:52.000000000 -0600
625 +++ cacti-0.8.7a/lib/api_device.php 2007-11-18 09:38:25.000000000 -0600
627 $save["ping_retries"] = form_input_validate($ping_retries, "ping_retries", "^[0-9]+$", true, 3);
628 $save["max_oids"] = form_input_validate($max_oids, "max_oids", "^[0-9]+$", true, 3);
630 + $save = do_hook_function('api_device_save', $save);
634 if (!is_error_message()) {
635 diff -Nuar cacti-0.8.7a-old/lib/functions.php cacti-0.8.7a/lib/functions.php
636 --- cacti-0.8.7a-old/lib/functions.php 2007-11-17 12:11:52.000000000 -0600
637 +++ cacti-0.8.7a/lib/functions.php 2007-11-18 09:38:26.000000000 -0600
638 @@ -1476,6 +1476,7 @@
639 /* draw_navigation_text - determines the top header navigation text for the current page and displays it to
641 function draw_navigation_text() {
643 $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array());
646 @@ -1488,7 +1489,7 @@
647 "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
648 "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
649 "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"),
650 - "index.php:" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"),
651 + "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"),
652 "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"),
653 "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"),
654 "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"),
655 @@ -1565,6 +1566,8 @@
656 "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
659 + $nav = do_hook_function('draw_navigation_text', $nav);
661 $current_page = basename($_SERVER["PHP_SELF"]);
662 $current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
664 diff -Nuar cacti-0.8.7a-old/lib/html_form.php cacti-0.8.7a/lib/html_form.php
665 --- cacti-0.8.7a-old/lib/html_form.php 2007-11-17 12:11:52.000000000 -0600
666 +++ cacti-0.8.7a/lib/html_form.php 2007-11-18 09:38:26.000000000 -0600
667 @@ -655,11 +655,13 @@
668 on a confirmation form
669 @arg $cancel_url - the url to go to when the user clicks 'cancel'
670 @arg $action_url - the url to go to when the user clicks 'delete' */
671 -function form_confirm_buttons($action_url, $cancel_url) { ?>
672 +function form_confirm_buttons($action_url, $cancel_url) {
676 <td bgcolor="#E1E1E1">
677 - <a href="<?php print $cancel_url;?>"><img src="images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a>
678 - <a href="<?php print $action_url . "&confirm=yes";?>"><img src="images/button_delete.gif" border="0" alt="Delete" align="absmiddle"></a>
679 + <a href="<?php print $cancel_url;?>"><img src="<?php print $config['url_path'] ?>images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a>
680 + <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>
685 @arg $force_type - if specified, will force the 'action' button to be either
686 'save' or 'create'. otherwise this field should be properly auto-detected */
687 function form_save_button($cancel_url, $force_type = "", $key_field = "id") {
689 if (empty($force_type)) {
690 if (empty($_GET[$key_field])) {
691 $img = "button_create.gif";
694 <td bgcolor="#f5f5f5" align="right">
695 <input type='hidden' name='action' value='save'>
696 - <a href='<?php print $cancel_url;?>'><img src='images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
697 - <input type='image' src='images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
698 + <a href='<?php print $cancel_url;?>'><img src='<?php echo $config['url_path']; ?>images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
699 + <input type='image' src='<?php echo $config['url_path']; ?>images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
703 diff -Nuar cacti-0.8.7a-old/lib/html.php cacti-0.8.7a/lib/html.php
704 --- cacti-0.8.7a-old/lib/html.php 2007-11-17 12:11:52.000000000 -0600
705 +++ cacti-0.8.7a/lib/html.php 2007-11-18 09:44:04.000000000 -0600
707 @arg $extra_url_args - extra arguments to append to the url
708 @arg $header - html to use as a header */
709 function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
712 if (sizeof($graph_array) > 0) {
715 <table width='1' cellpadding='0'>
718 - <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>
719 + <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>
721 <td valign='top' style='padding: 3px;' class='noprint'>
722 - <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>
723 - <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>
724 - <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
725 + <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>
726 + <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;?>'><<?php print $config['url_path']; ?>img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
727 + <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>
728 + <?php do_hook('graph_buttons', array('hook' => 'graphs', 'local_graph_id' => $graph['local_graph_id'], 'rra' => 0, 'view_type' => '')); ?>
733 @arg $extra_url_args - extra arguments to append to the url
734 @arg $header - html to use as a header */
735 function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
738 if (sizeof($graph_array) > 0) {
740 @@ -144,12 +147,12 @@
741 <table width='1' cellpadding='0'>
744 - <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>
745 + <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>
747 <td valign='top' style='padding: 3px;'>
748 - <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>
749 - <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>
750 - <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
751 + <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>
752 + <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>
753 + <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>
760 while (list($item_sub_url, $item_sub_title) = each($item_title)) {
761 + $item_sub_url = $config['url_path'] . $item_sub_url;
763 /* indent sub-items */
765 $prepend_string = "--- ";
768 /* do not put a line between each sub-item */
769 if (($i == 0) || ($draw_sub_items == false)) {
770 - $background = "images/menu_line.gif";
771 + $background = $config['url_path'] . "images/menu_line.gif";
775 @@ -570,17 +575,18 @@
777 if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) {
778 /* draw normal (non sub-item) menu item */
779 + $item_url = $config['url_path'] . $item_url;
780 if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) {
781 - print "<tr><td class='textMenuItemSelected' background='images/menu_line.gif'><strong><a href='$item_url'>$item_title</a></strong></td></tr>\n";
782 + 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";
784 - print "<tr><td class='textMenuItem' background='images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
785 + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
792 - print "<tr><td class='textMenuItem' background='images/menu_line.gif'></td></tr>\n";
793 + print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'></td></tr>\n";
795 print "</table></td></tr>";
797 @@ -590,18 +596,19 @@
798 @arg $actions_array - an array that contains a list of possible actions. this array should
799 be compatible with the form_dropdown() function */
800 function draw_actions_dropdown($actions_array) {
803 <table align='center' width='100%'>
805 <td width='1' valign='top'>
806 - <img src='images/arrow.gif' alt='' align='absmiddle'>
807 + <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'>
811 <?php form_dropdown("drp_action",$actions_array,"","","1","","");?>
813 <td width='1' align='right'>
814 - <input type='image' src='images/button_go.gif' alt='Go'>
815 + <input type='image' src='<?php echo $config['url_path']; ?>images/button_go.gif' alt='Go'>
819 diff -Nuar cacti-0.8.7a-old/lib/html_tree.php cacti-0.8.7a/lib/html_tree.php
820 --- cacti-0.8.7a-old/lib/html_tree.php 2007-11-17 12:11:52.000000000 -0600
821 +++ cacti-0.8.7a/lib/html_tree.php 2007-11-18 09:38:26.000000000 -0600
823 if (read_graph_config_option("thumbnail_section_tree_1") == "on") {
824 if (read_graph_config_option("timespan_sel") == "on") {
825 print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img align='middle' alt='$graph_title' class='graphimage' id='graph_$local_graph_id'
826 - src='graph_image.php?local_graph_id=$local_graph_id&rra_id=0&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end() . '&graph_height=' .
827 + src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=0&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end() . '&graph_height=' .
828 read_graph_config_option("default_height") . '&graph_width=' . read_graph_config_option("default_width") . "&graph_nolegend=true' border='0'></a></td>\n";
830 /* if we are at the end of a row, start a new one */
834 print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img align='middle' alt='$graph_title' class='graphimage' id='graph_$local_graph_id'
835 - src='graph_image.php?local_graph_id=$local_graph_id&rra_id=$rra_id&graph_start=" . -(db_fetch_cell("select timespan from rra where id=$rra_id")) . '&graph_height=' .
836 + src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=$rra_id&graph_start=" . -(db_fetch_cell("select timespan from rra where id=$rra_id")) . '&graph_height=' .
837 read_graph_config_option("default_height") . '&graph_width=' . read_graph_config_option("default_width") . "&graph_nolegend=true' border='0'></a></td>\n";
839 /* if we are at the end of a row, start a new one */
840 @@ -909,10 +909,10 @@
843 if (read_graph_config_option("timespan_sel") == "on") {
844 - print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img class='graphimage' id='graph_$local_graph_id' src='graph_image.php?local_graph_id=$local_graph_id&rra_id=0&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end() . "' border='0' alt='$graph_title'></a></td>";
845 + print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img class='graphimage' id='graph_$local_graph_id' src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=0&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end() . "' border='0' alt='$graph_title'></a></td>";
848 - print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img class='graphimage' id='graph_$local_graph_id' src='graph_image.php?local_graph_id=$local_graph_id&rra_id=$rra_id' border='0' alt='$graph_title'></a></td>";
849 + print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img class='graphimage' id='graph_$local_graph_id' src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=$rra_id' border='0' alt='$graph_title'></a></td>";
853 diff -Nuar cacti-0.8.7a-old/lib/poller.php cacti-0.8.7a/lib/poller.php
854 --- cacti-0.8.7a-old/lib/poller.php 2007-11-17 12:11:52.000000000 -0600
855 +++ cacti-0.8.7a/lib/poller.php 2007-11-18 09:38:26.000000000 -0600
860 + do_hook_function('poller_output', $rrd_update_array);
862 - $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
863 + if (do_hook_function('poller_on_demand', $results)) {
864 + $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
868 return $rrds_processed;
869 diff -Nuar cacti-0.8.7a-old/lib/rrd.php cacti-0.8.7a/lib/rrd.php
870 --- cacti-0.8.7a-old/lib/rrd.php 2007-11-17 12:11:52.000000000 -0600
871 +++ cacti-0.8.7a/lib/rrd.php 2007-11-18 09:38:26.000000000 -0600
876 + $data = do_hook_function('rrdtool_function_graph_cache_check', array('local_graph_id' => $local_graph_id,'rra_id' => $rra_id,'rrd_struc' => $rrd_struc,'graph_data_array' => $graph_data_array, 'return' => false));
877 + if (isset($data['return']) && $data['return'] != false)
878 + return $data['return'];
880 /* find the step and how often this graph is updated with new data */
881 $ds_step = db_fetch_cell("select
882 data_template_data.rrd_step
883 @@ -1160,6 +1164,13 @@
887 + $graph_array = do_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));
888 + if (!empty($graph_array)) {
889 + $graph_defs = $graph_array['graph_defs'];
890 + $txt_graph_items = $graph_array['txt_graph_items'];
891 + $graph_opts = $graph_array['graph_opts'];
894 /* either print out the source or pass the source onto rrdtool to get us a nice PNG */
895 if (isset($graph_data_array["print_source"])) {
896 print "<PRE>" . read_config_option("path_rrdtool") . " graph $graph_opts$graph_defs$txt_graph_items</PRE>";
897 @@ -1168,13 +1179,19 @@
898 rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrd_struc);
901 + $graph_data_array = do_hook_function('prep_graph_array', $graph_data_array);
903 if (isset($graph_data_array["output_flag"])) {
904 $output_flag = $graph_data_array["output_flag"];
906 $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA;
909 - return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
910 + $output = rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
912 + do_hook_function('rrdtool_function_graph_set_file', array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id));
918 diff -Nuar cacti-0.8.7a-old/lib/variables.php cacti-0.8.7a/lib/variables.php
919 --- cacti-0.8.7a-old/lib/variables.php 2007-11-17 12:11:52.000000000 -0600
920 +++ cacti-0.8.7a/lib/variables.php 2007-11-18 09:38:26.000000000 -0600
922 $string = str_replace($l_escape_string . "host_snmp_timeout" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["snmp_timeout"], $string);
923 $string = str_replace($l_escape_string . "host_id" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["id"], $string);
925 + $temp = do_hook_function('substitute_host_data', array('string' => $string, 'l_escape_string' => $l_escape_string, 'r_escape_string' => $r_escape_string, 'host_id' => $host_id));
926 + $string = $temp['string'];
931 diff -Nuar cacti-0.8.7a-old/plugins/index.php cacti-0.8.7a/plugins/index.php
932 --- cacti-0.8.7a-old/plugins/index.php 1969-12-31 17:00:00.000000000 -0700
933 +++ cacti-0.8.7a/plugins/index.php 2007-11-18 09:38:26.000000000 -0600
937 +header("Location:../index.php");
940 diff -Nuar cacti-0.8.7a-old/poller.php cacti-0.8.7a/poller.php
941 --- cacti-0.8.7a-old/poller.php 2007-11-17 12:11:52.000000000 -0600
942 +++ cacti-0.8.7a/poller.php 2007-11-18 09:48:01.000000000 -0600
947 +do_hook('poller_top');
949 /* record the start time */
950 list($micro,$seconds) = split(" ", microtime());
951 $poller_start = $seconds + $micro;
956 + $extra_args = do_hook_function ('poller_command_args', $extra_args);
958 /* Populate each execution file with appropriate information */
959 foreach ($polling_hosts as $item) {
960 if ($host_count == 1) {
963 /* sleep the appripriate amount of time */
964 if ($poller_runs_completed < $poller_runs) {
965 + do_hook('poller_bottom');
967 usleep($sleep_time * 1000000);
968 db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);
969 + do_hook('poller_top');
971 }else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM) {
972 cacti_log("WARNING: Cacti Polling Cycle Exceeded Poller Interval by " . $loop_end-$loop_start-$poller_interval . " seconds", TRUE, "POLLER");
974 echo " --debug|-d Output debug information. Similar to cacti's DEBUG logging level.\n\n";
977 +do_hook('poller_bottom');
980 diff -Nuar cacti-0.8.7a-old/user_admin.php cacti-0.8.7a/user_admin.php
981 --- cacti-0.8.7a-old/user_admin.php 2007-11-17 12:11:52.000000000 -0600
982 +++ cacti-0.8.7a/user_admin.php 2007-11-18 09:38:26.000000000 -0600
987 - include_once("include/top_header.php");
989 - include_once("include/bottom_footer.php");
990 + if (!do_hook_function('user_admin_action', get_request_var_request("action"))) {
991 + include_once("include/top_header.php");
993 + include_once("include/bottom_footer.php");
999 $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);
1000 $save["realm"] = get_request_var_post("realm", 0);
1001 $save["enabled"] = form_input_validate(get_request_var_post("enabled", ""), "enabled", "", true, 3);
1002 + $save = do_hook_function('user_admin_setup_sql_save', $save);
1004 if (!is_error_message()) {
1005 $user_id = sql_save($save, "user_auth");
1007 policy_hosts = " . get_request_var_post("policy_hosts") . ",
1008 policy_graph_templates = " . get_request_var_post("policy_graph_templates") . "
1009 WHERE id = " . get_request_var_post("id"));
1011 + do_hook('user_admin_user_save');
1016 $header_label = "[new]";
1019 + do_hook_function('user_admin_edit', (isset($user) ? get_request_var("id") : 0));
1021 html_start_box("<strong>User Management</strong> $header_label", "100%", $colors["header"], "3", "center", "");
1023 draw_edit_form(array(
1025 <td <?php print ((get_request_var("action") == "graph_settings_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='130' align='center' class='tab'>
1026 <span class='textHeader'><a href='user_admin.php?action=graph_settings_edit&id=<?php print $_GET["id"];?>'>Graph Settings</a></span>
1028 + <?php do_hook('user_admin_tab');?>
1033 }elseif (get_request_var("action") == "graph_perms_edit") {
1036 - user_realms_edit();
1037 + if (do_hook_function('user_admin_run_action', get_request_var_request("action"))) {
1038 + user_realms_edit();
1042 form_save_button("user_admin.php");
1043 diff -Nuar cacti-0.8.7a-old/utilities.php cacti-0.8.7a/utilities.php
1044 --- cacti-0.8.7a-old/utilities.php 2007-11-17 12:11:52.000000000 -0600
1045 +++ cacti-0.8.7a/utilities.php 2007-11-18 09:38:26.000000000 -0600
1046 @@ -129,11 +129,14 @@
1047 include_once("./include/bottom_footer.php");
1050 - include_once("./include/top_header.php");
1053 + if (!do_hook_function('utilities_action', $_REQUEST['action'])) {
1054 + include_once('./include/top_header.php');
1056 - include_once("./include/bottom_footer.php");
1059 + include_once('./include/bottom_footer.php');
1064 @@ -1320,6 +1323,8 @@
1068 + do_hook('utilities_list');