packages: cacti/cacti-plugin-PA.patch (NEW) - PluginArchitecture patch - ht...
glen
glen at pld-linux.org
Tue Apr 13 21:38:13 CEST 2010
Author: glen Date: Tue Apr 13 19:38:13 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- PluginArchitecture patch - http://cactiusers.org/wiki/PluginArchitectureInstall
extracted from this archive: http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7e-PA-v2.6.zip
---- Files affected:
packages/cacti:
cacti-plugin-PA.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/cacti/cacti-plugin-PA.patch
diff -u /dev/null packages/cacti/cacti-plugin-PA.patch:1.1
--- /dev/null Tue Apr 13 21:38:13 2010
+++ packages/cacti/cacti-plugin-PA.patch Tue Apr 13 21:38:07 2010
@@ -0,0 +1,2038 @@
+diff -Naur cacti-0.8.7e-old/auth_changepassword.php cacti-0.8.7e/auth_changepassword.php
+--- cacti-0.8.7e-old/auth_changepassword.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/auth_changepassword.php 2009-11-21 23:06:16.000000000 -0600
+@@ -59,6 +59,8 @@
+ header("Location: index.php"); break;
+ case '3': /* default graph page */
+ header("Location: graph_view.php"); break;
++ default:
++ api_plugin_hook_function('login_options_navigate', $user['login_opts']);
+ }
+ }else{
+ header("Location: graph_view.php");
+diff -Naur cacti-0.8.7e-old/auth_login.php cacti-0.8.7e/auth_login.php
+--- cacti-0.8.7e-old/auth_login.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/auth_login.php 2009-11-21 23:06:16.000000000 -0600
+@@ -212,6 +212,8 @@
+ header("Location: index.php"); break;
+ case '3': /* default graph page */
+ header("Location: graph_view.php"); break;
++ default:
++ api_plugin_hook_function('login_options_navigate', $user['login_opts']);
+ }
+ exit;
+
+@@ -262,9 +264,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");
++
++$cacti_logo = $config['url_path'] . 'images/auth_login.gif';
++$cacti_logo = api_plugin_hook_function('cacti_image', $cacti_logo);
++
++?>
+ <table 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
+
+@@ -317,6 +327,7 @@
+ <td><input type="submit" value="Login"></td>
+ </tr>
+ </table>
++<?php api_plugin_hook('login_after'); ?>
+ </form>
+ </body>
+ </html>
+diff -Naur cacti-0.8.7e-old/data_sources.php cacti-0.8.7e/data_sources.php
+--- cacti-0.8.7e-old/data_sources.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/data_sources.php 2009-11-21 23:06:16.000000000 -0600
+@@ -44,6 +44,8 @@
+ 7 => "Disable"
+ );
+
++$ds_actions = api_plugin_hook_function('data_source_action_array', $ds_actions);
++
+ /* set default action */
+ if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
+
+@@ -402,7 +404,10 @@
+ api_reapply_suggested_data_source_title($selected_items[$i]);
+ update_data_source_title_cache($selected_items[$i]);
+ }
++ } else {
++ api_plugin_hook_function('data_source_action_execute', $_POST['drp_action']);
+ }
++
+ header("Location: data_sources.php");
+ exit;
+ }
+@@ -533,7 +538,12 @@
+ <p>$ds_list</p>
+ </td>
+ </tr>\n
+- ";
++ ";
++ } else {
++ $save['drp_action'] = $_POST['drp_action'];
++ $save['ds_list'] = $ds_list;
++ $save['ds_array'] = (isset($ds_array)? $ds_array : array());
++ api_plugin_hook_function('data_source_action_prepare', $save);
+ }
+
+ if (!isset($ds_array)) {
+@@ -675,6 +685,8 @@
+ input_validate_input_number(get_request_var("id"));
+ /* ==================================================== */
+
++ api_plugin_hook('data_source_edit_top');
++
+ $use_data_template = true;
+ $host_id = 0;
+
+@@ -967,8 +979,9 @@
+
+ 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");
+ }
+
+ function get_poller_interval($seconds) {
+@@ -1300,6 +1313,7 @@
+ $i = 0;
+ if (sizeof($data_sources) > 0) {
+ foreach ($data_sources as $data_source) {
++ $data_source = api_plugin_hook_function('data_sources_table', $data_source);
+ $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
+ $data_input_name = ((empty($data_source["data_input_name"])) ? "<em>External</em>" : $data_source["data_input_name"]);
+ $poller_interval = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0);
+@@ -1328,4 +1342,3 @@
+ print "</form>\n";
+ }
+ ?>
+-
+diff -Naur cacti-0.8.7e-old/graph_image.php cacti-0.8.7e/graph_image.php
+--- cacti-0.8.7e-old/graph_image.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/graph_image.php 2009-11-21 23:06:16.000000000 -0600
+@@ -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.7e-old/graph.php cacti-0.8.7e/graph.php
+--- cacti-0.8.7e-old/graph.php 2009-11-21 23:31:26.000000000 -0600
++++ cacti-0.8.7e/graph.php 2009-11-21 23:06:16.000000000 -0600
+@@ -100,6 +100,7 @@
+ <a href='graph.php?action=zoom&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $rra["id"];?>&view_type=<?php print $_REQUEST["view_type"];?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
+ <a href='graph_xport.php?local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $rra["id"];?>&view_type=<?php print $_REQUEST["view_type"];?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
+ <a href='graph.php?action=properties&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $rra["id"];?>&view_type=<?php print $_REQUEST["view_type"];?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a>
++ <?php api_plugin_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $rra['id'], 'view_type' => $_REQUEST['view_type'])); ?>
+ </td>
+ </tr>
+ <tr>
+@@ -214,6 +215,7 @@
+ <td valign='top' style='padding: 3px;' class='noprint'>
+ <a href='graph.php?action=properties&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_REQUEST["view_type"];?>&graph_start=<?php print $graph_start;?>&graph_end=<?php print $graph_end;?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a>
+ <a href='graph_xport.php?local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_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>
++ <?php api_plugin_hook('graph_buttons', array('hook' => 'zoom', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $_GET['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?>
+ </td>
+ </tr>
+ <tr>
+@@ -246,6 +248,7 @@
+ <td valign='top' style='padding: 3px;'>
+ <a href='graph.php?action=zoom&local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_REQUEST["view_type"];?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
+ <a href='graph_xport.php?local_graph_id=<?php print $_GET["local_graph_id"];?>&rra_id=<?php print $_GET["rra_id"];?>&view_type=<?php print $_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.7e-old/graphs_new.php cacti-0.8.7e/graphs_new.php
+--- cacti-0.8.7e-old/graphs_new.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/graphs_new.php 2009-11-21 23:06:16.000000000 -0600
+@@ -479,7 +479,8 @@
+ </td>
+ <td nowrap style='white-space: nowrap;' class="textInfo" align="center" valign="top">
+ <span style="white-space: nowrap; color: #c16921;">*</span><a href="host.php?action=edit&id=<?php print $_REQUEST["host_id"];?>">Edit this Host</a><br>
+- <span style="white-space: nowrap; color: #c16921;">*</span><a href="host.php?action=edit">Create New Host</a>
++ <span style="white-space: nowrap; color: #c16921;">*</span><a href="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.7e-old/graphs.php cacti-0.8.7e/graphs.php
+--- cacti-0.8.7e-old/graphs.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/graphs.php 2009-11-21 23:06:16.000000000 -0600
+@@ -45,6 +45,8 @@
+ 4 => "Convert to Graph Template"
+ );
+
++$graph_actions = api_plugin_hook_function('graphs_action_array', $graph_actions);
++
+ /* set default action */
+ if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
+
+@@ -360,8 +362,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 {
++ api_plugin_hook_function('graphs_action_execute', $_POST['drp_action']);
+ }
+
+ header("Location: graphs.php");
+@@ -502,6 +506,11 @@
+ </td>
+ </tr>\n
+ ";
++ } else {
++ $save['drp_action'] = $_POST['drp_action'];
++ $save['graph_list'] = $graph_list;
++ $save['graph_array'] = (isset($graph_array) ? $graph_array : array());
++ api_plugin_hook_function('graphs_action_prepare', $save);
+ }
+
+ if (!isset($graph_array)) {
+diff -Naur cacti-0.8.7e-old/host.php cacti-0.8.7e/host.php
+--- cacti-0.8.7e-old/host.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/host.php 2009-11-21 23:06:16.000000000 -0600
+@@ -44,6 +44,8 @@
+ 6 => "Change Availability Options"
+ );
+
++$device_actions = api_plugin_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 {
++ api_plugin_hook_function('device_action_execute', $_POST['drp_action']);
+ }
+
+ header("Location: host.php");
+@@ -445,6 +449,11 @@
+ </tr>\n
+ <input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n
+ ";
++ } else {
++ $save['drp_action'] = $_POST['drp_action'];
++ $save['host_list'] = $host_list;
++ $save['host_array'] = (isset($host_array)? $host_array : array());
++ api_plugin_hook_function('device_action_prepare', $save);
+ }
+
+ if (!isset($host_array)) {
+@@ -533,6 +542,8 @@
+
+ display_output_messages();
+
++ api_plugin_hook('host_edit_top');
++
+ if (!empty($_GET["id"])) {
+ $host = db_fetch_row("select * from host where id=" . $_GET["id"]);
+ $header_label = "[edit: " . $host["description"] . "]";
+@@ -643,7 +654,8 @@
+ <td class="textInfo" valign="top">
+ <span style="color: #c16921;">*</span><a href="graphs_new.php?host_id=<?php print $host["id"];?>">Create Graphs for this Host</a><br>
+ <span style="color: #c16921;">*</span><a href="data_sources.php?host_id=<?php print $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="graphs.php?host_id=<?php print $host["id"];?>&graph_rows=30&filter=&template_id=-1&page=1">Graph List</a>
++ <span style="color: #c16921;">*</span><a href="graphs.php?host_id=<?php print $host["id"];?>&graph_rows=30&filter=&template_id=-1&page=1">Graph List</a><br>
++ <?php api_plugin_hook('device_edit_top_links'); ?>
+ </td>
+ </tr>
+ </table>
+@@ -1104,6 +1116,8 @@
+ }
+
+ form_save_button("host.php");
++
++ api_plugin_hook('host_edit_bottom');
+ }
+
+ function host() {
+diff -Naur cacti-0.8.7e-old/include/auth.php cacti-0.8.7e/include/auth.php
+--- cacti-0.8.7e-old/include/auth.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/include/auth.php 2009-11-21 23:06:16.000000000 -0600
+@@ -31,6 +31,9 @@
+ }
+
+ if (read_config_option("auth_method") != 0) {
++ /* handle alternate authentication realms */
++ api_plugin_hook_function('auth_alternate_realms');
++
+ /* handle change password dialog */
+ if ((isset($_SESSION['sess_change_password'])) && (read_config_option("webbasic_enabled") != "on")) {
+ header ("Location: auth_changepassword.php?ref=" . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "index.php"));
+@@ -75,7 +78,7 @@
+ <html>
+ <head>
+ <title>Cacti</title>
+- <link href="include/main.css" rel="stylesheet">
++ <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
+ </style>
+ </head>
+
+@@ -83,7 +86,7 @@
+
+ <table width="450" align='center'>
+ <tr>
+- <td colspan='2'><img src='images/auth_deny.gif' border='0' alt='Access Denied'></td>
++ <td colspan='2'><img src='<?php echo $config['url_path']; ?>images/auth_deny.gif' border='0' alt='Access Denied'></td>
+ </tr>
+ <tr height='10'><td></td></tr>
+ <tr>
+@@ -91,7 +94,7 @@
+ need access to this particular section, please contact the Cacti administrator.</td>
+ </tr>
+ <tr>
+- <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='index.php'>Login</a> )</td>
++ <td class='textArea' colspan='2' align='center'>( <a href='' onclick='javascript: history.back();'>Return</a> | <a href='<?php echo $config['url_path']; ?>index.php'>Login</a> )</td>
+ </tr>
+ </table>
+
+diff -Naur cacti-0.8.7e-old/include/bottom_footer.php cacti-0.8.7e/include/bottom_footer.php
+--- cacti-0.8.7e-old/include/bottom_footer.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/include/bottom_footer.php 2009-11-21 23:06:16.000000000 -0600
+@@ -21,6 +21,10 @@
+ | http://www.cacti.net/ |
+ +-------------------------------------------------------------------------+
+ */
++
++$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE);
++if (($oper_mode == OPER_MODE_NATIVE) || ($oper_mode == OPER_MODE_IFRAME_NONAV)) {
++
+ ?>
+ <br>
+ </td>
+@@ -31,6 +35,9 @@
+ </html>
+
+ <?php
++
++}
++
+ /* we use this session var to store field values for when a save fails,
+ this way we can restore the field's previous values. we reset it here, because
+ they only need to be stored for a single page */
+diff -Naur cacti-0.8.7e-old/include/global_arrays.php cacti-0.8.7e/include/global_arrays.php
+--- cacti-0.8.7e-old/include/global_arrays.php 2009-11-21 23:31:26.000000000 -0600
++++ cacti-0.8.7e/include/global_arrays.php 2009-11-21 23:06:16.000000000 -0600
+@@ -22,6 +22,8 @@
+ +-------------------------------------------------------------------------+
+ */
+
++global $menu;
++
+ $messages = array(
+ 1 => array(
+ "message" => 'Save Successful.',
+@@ -645,4 +647,10 @@
+ GDC_SLASH => "/"
+ );
+
++$plugin_architecture = array(
++ 'version' => '2.6'
++ );
++
++api_plugin_hook('config_arrays');
++
+ ?>
+diff -Naur cacti-0.8.7e-old/include/global_constants.php cacti-0.8.7e/include/global_constants.php
+--- cacti-0.8.7e-old/include/global_constants.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/include/global_constants.php 2009-11-21 23:06:16.000000000 -0600
+@@ -175,4 +175,8 @@
+ define("SNMP_CMDPHP", 1);
+ define("SNMP_WEBUI", 2);
+
++define('OPER_MODE_NATIVE', 0);
++define('OPER_MODE_RESKIN', 1);
++define('OPER_MODE_IFRAME_NONAV', 2);
++
+ ?>
+diff -Naur cacti-0.8.7e-old/include/global_form.php cacti-0.8.7e/include/global_form.php
+--- cacti-0.8.7e-old/include/global_form.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/include/global_form.php 2009-11-21 23:06:16.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 = api_plugin_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 */
+@@ -1184,4 +1185,7 @@
+ "dropdown_sql" => "select id,name from snmp_query order by name"
+ )
+ );
+-?>
++
++
++api_plugin_hook('config_form');
++
+diff -Naur cacti-0.8.7e-old/include/global.php cacti-0.8.7e/include/global.php
+--- cacti-0.8.7e-old/include/global.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/include/global.php 2009-11-21 23:06:16.000000000 -0600
+@@ -41,6 +41,22 @@
+ /* Default session name - Session name must contain alpha characters */
+ $cacti_session_name = "Cacti";
+
++$plugins = array();
++//$plugins[] = 'thold';
++
++/* Do not edit this line */
++$config = array();
++
++/*
++ Edit this to point to the default URL of your Cacti install
++ ex: if your cacti install as at http://serverip/cacti/ this
++ would be set to /cacti/
++*/
++
++$config['url_path'] = '/';
++
++define('URL_PATH', $config['url_path']);
++
+ /* Include configuration */
+ include(dirname(__FILE__) . "/config.php");
+
+@@ -76,7 +92,6 @@
+ "structure_rra_paths.php"
+ );
+
+-$config = array();
+ $colors = array();
+
+ /* this should be auto-detected, set it manually if needed */
+@@ -180,18 +195,23 @@
+ /* display ALL errors */
+ error_reporting(E_ALL);
+
++/* current cacti version */
++$config["cacti_version"] = "0.8.7c";
++
+ /* include base modules */
+ include($config["library_path"] . "/adodb/adodb.inc.php");
+ include($config["library_path"] . "/database.php");
+-include_once($config["library_path"] . "/functions.php");
+-include_once($config["include_path"] . "/global_constants.php");
+-include_once($config["include_path"] . "/global_arrays.php");
+-include_once($config["include_path"] . "/global_settings.php");
+
+ /* connect to the database server */
+ db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);
+
+ /* include additional modules */
++include_once($config["library_path"] . "/functions.php");
++include_once($config["include_path"] . "/global_constants.php");
++include_once($config["library_path"] . "/plugins.php");
++include_once($config["include_path"] . "/plugins.php");
++include_once($config["include_path"] . "/global_arrays.php");
++include_once($config["include_path"] . "/global_settings.php");
+ include_once($config["include_path"] . "/global_form.php");
+ include_once($config["library_path"] . "/html.php");
+ include_once($config["library_path"] . "/html_form.php");
+@@ -200,6 +220,8 @@
+ include_once($config["library_path"] . "/variables.php");
+ include_once($config["library_path"] . "/auth.php");
+
++api_plugin_hook("config_insert");
++
+ /* current cacti version */
+ $config["cacti_version"] = "0.8.7e";
+
+diff -Naur cacti-0.8.7e-old/include/global_settings.php cacti-0.8.7e/include/global_settings.php
+--- cacti-0.8.7e-old/include/global_settings.php 2009-06-28 11:07:11.000000000 -0500
++++ cacti-0.8.7e/include/global_settings.php 2009-11-21 23:06:16.000000000 -0600
+@@ -1185,4 +1185,6 @@
+ )
+ );
+
++api_plugin_hook('config_settings');
++
+ ?>
+diff -Naur cacti-0.8.7e-old/include/plugins.php cacti-0.8.7e/include/plugins.php
+--- cacti-0.8.7e-old/include/plugins.php 1969-12-31 17:00:00.000000000 -0700
++++ cacti-0.8.7e/include/plugins.php 2009-11-21 23:06:16.000000000 -0600
+@@ -0,0 +1,36 @@
++<?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
++ */
++
++/* On startup, register all plugins configured for use. */
++if (isset($plugins) && is_array($plugins)) {
++ foreach ($plugins as $name) {
++ use_plugin($name);
++ }
++}
++
++
++
+diff -Naur cacti-0.8.7e-old/include/top_graph_header.php cacti-0.8.7e/include/top_graph_header.php
+--- cacti-0.8.7e-old/include/top_graph_header.php 2009-11-21 23:31:26.000000000 -0600
++++ cacti-0.8.7e/include/top_graph_header.php 2009-11-21 23:20:04.000000000 -0600
+@@ -25,6 +25,11 @@
+ $using_guest_account = false;
+ $show_console_tab = true;
+
++$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE);
++if ($oper_mode == OPER_MODE_RESKIN) {
++ return;
++}
++
+ /* ================= input validation ================= */
+ input_validate_input_number(get_request_var_request("local_graph_id"));
+ /* ==================================================== */
+@@ -50,41 +55,52 @@
+ $_SESSION["sess_nav_level_cache"][2]["url"] = "graph.php?local_graph_id=" . $_REQUEST["local_graph_id"] . "&rra_id=all";
+ }
+
++$page_title = api_plugin_hook_function('page_title', 'Cacti');
++
+ ?>
+ <html>
+ <head>
+- <title>Cacti</title>
++ <title><?php echo $page_title; ?></title>
+ <?php if (isset($_SESSION["custom"])) {
+ if ($_SESSION["custom"]) {
+ print "<meta http-equiv=refresh content='99999'>\r\n";
+ }else{
+- print "<meta http-equiv=refresh content='" . htmlspecialchars(read_graph_config_option("page_refresh"),ENT_QUOTES) . "'>\r\n";
++ $refresh = api_plugin_hook_function('top_graph_refresh', read_graph_config_option('page_refresh'));
++ print "<meta http-equiv=refresh content='" . $refresh . "'>\r\n";
+ }
+ }
+ ?>
+- <link href="include/main.css" rel="stylesheet">
+- <link href="images/favicon.ico" rel="shortcut icon"/>
+- <script type="text/javascript" src="include/layout.js"></script>
+- <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>
++ <link href="<?php echo $config['url_path']; ?>include/main.css" rel="stylesheet">
++ <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
++ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.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>
++ <?php api_plugin_hook('page_head'); ?>
+ </head>
+
+-<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
++<?php if ($oper_mode == OPER_MODE_NATIVE) {?>
++<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" <?php print api_plugin_hook_function("body_style", "");?>>
+ <a name='page_top'></a>
++<?php }else{?>
++<body leftmargin="15" topmargin="15" marginwidth="15" marginheight="15" <?php print api_plugin_hook_function("body_style", "");?>>
++<?php }?>
+
+ <table width="100%" height="100%" cellspacing="0" cellpadding="0">
++<?php if ($oper_mode == OPER_MODE_NATIVE) { ;?>
+ <tr height="25" bgcolor="#a9a9a9" class="noprint">
+ <td colspan="2" valign="bottom" nowrap>
+ <table width="100%" cellspacing="0" cellpadding="0">
+- <tr style="background: transparent url('images/cacti_backdrop2.gif') no-repeat center right;">
++ <tr style="background: transparent url('<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif') no-repeat center right;">
+ <td id="tabs" nowrap>
+- <?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<?php if ((substr(basename($_SERVER["PHP_SELF"]),0,5) == "graph") || (basename($_SERVER["PHP_SELF"]) == "graph_settings.php")) { print "_down"; } print ".gif";?>" alt="Graphs" align="absmiddle" border="0"></a>
++ <?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<?php if ((substr(basename($_SERVER["PHP_SELF"]),0,5) == "graph") || (basename($_SERVER["PHP_SELF"]) == "graph_settings.php")) { print "_down"; } print ".gif";?>" alt="Graphs" align="absmiddle" border="0"></a><?php
++ api_plugin_hook('top_graph_header_tabs');
++ ?>
+ </td>
+ <td id="gtabs" align="right" nowrap>
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list