]> git.pld-linux.org Git - packages/cacti.git/blame - cacti-plugin-0.8.6h.diff
- up to 0.8.7b, fixed "Multiple Security Vulnerabilities"
[packages/cacti.git] / cacti-plugin-0.8.6h.diff
CommitLineData
0d8716e1
MWP
1diff -Naur -U 8 cacti-0.8.6h-old/data_sources.php cacti-0.8.6h/data_sources.php
2--- cacti-0.8.6h-old/data_sources.php 2006-01-03 21:08:30.000000000 -0600
3+++ cacti-0.8.6h/data_sources.php 2006-01-05 23:25:32.000000000 -0600
4@@ -1038,28 +1038,35 @@
5 print $nav;
6
7 html_header_checkbox(array("Name", "Data Input Method", "Active", "Template Name"));
8
9 $i = 0;
10 if (sizeof($data_sources) > 0) {
11 foreach ($data_sources as $data_source) {
12 form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
13+
14+ $ds_table['data_source'] = $data_source;
15+ $ds_table['data_input_name'] = $data_source['data_input_name'];
16+ $ds_table['active'] = (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");
17+ $ds_table['template_name'] = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
18+ $ds_table = do_hook_function("data_sources_table", $ds_table);
19+
20 ?>
21 <td>
22 <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>
23 </td>
24 <td>
25- <?php print $data_source["data_input_name"];?>
26+ <?php print $ds_table['data_input_name']; ?>
27 </td>
28 <td>
29- <?php print (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");?>
30+ <?php print $ds_table['active']; ?>
31 </td>
32 <td>
33- <?php print ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);?>
34+ <?php print $ds_table['template_name']; ?>
35 </td>
36 <td style="<?php print get_checkbox_style();?>" width="1%" align="right">
37 <input type='checkbox' style='margin: 0px;' name='chk_<?php print $data_source["local_data_id"];?>' title="<?php print $data_source["name_cache"];?>">
38 </td>
39 </tr>
40 <?php
41 }
42
43diff -Naur -U 8 cacti-0.8.6h-old/graphs_new.php cacti-0.8.6h/graphs_new.php
44--- cacti-0.8.6h-old/graphs_new.php 2006-01-03 21:08:30.000000000 -0600
45+++ cacti-0.8.6h/graphs_new.php 2006-01-05 23:25:38.000000000 -0600
46@@ -394,17 +394,18 @@
47 </tr>
48
49 <tr>
50 <td class="textArea" style="padding: 3px;" width="300" nowrap>
51 Create new graphs for the following host:
52 </td>
53 <td class="textInfo" rowspan="2" valign="top">
54 <span style="color: #c16921;">*</span><a href="host.php?action=edit&id=<?php print $_REQUEST["host_id"];?>">Edit this Host</a><br>
55- <span style="color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a>
56+ <span style="color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a><br>
57+ <?php do_hook("graphs_new_top_links"); ?>
58 </td>
59 </tr>
60 <td>
61 <select name="cbo_graph_id" onChange="window.location=document.form_graph_id.cbo_graph_id.options[document.form_graph_id.cbo_graph_id.selectedIndex].value">
62 <?php
63 $hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname");
64
65 if (sizeof($hosts) > 0) {
66diff -Naur -U 8 cacti-0.8.6h-old/include/config_arrays.php cacti-0.8.6h/include/config_arrays.php
67--- cacti-0.8.6h-old/include/config_arrays.php 2006-01-03 21:08:30.000000000 -0600
68+++ cacti-0.8.6h/include/config_arrays.php 2006-01-05 23:25:43.000000000 -0600
69@@ -19,16 +19,18 @@
70 | Ian Berry. See about.php for specific developer credit. Any questions |
71 | or comments regarding this code should be directed to: |
72 | - iberry@raxnet.net |
73 +-------------------------------------------------------------------------+
74 | - raXnet - http://www.raxnet.net/ |
75 +-------------------------------------------------------------------------+
76 */
77
78+global $menu;
79+
80 $messages = array(
81 1 => array(
82 "message" => 'Save Successful.',
83 "type" => "info"),
84 2 => array(
85 "message" => 'Save Failed',
86 "type" => "error"),
87 3 => array(
88@@ -424,9 +426,11 @@
89 GD_Y_MN_D =>"Year, Month Name, Day"
90 );
91
92 $graph_datechar = array(
93 GDC_HYPHEN => "-",
94 GDC_SLASH => "/"
95 );
96
97-?>
98+do_hook("config_arrays");
99+
100+?>
101\ No newline at end of file
102diff -Naur -U 8 cacti-0.8.6h-old/include/config_form.php cacti-0.8.6h/include/config_form.php
103--- cacti-0.8.6h-old/include/config_form.php 2006-01-03 21:08:30.000000000 -0600
104+++ cacti-0.8.6h/include/config_form.php 2006-01-05 23:25:49.000000000 -0600
105@@ -994,9 +994,11 @@
106 "value" => "|arg1:policy_graph_templates|"
107 ),
108 "save_component_user" => array(
109 "method" => "hidden",
110 "value" => "1"
111 )
112 );
113
114-?>
115+do_hook("config_form");
116+
117+?>
118\ No newline at end of file
119diff -Naur -U 8 cacti-0.8.6h-old/include/config.php cacti-0.8.6h/include/config.php
120--- cacti-0.8.6h-old/include/config.php 2006-01-03 21:08:30.000000000 -0600
121+++ cacti-0.8.6h/include/config.php 2006-01-05 23:25:41.000000000 -0600
122@@ -27,16 +27,29 @@
123 /* make sure these values refect your actual database/host/user/password */
124 $database_type = "mysql";
125 $database_default = "cacti";
126 $database_hostname = "localhost";
127 $database_username = "cactiuser";
128 $database_password = "cactiuser";
129 $database_port = "3306";
130
131+$plugins = array();
132+//$plugins[] = 'thold';
133+
134+/* Do not edit this line */
135+$config = array();
136+
137+/* This is full URL Path to the Cacti installation
138+ For example, if your cacti was accessible by http://server/cacti/ you would user '/cacti/'
139+ as the url path. For just http://server/ use '/'
140+*/
141+
142+$config["url_path"] = '/';
143+
144 /* ----- you probably do not need to change anything below this line ----- */
145
146 /* Files that do not need http header information - Command line scripts */
147 $no_http_header_files = array(
148 "poller.php",
149 "cmd.php",
150 "query_host_cpu.php",
151 "query_host_partitions.php",
152@@ -46,30 +59,34 @@
153 "rebuild_poller_cache.php",
154 "script_server.php",
155 "sql.php",
156 "ss_host_cpu.php",
157 "ss_host_disk.php",
158 "ss_sql.php"
159 );
160
161-$config = array();
162 $colors = array();
163
164 /* this should be auto-detected, set it manually if needed */
165 $config["cacti_server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix";
166
167 /* built-in snmp support */
168 $config["php_snmp_support"] = function_exists("snmpget");
169
170 /* used for includes */
171 $config["base_path"] = strtr(ereg_replace("(.*)[\/\\]include", "\\1", dirname(__FILE__)), "\\", "/");
172 $config["library_path"] = ereg_replace("(.*[\/\\])include", "\\1lib", dirname(__FILE__));
173 $config["include_path"] = dirname(__FILE__);
174
175+/* include the plugin function, we do this before everything else,
176+ incase we want to add hooks to change config options */
177+
178+include_once($config["include_path"] . "/plugins.php");
179+
180 /* colors */
181 $colors["dark_outline"] = "454E53";
182 $colors["dark_bar"] = "AEB4B7";
183 $colors["panel"] = "E5E5E5";
184 $colors["panel_text"] = "000000";
185 $colors["panel_link"] = "000000";
186 $colors["light"] = "F5F5F5";
187 $colors["alternate"] = "E7E9F2";
188diff -Naur -U 8 cacti-0.8.6h-old/include/config_settings.php cacti-0.8.6h/include/config_settings.php
189--- cacti-0.8.6h-old/include/config_settings.php 2006-01-03 21:08:30.000000000 -0600
190+++ cacti-0.8.6h/include/config_settings.php 2006-01-05 23:25:52.000000000 -0600
191@@ -842,9 +842,11 @@
192 "friendly_name" => "Unit Font File",
193 "description" => "The size of the font used for Graph Unit items",
194 "method" => "textbox",
195 "max_length" => "100"
196 )
197 )
198 );
199
200-?>
201+do_hook("config_settings");
202+
203+?>
204\ No newline at end of file
205diff -Naur -U 8 cacti-0.8.6h-old/include/plugins.php cacti-0.8.6h/include/plugins.php
206--- cacti-0.8.6h-old/include/plugins.php 1969-12-31 17:00:00.000000000 -0700
207+++ cacti-0.8.6h/include/plugins.php 2006-01-05 23:25:53.000000000 -0600
208@@ -0,0 +1,70 @@
209+<?php
210+
211+/*
212+ * Copyright (c) 1999-2005 The SquirrelMail Project Team (http://squirrelmail.org)
213+ * Licensed under the GNU GPL. For full terms see the file COPYING.
214+ */
215+
216+global $plugin_hooks;
217+$plugin_hooks = array();
218+
219+function use_plugin ($name) {
220+ global $config;
221+ if (file_exists($config["base_path"] . "/plugins/$name/setup.php")) {
222+ include_once($config["base_path"] . "/plugins/$name/setup.php");
223+ $function = "plugin_init_$name";
224+ if (function_exists($function)) {
225+ $function();
226+ }
227+ }
228+}
229+
230+/**
231+ * This function executes a hook.
232+ * @param string $name Name of hook to fire
233+ * @return mixed $data
234+ */
235+function do_hook ($name) {
236+ global $plugin_hooks;
237+ $data = func_get_args();
238+ $ret = '';
239+
240+ if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
241+ foreach ($plugin_hooks[$name] as $function) {
242+ if (function_exists($function)) {
243+ $function($data);
244+ }
245+ }
246+ }
247+
248+ /* Variable-length argument lists have a slight problem when */
249+ /* passing values by reference. Pity. This is a workaround. */
250+ return $data;
251+}
252+
253+function do_hook_function($name,$parm=NULL) {
254+ global $plugin_hooks;
255+ $ret = $parm;
256+
257+ if (isset($plugin_hooks[$name])
258+ && is_array($plugin_hooks[$name])) {
259+ foreach ($plugin_hooks[$name] as $function) {
260+ if (function_exists($function)) {
261+ $ret = $function($ret);
262+ }
263+ }
264+ }
265+
266+ /* Variable-length argument lists have a slight problem when */
267+ /* passing values by reference. Pity. This is a workaround. */
268+ return $ret;
269+}
270+
271+/* On startup, register all plugins configured for use. */
272+if (isset($plugins) && is_array($plugins)) {
273+ foreach ($plugins as $name) {
274+ use_plugin($name);
275+ }
276+}
277+
278+?>
279\ No newline at end of file
280diff -Naur -U 8 cacti-0.8.6h-old/include/top_graph_header.php cacti-0.8.6h/include/top_graph_header.php
281--- cacti-0.8.6h-old/include/top_graph_header.php 2006-01-03 21:08:30.000000000 -0600
282+++ cacti-0.8.6h/include/top_graph_header.php 2006-01-05 23:25:56.000000000 -0600
283@@ -76,75 +76,78 @@
284 ?>
285 <html>
286 <head>
287 <title>cacti</title>
288 <?php if (isset($_SESSION["custom"])) {
289 if ($_SESSION["custom"]) {
290 print "<meta http-equiv=refresh content='99999'; url='" . basename($_SERVER["PHP_SELF"]) . "'>\r\n";
291 }else{
292- print "<meta http-equiv=refresh content='" . read_graph_config_option("page_refresh") . "'; url='" . basename($_SERVER["PHP_SELF"]) . "'>\r\n";
293+ $refresh = do_hook_function("top_graph_refresh", read_graph_config_option("page_refresh"));
294+ print "<meta http-equiv=refresh content='" . $refresh . "'; url='" . basename($_SERVER["PHP_SELF"]) . "'>\r\n";
295 }
296 }
297 ?>
298- <link href="include/main.css" rel="stylesheet">
299+ <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
300
301- <script type="text/javascript" src="include/treeview/ua.js"></script>
302- <script type="text/javascript" src="include/treeview/ftiens4.js"></script>
303- <script type="text/javascript" src="include/jscalendar/calendar.js"></script>
304- <script type="text/javascript" src="include/jscalendar/lang/calendar-en.js"></script>
305- <script type="text/javascript" src="include/jscalendar/calendar-setup.js"></script>
306+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script>
307+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script>
308+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
309+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
310+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
311 </head>
312
313 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
314
315 <table width="100%" height="100%" cellspacing="0" cellpadding="0">
316 <tr height="37" bgcolor="#a9a9a9">
317 <td colspan="2" valign="bottom" nowrap>
318 <table width="100%" cellspacing="0" cellpadding="0">
319 <tr>
320 <td nowrap>
321- &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;
322+ &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
323+ do_hook("top_graph_header_tabs");
324+ ?>&nbsp;
325 </td>
326 <td>
327- <img src="images/cacti_backdrop2.gif" align="absmiddle">
328+ <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif" align="absmiddle">
329 </td>
330 <td align="right" nowrap>
331- <?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>
332+ <?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>
333 </td>
334 </tr>
335 </table>
336 </td>
337 </tr>
338 <tr height="2" colspan="2" bgcolor="#183c8f">
339 <td colspan="2">
340- <img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
341+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
342 </td>
343 </tr>
344 <tr height="5" bgcolor="#e9e9e9">
345 <td colspan="2">
346 <table width="100%">
347 <tr>
348 <td>
349 <?php draw_navigation_text();?>
350 </td>
351 <td align="right">
352 <?php if ((isset($_SESSION["sess_user_id"])) && ($using_guest_account == false)) { ?>
353- 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;
354+ 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;
355 <?php } ?>
356 </td>
357 </tr>
358 </table>
359 </td>
360 </tr>
361 <tr>
362- <td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
363- <img src="images/transparent_line.gif" width="<?php print read_graph_config_option("default_dual_pane_width");?>" height="2" border="0"><br>
364+ <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;">
365+ <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>
366 </td>
367- <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;">
368+ <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;">
369
370 </td>
371 </tr>
372
373 <?php if ((basename($_SERVER["PHP_SELF"]) == "graph.php") && ($_REQUEST["action"] == "properties")) {?>
374 <tr>
375 <td valign="top" height="1" colspan="3" bgcolor="#efefef">
376 <?php
377diff -Naur -U 8 cacti-0.8.6h-old/include/top_header.php cacti-0.8.6h/include/top_header.php
378--- cacti-0.8.6h-old/include/top_header.php 2006-01-03 21:08:30.000000000 -0600
379+++ cacti-0.8.6h/include/top_header.php 2006-01-05 23:25:56.000000000 -0600
380@@ -19,79 +19,80 @@
381 | Ian Berry. See about.php for specific developer credit. Any questions |
382 | or comments regarding this code should be directed to: |
383 | - iberry@raxnet.net |
384 +-------------------------------------------------------------------------+
385 | - raXnet - http://www.raxnet.net/ |
386 +-------------------------------------------------------------------------+
387 */
388
389-global $colors;
390+global $colors, $config;
391 ?>
392 <html>
393 <head>
394 <title>cacti</title>
395- <link href="include/main.css" rel="stylesheet">
396- <script type="text/javascript" src="include/layout.js"></script>
397+ <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
398+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
399 </style>
400 </head>
401
402-<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif">
403+<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="<?php echo $config['url_path']; ?>images/left_border.gif">
404
405 <table width="100%" cellspacing="0" cellpadding="0">
406 <tr height="37" bgcolor="#a9a9a9">
407 <td valign="bottom" colspan="3" nowrap>
408 <table width="100%" cellspacing="0" cellpadding="0">
409 <tr>
410 <td valign="bottom">
411- &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="Console" align="absmiddle" border="0"></a>
412- </td>
413+ &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
414+ do_hook("top_header_tabs");
415+ ?></td>
416 <td align="right">
417- <img src="images/cacti_backdrop.gif" align="absmiddle">
418+ <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop.gif" align="absmiddle">
419 </td>
420 </tr>
421 </table>
422 </td>
423 </tr>
424 <tr height="2" bgcolor="#183c8f">
425 <td colspan="3">
426- <img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
427+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
428 </td>
429 </tr>
430 <tr height="5" bgcolor="#e9e9e9">
431 <td colspan="3">
432 <table width="100%">
433 <tr>
434 <td>
435 <?php draw_navigation_text();?>
436 </td>
437 <td align="right">
438 <?php if (read_config_option("global_auth") == "on") { ?>
439- 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;
440+ 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;
441 <?php } ?>
442 </td>
443 </tr>
444 </table>
445 </td>
446 </tr>
447 <tr>
448- <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;">
449- <img src="images/transparent_line.gif" width="135" height="2" border="0"><br>
450+ <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;">
451+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="2" border="0"><br>
452 </td>
453- <td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
454+ <td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
455
456 </td>
457 </tr>
458 <tr height="5">
459 <td valign="top" rowspan="2" width="135" style="padding: 5px; border-right: #aaaaaa 1px solid;" bgcolor='#f5f5f5'>
460 <table bgcolor="#f5f5f5" width="100%" cellpadding="1" cellspacing="0" border="0">
461 <?php draw_menu();?>
462 </table>
463
464- <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
465- <p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
466- <img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
467+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
468+ <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>
469+ <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
470 </td>
471 <td></td>
472 </tr>
473 <tr>
474 <td width="135" height="500"></td>
475 <td width="100%" valign="top"><?php display_output_messages();?>
476diff -Naur -U 8 cacti-0.8.6h-old/lib/api_device.php cacti-0.8.6h/lib/api_device.php
477--- cacti-0.8.6h-old/lib/api_device.php 2006-01-03 21:08:30.000000000 -0600
478+++ cacti-0.8.6h/lib/api_device.php 2006-01-05 23:25:59.000000000 -0600
479@@ -71,16 +71,18 @@
480 $save["snmp_community"] = form_input_validate($snmp_community, "snmp_community", "", true, 3);
481 $save["snmp_version"] = form_input_validate($snmp_version, "snmp_version", "", true, 3);
482 $save["snmp_username"] = form_input_validate($snmp_username, "snmp_username", "", true, 3);
483 $save["snmp_password"] = form_input_validate($snmp_password, "snmp_password", "", true, 3);
484 $save["snmp_port"] = form_input_validate($snmp_port, "snmp_port", "^[0-9]+$", false, 3);
485 $save["snmp_timeout"] = form_input_validate($snmp_timeout, "snmp_timeout", "^[0-9]+$", false, 3);
486 $save["disabled"] = form_input_validate($disabled, "disabled", "", true, 3);
487
488+ $save = do_hook_function("api_device_save", $save);
489+
490 $host_id = 0;
491
492 if (!is_error_message()) {
493 $host_id = sql_save($save, "host");
494
495 if ($host_id) {
496 raise_message(1);
497
498diff -Naur -U 8 cacti-0.8.6h-old/lib/functions.php cacti-0.8.6h/lib/functions.php
499--- cacti-0.8.6h-old/lib/functions.php 2006-01-03 21:08:30.000000000 -0600
500+++ cacti-0.8.6h/lib/functions.php 2006-01-05 23:26:11.000000000 -0600
501@@ -181,19 +181,19 @@
502
503 return $field_value;
504 }
505
506 /* is_error_message - finds whether an error message has been raised and has not been outputted to the
507 user
508 @returns - (bool) whether the messages array contains an error or not */
509 function is_error_message() {
510- global $config;
511+ global $config, $messages;
512
513- include($config["include_path"] . "/config_arrays.php");
514+ include_once($config["include_path"] . "/config_arrays.php");
515
516 if (isset($_SESSION["sess_messages"])) {
517 if (is_array($_SESSION["sess_messages"])) {
518 foreach (array_keys($_SESSION["sess_messages"]) as $current_message_id) {
519 if ($messages[$current_message_id]["type"] == "error") { return true; }
520 }
521 }
522 }
523@@ -557,16 +557,18 @@
524 if ($issue_log_message) {
525 if ($hosts[$host_id]["status"] == HOST_DOWN) {
526 cacti_log("Host[$host_id] ERROR: HOST EVENT: Host is DOWN Message: " . $hosts[$host_id]["status_last_error"], $print_data_to_stdout);
527 } else {
528 cacti_log("Host[$host_id] NOTICE: HOST EVENT: Host Returned from DOWN State: ", $print_data_to_stdout);
529 }
530 }
531
532+ do_hook_function("update_host_status", array('issue_log_message' => $issue_log_message, 'status' => $status, 'host_id' => $host_id, 'hosts' => $hosts));
533+
534 db_execute("update host set
535 status = '" . $hosts[$host_id]["status"] . "',
536 status_event_count = '" . $hosts[$host_id]["status_event_count"] . "',
537 status_fail_date = '" . $hosts[$host_id]["status_fail_date"] . "',
538 status_rec_date = '" . $hosts[$host_id]["status_rec_date"] . "',
539 status_last_error = '" . $hosts[$host_id]["status_last_error"] . "',
540 min_time = '" . $hosts[$host_id]["min_time"] . "',
541 max_time = '" . $hosts[$host_id]["max_time"] . "',
542@@ -1341,16 +1343,18 @@
543 "user_admin.php:user_realms_edit" => array("title" => "Edit (Realm Permissions)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
544 "user_admin.php:graph_settings_edit" => array("title" => "Edit (Graph Settings)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
545 "about.php:" => array("title" => "About Cacti", "mapping" => "index.php:", "url" => "about.php", "level" => "1"),
546 "templates_export.php:" => array("title" => "Export Templates", "mapping" => "index.php:", "url" => "templates_export.php", "level" => "1"),
547 "templates_export.php:save" => array("title" => "Export Results", "mapping" => "index.php:,templates_export.php:", "url" => "templates_export.php", "level" => "2"),
548 "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
549 );
550
551+ $nav = do_hook_function("draw_navigation_text", $nav);
552+
553 $current_page = basename($_SERVER["PHP_SELF"]);
554 $current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
555
556 /* find the current page in the big array */
557 $current_array = $nav{$current_page . ":" . $current_action};
558 $current_mappings = split(",", $current_array["mapping"]);
559 $current_nav = "";
560
561diff -Naur -U 8 cacti-0.8.6h-old/lib/html_form.php cacti-0.8.6h/lib/html_form.php
562--- cacti-0.8.6h-old/lib/html_form.php 2006-01-03 21:08:30.000000000 -0600
563+++ cacti-0.8.6h/lib/html_form.php 2006-01-05 23:26:14.000000000 -0600
564@@ -429,16 +429,17 @@
565 <?php }
566
567 /* form_save_button - draws a (save|create) and cancel button at the bottom of
568 an html edit form
569 @arg $cancel_url - the url to go to when the user clicks 'cancel'
570 @arg $force_type - if specified, will force the 'action' button to be either
571 'save' or 'create'. otherwise this field should be properly auto-detected */
572 function form_save_button($cancel_url, $force_type = "", $key_field = "id") {
573+ global $config;
574 if (empty($force_type)) {
575 if (empty($_GET[$key_field])) {
576 $img = "button_create.gif";
577 $alt = "Create";
578 }else{
579 $img = "button_save.gif";
580 $alt = "Save";
581 }
582@@ -449,18 +450,18 @@
583 $img = "button_create.gif";
584 $alt = "Create";
585 }
586 ?>
587 <table align='center' width='98%' style='background-color: #ffffff; border: 1px solid #bbbbbb;'>
588 <tr>
589 <td bgcolor="#f5f5f5" align="right">
590 <input type='hidden' name='action' value='save'>
591- <a href='<?php print $cancel_url;?>'><img src='images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
592- <input type='image' src='images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
593+ <a href='<?php print $cancel_url;?>'><img src='<?php echo $config['url_path']; ?>images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'></a>
594+ <input type='image' src='<?php echo $config['url_path']; ?>images/<?php print $img;?>' alt='<?php print $alt;?>' align='absmiddle'>
595 </td>
596 </tr>
597 </table>
598 </form>
599 <?php
600 }
601
602 ?>
603diff -Naur -U 8 cacti-0.8.6h-old/lib/html.php cacti-0.8.6h/lib/html.php
604--- cacti-0.8.6h-old/lib/html.php 2006-01-03 21:08:30.000000000 -0600
605+++ cacti-0.8.6h/lib/html.php 2006-01-05 23:26:10.000000000 -0600
606@@ -83,33 +83,34 @@
607 @arg $graph_array - the array to contains graph information. for each graph in the
608 array, the following two keys must exist
609 $arr[0]["local_graph_id"] // graph id
610 $arr[0]["title_cache"] // graph title
611 @arg $no_graphs_message - display this message if no graphs are found in $graph_array
612 @arg $extra_url_args - extra arguments to append to the url
613 @arg $header - html to use as a header */
614 function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
615+ global $config;
616 $i = 0;
617 if (sizeof($graph_array) > 0) {
618 if ($header != "") {
619 print $header;
620 }
621
622 foreach ($graph_array as $graph) {
623 ?>
624 <tr bgcolor='#<?php print ($i % 2 == 0 ? "f9f9f9" : "ffffff");?>'>
625 <td align='center'>
626 <table width='1' cellpadding='0'>
627 <tr>
628 <td>
629- <a href='graph.php?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>
630+ <a href='<?php print $config['url_path'] ?>graph.php?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>
631 </td>
632 <td valign='top' style='padding: 3px;'>
633- <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>
634+ <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>
635 </td>
636 </tr>
637 </table>
638 </td>
639 </tr>
640 <?php
641
642 $i++;
643@@ -125,34 +126,35 @@
644 @arg $graph_array - the array to contains graph information. for each graph in the
645 array, the following two keys must exist
646 $arr[0]["local_graph_id"] // graph id
647 $arr[0]["title_cache"] // graph title
648 @arg $no_graphs_message - display this message if no graphs are found in $graph_array
649 @arg $extra_url_args - extra arguments to append to the url
650 @arg $header - html to use as a header */
651 function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
652+ global $config;
653 $i = 0; $k = 0;
654 if (sizeof($graph_array) > 0) {
655 if ($header != "") {
656 print $header;
657 }
658
659 print "<tr>";
660
661 foreach ($graph_array as $graph) {
662 ?>
663 <td align='center' width='<?php print (98 / read_graph_config_option("num_columns"));?>%'>
664 <table width='1' cellpadding='0'>
665 <tr>
666 <td>
667- <a href='graph.php?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>
668+ <a href='<?php print $config['url_path'] ?>graph.php?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>
669 </td>
670 <td valign='top' style='padding: 3px;'>
671- <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>
672+ <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>
673 </td>
674 </tr>
675 </table>
676 </td>
677 <?php
678
679 $i++;
680 $k++;
681@@ -425,26 +427,28 @@
682 /* if the current page exists in the sub-items array, draw each sub-item */
683 if (array_key_exists(basename($_SERVER["PHP_SELF"]), $item_title) == true) {
684 $draw_sub_items = true;
685 }else{
686 $draw_sub_items = false;
687 }
688
689 while (list($item_sub_url, $item_sub_title) = each($item_title)) {
690+ $item_sub_url = $config['url_path'] . $item_sub_url;
691+
692 /* indent sub-items */
693 if ($i > 0) {
694 $prepend_string = "---&nbsp;";
695 }else{
696 $prepend_string = "";
697 }
698
699 /* do not put a line between each sub-item */
700 if (($i == 0) || ($draw_sub_items == false)) {
701- $background = "images/menu_line.gif";
702+ $background = $config['url_path'] . "images/menu_line.gif";
703 }else{
704 $background = "";
705 }
706
707 /* draw all of the sub-items as selected for ui grouping reasons. we can use the 'bold'
708 or 'not bold' to distinguish which sub-item is actually selected */
709 if ((basename($_SERVER["PHP_SELF"]) == basename($item_sub_url)) || ($draw_sub_items)) {
710 $td_class = "textMenuItemSelected";
711@@ -463,48 +467,50 @@
712 }
713
714 $i++;
715 }
716 }
717 }else{
718 if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) {
719 /* draw normal (non sub-item) menu item */
720+ $item_url = $config['url_path'] . $item_url;
721 if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) {
722- print "<tr><td class='textMenuItemSelected' background='images/menu_line.gif'><strong><a href='$item_url'>$item_title</a></strong></td></tr>\n";
723+ 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";
724 }else{
725- print "<tr><td class='textMenuItem' background='images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
726+ print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'><a href='$item_url'>$item_title</a></td></tr>\n";
727 }
728 }
729 }
730 }
731 }
732
733- print "<tr><td class='textMenuItem' background='images/menu_line.gif'></td></tr>\n";
734+ print "<tr><td class='textMenuItem' background='" . $config['url_path'] . "images/menu_line.gif'></td></tr>\n";
735
736 print '</table></td></tr>';
737 }
738
739 /* draw_actions_dropdown - draws a table the allows the user to select an action to perform
740 on one or more data elements
741 @arg $actions_array - an array that contains a list of possible actions. this array should
742 be compatible with the form_dropdown() function */
743 function draw_actions_dropdown($actions_array) {
744+ global $config;
745 ?>
746 <table align='center' width='98%'>
747 <tr>
748 <td width='1' valign='top'>
749- <img src='images/arrow.gif' alt='' align='absmiddle'>&nbsp;
750+ <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'>&nbsp;
751 </td>
752 <td align='right'>
753 Choose an action:
754 <?php form_dropdown("drp_action",$actions_array,"","","1","","");?>
755 </td>
756 <td width='1' align='right'>
757- <input type='image' src='images/button_go.gif' alt='Go'>
758+ <input type='image' src='<?php echo $config['url_path']; ?>images/button_go.gif' alt='Go'>
759 </td>
760 </tr>
761 </table>
762
763 <input type='hidden' name='action' value='actions'>
764 <?php
765 }
766
767@@ -521,9 +527,9 @@
768 function form_area($text) { ?>
769 <tr>
770 <td bgcolor="#E1E1E1" class="textArea">
771 <?php print $text;?>
772 </td>
773 </tr>
774 <?php }
775
776-?>
777+?>
778\ No newline at end of file
779diff -Naur -U 8 cacti-0.8.6h-old/plugins/index.php cacti-0.8.6h/plugins/index.php
780--- cacti-0.8.6h-old/plugins/index.php 1969-12-31 17:00:00.000000000 -0700
781+++ cacti-0.8.6h/plugins/index.php 2006-01-05 23:26:14.000000000 -0600
782@@ -0,0 +1,5 @@
783+<?php
784+
785+header("Location:../index.php");
786+
787+?>
788diff -Naur -U 8 cacti-0.8.6h-old/poller.php cacti-0.8.6h/poller.php
789--- cacti-0.8.6h-old/poller.php 2006-01-03 21:08:30.000000000 -0600
790+++ cacti-0.8.6h/poller.php 2006-01-05 23:25:38.000000000 -0600
791@@ -35,16 +35,18 @@
792
793 /* Start Initialization Section */
794 include(dirname(__FILE__) . "/include/config.php");
795 include_once($config["base_path"] . "/lib/poller.php");
796 include_once($config["base_path"] . "/lib/data_query.php");
797 include_once($config["base_path"] . "/lib/graph_export.php");
798 include_once($config["base_path"] . "/lib/rrd.php");
799
800+do_hook("poller_top");
801+
802 /* Record Start Time */
803 list($micro,$seconds) = split(" ", microtime());
804 $start = $seconds + $micro;
805
806 /* Get number of polling items from the database */
807 $polling_interval = read_config_option("poller_interval");
808
809 if (isset($polling_interval)) {
810@@ -263,9 +265,11 @@
811 if ($method == "cactid") {
812 chdir(read_config_option("path_webroot"));
813 }
814 }else{
815 print "There are no items in your poller cache or polling is disabled. Make sure you have at least one data source created. If you do, go to 'Utilities', and select 'Clear Poller Cache'.\n";
816 }
817 // End Mainline Processing
818
819-?>
820+do_hook("poller_bottom");
821+
822+?>
823\ No newline at end of file
824diff -Naur -U 8 cacti-0.8.6h-old/utilities.php cacti-0.8.6h/utilities.php
825--- cacti-0.8.6h-old/utilities.php 2006-01-03 21:08:30.000000000 -0600
826+++ cacti-0.8.6h/utilities.php 2006-01-05 22:32:11.000000000 -0600
827@@ -83,16 +83,19 @@
828 utilities_clear_logfile();
829
830 #utilities_view_logfile();
831
832
833 include_once("./include/bottom_footer.php");
834 break;
835 default:
836+
837+ do_hook_function("utilities_action", $_REQUEST["action"]);
838+
839 include_once("./include/top_header.php");
840
841 utilities();
842
843 include_once("./include/bottom_footer.php");
844 break;
845 }
846
847@@ -349,12 +352,14 @@
848 <p><a href='utilities.php?action=clear_logfile'>Clear Cacti Log File</a></p>
849 </td>
850 <td class="textArea">
851 <p>This action will reset the Cacti Log File. Please note that if you are using the Syslog/Eventlog only, this action will have no effect.</p>
852 </td>
853 </tr>
854 <?php
855
856+ do_hook("utilities_list");
857+
858 html_end_box();
859 }
860
861 ?>
This page took 0.152662 seconds and 4 git commands to generate.