diff -Nuar cacti-0.8.7a-old/auth_changepassword.php cacti-0.8.7a/auth_changepassword.php --- cacti-0.8.7a-old/auth_changepassword.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/auth_changepassword.php 2007-11-18 09:38:25.000000000 -0600 @@ -54,6 +54,8 @@ header("Location: index.php"); break; case '3': /* default graph page */ header("Location: graph_view.php"); break; + default: + do_hook_function('login_options_navigate', $user['login_opts']); } }else{ header("Location: graph_view.php"); diff -Nuar cacti-0.8.7a-old/auth_login.php cacti-0.8.7a/auth_login.php --- cacti-0.8.7a-old/auth_login.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/auth_login.php 2007-11-18 09:38:25.000000000 -0600 @@ -203,6 +203,8 @@ header("Location: index.php"); break; case '3': /* default graph page */ header("Location: graph_view.php"); break; + default: + do_hook_function('login_options_navigate', $user['login_opts']); } exit; @@ -253,9 +255,18 @@
"> + - + +
+
diff -Nuar cacti-0.8.7a-old/data_sources.php cacti-0.8.7a/data_sources.php --- cacti-0.8.7a-old/data_sources.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/data_sources.php 2007-11-18 09:38:25.000000000 -0600 @@ -1142,6 +1142,7 @@ $i = 0; if (sizeof($data_sources) > 0) { foreach ($data_sources as $data_source) { + $data_source = do_hook_function('data_sources_table', $data_source); $data_template_name = ((empty($data_source["data_template_name"])) ? "None" : $data_source["data_template_name"]); $data_input_name = ((empty($data_source["data_input_name"])) ? "External" : $data_source["data_input_name"]); $poller_interval = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0); diff -Nuar cacti-0.8.7a-old/graph_image.php cacti-0.8.7a/graph_image.php --- cacti-0.8.7a-old/graph_image.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/graph_image.php 2007-11-18 09:38:25.000000000 -0600 @@ -44,6 +44,8 @@ /* flush the headers now */ ob_end_clean(); +do_hook_function('graph_image'); + session_write_close(); $graph_data_array = array(); diff -Nuar cacti-0.8.7a-old/graph.php cacti-0.8.7a/graph.php --- cacti-0.8.7a-old/graph.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/graph.php 2007-11-18 09:39:31.000000000 -0600 @@ -93,6 +93,7 @@ Zoom Graph
CSV Export
Graph Source/Properties + 'view', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $rra['id'], 'view_type' => $_REQUEST['view_type'])); ?> @@ -207,6 +208,7 @@ Graph Source/Properties CSV Export
+ 'zoom', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $_GET['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?> @@ -239,6 +241,7 @@ Zoom Graph
CSV Export
+ 'properties', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $_GET['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?> diff -Nuar cacti-0.8.7a-old/graphs_new.php cacti-0.8.7a/graphs_new.php --- cacti-0.8.7a-old/graphs_new.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/graphs_new.php 2007-11-18 09:38:25.000000000 -0600 @@ -473,7 +473,8 @@ *">Edit this Host
- *Create New Host + *Create New Host
+ diff -Nuar cacti-0.8.7a-old/graphs.php cacti-0.8.7a/graphs.php --- cacti-0.8.7a-old/graphs.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/graphs.php 2007-11-18 09:38:25.000000000 -0600 @@ -45,6 +45,8 @@ 4 => "Convert to Graph Template" ); +$graph_actions = do_hook_function('graphs_action_array', $graph_actions); + /* set default action */ if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; } @@ -357,8 +359,10 @@ input_validate_input_number($selected_items[$i]); /* ==================================================== */ - api_resize_graphs($selected_items[$i], $_POST["graph_width"], $_POST["graph_height"]); + api_resize_graphs($selected_items[$i], $_POST['graph_width'], $_POST['graph_height']); } + } else { + do_hook_function('graphs_action_execute', $_POST['drp_action']); } header("Location: graphs.php"); @@ -499,6 +503,11 @@ \n "; + } else { + $save['drp_action'] = $_POST['drp_action']; + $save['graph_list'] = $graph_list; + $save['graph_array'] = $graph_array; + do_hook_function('graphs_action_prepare', $save); } if (!isset($graph_array)) { diff -Nuar cacti-0.8.7a-old/host.php cacti-0.8.7a/host.php --- cacti-0.8.7a-old/host.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/host.php 2007-11-18 09:38:25.000000000 -0600 @@ -44,6 +44,8 @@ 6 => "Change Availability Options" ); +$device_actions = do_hook_function('device_action_array', $device_actions); + /* set default action */ if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; } @@ -309,6 +311,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); } + } else { + do_hook_function('device_action_execute', $_POST['drp_action']); } header("Location: host.php"); @@ -445,6 +449,11 @@ \n \n "; + } else { + $save['drp_action'] = $_POST['drp_action']; + $save['host_list'] = $host_list; + $save['host_array'] = (isset($host_array)? $host_array : array()); + do_hook_function('device_action_prepare', $save); } if (!isset($host_array)) { diff -Nuar cacti-0.8.7a-old/include/auth.php cacti-0.8.7a/include/auth.php --- cacti-0.8.7a-old/include/auth.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/include/auth.php 2007-11-18 09:38:25.000000000 -0600 @@ -75,7 +75,7 @@ Cacti - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ need access to this particular section, please contact the Cacti administrator. - +
Access Deniedimages/auth_deny.gif' border='0' alt='Access Denied'>
( Return | Login )( Return | index.php'>Login )
diff -Nuar cacti-0.8.7a-old/include/global_arrays.php cacti-0.8.7a/include/global_arrays.php --- cacti-0.8.7a-old/include/global_arrays.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/include/global_arrays.php 2007-11-18 09:40:22.000000000 -0600 @@ -22,6 +22,8 @@ +-------------------------------------------------------------------------+ */ +global $menu; + $messages = array( 1 => array( "message" => 'Save Successful.', @@ -595,4 +597,10 @@ GDC_SLASH => "/" ); +$plugin_architecture = array( + 'version' => '1.4' + ); + +do_hook('config_arrays'); + ?> diff -Nuar cacti-0.8.7a-old/include/global_form.php cacti-0.8.7a/include/global_form.php --- cacti-0.8.7a-old/include/global_form.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/include/global_form.php 2007-11-18 09:38:25.000000000 -0600 @@ -22,8 +22,9 @@ +-------------------------------------------------------------------------+ */ -if (!defined("VALID_HOST_FIELDS")) { - define("VALID_HOST_FIELDS", "(hostname|snmp_community|snmp_username|snmp_password|snmp_auth_protocol|snmp_priv_passphrase|snmp_priv_protocol|snmp_context|snmp_version|snmp_port|snmp_timeout)"); +if (!defined('VALID_HOST_FIELDS')) { + $string = do_hook_function('valid_host_fields', '(hostname|snmp_community|snmp_username|snmp_password|snmp_auth_protocol|snmp_priv_passphrase|snmp_priv_protocol|snmp_context|snmp_version|snmp_port|snmp_timeout)'); + define('VALID_HOST_FIELDS', $string); } /* file: cdef.php, action: edit */ @@ -1153,4 +1154,6 @@ ) ); +do_hook('config_form'); + ?> diff -Nuar cacti-0.8.7a-old/include/global.php cacti-0.8.7a/include/global.php --- cacti-0.8.7a-old/include/global.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/include/global.php 2007-11-18 09:38:25.000000000 -0600 @@ -41,6 +41,21 @@ /* Default session name - Session name must contain alpha characters */ $cacti_session_name = "Cacti"; +$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'] = '/'; + + /* Include configuration */ include(dirname(__FILE__) . "/config.php"); @@ -73,7 +88,6 @@ "rebuild_poller_cache.php" ); -$config = array(); $colors = array(); /* this should be auto-detected, set it manually if needed */ @@ -88,6 +102,13 @@ $config["include_path"] = dirname(__FILE__); $config["rra_path"] = $config["base_path"] . '/rra'; +define('URL_PATH', $config['url_path']); + +/* 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"; diff -Nuar cacti-0.8.7a-old/include/global_settings.php cacti-0.8.7a/include/global_settings.php --- cacti-0.8.7a-old/include/global_settings.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/include/global_settings.php 2007-11-18 09:38:25.000000000 -0600 @@ -1083,4 +1083,6 @@ ) ); +do_hook('config_settings'); + ?> diff -Nuar cacti-0.8.7a-old/include/plugins.php cacti-0.8.7a/include/plugins.php --- cacti-0.8.7a-old/include/plugins.php 1969-12-31 17:00:00.000000000 -0700 +++ cacti-0.8.7a/include/plugins.php 2007-11-18 09:38:25.000000000 -0600 @@ -0,0 +1,89 @@ + - Cacti + <?php echo $page_title; ?> \r\n"; }else{ - print "\r\n"; + $refresh = do_hook_function('top_graph_refresh', read_graph_config_option('page_refresh')); + print "\r\n"; } } ?> - - - - - - - - + + + + + + + + + @@ -123,13 +127,15 @@
-  Console" alt="Graphs" align="absmiddle" border="0">  +  Console" alt="Graphs" align="absmiddle" border="0">  - + - Settings';}?>  .gif" border="0" title="Tree View" alt="Tree View" align="absmiddle">.gif" border="0" title="List View" alt="List View" align="absmiddle">.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"> 
+ Settings';}?>  .gif" border="0" title="Tree View" alt="Tree View" align="absmiddle">.gif" border="0" title="List View" alt="List View" align="absmiddle">.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"> 
@@ -137,7 +143,7 @@ -
+
@@ -149,7 +155,7 @@ - Logged in as (Logout)  + Logged in as (Logout @@ -157,10 +163,10 @@ - - " height="2" border="0">
+ + " height="2" border="0">
- + diff -Nuar cacti-0.8.7a-old/include/top_header.php cacti-0.8.7a/include/top_header.php --- cacti-0.8.7a-old/include/top_header.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/include/top_header.php 2007-11-18 09:38:25.000000000 -0600 @@ -22,21 +22,25 @@ +-------------------------------------------------------------------------+ */ -global $colors; +global $colors, $config; + +$page_title = do_hook_function('page_title', 'Cacti'); + ?> - Cacti - - - + <?php echo $page_title; ?> + + + "; - }?> + } + do_hook('page_head'); ?> - + @@ -44,10 +48,11 @@
+  ConsoleGraphs
-  ConsoleGraphs - - +
@@ -55,7 +60,7 @@ -
+
@@ -67,7 +72,7 @@ - Logged in as (Logout)  + Logged in as (Logout @@ -75,10 +80,10 @@ - -
- - + +
+ + @@ -88,9 +93,9 @@ -
-

-
+
+

about.php'>

+
diff -Nuar cacti-0.8.7a-old/index.php cacti-0.8.7a/index.php --- cacti-0.8.7a-old/index.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/index.php 2007-11-18 09:38:25.000000000 -0600 @@ -25,6 +25,8 @@ include("./include/auth.php"); include("./include/top_header.php"); +do_hook('console_before'); + ?> @@ -46,6 +48,8 @@ diff -Nuar cacti-0.8.7a-old/lib/api_device.php cacti-0.8.7a/lib/api_device.php --- cacti-0.8.7a-old/lib/api_device.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/lib/api_device.php 2007-11-18 09:38:25.000000000 -0600 @@ -126,6 +126,8 @@ $save["ping_retries"] = form_input_validate($ping_retries, "ping_retries", "^[0-9]+$", true, 3); $save["max_oids"] = form_input_validate($max_oids, "max_oids", "^[0-9]+$", true, 3); + $save = do_hook_function('api_device_save', $save); + $host_id = 0; if (!is_error_message()) { diff -Nuar cacti-0.8.7a-old/lib/functions.php cacti-0.8.7a/lib/functions.php --- cacti-0.8.7a-old/lib/functions.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/lib/functions.php 2007-11-18 09:38:26.000000000 -0600 @@ -1476,6 +1476,7 @@ /* draw_navigation_text - determines the top header navigation text for the current page and displays it to the browser */ function draw_navigation_text() { + global $config; $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array()); $nav = array( @@ -1488,7 +1489,7 @@ "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"), - "index.php:" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"), + "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"), "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"), "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"), "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"), @@ -1565,6 +1566,8 @@ "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"), ); + $nav = do_hook_function('draw_navigation_text', $nav); + $current_page = basename($_SERVER["PHP_SELF"]); $current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : ""); diff -Nuar cacti-0.8.7a-old/lib/html_form.php cacti-0.8.7a/lib/html_form.php --- cacti-0.8.7a-old/lib/html_form.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/lib/html_form.php 2007-11-18 09:38:26.000000000 -0600 @@ -655,11 +655,13 @@ on a confirmation form @arg $cancel_url - the url to go to when the user clicks 'cancel' @arg $action_url - the url to go to when the user clicks 'delete' */ -function form_confirm_buttons($action_url, $cancel_url) { ?> +function form_confirm_buttons($action_url, $cancel_url) { + global $config; +?>
- Cancel - ">Delete + Cancel + ">Delete
- Cancel - + images/button_cancel2.gif' alt='Cancel' align='absmiddle' border='0'> + images/' alt='' align='absmiddle'>
diff -Nuar cacti-0.8.7a-old/lib/html.php cacti-0.8.7a/lib/html.php --- cacti-0.8.7a-old/lib/html.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/lib/html.php 2007-11-18 09:44:04.000000000 -0600 @@ -86,6 +86,7 @@ @arg $extra_url_args - extra arguments to append to the url @arg $header - html to use as a header */ function html_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") { + global $config; $i = 0; if (sizeof($graph_array) > 0) { if ($header != "") { @@ -99,12 +100,13 @@
- <?php print $graph["title_cache"];?> + graph.php?action=view&local_graph_id=&rra_id=all'>graph_image.php?local_graph_id=&rra_id=0' border='0' alt=''> - Zoom Graph
- CSV Export
- Page Top
+ graph.php?action=zoom&local_graph_id=&rra_id=0&'>images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'>
+ graph_xport.php?local_graph_id=&rra_id=0&'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'>
+ images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'>
+ 'graphs', 'local_graph_id' => $graph['local_graph_id'], 'rra' => 0, 'view_type' => '')); ?>
@@ -130,6 +132,7 @@ @arg $extra_url_args - extra arguments to append to the url @arg $header - html to use as a header */ function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") { + global $config; $i = 0; $k = 0; if (sizeof($graph_array) > 0) { if ($header != "") { @@ -144,12 +147,12 @@
- <?php print $graph["title_cache"];?> + graph.php?action=view&rra_id=all&local_graph_id='>graph_image.php?local_graph_id=&rra_id=0&graph_height=&graph_width=&graph_nolegend=true' border='0' alt=''> - Zoom Graph
- CSV Export
- Page Top
+ graph.php?action=zoom&local_graph_id=&rra_id=0&'>images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'>
+ graph_xport.php?local_graph_id=&rra_id=0&'>images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'>
+ images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'>
@@ -532,6 +535,8 @@ } while (list($item_sub_url, $item_sub_title) = each($item_title)) { + $item_sub_url = $config['url_path'] . $item_sub_url; + /* indent sub-items */ if ($i > 0) { $prepend_string = "--- "; @@ -541,7 +546,7 @@ /* do not put a line between each sub-item */ if (($i == 0) || ($draw_sub_items == false)) { - $background = "images/menu_line.gif"; + $background = $config['url_path'] . "images/menu_line.gif"; }else{ $background = ""; } @@ -570,17 +575,18 @@ }else{ if ((isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) { /* draw normal (non sub-item) menu item */ + $item_url = $config['url_path'] . $item_url; if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) { - print "$item_title\n"; + print "$item_title\n"; }else{ - print "$item_title\n"; + print "$item_title\n"; } } } } } - print "\n"; + print "\n"; print ""; } @@ -590,18 +596,19 @@ @arg $actions_array - an array that contains a list of possible actions. this array should be compatible with the form_dropdown() function */ function draw_actions_dropdown($actions_array) { + global $config; ?>
-   + images/arrow.gif' alt='' align='absmiddle'>  Choose an action: - + images/button_go.gif' alt='Go'>
diff -Nuar cacti-0.8.7a-old/lib/html_tree.php cacti-0.8.7a/lib/html_tree.php --- cacti-0.8.7a-old/lib/html_tree.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/lib/html_tree.php 2007-11-18 09:38:26.000000000 -0600 @@ -890,7 +890,7 @@ if (read_graph_config_option("thumbnail_section_tree_1") == "on") { if (read_graph_config_option("timespan_sel") == "on") { print "$graph_title\n"; /* if we are at the end of a row, start a new one */ @@ -899,7 +899,7 @@ } }else{ print "$graph_title\n"; /* if we are at the end of a row, start a new one */ @@ -909,10 +909,10 @@ } }else{ if (read_graph_config_option("timespan_sel") == "on") { - print "$graph_title"; + print "$graph_title"; print "\n"; }else{ - print "$graph_title"; + print "$graph_title"; print "\n"; } } diff -Nuar cacti-0.8.7a-old/lib/poller.php cacti-0.8.7a/lib/poller.php --- cacti-0.8.7a-old/lib/poller.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/lib/poller.php 2007-11-18 09:38:26.000000000 -0600 @@ -320,8 +320,11 @@ } } } + do_hook_function('poller_output', $rrd_update_array); - $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe); + if (do_hook_function('poller_on_demand', $results)) { + $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe); + } } return $rrds_processed; diff -Nuar cacti-0.8.7a-old/lib/rrd.php cacti-0.8.7a/lib/rrd.php --- cacti-0.8.7a-old/lib/rrd.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/lib/rrd.php 2007-11-18 09:38:26.000000000 -0600 @@ -484,6 +484,10 @@ } } + $data = do_hook_function('rrdtool_function_graph_cache_check', array('local_graph_id' => $local_graph_id,'rra_id' => $rra_id,'rrd_struc' => $rrd_struc,'graph_data_array' => $graph_data_array, 'return' => false)); + if (isset($data['return']) && $data['return'] != false) + return $data['return']; + /* find the step and how often this graph is updated with new data */ $ds_step = db_fetch_cell("select data_template_data.rrd_step @@ -1160,6 +1164,13 @@ } } + $graph_array = do_hook_function('rrd_graph_graph_options', array('graph_opts' => $graph_opts, 'graph_defs' => $graph_defs, 'txt_graph_items' => $txt_graph_items, 'graph_id' => $local_graph_id, 'start' => $graph_start, 'end' => $graph_end)); + if (!empty($graph_array)) { + $graph_defs = $graph_array['graph_defs']; + $txt_graph_items = $graph_array['txt_graph_items']; + $graph_opts = $graph_array['graph_opts']; + } + /* either print out the source or pass the source onto rrdtool to get us a nice PNG */ if (isset($graph_data_array["print_source"])) { print "
" . read_config_option("path_rrdtool") . " graph $graph_opts$graph_defs$txt_graph_items
"; @@ -1168,13 +1179,19 @@ rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrd_struc); return 0; }else{ + $graph_data_array = do_hook_function('prep_graph_array', $graph_data_array); + if (isset($graph_data_array["output_flag"])) { $output_flag = $graph_data_array["output_flag"]; }else{ $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA; } - return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc); + $output = rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc); + + do_hook_function('rrdtool_function_graph_set_file', array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id)); + + return $output; } } } diff -Nuar cacti-0.8.7a-old/lib/variables.php cacti-0.8.7a/lib/variables.php --- cacti-0.8.7a-old/lib/variables.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/lib/variables.php 2007-11-18 09:38:26.000000000 -0600 @@ -181,6 +181,9 @@ $string = str_replace($l_escape_string . "host_snmp_timeout" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["snmp_timeout"], $string); $string = str_replace($l_escape_string . "host_id" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["id"], $string); + $temp = do_hook_function('substitute_host_data', array('string' => $string, 'l_escape_string' => $l_escape_string, 'r_escape_string' => $r_escape_string, 'host_id' => $host_id)); + $string = $temp['string']; + return $string; } diff -Nuar cacti-0.8.7a-old/plugins/index.php cacti-0.8.7a/plugins/index.php --- cacti-0.8.7a-old/plugins/index.php 1969-12-31 17:00:00.000000000 -0700 +++ cacti-0.8.7a/plugins/index.php 2007-11-18 09:38:26.000000000 -0600 @@ -0,0 +1,5 @@ + diff -Nuar cacti-0.8.7a-old/poller.php cacti-0.8.7a/poller.php --- cacti-0.8.7a-old/poller.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/poller.php 2007-11-18 09:48:01.000000000 -0600 @@ -73,6 +73,8 @@ } } +do_hook('poller_top'); + /* record the start time */ list($micro,$seconds) = split(" ", microtime()); $poller_start = $seconds + $micro; @@ -231,6 +233,8 @@ $method = "cmd.php"; } + $extra_args = do_hook_function ('poller_command_args', $extra_args); + /* Populate each execution file with appropriate information */ foreach ($polling_hosts as $item) { if ($host_count == 1) { @@ -402,9 +406,11 @@ /* sleep the appripriate amount of time */ if ($poller_runs_completed < $poller_runs) { + do_hook('poller_bottom'); db_close(); usleep($sleep_time * 1000000); db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port); + do_hook('poller_top'); } }else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM) { cacti_log("WARNING: Cacti Polling Cycle Exceeded Poller Interval by " . $loop_end-$loop_start-$poller_interval . " seconds", TRUE, "POLLER"); @@ -420,4 +426,6 @@ echo " --debug|-d Output debug information. Similar to cacti's DEBUG logging level.\n\n"; } +do_hook('poller_bottom'); + ?> diff -Nuar cacti-0.8.7a-old/user_admin.php cacti-0.8.7a/user_admin.php --- cacti-0.8.7a-old/user_admin.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/user_admin.php 2007-11-18 09:38:26.000000000 -0600 @@ -72,9 +72,11 @@ break; default: - include_once("include/top_header.php"); - user(); - include_once("include/bottom_footer.php"); + if (!do_hook_function('user_admin_action', get_request_var_request("action"))) { + include_once("include/top_header.php"); + user(); + include_once("include/bottom_footer.php"); + } break; } @@ -407,6 +409,7 @@ $save["policy_graph_templates"] = form_input_validate(get_request_var_post("policy_graph_templates", get_request_var_post("_policy_graph_templates")), "policy_graph_templates", "", true, 3); $save["realm"] = get_request_var_post("realm", 0); $save["enabled"] = form_input_validate(get_request_var_post("enabled", ""), "enabled", "", true, 3); + $save = do_hook_function('user_admin_setup_sql_save', $save); if (!is_error_message()) { $user_id = sql_save($save, "user_auth"); @@ -449,6 +452,8 @@ policy_hosts = " . get_request_var_post("policy_hosts") . ", policy_graph_templates = " . get_request_var_post("policy_graph_templates") . " WHERE id = " . get_request_var_post("id")); + } else { + do_hook('user_admin_user_save'); } } } @@ -899,6 +904,8 @@ $header_label = "[new]"; } + do_hook_function('user_admin_edit', (isset($user) ? get_request_var("id") : 0)); + html_start_box("User Management $header_label", "100%", $colors["header"], "3", "center", ""); draw_edit_form(array( @@ -925,6 +932,7 @@ nowrap='nowrap' width='130' align='center' class='tab'> Graph Settings + @@ -938,7 +946,9 @@ }elseif (get_request_var("action") == "graph_perms_edit") { graph_perms_edit(); }else{ - user_realms_edit(); + if (do_hook_function('user_admin_run_action', get_request_var_request("action"))) { + user_realms_edit(); + } } form_save_button("user_admin.php"); diff -Nuar cacti-0.8.7a-old/utilities.php cacti-0.8.7a/utilities.php --- cacti-0.8.7a-old/utilities.php 2007-11-17 12:11:52.000000000 -0600 +++ cacti-0.8.7a/utilities.php 2007-11-18 09:38:26.000000000 -0600 @@ -129,11 +129,14 @@ include_once("./include/bottom_footer.php"); break; default: - include_once("./include/top_header.php"); - utilities(); + if (!do_hook_function('utilities_action', $_REQUEST['action'])) { + include_once('./include/top_header.php'); - include_once("./include/bottom_footer.php"); + utilities(); + + include_once('./include/bottom_footer.php'); + } break; } @@ -1320,6 +1323,8 @@