packages: cacti/cacti-PA.patch, cacti/cacti-adodb.patch, cacti/cacti-config...

arekm arekm at pld-linux.org
Wed Oct 12 20:43:54 CEST 2011


Author: arekm                        Date: Wed Oct 12 18:43:54 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- up to 0.8.7h

---- Files affected:
packages/cacti:
   cacti-PA.patch (1.6 -> 1.7) , cacti-adodb.patch (1.1 -> 1.2) , cacti-config.patch (1.10 -> 1.11) , cacti.spec (1.141 -> 1.142) , host_name-url.patch (1.3 -> 1.4) , cli-relpath.patch (1.2 -> NONE)  (REMOVED)

---- Diffs:

================================================================
Index: packages/cacti/cacti-PA.patch
diff -u packages/cacti/cacti-PA.patch:1.6 packages/cacti/cacti-PA.patch:1.7
--- packages/cacti/cacti-PA.patch:1.6	Wed Dec 15 19:40:05 2010
+++ packages/cacti/cacti-PA.patch	Wed Oct 12 20:43:48 2011
@@ -1,6 +1,6 @@
-diff -Naur cacti-0.8.7g/auth_changepassword.php cacti-0.8.7g-PA-v2.9/auth_changepassword.php
---- cacti-0.8.7g/auth_changepassword.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/auth_changepassword.php	2010-10-17 20:09:52.000000000 -0400
+diff -ruBbdNa cacti-0.8.7h/auth_changepassword.php cacti-0.8.7h-pia//auth_changepassword.php
+--- cacti-0.8.7h/auth_changepassword.php	2011-09-25 21:04:22.000000000 -0400
++++ cacti-0.8.7h-pia//auth_changepassword.php	2011-09-25 21:10:07.620946156 -0400
 @@ -59,6 +59,8 @@
  					header("Location: index.php"); break;
  				case '3': /* default graph page */
@@ -10,26 +10,33 @@
  			}
  		}else{
  			header("Location: graph_view.php");
-diff -Naur cacti-0.8.7g/auth_login.php cacti-0.8.7g-PA-v2.9/auth_login.php
---- cacti-0.8.7g/auth_login.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/auth_login.php	2010-10-17 20:09:52.000000000 -0400
-@@ -124,10 +124,12 @@
+diff -ruBbdNa cacti-0.8.7h/auth_login.php cacti-0.8.7h-pia//auth_login.php
+--- cacti-0.8.7h/auth_login.php	2011-09-25 21:04:22.000000000 -0400
++++ cacti-0.8.7h-pia//auth_login.php	2011-09-25 21:46:39.701939535 -0400
+@@ -124,12 +124,14 @@
  		}
  
  	default:
--		/* Builtin Auth */
--		if ((!$user_auth) && (!$ldap_error)) {
--			/* if auth has not occured process for builtin - AKA Ldap fall through */
--			$user = db_fetch_row("SELECT * FROM user_auth WHERE username = '" . $username . "' AND password = '" . md5(get_request_var_post("login_password")) . "' AND realm = 0");
 +		if (!api_plugin_hook_function('login_process', false)) {
-+			/* Builtin Auth */
-+			if ((!$user_auth) && (!$ldap_error)) {
-+				/* if auth has not occured process for builtin - AKA Ldap fall through */
-+				$user = db_fetch_row("SELECT * FROM user_auth WHERE username = '" . $username . "' AND password = '" . md5(get_request_var_post("login_password")) . "' AND realm = 0");
-+			}
+ 		/* Builtin Auth */
+ 		if ((!$user_auth) && (!$ldap_error)) {
+ 			/* if auth has not occured process for builtin - AKA Ldap fall through */
+ 			$user = db_fetch_row("SELECT * FROM user_auth WHERE username = " . $cnn_id->qstr($username) . " AND password = '" . md5(get_request_var_post("login_password")) . "' AND realm = 0");
  		}
  	}
++	}
  	/* end of switch */
+ 
+ 	/* Create user from template if requested */
+@@ -168,7 +170,7 @@
+ 	/* Process the user  */
+ 	if (sizeof($user) > 0) {
+ 		cacti_log("LOGIN: User '" . $user["username"] . "' Authenticated", false, "AUTH");
+-		db_execute("INSERT INTO user_log (username,user_id,result,ip,time) VALUES (" . $cnn_id->qstr($username) ."," . $user["id"] . ",1,'" . $_SERVER["REMOTE_ADDR"] . "',NOW())");
++		db_execute("INSERT INTO user_log (username,user_id,result,ip,time) VALUES (" . $cnn_id->qstr($username) . "," . $user["id"] . ",1,'" . $_SERVER["REMOTE_ADDR"] . "',NOW())");
+ 		/* is user enabled */
+ 		$user_enabled = $user["enabled"];
+ 		if ($user_enabled != "on") {
 @@ -189,29 +191,42 @@
  		decide what to do next */
  		switch ($user["login_opts"]) {
@@ -37,34 +44,25 @@
 -				if (sizeof(db_fetch_assoc("SELECT realm_id FROM user_auth_realm WHERE realm_id = 8 AND user_id = " . $_SESSION["sess_user_id"])) == 0) {
 -					header("Location: graph_view.php");
 -				}else{
--					if (isset($_SERVER["HTTP_REFERER"])) {
--						$referer = $_SERVER["HTTP_REFERER"];
--						if (basename($referer) == "logout.php") {
--							$referer = "index.php";
--						}
--					} else if (isset($_SERVER["REQUEST_URI"])) {
--						$referer = $_SERVER["REQUEST_URI"];
--						if (basename($referer) == "logout.php") {
--							$referer = "index.php";
--						}
--					} else {
--						$referer = "index.php";
 +				/* because we use plugins, we can't redirect back to graph_view.php if they don't
 +				 * have console access
 +				 */
-+				if (isset($_SERVER["HTTP_REFERER"])) {
-+					$referer = $_SERVER["HTTP_REFERER"];
-+					if (basename($referer) == "logout.php") {
+ 					if (isset($_SERVER["HTTP_REFERER"])) {
+ 						$referer = $_SERVER["HTTP_REFERER"];
+ 						if (basename($referer) == "logout.php") {
+-							$referer = "index.php";
 +						$referer = $config['url_path'] . "index.php";
-+					}
-+				} else if (isset($_SERVER["REQUEST_URI"])) {
-+					$referer = $_SERVER["REQUEST_URI"];
-+					if (basename($referer) == "logout.php") {
+ 						}
+ 					} else if (isset($_SERVER["REQUEST_URI"])) {
+ 						$referer = $_SERVER["REQUEST_URI"];
+ 						if (basename($referer) == "logout.php") {
+-							$referer = "index.php";
 +						$referer = $config['url_path'] . "index.php";
- 					}
-+				} else {
+ 						}
+ 					} else {
+-						$referer = "index.php";
 +					$referer = $config['url_path'] . "index.php";
-+				}
+ 					}
 +
 +				if (substr_count($referer, "plugins")) {
  					header("Location: " . $referer);
@@ -90,26 +88,44 @@
  		}
  		exit;
  	}else{
+@@ -222,7 +237,7 @@
+ 			exit;
+ 		}else{
+ 			/* BAD username/password builtin and LDAP */
+-			db_execute("INSERT INTO user_log (username,user_id,result,ip,time) VALUES ('" . $username . "',0,0,'" . $_SERVER["REMOTE_ADDR"] . "',NOW())");
++			db_execute("INSERT INTO user_log (username,user_id,result,ip,time) VALUES (" . $cnn_id->qstr($username) . ",0,0,'" . $_SERVER["REMOTE_ADDR"] . "',NOW())");
+ 		}
+ 	}
+ }
+@@ -249,7 +264,7 @@
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+ <html>
+ <head>
+-	<title>Login to Cacti</title>
++	<title><?php print api_plugin_hook_function("login_title", "Login to Cacti");?></title>
+ 	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ 	<STYLE TYPE="text/css">
+ 	<!--
 @@ -264,9 +279,17 @@
  <body bgcolor="#FFFFFF" onload="document.login.login_username.focus()">
  	<form name="login" method="post" action="<?php print basename($_SERVER["PHP_SELF"]);?>">
  	<input type="hidden" name="action" value="login">
 +<?php
 +
-+api_plugin_hook("login_before");
++api_plugin_hook_function("login_before", array('ldap_error' => $ldap_error, 'ldap_error_message' => $ldap_error_message, 'username' => $username, 'user_enabled' => $user_enabled, 'action' => $action));
 +
 +$cacti_logo = $config['url_path'] . 'images/auth_login.gif';
 +$cacti_logo = api_plugin_hook_function('cacti_image', $cacti_logo);
 +
 +?>
- 	<table align="center">
+ 	<table id="login" align="center">
  		<tr>
 -			<td colspan="2"><img src="images/auth_login.gif" border="0" alt=""></td>
 +			<td colspan="2"><center><?php if ($cacti_logo != '') { ?><img src="<?php echo $cacti_logo; ?>" border="0" alt=""><?php } ?></center></td>
  		</tr>
  		<?php
  
-@@ -303,22 +326,29 @@
+@@ -303,13 +326,19 @@
  			<td><input type="password" name="login_password" size="40" style="width: 295px;"></td>
  		</tr>
  		<?php
@@ -117,7 +133,7 @@
 +		if (read_config_option("auth_method") == "3" || api_plugin_hook_function('login_realms_exist')) {
 +			$realms = api_plugin_hook_function('login_realms', array("local" => array("name" => "Local", "selected" => false), "ldap" => array("name" => "LDAP", "selected" => true)));
 +			?>
- 		<tr>
+ 		<tr id="realm_row">
  			<td>Realm:</td>
  			<td>
 -				<select name="realm" style="width: 295px;">
@@ -132,11 +148,8 @@
 +				?>
  				</select>
  			</td>
--			</tr>
-+		</tr>
- 		<?php }?>
- 		<tr style="height:10px;"><td></td></tr>
- 		<tr>
+ 			</tr>
+@@ -319,6 +348,7 @@
  			<td><input type="submit" value="Login"></td>
  		</tr>
  	</table>
@@ -144,9 +157,9 @@
  	</form>
  </body>
  </html>
-diff -Naur cacti-0.8.7g/cli/add_graph_template.php cacti-0.8.7g-PA-v2.9/cli/add_graph_template.php
---- cacti-0.8.7g/cli/add_graph_template.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/cli/add_graph_template.php	2010-10-17 20:09:52.000000000 -0400
+diff -ruBbdNa cacti-0.8.7h/cli/add_graph_template.php cacti-0.8.7h-pia//cli/add_graph_template.php
+--- cacti-0.8.7h/cli/add_graph_template.php	2011-09-25 21:04:21.000000000 -0400
++++ cacti-0.8.7h-pia//cli/add_graph_template.php	2011-09-25 21:10:07.621946045 -0400
 @@ -144,6 +144,7 @@
  		exit(1);
  	}else{
@@ -155,31 +168,20 @@
  	}
  
  	if (is_error_message()) {
-diff -Naur cacti-0.8.7g/cli/add_tree.php cacti-0.8.7g-PA-v2.9/cli/add_tree.php
---- cacti-0.8.7g/cli/add_tree.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/cli/add_tree.php	2010-10-17 20:09:52.000000000 -0400
-@@ -33,6 +33,7 @@
- include(dirname(__FILE__)."/../include/global.php");
- include_once($config["base_path"]."/lib/api_automation_tools.php");
- include_once($config["base_path"].'/lib/tree.php');
-+include_once($config["base_path"].'/lib/api_tree.php');
- 
- /* process calling arguments */
- $parms = $_SERVER["argv"];
-diff -Naur cacti-0.8.7g/cli/host_update_template.php cacti-0.8.7g-PA-v2.9/cli/host_update_template.php
---- cacti-0.8.7g/cli/host_update_template.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/cli/host_update_template.php	2010-10-17 20:09:52.000000000 -0400
+diff -ruBbdNa cacti-0.8.7h/cli/host_update_template.php cacti-0.8.7h-pia//cli/host_update_template.php
+--- cacti-0.8.7h/cli/host_update_template.php	2011-09-25 21:04:21.000000000 -0400
++++ cacti-0.8.7h-pia//cli/host_update_template.php	2011-09-25 21:10:07.621946045 -0400
 @@ -136,6 +136,7 @@
  
  			foreach ($graph_templates as $graph_template) {
  				db_execute("REPLACE INTO host_graph (host_id, graph_template_id) VALUES (" . $host["id"] . ", " . $graph_template["graph_template_id"] . ")");
-+				api_plugin_hook_function('add_graph_template_to_host', array("host_id" => $host_id, "graph_template_id" => $graph_template["graph_template_id"]));
++				api_plugin_hook_function('add_graph_template_to_host', array("host_id" => $host["id"], "graph_template_id" => $graph_template["graph_template_id"]));
  			}
  		}
  	}
-diff -Naur cacti-0.8.7g/data_sources.php cacti-0.8.7g-PA-v2.9/data_sources.php
---- cacti-0.8.7g/data_sources.php	2010-09-19 21:39:05.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/data_sources.php	2010-10-17 20:09:52.000000000 -0400
+diff -ruBbdNa cacti-0.8.7h/data_sources.php cacti-0.8.7h-pia//data_sources.php
+--- cacti-0.8.7h/data_sources.php	2011-09-25 21:04:22.000000000 -0400
++++ cacti-0.8.7h-pia//data_sources.php	2011-09-25 21:10:07.621946045 -0400
 @@ -44,6 +44,8 @@
  	7 => "Disable"
  	);
@@ -189,7 +191,34 @@
  /* set default action */
  if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
  
-@@ -402,6 +404,8 @@
+@@ -321,6 +323,8 @@
+ 						db_execute("delete from graph_templates_item where task_item_id IN (" . implode(",", $data_template_rrds) . ") and local_graph_id > 0");
+ 					}
+ 
++					api_plugin_hook_function('graph_items_remove', $data_template_rrds);
++
+ 					break;
+ 				case '3': /* delete all graphs tied to this data source */
+ 					$graphs = array_rekey(db_fetch_assoc("select
+@@ -336,6 +340,8 @@
+ 						api_graph_remove_multi($graphs);
+ 					}
+ 
++					api_plugin_hook_function('graphs_remove', $graphs);
++
+ 					break;
+ 			}
+ 
+@@ -346,6 +352,8 @@
+ 			}
+ 
+ 			api_data_source_remove_multi($selected_items);
++
++			api_plugin_hook_function('data_source_remove', $selected_items);
+ 		}elseif ($_POST["drp_action"] == "2") { /* change graph template */
+ 			for ($i=0;($i<count($selected_items));$i++) {
+ 				/* ================= input validation ================= */
+@@ -398,6 +406,8 @@
  				api_reapply_suggested_data_source_title($selected_items[$i]);
  				update_data_source_title_cache($selected_items[$i]);
  			}
@@ -198,7 +227,7 @@
  		}
  		header("Location: data_sources.php");
  		exit;
-@@ -545,6 +549,12 @@
+@@ -541,6 +551,12 @@
  				</tr>\n
  				";
  			$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Reapply Suggested Naming to Data Source(s)'>";
@@ -211,7 +240,7 @@
  		}
  	}else{
  		print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one data source.</span></td></tr>\n";
-@@ -683,6 +693,8 @@
+@@ -679,6 +695,8 @@
  	input_validate_input_number(get_request_var("host_id"));
  	/* ==================================================== */
  
@@ -220,44 +249,54 @@
  	$use_data_template = true;
  	$host_id = 0;
  
-@@ -975,8 +987,9 @@
+@@ -971,6 +989,8 @@
  
  	form_save_button("data_sources.php");
  
--	include_once("./include/bottom_footer.php");
 +	api_plugin_hook('data_source_edit_bottom');
- 
-+	include_once("./include/bottom_footer.php");
++
+ 	include_once("./include/bottom_footer.php");
  }
  
- function get_poller_interval($seconds) {
-@@ -1310,8 +1323,10 @@
+@@ -1305,10 +1325,35 @@
  	$i = 0;
  	if (sizeof($data_sources) > 0) {
  		foreach ($data_sources as $data_source) {
 +			$data_source["data_template_name"] = htmlspecialchars($data_source["data_template_name"]);
++			$data_name_cache = title_trim(htmlspecialchars($data_source["name_cache"]), read_config_option("max_title_data_source"));
++
++			if (trim(get_request_var_request("filter") != "")) {
++				$data_source['data_input_name'] = (preg_replace("/(" . preg_quote(get_request_var_request("filter")) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", htmlspecialchars($data_source['data_input_name'])));
++				$data_source['data_template_name'] = preg_replace("/(" . preg_quote(get_request_var_request("filter")) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $data_source['data_template_name']);
++				$data_name_cache = preg_replace("/(" . preg_quote(get_request_var_request("filter")) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", ($data_name_cache));
++			}
++
++			/* keep copy of data source for comparison */
++			$data_source_orig = $data_source;
 +			$data_source = api_plugin_hook_function('data_sources_table', $data_source);
  			/* we're escaping strings here, so no need to escape them on form_selectable_cell */
--			$data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : htmlspecialchars($data_source["data_template_name"]));
-+			$data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
++			if ($data_source_orig["data_template_name"] != $data_source["data_template_name"]) {
++				/* was changed by plugin, plugin has to take care for html-escaping */
++				$data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
++			} else {
++				/* we take care of html-escaping */
+ 			$data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : htmlspecialchars($data_source["data_template_name"]));
++			}
++			if ($data_source_orig["data_input_name"] != $data_source["data_input_name"]) {
++				/* was changed by plugin, plugin has to take care for html-escaping */
++				$data_input_name = ((empty($data_source["data_input_name"])) ? "<em>None</em>" : $data_source["data_input_name"]);
++			} else {
++				/* we take care of html-escaping */
  			$data_input_name    = ((empty($data_source["data_input_name"])) ? "<em>External</em>" : htmlspecialchars($data_source["data_input_name"]));
++			}
  			$poller_interval    = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0);
- 			form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $data_source["local_data_id"]); $i++;
-diff -Naur cacti-0.8.7g/graph_image.php cacti-0.8.7g-PA-v2.9/graph_image.php
---- cacti-0.8.7g/graph_image.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/graph_image.php	2010-10-17 20:09:52.000000000 -0400
-@@ -44,6 +44,8 @@
- /* flush the headers now */
- ob_end_clean();
- 
-+api_plugin_hook_function('graph_image');
 +
- session_write_close();
- 
- $graph_data_array = array();
-diff -Naur cacti-0.8.7g/graph.php cacti-0.8.7g-PA-v2.9/graph.php
---- cacti-0.8.7g/graph.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/graph.php	2010-10-17 20:09:52.000000000 -0400
+ 			form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $data_source["local_data_id"]); $i++;
+ 			form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars("data_sources.php?action=ds_edit&id=" . $data_source["local_data_id"]) . "' title='" . $data_source["name_cache"] . "'>" . ((get_request_var_request("filter") != "") ? preg_replace("/(" . preg_quote(get_request_var_request("filter")) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlspecialchars($data_source["name_cache"]), read_config_option("max_title_data_source"))) : title_trim(htmlspecialchars($data_source["name_cache"]), read_config_option("max_title_data_source"))) . "</a>", $data_source["local_data_id"]);
+ 			form_selectable_cell($data_source['local_data_id'], $data_source['local_data_id']);
+diff -ruBbdNa cacti-0.8.7h/graph.php cacti-0.8.7h-pia//graph.php
+--- cacti-0.8.7h/graph.php	2011-09-25 21:04:21.000000000 -0400
++++ cacti-0.8.7h-pia//graph.php	2011-09-25 21:10:07.622945935 -0400
 @@ -32,6 +32,8 @@
  include_once("./lib/html_tree.php");
  include_once("./include/top_graph_header.php");
@@ -271,7 +310,7 @@
  
  switch ($_REQUEST["action"]) {
  case 'view':
-+	do_hook_function('page_buttons',
++	api_plugin_hook_function('page_buttons',
 +		array('lgid' => $_GET["local_graph_id"],
 +			'leafid' => '',//$leaf_id,
 +			'mode' => 'mrtg',
@@ -280,23 +319,25 @@
  	?>
  	<tr bgcolor='#<?php print $colors["header"];?>'>
  		<td colspan='3' class='textHeaderDark'>
-@@ -100,6 +108,7 @@
- 								<a href='<?php print htmlspecialchars("graph.php?action=zoom&local_graph_id=" . $_GET["local_graph_id"]. "&rra_id=" . $rra["id"] . "&view_type=" . $_REQUEST["view_type"]);?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
- 								<a href='<?php print htmlspecialchars("graph_xport.php?local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $rra["id"] . "&view_type=" . $_REQUEST["view_type"]);?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
- 								<a href='<?php print htmlspecialchars("graph.php?action=properties&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $rra["id"] . "&view_type=" . $_REQUEST["view_type"]);?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a>
+@@ -102,7 +110,8 @@
+ 								<a href='<?php print htmlspecialchars("graph.php?action=zoom&local_graph_id=" . $_GET["local_graph_id"]. "&rra_id=" . $rra["id"] . "&view_type=" . $_REQUEST["view_type"] . "&graph_start=" . $graph_start . "&graph_end=" . $graph_end);?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
+ 								<a href='<?php print htmlspecialchars("graph_xport.php?local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $rra["id"] . "&view_type=" . $_REQUEST["view_type"] .  "&graph_start=" . $graph_start . "&graph_end=" . $graph_end);?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
+ 								<a href='<?php print htmlspecialchars("graph.php?action=properties&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $rra["id"] . "&view_type=" . $_REQUEST["view_type"] .  "&graph_start=" . $graph_start . "&graph_end=" . $graph_end);?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a>
+-								<a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
 +								<?php api_plugin_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $rra['id'], 'view_type' => $_REQUEST['view_type'])); ?>
++								<a href='#page_top'><img src='<?php print $config['url_path']; ?>images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
  							</td>
  						</tr>
  						<tr>
-@@ -113,6 +122,7 @@
+@@ -116,6 +125,7 @@
  			<?php
  			$i++;
  		}
-+		do_hook_function('tree_view_page_end');
++		api_plugin_hook_function('tree_view_page_end');
  	}
  
  	break;
-@@ -215,6 +225,7 @@
+@@ -218,6 +228,7 @@
  					<td valign='top' style='padding: 3px;' class='noprint'>
  						<a href='<?php print htmlspecialchars("graph.php?action=properties&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $_GET["rra_id"] . "&view_type=" . $_REQUEST["view_type"] . "&graph_start=" . $graph_start . "&graph_end=" . $graph_end);?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a>
  						<a href='<?php print htmlspecialchars("graph_xport.php?local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $_GET["rra_id"] . "&view_type=" . $_REQUEST["view_type"]);?>&graph_start=<?php print $graph_start;?>&graph_end=<?php print $graph_end;?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
@@ -304,30 +345,29 @@
  					</td>
  				</tr>
  				<tr>
-@@ -247,6 +258,7 @@
+@@ -250,6 +261,7 @@
  					<td valign='top' style='padding: 3px;'>
- 						<a href='<?php print htmlspecialchars("graph.php?action=zoom&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $_GET["rra_id"] . "&view_type=" . $_REQUEST["view_type"]);?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
+ 						<a href='<?php print htmlspecialchars("graph.php?action=zoom&local_graph_id=" . $_GET["local_graph_id"]. "&rra_id=" . $_GET["rra_id"] . "&view_type=" . $_REQUEST["view_type"] . "&graph_start=" . get_request_var("graph_start") . "&graph_end=" . get_request_var("graph_end"));?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
  						<a href='<?php print htmlspecialchars("graph_xport.php?local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $_GET["rra_id"] . "&view_type=" . $_REQUEST["view_type"]);?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
 +						<?php api_plugin_hook('graph_buttons', array('hook' => 'properties', 'local_graph_id' => $_GET['local_graph_id'], 'rra' =>  $_GET['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?>
  					</td>
  				</tr>
  				<tr>
-diff -Naur cacti-0.8.7g/graphs_new.php cacti-0.8.7g-PA-v2.9/graphs_new.php
---- cacti-0.8.7g/graphs_new.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/graphs_new.php	2010-10-17 20:09:52.000000000 -0400
-@@ -511,7 +511,8 @@
- 			</td>
- 			<td nowrap style='white-space: nowrap;' class="textInfo" align="center" valign="top">
- 				<span style="white-space: nowrap; color: #c16921;">*</span><a href="<?php print htmlspecialchars("host.php?action=edit&id=" . $_REQUEST["host_id"]);?>">Edit this Host</a><br>
--				<span style="white-space: nowrap; color: #c16921;">*</span><a href="<?php print htmlspecialchars("host.php?action=edit");?>">Create New Host</a>
-+				<span style="white-space: nowrap; color: #c16921;">*</span><a href="<?php print htmlspecialchars("host.php?action=edit");?>">Create New Host</a><br>
-+				<?php api_plugin_hook('graphs_new_top_links'); ?>
- 			</td>
- 		</tr>
- 	</table>
-diff -Naur cacti-0.8.7g/graphs.php cacti-0.8.7g-PA-v2.9/graphs.php
---- cacti-0.8.7g/graphs.php	2010-09-19 21:39:05.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/graphs.php	2010-10-17 20:09:52.000000000 -0400
+diff -ruBbdNa cacti-0.8.7h/graph_image.php cacti-0.8.7h-pia//graph_image.php
+--- cacti-0.8.7h/graph_image.php	2011-09-25 21:04:21.000000000 -0400
++++ cacti-0.8.7h-pia//graph_image.php	2011-09-25 21:10:07.622945935 -0400
+@@ -48,6 +48,8 @@
+ /* flush the headers now */
+ ob_end_clean();
+ 
++api_plugin_hook_function('graph_image');
++
+ session_write_close();
+ 
+ $graph_data_array = array();
+diff -ruBbdNa cacti-0.8.7h/graphs.php cacti-0.8.7h-pia//graphs.php
+--- cacti-0.8.7h/graphs.php	2011-09-25 21:04:21.000000000 -0400
++++ cacti-0.8.7h-pia//graphs.php	2011-09-25 21:10:07.622945935 -0400
 @@ -45,6 +45,8 @@
  	4 => "Convert to Graph Template"
  	);
@@ -337,7 +377,23 @@
  /* set default action */
  if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
  
-@@ -362,6 +364,8 @@
+@@ -287,12 +289,15 @@
+ 
+ 					if (sizeof($data_sources)) {
+ 						api_data_source_remove_multi($data_sources);
++						api_plugin_hook_function('data_source_remove', $data_sources);
+ 					}
+ 
+ 					break;
+ 			}
+ 
+ 			api_graph_remove_multi($selected_items);
++
++			api_plugin_hook_function('graphs_remove', $selected_items);
+ 		}elseif ($_POST["drp_action"] == "2") { /* change graph template */
+ 			input_validate_input_number(get_request_var_post("graph_template_id"));
+ 			for ($i=0;($i<count($selected_items));$i++) {
+@@ -357,6 +362,8 @@
  
  				api_resize_graphs($selected_items[$i], $_POST["graph_width"], $_POST["graph_height"]);
  			}
@@ -346,7 +402,7 @@
  		}
  
  		header("Location: graphs.php");
-@@ -514,6 +518,12 @@
+@@ -509,6 +516,12 @@
  				";
  
  			$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Resize Selected Graph(s)'>";
@@ -359,9 +415,39 @@
  		}
  	}else{
  		print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one graph.</span></td></tr>\n";
-diff -Naur cacti-0.8.7g/host.php cacti-0.8.7g-PA-v2.9/host.php
---- cacti-0.8.7g/host.php	2010-07-09 18:33:46.000000000 -0400
-+++ cacti-0.8.7g-PA-v2.9/host.php	2010-10-17 20:09:52.000000000 -0400
+@@ -1247,6 +1260,9 @@
+ 		$sql_where .= " AND graph_templates_graph.graph_template_id=" . get_request_var_request("template_id");
+ 	}
+ 
++	/* allow plugins to modify sql_where */
++	$sql_where .= api_plugin_hook_function('graphs_sql_where', $sql_where);
++
+ 	/* print checkbox form for validation */
+ 	print "<form name='chk' method='post' action='graphs.php'>\n";
+ 
+diff -ruBbdNa cacti-0.8.7h/graphs_new.php cacti-0.8.7h-pia//graphs_new.php
+--- cacti-0.8.7h/graphs_new.php	2011-09-25 21:04:22.000000000 -0400
++++ cacti-0.8.7h-pia//graphs_new.php	2011-09-25 21:10:07.622945935 -0400
+@@ -512,6 +512,7 @@
+ 			<td nowrap style='white-space: nowrap;' class="textInfo" align="center" valign="top">
+ 				<span style="white-space: nowrap; color: #c16921;">*</span><a href="<?php print htmlspecialchars("host.php?action=edit&id=" . $_REQUEST["host_id"]);?>">Edit this Host</a><br>
+ 				<span style="white-space: nowrap; color: #c16921;">*</span><a href="<?php print htmlspecialchars("host.php?action=edit");?>">Create New Host</a><br>
++				<?php api_plugin_hook('graphs_new_top_links'); ?>
+ 			</td>
+ 		</tr>
+ 	</table>
+@@ -836,7 +837,7 @@
+ 					}
+ 
+ 					while (list($field_name, $field_array) = each($xml_array["fields"])) {
+-						if ($field_array["direction"] == "input" && sizeof($field_names)) {
++						if ($field_array["direction"] == "input") {
+ 							foreach($field_names as $row) {
+ 								if ($row["field_name"] == $field_name) {
+ 									$html_dq_header .= "<td style='height:1px;'><strong><font color='#" . $colors["header_text"] . "'>" . $field_array["name"] . "</font></strong></td>\n";
+diff -ruBbdNa cacti-0.8.7h/host.php cacti-0.8.7h-pia//host.php
+--- cacti-0.8.7h/host.php	2011-09-25 21:04:22.000000000 -0400
++++ cacti-0.8.7h-pia//host.php	2011-09-25 21:10:07.623945827 -0400
 @@ -44,6 +44,8 @@
  	6 => "Change Availability Options"
  	);
@@ -379,7 +465,30 @@
  
  		header("Location: host.php?action=edit&id=" . $_POST["id"]);
  		exit;
-@@ -305,6 +308,8 @@
+@@ -289,16 +292,22 @@
+ 				case '1': /* leave graphs and data_sources in place, but disable the data sources */
+ 					api_data_source_disable_multi($data_sources_to_act_on);
+ 
++					api_plugin_hook_function('data_source_remove', $data_sources_to_act_on);
++
+ 					break;
+ 				case '2': /* delete graphs/data sources tied to this device */
+ 					api_data_source_remove_multi($data_sources_to_act_on);
+ 
+ 					api_graph_remove_multi($graphs_to_act_on);
+ 
++					api_plugin_hook_function('graphs_remove', $graphs_to_act_on);
++
+ 					break;
+ 			}
+ 
+ 			api_device_remove_multi($devices_to_act_on);
++
++			api_plugin_hook_function('device_remove', $devices_to_act_on);
+ 		}elseif (preg_match("/^tr_([0-9]+)$/", $_POST["drp_action"], $matches)) { /* place on tree */
+ 			for ($i=0;($i<count($selected_items));$i++) {
+ 				/* ================= input validation ================= */
+@@ -309,6 +318,8 @@
  
  				api_tree_item_save(0, $_POST["tree_id"], TREE_ITEM_TYPE_HOST, $_POST["tree_item_id"], "", 0, read_graph_config_option("default_rra_id"), $selected_items[$i], 1, 1, false);
  			}
@@ -388,7 +497,7 @@
  		}
  
  		header("Location: host.php");
-@@ -450,6 +455,12 @@
+@@ -454,6 +465,12 @@
  				<input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n
  				";
  			$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Place Device(s) on Tree'>";
@@ -401,7 +510,7 @@
  		}
  	}else{
  		print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one device.</span></td></tr>\n";
-@@ -532,6 +543,8 @@
+@@ -536,6 +553,8 @@
  	input_validate_input_number(get_request_var("id"));
  	/* ==================================================== */
  
@@ -410,7 +519,7 @@
  	if (!empty($_GET["id"])) {
  		$host = db_fetch_row("select * from host where id=" . $_GET["id"]);
  		$header_label = "[edit: " . htmlspecialchars($host["description"]) . "]";
-@@ -643,6 +656,7 @@
+@@ -647,6 +666,7 @@
  					<span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("graphs_new.php?host_id=" . $host["id"]);?>">Create Graphs for this Host</a><br>
  					<span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("data_sources.php?host_id=" . $host["id"] . "&ds_rows=30&filter=&template_id=-1&method_id=-1&page=1");?>">Data Source List</a><br>
  					<span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("graphs.php?host_id=" . $host["id"] . "&graph_rows=30&filter=&template_id=-1&page=1");?>">Graph List</a>
@@ -418,7 +527,7 @@
  				</td>
  			</tr>
  		</table>
-@@ -1107,6 +1121,8 @@
+@@ -1111,6 +1131,8 @@
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti/cacti-PA.patch?r1=1.6&r2=1.7&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti/cacti-adodb.patch?r1=1.1&r2=1.2&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti/cacti-config.patch?r1=1.10&r2=1.11&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti/cacti.spec?r1=1.141&r2=1.142&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti/host_name-url.patch?r1=1.3&r2=1.4&f=u



More information about the pld-cvs-commit mailing list