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