1 diff -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 @@
7 html_header_checkbox(array("Name", "Data Input Method", "Active", "Template Name"));
10 if (sizeof($data_sources) > 0) {
11 foreach ($data_sources as $data_source) {
12 form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
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);
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>
25 - <?php print $data_source["data_input_name"];?>
26 + <?php print $ds_table['data_input_name']; ?>
29 - <?php print (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");?>
30 + <?php print $ds_table['active']; ?>
33 - <?php print ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);?>
34 + <?php print $ds_table['template_name']; ?>
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"];?>">
43 diff -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
50 <td class="textArea" style="padding: 3px;" width="300" nowrap>
51 Create new graphs for the following host:
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"); ?>
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">
63 $hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname");
65 if (sizeof($hosts) > 0) {
66 diff -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
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 +-------------------------------------------------------------------------+
82 "message" => 'Save Successful.',
85 "message" => 'Save Failed',
89 GD_Y_MN_D =>"Year, Month Name, Day"
92 $graph_datechar = array(
98 +do_hook("config_arrays");
101 \ No newline at end of file
102 diff -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
106 "value" => "|arg1:policy_graph_templates|"
108 "save_component_user" => array(
109 "method" => "hidden",
115 +do_hook("config_form");
118 \ No newline at end of file
119 diff -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
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";
132 +//$plugins[] = 'thold';
134 +/* Do not edit this line */
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 '/'
142 +$config["url_path"] = '/';
144 /* ----- you probably do not need to change anything below this line ----- */
146 /* Files that do not need http header information - Command line scripts */
147 $no_http_header_files = array(
150 "query_host_cpu.php",
151 "query_host_partitions.php",
153 "rebuild_poller_cache.php",
164 /* this should be auto-detected, set it manually if needed */
165 $config["cacti_server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix";
167 /* built-in snmp support */
168 $config["php_snmp_support"] = function_exists("snmpget");
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__);
175 +/* include the plugin function, we do this before everything else,
176 + incase we want to add hooks to change config options */
178 +include_once($config["include_path"] . "/plugins.php");
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";
188 diff -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
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"
201 +do_hook("config_settings");
204 \ No newline at end of file
205 diff -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
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.
216 +global $plugin_hooks;
217 +$plugin_hooks = array();
219 +function use_plugin ($name) {
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)) {
231 + * This function executes a hook.
232 + * @param string $name Name of hook to fire
233 + * @return mixed $data
235 +function do_hook ($name) {
236 + global $plugin_hooks;
237 + $data = func_get_args();
240 + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
241 + foreach ($plugin_hooks[$name] as $function) {
242 + if (function_exists($function)) {
248 + /* Variable-length argument lists have a slight problem when */
249 + /* passing values by reference. Pity. This is a workaround. */
253 +function do_hook_function($name,$parm=NULL) {
254 + global $plugin_hooks;
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);
266 + /* Variable-length argument lists have a slight problem when */
267 + /* passing values by reference. Pity. This is a workaround. */
271 +/* On startup, register all plugins configured for use. */
272 +if (isset($plugins) && is_array($plugins)) {
273 + foreach ($plugins as $name) {
279 \ No newline at end of file
280 diff -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
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";
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";
298 - <link href="include/main.css" rel="stylesheet">
299 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
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>
313 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
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">
321 - <?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>
322 + <?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");
327 - <img src="images/cacti_backdrop2.gif" align="absmiddle">
328 + <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif" align="absmiddle">
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>';}?> <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="graph_view.php?action=tree"><img src="images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="graph_view.php?action=list"><img src="images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="graph_view.php?action=preview"><img src="images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?> <br>
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>';}?> <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="<?php echo $config['url_path'] ?>graph_view.php?action=tree"><img src="<?php echo $config['url_path'] ?>images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="<?php echo $config['url_path'] ?>graph_view.php?action=list"><img src="<?php echo $config['url_path'] ?>images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="<?php echo $config['url_path'] ?>graph_view.php?action=preview"><img src="<?php echo $config['url_path'] ?>images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?> <br>
338 <tr height="2" colspan="2" bgcolor="#183c8f">
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>
344 <tr height="5" bgcolor="#e9e9e9">
349 <?php draw_navigation_text();?>
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>)
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>)
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>
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;">
373 <?php if ((basename($_SERVER["PHP_SELF"]) == "graph.php") && ($_REQUEST["action"] == "properties")) {?>
375 <td valign="top" height="1" colspan="3" bgcolor="#efefef">
377 diff -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
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 +-------------------------------------------------------------------------+
390 +global $colors, $config;
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>
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">
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">
411 - <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>
413 + <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");
417 - <img src="images/cacti_backdrop.gif" align="absmiddle">
418 + <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop.gif" align="absmiddle">
424 <tr height="2" bgcolor="#183c8f">
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>
430 <tr height="5" bgcolor="#e9e9e9">
435 <?php draw_navigation_text();?>
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>)
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>)
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>
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">
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">
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>
474 <td width="135" height="500"></td>
475 <td width="100%" valign="top"><?php display_output_messages();?>
476 diff -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
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);
488 + $save = do_hook_function("api_device_save", $save);
492 if (!is_error_message()) {
493 $host_id = sql_save($save, "host");
498 diff -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 @@
506 /* is_error_message - finds whether an error message has been raised and has not been outputted to the
508 @returns - (bool) whether the messages array contains an error or not */
509 function is_error_message() {
511 + global $config, $messages;
513 - include($config["include_path"] . "/config_arrays.php");
514 + include_once($config["include_path"] . "/config_arrays.php");
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; }
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);
528 cacti_log("Host[$host_id] NOTICE: HOST EVENT: Host Returned from DOWN State: ", $print_data_to_stdout);
532 + do_hook_function("update_host_status", array('issue_log_message' => $issue_log_message, 'status' => $status, 'host_id' => $host_id, 'hosts' => $hosts));
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"),
551 + $nav = do_hook_function("draw_navigation_text", $nav);
553 $current_page = basename($_SERVER["PHP_SELF"]);
554 $current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
556 /* find the current page in the big array */
557 $current_array = $nav{$current_page . ":" . $current_action};
558 $current_mappings = split(",", $current_array["mapping"]);
561 diff -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 @@
567 /* form_save_button - draws a (save|create) and cancel button at the bottom of
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") {
574 if (empty($force_type)) {
575 if (empty($_GET[$key_field])) {
576 $img = "button_create.gif";
579 $img = "button_save.gif";
582 @@ -449,18 +450,18 @@
583 $img = "button_create.gif";
587 <table align='center' width='98%' style='background-color: #ffffff; border: 1px solid #bbbbbb;'>
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'>
603 diff -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
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 = "") {
617 if (sizeof($graph_array) > 0) {
622 foreach ($graph_array as $graph) {
624 <tr bgcolor='#<?php print ($i % 2 == 0 ? "f9f9f9" : "ffffff");?>'>
626 <table width='1' cellpadding='0'>
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>
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>
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 = "") {
654 if (sizeof($graph_array) > 0) {
661 foreach ($graph_array as $graph) {
663 <td align='center' width='<?php print (98 / read_graph_config_option("num_columns"));?>%'>
664 <table width='1' cellpadding='0'>
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>
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>
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;
686 $draw_sub_items = false;
689 while (list($item_sub_url, $item_sub_title) = each($item_title)) {
690 + $item_sub_url = $config['url_path'] . $item_sub_url;
692 /* indent sub-items */
694 $prepend_string = "--- ";
696 $prepend_string = "";
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";
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 @@
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";
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";
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";
736 print '</table></td></tr>';
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) {
746 <table align='center' width='98%'>
748 <td width='1' valign='top'>
749 - <img src='images/arrow.gif' alt='' align='absmiddle'>
750 + <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'>
754 <?php form_dropdown("drp_action",$actions_array,"","","1","","");?>
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'>
763 <input type='hidden' name='action' value='actions'>
768 function form_area($text) { ?>
770 <td bgcolor="#E1E1E1" class="textArea">
778 \ No newline at end of file
779 diff -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
785 +header("Location:../index.php");
788 diff -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
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");
800 +do_hook("poller_top");
802 /* Record Start Time */
803 list($micro,$seconds) = split(" ", microtime());
804 $start = $seconds + $micro;
806 /* Get number of polling items from the database */
807 $polling_interval = read_config_option("poller_interval");
809 if (isset($polling_interval)) {
811 if ($method == "cactid") {
812 chdir(read_config_option("path_webroot"));
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";
817 // End Mainline Processing
820 +do_hook("poller_bottom");
823 \ No newline at end of file
824 diff -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
828 utilities_clear_logfile();
830 #utilities_view_logfile();
833 include_once("./include/bottom_footer.php");
837 + do_hook_function("utilities_action", $_REQUEST["action"]);
839 include_once("./include/top_header.php");
843 include_once("./include/bottom_footer.php");
847 @@ -349,12 +352,14 @@
848 <p><a href='utilities.php?action=clear_logfile'>Clear Cacti Log File</a></p>
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>
856 + do_hook("utilities_list");