.: SOURCES/cacti-plugin-0.8.6g.diff (NEW) - patch add plugins arch...

wolvverine wolvverine at pld-linux.org
Thu Jan 12 03:15:05 CET 2006


Author: wolvverine                   Date: Thu Jan 12 02:15:05 2006 GMT
Module: .                             Tag: HEAD
---- Log message:
- patch add plugins architecture to cacti 0.8.6h

---- Files affected:
./SOURCES:
   cacti-plugin-0.8.6g.diff (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: ./SOURCES/cacti-plugin-0.8.6g.diff
diff -u /dev/null ./SOURCES/cacti-plugin-0.8.6g.diff:1.1
--- /dev/null	Thu Jan 12 03:15:05 2006
+++ ./SOURCES/cacti-plugin-0.8.6g.diff	Thu Jan 12 03:14:59 2006
@@ -0,0 +1,832 @@
+diff -Nar -U 8 cacti-0.8.6g/data_sources.php cacti-0.8.6g-new/data_sources.php
+--- cacti-0.8.6g/data_sources.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/data_sources.php	2005-09-12 10:59:25.000000000 -0500
+@@ -1038,28 +1038,36 @@
+ 	print $nav;
+ 
+ 	html_header_checkbox(array("Name", "Data Input Method", "Active", "Template Name"));
+ 
+ 	$i = 0;
+ 	if (sizeof($data_sources) > 0) {
+ 		foreach ($data_sources as $data_source) {
+ 			form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
++
++				$ds_table['data_source'] = $data_source;
++				$ds_table['data_input_name'] = $data_source['data_input_name'];
++				$ds_table['active'] = (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");
++				$ds_table['template_name'] = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
++
++				$ds_table = do_hook_function("data_sources_table", $ds_table);
++
+ 				?>
+ 				<td>
+ 					<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>
+ 				</td>
+ 				<td>
+-					<?php print $data_source["data_input_name"];?>
++					<?php print $ds_table['data_input_name']; ?>
+ 				</td>
+ 				<td>
+-					<?php print (($data_source["active"] == "on") ? "Yes" : "<span style='color: red;'>No</span>");?>
++					<?php print $ds_table['active']; ?>
+ 				</td>
+ 				<td>
+-					<?php print ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);?>
++					<?php print $ds_table['template_name']; ?>
+ 				</td>
+ 				<td style="<?php print get_checkbox_style();?>" width="1%" align="right">
+ 					<input type='checkbox' style='margin: 0px;' name='chk_<?php print $data_source["local_data_id"];?>' title="<?php print $data_source["name_cache"];?>">
+ 				</td>
+ 			</tr>
+ 			<?php
+ 		}
+ 
+diff -Nar -U 8 cacti-0.8.6g/graphs_new.php cacti-0.8.6g-new/graphs_new.php
+--- cacti-0.8.6g/graphs_new.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/graphs_new.php	2005-09-12 10:49:29.000000000 -0500
+@@ -394,17 +394,18 @@
+ 		</tr>
+ 
+ 		<tr>
+ 			<td class="textArea" style="padding: 3px;" width="300" nowrap>
+ 				Create new graphs for the following host:
+ 			</td>
+ 			<td class="textInfo" rowspan="2" valign="top">
+ 				<span style="color: #c16921;">*</span><a href="host.php?action=edit&id=<?php print $_REQUEST["host_id"];?>">Edit this Host</a><br>
+-				<span style="color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a>
++				<span style="color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a><br>
++				<?php do_hook("graphs_new_top_links"); ?>
+ 			</td>
+ 		</tr>
+ 			<td>
+ 				<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">
+ 					<?php
+ 					$hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname");
+ 
+ 					if (sizeof($hosts) > 0) {
+diff -Nar -U 8 cacti-0.8.6g/include/config_arrays.php cacti-0.8.6g-new/include/config_arrays.php
+--- cacti-0.8.6g/include/config_arrays.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/include/config_arrays.php	2005-09-12 13:17:45.000000000 -0500
+@@ -19,16 +19,18 @@
+  | Ian Berry. See about.php for specific developer credit. Any questions   |
+  | or comments regarding this code should be directed to:                  |
+  | - iberry at raxnet.net                                                     |
+  +-------------------------------------------------------------------------+
+  | - raXnet - http://www.raxnet.net/                                       |
+  +-------------------------------------------------------------------------+
+ */
+ 
++global $menu;
++
+ $messages = array(
+ 	1  => array(
+ 		"message" => 'Save Successful.',
+ 		"type" => "info"),
+ 	2  => array(
+ 		"message" => 'Save Failed',
+ 		"type" => "error"),
+ 	3  => array(
+@@ -423,9 +425,11 @@
+ 	GD_Y_MN_D =>"Year, Month Name, Day"
+ 	);
+ 
+ $graph_datechar = array(
+ 	GDC_HYPHEN => "-",
+ 	GDC_SLASH => "/"
+ 	);
+ 
+-?>
++do_hook("config_arrays");
++
++?>
+\ No newline at end of file
+diff -Nar -U 8 cacti-0.8.6g/include/config_form.php cacti-0.8.6g-new/include/config_form.php
+--- cacti-0.8.6g/include/config_form.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/include/config_form.php	2005-09-12 10:49:29.000000000 -0500
+@@ -994,9 +994,11 @@
+ 		"value" => "|arg1:policy_graph_templates|"
+ 		),
+ 	"save_component_user" => array(
+ 		"method" => "hidden",
+ 		"value" => "1"
+ 		)
+ 	);
+ 
++do_hook("config_form");
++
+ ?>
+diff -Nar -U 8 cacti-0.8.6g/include/config.php cacti-0.8.6g-new/include/config.php
+--- cacti-0.8.6g/include/config.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/include/config.php	2005-09-12 10:51:51.000000000 -0500
+@@ -26,44 +26,62 @@
+ 
+ /* make sure these values refect your actual database/host/user/password */
+ $database_type = "mysql";
+ $database_default = "cacti";
+ $database_hostname = "localhost";
+ $database_username = "cactiuser";
+ $database_password = "cactiuser";
+ 
++
++$plugins = array();
++//$plugins[] = 'thold';
++
++/* Do not edit this line */
++$config = array();
++
++/* This is full URL Path to the Cacti installation 
++   For example, if your cacti was accessible by http://server/cacti/ you would user '/cacti/'
++   as the url path.  For just http://server/ use '/'
++*/
++
++$config["url_path"] = '/';
++
+ /* ----- you probably do not need to change anything below this line ----- */
+ 
+ /* Files that do not need http header information - Command line scripts */
+ $no_http_header_files = array(
+ 	"poller.php",
+ 	"cmd.php",
+ 	"query_host_cpu.php",
+ 	"query_host_partitions.php",
+ 	"sql.php",
+ 	"ss_host_cpu.php",
+ 	"ss_host_disk.php",
+ 	"ss_sql.php"
+ );
+ 
+-$config = array();
+ $colors = array();
+ 
+ /* this should be auto-detected, set it manually if needed */
+ $config["cacti_server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix";
+ 
+ /* built-in snmp support */
+ $config["php_snmp_support"] = function_exists("snmpget");
+ 
+ /* used for includes */
+ $config["base_path"] = strtr(ereg_replace("(.*)[\/\\]include", "\\1", dirname(__FILE__)), "\\", "/");
+ $config["library_path"] = ereg_replace("(.*[\/\\])include", "\\1lib", dirname(__FILE__));
+ $config["include_path"] = dirname(__FILE__);
+ 
++/* include the plugin function, we do this before everything else,
++   incase we want to add hooks to change config options */
++
++include_once($config["include_path"] . "/plugins.php");
++
+ /* colors */
+ $colors["dark_outline"] = "454E53";
+ $colors["dark_bar"] = "AEB4B7";
+ $colors["panel"] = "E5E5E5";
+ $colors["panel_text"] = "000000";
+ $colors["panel_link"] = "000000";
+ $colors["light"] = "F5F5F5";
+ $colors["alternate"] = "E7E9F2";
+@@ -157,9 +175,9 @@
+ include_once($config["library_path"] . "/html_utility.php");
+ include_once($config["library_path"] . "/html_validate.php");
+ include_once($config["library_path"] . "/variables.php");
+ include_once($config["library_path"] . "/auth.php");
+ 
+ /* current cacti version */
+ $config["cacti_version"] = "0.8.6g";
+ 
+-?>
++?>
+\ No newline at end of file
+diff -Nar -U 8 cacti-0.8.6g/include/config_settings.php cacti-0.8.6g-new/include/config_settings.php
+--- cacti-0.8.6g/include/config_settings.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/include/config_settings.php	2005-09-12 13:16:53.000000000 -0500
+@@ -816,9 +816,11 @@
+ 			"friendly_name" => "Unit Font File",
+ 			"description" => "The size of the font used for Graph Unit items",
+ 			"method" => "textbox",
+ 			"max_length" => "100"
+ 			)
+ 		)
+ 	);
+ 
+-?>
++do_hook("config_settings");
++
++?>
+\ No newline at end of file
+diff -Nar -U 8 cacti-0.8.6g/include/plugins.php cacti-0.8.6g-new/include/plugins.php
+--- cacti-0.8.6g/include/plugins.php	1969-12-31 17:00:00.000000000 -0700
++++ cacti-0.8.6g-new/include/plugins.php	2005-09-12 10:49:29.000000000 -0500
+@@ -0,0 +1,70 @@
++<?php
++
++/*
++ * Copyright (c) 1999-2005 The SquirrelMail Project Team (http://squirrelmail.org)
++ * Licensed under the GNU GPL. For full terms see the file COPYING.
++ */
++
++global $plugin_hooks;
++$plugin_hooks = array();
++
++function use_plugin ($name) {
++    global $config;
++    if (file_exists($config["base_path"] . "/plugins/$name/setup.php")) {
++        include_once($config["base_path"] . "/plugins/$name/setup.php");
++        $function = "plugin_init_$name";
++        if (function_exists($function)) {
++            $function();
++        }
++    }
++}
++
++/**
++ * This function executes a hook.
++ * @param string $name Name of hook to fire
++ * @return mixed $data
++ */
++function do_hook ($name) {
++    global $plugin_hooks;
++    $data = func_get_args();
++    $ret = '';
++
++    if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
++        foreach ($plugin_hooks[$name] as $function) {
++            if (function_exists($function)) {
++                $function($data);
++            }
++        }
++    }
++
++    /* Variable-length argument lists have a slight problem when */
++    /* passing values by reference. Pity. This is a workaround.  */
++    return $data;
++}
++
++function do_hook_function($name,$parm=NULL) {
++    global $plugin_hooks;
++    $ret = $parm;
++
++    if (isset($plugin_hooks[$name])
++          && is_array($plugin_hooks[$name])) {
++        foreach ($plugin_hooks[$name] as $function) {
++            if (function_exists($function)) {
++                $ret = $function($ret);
++            }
++        }
++    }
++
++    /* Variable-length argument lists have a slight problem when */
++    /* passing values by reference. Pity. This is a workaround.  */
++    return $ret;
++}
++
++/* On startup, register all plugins configured for use. */
++if (isset($plugins) && is_array($plugins)) {
++    foreach ($plugins as $name) {
++        use_plugin($name);
++    }
++}
++
++?>
+\ No newline at end of file
+diff -Nar -U 8 cacti-0.8.6g/include/top_graph_header.php cacti-0.8.6g-new/include/top_graph_header.php
+--- cacti-0.8.6g/include/top_graph_header.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/include/top_graph_header.php	2005-09-12 10:49:29.000000000 -0500
+@@ -76,75 +76,78 @@
+ ?>
+ <html>
+ <head>
+ 	<title>cacti</title>
+ 	<?php if (isset($_SESSION["custom"])) {
+ 		if ($_SESSION["custom"]) {
+ 			print "<meta http-equiv=refresh content='99999'; url='" . basename($_SERVER["PHP_SELF"]) . "'>\r\n";
+ 		}else{
+-			print "<meta http-equiv=refresh content='" . read_graph_config_option("page_refresh") . "'; url='" . basename($_SERVER["PHP_SELF"]) . "'>\r\n";
++			$refresh = do_hook_function("top_graph_refresh", read_graph_config_option("page_refresh"));
++			print "<meta http-equiv=refresh content='" . $refresh . "'; url='" . basename($_SERVER["PHP_SELF"]) . "'>\r\n";
+ 		}
+ 	}
+ 	?>
+-	<link href="include/main.css" rel="stylesheet">
++	<link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
+ 
+-	<script type="text/javascript" src="include/treeview/ua.js"></script>
+-	<script type="text/javascript" src="include/treeview/ftiens4.js"></script>
+-	<script type="text/javascript" src="include/jscalendar/calendar.js"></script>
+-	<script type="text/javascript" src="include/jscalendar/lang/calendar-en.js"></script>
+-	<script type="text/javascript" src="include/jscalendar/calendar-setup.js"></script>
++	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script>
++	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script>
++	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
++	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
++	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
+ </head>
+ 
+ <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
+ 
+ <table width="100%" height="100%" cellspacing="0" cellpadding="0">
+ 	<tr height="37" bgcolor="#a9a9a9">
+ 		<td colspan="2" valign="bottom" nowrap>
+ 			<table width="100%" cellspacing="0" cellpadding="0">
+ 				<tr>
+ 					<td nowrap>
+-						&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;
++						&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
++						do_hook("top_graph_header_tabs");
++					?>&nbsp;
+ 					</td>
+ 					<td>
+-						<img src="images/cacti_backdrop2.gif" align="absmiddle">
++						<img src="<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif" align="absmiddle">
+ 					</td>
+ 					<td align="right" nowrap>
+-						<?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>
++						<?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 ($_REQU
 EST["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>
+ 					</td>
+ 				</tr>
+ 			</table>
+ 		</td>
+ 	</tr>
+ 	<tr height="2" colspan="2" bgcolor="#183c8f">
+ 		<td colspan="2">
+-			<img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
++			<img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
+ 		</td>
+ 	</tr>
+ 	<tr height="5" bgcolor="#e9e9e9">
+ 		<td colspan="2">
+ 			<table width="100%">
+ 				<tr>
+ 					<td>
+ 						<?php draw_navigation_text();?>
+ 					</td>
+ 					<td align="right">
+ 						<?php if ((isset($_SESSION["sess_user_id"])) && ($using_guest_account == false)) { ?>
+-						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;
++						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;
+ 						<?php } ?>
+ 					</td>
+ 				</tr>
+ 			</table>
+ 		</td>
+ 	</tr>
+ 	<tr>
+-		<td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
+-			<img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
++		<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;">
++			<img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
+ 		</td>
+-		<td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;">
++		<td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;">
+ 
+ 		</td>
+ 	</tr>
+ 
+ 	<?php if ((basename($_SERVER["PHP_SELF"]) == "graph.php") && ($_REQUEST["action"] == "properties")) {?>
+ 	<tr>
+ 		<td valign="top" height="1" colspan="3" bgcolor="#efefef">
+ 			<?php
+diff -Nar -U 8 cacti-0.8.6g/include/top_header.php cacti-0.8.6g-new/include/top_header.php
+--- cacti-0.8.6g/include/top_header.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/include/top_header.php	2005-09-12 10:56:22.000000000 -0500
+@@ -19,79 +19,79 @@
+  | Ian Berry. See about.php for specific developer credit. Any questions   |
+  | or comments regarding this code should be directed to:                  |
+  | - iberry at raxnet.net                                                     |
+  +-------------------------------------------------------------------------+
+  | - raXnet - http://www.raxnet.net/                                       |
+  +-------------------------------------------------------------------------+
+ */
+ 
+-global $colors;
++global $colors, $config;
+ ?>
+ <html>
+ <head>
+ 	<title>cacti</title>
+-	<link href="include/main.css" rel="stylesheet">
+-	<script type="text/javascript" src="include/layout.js"></script>
++	<link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
++	<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
+ </style>
+ </head>
+ 
+-<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/left_border.gif">
+-
++<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="<?php echo $config['url_path']; ?>images/left_border.gif">
+ <table width="100%" cellspacing="0" cellpadding="0">
+ 	<tr height="37" bgcolor="#a9a9a9">
+ 		<td valign="bottom" colspan="3" nowrap>
+ 			<table width="100%" cellspacing="0" cellpadding="0">
+ 				<tr>
+ 					<td valign="bottom">
+-						&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>
+-					</td>
++						&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
++						do_hook("top_header_tabs");
++					?></td>
+ 					<td align="right">
+-						<img src="images/cacti_backdrop.gif" align="absmiddle">
++						<img src="<?php echo $config['url_path']; ?>images/cacti_backdrop.gif" align="absmiddle">
+ 					</td>
+ 				</tr>
+ 			</table>
+ 		</td>
+ 	</tr>
+ 	<tr height="2" bgcolor="#183c8f">
+ 		<td colspan="3">
+-			<img src="images/transparent_line.gif" width="170" height="2" border="0"><br>
++			<img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="170" height="2" border="0"><br>
+ 		</td>
+ 	</tr>
+ 	<tr height="5" bgcolor="#e9e9e9">
+ 		<td colspan="3">
+ 			<table width="100%">
+ 				<tr>
+ 					<td>
+ 						<?php draw_navigation_text();?>
+ 					</td>
+ 					<td align="right">
+ 						<?php if (read_config_option("global_auth") == "on") { ?>
+-						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;
++						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;
+ 						<?php } ?>
+ 					</td>
+ 				</tr>
+ 			</table>
+ 		</td>
+ 	</tr>
+ 	<tr>
+-		<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;">
+-			<img src="images/transparent_line.gif" width="135" height="2" border="0"><br>
++		<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;">
++			<img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="2" border="0"><br>
+ 		</td>
+-		<td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
++		<td colspan="2" height="8" style="background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
+ 
+ 		</td>
+ 	</tr>
+ 	<tr height="5">
+ 		<td valign="top" rowspan="2" width="135" style="padding: 5px; border-right: #aaaaaa 1px solid;" bgcolor='#f5f5f5'>
+ 			<table bgcolor="#f5f5f5" width="100%" cellpadding="1" cellspacing="0" border="0">
+ 				<?php draw_menu();?>
+ 			</table>
+ 
+-			<img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
+-			<p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
+-			<img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
++			<img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
++			<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>
++			<img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="135" height="5" border="0"><br>
+ 		</td>
+ 		<td></td>
+ 	</tr>
+ 	<tr>
+ 		<td width="135" height="500"></td>
+ 		<td width="100%" valign="top"><?php display_output_messages();?>
+diff -Nar -U 8 cacti-0.8.6g/lib/api_device.php cacti-0.8.6g-new/lib/api_device.php
+--- cacti-0.8.6g/lib/api_device.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/lib/api_device.php	2005-09-12 10:49:29.000000000 -0500
+@@ -71,16 +71,18 @@
+ 	$save["snmp_community"] = form_input_validate($snmp_community, "snmp_community", "", true, 3);
+ 	$save["snmp_version"] = form_input_validate($snmp_version, "snmp_version", "", true, 3);
+ 	$save["snmp_username"] = form_input_validate($snmp_username, "snmp_username", "", true, 3);
+ 	$save["snmp_password"] = form_input_validate($snmp_password, "snmp_password", "", true, 3);
+ 	$save["snmp_port"] = form_input_validate($snmp_port, "snmp_port", "^[0-9]+$", false, 3);
+ 	$save["snmp_timeout"] = form_input_validate($snmp_timeout, "snmp_timeout", "^[0-9]+$", false, 3);
+ 	$save["disabled"] = form_input_validate($disabled, "disabled", "", true, 3);
+ 
++	$save = do_hook_function("api_device_save", $save);
++
+ 	$host_id = 0;
+ 
+ 	if (!is_error_message()) {
+ 		$host_id = sql_save($save, "host");
+ 
+ 		if ($host_id) {
+ 			raise_message(1);
+ 
+diff -Nar -U 8 cacti-0.8.6g/lib/functions.php cacti-0.8.6g-new/lib/functions.php
+--- cacti-0.8.6g/lib/functions.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/lib/functions.php	2005-09-12 10:49:29.000000000 -0500
+@@ -181,19 +181,19 @@
+ 
+ 	return $field_value;
+ }
+ 
+ /* is_error_message - finds whether an error message has been raised and has not been outputted to the
+      user
+    @returns - (bool) whether the messages array contains an error or not */
+ function is_error_message() {
+-	global $config;
++	global $config, $messages;
+ 
+-	include($config["include_path"] . "/config_arrays.php");
++	include_once($config["include_path"] . "/config_arrays.php");
+ 
+ 	if (isset($_SESSION["sess_messages"])) {
+ 		if (is_array($_SESSION["sess_messages"])) {
+ 			foreach (array_keys($_SESSION["sess_messages"]) as $current_message_id) {
+ 				if ($messages[$current_message_id]["type"] == "error") { return true; }
+ 			}
+ 		}
+ 	}
+@@ -557,16 +557,18 @@
+ 	if ($issue_log_message) {
+ 		if ($hosts[$host_id]["status"] == HOST_DOWN) {
+ 			cacti_log("Host[$host_id] ERROR: HOST EVENT: Host is DOWN Message: " . $hosts[$host_id]["status_last_error"], $print_data_to_stdout);
+ 		} else {
+ 			cacti_log("Host[$host_id] NOTICE: HOST EVENT: Host Returned from DOWN State: ", $print_data_to_stdout);
+ 		}
+ 	}
+ 
++	do_hook_function("update_host_status", array('issue_log_message' => $issue_log_message, 'status' => $status, 'host_id' => $host_id, 'hosts' => $hosts));
++
+ 	db_execute("update host set
+ 		status = '" . $hosts[$host_id]["status"] . "',
+ 		status_event_count = '" . $hosts[$host_id]["status_event_count"] . "',
+ 		status_fail_date = '" . $hosts[$host_id]["status_fail_date"] . "',
+ 		status_rec_date = '" . $hosts[$host_id]["status_rec_date"] . "',
+ 		status_last_error = '" . $hosts[$host_id]["status_last_error"] . "',
+ 		min_time = '" . $hosts[$host_id]["min_time"] . "',
+ 		max_time = '" . $hosts[$host_id]["max_time"] . "',
+@@ -1345,16 +1347,18 @@
+ 		"templates_export.php:save" => array("title" => "Export Results", "mapping" => "index.php:,templates_export.php:", "url" => "templates_export.php", "level" => "2"),
+ 		"templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
+ 		"smtp_servers.php:" => array("title" => "Coming Soon", "mapping" => "index.php:", "url" => "smtp_servers.php", "level" => "1"),
+ 		"email_templates.php:" => array("title" => "Coming Soon", "mapping" => "index.php:", "url" => "email_templates.php", "level" => "1"),
+ 		"event_queue.php:" => array("title" => "Coming Soon", "mapping" => "index.php:", "url" => "event_queue.php", "level" => "1"),
+ 		"smtp_queue.php:" => array("title" => "Coming Soon", "mapping" => "index.php:", "url" => "smtp_queue.php", "level" => "1"),
+ 		);
+ 
++	$nav = do_hook_function("draw_navigation_text", $nav);
++
+ 	$current_page = basename($_SERVER["PHP_SELF"]);
+ 	$current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
+ 
+ 	/* find the current page in the big array */
+ 	$current_array = $nav{$current_page . ":" . $current_action};
+ 	$current_mappings = split(",", $current_array["mapping"]);
+ 	$current_nav = "";
+ 
+diff -Nar -U 8 cacti-0.8.6g/lib/html_form.php cacti-0.8.6g-new/lib/html_form.php
+--- cacti-0.8.6g/lib/html_form.php	2005-09-08 18:56:24.000000000 -0500
++++ cacti-0.8.6g-new/lib/html_form.php	2005-09-12 10:49:29.000000000 -0500
+@@ -429,16 +429,17 @@
+ <?php }
+ 
+ /* form_save_button - draws a (save|create) and cancel button at the bottom of
+      an html edit form
+    @arg $cancel_url - the url to go to when the user clicks 'cancel'
+    @arg $force_type - if specified, will force the 'action' button to be either
+      'save' or 'create'. otherwise this field should be properly auto-detected */
+ function form_save_button($cancel_url, $force_type = "") {
++	global $config;
+ 	if (empty($force_type)) {
+ 		if (empty($_GET["id"])) {
+ 			$img = "button_create.gif";
+ 			$alt = "Create";
+ 		}else{
+ 			$img = "button_save.gif";
+ 			$alt = "Save";
+ 		}
+@@ -449,18 +450,18 @@
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list