]> git.pld-linux.org Git - packages/cacti.git/blame - cacti-plugin-0.8.7a.diff
- reverted encoding breakage
[packages/cacti.git] / cacti-plugin-0.8.7a.diff
CommitLineData
3d173e19
GS
1diff -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
4@@ -54,6 +54,8 @@
5 header("Location: index.php"); break;
6 case '3': /* default graph page */
7 header("Location: graph_view.php"); break;
8+ default:
9+ do_hook_function('login_options_navigate', $user['login_opts']);
10 }
11 }else{
12 header("Location: graph_view.php");
13diff -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
16@@ -203,6 +203,8 @@
17 header("Location: index.php"); break;
18 case '3': /* default graph page */
19 header("Location: graph_view.php"); break;
20+ default:
21+ do_hook_function('login_options_navigate', $user['login_opts']);
22 }
23 exit;
24
25@@ -253,9 +255,18 @@
26 <body bgcolor="#FFFFFF" onload="document.login.login_username.focus()">
27 <form name="login" method="post" action="<?php print basename($_SERVER["PHP_SELF"]);?>">
28 <input type="hidden" name="action" value="login">
29+<?php
30+
31+do_hook("login_before");
32+
33+$cacti_logo = $config['url_path'] . 'images/auth_login.gif';
34+$cacti_logo = do_hook_function('cacti_image', $cacti_logo);
35+
36+?>
37 <table align="center">
38 <tr>
39- <td colspan="2"><img src="images/auth_login.gif" border="0" alt=""></td>
40+ <td colspan="2"><center><?php if ($cacti_logo != '') { ?><img src="<?php echo $cacti_logo; ?>" border="0" alt=""><?php } ?></center></td>
41+
42 </tr>
43 <?php
44
45@@ -308,6 +319,7 @@
46 <td><input type="submit" value="Login"></td>
47 </tr>
48 </table>
49+<?php do_hook('login_after'); ?>
50 </form>
51 </body>
52 </html>
53diff -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
56@@ -1142,6 +1142,7 @@
57 $i = 0;
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);
64diff -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
67@@ -44,6 +44,8 @@
68 /* flush the headers now */
69 ob_end_clean();
70
71+do_hook_function('graph_image');
72+
73 session_write_close();
74
75 $graph_data_array = array();
76diff -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
79@@ -93,6 +93,7 @@
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'])); ?>
84 </td>
85 </tr>
86 <tr>
87@@ -207,6 +208,7 @@
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'])); ?>
92 </td>
93 </tr>
94 <tr>
95@@ -239,6 +241,7 @@
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'])); ?>
100 </td>
101 </tr>
102 <tr>
103diff -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
106@@ -473,7 +473,8 @@
107 </td>
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'); ?>
113 </td>
114 </tr>
115 </table>
116diff -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
119@@ -45,6 +45,8 @@
120 4 => "Convert to Graph Template"
121 );
122
123+$graph_actions = do_hook_function('graphs_action_array', $graph_actions);
124+
125 /* set default action */
126 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
127
128@@ -357,8 +359,10 @@
129 input_validate_input_number($selected_items[$i]);
130 /* ==================================================== */
131
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']);
134 }
135+ } else {
136+ do_hook_function('graphs_action_execute', $_POST['drp_action']);
137 }
138
139 header("Location: graphs.php");
140@@ -499,6 +503,11 @@
141 </td>
142 </tr>\n
143 ";
144+ } else {
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);
149 }
150
151 if (!isset($graph_array)) {
152diff -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
155@@ -44,6 +44,8 @@
156 6 => "Change Availability Options"
157 );
158
159+$device_actions = do_hook_function('device_action_array', $device_actions);
160+
161 /* set default action */
162 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
163
164@@ -309,6 +311,8 @@
165
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);
167 }
168+ } else {
169+ do_hook_function('device_action_execute', $_POST['drp_action']);
170 }
171
172 header("Location: host.php");
173@@ -445,6 +449,11 @@
174 </tr>\n
175 <input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n
176 ";
177+ } else {
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);
182 }
183
184 if (!isset($host_array)) {
185diff -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
188@@ -75,7 +75,7 @@
189 <html>
190 <head>
191 <title>Cacti</title>
192- <link href="include/main.css" rel="stylesheet">
193+ <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
194 </style>
195 </head>
196
197@@ -83,7 +83,7 @@
198
199 <table width="450" align='center'>
200 <tr>
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>
203 </tr>
204 <tr height='10'><td></td></tr>
205 <tr>
206@@ -91,7 +91,7 @@
207 need access to this particular section, please contact the Cacti administrator.</td>
208 </tr>
209 <tr>
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>
212 </tr>
213 </table>
214
215diff -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
218@@ -22,6 +22,8 @@
219 +-------------------------------------------------------------------------+
220 */
221
222+global $menu;
223+
224 $messages = array(
225 1 => array(
226 "message" => 'Save Successful.',
227@@ -595,4 +597,10 @@
228 GDC_SLASH => "/"
229 );
230
231+$plugin_architecture = array(
232+ 'version' => '1.4'
233+ );
234+
235+do_hook('config_arrays');
236+
237 ?>
238diff -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
241@@ -22,8 +22,9 @@
242 +-------------------------------------------------------------------------+
243 */
244
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);
250 }
251
252 /* file: cdef.php, action: edit */
253@@ -1153,4 +1154,6 @@
254 )
255 );
256
257+do_hook('config_form');
258+
259 ?>
260diff -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
263@@ -41,6 +41,21 @@
264 /* Default session name - Session name must contain alpha characters */
265 $cacti_session_name = "Cacti";
266
267+$plugins = array();
268+//$plugins[] = 'thold';
269+
270+/* Do not edit this line */
271+$config = array();
272+
273+/*
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 '/'
277+*/
278+
279+$config['url_path'] = '/';
280+
281+
282 /* Include configuration */
283 include(dirname(__FILE__) . "/config.php");
284
285@@ -73,7 +88,6 @@
286 "rebuild_poller_cache.php"
287 );
288
289-$config = array();
290 $colors = array();
291
292 /* this should be auto-detected, set it manually if needed */
293@@ -88,6 +102,13 @@
294 $config["include_path"] = dirname(__FILE__);
295 $config["rra_path"] = $config["base_path"] . '/rra';
296
297+define('URL_PATH', $config['url_path']);
298+
299+/* include the plugin function, we do this before everything else,
300+ incase we want to add hooks to change config options */
301+
302+include_once($config['include_path'] . '/plugins.php');
303+
304 /* colors */
305 $colors["dark_outline"] = "454E53";
306 $colors["dark_bar"] = "AEB4B7";
307diff -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 @@
311 )
312 );
313
314+do_hook('config_settings');
315+
316 ?>
317diff -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
320@@ -0,0 +1,89 @@
321+<?php
322+
323+/*
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.
326+ */
327+
328+global $plugin_hooks;
329+$plugin_hooks = array();
330+
331+function use_plugin ($name) {
332+ global $config;
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)) {
337+ $function();
338+ }
339+ }
340+}
341+
342+/**
343+ * This function executes a hook.
344+ * @param string $name Name of hook to fire
345+ * @return mixed $data
346+ */
347+function do_hook ($name) {
348+ global $plugin_hooks;
349+ $data = func_get_args();
350+ $ret = '';
351+
352+ if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
353+ foreach ($plugin_hooks[$name] as $function) {
354+ if (function_exists($function)) {
355+ $function($data);
356+ }
357+ }
358+ }
359+
360+ /* Variable-length argument lists have a slight problem when */
361+ /* passing values by reference. Pity. This is a workaround. */
362+ return $data;
363+}
364+
365+function do_hook_function($name,$parm=NULL) {
366+ global $plugin_hooks;
367+ $ret = $parm;
368+
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);
374+ }
375+ }
376+ }
377+
378+ /* Variable-length argument lists have a slight problem when */
379+ /* passing values by reference. Pity. This is a workaround. */
380+ return $ret;
381+}
382+
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 */
386+
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');
391+ }else{
392+ $user_realms = $user_auth_realms;
393+ }
394+ }
395+
396+ if ($filename != '') {
397+ if (isset($user_realms[$user_auth_realm_filenames{basename($filename)}]))
398+ return TRUE;
399+ }
400+ return FALSE;
401+}
402+
403+/* On startup, register all plugins configured for use. */
404+if (isset($plugins) && is_array($plugins)) {
405+ foreach ($plugins as $name) {
406+ use_plugin($name);
407+ }
408+}
409+
410diff -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
413@@ -92,26 +92,30 @@
414 }
415 }
416
417+$page_title = do_hook_function('page_title', 'Cacti');
418+
419 ?>
420 <html>
421 <head>
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";
427 }else{
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";
431 }
432 }
433 ?>
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'); ?>
451 </head>
452
453 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
454@@ -123,13 +127,15 @@
455 <table width="100%" cellspacing="0" cellpadding="0">
456 <tr>
457 <td nowrap>
458- &nbsp;<?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>&nbsp;
459+ &nbsp;<?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');
461+ ?>&nbsp;
462 </td>
463 <td>
464- <img src="images/cacti_backdrop2.gif" align="absmiddle">
465+ <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif" align="absmiddle">
466 </td>
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>';}?>&nbsp;&nbsp;<?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 }?>&nbsp;<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>';}?>&nbsp;&nbsp;<?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 }?>&nbsp;<br>
470 </td>
471 </tr>
472 </table>
473@@ -137,7 +143,7 @@
474 </tr>
475 <tr height="2" colspan="2" bgcolor="#183c8f" class="noprint">
476 <td colspan="2">
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>
479 </td>
480 </tr>
481 <tr height="5" bgcolor="#e9e9e9" class="noprint">
482@@ -149,7 +155,7 @@
483 </td>
484 <td align="right">
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>)&nbsp;
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>)&nbsp;
488 <?php } ?>
489 </td>
490 </tr>
491@@ -157,10 +163,10 @@
492 </td>
493 </tr>
494 <tr class="noprint">
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>
499 </td>
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;">
502
503 </td>
504 </tr>
505diff -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
508@@ -22,21 +22,25 @@
509 +-------------------------------------------------------------------------+
510 */
511
512-global $colors;
513+global $colors, $config;
514+
515+$page_title = do_hook_function('page_title', 'Cacti');
516+
517 ?>
518 <html>
519 <head>
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"] . "'\">";
530- }?>
531+ }
532+ do_hook('page_head'); ?>
533 </style>
534 </head>
535
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">
538
539 <table width="100%" cellspacing="0" cellpadding="0">
540 <tr height="37" bgcolor="#a9a9a9">
541@@ -44,10 +48,11 @@
542 <table width="100%" cellspacing="0" cellpadding="0">
543 <tr>
544 <td valign="bottom">
545- &nbsp;<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>
546- </td>
547+ &nbsp;<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');
549+ ?></td>
550 <td align="right">
551- <img src="images/cacti_backdrop.gif" align="absmiddle">
552+ <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop.gif" align="absmiddle">
553 </td>
554 </tr>
555 </table>
556@@ -55,7 +60,7 @@
557 </tr>
558 <tr height="2" bgcolor="#183c8f">
559 <td colspan="3">
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>
562 </td>
563 </tr>
564 <tr height="5" bgcolor="#e9e9e9">
565@@ -67,7 +72,7 @@
566 </td>
567 <td align="right">
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>)&nbsp;
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>)&nbsp;
571 <?php } ?>
572 </td>
573 </tr>
574@@ -75,10 +80,10 @@
575 </td>
576 </tr>
577 <tr>
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>
580- </td>
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>
584+ </td>
585+ <td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
586
587 </td>
588 </tr>
589@@ -88,9 +93,9 @@
590 <?php draw_menu();?>
591 </table>
592
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>
599 </td>
600 <td width="100%" colspan="2" valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;"><?php display_output_messages();?>
601
602diff -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
605@@ -25,6 +25,8 @@
606 include("./include/auth.php");
607 include("./include/top_header.php");
608
609+do_hook('console_before');
610+
611 ?>
612 <table width="100%" align="center">
613 <tr>
614@@ -46,6 +48,8 @@
615
616 <?php
617
618+do_hook('console_after');
619+
620 include("./include/bottom_footer.php");
621
622 ?>
623diff -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
626@@ -126,6 +126,8 @@
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);
629
630+ $save = do_hook_function('api_device_save', $save);
631+
632 $host_id = 0;
633
634 if (!is_error_message()) {
635diff -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
640 the browser */
641 function draw_navigation_text() {
642+ global $config;
643 $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array());
644
645 $nav = 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"),
657 );
658
659+ $nav = do_hook_function('draw_navigation_text', $nav);
660+
661 $current_page = basename($_SERVER["PHP_SELF"]);
662 $current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
663
664diff -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) {
673+ global $config;
674+?>
675 <tr>
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>
681 </td>
682 </tr>
683 <?php }
684@@ -670,6 +672,7 @@
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") {
688+ global $config;
689 if (empty($force_type)) {
690 if (empty($_GET[$key_field])) {
691 $img = "button_create.gif";
692@@ -690,8 +693,8 @@
693 <tr>
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'>
700 </td>
701 </tr>
702 </table>
703diff -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
706@@ -86,6 +86,7 @@
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 = "") {
710+ global $config;
711 $i = 0;
712 if (sizeof($graph_array) > 0) {
713 if ($header != "") {
714@@ -99,12 +100,13 @@
715 <table width='1' cellpadding='0'>
716 <tr>
717 <td>
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>
720 </td>
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' => '')); ?>
729 </td>
730 </tr>
731 </table>
732@@ -130,6 +132,7 @@
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 = "") {
736+ global $config;
737 $i = 0; $k = 0;
738 if (sizeof($graph_array) > 0) {
739 if ($header != "") {
740@@ -144,12 +147,12 @@
741 <table width='1' cellpadding='0'>
742 <tr>
743 <td>
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>
746 </td>
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>
754 </td>
755 </tr>
756 </table>
757@@ -532,6 +535,8 @@
758 }
759
760 while (list($item_sub_url, $item_sub_title) = each($item_title)) {
761+ $item_sub_url = $config['url_path'] . $item_sub_url;
762+
763 /* indent sub-items */
764 if ($i > 0) {
765 $prepend_string = "---&nbsp;";
766@@ -541,7 +546,7 @@
767
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";
772 }else{
773 $background = "";
774 }
775@@ -570,17 +575,18 @@
776 }else{
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";
783 }else{
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";
786 }
787 }
788 }
789 }
790 }
791
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";
794
795 print "</table></td></tr>";
796 }
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) {
801+ global $config;
802 ?>
803 <table align='center' width='100%'>
804 <tr>
805 <td width='1' valign='top'>
806- <img src='images/arrow.gif' alt='' align='absmiddle'>&nbsp;
807+ <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'>&nbsp;
808 </td>
809 <td align='right'>
810 Choose an action:
811 <?php form_dropdown("drp_action",$actions_array,"","","1","","");?>
812 </td>
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'>
816 </td>
817 </tr>
818 </table>
819diff -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
822@@ -890,7 +890,7 @@
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";
829
830 /* if we are at the end of a row, start a new one */
831@@ -899,7 +899,7 @@
832 }
833 }else{
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";
838
839 /* if we are at the end of a row, start a new one */
840@@ -909,10 +909,10 @@
841 }
842 }else{
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>";
846 print "</tr><tr>\n";
847 }else{
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>";
850 print "</tr><tr>\n";
851 }
852 }
853diff -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
856@@ -320,8 +320,11 @@
857 }
858 }
859 }
860+ do_hook_function('poller_output', $rrd_update_array);
861
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);
865+ }
866 }
867
868 return $rrds_processed;
869diff -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
872@@ -484,6 +484,10 @@
873 }
874 }
875
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'];
879+
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 @@
884 }
885 }
886
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'];
892+ }
893+
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);
899 return 0;
900 }else{
901+ $graph_data_array = do_hook_function('prep_graph_array', $graph_data_array);
902+
903 if (isset($graph_data_array["output_flag"])) {
904 $output_flag = $graph_data_array["output_flag"];
905 }else{
906 $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA;
907 }
908
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);
911+
912+ do_hook_function('rrdtool_function_graph_set_file', array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id));
913+
914+ return $output;
915 }
916 }
917 }
918diff -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
921@@ -181,6 +181,9 @@
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);
924
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'];
927+
928 return $string;
929 }
930
931diff -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
934@@ -0,0 +1,5 @@
935+<?php
936+
937+header("Location:../index.php");
938+
939+?>
940diff -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
943@@ -73,6 +73,8 @@
944 }
945 }
946
947+do_hook('poller_top');
948+
949 /* record the start time */
950 list($micro,$seconds) = split(" ", microtime());
951 $poller_start = $seconds + $micro;
952@@ -231,6 +233,8 @@
953 $method = "cmd.php";
954 }
955
956+ $extra_args = do_hook_function ('poller_command_args', $extra_args);
957+
958 /* Populate each execution file with appropriate information */
959 foreach ($polling_hosts as $item) {
960 if ($host_count == 1) {
961@@ -402,9 +406,11 @@
962
963 /* sleep the appripriate amount of time */
964 if ($poller_runs_completed < $poller_runs) {
965+ do_hook('poller_bottom');
966 db_close();
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');
970 }
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");
973@@ -420,4 +426,6 @@
974 echo " --debug|-d Output debug information. Similar to cacti's DEBUG logging level.\n\n";
975 }
976
977+do_hook('poller_bottom');
978+
979 ?>
980diff -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
983@@ -72,9 +72,11 @@
984 break;
985
986 default:
987- include_once("include/top_header.php");
988- user();
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");
992+ user();
993+ include_once("include/bottom_footer.php");
994+ }
995 break;
996 }
997
998@@ -407,6 +409,7 @@
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);
1003
1004 if (!is_error_message()) {
1005 $user_id = sql_save($save, "user_auth");
1006@@ -449,6 +452,8 @@
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"));
1010+ } else {
1011+ do_hook('user_admin_user_save');
1012 }
1013 }
1014 }
1015@@ -899,6 +904,8 @@
1016 $header_label = "[new]";
1017 }
1018
1019+ do_hook_function('user_admin_edit', (isset($user) ? get_request_var("id") : 0));
1020+
1021 html_start_box("<strong>User Management</strong> $header_label", "100%", $colors["header"], "3", "center", "");
1022
1023 draw_edit_form(array(
1024@@ -925,6 +932,7 @@
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>
1027 </td>
1028+ <?php do_hook('user_admin_tab');?>
1029 <td></td>
1030 </tr>
1031 </table>
1032@@ -938,7 +946,9 @@
1033 }elseif (get_request_var("action") == "graph_perms_edit") {
1034 graph_perms_edit();
1035 }else{
1036- user_realms_edit();
1037+ if (do_hook_function('user_admin_run_action', get_request_var_request("action"))) {
1038+ user_realms_edit();
1039+ }
1040 }
1041
1042 form_save_button("user_admin.php");
1043diff -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");
1048 break;
1049 default:
1050- include_once("./include/top_header.php");
1051
1052- utilities();
1053+ if (!do_hook_function('utilities_action', $_REQUEST['action'])) {
1054+ include_once('./include/top_header.php');
1055
1056- include_once("./include/bottom_footer.php");
1057+ utilities();
1058+
1059+ include_once('./include/bottom_footer.php');
1060+ }
1061 break;
1062 }
1063
1064@@ -1320,6 +1323,8 @@
1065
1066 <?php
1067
1068+ do_hook('utilities_list');
1069+
1070 html_end_box();
1071 }
1072
This page took 0.373741 seconds and 4 git commands to generate.