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 @@
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"]);
19 + $ds_table = do_hook_function("data_sources_table", $ds_table);
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>
26 - <?php print $data_source["data_input_name"];?>
27 + <?php print $ds_table['data_input_name']; ?>
30 - <?php print (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");?>
31 + <?php print $ds_table['active']; ?>
34 - <?php print ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);?>
35 + <?php print $ds_table['template_name']; ?>
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"];?>">
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
51 <td class="textArea" style="padding: 3px;" width="300" nowrap>
52 Create new graphs for the following host:
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"); ?>
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">
64 $hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname");
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
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 +-------------------------------------------------------------------------+
83 "message" => 'Save Successful.',
86 "message" => 'Save Failed',
90 GD_Y_MN_D =>"Year, Month Name, Day"
93 $graph_datechar = array(
99 +do_hook("config_arrays");
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
107 "value" => "|arg1:policy_graph_templates|"
109 "save_component_user" => array(
110 "method" => "hidden",
115 +do_hook("config_form");
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
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";
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",
161 /* this should be auto-detected, set it manually if needed */
162 $config["cacti_server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix";
164 /* built-in snmp support */
165 $config["php_snmp_support"] = function_exists("snmpget");
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__);
172 +/* include the plugin function, we do this before everything else,
173 + incase we want to add hooks to change config options */
175 +include_once($config["include_path"] . "/plugins.php");
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";
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");
191 /* current cacti version */
192 $config["cacti_version"] = "0.8.6g";
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
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"
210 +do_hook("config_settings");
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
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.
225 +global $plugin_hooks;
226 +$plugin_hooks = array();
228 +function use_plugin ($name) {
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)) {
240 + * This function executes a hook.
241 + * @param string $name Name of hook to fire
242 + * @return mixed $data
244 +function do_hook ($name) {
245 + global $plugin_hooks;
246 + $data = func_get_args();
249 + if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
250 + foreach ($plugin_hooks[$name] as $function) {
251 + if (function_exists($function)) {
257 + /* Variable-length argument lists have a slight problem when */
258 + /* passing values by reference. Pity. This is a workaround. */
262 +function do_hook_function($name,$parm=NULL) {
263 + global $plugin_hooks;
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);
275 + /* Variable-length argument lists have a slight problem when */
276 + /* passing values by reference. Pity. This is a workaround. */
280 +/* On startup, register all plugins configured for use. */
281 +if (isset($plugins) && is_array($plugins)) {
282 + foreach ($plugins as $name) {
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
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";
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";
307 - <link href="include/main.css" rel="stylesheet">
308 + <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
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>
322 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
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">
330 - <?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>
331 + <?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");
336 - <img src="images/cacti_backdrop2.gif" align="absmiddle">
337 + <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif" align="absmiddle">
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>';}?> <?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>
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>';}?> <?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>
347 <tr height="2" colspan="2" bgcolor="#183c8f">
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>
353 <tr height="5" bgcolor="#e9e9e9">
358 <?php draw_navigation_text();?>
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>)
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>)
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>
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;">
382 <?php if ((basename($_SERVER["PHP_SELF"]) == "graph.php") && ($_REQUEST["action"] == "properties")) {?>
384 <td valign="top" height="1" colspan="3" bgcolor="#efefef">
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
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 +-------------------------------------------------------------------------+
399 +global $colors, $config;
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>
411 -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif">
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">
420 - <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>
422 + <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");
426 - <img src="images/cacti_backdrop.gif" align="absmiddle">
427 + <img src="<?php echo $config['url_path']; ?>images/cacti_backdrop.gif" align="absmiddle">
433 <tr height="2" bgcolor="#183c8f">
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>
439 <tr height="5" bgcolor="#e9e9e9">
444 <?php draw_navigation_text();?>
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>)
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>)
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>
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">
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">
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>
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
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);
497 + $save = do_hook_function("api_device_save", $save);
501 if (!is_error_message()) {
502 $host_id = sql_save($save, "host");
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 @@
515 /* is_error_message - finds whether an error message has been raised and has not been outputted to the
517 @returns - (bool) whether the messages array contains an error or not */
518 function is_error_message() {
520 + global $config, $messages;
522 - include($config["include_path"] . "/config_arrays.php");
523 + include_once($config["include_path"] . "/config_arrays.php");
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; }
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);
537 cacti_log("Host[$host_id] NOTICE: HOST EVENT: Host Returned from DOWN State: ", $print_data_to_stdout);
541 + do_hook_function("update_host_status", array('issue_log_message' => $issue_log_message, 'status' => $status, 'host_id' => $host_id, 'hosts' => $hosts));
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"),
560 + $nav = do_hook_function("draw_navigation_text", $nav);
562 $current_page = basename($_SERVER["PHP_SELF"]);
563 $current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
565 /* find the current page in the big array */
566 $current_array = $nav{$current_page . ":" . $current_action};
567 $current_mappings = split(",", $current_array["mapping"]);
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 @@
576 /* form_save_button - draws a (save|create) and cancel button at the bottom of
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 = "") {
583 if (empty($force_type)) {
584 if (empty($_GET["id"])) {
585 $img = "button_create.gif";
588 $img = "button_save.gif";
591 @@ -449,18 +450,18 @@
592 $img = "button_create.gif";
596 <table align='center' width='98%' style='background-color: #ffffff; border: 1px solid #bbbbbb;'>
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'>
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
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 = "") {
626 if (sizeof($graph_array) > 0) {
631 foreach ($graph_array as $graph) {
633 <tr bgcolor='#<?php print ($i % 2 == 0 ? "f9f9f9" : "ffffff");?>'>
635 <table width='1' cellpadding='0'>
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>
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>
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 = "") {
663 if (sizeof($graph_array) > 0) {
670 foreach ($graph_array as $graph) {
672 <td align='center' width='<?php print (98 / read_graph_config_option("num_columns"));?>%'>
673 <table width='1' cellpadding='0'>
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>
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>
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;
695 $draw_sub_items = false;
698 while (list($item_sub_url, $item_sub_title) = each($item_title)) {
699 + $item_sub_url = $config['url_path'] . $item_sub_url;
701 /* indent sub-items */
703 $prepend_string = "--- ";
705 $prepend_string = "";
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";
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 @@
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";
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";
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";
745 print '</table></td></tr>';
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) {
755 <table align='center' width='98%'>
757 <td width='1' valign='top'>
758 - <img src='images/arrow.gif' alt='' align='absmiddle'>
759 + <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='absmiddle'>
763 <?php form_dropdown("drp_action",$actions_array,"","","1","","");?>
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'>
772 <input type='hidden' name='action' value='actions'>
777 function form_area($text) { ?>
779 <td bgcolor="#E1E1E1" class="textArea">
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
794 +header("Location:../index.php");
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
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");
809 +do_hook("poller_top");
811 /* Record Start Time */
812 list($micro,$seconds) = split(" ", microtime());
813 $start = $seconds + $micro;
815 /* Let PHP Run Just as Long as It Has To */
816 ini_set("max_execution_time", "0");
818 /* Disable Mib File Loading */
822 db_execute("truncate table poller_output");
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";
826 // End Mainline Processing
829 +do_hook("poller_bottom");
832 \ No newline at end of file