]> git.pld-linux.org Git - packages/cacti.git/blame - cacti-plugin-0.8.6j.diff
- poller in sbin, no hide of errors
[packages/cacti.git] / cacti-plugin-0.8.6j.diff
CommitLineData
a633de6e
GS
1diff -Naur cacti-0.8.6j-old/auth_login.php cacti-0.8.6j/auth_login.php
2--- cacti-0.8.6j-old/auth_login.php 2007-01-23 21:01:57.000000000 -0600
3+++ cacti-0.8.6j/auth_login.php 2007-01-23 21:02:52.000000000 -0600
4@@ -111,9 +111,16 @@
5 'Location' does not work. This seems to fix the bug for me at least... -->
6 <form name="login" method="post" action="<?php print basename($_SERVER["PHP_SELF"]);?>">
7
8+<?php do_hook("login_before");
9+
10+$cacti_logo = $config['url_path'] . 'images/auth_login.gif';
11+$cacti_logo = do_hook_function('cacti_image', $cacti_logo);
12+
13+?>
14+
15 <table align="center">
16 <tr>
17- <td colspan="2"><img src="images/auth_login.gif" border="0" alt=""></td>
18+ <td colspan="2"><center><?php if ($cacti_logo != '') { ?><img src="<?php echo $cacti_logo; ?>" border="0" alt=""><?php } ?></center></td>
19 </tr>
20 <?php
21 if ($_REQUEST["action"] == "login") {?>
22@@ -155,6 +162,8 @@
23
24 <input type="hidden" name="action" value="login">
25
26+<?php do_hook("login_after"); ?>
27+
28 </form>
29
30 </body>
31diff -Naur cacti-0.8.6j-old/data_sources.php cacti-0.8.6j/data_sources.php
32--- cacti-0.8.6j-old/data_sources.php 2007-01-23 21:01:57.000000000 -0600
33+++ cacti-0.8.6j/data_sources.php 2007-01-23 21:02:52.000000000 -0600
34@@ -1072,18 +1072,25 @@
35 foreach ($data_sources as $data_source) {
36 $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
37 form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
38+
39+ $ds_table['data_source'] = $data_source;
40+ $ds_table['data_input_name'] = $data_source['data_input_name'];
41+ $ds_table['active'] = (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");
42+ $ds_table['template_name'] = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
43+ $ds_table = do_hook_function("data_sources_table", $ds_table);
44+
45 ?>
46 <td>
47 <a class='linkEditMain' href='data_sources.php?action=ds_edit&id=<?php print $data_source["local_data_id"];?>' title='<?php print $data_source["name_cache"];?>'><?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim($data_source["name_cache"], read_config_option("max_title_data_source"))); }else{ print title_trim($data_source["name_cache"], read_config_option("max_title_data_source")); } ?></a>
48 </td>
49 <td>
50- <?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_source["data_input_name"]); }else{ print $data_source["data_input_name"]; } ?></a>
51+ <?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $ds_table['data_input_name']); }else{ print $ds_table['data_input_name']; } ?></a>
52 </td>
53 <td>
54- <?php print (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");?>
55+ <?php print $ds_table['active']; ?>
56 </td>
57 <td>
58- <?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_template_name); }else{ print $data_template_name; } ?></a>
59+ <?php if ($_REQUEST["filter"] != "") { print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $ds_table['template_name']); }else{ print $ds_table['template_name']; } ?></a>
60 </td>
61 <td style="<?php print get_checkbox_style();?>" width="1%" align="right">
62 <input type='checkbox' style='margin: 0px;' name='chk_<?php print $data_source["local_data_id"];?>' title="<?php print $data_source["name_cache"];?>">
63diff -Naur cacti-0.8.6j-old/graph_image.php cacti-0.8.6j/graph_image.php
64--- cacti-0.8.6j-old/graph_image.php 2007-01-23 21:01:57.000000000 -0600
65+++ cacti-0.8.6j/graph_image.php 2007-01-23 21:02:52.000000000 -0600
66@@ -46,6 +46,8 @@
67 /* flush the headers now */
68 ob_end_flush();
69
70+do_hook_function('graph_image');
71+
72 session_write_close();
73
74 $graph_data_array = array();
75diff -Naur cacti-0.8.6j-old/graph.php cacti-0.8.6j/graph.php
76--- cacti-0.8.6j-old/graph.php 2007-01-23 21:01:57.000000000 -0600
77+++ cacti-0.8.6j/graph.php 2007-01-23 14:54:36.000000000 -0600
78@@ -94,6 +94,7 @@
79 <td valign='top' style='padding: 3px;' class='noprint'>
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.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>
82+ <?php do_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => $_GET["local_graph_id"], 'rra' => $rra["id"], 'view_type' => $_REQUEST["view_type"])); ?>
83 </td>
84 </tr>
85 <tr>
86@@ -208,6 +209,7 @@
87 </td>
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+ <?php do_hook('graph_buttons', array('hook' => 'zoom', 'local_graph_id' => $_GET["local_graph_id"], 'rra' => $_GET["rra_id"], 'view_type' => $_REQUEST["view_type"])); ?>
91 </td>
92 </tr>
93 <tr>
94@@ -239,6 +241,7 @@
95 </td>
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+ <?php do_hook('graph_buttons', array('hook' => 'properties', 'local_graph_id' => $_GET["local_graph_id"], 'rra' => $_GET["rra_id"], 'view_type' => $_REQUEST["view_type"])); ?>
99 </td>
100 </tr>
101 <tr>
102@@ -259,4 +262,4 @@
103
104 include_once("./include/bottom_footer.php");
105
106-?>
107+?>
108\ No newline at end of file
109diff -Naur cacti-0.8.6j-old/graphs_new.php cacti-0.8.6j/graphs_new.php
110--- cacti-0.8.6j-old/graphs_new.php 2007-01-23 21:01:57.000000000 -0600
111+++ cacti-0.8.6j/graphs_new.php 2007-01-23 21:02:52.000000000 -0600
112@@ -405,7 +405,8 @@
113 </td>
114 <td class="textInfo" rowspan="2" valign="top">
115 <span style="color: #c16921;">*</span><a href="host.php?action=edit&id=<?php print $_REQUEST["host_id"];?>">Edit this Host</a><br>
116- <span style="color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a>
117+ <span style="color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a><br>
118+ <?php do_hook("graphs_new_top_links"); ?>
119 </td>
120 </tr>
121 <td>
122diff -Naur cacti-0.8.6j-old/graphs.php cacti-0.8.6j/graphs.php
123--- cacti-0.8.6j-old/graphs.php 2007-01-23 21:01:57.000000000 -0600
124+++ cacti-0.8.6j/graphs.php 2007-01-23 21:02:52.000000000 -0600
125@@ -47,6 +47,8 @@
126 4 => "Convert to Graph Template"
127 );
128
129+$graph_actions = do_hook_function('graphs_action_array', $graph_actions);
130+
131 /* set default action */
132 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
133
134@@ -357,8 +359,10 @@
135 input_validate_input_number($selected_items[$i]);
136 /* ==================================================== */
137
138- api_resize_graphs($selected_items[$i], $_POST["graph_width"], $_POST["graph_height"]);
139+ api_resize_graphs($selected_items[$i], $_POST['graph_width'], $_POST['graph_height']);
140 }
141+ } else {
142+ do_hook_function('graphs_action_execute', $_POST['drp_action']);
143 }
144
145 header("Location: graphs.php");
146@@ -499,6 +503,11 @@
147 </td>
148 </tr>\n
149 ";
150+ } else {
151+ $save['drp_action'] = $_POST['drp_action'];
152+ $save['graph_list'] = $graph_list;
153+ $save['graph_array'] = $graph_array;
154+ do_hook_function('graphs_action_prepare', $save);
155 }
156
157 if (!isset($graph_array)) {
158@@ -1149,4 +1158,4 @@
159 print "</form>\n";
160 }
161
162-?>
163+?>
164\ No newline at end of file
165diff -Naur cacti-0.8.6j-old/host.php cacti-0.8.6j/host.php
166--- cacti-0.8.6j-old/host.php 2007-01-23 21:01:57.000000000 -0600
167+++ cacti-0.8.6j/host.php 2007-01-23 21:02:52.000000000 -0600
168@@ -44,6 +44,8 @@
169 5 => "Clear Statistics"
170 );
171
172+$device_actions = do_hook_function('device_action_array', $device_actions);
173+
174 /* set default action */
175 if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
176
177@@ -280,6 +282,8 @@
178
179 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);
180 }
181+ } else {
182+ do_hook_function('device_action_execute', $_POST['drp_action']);
183 }
184
185 header("Location: host.php");
186@@ -385,6 +389,11 @@
187 </tr>\n
188 <input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n
189 ";
190+ } else {
191+ $save['drp_action'] = $_POST['drp_action'];
192+ $save['host_list'] = $host_list;
193+ $save['host_array'] = (isset($host_array)? $host_array : array());
194+ do_hook_function('device_action_prepare', $save);
195 }
196
197 if (!isset($host_array)) {
198diff -Naur cacti-0.8.6j-old/include/auth.php cacti-0.8.6j/include/auth.php
199--- cacti-0.8.6j-old/include/auth.php 2007-01-23 21:01:57.000000000 -0600
200+++ cacti-0.8.6j/include/auth.php 2007-01-23 21:02:52.000000000 -0600
201@@ -77,7 +77,7 @@
202 <html>
203 <head>
204 <title>Cacti</title>
205- <link href="include/main.css" rel="stylesheet">
206+ <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
207 </style>
208 </head>
209
210@@ -85,7 +85,7 @@
211
212 <table width="450" align='center'>
213 <tr>
214- <td colspan='2'><img src='images/auth_deny.gif' border='0' alt='Access Denied'></td>
215+ <td colspan='2'><img src='<?php echo $config['url_path']; ?>images/auth_deny.gif' border='0' alt='Access Denied'></td>
216 </tr>
217 <tr height='10'><td></td></tr>
218 <tr>
219@@ -93,7 +93,7 @@
220 need access to this particular section, please contact the Cacti administrator.</td>
221 </tr>
222 <tr>
223- <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='logout.php'>Login</a> )</td>
224+ <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='<?php echo $config['url_path']; ?>logout.php'>Login</a> )</td>
225 </tr>
226 </table>
227
228diff -Naur cacti-0.8.6j-old/include/config_arrays.php cacti-0.8.6j/include/config_arrays.php
229--- cacti-0.8.6j-old/include/config_arrays.php 2007-01-23 21:01:57.000000000 -0600
230+++ cacti-0.8.6j/include/config_arrays.php 2007-01-23 21:02:52.000000000 -0600
231@@ -24,6 +24,8 @@
232 +-------------------------------------------------------------------------+
233 */
234
235+global $menu;
236+
237 $messages = array(
238 1 => array(
239 "message" => 'Save Successful.',
240@@ -452,4 +454,10 @@
241 GDC_SLASH => "/"
242 );
243
244-?>
245+$plugin_architecture = array(
246+ "version" => '1.1'
247+ );
248+
249+do_hook("config_arrays");
250+
251+?>
252\ No newline at end of file
253diff -Naur cacti-0.8.6j-old/include/config_form.php cacti-0.8.6j/include/config_form.php
254--- cacti-0.8.6j-old/include/config_form.php 2007-01-23 21:01:57.000000000 -0600
255+++ cacti-0.8.6j/include/config_form.php 2007-01-23 21:02:52.000000000 -0600
256@@ -25,7 +25,8 @@
257 */
258
259 if (!defined("VALID_HOST_FIELDS")) {
260- define("VALID_HOST_FIELDS", "(hostname|snmp_community|snmp_username|snmp_password|snmp_version|snmp_port|snmp_timeout)");
261+ $string = do_hook_function('valid_host_fields', '(hostname|snmp_community|snmp_username|snmp_password|snmp_version|snmp_port|snmp_timeout)');
262+ define("VALID_HOST_FIELDS", $string);
263 }
264
265 /* file: cdef.php, action: edit */
266@@ -1000,4 +1001,6 @@
267 )
268 );
269
270-?>
271+do_hook("config_form");
272+
273+?>
274\ No newline at end of file
275diff -Naur cacti-0.8.6j-old/include/config.php cacti-0.8.6j/include/config.php
276--- cacti-0.8.6j-old/include/config.php 2007-01-23 21:01:57.000000000 -0600
277+++ cacti-0.8.6j/include/config.php 2007-01-23 21:02:52.000000000 -0600
278@@ -32,6 +32,22 @@
279 $database_password = "cactiuser";
280 $database_port = "3306";
281
282+$plugins = array();
283+//$plugins[] = 'thold';
284+
285+/* Do not edit this line */
286+$config = array();
287+
288+
289+/*
290+ This is full URL Path to the Cacti installation
291+ For example, if your cacti was accessible by http://server/cacti/ you would user '/cacti/'
292+ as the url path. For just http://server/ use '/'
293+*/
294+
295+$config['url_path'] = '/';
296+
297+
298 /* ----- you probably do not need to change anything below this line ----- */
299
300 /* Files that do not need http header information - Command line scripts */
301@@ -52,7 +68,7 @@
302 "ss_sql.php"
303 );
304
305-$config = array();
306+
307 $colors = array();
308
309 /* this should be auto-detected, set it manually if needed */
310@@ -66,6 +82,13 @@
311 $config["library_path"] = ereg_replace("(.*[\/\\])include", "\\1lib", dirname(__FILE__));
312 $config["include_path"] = dirname(__FILE__);
313
314+define('URL_PATH', $config['url_path']);
315+
316+/* include the plugin function, we do this before everything else,
317+ incase we want to add hooks to change config options */
318+
319+include_once($config["include_path"] . "/plugins.php");
320+
321 /* colors */
322 $colors["dark_outline"] = "454E53";
323 $colors["dark_bar"] = "AEB4B7";
324@@ -169,4 +192,4 @@
325 /* current cacti version */
326 $config["cacti_version"] = "0.8.6j";
327
328-?>
329+?>
330\ No newline at end of file
331diff -Naur cacti-0.8.6j-old/include/config_settings.php cacti-0.8.6j/include/config_settings.php
332--- cacti-0.8.6j-old/include/config_settings.php 2007-01-23 21:01:57.000000000 -0600
333+++ cacti-0.8.6j/include/config_settings.php 2007-01-23 21:02:52.000000000 -0600
334@@ -928,4 +928,6 @@
335 )
336 );
337
338-?>
339+do_hook("config_settings");
340+
341+?>
342\ No newline at end of file
343diff -Naur cacti-0.8.6j-old/include/plugins.php cacti-0.8.6j/include/plugins.php
344--- cacti-0.8.6j-old/include/plugins.php 1969-12-31 17:00:00.000000000 -0700
345+++ cacti-0.8.6j/include/plugins.php 2007-01-23 21:02:52.000000000 -0600
346@@ -0,0 +1,70 @@
347+<?php
348+
349+/*
350+ * Copyright (c) 1999-2005 The SquirrelMail Project Team (http://squirrelmail.org)
351+ * Licensed under the GNU GPL. For full terms see the file COPYING.
352+ */
353+
354+global $plugin_hooks;
355+$plugin_hooks = array();
356+
357+function use_plugin ($name) {
358+ global $config;
359+ if (file_exists($config["base_path"] . "/plugins/$name/setup.php")) {
360+ include_once($config["base_path"] . "/plugins/$name/setup.php");
361+ $function = "plugin_init_$name";
362+ if (function_exists($function)) {
363+ $function();
364+ }
365+ }
366+}
367+
368+/**
369+ * This function executes a hook.
370+ * @param string $name Name of hook to fire
371+ * @return mixed $data
372+ */
373+function do_hook ($name) {
374+ global $plugin_hooks;
375+ $data = func_get_args();
376+ $ret = '';
377+
378+ if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
379+ foreach ($plugin_hooks[$name] as $function) {
380+ if (function_exists($function)) {
381+ $function($data);
382+ }
383+ }
384+ }
385+
386+ /* Variable-length argument lists have a slight problem when */
387+ /* passing values by reference. Pity. This is a workaround. */
388+ return $data;
389+}
390+
391+function do_hook_function($name,$parm=NULL) {
392+ global $plugin_hooks;
393+ $ret = $parm;
394+
395+ if (isset($plugin_hooks[$name])
396+ && is_array($plugin_hooks[$name])) {
397+ foreach ($plugin_hooks[$name] as $function) {
398+ if (function_exists($function)) {
399+ $ret = $function($ret);
400+ }
401+ }
402+ }
403+
404+ /* Variable-length argument lists have a slight problem when */
405+ /* passing values by reference. Pity. This is a workaround. */
406+ return $ret;
407+}
408+
409+/* On startup, register all plugins configured for use. */
410+if (isset($plugins) && is_array($plugins)) {
411+ foreach ($plugins as $name) {
412+ use_plugin($name);
413+ }
414+}
415+
416+?>
417\ No newline at end of file
418diff -Naur cacti-0.8.6j-old/include/top_graph_header.php cacti-0.8.6j/include/top_graph_header.php
419--- cacti-0.8.6j-old/include/top_graph_header.php 2007-01-23 21:01:57.000000000 -0600
420+++ cacti-0.8.6j/include/top_graph_header.php 2007-01-23 21:02:52.000000000 -0600
421@@ -97,17 +97,18 @@
422 if ($_SESSION["custom"]) {
423 print "<meta http-equiv=refresh content='99999'>\r\n";
424 }else{
425- print "<meta http-equiv=refresh content='" . read_graph_config_option("page_refresh") . "'>\r\n";
426+ $refresh = do_hook_function("top_graph_refresh", read_graph_config_option("page_refresh"));
427+ print "<meta http-equiv=refresh content='" . $refresh . "'>\r\n";
428 }
429 }
430 ?>
431- <link href="include/main.css" rel="stylesheet">
432+ <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
433
434- <script type="text/javascript" src="include/treeview/ua.js"></script>
435- <script type="text/javascript" src="include/treeview/ftiens4.js"></script>
436- <script type="text/javascript" src="include/jscalendar/calendar.js"></script>
437- <script type="text/javascript" src="include/jscalendar/lang/calendar-en.js"></script>
438- <script type="text/javascript" src="include/jscalendar/calendar-setup.js"></script>
439+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script>
440+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script>
441+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
442+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
443+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
444 </head>
445
446 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
447@@ -118,13 +119,14 @@
448 <table width="100%" cellspacing="0" cellpadding="0">
449 <tr>
450 <td nowrap>
451- &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.gif" alt="Graphs" align="absmiddle" border="0"></a>&nbsp;
452- </td>
453+ &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.gif" alt="Graphs" align="absmiddle" border="0"></a><?php
454+ do_hook("top_graph_header_tabs");
455+ ?>&nbsp; </td>
456 <td>
457- <img src="images/cacti_backdrop2.gif" align="absmiddle">
458+ <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif" align="absmiddle">
459 </td>
460 <td align="right" nowrap>
461- <?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>
462+ <?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>
463 </td>
464 </tr>
465 </table>
466@@ -132,7 +134,7 @@
467 </tr>
468 <tr height="2" colspan="2" bgcolor="#183c8f" class="noprint">
469 <td colspan="2">
470- <img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
471+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
472 </td>
473 </tr>
474 <tr height="5" bgcolor="#e9e9e9" class="noprint">
475@@ -144,7 +146,7 @@
476 </td>
477 <td align="right">
478 <?php if ((isset($_SESSION["sess_user_id"])) && ($using_guest_account == false)) { ?>
479- 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;
480+ 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;
481 <?php } ?>
482 </td>
483 </tr>
484@@ -152,10 +154,10 @@
485 </td>
486 </tr>
487 <tr class="noprint">
488- <td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
489- <img src="images/transparent_line.gif" width="<?php print read_graph_config_option("default_dual_pane_width");?>" height="2" border="0"><br>
490+ <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;">
491+ <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>
492 </td>
493- <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;">
494+ <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;">
495
496 </td>
497 </tr>
498@@ -203,4 +205,4 @@
499 <?php } ?>
500 </td>
501 <?php } ?>
502- <td valign="top">
503+ <td valign="top">
504\ No newline at end of file
505diff -Naur cacti-0.8.6j-old/include/top_header.php cacti-0.8.6j/include/top_header.php
506--- cacti-0.8.6j-old/include/top_header.php 2007-01-23 21:01:57.000000000 -0600
507+++ cacti-0.8.6j/include/top_header.php 2007-01-23 21:02:52.000000000 -0600
508@@ -24,20 +24,20 @@
509 +-------------------------------------------------------------------------+
510 */
511
512-global $colors;
513+global $colors, $config;
514 ?>
515 <html>
516 <head>
517 <title>cacti</title>
518- <link href="include/main.css" rel="stylesheet">
519- <script type="text/javascript" src="include/layout.js"></script>
520+ <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
521+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
522 <?php if (isset($refresh)) {
523 print "<meta http-equiv=refresh content=\"" . $refresh["seconds"] . "; url='" . $refresh["page"] . "'\">";
524 }?>
525 </style>
526 </head>
527
528-<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif">
529+<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="<?php echo $config['url_path']; ?>images/left_border.gif">
530
531 <table width="100%" cellspacing="0" cellpadding="0">
532 <tr height="37" bgcolor="#a9a9a9">
533@@ -45,10 +45,11 @@
534 <table width="100%" cellspacing="0" cellpadding="0">
535 <tr>
536 <td valign="bottom">
537- &nbsp;<a href="index.php"><img src="images/tab_console.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>
538- </td>
539+ &nbsp;<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><a href="<?php echo $config['url_path']; ?>graph_view.php"><img src="<?php echo $config['url_path']; ?>images/tab_graphs.gif" alt="Console" align="absmiddle" border="0"></a><?php
540+ do_hook("top_header_tabs");
541+ ?></td>
542 <td align="right">
543- <img src="images/cacti_backdrop.gif" align="absmiddle">
544+ <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop.gif" align="absmiddle">
545 </td>
546 </tr>
547 </table>
548@@ -56,7 +57,7 @@
549 </tr>
550 <tr height="2" bgcolor="#183c8f">
551 <td colspan="3">
552- <img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
553+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
554 </td>
555 </tr>
556 <tr height="5" bgcolor="#e9e9e9">
557@@ -68,7 +69,7 @@
558 </td>
559 <td align="right">
560 <?php if (read_config_option("global_auth") == "on") { ?>
561- 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;
562+ 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;
563 <?php } ?>
564 </td>
565 </tr>
566@@ -76,10 +77,10 @@
567 </td>
568 </tr>
569 <tr>
570- <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;">
571- <img src="images/transparent_line.gif" width="135" height="2" border="0"><br>
572- </td>
573- <td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
574+ <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;">
575+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="2" border="0"><br>
576+ </td>
577+ <td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
578
579 </td>
580 </tr>
581@@ -89,9 +90,9 @@
582 <?php draw_menu();?>
583 </table>
584
585- <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
586- <p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
587- <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
588+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
589+ <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>
590+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
591 </td>
592 <td></td>
593 </tr>
594diff -Naur cacti-0.8.6j-old/index.php cacti-0.8.6j/index.php
595--- cacti-0.8.6j-old/index.php 2007-01-23 21:01:57.000000000 -0600
596+++ cacti-0.8.6j/index.php 2007-01-23 21:02:52.000000000 -0600
597@@ -27,6 +27,8 @@
598 include("./include/auth.php");
599 include("./include/top_header.php");
600
601+do_hook("console_before");
602+
603 ?>
604 <table width="98%" align="center">
605 <tr>
606@@ -44,6 +46,8 @@
607 </table>
608 <?php
609
610+do_hook("console_after");
611+
612 include("./include/bottom_footer.php");
613
614 ?>
615diff -Naur cacti-0.8.6j-old/lib/api_device.php cacti-0.8.6j/lib/api_device.php
616--- cacti-0.8.6j-old/lib/api_device.php 2007-01-23 21:01:57.000000000 -0600
617+++ cacti-0.8.6j/lib/api_device.php 2007-01-23 21:02:52.000000000 -0600
618@@ -76,6 +76,8 @@
619 $save["snmp_timeout"] = form_input_validate($snmp_timeout, "snmp_timeout", "^[0-9]+$", false, 3);
620 $save["disabled"] = form_input_validate($disabled, "disabled", "", true, 3);
621
622+ $save = do_hook_function("api_device_save", $save);
623+
624 $host_id = 0;
625
626 if (!is_error_message()) {
627@@ -123,4 +125,4 @@
628 return $host_id;
629 }
630
631-?>
632+?>
633\ No newline at end of file
634diff -Naur cacti-0.8.6j-old/lib/functions.php cacti-0.8.6j/lib/functions.php
635--- cacti-0.8.6j-old/lib/functions.php 2007-01-23 21:01:57.000000000 -0600
636+++ cacti-0.8.6j/lib/functions.php 2007-01-23 21:02:52.000000000 -0600
637@@ -620,6 +620,8 @@
638 }
639 }
640
641+ do_hook_function("update_host_status", array('issue_log_message' => $issue_log_message, 'status' => $status, 'host_id' => $host_id, 'hosts' => $hosts));
642+
643 db_execute("update host set
644 status = '" . $hosts[$host_id]["status"] . "',
645 status_event_count = '" . $hosts[$host_id]["status_event_count"] . "',
646@@ -1323,6 +1325,7 @@
647 /* draw_navigation_text - determines the top header navigation text for the current page and displays it to
648 the browser */
649 function draw_navigation_text() {
650+ global $config;
651 $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array());
652
653 $nav = array(
654@@ -1335,7 +1338,7 @@
655 "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
656 "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
657 "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"),
658- "index.php:" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"),
659+ "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"),
660 "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"),
661 "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"),
662 "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"),
663@@ -1410,6 +1413,8 @@
664 "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
665 );
666
667+ $nav = do_hook_function("draw_navigation_text", $nav);
668+
669 $current_page = basename($_SERVER["PHP_SELF"]);
670 $current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
671
672@@ -1721,4 +1726,4 @@
673 return $string;
674 }
675
676-?>
677+?>
678\ No newline at end of file
679diff -Naur cacti-0.8.6j-old/lib/html_form.php cacti-0.8.6j/lib/html_form.php
680--- cacti-0.8.6j-old/lib/html_form.php 2007-01-23 21:01:57.000000000 -0600
681+++ cacti-0.8.6j/lib/html_form.php 2007-01-23 21:02:52.000000000 -0600
682@@ -419,11 +419,13 @@
683 on a confirmation form
684 @arg $cancel_url - the url to go to when the user clicks 'cancel'
685 @arg $action_url - the url to go to when the user clicks 'delete' */
686-function form_confirm_buttons($action_url, $cancel_url) { ?>
687+function form_confirm_buttons($action_url, $cancel_url) {
688+ global $config;
689+ ?>
690 <tr>
691 <td bgcolor="#E1E1E1">
692- <a href="<?php print $cancel_url;?>"><img src="images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a>
693- <a href="<?php print $action_url . "&confirm=yes";?>"><img src="images/button_delete.gif" border="0" alt="Delete" align="absmiddle"></a>
694+ <a href="<?php print $cancel_url;?>"><img src="<?php print $config['url_path'] ?>images/button_cancel.gif" border="0" alt="Cancel" align="absmiddle"></a>
695+ <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>
696 </td>
697 </tr>
698 <?php }
699@@ -434,6 +436,7 @@
700 @arg $force_type - if specified, will force the 'action' button to be either
701 'save' or 'create'. otherwise this field should be properly auto-detected */
702 function form_save_button($cancel_url, $force_type = "", $key_field = "id") {
703+ global $config;
704 if (empty($force_type)) {
705 if (empty($_GET[$key_field])) {
706 $img = "button_create.gif";
707@@ -454,8 +457,8 @@
708 <tr>
709 <td bgcolor="#f5f5f5" align="right">
710 <input type='hidden' name='action' value='save'>
711- <a href='<?php print $cancel_url;?>'><img src='images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
712- <input type='image' src='images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
713+ <a href='<?php print $cancel_url;?>'><img src='<?php echo $config['url_path']; ?>images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
714+ <input type='image' src='<?php echo $config['url_path']; ?>images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
715 </td>
716 </tr>
717 </table>
718@@ -463,4 +466,4 @@
719 <?php
720 }
721
722-?>
723+?>
724\ No newline at end of file
725diff -Naur cacti-0.8.6j-old/lib/html.php cacti-0.8.6j/lib/html.php
726--- cacti-0.8.6j-old/lib/html.php 2007-01-23 21:01:57.000000000 -0600
727+++ cacti-0.8.6j/lib/html.php 2007-01-23 14:57:46.000000000 -0600
728@@ -88,6 +88,7 @@
729 @arg $extra_url_args - extra arguments to append to the url
730 @arg $header - html to use as a header */
731 function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
732+ global $config;
733 $i = 0;
734 if (sizeof($graph_array) > 0) {
735 if ($header != "") {
736@@ -101,10 +102,11 @@
737 <table width='1' cellpadding='0'>
738 <tr>
739 <td>
740- <a href='graph.php?action=view&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=all'><img 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>
741+ <a href='<?php print $config['url_path']; ?>graph.php?action=view&local_graph_id=<?php print $graph["local_graph_id"];?>&rra_id=all'><img 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>
742 </td>
743 <td valign='top' style='padding: 3px;' class='noprint'>
744- <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>
745+ <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>
746+ <?php do_hook('graph_buttons', array('hook' => 'graphs', 'local_graph_id' => $graph["local_graph_id"], 'rra' => 0, 'view_type' => '')); ?>
747 </td>
748 </tr>
749 </table>
750@@ -130,6 +132,7 @@
751 @arg $extra_url_args - extra arguments to append to the url
752 @arg $header - html to use as a header */
753 function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
754+ global $config;
755 $i = 0; $k = 0;
756 if (sizeof($graph_array) > 0) {
757 if ($header != "") {
758@@ -144,10 +147,11 @@
759 <table width='1' cellpadding='0'>
760 <tr>
761 <td>
762- <a href='graph.php?action=view&rra_id=all&local_graph_id=<?php print $graph["local_graph_id"];?>'><img 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>
763+ <a href='<?php print $config['url_path']; ?>graph.php?action=view&rra_id=all&local_graph_id=<?php print $graph["local_graph_id"];?>'><img 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>
764 </td>
765 <td valign='top' style='padding: 3px;'>
766- <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>
767+ <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>
768+ <?php do_hook('graph_buttons', array('hook' => 'thumbnails', 'local_graph_id' => $graph["local_graph_id"], 'rra' => 0, 'view_type' => '')); ?>
769 </td>
770 </tr>
771 </table>
772@@ -530,6 +534,8 @@
773 }
774
775 while (list($item_sub_url, $item_sub_title) = each($item_title)) {
776+ $item_sub_url = $config['url_path'] . $item_sub_url;
777+
778 /* indent sub-items */
779 if ($i > 0) {
780 $prepend_string = "---&nbsp;";
781@@ -539,7 +545,7 @@
782
783 /* do not put a line between each sub-item */
784 if (($i == 0) || ($draw_sub_items == false)) {
785- $background = "images/menu_line.gif";
786+ $background = $config['url_path'] . "images/menu_line.gif";
787 }else{
788 $background = "";
789 }
790@@ -568,17 +574,18 @@
791 }else{
792 if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) {
793 /* draw normal (non sub-item) menu item */
794+ $item_url = $config['url_path'] . $item_url;
795 if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) {
796- print "<tr><td class='textMenuItemSelected' background='images/menu_line.gif'><strong><a href='$item_url'>$item_title</a></strong></td></tr>\n";
797+ 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";
798 }else{
799- print "<tr><td class='textMenuItem' background='images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
800+ print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
801 }
802 }
803 }
804 }
805 }
806
807- print "<tr><td class='textMenuItem' background='images/menu_line.gif'></td></tr>\n";
808+ print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'></td></tr>\n";
809
810 print '</table></td></tr>';
811 }
812@@ -588,18 +595,19 @@
813 @arg $actions_array - an array that contains a list of possible actions. this array should
814 be compatible with the form_dropdown() function */
815 function draw_actions_dropdown($actions_array) {
816+ global $config;
817 ?>
818 <table align='center' width='98%'>
819 <tr>
820 <td width='1' valign='top'>
821- <img src='images/arrow.gif' alt='' align='absmiddle'>&nbsp;
822+ <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'>&nbsp;
823 </td>
824 <td align='right'>
825 Choose an action:
826 <?php form_dropdown("drp_action",$actions_array,"","","1","","");?>
827 </td>
828 <td width='1' align='right'>
829- <input type='image' src='images/button_go.gif' alt='Go'>
830+ <input type='image' src='<?php echo $config['url_path']; ?>images/button_go.gif' alt='Go'>
831 </td>
832 </tr>
833 </table>
834@@ -626,4 +634,4 @@
835 </tr>
836 <?php }
837
838-?>
839+?>
840\ No newline at end of file
841diff -Naur cacti-0.8.6j-old/lib/html_tree.php cacti-0.8.6j/lib/html_tree.php
842--- cacti-0.8.6j-old/lib/html_tree.php 2007-01-23 21:01:57.000000000 -0600
843+++ cacti-0.8.6j/lib/html_tree.php 2007-01-23 21:02:52.000000000 -0600
844@@ -886,7 +886,7 @@
845 if (read_graph_config_option("thumbnail_section_tree_1") == "on") {
846 if (read_graph_config_option("timespan_sel") == "on") {
847 print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img align='middle' alt='$graph_title'
848- 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=' .
849+ 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=' .
850 read_graph_config_option("default_height") . '&graph_width=' . read_graph_config_option("default_width") . "&graph_nolegend=true' border='0'></a></td>\n";
851
852 /* if we are at the end of a row, start a new one */
853@@ -895,7 +895,7 @@
854 }
855 }else{
856 print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img align='middle' alt='$graph_title'
857- 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=' .
858+ 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=' .
859 read_graph_config_option("default_height") . '&graph_width=' . read_graph_config_option("default_width") . "&graph_nolegend=true' border='0'></a></td>\n";
860
861 /* if we are at the end of a row, start a new one */
862@@ -905,10 +905,10 @@
863 }
864 }else{
865 if (read_graph_config_option("timespan_sel") == "on") {
866- print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img 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>";
867+ print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img 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>";
868 print "</tr><tr>\n";
869 }else{
870- print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img src='graph_image.php?local_graph_id=$local_graph_id&rra_id=$rra_id' border='0' alt='$graph_title'></a></td>";
871+ print "<td><a href='graph.php?local_graph_id=$local_graph_id&rra_id=all'><img src='graph_image.php?action=view&local_graph_id=$local_graph_id&rra_id=$rra_id' border='0' alt='$graph_title'></a></td>";
872 print "</tr><tr>\n";
873 }
874 }
875@@ -978,4 +978,4 @@
876
877 return $html;
878 }
879-?>
880+?>
881\ No newline at end of file
882diff -Naur cacti-0.8.6j-old/lib/poller.php cacti-0.8.6j/lib/poller.php
883--- cacti-0.8.6j-old/lib/poller.php 2007-01-23 21:01:57.000000000 -0600
884+++ cacti-0.8.6j/lib/poller.php 2007-01-23 21:02:52.000000000 -0600
885@@ -228,6 +228,12 @@
886 $limit = "LIMIT 10000";
887 }
888
889+ if ($remainder) {
890+ $limit = "";
891+ }else{
892+ $limit = "LIMIT 10000";
893+ }
894+
895 /* create/update the rrd files */
896 $results = db_fetch_assoc("select
897 poller_output.output,
898@@ -296,11 +302,14 @@
899 }
900 }
901 }
902+ do_hook_function("poller_output", $rrd_update_array);
903
904- $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
905+ if (do_hook_function("poller_on_demand", $results)) {
906+ $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
907+ }
908 }
909
910 return $rrds_processed;
911 }
912
913-?>
914+?>
915\ No newline at end of file
916diff -Naur cacti-0.8.6j-old/lib/rrd.php cacti-0.8.6j/lib/rrd.php
917--- cacti-0.8.6j-old/lib/rrd.php 2007-01-23 21:01:57.000000000 -0600
918+++ cacti-0.8.6j/lib/rrd.php 2007-01-23 21:02:52.000000000 -0600
919@@ -471,6 +471,10 @@
920 }
921 }
922
923+ $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));
924+ if (isset($data['return']) && $data['return'] != false)
925+ return $data['return'];
926+
927 /* find the step and how often this graph is updated with new data */
928 $ds_step = db_fetch_cell("select
929 data_template_data.rrd_step
930@@ -1145,15 +1149,21 @@
931 rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrd_struc);
932 return 0;
933 }else{
934+ $graph_data_array = do_hook_function("prep_graph_array", $graph_data_array);
935+
936 if (isset($graph_data_array["output_flag"])) {
937 $output_flag = $graph_data_array["output_flag"];
938 }else{
939 $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA;
940 }
941
942- return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
943+ $output = rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
944+
945+ do_hook_function("rrdtool_function_graph_set_file", array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id));
946+
947+ return $output;
948 }
949 }
950 }
951
952-?>
953+?>
954\ No newline at end of file
955diff -Naur cacti-0.8.6j-old/lib/variables.php cacti-0.8.6j/lib/variables.php
956--- cacti-0.8.6j-old/lib/variables.php 2007-01-23 21:01:57.000000000 -0600
957+++ cacti-0.8.6j/lib/variables.php 2007-01-23 21:02:52.000000000 -0600
958@@ -179,6 +179,9 @@
959 $string = str_replace($l_escape_string . "host_snmp_timeout" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["snmp_timeout"], $string);
960 $string = str_replace($l_escape_string . "host_id" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["id"], $string);
961
962+ $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));
963+ $string = $temp['string'];
964+
965 return $string;
966 }
967
968@@ -207,4 +210,4 @@
969 return $string;
970 }
971
972-?>
973+?>
974\ No newline at end of file
975diff -Naur cacti-0.8.6j-old/plugins/index.php cacti-0.8.6j/plugins/index.php
976--- cacti-0.8.6j-old/plugins/index.php 1969-12-31 17:00:00.000000000 -0700
977+++ cacti-0.8.6j/plugins/index.php 2007-01-23 21:02:52.000000000 -0600
978@@ -0,0 +1,5 @@
979+<?php
980+
981+header("Location:../index.php");
982+
983+?>
984diff -Naur cacti-0.8.6j-old/poller.php cacti-0.8.6j/poller.php
985--- cacti-0.8.6j-old/poller.php 2007-01-23 21:01:57.000000000 -0600
986+++ cacti-0.8.6j/poller.php 2007-01-23 21:02:52.000000000 -0600
987@@ -40,6 +40,8 @@
988 include_once($config["base_path"] . "/lib/graph_export.php");
989 include_once($config["base_path"] . "/lib/rrd.php");
990
991+do_hook("poller_top");
992+
993 /* Record Start Time */
994 list($micro,$seconds) = split(" ", microtime());
995 $start = $seconds + $micro;
996@@ -188,7 +190,6 @@
997
998 /* insert poller stats into the settings table */
999 db_execute("replace into settings (name,value) values ('stats_poller','$cacti_stats')");
1000- db_execute("truncate table poller_output");
1001
1002 break;
1003 }else {
1004@@ -261,4 +262,6 @@
1005 }
1006 // End Mainline Processing
1007
1008-?>
1009+do_hook("poller_bottom");
1010+
1011+?>
1012\ No newline at end of file
1013diff -Naur cacti-0.8.6j-old/user_admin.php cacti-0.8.6j/user_admin.php
1014--- cacti-0.8.6j-old/user_admin.php 2007-01-23 21:01:57.000000000 -0600
1015+++ cacti-0.8.6j/user_admin.php 2007-01-23 15:11:46.000000000 -0600
1016@@ -72,11 +72,13 @@
1017 include_once("include/bottom_footer.php");
1018 break;
1019 default:
1020- include_once("include/top_header.php");
1021+ if (!do_hook_function("user_admin_action", $_REQUEST["action"])) {
1022+ include_once("include/top_header.php");
1023
1024- user();
1025+ user();
1026
1027- include_once("include/bottom_footer.php");
1028+ include_once("include/bottom_footer.php");
1029+ }
1030 break;
1031 }
1032
1033@@ -158,6 +160,7 @@
1034 $save["policy_trees"] = form_input_validate((isset($_POST["policy_trees"]) ? $_POST["policy_trees"] : $_POST["_policy_trees"]), "policy_trees", "", true, 3);
1035 $save["policy_hosts"] = form_input_validate((isset($_POST["policy_hosts"]) ? $_POST["policy_hosts"] : $_POST["_policy_hosts"]), "policy_hosts", "", true, 3);
1036 $save["policy_graph_templates"] = form_input_validate((isset($_POST["policy_graph_templates"]) ? $_POST["policy_graph_templates"] : $_POST["_policy_graph_templates"]), "policy_graph_templates", "", true, 3);
1037+ $save = do_hook_function("user_admin_setup_sql_save", $save);
1038
1039 if (!is_error_message()) {
1040 $user_id = sql_save($save, "user_auth");
1041@@ -200,6 +203,8 @@
1042 policy_hosts='" . $_POST["policy_hosts"] . "',
1043 policy_graph_templates='" . $_POST["policy_graph_templates"] . "'
1044 where id=" . $_POST["id"]);
1045+ }else{
1046+ do_hook("user_admin_user_save");
1047 }
1048 }
1049 }
1050@@ -695,6 +700,7 @@
1051 <td <?php print (($_GET["action"] == "graph_settings_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='130' align='center' class='tab'>
1052 <span class='textHeader'><a href='user_admin.php?action=graph_settings_edit&id=<?php print $_GET["id"];?>'>Graph Settings</a></span>
1053 </td>
1054+ <?php do_hook("user_admin_tab");?>
1055 <td></td>
1056 </tr>
1057 </table>
1058@@ -708,7 +714,9 @@
1059 }elseif ($_GET["action"] == "graph_perms_edit") {
1060 graph_perms_edit();
1061 }else{
1062- user_realms_edit();
1063+ if (do_hook_function("user_admin_run_action", $_REQUEST["action"])) {
1064+ user_realms_edit();
1065+ }
1066 }
1067
1068 form_save_button("user_admin.php");
1069@@ -791,4 +799,4 @@
1070 }
1071 html_end_box();
1072 }
1073-?>
1074+?>
1075\ No newline at end of file
1076diff -Naur cacti-0.8.6j-old/utilities.php cacti-0.8.6j/utilities.php
1077--- cacti-0.8.6j-old/utilities.php 2007-01-23 21:01:57.000000000 -0600
1078+++ cacti-0.8.6j/utilities.php 2007-01-23 21:02:52.000000000 -0600
1079@@ -122,11 +122,14 @@
1080 include_once("./include/bottom_footer.php");
1081 break;
1082 default:
1083- include_once("./include/top_header.php");
1084
1085- utilities();
1086+ if (!do_hook_function("utilities_action", $_REQUEST["action"])) {
1087+ include_once("./include/top_header.php");
1088
1089- include_once("./include/bottom_footer.php");
1090+ utilities();
1091+
1092+ include_once("./include/bottom_footer.php");
1093+ }
1094 break;
1095 }
1096
1097@@ -973,7 +976,9 @@
1098 </tr>
1099 <?php
1100
1101+ do_hook("utilities_list");
1102+
1103 html_end_box();
1104 }
1105
1106-?>
1107+?>
1108\ No newline at end of file
This page took 0.192351 seconds and 4 git commands to generate.