]> git.pld-linux.org Git - packages/cacti.git/blob - cacti-PA.patch
- updated to 2.8
[packages/cacti.git] / cacti-PA.patch
1 diff -Naur cacti-0.8.7g-old/auth_changepassword.php cacti-0.8.7g/auth_changepassword.php
2 --- cacti-0.8.7g-old/auth_changepassword.php    2010-07-09 18:33:46.000000000 -0400
3 +++ cacti-0.8.7g/auth_changepassword.php        2010-07-09 18:34:11.000000000 -0400
4 @@ -59,6 +59,8 @@
5                                         header("Location: index.php"); break;
6                                 case '3': /* default graph page */
7                                         header("Location: graph_view.php"); break;
8 +                               default:
9 +                                       api_plugin_hook_function('login_options_navigate', $user['login_opts']);
10                         }
11                 }else{
12                         header("Location: graph_view.php");
13 diff -Naur cacti-0.8.7g-old/auth_login.php cacti-0.8.7g/auth_login.php
14 --- cacti-0.8.7g-old/auth_login.php     2010-07-09 18:33:46.000000000 -0400
15 +++ cacti-0.8.7g/auth_login.php 2010-07-09 18:34:11.000000000 -0400
16 @@ -124,10 +124,12 @@
17                 }
18  
19         default:
20 -               /* Builtin Auth */
21 -               if ((!$user_auth) && (!$ldap_error)) {
22 -                       /* if auth has not occured process for builtin - AKA Ldap fall through */
23 -                       $user = db_fetch_row("SELECT * FROM user_auth WHERE username = '" . $username . "' AND password = '" . md5(get_request_var_post("login_password")) . "' AND realm = 0");
24 +               if (!api_plugin_hook_function('login_process', false)) {
25 +                       /* Builtin Auth */
26 +                       if ((!$user_auth) && (!$ldap_error)) {
27 +                               /* if auth has not occured process for builtin - AKA Ldap fall through */
28 +                               $user = db_fetch_row("SELECT * FROM user_auth WHERE username = '" . $username . "' AND password = '" . md5(get_request_var_post("login_password")) . "' AND realm = 0");
29 +                       }
30                 }
31         }
32         /* end of switch */
33 @@ -189,29 +191,42 @@
34                 decide what to do next */
35                 switch ($user["login_opts"]) {
36                         case '1': /* referer */
37 -                               if (sizeof(db_fetch_assoc("SELECT realm_id FROM user_auth_realm WHERE realm_id = 8 AND user_id = " . $_SESSION["sess_user_id"])) == 0) {
38 -                                       header("Location: graph_view.php");
39 -                               }else{
40 -                                       if (isset($_SERVER["HTTP_REFERER"])) {
41 -                                               $referer = $_SERVER["HTTP_REFERER"];
42 -                                               if (basename($referer) == "logout.php") {
43 -                                                       $referer = "index.php";
44 -                                               }
45 -                                       } else if (isset($_SERVER["REQUEST_URI"])) {
46 -                                               $referer = $_SERVER["REQUEST_URI"];
47 -                                               if (basename($referer) == "logout.php") {
48 -                                                       $referer = "index.php";
49 -                                               }
50 -                                       } else {
51 -                                               $referer = "index.php";
52 +                               /* because we use plugins, we can't redirect back to graph_view.php if they don't
53 +                                * have console access
54 +                                */
55 +                               if (isset($_SERVER["HTTP_REFERER"])) {
56 +                                       $referer = $_SERVER["HTTP_REFERER"];
57 +                                       if (basename($referer) == "logout.php") {
58 +                                               $referer = $config['url_path'] . "index.php";
59 +                                       }
60 +                               } else if (isset($_SERVER["REQUEST_URI"])) {
61 +                                       $referer = $_SERVER["REQUEST_URI"];
62 +                                       if (basename($referer) == "logout.php") {
63 +                                               $referer = $config['url_path'] . "index.php";
64                                         }
65 +                               } else {
66 +                                       $referer = $config['url_path'] . "index.php";
67 +                               }
68 +
69 +                               if (substr_count($referer, "plugins")) {
70                                         header("Location: " . $referer);
71 +                               } elseif (sizeof(db_fetch_assoc("SELECT realm_id FROM user_auth_realm WHERE realm_id = 8 AND user_id = " . $_SESSION["sess_user_id"])) == 0) {
72 +                                       header("Location: graph_view.php");
73 +                               } else {
74 +                                       header("Location: $referer");
75                                 }
76 +
77                                 break;
78                         case '2': /* default console page */
79 -                               header("Location: index.php"); break;
80 +                               header("Location: " . $config['url_path'] . "index.php");
81 +
82 +                               break;
83                         case '3': /* default graph page */
84 -                               header("Location: graph_view.php"); break;
85 +                               header("Location: " . $config['url_path'] . "graph_view.php");
86 +
87 +                               break;
88 +                       default:
89 +                               api_plugin_hook_function('login_options_navigate', $user['login_opts']);
90                 }
91                 exit;
92         }else{
93 @@ -264,9 +279,17 @@
94  <body bgcolor="#FFFFFF" onload="document.login.login_username.focus()">
95         <form name="login" method="post" action="<?php print basename($_SERVER["PHP_SELF"]);?>">
96         <input type="hidden" name="action" value="login">
97 +<?php
98 +
99 +api_plugin_hook("login_before");
100 +
101 +$cacti_logo = $config['url_path'] . 'images/auth_login.gif';
102 +$cacti_logo = api_plugin_hook_function('cacti_image', $cacti_logo);
103 +
104 +?>
105         <table align="center">
106                 <tr>
107 -                       <td colspan="2"><img src="images/auth_login.gif" border="0" alt=""></td>
108 +                       <td colspan="2"><center><?php if ($cacti_logo != '') { ?><img src="<?php echo $cacti_logo; ?>" border="0" alt=""><?php } ?></center></td>
109                 </tr>
110                 <?php
111  
112 @@ -303,22 +326,29 @@
113                         <td><input type="password" name="login_password" size="40" style="width: 295px;"></td>
114                 </tr>
115                 <?php
116 -               if (read_config_option("auth_method") == "3") {?>
117 +               if (read_config_option("auth_method") == "3" || api_plugin_hook_function('login_realms_exist')) {
118 +                       $realms = api_plugin_hook_function('login_realms', array("local" => array("name" => "Local", "selected" => false), "ldap" => array("name" => "LDAP", "selected" => true)));
119 +                       ?>
120                 <tr>
121                         <td>Realm:</td>
122                         <td>
123 -                               <select name="realm" style="width: 295px;">
124 -                                       <option value="local">Local</option>
125 -                                       <option value="ldap" selected>LDAP</option>
126 +                               <select name="realm" style="width: 295px;"><?php
127 +                               if (sizeof($realms)) {
128 +                               foreach($realms as $name => $realm) {
129 +                                       print "\t\t\t\t\t<option value='" . $name . "'" . ($realm["selected"] ? " selected":"") . ">" . htmlspecialchars($realm["name"]) . "</option>\n";
130 +                               }
131 +                               }
132 +                               ?>
133                                 </select>
134                         </td>
135 -                       </tr>
136 +               </tr>
137                 <?php }?>
138                 <tr style="height:10px;"><td></td></tr>
139                 <tr>
140                         <td><input type="submit" value="Login"></td>
141                 </tr>
142         </table>
143 +<?php api_plugin_hook('login_after'); ?>
144         </form>
145  </body>
146  </html>
147 diff -Naur cacti-0.8.7g-old/data_sources.php cacti-0.8.7g/data_sources.php
148 --- cacti-0.8.7g-old/data_sources.php   2010-07-09 18:33:46.000000000 -0400
149 +++ cacti-0.8.7g/data_sources.php       2010-07-09 18:34:11.000000000 -0400
150 @@ -44,6 +44,8 @@
151         7 => "Disable"
152         );
153  
154 +$ds_actions = api_plugin_hook_function('data_source_action_array', $ds_actions);
155 +
156  /* set default action */
157  if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
158  
159 @@ -402,6 +404,8 @@
160                                 api_reapply_suggested_data_source_title($selected_items[$i]);
161                                 update_data_source_title_cache($selected_items[$i]);
162                         }
163 +               } else {
164 +                       api_plugin_hook_function('data_source_action_execute', $_POST['drp_action']);
165                 }
166                 header("Location: data_sources.php");
167                 exit;
168 @@ -545,6 +549,12 @@
169                                 </tr>\n
170                                 ";
171                         $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue' title='Reapply Suggested Naming to Data Source(s)'>";
172 +               }else{
173 +                       $save['drp_action'] = $_POST['drp_action'];
174 +                       $save['ds_list'] = $ds_list;
175 +                       $save['ds_array'] = (isset($ds_array)? $ds_array : array());
176 +                       api_plugin_hook_function('data_source_action_prepare', $save);
177 +                       $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue'>";
178                 }
179         }else{
180                 print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one data source.</span></td></tr>\n";
181 @@ -683,6 +693,8 @@
182         input_validate_input_number(get_request_var("host_id"));
183         /* ==================================================== */
184  
185 +       api_plugin_hook('data_source_edit_top');
186 +
187         $use_data_template = true;
188         $host_id = 0;
189  
190 @@ -975,8 +987,9 @@
191  
192         form_save_button("data_sources.php");
193  
194 -       include_once("./include/bottom_footer.php");
195 +       api_plugin_hook('data_source_edit_bottom');
196  
197 +       include_once("./include/bottom_footer.php");
198  }
199  
200  function get_poller_interval($seconds) {
201 @@ -1310,6 +1323,7 @@
202         $i = 0;
203         if (sizeof($data_sources) > 0) {
204                 foreach ($data_sources as $data_source) {
205 +                       $data_source = api_plugin_hook_function('data_sources_table', $data_source);
206                         $data_template_name = ((empty($data_source["data_template_name"])) ? "<em>None</em>" : $data_source["data_template_name"]);
207                         $data_input_name    = ((empty($data_source["data_input_name"])) ? "<em>External</em>" : $data_source["data_input_name"]);
208                         $poller_interval    = ((isset($poller_intervals[$data_source["local_data_id"]])) ? $poller_intervals[$data_source["local_data_id"]] : 0);
209 diff -Naur cacti-0.8.7g-old/graph_image.php cacti-0.8.7g/graph_image.php
210 --- cacti-0.8.7g-old/graph_image.php    2010-07-09 18:33:46.000000000 -0400
211 +++ cacti-0.8.7g/graph_image.php        2010-07-09 18:34:11.000000000 -0400
212 @@ -44,6 +44,8 @@
213  /* flush the headers now */
214  ob_end_clean();
215  
216 +api_plugin_hook_function('graph_image');
217 +
218  session_write_close();
219  
220  $graph_data_array = array();
221 diff -Naur cacti-0.8.7g-old/graph.php cacti-0.8.7g/graph.php
222 --- cacti-0.8.7g-old/graph.php  2010-07-09 18:33:46.000000000 -0400
223 +++ cacti-0.8.7g/graph.php      2010-07-09 18:34:11.000000000 -0400
224 @@ -32,6 +32,8 @@
225  include_once("./lib/html_tree.php");
226  include_once("./include/top_graph_header.php");
227  
228 +api_plugin_hook_function('graph');
229 +
230  /* ================= input validation ================= */
231  input_validate_input_regex(get_request_var("rra_id"), "^([0-9]+|all)$");
232  input_validate_input_number(get_request_var("local_graph_id"));
233 @@ -94,17 +96,18 @@
234                                         <table width='1' cellpadding='0'>
235                                                 <tr>
236                                                         <td>
237 -                                                               <img class='graphimage' id='graph_<?php print $_GET["local_graph_id"] ?>' src='<?php print htmlspecialchars("graph_image.php?action=view&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $rra["id"]);?>' border='0' alt='<?php print htmlspecialchars($graph_title);?>'>
238 +                                                                       <img class='graphimage' id='graph_<?php print $_GET["local_graph_id"] ?>' src='<?php print htmlspecialchars("graph_image.php?action=view&local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $rra["id"]);?>' border='0' alt='<?php print htmlspecialchars($graph_title);?>'>
239                                                         </td>
240                                                         <td valign='top' style='padding: 3px;' class='noprint'>
241                                                                 <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>
242                                                                 <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>
243                                                                 <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>
244 +                                                               <?php api_plugin_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => $_GET['local_graph_id'], 'rra' => $rra['id'], 'view_type' => $_REQUEST['view_type'])); ?>
245                                                         </td>
246                                                 </tr>
247                                                 <tr>
248                                                         <td colspan='2' align='center'>
249 -                                                               <strong><?php print htmlspecialchars($rra["name"]);?></strong>
250 +                                                                       <strong><?php print htmlspecialchars($rra["name"]);?></strong>
251                                                         </td>
252                                                 </tr>
253                                         </table>
254 @@ -215,6 +218,7 @@
255                                         <td valign='top' style='padding: 3px;' class='noprint'>
256                                                 <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>
257                                                 <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>
258 +                                               <?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'])); ?>
259                                         </td>
260                                 </tr>
261                                 <tr>
262 @@ -247,6 +251,7 @@
263                                         <td valign='top' style='padding: 3px;'>
264                                                 <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>
265                                                 <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>
266 +                                               <?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'])); ?>
267                                         </td>
268                                 </tr>
269                                 <tr>
270 diff -Naur cacti-0.8.7g-old/graphs_new.php cacti-0.8.7g/graphs_new.php
271 --- cacti-0.8.7g-old/graphs_new.php     2010-07-09 18:33:46.000000000 -0400
272 +++ cacti-0.8.7g/graphs_new.php 2010-07-09 18:34:11.000000000 -0400
273 @@ -511,7 +511,8 @@
274                         </td>
275                         <td nowrap style='white-space: nowrap;' class="textInfo" align="center" valign="top">
276                                 <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>
277 -                               <span style="white-space: nowrap; color: #c16921;">*</span><a href="<?php print htmlspecialchars("host.php?action=edit");?>">Create New Host</a>
278 +                               <span style="white-space: nowrap; color: #c16921;">*</span><a href="<?php print htmlspecialchars("host.php?action=edit");?>">Create New Host</a><br>
279 +                               <?php api_plugin_hook('graphs_new_top_links'); ?>
280                         </td>
281                 </tr>
282         </table>
283 diff -Naur cacti-0.8.7g-old/graphs.php cacti-0.8.7g/graphs.php
284 --- cacti-0.8.7g-old/graphs.php 2010-07-09 18:33:46.000000000 -0400
285 +++ cacti-0.8.7g/graphs.php     2010-07-09 18:34:11.000000000 -0400
286 @@ -45,6 +45,8 @@
287         4 => "Convert to Graph Template"
288         );
289  
290 +$graph_actions = api_plugin_hook_function('graphs_action_array', $graph_actions);
291 +
292  /* set default action */
293  if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
294  
295 @@ -362,6 +364,8 @@
296  
297                                 api_resize_graphs($selected_items[$i], $_POST["graph_width"], $_POST["graph_height"]);
298                         }
299 +               } else {
300 +                       api_plugin_hook_function('graphs_action_execute', $_POST['drp_action']);
301                 }
302  
303                 header("Location: graphs.php");
304 @@ -514,6 +518,12 @@
305                                 ";
306  
307                         $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue' title='Resize Selected Graph(s)'>";
308 +               } else {
309 +                       $save['drp_action'] = $_POST['drp_action'];
310 +                       $save['graph_list'] = $graph_list;
311 +                       $save['graph_array'] = (isset($graph_array) ? $graph_array : array());
312 +                       api_plugin_hook_function('graphs_action_prepare', $save);
313 +                       $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue'>";
314                 }
315         }else{
316                 print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one graph.</span></td></tr>\n";
317 diff -Naur cacti-0.8.7g-old/host.php cacti-0.8.7g/host.php
318 --- cacti-0.8.7g-old/host.php   2010-07-09 18:33:46.000000000 -0400
319 +++ cacti-0.8.7g/host.php       2010-07-09 18:34:11.000000000 -0400
320 @@ -44,6 +44,8 @@
321         6 => "Change Availability Options"
322         );
323  
324 +$device_actions = api_plugin_hook_function('device_action_array', $device_actions);
325 +
326  /* set default action */
327  if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
328  
329 @@ -305,6 +307,8 @@
330  
331                                 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);
332                         }
333 +               } else {
334 +                       api_plugin_hook_function('device_action_execute', $_POST['drp_action']); 
335                 }
336  
337                 header("Location: host.php");
338 @@ -450,6 +454,12 @@
339                                 <input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n
340                                 ";
341                         $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue' title='Place Device(s) on Tree'>";
342 +               } else {
343 +                       $save['drp_action'] = $_POST['drp_action'];
344 +                       $save['host_list'] = $host_list;
345 +                       $save['host_array'] = (isset($host_array)? $host_array : array());
346 +                       api_plugin_hook_function('device_action_prepare', $save);
347 +                       $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'>&nbsp;<input type='submit' value='Continue'>";
348                 }
349         }else{
350                 print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one device.</span></td></tr>\n";
351 @@ -532,6 +542,8 @@
352         input_validate_input_number(get_request_var("id"));
353         /* ==================================================== */
354  
355 +       api_plugin_hook('host_edit_top');
356 +
357         if (!empty($_GET["id"])) {
358                 $host = db_fetch_row("select * from host where id=" . $_GET["id"]);
359                 $header_label = "[edit: " . htmlspecialchars($host["description"]) . "]";
360 @@ -643,6 +655,7 @@
361                                         <span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("graphs_new.php?host_id=" . $host["id"]);?>">Create Graphs for this Host</a><br>
362                                         <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>
363                                         <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>
364 +                                       <?php api_plugin_hook('device_edit_top_links'); ?>
365                                 </td>
366                         </tr>
367                 </table>
368 @@ -1107,6 +1120,8 @@
369         }
370  
371         form_save_button("host.php", "return");
372 +
373 +       api_plugin_hook('host_edit_bottom');
374  }
375  
376  function host() {
377 diff -Naur cacti-0.8.7g-old/images/disable_icon.png cacti-0.8.7g/images/disable_icon.png
378 --- cacti-0.8.7g-old/images/disable_icon.png    1969-12-31 19:00:00.000000000 -0500
379 +++ cacti-0.8.7g/images/disable_icon.png        2010-07-09 18:34:11.000000000 -0400
380 @@ -0,0 +1,4 @@
381 +\89PNG
382 +\1a
383 +\0\0\0
384 IHDR\0\0\0\10\0\0\0\10\b\ 3\0\0\0(-\ fS\0\0\ 3\0PLTE\80\80\80¾/\aµ0\ f·9\1a¸6\16¹9\17º9\19½B#À,\ 2À2
385 +Á3\vÂ8\12À<\18×2\ 1Ô8\11à9\ 4á>\bÙD\1fÞA\19ØG#ßH"ÞN%ÛQ,ÚQ/ÜP*ÜS0àB
386 éH\ eàG\15àK\1câN&äP$áP,èV$é],âT1ãZ8ã];ã`?èc7äaBåeFågHælOçoSçpTèuZèv[èy^è}cÑ\90\7fê\81\87\83\85\8d\90\8d\92qµ&\0Ü\96\85Þ\9b\8aí\97\80î\9d\89ï \8cð¨\95ñ®\9dö±\98ò²¢ô½°ô¿²õ·õÆ»øǶûäÜûèâüðîÿÿÿ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Úú
387 ¤\0\0\0\ 1tRNS\0@æØf\0\0\0\ 1bKGD\0\88\ 5\1dH\0\0\0  pHYs\0\0\ eÄ\0\0\ eÄ\ 1\95+\ e\e\0\0\0ÇIDATx\9ceÏ[o\82@\14\ 4\15ã­¦!Ù\8a¶T6\9a\ 3h¤!»à\ 5EK´\94ùÿ\7fÇ\ 3öÍyü\92\99djµ§d:\¯<Ï¥\85\ e\fú|\8at\18\ 4¬$^\18Ô)Qi\ 1\14Ç\85¬`\13é\1fdJeHÅ{\87ÁW)"\97¤­ E   ^P\}\17°?²¼\ 2Z#©à3\84YnH\1f\89û\ f³>\83ã=*ó¯ß|Úc\10tDB´\9co\11\f¦¤3nq|ÃÅz5\18ƶCÑ\1f\90o-kTÂp,Ê\98³éd4Ø1ì\e\8df³Ýjwë\86±û~>\7f\a®\82"X_\1e\0\0\0\0IEND®B`\82
388 \ No newline at end of file
389 diff -Naur cacti-0.8.7g-old/images/enable_icon_disabled.png cacti-0.8.7g/images/enable_icon_disabled.png
390 --- cacti-0.8.7g-old/images/enable_icon_disabled.png    1969-12-31 19:00:00.000000000 -0500
391 +++ cacti-0.8.7g/images/enable_icon_disabled.png        2010-07-09 18:34:11.000000000 -0400
392 @@ -0,0 +1,3 @@
393 +\89PNG
394 +\1a
395 +\0\0\0
396 IHDR\0\0\0\10\0\0\0\10\b\ 3\0\0\0(-\ fS\0\0\ 3\0PLTE\80\80\80PPPUUUWWWXXXYYYZZZ[[[\\\^^^```bbbiiijjjssstttuuuvvvwwwxxx|||}}}~~~\7f\7f\7fKKK\81\81\81\82\82\82\85\85\85\86\86\86\87\87\87\8a\8a\8a\8b\8b\8b\8c\8c\8c\8d\8d\8d\8e\8e\8e\92\92\92\96\96\96\97\97\97\9a\9a\9a\9b\9b\9b\9d\9d\9d   £££¤¤¤¦¦¦«««³³³´´´¾¾¾ÅÅÅËËËÿÿÿ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15øÝ2\0\0\0\ 1bKGD\0\88\ 5\1dH\0\0\0       pHYs\0\0\ eÄ\0\0\ eÄ\ 1\95+\ e\e\0\0\0ªIDATxÚ]ÎÍJBQ\18@Ñ¥|WiRrA'M:\b\8e\ 5ßÿ\11\9c\ 659D3\83\ 6Â%åüØ(¨ö\v¬\1d\a\7f\v·Km\9d̦\96§E¸,\86¢¶­nò¼\ fuèU{\98}\9a\98   ­ÐúÌ\98)K¡W­ç|\90^\87á,Р'»\\by»b\ 4)\7f   \9bþï£:&ÓÉ\81\8c`J²4ò\1e\95 N'iäht\13®ËÊ´\9a\1f7j!\çÃXê\9b±\96¡¯\85ÝËúã\87\vw{\8f¿Øo"ÍH\93ì>]î\0\0\0\0IEND®B`\82
397 \ No newline at end of file
398 diff -Naur cacti-0.8.7g-old/images/enable_icon.png cacti-0.8.7g/images/enable_icon.png
399 --- cacti-0.8.7g-old/images/enable_icon.png     1969-12-31 19:00:00.000000000 -0500
400 +++ cacti-0.8.7g/images/enable_icon.png 2010-07-09 18:34:11.000000000 -0400
401 @@ -0,0 +1,5 @@
402 +\89PNG
403 +\1a
404 +\0\0\0
405 IHDR\0\0\0\10\0\0\0\10\b\ 3\0\0\0(-\ fS\0\0\ 3\0PLTE\80\80\80\ fo\ f\ 5~\ 5\16t\16\17y\17\19w\19\1ez\1e#}#\v\80\v\ 1\91\ 1\12\82\12\19\8d\19\1f\8c\1f\1f\9e\1f\b£\b\ f£\ f
406 ¤
407
408 +\15¤\15\14¯\14\18¢\18\19¬\19#\8c#%\9a%)\97).\94.0\9500\9801\981;\9e;$¯$!µ!? ?8ª8B\9fBB BA¨AO§OR¦RT©T[­[a¯ag³gkµkv»v\7f°\7fy¼y\0o\0\85·\85\8a»\8a\80À\80\8cÆ\8c\9dÏ\9d£Ö£±Ø±ÿÿÿ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0×\1fX4\0\0\0\ 1tRNS\0@æØf\0\0\0\ 1bKGD\0\88\ 5\1dH\0\0\0    pHYs\0\0\ eÄ\0\0\ eÄ\ 1\95+\ e\e\0\0\0®IDATx\9ceÏÛ\ e\820\f\ 6`ä Ó`2\ 4%3\9b £c\1c\ 4\15eïÿfv\98è\ 5½û¿¦ië8\8b\9aºFW\0 sÁO\ f\84î5ö]SkTÉ\ 2\84v|¶\8d\9e\f\80\10l\8d û®ÖÊ\18\9cm\10*ì+(P\18\9b\ 1\1a­U!8J:\8fHm~\95Z\10Õ\1fö;\ 4\ eJ\81\98\ f\89\ 5VØ«JÌqL\89\ 5\9c³,¢.B\88\92ços9F_ !îgi\9a$\94n\a\84ûÊó\ 2Ï÷     qÝá¶|þ\ 3@{\1aIÇ=\1eþ\0\0\0\0IEND®B`\82
409 \ No newline at end of file
410 diff -Naur cacti-0.8.7g-old/images/install_icon_disabled.png cacti-0.8.7g/images/install_icon_disabled.png
411 --- cacti-0.8.7g-old/images/install_icon_disabled.png   1969-12-31 19:00:00.000000000 -0500
412 +++ cacti-0.8.7g/images/install_icon_disabled.png       2010-07-09 18:34:11.000000000 -0400
413 @@ -0,0 +1,5 @@
414 +\89PNG
415 +\1a
416 +\0\0\0
417 IHDR\0\0\0\10\0\0\0\10\b\ 3\0\0\0(-\ fS\0\0\ 3\0PLTE\80\80\80dddfffgggnnnrrrxxx}}}```\8b\8b\8b\95\95\95\9c\9c\9c¢¢¢©©©­­­µµµ¹¹¹ºººÁÁÁÈÈÈÏÏÏÛÛÛéééíííñññýýýþýý\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\ 6Óö\0\0\0\ 1tRNS\0@æØf\0\0\0\ 1bKGD\0\88\ 5\1dH\0\0\0  pHYs\0\0\ eÄ\0\0\ eÄ\ 1\95+\ e\e\0\0\0\81IDATx\9cmÎÁ
418 +\ 41\b\ 3Ð"+RK T\8aôÿ\7ft\9dé\ eìarË;D[{Í\94JØ_uÒ\8b\9eî«\92\89#)\1e\13±\18\e\92\ 5\10\ 2È
419 F
420 +\vDáÝ3\87\8fp¹ÀjÑ2
421 t\1cе\99ɽ¬ß ZRÉ~\0êÚóê:\94÷Yà\1eí8g\e?\9c\01ùù½J\193búóz     MÕÈö\96/\9b\bÆ'¸ãï\0\0\0\0IEND®B`\82
422 \ No newline at end of file
423 diff -Naur cacti-0.8.7g-old/images/install_icon.png cacti-0.8.7g/images/install_icon.png
424 --- cacti-0.8.7g-old/images/install_icon.png    1969-12-31 19:00:00.000000000 -0500
425 +++ cacti-0.8.7g/images/install_icon.png        2010-07-09 18:34:11.000000000 -0400
426 @@ -0,0 +1,5 @@
427 +\89PNG
428 +\1a
429 +\0\0\0
430 IHDR\0\0\0\10\0\0\0\10\b\ 3\0\0\0(-\ fS\0\0\ 3\0PLTE\80\80\80\1a2\9b\ f\1c;¢",\91$,\90&6\99+6\99&D­%U¼2[º)JÃ)NÉ#TÛ1UÊ2gÆ4kÐ;vÝ*\7fÿ/yÿ>\7fðFU¤NV§RU£Z]¨LdµN}ÏAyä0\83ÿ5\82ÿ;\85ÿ?\93ÿ^\86ÒB\84ûM\85ÿO\8aÿN\92ûR\88ÿW\91úV\98ü^\9dõZ¤ÿa\93ÿg\97ÿ`\98ÿk\9aÿr\97ót\98ðu\9bõr\9fÿc£öd«ÿh¨ûi±ÿhµÿ}¦ÿ{¼ý~Äÿ\11&\9a\95\98Ä\91 Ò\85«ÿ\8a¯ÿ\8d±ÿ\92¿ÿ\97¹ÿ\9b»ÿ«¬Ð¥²Ú¦¶ß±²Ó¹ºØ¡·ãª»ã\87Ìÿ\89Èÿ\8dÉÿ\93ÑÿºÆå³Ëþ¸×ÿºÕÿÅÅÝÅÖþÇÛÿËÝûÉÞÿÃáÿÏâÿÖãÿÙæüßëüßîÿÜòÿêí÷îîõèïÿæúÿìòÿõõùòÿÿÿÿÿ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\bÜ`á\0\0\0\ 1tRNS\0@æØf\0\0\0\ 1bKGD\0\88\ 5\1dH\0\0\0  pHYs\0\0\ eÄ\0\0\ eÄ\ 1\95+\ e\e\0\0\0ÍIDATx\9cc`À
431 +Ü%XXÄÝàÜ vn\ 3''=\1e\16w(ßÊ61:4$"\\9b  ¬(\99Í6%Ø)4ØÞ)PÛ*\1e(àÌ\17ëïd\97\9adnkïÈk
432 \14\103\b4×6LNÒÕÖ¶U\14\ 5
433 +0\9a\e:Ú©&%(99é*1\ 3\ 5\98u\94#S\1d\93\12\9cRC\14\858\80\ 2\92j2j\91©@\10ª($'   \14p\956\16R\8fNM\8dR\91Ñ\14±\ 1YËef&o\12\15m$olÆ   ²\96ÁOÀÒËÌÂÂÌËKÐ\15âT?~
434 o__o#~W\98g\92<\15¤¤\14\19°\ 1\0ëz%àÝÔ\1c²\0\0\0\0IEND®B`\82
435 \ No newline at end of file
436 diff -Naur cacti-0.8.7g-old/images/uninstall_icon.gif cacti-0.8.7g/images/uninstall_icon.gif
437 --- cacti-0.8.7g-old/images/uninstall_icon.gif  1969-12-31 19:00:00.000000000 -0500
438 +++ cacti-0.8.7g/images/uninstall_icon.gif      2010-07-09 18:34:11.000000000 -0400
439 @@ -0,0 +1,4 @@
440 +GIF89a\10\0\10\0÷N\0\0\0\0\ 1\ 1\ 1\ 2\ 2\ 2\ 3\ 3\ 3\ 4\ 4\ 4\ 5\ 5\ 5\ 6\ 6\ 6\a\a\a\b\b\b                       
441 +
442 +
443 +\v\v\v\f\f\f
444 \ e\ e\ e\ f\ f\ f\10\10\10\11\11\11\12\12\12\13\13\13\14\14\14\15\15\15\16\16\16\17\17\17\18\18\18\19\19\19\1a\1a\1a\e\e\e\1c\1c\1c\1d\1d\1d\1e\1e\1e\1f\1f\1f   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???A??C??D??F@@H??J>>M<<N::O99O88P88P77P77P77Q66Q66P66P66P77O77O77X99c==m??xBB\82EE\8aGG\8eJJ\93LL\99NN\9ePP SS\9fVV XX YY\9fZZ\9b\\\9f]]¦``±cc½ggÄiiÈooÎvvÐzzÑ}}Ò\7f\7fÓ\81\81Ó\82\82Ô\82\82Ô\84\84Õ\86\86Õ\87\87Õ\88\88Ö\8a\8aÖ\8a\8aÖ\8b\8bÖ\8b\8bÖ\8c\8cÖ\8d\8dÖ\8d\8dÒ\8c\8cÌ\8b\8bÃ\8a\8a¸\89\89©\87\87\9e\85\85\94\84\84\8b\82\82\83\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\80\7f\7f\81\7f\7f\82\7f\7f\83~~\86~~\8a}}\90{{\96zz\9dxx¦uu¯ss¸qq»ppºpp»uu¼yy»~~»\83\83¿\8c\8cÂ\93\93Æ\99\99É\9e\9eÌ¡¡Ï££Ñ¥¥Ó¥¥Õ¥¥Ö¥¥Ö¥¥×¤¤×££×¢¢×  ×\9f\9fÖ\9e\9eÖ\9e\9eÖ\9d\9dÖ\9d\9dÖ\9e\9e×\9f\9f×  ×¡¡Ø££Ú§§ÛªªÛ­­Ü°°Þ´´ß¶¶ß¸¸àººá»»á¼¼â½½ã¿¿äÁÁåÃÃæÅÅçÈÈèÉÉèÊÊéËËéÌÌéÍÍêÎÎëÐÐìÒÒíÓÓîÔÔîÕÕïÖÖïØØðÚÚñÝÝòááóååôèèôêêôêêôêêôêêôëëõëëõììõííõîîõïïõððöññ÷òòøóóùôôúööûøøüùùüûûýüüýüüþýýþýýþýý!ù\ 4       \0\0\88\0,\0\0\0\0\10\0\10\0\0\bÅ\0\11      \1cH°`AyÇÔ\84       £&\99<\83\88\92}±ÃL\9a4fq¾H+(ñX³_Æ\8cýjvLã@w]~ýbcÇ\9d¹=lTvy\88èW\1a;iØ\98û÷Ï\1c\9b4{Â$\13\b&\8dÑp<yúÌIF \92£ÿ\8e¹swì_85l\9c\bt¢&αci¦ªùu,Î\1e­\88Ȥù\15\87M\1cwòìı£-NÓ\9a^\8eýÚ³GÞ?²ÒÜy\19\8aH\9e\93\98
445 Ó\16î\98¶¿HÜ
446 Lv8\9cåppÏZ+ÈÌI\17¯e» Ù\f1\19\99'OÈl\84Ⱥ`@\0;
447 \ No newline at end of file
448 diff -Naur cacti-0.8.7g-old/images/view_none.gif cacti-0.8.7g/images/view_none.gif
449 --- cacti-0.8.7g-old/images/view_none.gif       1969-12-31 19:00:00.000000000 -0500
450 +++ cacti-0.8.7g/images/view_none.gif   2010-07-09 18:34:11.000000000 -0400
451 @@ -0,0 +1,4 @@
452 +GIF89a\10\0\10\0÷\0\0\0\0\0\ 1\ 1\ 1\ 2\ 2\ 2\ 3\ 3\ 3\ 4\ 4\ 4\ 5\ 5\ 5\ 6\ 6\ 6\a\a\a\b\b\b                       
453 +
454 +
455 +\v\v\v\f\f\f
456 \ e\ e\ e\ f\ f\ f\10\10\10\11\11\11\12\12\12\13\13\13\14\14\14\15\15\15\16\16\16\17\17\17\18\18\18\19\19\19\1a\1a\1a\e\e\e\1c\1c\1c\1d\1d\1d\1e\1e\1e\1f\1f\1f   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```dddhhhnnntttyyy}}}~~~\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\7f\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\81\81\81\82\82\82\86\86\86\8b\8b\8b\91\91\91\97\97\97\9b\9b\9b   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù\ 4       \0\0\8c\0,\0\0\0\0\10\0\10\0\0\b\1d\0\19      \1cH° Á\83\b\13*\È°¡Ã\87\10#J\9cH±¢Å\81\ 1\ 1\0;
457 \ No newline at end of file
458 diff -Naur cacti-0.8.7g-old/include/auth.php cacti-0.8.7g/include/auth.php
459 --- cacti-0.8.7g-old/include/auth.php   2010-07-09 18:33:46.000000000 -0400
460 +++ cacti-0.8.7g/include/auth.php       2010-07-09 18:34:11.000000000 -0400
461 @@ -31,6 +31,9 @@
462  }
463  
464  if (read_config_option("auth_method") != 0) {
465 +       /* handle alternate authentication realms */
466 +       api_plugin_hook_function('auth_alternate_realms');
467 +
468         /* handle change password dialog */
469         if ((isset($_SESSION['sess_change_password'])) && (read_config_option("webbasic_enabled") != "on")) {
470                 header ("Location: auth_changepassword.php?ref=" . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "index.php"));
471 @@ -72,9 +75,9 @@
472                         and user_auth_realm.realm_id='$realm_id'")) || (empty($realm_id)))) {
473  
474                         if (isset($_SERVER["HTTP_REFERER"])) {
475 -                               $goBack = "<td class='textArea' colspan='2' align='center'>( <a href='" . htmlspecialchars($_SERVER["HTTP_REFERER"]) . "'>Return</a> | <a href='logout.php'>Login Again</a> )</td>";
476 +                               $goBack = "<td class='textArea' colspan='2' align='center'>( <a href='" . htmlspecialchars($_SERVER["HTTP_REFERER"]) . "'>Return</a> | <a href='" . $config['url_path'] . "logout.php'>Login Again</a> )</td>";
477                         }else{
478 -                               $goBack = "<td class='textArea' colspan='2' align='center'>( <a href='logout.php'>Login Again</a> )</td>";
479 +                               $goBack = "<td class='textArea' colspan='2' align='center'>( <a href='" . $config['url_path'] . "logout.php'>Login Again</a> )</td>";
480                         }
481  
482                         ?>
483 @@ -83,14 +86,14 @@
484                         <head>
485                                 <title>Cacti</title>
486                                 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
487 -                               <link href="include/main.css" type="text/css" rel="stylesheet">
488 +                               <link href="<?php echo $config['url_path']; ?>include/main.css" type="text/css" rel="stylesheet">
489                         </head>
490                         <body>
491                         <br><br>
492  
493                         <table width="450" align='center'>
494                                 <tr>
495 -                                       <td colspan='2'><img src='images/auth_deny.gif' border='0' alt='Access Denied'></td>
496 +                                       <td colspan='2'><img src='<?php echo $config['url_path']; ?>images/auth_deny.gif' border='0' alt='Access Denied'></td>
497                                 </tr>
498                                 <tr style='height:10px;'><td></td></tr>
499                                 <tr>
500 diff -Naur cacti-0.8.7g-old/include/bottom_footer.php cacti-0.8.7g/include/bottom_footer.php
501 --- cacti-0.8.7g-old/include/bottom_footer.php  2010-07-09 18:33:46.000000000 -0400
502 +++ cacti-0.8.7g/include/bottom_footer.php      2010-07-09 18:34:11.000000000 -0400
503 @@ -21,6 +21,10 @@
504   | http://www.cacti.net/                                                   |
505   +-------------------------------------------------------------------------+
506  */
507 +
508 +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE);
509 +if (($oper_mode == OPER_MODE_NATIVE) || ($oper_mode == OPER_MODE_IFRAME_NONAV)) {
510 +
511  ?>
512                         </div>
513                         <br>
514 @@ -32,6 +36,9 @@
515  </html>
516  
517  <?php
518 +
519 +}
520 +
521  /* we use this session var to store field values for when a save fails,
522  this way we can restore the field's previous values. we reset it here, because
523  they only need to be stored for a single page */
524 diff -Naur cacti-0.8.7g-old/include/config.php cacti-0.8.7g/include/config.php
525 --- cacti-0.8.7g-old/include/config.php 2010-07-09 18:33:46.000000000 -0400
526 +++ cacti-0.8.7g/include/config.php     2010-07-09 18:34:11.000000000 -0400
527 @@ -30,6 +30,17 @@
528  $database_password = "cactiuser";
529  $database_port = "3306";
530  
531 +/* load up old style plugins here */
532 +$plugins = array();
533 +//$plugins[] = 'thold';
534 +
535 +/*
536 +   Edit this to point to the default URL of your Cacti install
537 +   ex: if your cacti install as at http://serverip/cacti/ this
538 +   would be set to /cacti/
539 +*/
540 +$url_path = "/";
541 +
542  /* Default session name - Session name must contain alpha characters */
543  #$cacti_session_name = "Cacti";
544  
545 diff -Naur cacti-0.8.7g-old/include/global_arrays.php cacti-0.8.7g/include/global_arrays.php
546 --- cacti-0.8.7g-old/include/global_arrays.php  2010-07-09 18:33:46.000000000 -0400
547 +++ cacti-0.8.7g/include/global_arrays.php      2010-07-09 18:34:11.000000000 -0400
548 @@ -22,6 +22,8 @@
549   +-------------------------------------------------------------------------+
550  */
551  
552 +global $menu;
553 +
554  $messages = array(
555         1  => array(
556                 "message" => 'Save Successful.',
557 @@ -654,4 +656,10 @@
558         GDC_SLASH => "/"
559         );
560  
561 +$plugin_architecture = array(
562 +       'version' => '2.8'
563 +       );
564 +
565 +api_plugin_hook('config_arrays');
566 +
567  ?>
568 diff -Naur cacti-0.8.7g-old/include/global_constants.php cacti-0.8.7g/include/global_constants.php
569 --- cacti-0.8.7g-old/include/global_constants.php       2010-07-09 18:33:46.000000000 -0400
570 +++ cacti-0.8.7g/include/global_constants.php   2010-07-09 18:34:11.000000000 -0400
571 @@ -173,4 +173,8 @@
572  define("SNMP_CMDPHP", 1);
573  define("SNMP_WEBUI", 2);
574  
575 -?>
576 +define('OPER_MODE_NATIVE', 0);
577 +define('OPER_MODE_RESKIN', 1);
578 +define('OPER_MODE_IFRAME_NONAV', 2);
579 +
580 +?>
581 \ No newline at end of file
582 diff -Naur cacti-0.8.7g-old/include/global_form.php cacti-0.8.7g/include/global_form.php
583 --- cacti-0.8.7g-old/include/global_form.php    2010-07-09 18:33:46.000000000 -0400
584 +++ cacti-0.8.7g/include/global_form.php        2010-07-09 18:34:11.000000000 -0400
585 @@ -22,8 +22,9 @@
586   +-------------------------------------------------------------------------+
587  */
588  
589 -if (!defined("VALID_HOST_FIELDS")) {
590 -       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)");
591 +if (!defined('VALID_HOST_FIELDS')) {
592 +       $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)');
593 +       define('VALID_HOST_FIELDS', $string);
594  }
595  
596  /* file: cdef.php, action: edit */
597 @@ -1190,4 +1191,7 @@
598                 "dropdown_sql" => "select id,name from snmp_query order by name"
599                 )
600         );
601 -?>
602 +
603 +
604 +api_plugin_hook('config_form');
605 +
606 diff -Naur cacti-0.8.7g-old/include/global.php cacti-0.8.7g/include/global.php
607 --- cacti-0.8.7g-old/include/global.php 2010-07-09 18:33:46.000000000 -0400
608 +++ cacti-0.8.7g/include/global.php     2010-07-09 18:34:11.000000000 -0400
609 @@ -93,6 +93,13 @@
610  /* built-in snmp support */
611  $config["php_snmp_support"] = function_exists("snmpget");
612  
613 +/* set URL path */
614 +if (! isset($url_path)) { 
615 +       $url_path = "";
616 +}
617 +$config['url_path'] = $url_path;
618 +define('URL_PATH', $url_path);
619 +
620  /* used for includes */
621  $config["base_path"] = strtr(ereg_replace("(.*)[\\\/]include", "\\1", dirname(__FILE__)), "\\", "/");
622  $config["library_path"] = ereg_replace("(.*[\\\/])include", "\\1lib", dirname(__FILE__));
623 @@ -188,15 +195,17 @@
624  /* include base modules */
625  include($config["library_path"] . "/adodb/adodb.inc.php");
626  include($config["library_path"] . "/database.php");
627 -include_once($config["library_path"] . "/functions.php");
628 -include_once($config["include_path"] . "/global_constants.php");
629 -include_once($config["include_path"] . "/global_arrays.php");
630 -include_once($config["include_path"] . "/global_settings.php");
631  
632  /* connect to the database server */
633  db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);
634  
635  /* include additional modules */
636 +include_once($config["library_path"] . "/functions.php");
637 +include_once($config["include_path"] . "/global_constants.php");
638 +include_once($config["library_path"] . "/plugins.php");
639 +include_once($config["include_path"] . "/plugins.php");
640 +include_once($config["include_path"] . "/global_arrays.php");
641 +include_once($config["include_path"] . "/global_settings.php");
642  include_once($config["include_path"] . "/global_form.php");
643  include_once($config["library_path"] . "/html.php");
644  include_once($config["library_path"] . "/html_form.php");
645 @@ -205,6 +214,8 @@
646  include_once($config["library_path"] . "/variables.php");
647  include_once($config["library_path"] . "/auth.php");
648  
649 +api_plugin_hook("config_insert");
650 +
651  /* current cacti version */
652  $config["cacti_version"] = "0.8.7g";
653  
654 diff -Naur cacti-0.8.7g-old/include/global_settings.php cacti-0.8.7g/include/global_settings.php
655 --- cacti-0.8.7g-old/include/global_settings.php        2010-07-09 18:33:46.000000000 -0400
656 +++ cacti-0.8.7g/include/global_settings.php    2010-07-09 18:34:11.000000000 -0400
657 @@ -1190,4 +1190,6 @@
658                 )
659         );
660  
661 +api_plugin_hook('config_settings');
662 +
663  ?>
664 diff -Naur cacti-0.8.7g-old/include/plugins.php cacti-0.8.7g/include/plugins.php
665 --- cacti-0.8.7g-old/include/plugins.php        1969-12-31 19:00:00.000000000 -0500
666 +++ cacti-0.8.7g/include/plugins.php    2010-07-09 18:34:11.000000000 -0400
667 @@ -0,0 +1,38 @@
668 +<?php
669 +
670 +/*
671 + * Copyright (c) 1999-2005 The SquirrelMail Project Team (http://squirrelmail.org)
672 + * Licensed under the GNU GPL. For full terms see the file COPYING.
673 + */
674 +
675 +global $plugin_hooks, $plugins_system;
676 +$plugin_hooks = array();
677 +$plugins_system = array('settings', 'boost', 'dsstats');
678 +
679 +function use_plugin ($name) {
680 +       global $config;
681 +       if (file_exists($config['base_path'] . "/plugins/$name/setup.php")) {
682 +               include_once($config['base_path'] . "/plugins/$name/setup.php");
683 +               $function = "plugin_init_$name";
684 +               if (function_exists($function)) {
685 +                       $function();
686 +               }
687 +       }
688 +}
689 +
690 +/**
691 + * This function executes a hook.
692 + * @param string $name Name of hook to fire
693 + * @return mixed $data
694 + */
695 +
696 +$oldplugins = read_config_option('oldplugins');
697 +$oldplugins = explode(',', $oldplugins);
698 +$plugins = array_merge($plugins, $oldplugins);
699 +
700 +/* On startup, register all plugins configured for use. */
701 +if (isset($plugins) && is_array($plugins)) {
702 +       foreach ($plugins as $name) {
703 +               use_plugin($name);
704 +       }
705 +}
706 diff -Naur cacti-0.8.7g-old/include/top_graph_header.php cacti-0.8.7g/include/top_graph_header.php
707 --- cacti-0.8.7g-old/include/top_graph_header.php       2010-07-09 18:33:46.000000000 -0400
708 +++ cacti-0.8.7g/include/top_graph_header.php   2010-07-09 18:34:11.000000000 -0400
709 @@ -25,6 +25,11 @@
710  $using_guest_account = false;
711  $show_console_tab = true;
712  
713 +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE);
714 +if ($oper_mode == OPER_MODE_RESKIN) {
715 +       return;
716 +}
717 +
718  /* ================= input validation ================= */
719  input_validate_input_number(get_request_var_request("local_graph_id"));
720  input_validate_input_number(get_request_var_request("graph_start"));
721 @@ -52,41 +57,53 @@
722         $_SESSION["sess_nav_level_cache"][2]["url"] = "graph.php?local_graph_id=" . $_REQUEST["local_graph_id"] . "&rra_id=all";
723  }
724  
725 +$page_title = api_plugin_hook_function('page_title', draw_navigation_text("title"));
726 +
727  ?>
728  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
729  <html>
730  <head>
731 -       <title><?php echo draw_navigation_text("title");?></title>
732 +       <title><?php echo $page_title; ?></title>
733         <?php
734         if (isset($_SESSION["custom"]) && $_SESSION["custom"] == true) {
735                 print "<meta http-equiv=refresh content='99999'>\r\n";
736         }else{
737 -               print "<meta http-equiv=refresh content='" . htmlspecialchars(read_graph_config_option("page_refresh"),ENT_QUOTES) . "'>\r\n";
738 +               $refresh = api_plugin_hook_function('top_graph_refresh', htmlspecialchars(read_graph_config_option("page_refresh"),ENT_QUOTES));
739 +               print "<meta http-equiv=refresh content='" . $refresh . "'>\r\n";
740         }
741         ?>
742         <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
743 -       <link href="include/main.css" type="text/css" rel="stylesheet">
744 -       <link href="images/favicon.ico" rel="shortcut icon"/>
745 -       <script type="text/javascript" src="include/layout.js"></script>
746 -       <script type="text/javascript" src="include/treeview/ua.js"></script>
747 -       <script type="text/javascript" src="include/treeview/ftiens4.js"></script>
748 -       <script type="text/javascript" src="include/jscalendar/calendar.js"></script>
749 -       <script type="text/javascript" src="include/jscalendar/lang/calendar-en.js"></script>
750 -       <script type="text/javascript" src="include/jscalendar/calendar-setup.js"></script>
751 +       <link href="<?php echo $config['url_path']; ?>include/main.css" type="text/css" rel="stylesheet">
752 +       <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
753 +       <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
754 +       <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script>
755 +       <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script>
756 +       <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
757 +       <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
758 +       <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
759 +       <?php api_plugin_hook('page_head'); ?>
760  </head>
761  
762 -<body>
763 +<?php if ($oper_mode == OPER_MODE_NATIVE) {?>
764 +<body <?php print api_plugin_hook_function("body_style", "");?>>
765  <a name='page_top'></a>
766 +<?php }else{?>
767 +<body <?php print api_plugin_hook_function("body_style", "");?>>
768 +<?php }?>
769 +
770  <table style="width:100%;height:100%;" cellspacing="0" cellpadding="0">
771 +<?php if ($oper_mode == OPER_MODE_NATIVE) { ;?>
772         <tr style="height:25px;" bgcolor="#a9a9a9" class="noprint">
773                 <td colspan="2" valign="bottom" nowrap>
774                         <table width="100%" cellspacing="0" cellpadding="0">
775 -                               <tr style="background: transparent url('images/cacti_backdrop2.gif') no-repeat center right;">
776 +                               <tr style="background: transparent url('<?php echo $config['url_path']; ?>images/cacti_backdrop2.gif') no-repeat center right;">
777                                         <td id="tabs" nowrap>
778 -                                               &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<?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>&nbsp;
779 +                                               &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<?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
780 +                                               api_plugin_hook('top_graph_header_tabs');
781 +                                               ?>
782                                         </td>
783                                         <td id="gtabs" align="right" nowrap>
784 -                                               <?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="<?php print htmlspecialchars("graph_view.php?action=tree");?>"><img src="images/tab_mode_tree<?php if (isset($_REQUEST["action"]) && $_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 (isset($_REQUEST["action"]) && $_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 (isset($_REQUEST["action"]) && $_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?>&nbsp;<br>
785 +                                               <?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 print htmlspecialchars($config['url_path'] . "graph_view.php?action=tree");?>"><img src="<?php echo $config['url_path']; ?>images/tab_mode_tree<?php if (isset($_REQUEST["action"]) && $_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 print htmlspecialchars($config['url_path'] . "graph_view.php?action=list");?>"><img src="<?php echo $config['url_path']; ?>images/tab_mode_list<?php if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="<?php print htmlspecialchars($config['url_path'] . "graph_view.php?action=preview");?>"><img src="<?php echo $config['url_path']; ?>images/tab_mode_preview<?php if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?>&nbsp;<br>
786                                         </td>
787                                 </tr>
788                         </table>
789 @@ -94,7 +111,7 @@
790         </tr>
791         <tr style="height:2px;" bgcolor="#183c8f" class="noprint">
792                 <td colspan="2">
793 -                       <img src="images/transparent_line.gif" style="height:2px;width:170px;" border="0"><br>
794 +                       <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" style="height:2px;width:170px;" border="0"><br>
795                 </td>
796         </tr>
797         <tr style="height:5px;" bgcolor="#e9e9e9" class="noprint">
798 @@ -106,7 +123,7 @@
799                                         </td>
800                                         <td align="right">
801                                                 <?php if ((isset($_SESSION["sess_user_id"])) && ($using_guest_account == false)) { ?>
802 -                                               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;
803 +                                               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;
804                                                 <?php } ?>
805                                         </td>
806                                 </tr>
807 @@ -114,10 +131,10 @@
808                 </td>
809         </tr>
810         <tr class="noprint">
811 -               <td bgcolor="#efefef" colspan="1" style="height:8px;background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
812 -                       <img src="images/transparent_line.gif" width="<?php print htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>" style="height:2px;" border="0"><br>
813 +               <td bgcolor="#efefef" colspan="1" style="height:8px;background-image: url(<?php echo $config['url_path']; ?>images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
814 +                       <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" width="<?php print htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>" style="height:2px;" border="0"><br>
815                 </td>
816 -               <td bgcolor="#ffffff" colspan="1" style="height:8px;background-image: url(images/shadow.gif); background-repeat: repeat-x;">
817 +               <td bgcolor="#ffffff" colspan="1" style="height:8px;background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;">
818  
819                 </td>
820         </tr>
821 @@ -143,6 +160,8 @@
822                 </td>
823         </tr>
824         <?php }
825 +       }
826 +       global $graph_views;
827         load_current_session_value("action", "sess_cacti_graph_action", $graph_views[read_graph_config_option("default_tree_view_mode")]);
828         ?>
829         <tr>
830 diff -Naur cacti-0.8.7g-old/include/top_header.php cacti-0.8.7g/include/top_header.php
831 --- cacti-0.8.7g-old/include/top_header.php     2010-07-09 18:33:46.000000000 -0400
832 +++ cacti-0.8.7g/include/top_header.php 2010-07-09 18:34:11.000000000 -0400
833 @@ -22,38 +22,53 @@
834   +-------------------------------------------------------------------------+
835  */
836  
837 -global $colors;
838 +global $colors, $config;
839 +
840 +$oper_mode = api_plugin_hook_function('top_header', OPER_MODE_NATIVE);
841 +if ($oper_mode == OPER_MODE_RESKIN) {
842 +       return;
843 +}
844 +
845 +$page_title = api_plugin_hook_function('page_title', draw_navigation_text("title"));
846 +
847  ?>
848  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
849  <html>
850  <head>
851 -       <title><?php echo draw_navigation_text("title");?></title>
852 -       <link href="include/main.css" type="text/css" rel="stylesheet">
853 -       <link href="images/favicon.ico" rel="shortcut icon"/>
854 +       <title><?php echo $page_title; ?></title>
855 +       <link href="<?php echo $config['url_path']; ?>include/main.css" type="text/css" rel="stylesheet">
856 +       <link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon">
857         <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
858 -       <script type="text/javascript" src="include/layout.js"></script>
859 +       <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
860         <?php if (isset($refresh)) {
861         print "<meta http-equiv=refresh content=\"" . $refresh["seconds"] . "; url='" . $refresh["page"] . "'\">";
862 -       }?>
863 +       }
864 +       api_plugin_hook('page_head'); ?>
865  </head>
866  
867 -<body style="background-image:url('images/left_border.gif');background-repeat:repeat-y;">
868 +<?php if ($oper_mode == OPER_MODE_NATIVE) {?>
869 +<body style="background-image:url('<?php print $config['url_path'];?>images/left_border.gif');background-repeat:repeat-y;" <?php print api_plugin_hook_function("body_style", "");?>>
870 +<?php }else{?>
871 +<body style="background-image:url('<?php print $config['url_path'];?>images/left_border.gif');background-repeat:repeat-y;" <?php print api_plugin_hook_function("body_style", "");?>>
872 +<?php }?>
873  
874  <table width="100%" cellspacing="0" cellpadding="0">
875 +<?php if ($oper_mode == OPER_MODE_NATIVE) { ;?>
876         <tr style="height:1px;" bgcolor="#a9a9a9">
877                 <td valign="bottom" colspan="3" nowrap>
878                         <table width="100%" cellspacing="0" cellpadding="0">
879 -                               <tr style="background: transparent url('images/cacti_backdrop.gif') no-repeat center right;">
880 +                               <tr style="background: transparent url('<?php echo $config['url_path']; ?>images/cacti_backdrop.gif') no-repeat center right;">
881                                         <td id="tabs" valign="bottom">
882 -                                               &nbsp;<a href="index.php"><img src="images/tab_console_down.gif" alt="Console" align="absmiddle" border="0"></a><a href="graph_view.php"><img src="images/tab_graphs.gif" alt="Graphs" align="absmiddle" border="0"></a>
883 -                                       </td>
884 +                                               &nbsp;<a href="<?php echo $config['url_path']; ?>index.php"><img src="<?php echo $config['url_path']; ?>images/tab_console_down.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="Graphs" align="absmiddle" border="0"></a><?php
885 +                                               api_plugin_hook('top_header_tabs');
886 +                                       ?></td>
887                                 </tr>
888                         </table>
889                 </td>
890         </tr>
891         <tr style="height:2px;" bgcolor="#183c8f">
892                 <td colspan="3">
893 -                       <img src="images/transparent_line.gif" style="height:2px;" border="0"><br>
894 +                       <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" style="height:2px;" border="0"><br>
895                 </td>
896         </tr>
897         <tr style="height:5px;" bgcolor="#e9e9e9">
898 @@ -65,7 +80,7 @@
899                                         </td>
900                                         <td align="right">
901                                                 <?php if (read_config_option("auth_method") != 0) { ?>
902 -                                               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;
903 +                                               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;
904                                                 <?php } ?>
905                                         </td>
906                                 </tr>
907 @@ -73,10 +88,10 @@
908                 </td>
909         </tr>
910         <tr>
911 -               <td bgcolor="#f5f5f5" colspan="1" style="height:8px;width:135px;background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
912 -                       <img src="images/transparent_line.gif" style="height:2px;width:135px;" border="0"><br>
913 +               <td bgcolor="#f5f5f5" colspan="1" style="height:8px;width:135px;background-image: url(<?php echo $config['url_path']; ?>images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
914 +                       <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" style="height:2px;width:135px;" border="0"><br>
915                 </td>
916 -               <td colspan="2" style="height:8px;background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
917 +               <td colspan="2" style="height:8px;background-image: url(<?php echo $config['url_path']; ?>images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
918  
919                 </td>
920         </tr>
921 @@ -86,9 +101,12 @@
922                                 <?php draw_menu();?>
923                         </table>
924  
925 -                       <img src="images/transparent_line.gif" style="height:5px;width:135px;" border="0"><br>
926 -                       <p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
927 -                       <img src="images/transparent_line.gif" style="height:5px;width:135px;" border="0"><br>
928 +                       <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" style="height:5px;width:135px;" border="0"><br>
929 +                       <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>
930 +                       <img src="<?php echo $config['url_path']; ?>images/transparent_line.gif" style="height:5px;width:135px;" border="0"><br>
931                 </td>
932                 <td width="100%" colspan="2" valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;"><?php display_output_messages();?><div style='position:relative;' id='main'>
933 -
934 +<?php }else{ ?>
935 +       <tr>
936 +               <td width="100%" valign="top"><?php display_output_messages();?>
937 +<?php } ?>
938 diff -Naur cacti-0.8.7g-old/index.php cacti-0.8.7g/index.php
939 --- cacti-0.8.7g-old/index.php  2010-07-09 18:33:46.000000000 -0400
940 +++ cacti-0.8.7g/index.php      2010-07-09 18:34:11.000000000 -0400
941 @@ -25,6 +25,8 @@
942  include("./include/auth.php");
943  include("./include/top_header.php");
944  
945 +api_plugin_hook('console_before');
946 +
947  ?>
948  <table width="100%" align="center">
949         <tr>
950 @@ -46,6 +48,8 @@
951  
952  <?php
953  
954 +api_plugin_hook('console_after');
955 +
956  include("./include/bottom_footer.php");
957  
958  ?>
959 diff -Naur cacti-0.8.7g-old/lib/api_device.php cacti-0.8.7g/lib/api_device.php
960 --- cacti-0.8.7g-old/lib/api_device.php 2010-07-09 18:33:46.000000000 -0400
961 +++ cacti-0.8.7g/lib/api_device.php     2010-07-09 18:34:11.000000000 -0400
962 @@ -137,6 +137,8 @@
963         $save["ping_retries"]         = form_input_validate($ping_retries, "ping_retries", "^[0-9]+$", true, 3);
964         $save["max_oids"]             = form_input_validate($max_oids, "max_oids", "^[0-9]+$", true, 3);
965  
966 +       $save = api_plugin_hook_function('api_device_save', $save);
967 +
968         $host_id = 0;
969  
970         if (!is_error_message()) {
971 diff -Naur cacti-0.8.7g-old/lib/auth.php cacti-0.8.7g/lib/auth.php
972 --- cacti-0.8.7g-old/lib/auth.php       2010-07-09 18:33:46.000000000 -0400
973 +++ cacti-0.8.7g/lib/auth.php   2010-07-09 18:34:11.000000000 -0400
974 @@ -121,8 +121,9 @@
975                 }
976         }
977  
978 -       return true;
979 +       api_plugin_hook_function('copy_user', array('template_id' => $template_id, 'new_id' => $new_id));
980  
981 +       return true;
982  }
983  
984  
985 @@ -152,6 +153,7 @@
986         db_execute("delete from settings_graphs where user_id=" . $user_id);
987         db_execute("delete from settings_tree where user_id=" . $user_id);
988  
989 +       api_plugin_hook_function('user_remove', $user_id);
990  }
991  
992  /* user_disable - disable a user account
993 diff -Naur cacti-0.8.7g-old/lib/functions.php cacti-0.8.7g/lib/functions.php
994 --- cacti-0.8.7g-old/lib/functions.php  2010-07-09 18:33:46.000000000 -0400
995 +++ cacti-0.8.7g/lib/functions.php      2010-07-09 18:34:11.000000000 -0400
996 @@ -1689,6 +1689,8 @@
997     @arg $type - (string) Either 'url' or 'title'
998     @returns (string> Either the navigation text or title */
999  function draw_navigation_text($type = "url") {
1000 +       global $config;
1001 +
1002         $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array());
1003  
1004         $nav = array(
1005 @@ -1701,8 +1703,8 @@
1006                 "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
1007                 "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"),
1008                 "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"),
1009 -               "index.php:" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"),
1010 -               "index.php:login" => array("title" => "Console", "mapping" => "", "url" => "index.php", "level" => "0"),
1011 +               "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"),
1012 +               "index.php:login" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"),
1013                 "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"),
1014                 "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"),
1015                 "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"),
1016 @@ -1780,6 +1782,8 @@
1017                 "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
1018                 );
1019  
1020 +       $nav =  api_plugin_hook_function('draw_navigation_text', $nav);
1021 +
1022         $current_page = basename($_SERVER["PHP_SELF"]);
1023  
1024         input_validate_input_regex(get_request_var_request("action"), "^([a-zA-Z0-9_-]+)$");
1025 diff -Naur cacti-0.8.7g-old/lib/html_form.php cacti-0.8.7g/lib/html_form.php
1026 --- cacti-0.8.7g-old/lib/html_form.php  2010-07-09 18:33:46.000000000 -0400
1027 +++ cacti-0.8.7g/lib/html_form.php      2010-07-09 18:34:11.000000000 -0400
1028 @@ -722,11 +722,13 @@
1029       on a confirmation form
1030     @arg $cancel_url - the url to go to when the user clicks 'cancel'
1031     @arg $action_url - the url to go to when the user clicks 'delete' */
1032 -function form_confirm_buttons($action_url, $cancel_url) { ?>
1033 +function form_confirm_buttons($action_url, $cancel_url) {
1034 +       global $config;
1035 +       ?>
1036         <tr>
1037                 <td bgcolor="#E1E1E1">
1038 -                       <input type='button' onClick='cactiReturnTo("<?php print $cancel_url;?>")' value='Cancel'>
1039 -                       <input type='submit' onClick='cactiReturnTo("<?php print $action_url;?>&confirm=true")' value='Delete'>
1040 +                       <input type='button' onClick='cactiReturnTo("<?php print $config['url_path'] . $cancel_url;?>")' value='Cancel'>
1041 +                       <input type='submit' onClick='cactiReturnTo("<?php print $config['url_path'] . $action_url;?>&confirm=true")' value='Delete'>
1042                 </td>
1043         </tr>
1044  <?php }
1045 diff -Naur cacti-0.8.7g-old/lib/html.php cacti-0.8.7g/lib/html.php
1046 --- cacti-0.8.7g-old/lib/html.php       2010-07-09 18:33:46.000000000 -0400
1047 +++ cacti-0.8.7g/lib/html.php   2010-07-09 18:34:11.000000000 -0400
1048 @@ -144,14 +144,15 @@
1049                                         <table align='center' cellpadding='0'>
1050                                                 <tr>
1051                                                         <td align='center'>
1052 -                                                               <div style="min-height: <?php echo (1.6 * $graph["height"]) . "px"?>;"><a href='<?php print htmlspecialchars("graph.php?action=view&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=all");?>'><img class='graphimage' id='graph_<?php print $graph["local_graph_id"] ?>' src='<?php print htmlspecialchars("graph_image.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0" . (($extra_url_args == "") ? "" : "&$extra_url_args"));?>' border='0' alt='<?php print htmlspecialchars($graph["title_cache"]);?>'></a></div>
1053 +                                                               <div style="min-height: <?php echo (1.6 * $graph["height"]) . "px"?>;"><a href='<?php print htmlspecialchars($config['url_path'] . "graph.php?action=view&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=all");?>'><img class='graphimage' id='graph_<?php print $graph["local_graph_id"] ?>' src='<?php print htmlspecialchars($config['url_path'] . "graph_image.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0" . (($extra_url_args == "") ? "" : "&$extra_url_args"));?>' border='0' alt='<?php print htmlspecialchars($graph["title_cache"]);?>'></a></div>
1054                                                                 <?php print (read_graph_config_option("show_graph_title") == "on" ? "<p style='font-size: 10;' align='center'><strong>" . htmlspecialchars($graph["title_cache"]) . "</strong></p>" : "");?>
1055                                                         </td>
1056                                                         <td valign='top' style='align: left; padding: 3px;' class='noprint'>
1057 -                                                               <a href='<?php print htmlspecialchars("graph.php?action=zoom&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&". $extra_url_args);?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
1058 -                                                               <a href='<?php print htmlspecialchars("graph_xport.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
1059 -                                                               <a href='<?php print htmlspecialchars("graph.php?action=properties&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br>
1060 -                                                               <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
1061 +                                                               <a href='<?php print htmlspecialchars($config['url_path'] . "graph.php?action=zoom&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&". $extra_url_args);?>'><img src='<?php print $config['url_path'];?>images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
1062 +                                                               <a href='<?php print htmlspecialchars($config['url_path'] . "graph_xport.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='<?php print $config['url_path'];?>images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
1063 +                                                               <a href='<?php print htmlspecialchars($config['url_path'] . "graph.php?action=properties&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='<?php print $config['url_path'];?>images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br>
1064 +                                                               <?php api_plugin_hook('graph_buttons', array('hook' => 'graphs_thumbnails', 'local_graph_id' => $graph['local_graph_id'], 'rra' =>  0, 'view_type' => 'view')); ?>
1065 +                                                               <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>
1066                                                         </td>
1067                                                 </tr>
1068                                         </table>
1069 @@ -177,6 +178,7 @@
1070     @arg $extra_url_args - extra arguments to append to the url
1071     @arg $header - html to use as a header */
1072  function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "") {
1073 +       global $config;
1074         $i = 0; $k = 0; $j = 0;
1075  
1076         $num_graphs = sizeof($graph_array);
1077 @@ -268,14 +270,15 @@
1078                                 <table align='center' cellpadding='0'>
1079                                         <tr>
1080                                                 <td align='center'>
1081 -                                                       <div style="min-height: <?php echo (1.6 * read_graph_config_option("default_height")) . "px"?>;"><a href='<?php print htmlspecialchars("graph.php?action=view&rra_id=all&local_graph_id=" . $graph["local_graph_id"]);?>'><img class='graphimage' id='graph_<?php print $graph["local_graph_id"] ?>' src='<?php print htmlspecialchars("graph_image.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&graph_height=" . read_graph_config_option("default_height") . "&graph_width=" . read_graph_config_option("default_width") . "&graph_nolegend=true" . (($extra_url_args == "") ? "" : "&$extra_url_args"));?>' border='0' alt='<?php print htmlspecialchars($graph["title_cache"]);?>'></a></div>
1082 +                                                       <div style="min-height: <?php echo (1.6 * read_graph_config_option("default_height")) . "px"?>;"><a href='<?php print htmlspecialchars($config['url_path'] . "graph.php?action=view&rra_id=all&local_graph_id=" . $graph["local_graph_id"]);?>'><img class='graphimage' id='graph_<?php print $graph["local_graph_id"] ?>' src='<?php print htmlspecialchars($config["url_path"] . "graph_image.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&graph_height=" . read_graph_config_option("default_height") . "&graph_width=" . read_graph_config_option("default_width") . "&graph_nolegend=true" . (($extra_url_args == "") ? "" : "&$extra_url_args"));?>' border='0' alt='<?php print htmlspecialchars($graph["title_cache"]);?>'></a></div>
1083                                                         <?php print (read_graph_config_option("show_graph_title") == "on" ? "<p style='font-size: 10;' align='center'><strong>" . htmlspecialchars($graph["title_cache"]) . "</strong></p>" : "");?>
1084                                                 </td>
1085                                                 <td valign='top' style='align: left; padding: 3px;'>
1086 -                                                       <a href='<?php print htmlspecialchars("graph.php?action=zoom&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
1087 -                                                       <a href='<?php print htmlspecialchars("graph_xport.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
1088 -                                                       <a href='<?php print htmlspecialchars("graph.php?action=properties&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br>
1089 -                                                       <a href='#page_top'><img src='images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
1090 +                                                       <a href='<?php print htmlspecialchars($config['url_path'] . "graph.php?action=zoom&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='<?php print $config['url_path'];?>images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
1091 +                                                       <a href='<?php print htmlspecialchars($config['url_path'] . "graph_xport.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='<?php print $config['url_path'];?>images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
1092 +                                                       <a href='<?php print htmlspecialchars($config['url_path'] . "graph.php?action=properties&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);?>'><img src='<?php print $config['url_path'];?>images/graph_properties.gif' border='0' alt='Graph Source/Properties' title='Graph Source/Properties' style='padding: 3px;'></a><br>
1093 +                                                       <?php api_plugin_hook('graph_buttons_thumbnails', array('hook' => 'graphs_thumbnails', 'local_graph_id' => $graph['local_graph_id'], 'rra' =>  0, 'view_type' => '')); ?>
1094 +                                                       <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>
1095                                                 </td>
1096                                         </tr>
1097                                 </table>
1098 @@ -638,9 +641,9 @@
1099                 print "<td style='$this_row_style'>" . $item["hex"] . "</td>\n";
1100  
1101                 if ($disable_controls == false) {
1102 -                       print "<td><a href='" . htmlspecialchars("$filename?action=item_movedown&id=" . $item["id"] . "&$url_data") . "'><img src='images/move_down.gif' border='0' alt='Move Down'></a>
1103 -                                       <a href='" . htmlspecialchars("$filename?action=item_moveup&id=" . $item["id"] . "&$url_data") . "'><img src='images/move_up.gif' border='0' alt='Move Up'></a></td>\n";
1104 -                       print "<td align='right'><a href='" . htmlspecialchars("$filename?action=item_remove&id=" . $item["id"] . "&$url_data") . "'><img src='images/delete_icon.gif' style='height:10px;width:10px;' border='0' alt='Delete'></a></td>\n";
1105 +                       print "<td><a href='" . htmlspecialchars("$filename?action=item_movedown&id=" . $item["id"] . "&$url_data") . "'><img src='" . $config['url_path'] . "images/move_down.gif' border='0' alt='Move Down'></a>
1106 +                                       <a href='" . htmlspecialchars("$filename?action=item_moveup&id=" . $item["id"] . "&$url_data") . "'><img src='" . $config['url_path'] . "images/move_up.gif' border='0' alt='Move Up'></a></td>\n";
1107 +                       print "<td align='right'><a href='" . htmlspecialchars("$filename?action=item_remove&id=" . $item["id"] . "&$url_data") . "'><img src='" . $config['url_path'] . "images/delete_icon.gif' style='height:10px;width:10px;' border='0' alt='Delete'></a></td>\n";
1108                 }
1109  
1110                 print "</tr>";
1111 @@ -706,6 +709,8 @@
1112                                         }
1113  
1114                                         while (list($item_sub_url, $item_sub_title) = each($item_title)) {
1115 +                                               $item_sub_url = $config['url_path'] . $item_sub_url;
1116 +
1117                                                 /* indent sub-items */
1118                                                 if ($i > 0) {
1119                                                         $prepend_string = "---&nbsp;";
1120 @@ -715,7 +720,7 @@
1121  
1122                                                 /* do not put a line between each sub-item */
1123                                                 if (($i == 0) || ($draw_sub_items == false)) {
1124 -                                                       $background = "images/menu_line.gif";
1125 +                                                       $background = $config['url_path'] . "images/menu_line.gif";
1126                                                 }else{
1127                                                         $background = "";
1128                                                 }
1129 @@ -744,17 +749,18 @@
1130                         }else{
1131                                 if ($current_realm_id == -1 || (isset($user_realms[$current_realm_id])) || (!isset($user_auth_realm_filenames{basename($item_url)}))) {
1132                                         /* draw normal (non sub-item) menu item */
1133 +                                       $item_url = $config['url_path'] . $item_url;
1134                                         if (basename($_SERVER["PHP_SELF"]) == basename($item_url)) {
1135 -                                               print "<tr><td class='textMenuItemSelected' style='background-image:url(\"images/menu_line.gif\");'><strong><a href='" . htmlspecialchars($item_url) . "'>$item_title</a></strong></td></tr>\n";
1136 +                                               print "<tr><td class='textMenuItemSelected' style='background-image:url(\"" . $config['url_path'] . "images/menu_line.gif\");'><strong><a href='" . htmlspecialchars($item_url) . "'>$item_title</a></strong></td></tr>\n";
1137                                         }else{
1138 -                                               print "<tr><td class='textMenuItem' style='background-image:url(\"images/menu_line.gif\");'><a href='" . htmlspecialchars($item_url) . "'>$item_title</a></td></tr>\n";
1139 +                                               print "<tr><td class='textMenuItem' style='background-image:url(\"" . $config['url_path'] . "images/menu_line.gif\");'><a href='" . htmlspecialchars($item_url) . "'>$item_title</a></td></tr>\n";
1140                                         }
1141                                 }
1142                         }
1143                 }
1144         }
1145  
1146 -       print "<tr><td class='textMenuItem' style='background-image:url(\"images/menu_line.gif\");'></td></tr>\n";
1147 +       print "<tr><td class='textMenuItem' style='background-image:url(\"" . $config['url_path'] . "images/menu_line.gif\");'></td></tr>\n";
1148  
1149         print "</table></td></tr>";
1150  }
1151 @@ -764,11 +770,12 @@
1152     @arg $actions_array - an array that contains a list of possible actions. this array should
1153       be compatible with the form_dropdown() function */
1154  function draw_actions_dropdown($actions_array) {
1155 +       global $config;
1156         ?>
1157         <table align='center' width='100%'>
1158                 <tr>
1159                         <td width='1' valign='top'>
1160 -                               <img src='images/arrow.gif' alt=''>&nbsp;
1161 +                               <img src='<?php echo $config['url_path']; ?>images/arrow.gif' alt='' align='middle'>&nbsp;
1162                         </td>
1163                         <td align='right'>
1164                                 Choose an action:
1165 diff -Naur cacti-0.8.7g-old/lib/plugins.php cacti-0.8.7g/lib/plugins.php
1166 --- cacti-0.8.7g-old/lib/plugins.php    1969-12-31 19:00:00.000000000 -0500
1167 +++ cacti-0.8.7g/lib/plugins.php        2010-07-09 18:34:11.000000000 -0400
1168 @@ -0,0 +1,476 @@
1169 +<?php
1170 +
1171 +
1172 +
1173 +function do_hook ($name) {
1174 +       $data = func_get_args();
1175 +       $data = api_plugin_hook ($name, $data);
1176 +       return $data;
1177 +}
1178 +
1179 +function do_hook_function($name,$parm=NULL) {
1180 +       return api_plugin_hook_function ($name, $parm);
1181 +}
1182 +
1183 +function api_user_realm_auth ($filename = '') {
1184 +       return api_plugin_user_realm_auth ($filename);
1185 +}
1186 +
1187 +/**
1188 + * This function executes a hook.
1189 + * @param string $name Name of hook to fire
1190 + * @return mixed $data
1191 + */
1192 +function api_plugin_hook ($name) {
1193 +       global $config, $plugin_hooks, $plugins_system;
1194 +       $data = func_get_args();
1195 +       $ret = '';
1196 +       $p = array();
1197 +
1198 +       $ps_where = '';
1199 +       if (sizeof($plugins_system)) {
1200 +               foreach($plugins_system as $plugin) {
1201 +                       $ps_where .= (strlen($ps_where) ? "', '":"('") . $plugin;
1202 +               }
1203 +               $ps_where .= "')";
1204 +       }
1205 +
1206 +       /* order the plugin functions by system first, then followed by order */
1207 +       $result = db_fetch_assoc("SELECT 1 AS id, ph.name, ph.file, ph.function
1208 +               FROM plugin_hooks AS ph
1209 +               LEFT JOIN plugin_config AS pc
1210 +               ON pc.directory=ph.name
1211 +               WHERE ph.status = 1 AND hook = '$name'
1212 +               AND ph.name IN $ps_where
1213 +               UNION
1214 +               SELECT pc.id, ph.name, ph.file, ph.function
1215 +               FROM plugin_hooks AS ph
1216 +               LEFT JOIN plugin_config AS pc
1217 +               ON pc.directory=ph.name
1218 +               WHERE ph.status = 1 AND hook = '$name'
1219 +               AND ph.name NOT IN $ps_where
1220 +               ORDER BY id ASC", true);
1221 +
1222 +       if (count($result)) {
1223 +               foreach ($result as $hdata) {
1224 +                       $p[] = $hdata['name'];
1225 +                       if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
1226 +                               include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
1227 +                       }
1228 +                       $function = $hdata['function'];
1229 +                       if (function_exists($function)) {
1230 +                               $function($data);
1231 +                       }
1232 +               }
1233 +       }
1234 +
1235 +       if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
1236 +               foreach ($plugin_hooks[$name] as $pname => $function) {
1237 +                       if (function_exists($function)  && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) {
1238 +                               $function($data);
1239 +                       }
1240 +               }
1241 +       }
1242 +
1243 +       /* Variable-length argument lists have a slight problem when */
1244 +       /* passing values by reference. Pity. This is a workaround.  */
1245 +       return $data;
1246 +}
1247 +
1248 +function api_plugin_hook_function ($name, $parm=NULL) {
1249 +       global $config, $plugin_hooks, $plugins_system;
1250 +       $ret = $parm;
1251 +       $p = array();
1252 +       $ps_where = '';
1253 +
1254 +       if (sizeof($plugins_system)) {
1255 +               foreach($plugins_system as $plugin) {
1256 +                       $ps_where .= (strlen($ps_where) ? "', '":"('") . $plugin;
1257 +               }
1258 +               $ps_where .= "')";
1259 +       }
1260 +
1261 +       /* order the plugin functions by system first, then followed by order */
1262 +       $result = db_fetch_assoc("SELECT 1 AS id, ph.name, ph.file, ph.function
1263 +               FROM plugin_hooks AS ph
1264 +               LEFT JOIN plugin_config AS pc
1265 +               ON pc.directory=ph.name
1266 +               WHERE ph.status = 1 AND hook = '$name'
1267 +               AND ph.name IN $ps_where
1268 +               UNION
1269 +               SELECT pc.id, ph.name, ph.file, ph.function
1270 +               FROM plugin_hooks AS ph
1271 +               LEFT JOIN plugin_config AS pc
1272 +               ON pc.directory=ph.name
1273 +               WHERE ph.status = 1 AND hook = '$name'
1274 +               AND ph.name NOT IN $ps_where
1275 +               ORDER BY id ASC", true);
1276 +
1277 +       if (count($result)) {
1278 +               foreach ($result as $hdata) {
1279 +                       $p[] = $hdata['name'];
1280 +                       if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
1281 +                               include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
1282 +                       }
1283 +                       $function = $hdata['function'];
1284 +                       if (function_exists($function)) {
1285 +                               $ret = $function($ret);
1286 +                       }
1287 +               }
1288 +       }
1289 +
1290 +       if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
1291 +               foreach ($plugin_hooks[$name] as $pname => $function) {
1292 +                       if (function_exists($function)  && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) {
1293 +                               $ret = $function($ret);
1294 +                       }
1295 +               }
1296 +       }
1297 +
1298 +       /* Variable-length argument lists have a slight problem when */
1299 +       /* passing values by reference. Pity. This is a workaround.  */
1300 +       return $ret;
1301 +}
1302 +
1303 +function api_plugin_db_table_create ($plugin, $table, $data) {
1304 +       global $config, $database_default;
1305 +       include_once($config["library_path"] . "/database.php");
1306 +
1307 +       $result = db_fetch_assoc("show tables from `" . $database_default . "`") or die (mysql_error());
1308 +       $tables = array();
1309 +       foreach($result as $index => $arr) {
1310 +               foreach ($arr as $t) {
1311 +                       $tables[] = $t;
1312 +               }
1313 +       }
1314 +       if (!in_array($table, $tables)) {
1315 +               $c = 0;
1316 +               $sql = 'CREATE TABLE `' . $table . "` (\n";
1317 +               foreach ($data['columns'] as $column) {
1318 +                       if (isset($column['name'])) {
1319 +                               if ($c > 0)
1320 +                                       $sql .= ",\n";
1321 +                               $sql .= '`' . $column['name'] . '`';
1322 +                               if (isset($column['type']))
1323 +                                       $sql .= ' ' . $column['type'];
1324 +                               if (isset($column['unsigned']))
1325 +                                       $sql .= ' unsigned';
1326 +                               if (isset($column['NULL']) && $column['NULL'] == false)
1327 +                                       $sql .= ' NOT NULL';
1328 +                               if (isset($column['NULL']) && $column['NULL'] == true && !isset($column['default']))
1329 +                                       $sql .= ' default NULL';
1330 +                               if (isset($column['default']))
1331 +                                       $sql .= ' default ' . (is_numeric($column['default']) ? $column['default'] : "'" . $column['default'] . "'");
1332 +                               if (isset($column['auto_increment']))
1333 +                                       $sql .= ' auto_increment';
1334 +                               $c++;
1335 +                       }
1336 +               }
1337 +
1338 +               if (isset($data['primary'])) {
1339 +                       $sql .= ",\n PRIMARY KEY (`" . $data['primary'] . '`)';
1340 +               }
1341 +
1342 +               foreach ($data['keys'] as $key) {
1343 +                       if (isset($key['name'])) {
1344 +                               $sql .= ",\n KEY `" . $key['name'] . '` (`' . $key['columns'] . '`)';
1345 +                       }
1346 +               }
1347 +               $sql .= ') TYPE = ' . $data['type'];
1348 +
1349 +               if (isset($data['comment'])) {
1350 +                       $sql .= " COMMENT = '" . $data['comment'] . "'";
1351 +               }
1352 +               if (db_execute($sql)) {
1353 +                       db_execute("INSERT INTO plugin_db_changes (plugin, `table`, method) VALUES ('$plugin', '$table', 'create')");
1354 +               }
1355 +       } else {
1356 +               db_execute("INSERT INTO plugin_db_changes (plugin, `table`, method) VALUES ('$plugin', '$table', 'create')");
1357 +       }
1358 +}
1359 +
1360 +function api_plugin_db_changes_remove ($plugin) {
1361 +       // Example: api_plugin_db_changes_remove ('thold');
1362 +
1363 +       $tables = db_fetch_assoc("SELECT `table` FROM plugin_db_changes WHERE plugin = '$plugin' AND method ='create'", false);
1364 +       if (count($tables)) {
1365 +               foreach ($tables as $table) {
1366 +                       db_execute("DROP TABLE IF EXISTS `" . $table['table'] . "`;");
1367 +               }
1368 +               db_execute("DELETE FROM plugin_db_changes where plugin = '$plugin' AND method ='create'", false);
1369 +       }
1370 +       $columns = db_fetch_assoc("SELECT `table`, `column` FROM plugin_db_changes WHERE plugin = '$plugin' AND method ='addcolumn'", false);
1371 +       if (count($columns)) {
1372 +               foreach ($columns as $column) {
1373 +                       db_execute('ALTER TABLE `' . $column['table'] . '` DROP `' . $column['column'] . '`');
1374 +               }
1375 +               db_execute("DELETE FROM plugin_db_changes where plugin = '$plugin' AND method = 'addcolumn'", false);
1376 +       }
1377 +}
1378 +
1379 +function api_plugin_db_add_column ($plugin, $table, $column) {
1380 +       // Example: api_plugin_db_add_column ('thold', 'plugin_config', array('name' => 'test' . rand(1, 200), 'type' => 'varchar (255)', 'NULL' => false));
1381 +
1382 +       global $config, $database_default;
1383 +       include_once($config['library_path'] . '/database.php');
1384 +
1385 +       $result = db_fetch_assoc('show columns from `' . $table . '`') or die (mysql_error());
1386 +       $columns = array();
1387 +       foreach($result as $index => $arr) {
1388 +               foreach ($arr as $t) {
1389 +                       $columns[] = $t;
1390 +               }
1391 +       }
1392 +       if (isset($column['name']) && !in_array($column['name'], $columns)) {
1393 +               $sql = 'ALTER TABLE `' . $table . '` ADD `' . $column['name'] . '`';
1394 +               if (isset($column['type']))
1395 +                       $sql .= ' ' . $column['type'];
1396 +               if (isset($column['unsigned']))
1397 +                       $sql .= ' unsigned';
1398 +               if (isset($column['NULL']) && $column['NULL'] == false)
1399 +                       $sql .= ' NOT NULL';
1400 +               if (isset($column['NULL']) && $column['NULL'] == true && !isset($column['default']))
1401 +                       $sql .= ' default NULL';
1402 +               if (isset($column['default']))
1403 +                       $sql .= ' default ' . (is_numeric($column['default']) ? $column['default'] : "'" . $column['default'] . "'");
1404 +               if (isset($column['auto_increment']))
1405 +                       $sql .= ' auto_increment';
1406 +               if (isset($column['after']))
1407 +                       $sql .= ' AFTER ' . $column['after'];
1408 +
1409 +               if (db_execute($sql)) {
1410 +                       db_execute("INSERT INTO plugin_db_changes (plugin, `table`, `column`, `method`) VALUES ('$plugin', '$table', '" . $column['name'] . "', 'addcolumn')");
1411 +               }
1412 +       }
1413 +}
1414 +
1415 +function api_plugin_install ($plugin) {
1416 +       global $config;
1417 +       include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1418 +
1419 +       $exists = db_fetch_assoc("SELECT id FROM plugin_config WHERE directory = '$plugin'", false);
1420 +       if (sizeof($exists)) {
1421 +               db_execute("DELETE FROM plugin_config WHERE directory = '$plugin'");
1422 +       }
1423 +
1424 +       $name = $author = $webpage = $version = '';
1425 +       $function = 'plugin_' . $plugin . '_version';
1426 +       if (function_exists($function)){
1427 +               $info = $function();
1428 +               $name = $info['longname'];
1429 +               if (isset($info['homepage'])) {
1430 +                       $webpage = $info['homepage'];
1431 +               }elseif (isset($info['webpage'])) {
1432 +                       $webpage = $info['webpage'];
1433 +               }else{
1434 +                       $webpage = "Not Stated";
1435 +               }
1436 +               $author = $info['author'];
1437 +               $version = $info['version'];
1438 +       }
1439 +
1440 +       db_execute("INSERT INTO plugin_config (directory, name, author, webpage, version) VALUES ('$plugin', '$name', '$author', '$webpage', '$version')");
1441 +
1442 +       $function = 'plugin_' . $plugin . '_install';
1443 +       if (function_exists($function)){
1444 +               $function();
1445 +               $ready = api_plugin_check_config ($plugin);
1446 +               if ($ready) {
1447 +                       // Set the plugin as "disabled" so it can go live
1448 +                       db_execute("UPDATE plugin_config SET status = 4 WHERE directory = '$plugin'");
1449 +               } else {
1450 +                       // Set the plugin as "needs configuration"
1451 +                       db_execute("UPDATE plugin_config SET status = 2 WHERE directory = '$plugin'");
1452 +               }
1453 +       }
1454 +}
1455 +
1456 +function api_plugin_uninstall ($plugin) {
1457 +       global $config;
1458 +       include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1459 +       // Run the Plugin's Uninstall Function first
1460 +       $function = 'plugin_' . $plugin . '_uninstall';
1461 +       if (function_exists($function)) {
1462 +               $function();
1463 +       }
1464 +       api_plugin_remove_hooks ($plugin);
1465 +       api_plugin_remove_realms ($plugin);
1466 +       db_execute("DELETE FROM plugin_config WHERE directory = '$plugin'");
1467 +       api_plugin_db_changes_remove ($plugin);
1468 +}
1469 +
1470 +function api_plugin_check_config ($plugin) {
1471 +       global $config;
1472 +       include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1473 +       $function = 'plugin_' . $plugin . '_check_config';
1474 +       if (function_exists($function)) {
1475 +               return $function();
1476 +       }
1477 +       return TRUE;
1478 +}
1479 +
1480 +function api_plugin_enable ($plugin) {
1481 +       $ready = api_plugin_check_config ($plugin);
1482 +       if ($ready) {
1483 +               api_plugin_enable_hooks ($plugin);
1484 +               db_execute("UPDATE plugin_config SET status = 1 WHERE directory = '$plugin'");
1485 +       }
1486 +}
1487 +
1488 +function api_plugin_is_enabled ($plugin) {
1489 +       $status = db_fetch_cell("SELECT status FROM plugin_config WHERE directory = '$plugin'", false);
1490 +       if ($status == '1')
1491 +               return true;
1492 +       return false;
1493 +}
1494 +
1495 +function api_plugin_disable ($plugin) {
1496 +       api_plugin_disable_hooks ($plugin);
1497 +       db_execute("UPDATE plugin_config SET status = 4 WHERE directory = '$plugin'");
1498 +}
1499 +
1500 +function api_plugin_moveup($plugin) {
1501 +       global $plugins_system;
1502 +
1503 +       $sql_where = "";
1504 +       if (sizeof($plugins_system)) {
1505 +               foreach($plugins_system as $s) {
1506 +                       $sql_where .= (strlen($sql_where) ? " AND ":"(") . " directory!='$s'";
1507 +               }
1508 +
1509 +               $sql_where .= ")";
1510 +       }
1511 +
1512 +       $id = db_fetch_cell("SELECT id FROM plugin_config WHERE directory='$plugin'" . (strlen($sql_where) ? " AND " . $sql_where:""));
1513 +       $temp_id = db_fetch_cell("SELECT MAX(id) FROM plugin_config")+1;
1514 +       $prior_id = db_fetch_cell("SELECT MAX(id) FROM plugin_config WHERE id<$id" . (strlen($sql_where) ? " AND " . $sql_where:""));
1515 +
1516 +       /* update the above plugin to the prior temp id */
1517 +       db_execute("UPDATE plugin_config SET id=$temp_id WHERE id=$prior_id");
1518 +       db_execute("UPDATE plugin_config SET id=$prior_id WHERE id=$id");
1519 +       db_execute("UPDATE plugin_config SET id=$id WHERE id=$temp_id");
1520 +}
1521 +
1522 +function api_plugin_movedown($plugin) {
1523 +       global $plugins_system;
1524 +
1525 +       $sql_where = "";
1526 +       if (sizeof($plugins_system)) {
1527 +               foreach($plugins_system as $s) {
1528 +                       $sql_where .= (strlen($sql_where) ? " AND ":"(") . " directory!='$s'";
1529 +               }
1530 +
1531 +               $sql_where .= ")";
1532 +       }
1533 +
1534 +       $id = db_fetch_cell("SELECT id FROM plugin_config WHERE directory='$plugin'" . (strlen($sql_where) ? " AND " . $sql_where:""));
1535 +       $temp_id = db_fetch_cell("SELECT MAX(id) FROM plugin_config")+1;
1536 +       $next_id = db_fetch_cell("SELECT MIN(id) FROM plugin_config WHERE id>$id" . (strlen($sql_where) ? " AND " . $sql_where:""));
1537 +
1538 +       /* update the above plugin to the prior temp id */
1539 +       db_execute("UPDATE plugin_config SET id=$temp_id WHERE id=$next_id");
1540 +       db_execute("UPDATE plugin_config SET id=$next_id WHERE id=$id");
1541 +       db_execute("UPDATE plugin_config SET id=$id WHERE id=$temp_id");
1542 +}
1543 +
1544 +function api_plugin_register_hook ($plugin, $hook, $function, $file) {
1545 +       $exists = db_fetch_assoc("SELECT id FROM plugin_hooks WHERE name = '$plugin' AND hook = '$hook'", false);
1546 +       if (!count($exists)) {
1547 +               $settings = array('config_settings', 'config_arrays', 'config_form');
1548 +               if (!in_array($hook, $settings)) {
1549 +                       db_execute("INSERT INTO plugin_hooks (name, hook, function, file) VALUES ('$plugin', '$hook', '$function', '$file')");
1550 +               } else {
1551 +                       db_execute("INSERT INTO plugin_hooks (name, hook, function, file, status) VALUES ('$plugin', '$hook', '$function', '$file', 1)");
1552 +               }
1553 +       }
1554 +}
1555 +
1556 +function api_plugin_remove_hooks ($plugin) {
1557 +       db_execute("DELETE FROM plugin_hooks WHERE name = '$plugin'");
1558 +}
1559 +
1560 +function api_plugin_enable_hooks ($plugin) {
1561 +       db_execute("UPDATE plugin_hooks SET status = 1 WHERE name = '$plugin'");
1562 +}
1563 +
1564 +function api_plugin_disable_hooks ($plugin) {
1565 +       db_execute("UPDATE plugin_hooks SET status = 0 WHERE name = '$plugin' AND hook != 'config_settings' AND hook != 'config_arrays' AND hook != 'config_form'");
1566 +}
1567 +
1568 +function api_plugin_register_realm ($plugin, $file, $display, $admin = false) {
1569 +       $exists = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin' AND file = '$file'", false);
1570 +       if (!count($exists)) {
1571 +               db_execute("INSERT INTO plugin_realms (plugin, file, display) VALUES ('$plugin', '$file', '$display')");
1572 +               if ($admin) {
1573 +                       $realm_id = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin' AND file = '$file'", false);
1574 +                       $realm_id = $realm_id[0]['id'] + 100;
1575 +                       $user_id = db_fetch_assoc("SELECT id FROM user_auth WHERE username = 'admin'", false);
1576 +                       if (count($user_id)) {
1577 +                               $user_id = $user_id[0]['id'];
1578 +                               $exists = db_fetch_assoc("SELECT realm_id FROM user_auth_realm WHERE user_id = $user_id and realm_id = $realm_id", false);
1579 +                               if (!count($exists)) {
1580 +                                       db_execute("INSERT INTO user_auth_realm (user_id, realm_id) VALUES ($user_id, $realm_id)");
1581 +                               }
1582 +                       }
1583 +               }
1584 +       }
1585 +}
1586 +
1587 +function api_plugin_remove_realms ($plugin) {
1588 +       $realms = db_fetch_assoc("SELECT id FROM plugin_realms WHERE plugin = '$plugin'", false);
1589 +       foreach ($realms as $realm) {
1590 +               $id = $realm['id'] + 100;
1591 +               db_execute("DELETE FROM user_auth_realm WHERE realm_id = '$id'");
1592 +       }
1593 +       db_execute("DELETE FROM plugin_realms WHERE plugin = '$plugin'");
1594 +}
1595 +
1596 +function api_plugin_load_realms () {
1597 +       global $user_auth_realms, $user_auth_realm_filenames;
1598 +       $plugin_realms = db_fetch_assoc("SELECT * FROM plugin_realms ORDER BY plugin, display", false);
1599 +       if (count($plugin_realms)) {
1600 +               foreach ($plugin_realms as $plugin_realm) {
1601 +                       $plugin_files = explode(',', $plugin_realm['file']);
1602 +                       foreach($plugin_files as $plugin_file) {
1603 +                               $user_auth_realm_filenames[$plugin_file] = $plugin_realm['id'] + 100;
1604 +                       }
1605 +                       $user_auth_realms[$plugin_realm['id'] + 100] = $plugin_realm['display'];
1606 +               }
1607 +       }
1608 +}
1609 +
1610 +function api_plugin_user_realm_auth ($filename = '') {
1611 +       global $user_realms, $user_auth_realms, $user_auth_realm_filenames;
1612 +       /* list all realms that this user has access to */
1613 +       if (!isset($user_realms)) {
1614 +               if (read_config_option('global_auth') == 'on' || read_config_option('auth_method') != 0) {
1615 +                       $user_realms = db_fetch_assoc("select realm_id from user_auth_realm where user_id=" . $_SESSION["sess_user_id"], false);
1616 +                       $user_realms = array_rekey($user_realms, "realm_id", "realm_id");
1617 +               }else{
1618 +                       $user_realms = $user_auth_realms;
1619 +               }
1620 +       }
1621 +       if ($filename != '') {
1622 +               if (isset($user_realms[$user_auth_realm_filenames{basename($filename)}]))
1623 +                       return TRUE;
1624 +       }
1625 +       return FALSE;
1626 +}
1627 +
1628 +function plugin_config_arrays () {
1629 +       global $menu;
1630 +       $menu['Configuration']['plugins.php'] = 'Plugin Management';
1631 +       api_plugin_load_realms ();
1632 +}
1633 +
1634 +function plugin_draw_navigation_text ($nav) {
1635 +       $nav["plugins.php:"] = array("title" => "Plugin Management", "mapping" => "index.php:", "url" => "plugins.php", "level" => "1");
1636 +       return $nav;
1637 +}
1638 +
1639 +
1640 +
1641 +
1642 +
1643 +
1644 +
1645 diff -Naur cacti-0.8.7g-old/lib/poller.php cacti-0.8.7g/lib/poller.php
1646 --- cacti-0.8.7g-old/lib/poller.php     2010-07-09 18:33:46.000000000 -0400
1647 +++ cacti-0.8.7g/lib/poller.php 2010-07-09 18:34:11.000000000 -0400
1648 @@ -344,8 +344,11 @@
1649                                 }
1650                         }
1651                 }
1652 +               api_plugin_hook_function('poller_output', $rrd_update_array);
1653  
1654 -               $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
1655 +               if (api_plugin_hook_function('poller_on_demand', $results)) {
1656 +                       $rrds_processed = rrdtool_function_update($rrd_update_array, $rrdtool_pipe);
1657 +               }
1658         }
1659  
1660         return $rrds_processed;
1661 diff -Naur cacti-0.8.7g-old/lib/rrd.php cacti-0.8.7g/lib/rrd.php
1662 --- cacti-0.8.7g-old/lib/rrd.php        2010-07-09 18:33:46.000000000 -0400
1663 +++ cacti-0.8.7g/lib/rrd.php    2010-07-09 18:34:11.000000000 -0400
1664 @@ -419,6 +419,9 @@
1665  
1666         $data_source_path = get_data_source_path($local_data_id, true);
1667  
1668 +       /* update the rrdfile if performing a fetch */
1669 +       api_plugin_hook_function('rrdtool_function_fetch_cache_check', $local_data_id);
1670 +
1671         /* build and run the rrdtool fetch command with all of our data */
1672         $cmd_line = "fetch $data_source_path AVERAGE -s $start_time -e $end_time";
1673         if ($resolution > 0) {
1674 @@ -539,6 +542,10 @@
1675                 }
1676         }
1677  
1678 +       $data = api_plugin_hook_function('rrdtool_function_graph_cache_check', array('local_graph_id' => $local_graph_id,'rra_id' => $rra_id,'rrd_struc' => $rrdtool_pipe,'graph_data_array' => $graph_data_array, 'return' => false));
1679 +       if (isset($data['return']) && $data['return'] != false)
1680 +               return $data['return'];
1681 +
1682         /* find the step and how often this graph is updated with new data */
1683         $ds_step = db_fetch_cell("select
1684                 data_template_data.rrd_step
1685 @@ -1376,6 +1383,13 @@
1686         }
1687         }
1688  
1689 +       $graph_array = api_plugin_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));
1690 +       if (!empty($graph_array)) {
1691 +               $graph_defs = $graph_array['graph_defs'];
1692 +               $txt_graph_items = $graph_array['txt_graph_items'];
1693 +               $graph_opts = $graph_array['graph_opts'];
1694 +       }
1695 +
1696         /* either print out the source or pass the source onto rrdtool to get us a nice PNG */
1697         if (isset($graph_data_array["print_source"])) {
1698                 print "<PRE>" . htmlspecialchars(read_config_option("path_rrdtool") . " graph " . $graph_opts . $graph_defs . $txt_graph_items) . "</PRE>";
1699 @@ -1384,13 +1398,19 @@
1700                         @rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrdtool_pipe);
1701                         return 0;
1702                 }else{
1703 +                       $graph_data_array = api_plugin_hook_function('prep_graph_array', $graph_data_array);
1704 +
1705                         if (isset($graph_data_array["output_flag"])) {
1706                                 $output_flag = $graph_data_array["output_flag"];
1707                         }else{
1708                                 $output_flag = RRDTOOL_OUTPUT_GRAPH_DATA;
1709                         }
1710  
1711 -                       return @rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrdtool_pipe);
1712 +                       $output = @rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrdtool_pipe);
1713 +
1714 +                       api_plugin_hook_function('rrdtool_function_graph_set_file', array('output' => $output, 'local_graph_id' => $local_graph_id, 'rra_id' => $rra_id));
1715 +
1716 +                       return $output;
1717                 }
1718         }
1719  }
1720 diff -Naur cacti-0.8.7g-old/lib/variables.php cacti-0.8.7g/lib/variables.php
1721 --- cacti-0.8.7g-old/lib/variables.php  2010-07-09 18:33:46.000000000 -0400
1722 +++ cacti-0.8.7g/lib/variables.php      2010-07-09 18:34:11.000000000 -0400
1723 @@ -183,6 +183,9 @@
1724         $string = str_replace($l_escape_string . "host_max_oids" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["max_oids"], $string);
1725         $string = str_replace($l_escape_string . "host_id" . $r_escape_string, $_SESSION["sess_host_cache_array"][$host_id]["id"], $string);
1726  
1727 +       $temp = api_plugin_hook_function('substitute_host_data', array('string' => $string, 'l_escape_string' => $l_escape_string, 'r_escape_string' => $r_escape_string, 'host_id' => $host_id));
1728 +       $string = $temp['string'];
1729 +
1730         return $string;
1731  }
1732  
1733 diff -Naur cacti-0.8.7g-old/plugins/index.php cacti-0.8.7g/plugins/index.php
1734 --- cacti-0.8.7g-old/plugins/index.php  1969-12-31 19:00:00.000000000 -0500
1735 +++ cacti-0.8.7g/plugins/index.php      2010-07-09 18:34:11.000000000 -0400
1736 @@ -0,0 +1,5 @@
1737 +<?php
1738 +
1739 +header("Location:../index.php");
1740 +
1741 +?>
1742 diff -Naur cacti-0.8.7g-old/plugins.php cacti-0.8.7g/plugins.php
1743 --- cacti-0.8.7g-old/plugins.php        1969-12-31 19:00:00.000000000 -0500
1744 +++ cacti-0.8.7g/plugins.php    2010-07-09 18:34:11.000000000 -0400
1745 @@ -0,0 +1,647 @@
1746 +<?php
1747 +/*
1748 + +-------------------------------------------------------------------------+
1749 + | Copyright (C) 2004-2010 The Cacti Group                                 |
1750 + |                                                                         |
1751 + | This program is free software; you can redistribute it and/or           |
1752 + | modify it under the terms of the GNU General Public License             |
1753 + | as published by the Free Software Foundation; either version 2          |
1754 + | of the License, or (at your option) any later version.                  |
1755 + |                                                                         |
1756 + | This program is distributed in the hope that it will be useful,         |
1757 + | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
1758 + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
1759 + | GNU General Public License for more details.                            |
1760 + +-------------------------------------------------------------------------+
1761 + | Cacti: The Complete RRDTool-based Graphing Solution                     |
1762 + +-------------------------------------------------------------------------+
1763 + | This code is designed, written, and maintained by the Cacti Group. See  |
1764 + | about.php and/or the AUTHORS file for specific developer information.   |
1765 + +-------------------------------------------------------------------------+
1766 + | http://www.cacti.net/                                                   |
1767 + +-------------------------------------------------------------------------+
1768 +*/
1769 +
1770 +include("./include/auth.php");
1771 +
1772 +define("MAX_DISPLAY_PAGES", 21);
1773 +
1774 +$actions = array("install" => "Install",
1775 +       "enable" => "Enable",
1776 +       "disable" => "Disable",
1777 +       "uninstall" => "Uninstall",
1778 +//     "check" => "Check"
1779 +);
1780 +
1781 +$status_names = array(
1782 +       -2 => 'Disabled',
1783 +       -1 => 'Active',
1784 +       0 => 'Not Installed',
1785 +       1 => 'Active',
1786 +       2 => 'Awaiting Configuration',
1787 +       3 => 'Awaiting Upgrade',
1788 +       4 => 'Installed'
1789 +);
1790 +
1791 +/* get the comprehensive list of plugins */
1792 +$pluginslist = retrieve_plugin_list();
1793 +
1794 +/* Check to see if we are installing, etc... */
1795 +$modes = array('installold', 'uninstallold', 'install', 'uninstall', 'disable', 'enable', 'check', 'moveup', 'movedown');
1796 +
1797 +if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)  && isset($_GET['id'])) {
1798 +       input_validate_input_regex(get_request_var("id"), "^([a-zA-Z0-9]+)$");
1799 +
1800 +       $mode = $_GET['mode'];
1801 +       $id   = sanitize_search_string($_GET['id']);
1802 +
1803 +       switch ($mode) {
1804 +               case 'installold':
1805 +                       api_plugin_install_old($id);
1806 +                       header("Location: plugins.php");
1807 +                       exit;
1808 +                       break;
1809 +               case 'uninstallold':
1810 +                       api_plugin_uninstall_old($id);
1811 +                       header("Location: plugins.php");
1812 +                       exit;
1813 +                       break;
1814 +               case 'install':
1815 +                       api_plugin_install($id);
1816 +                       header("Location: plugins.php");
1817 +                       exit;
1818 +                       break;
1819 +               case 'uninstall':
1820 +                       if (!in_array($id, $pluginslist)) break;
1821 +                       api_plugin_uninstall($id);
1822 +                       header("Location: plugins.php");
1823 +                       exit;
1824 +                       break;
1825 +               case 'disable':
1826 +                       if (!in_array($id, $pluginslist)) break;
1827 +                       api_plugin_disable($id);
1828 +                       header("Location: plugins.php");
1829 +                       exit;
1830 +                       break;
1831 +               case 'enable':
1832 +                       if (!in_array($id, $pluginslist)) break;
1833 +                       api_plugin_enable($id);
1834 +                       header("Location: plugins.php");
1835 +                       exit;
1836 +                       break;
1837 +               case 'check':
1838 +                       if (!in_array($id, $pluginslist)) break;
1839 +                       break;
1840 +               case 'moveup':
1841 +                       if (!in_array($id, $pluginslist)) break;
1842 +                       if (is_system_plugin($id)) break;
1843 +                       api_plugin_moveup($id);
1844 +                       header("Location: plugins.php");
1845 +                       exit;
1846 +                       break;
1847 +               case 'movedown':
1848 +                       if (!in_array($id, $pluginslist)) break;
1849 +                       if (is_system_plugin($id)) break;
1850 +                       api_plugin_movedown($id);
1851 +                       header("Location: plugins.php");
1852 +                       exit;
1853 +                       break;
1854 +       }
1855 +}
1856 +
1857 +function retrieve_plugin_list () {
1858 +       $pluginslist = array();
1859 +       $temp = db_fetch_assoc('SELECT directory FROM plugin_config ORDER BY name');
1860 +       foreach ($temp as $t) {
1861 +               $pluginslist[] = $t['directory'];
1862 +       }
1863 +       return $pluginslist;
1864 +}
1865 +
1866 +include("./include/top_header.php");
1867 +
1868 +update_show_current();
1869 +
1870 +include("./include/bottom_footer.php");
1871 +
1872 +
1873 +function api_plugin_install_old ($plugin) {
1874 +       global $config;
1875 +       if (!file_exists($config['base_path'] . "/plugins/$plugin/setup.php")) {
1876 +               return false;
1877 +       }
1878 +       $oldplugins = read_config_option('oldplugins');
1879 +       $oldplugins = explode(',', $oldplugins);
1880 +       if (!in_array($plugin, $oldplugins)) {
1881 +               include_once($config['base_path'] . "/plugins/$plugin/setup.php");
1882 +               $function = 'plugin_init_' . $plugin;
1883 +               if (function_exists($function)){
1884 +                       $oldplugins[] = $plugin;
1885 +                       $oldplugins = implode(',', $oldplugins);
1886 +                       set_config_option('oldplugins', $oldplugins);
1887 +                       unset($_SESSION['sess_config_array']['oldplugins']);
1888 +                       return true;
1889 +               } else {
1890 +                       return false;
1891 +               }
1892 +       }
1893 +       return false;
1894 +}
1895 +
1896 +function api_plugin_uninstall_old ($plugin) {
1897 +       global $config;
1898 +       $oldplugins = read_config_option('oldplugins');
1899 +       $oldplugins = explode(',', $oldplugins);
1900 +       if (!empty($oldplugins)) {
1901 +               if (in_array($plugin, $oldplugins)) {
1902 +                       for ($a = 0; $a < count($oldplugins); $a++) {
1903 +                               if ($oldplugins[$a] == $plugin) {
1904 +                                       unset($oldplugins[$a]);
1905 +                                       break;
1906 +                               }
1907 +                       }
1908 +                       $oldplugins = implode(',', $oldplugins);
1909 +                       set_config_option('oldplugins', $oldplugins);
1910 +                       unset($_SESSION['sess_config_array']['oldplugins']);
1911 +                       return true;
1912 +               }
1913 +       }
1914 +       return false;
1915 +}
1916 +
1917 +function update_show_updates () {
1918 +       global $pluginslist, $colors, $config, $plugin_architecture;
1919 +
1920 +       $cinfo = array();
1921 +       sort($pluginslist);
1922 +
1923 +       $cinfo = update_get_plugin_info ();
1924 +
1925 +       $x = 0;
1926 +
1927 +       $info = update_get_cached_plugin_info();
1928 +
1929 +       $cactinew = update_check_if_newer($cinfo['cacti']['version'], $info['cacti']['version']) ;
1930 +       if (isset($cinfo['cacti_plugin_arch']['version'])) {
1931 +               $archnew =  update_check_if_newer($cinfo['cacti_plugin_arch']['version'], $info['cacti_plugin_arch']['version']);
1932 +       } else {
1933 +               $archnew = 0;
1934 +       }
1935 +
1936 +       if ($cactinew) {
1937 +               $x++;
1938 +               print "<tr><td width='25%' valign=top><table width='100%'>";
1939 +               html_header(array("Cacti"), 2);
1940 +               form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1941 +               print "<td width='25%'><strong>Version:</strong></td><td>" . $config["cacti_version"] . "</td></tr>";
1942 +               form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1943 +               print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info['cacti']['changes']) . "</td></tr></table>";
1944 +       }
1945 +       if (isset($plugin_architecture['version']) && $archnew) {
1946 +               $x++;
1947 +               print "<table width='100%'>";
1948 +               html_header(array("Plugin Architecture"), 2);
1949 +               form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1950 +               print "<td width='25%'><strong>Version:</strong></td><td>" . $plugin_architecture['version'] . "</td>";
1951 +               form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1952 +               print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info['cacti_plugin_arch']['changes']) . "</td></tr></table>";
1953 +       }
1954 +       print "<table width='100%' cellspacing=0 cellpadding=3>";
1955 +
1956 +       foreach ($pluginslist as $plugin) {
1957 +               if (isset($cinfo[$plugin]) && update_check_if_newer($cinfo[$plugin]['version'], $info[$plugin]['version'])) {
1958 +                       $x++;
1959 +                       print "<table width='100%'>";
1960 +                       html_header(array((isset($cinfo[$plugin]['longname']) ? $cinfo[$plugin]['longname'] : $plugin)), 2);
1961 +                       form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1962 +                       print "<td width='50%'><strong>Directory:</strong></td><td>$plugin</td>";
1963 +                       form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1964 +                       print "<td><strong>Version:</strong></td><td>" . $info[$plugin]['version'] . "</td>";
1965 +                       form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1966 +                       print "<td><strong>Author:</strong></td><td>" . (isset($cinfo[$plugin]['author']) && $cinfo[$plugin]['author'] != '' ? (isset($cinfo[$plugin]['email']) && $cinfo[$plugin]['email'] != '' ? "<a href='mailto:" . $cinfo[$plugin]['email'] . "'>" . $cinfo[$plugin]['author'] . "</a>"  : $cinfo[$plugin]['author']) : "") . "</td>";
1967 +                       form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1968 +                       print "<td><strong>Home Page:</strong></td><td>" . (isset($cinfo[$plugin]['webpage']) && $cinfo[$plugin]['webpage'] != '' ? "<a href='" . $cinfo[$plugin]['webpage'] . "'>" . $cinfo[$plugin]['webpage'] . "</a>" : "") . "</td>";
1969 +                       form_alternate_row_color($colors["alternate"],$colors["light"], 0);
1970 +                       print "<td valign=top><strong>Changes:</strong></td><td>" . str_replace("\n", '<br>', $info[$plugin]['changes']) . "</td>";
1971 +
1972 +                       print "</tr></table>";
1973 +               }
1974 +       }
1975 +       if ($x == 0)
1976 +               print "<br><center><b>There are currently no Updates!</b></center><br>";
1977 +       print "</table>";
1978 +       html_end_box(TRUE);
1979 +}
1980 +
1981 +function update_check_if_newer() {
1982 +       return false;
1983 +}
1984 +
1985 +function plugins_temp_table_exists($table) {
1986 +       return sizeof(db_fetch_row("SHOW TABLES LIKE '$table'"));
1987 +}
1988 +
1989 +function plugins_load_temp_table() {
1990 +       global $config, $plugins;
1991 +
1992 +       $pluginslist = retrieve_plugin_list();
1993 +
1994 +       if (isset($_SESSION["plugin_temp_table"])) {
1995 +               $table = $_SESSION["plugin_temp_table"];
1996 +       }else{
1997 +               $table = "plugin_temp_table_" . rand();
1998 +       }
1999 +
2000 +       while (true) {
2001 +               if (!plugins_temp_table_exists($table)) {
2002 +                       $_SESSION["plugin_temp_table"] = $table;
2003 +                       db_execute("CREATE TEMPORARY TABLE $table LIKE plugin_config");
2004 +                       db_execute("INSERT INTO $table SELECT * FROM plugin_config");
2005 +                       break;
2006 +               }else{
2007 +                       $table = "plugin_temp_table_" . rand();
2008 +               }
2009 +       }
2010 +
2011 +       $path = $config['base_path'] . '/plugins/';
2012 +       $dh = opendir($path);
2013 +       while (($file = readdir($dh)) !== false) {
2014 +               if ((is_dir("$path/$file")) && (file_exists("$path/$file/setup.php")) && (!in_array($file, $pluginslist))) {
2015 +                       if (!function_exists('plugin_' . $file . '_install')) {
2016 +                               include_once("$path/$file/setup.php");
2017 +                               if (!function_exists('plugin_' . $file . '_install') && function_exists($file . '_version')) {
2018 +                                       $function = $file . '_version';
2019 +                                       $cinfo[$file] = $function();
2020 +                                       if (!isset($cinfo[$file]['author'])) $cinfo[$file]['author'] = 'Unknown';
2021 +                                       if (!isset($cinfo[$file]['homepage'])) $cinfo[$file]['homepage'] = 'Not Stated';
2022 +                                       if (isset($cinfo[$file]['webpage'])) $cinfo[$file]['homepage'] = $cinfo[$file]['webpage'];
2023 +                                       if (!isset($cinfo[$file]['longname'])) $cinfo[$file]['longname'] = ucfirst($file);
2024 +                                       $cinfo[$file]['status'] = -2;
2025 +                                       if (in_array($file, $plugins)) {
2026 +                                               $cinfo[$file]['status'] = -1;
2027 +                                       }
2028 +                                       db_execute("REPLACE INTO $table (directory, name, status, author, webpage, version)
2029 +                                               VALUES ('" .
2030 +                                                       $file . "', '" .
2031 +                                                       $cinfo[$file]['longname'] . "', '" .
2032 +                                                       $cinfo[$file]['status'] . "', '" .
2033 +                                                       $cinfo[$file]['author'] . "', '" .
2034 +                                                       $cinfo[$file]['homepage'] . "', '" .
2035 +                                                       $cinfo[$file]['version'] . "')");
2036 +                                       $pluginslist[] = $file;
2037 +                               } else if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) {
2038 +                                       $function = $file . '_version';
2039 +                                       $cinfo[$file] = $function();
2040 +                                       $cinfo[$file]['status'] = 0;
2041 +                                       if (!isset($cinfo[$file]['author'])) $cinfo[$file]['author'] = 'Unknown';
2042 +                                       if (!isset($cinfo[$file]['homepage'])) $cinfo[$file]['homepage'] = 'Not Stated';
2043 +                                       if (isset($cinfo[$file]['webpage'])) $cinfo[$file]['homepage'] = $cinfo[$file]['webpage'];
2044 +                                       if (!isset($cinfo[$file]['longname'])) $cinfo[$file]['homepage'] = ucfirst($file);
2045 +                                       db_execute("REPLACE INTO $table (directory, name, status, author, webpage, version)
2046 +                                               VALUES ('" .
2047 +                                                       $file . "', '" .
2048 +                                                       $cinfo[$file]['longname'] . "', '" .
2049 +                                                       $cinfo[$file]['status'] . "', '" .
2050 +                                                       $cinfo[$file]['author'] . "', '" .
2051 +                                                       $cinfo[$file]['homepage'] . "', '" .
2052 +                                                       $cinfo[$file]['version'] . "')");
2053 +                                       $pluginslist[] = $file;
2054 +                               }
2055 +                       }else{
2056 +                               cacti_log("WARNING: Install function already exists for plugin directory '$file'", false);
2057 +                       }
2058 +               }
2059 +       }
2060 +       closedir($dh);
2061 +
2062 +       return $table;
2063 +}
2064 +
2065 +function update_show_current () {
2066 +       global $plugins, $pluginslist, $colors, $plugin_architecture, $config, $status_names, $actions;
2067 +
2068 +       /* ================= input validation ================= */
2069 +       input_validate_input_number(get_request_var_request("page"));
2070 +       /* ==================================================== */
2071 +
2072 +       /* clean up search string */
2073 +       if (isset($_REQUEST["filter"])) {
2074 +               $_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
2075 +       }
2076 +
2077 +       /* clean up sort_column */
2078 +       if (isset($_REQUEST["sort_column"])) {
2079 +               $_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
2080 +       }
2081 +
2082 +       /* clean up search string */
2083 +       if (isset($_REQUEST["sort_direction"])) {
2084 +               $_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
2085 +       }
2086 +
2087 +       /* if the user pushed the 'clear' button */
2088 +       if (isset($_REQUEST["clear_x"])) {
2089 +               kill_session_var("sess_plugins_filter");
2090 +               kill_session_var("sess_plugins_sort_column");
2091 +               kill_session_var("sess_plugins_sort_direction");
2092 +
2093 +               unset($_REQUEST["page"]);
2094 +               unset($_REQUEST["filter"]);
2095 +               unset($_REQUEST["sort_column"]);
2096 +               unset($_REQUEST["sort_direction"]);
2097 +               $_REQUEST["page"] = 1;
2098 +       }
2099 +
2100 +       /* remember these search fields in session vars so we don't have to keep passing them around */
2101 +       load_current_session_value("filter", "sess_plugins_filter", "");
2102 +       load_current_session_value("sort_column", "sess_plugins_sort_column", "name");
2103 +       load_current_session_value("sort_direction", "sess_plugins_sort_direction", "ASC");
2104 +       load_current_session_value("page", "sess_plugins_current_page", "1");
2105 +
2106 +       $table = plugins_load_temp_table();
2107 +
2108 +       html_start_box("<strong>Plugin Management</strong> (Cacti Version: " . $config["cacti_version"] .
2109 +               (isset($plugin_architecture['version']) ? ", Plugin Architecture Version: " . $plugin_architecture['version']:"") .
2110 +               ")", "100%", $colors["header"], "3", "center", "");
2111 +
2112 +       ?>
2113 +       <tr bgcolor="#<?php print $colors['panel'];?>">
2114 +               <td class="noprint">
2115 +               <form name="form_plugins" method="get" action="plugins.php">
2116 +                       <table width="100%" cellpadding="0" cellspacing="0">
2117 +                               <tr class="noprint">
2118 +                                       <td nowrap style='white-space: nowrap;' width="50">
2119 +                                               Search:&nbsp;
2120 +                                       </td>
2121 +                                       <td width="1">
2122 +                                               <input type="text" name="filter" size="40" value="<?php print get_request_var_request("filter");?>">
2123 +                                       </td>
2124 +                                       <td nowrap style='white-space: nowrap;'>
2125 +                                               &nbsp;<input type="submit" value="Go" title="Set/Refresh Filters">
2126 +                                               <input type="submit" name="clear_x" value="Clear" title="Clear Filters">
2127 +                                       </td>
2128 +                               </tr>
2129 +                       </table>
2130 +                       <input type='hidden' name='page' value='1'>
2131 +               </form>
2132 +               </td>
2133 +       </tr>
2134 +       <?php
2135 +
2136 +       html_end_box();
2137 +
2138 +       /* print checkbox form for validation */
2139 +       print "<form name='chk' method='post' action='plugins.php'>\n";
2140 +
2141 +       html_start_box("", "100%", $colors["header"], "3", "center", "");
2142 +
2143 +       /* form the 'where' clause for our main sql query */
2144 +       $sql_where = "WHERE ($table.name LIKE '%%" . get_request_var_request("filter") . "%%')";
2145 +
2146 +       if (get_request_var_request("sort_column") == "version") {
2147 +               $sortc = "version+0";
2148 +       }else{
2149 +               $sortc = get_request_var_request("sort_column");
2150 +       }
2151 +
2152 +       if (get_request_var_request("sort_column") == "id") {
2153 +               $sortd = "ASC";
2154 +       }else{
2155 +               $sortd = get_request_var_request("sort_direction");
2156 +       }
2157 +
2158 +       $total_rows = db_fetch_cell("SELECT
2159 +               count(*)
2160 +               FROM $table
2161 +               $sql_where");
2162 +
2163 +       $plugins = db_fetch_assoc("SELECT *
2164 +               FROM $table
2165 +               $sql_where
2166 +               ORDER BY " . $sortc . " " . $sortd . "
2167 +               LIMIT " . (read_config_option("num_rows_device")*(get_request_var_request("page")-1)) . "," . read_config_option("num_rows_device"));
2168 +
2169 +       db_execute("DROP TABLE $table");
2170 +
2171 +       /* generate page list */
2172 +       $url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, read_config_option("num_rows_device"), $total_rows, "plugins.php?filter=" . get_request_var_request("filter"));
2173 +
2174 +       if ($total_rows == 0) {
2175 +               $nav = "<tr bgcolor='#" . $colors["header"] . "'>
2176 +                               <td colspan='9'>
2177 +                                       <table width='100%' cellspacing='0' cellpadding='0' border='0'>
2178 +                                               <tr>
2179 +                                                       <td align='center' class='textHeaderDark'>
2180 +                                                               No Plugins Found
2181 +                                                       </td>\n
2182 +                                               </tr>
2183 +                                       </table>
2184 +                               </td>
2185 +                       </tr>\n";
2186 +       }elseif ($total_rows < read_config_option("num_rows_device")) {
2187 +               $nav = "<tr bgcolor='#" . $colors["header"] . "'>
2188 +                               <td colspan='9'>
2189 +                                       <table width='100%' cellspacing='0' cellpadding='0' border='0'>
2190 +                                               <tr>
2191 +                                                       <td align='center' class='textHeaderDark'>
2192 +                                                               Showing All $total_rows Rows
2193 +                                                       </td>\n
2194 +                                               </tr>
2195 +                                       </table>
2196 +                               </td>
2197 +                       </tr>\n";
2198 +       }else{
2199 +               $nav = "<tr bgcolor='#" . $colors["header"] . "'>
2200 +                               <td colspan='9'>
2201 +                                       <table width='100%' cellspacing='0' cellpadding='0' border='0'>
2202 +                                               <tr>
2203 +                                                       <td align='left' class='textHeaderDark'>
2204 +                                                               <strong>&lt;&lt; "; if (get_request_var_request("page") > 1) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("plugins.php?filter=" . get_request_var_request("filter") . "&page=" . (get_request_var_request("page")-1)) . "'>"; } $nav .= "Previous"; if (get_request_var_request("page") > 1) { $nav .= "</a>"; } $nav .= "</strong>
2205 +                                                       </td>\n
2206 +                                                       <td align='center' class='textHeaderDark'>
2207 +                                                               Showing Rows " . ((read_config_option("num_rows_device")*(get_request_var_request("page")-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_device")) || ($total_rows < (read_config_option("num_rows_device")*get_request_var_request("page")))) ? $total_rows : (read_config_option("num_rows_device")*get_request_var_request("page"))) . " of $total_rows [$url_page_select]
2208 +                                                       </td>\n
2209 +                                                       <td align='right' class='textHeaderDark'>
2210 +                                                               <strong>"; if ((get_request_var_request("page") * read_config_option("num_rows_device")) < $total_rows) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("plugins.php?filter=" . get_request_var_request("filter") . "&page=" . (get_request_var_request("page")+1)) . "'>"; } $nav .= "Next"; if ((get_request_var_request("page") * read_config_option("num_rows_device")) < $total_rows) { $nav .= "</a>"; } $nav .= " &gt;&gt;</strong>
2211 +                                                       </td>\n
2212 +                                               </tr>
2213 +                                       </table>
2214 +                               </td>
2215 +                       </tr>\n";
2216 +       }
2217 +
2218 +       print $nav;
2219 +
2220 +       $display_text = array(
2221 +               "nosort" => array("Actions", ""),
2222 +               "directory" => array("Name", "ASC"),
2223 +               "id" => array("Load Order", "ASC"),
2224 +               "name" => array("Description", "ASC"),
2225 +               "nosort1" => array("Type", "ASC"),
2226 +               "status" => array("Status", "ASC"),
2227 +               "author" => array("Author", "ASC"),
2228 +               "webpage" => array("Web Page", "ASC"),
2229 +               "version" => array("Version", "ASC"));
2230 +
2231 +       html_header_sort($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"), 1);
2232 +
2233 +       $i = 0;
2234 +       if (sizeof($plugins)) {
2235 +               if (get_request_var_request("sort_column") == "id") {
2236 +                       $inst_system_plugins = get_system_plugins($plugins);
2237 +                       if (sizeof($inst_system_plugins)) {
2238 +                               foreach($inst_system_plugins as $plugin) {
2239 +                                       form_alternate_row_color($colors["alternate"], $colors["light"], $i); $i++;
2240 +                                       print format_plugin_row($plugin, false, false, true);
2241 +                               }
2242 +                       }
2243 +               }
2244 +
2245 +               $j = 0;
2246 +               foreach ($plugins as $plugin) {
2247 +                       if ((isset($plugins[$j+1]) && $plugins[$j+1]['status'] < 0) || (!isset($plugins[$j+1]))) {
2248 +                               $last_plugin = true;
2249 +                       }else{
2250 +                               $last_plugin = false;
2251 +                       }
2252 +                       if ($plugin['status'] <= 0 || is_system_plugin($plugin) || (get_request_var_request('sort_column') != 'id')) {
2253 +                               $load_ordering = false;
2254 +                       }else{
2255 +                               $load_ordering = true;
2256 +                       }
2257 +
2258 +                       if (get_request_var_request("sort_column") == "id") {
2259 +                               if (!is_system_plugin($plugin)) {
2260 +                                       form_alternate_row_color($colors["alternate"], $colors["light"], $i);
2261 +                                       print format_plugin_row($plugin, $last_plugin, $load_ordering, false);
2262 +                                       $i++;
2263 +                               }
2264 +                       }else{
2265 +                               form_alternate_row_color($colors["alternate"], $colors["light"], $i);
2266 +                               print format_plugin_row($plugin, $last_plugin, $load_ordering, is_system_plugin($plugin));
2267 +                               $i++;
2268 +                       }
2269 +
2270 +                       $j++;
2271 +               }
2272 +
2273 +               print $nav;
2274 +       }else{
2275 +               print "<tr><td><em>No Plugins Found</em></td></tr>";
2276 +       }
2277 +
2278 +       html_end_box(false);
2279 +
2280 +       html_start_box("", "100%", $colors["header"], "3", "center", "");
2281 +       echo "<tr><td colspan=10><strong>NOTE:</strong> Please sort by 'Load Order' to change plugin load ordering.<br><strong>NOTE:</strong> SYSTEM plugins can not be ordered.</td></tr>";
2282 +       html_end_box();
2283 +
2284 +       print "</form>\n";
2285 +}
2286 +
2287 +function format_plugin_row($plugin, $last_plugin, $include_ordering, $system_plugin) {
2288 +       global $status_names;
2289 +       static $first_plugin = true;
2290 +
2291 +       $row = plugin_actions($plugin);
2292 +       $row .= "<td><strong>" . (strlen(get_request_var_request("filter")) ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", ucfirst($plugin["directory"])) : ucfirst($plugin["directory"])) . "</strong></td>";
2293 +       if ($include_ordering) {
2294 +               $row .= "<td style='white-space:nowrap;'>";
2295 +               if (!$first_plugin) {
2296 +                       $row .= "<a href='" . htmlspecialchars("plugins.php?mode=moveup&id=" . $plugin['directory']) . "' title='Order Before Prevous Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/move_up.gif'></a>";
2297 +               }else{
2298 +                       $row .= "<a href='#' title='Can NOT Reduce Load Order' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/view_none.gif'></a>";
2299 +               }
2300 +               if (!$last_plugin) {
2301 +                       $row .= "<a href='" . htmlspecialchars("plugins.php?mode=movedown&id=" . $plugin['directory']) . "' title='Order After Next Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/move_down.gif'></a>";
2302 +               }else{
2303 +                       $row .= "<a href='#' title='Can Increase Load Order' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/view_none.gif'></a>";
2304 +               }
2305 +               $row .= "</td>\n";
2306 +       }else{
2307 +               $row .= "<td></td>\n";
2308 +       }
2309 +
2310 +       $row .= "<td style='white-space:nowrap;'>" . (strlen(get_request_var_request("filter")) ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $plugin["name"]) : $plugin["name"]) . "</td>\n";
2311 +       $row .= "<td style='white-space:nowrap;'>" . ($system_plugin ? "System": ($plugin['status'] < 0 ? "Old PIA":"General")) . "</td>\n";
2312 +       $row .= "<td style='white-space:nowrap;'>" . $status_names[$plugin["status"]] . "</td>\n";
2313 +       $row .= "<td style='white-space:nowrap;'>" . $plugin["author"] . "</td>\n";
2314 +       $row .= "<td><a href='" . htmlspecialchars($plugin["webpage"]) . "'>" . htmlspecialchars($plugin["webpage"]) . "</a></td>\n";
2315 +       $row .= "<td>" . $plugin["version"] . "</td>\n";
2316 +       $row .= "</tr>\n";
2317 +
2318 +       if ($include_ordering) {
2319 +               $first_plugin = false;
2320 +       }
2321 +
2322 +       return $row;
2323 +}
2324 +
2325 +function plugin_actions($plugin) {
2326 +       $link = "<td>";
2327 +       switch ($plugin['status']) {
2328 +               case "-2": // Old PA Not Installed
2329 +                       $link .= "<a href='" . htmlspecialchars("plugins.php?mode=installold&id=" . $plugin['directory']) . "' title='Install Old Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/install_icon.png'></a>";
2330 +                       $link .= "<img style='padding:1px;' border='0' align='absmiddle' src='images/view_none.gif'>";
2331 +                       break;
2332 +               case "-1":      // Old PA Currently Active
2333 +                       $oldplugins = read_config_option('oldplugins');
2334 +                       $oldplugins = explode(',', $oldplugins);
2335 +                       if (in_array($plugin['directory'], $oldplugins)) {
2336 +                               $link .= "<a href='" . htmlspecialchars("plugins.php?mode=uninstallold&id=" . $plugin['directory']) . "' title='Uninstall Old Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/uninstall_icon.gif'></a>";
2337 +                       } else {
2338 +                               $link .= "<a href='#' title='Please Uninstall from config.php' class='linkEditMain'><img style='padding:1px;' align='absmiddle' border='0' src='images/install_icon_disabled.png'></a>";
2339 +                       }
2340 +                       $link .= "<img style='padding:1px;' border='0' align='absmiddle' src='images/view_none.gif'>";
2341 +                       break;
2342 +               case "0": // Not Installed
2343 +                       $link .= "<a href='" . htmlspecialchars("plugins.php?mode=install&id=" . $plugin['directory']) . "' title='Install Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/install_icon.png'></a>";
2344 +                       $link .= "<img style='padding:1px;' border='0' align='absmiddle' src='images/view_none.gif'>";
2345 +                       break;
2346 +               case "1":       // Currently Active
2347 +                       $link .= "<a href='" . htmlspecialchars("plugins.php?mode=uninstall&id=" . $plugin['directory']) . "' title='Uninstall Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/uninstall_icon.gif'></a>";
2348 +                       $link .= "<a href='" . htmlspecialchars("plugins.php?mode=disable&id=" . $plugin['directory']) . "' title='Disable Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/disable_icon.png'></a>";
2349 +                       break;
2350 +               case "4":       // Installed but not active
2351 +                       $link .= "<a href='" . htmlspecialchars("plugins.php?mode=uninstall&id=" . $plugin['directory']) . "' title='Uninstall Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/uninstall_icon.gif'></a>";
2352 +                       $link .= "<a href='" . htmlspecialchars("plugins.php?mode=enable&id=" . $plugin['directory']) . "' title='Enable Plugin' class='linkEditMain'><img style='padding:1px;' border='0' align='absmiddle' src='images/enable_icon.png'></a>";
2353 +                       break;
2354 +               default: // Old PIA
2355 +                       $link .= "<a href='#' title='Please Install/Uninstall from config.php' class='linkEditMain'><img style='padding:1px;' align='absmiddle' border='0' src='images/install_icon_disabled.png'></a>";
2356 +                       $link .= "<a href='#' title='Enabling from the UI is not supported' class='linkEditMain'><img style='padding:1px;' align='absmiddle' border='0' src='images/enable_icon_disabled.png'></a>";
2357 +                       break;
2358 +       }
2359 +       $link .= "</td>";
2360 +
2361 +       return $link;
2362 +}
2363 +
2364 +function is_system_plugin($plugin) {
2365 +       global $plugins_system;
2366 +
2367 +       if (is_array($plugin)) {
2368 +               $plugin = $plugin["directory"];
2369 +       }
2370 +
2371 +       if (!in_array($plugin, $plugins_system)) {
2372 +               return false;
2373 +       }else{
2374 +               return true;
2375 +       }
2376 +}
2377 +
2378 +function get_system_plugins($plugins) {
2379 +       $inst_system_plugins = array();
2380 +
2381 +       if (sizeof($plugins)) {
2382 +               foreach($plugins as $plugin) {
2383 +                       if (is_system_plugin($plugin)) {
2384 +                               $inst_system_plugins[] = $plugin;
2385 +                       }
2386 +               }
2387 +       }
2388 +
2389 +       return $inst_system_plugins;
2390 +}
2391 +
2392 +
2393 diff -Naur cacti-0.8.7g-old/poller.php cacti-0.8.7g/poller.php
2394 --- cacti-0.8.7g-old/poller.php 2010-07-09 18:33:46.000000000 -0400
2395 +++ cacti-0.8.7g/poller.php     2010-07-09 18:34:11.000000000 -0400
2396 @@ -108,6 +108,8 @@
2397         pcntl_signal(SIGINT, "sig_handler");
2398  }
2399  
2400 +api_plugin_hook('poller_top');
2401 +
2402  /* record the start time */
2403  list($micro,$seconds) = split(" ", microtime());
2404  $poller_start         = $seconds + $micro;
2405 @@ -304,6 +306,8 @@
2406                         $total_procs    = $concurrent_processes;
2407                 }
2408  
2409 +               $extra_args = api_plugin_hook_function ('poller_command_args', $extra_args);
2410 +
2411                 /* Populate each execution file with appropriate information */
2412                 foreach ($polling_hosts as $item) {
2413                         if ($host_count == 1) {
2414 @@ -446,9 +450,11 @@
2415  
2416                 /* sleep the appripriate amount of time */
2417                 if ($poller_runs_completed < $poller_runs) {
2418 +                       api_plugin_hook('poller_bottom');
2419                         db_close();
2420                         usleep($sleep_time * 1000000);
2421                         db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);
2422 +                       api_plugin_hook('poller_top');
2423                 }
2424         }else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM || $debug) {
2425                 cacti_log("WARNING: Cacti Polling Cycle Exceeded Poller Interval by " . $loop_end-$loop_start-$poller_interval . " seconds", TRUE, "POLLER");
2426 @@ -495,4 +501,6 @@
2427         echo "    --debug|-d     Output debug information.  Similar to cacti's DEBUG logging level.\n\n";
2428  }
2429  
2430 +api_plugin_hook('poller_bottom');
2431 +
2432  ?>
2433 diff -Naur cacti-0.8.7g-old/user_admin.php cacti-0.8.7g/user_admin.php
2434 --- cacti-0.8.7g-old/user_admin.php     2010-07-09 18:33:46.000000000 -0400
2435 +++ cacti-0.8.7g/user_admin.php 2010-07-09 18:34:11.000000000 -0400
2436 @@ -57,9 +57,11 @@
2437                 break;
2438  
2439         default:
2440 -               include_once("include/top_header.php");
2441 -               user();
2442 -               include_once("include/bottom_footer.php");
2443 +               if (!api_plugin_hook_function('user_admin_action', get_request_var_request("action"))) {
2444 +                       include_once("include/top_header.php");
2445 +                       user();
2446 +                       include_once("include/bottom_footer.php");
2447 +               }
2448                 break;
2449  }
2450  
2451 @@ -402,6 +404,7 @@
2452                 $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);
2453                 $save["realm"] = get_request_var_post("realm", 0);
2454                 $save["enabled"] = form_input_validate(get_request_var_post("enabled", ""), "enabled", "", true, 3);
2455 +               $save = api_plugin_hook_function('user_admin_setup_sql_save', $save);
2456  
2457                 if (!is_error_message()) {
2458                         $user_id = sql_save($save, "user_auth");
2459 @@ -444,6 +447,8 @@
2460                                         policy_hosts = " . get_request_var_post("policy_hosts") . ",
2461                                         policy_graph_templates = " . get_request_var_post("policy_graph_templates") . "
2462                                         WHERE id = " . get_request_var_post("id"));
2463 +                       } else {
2464 +                               api_plugin_hook('user_admin_user_save');
2465                         }
2466                 }
2467         }
2468 @@ -889,6 +894,8 @@
2469                 $header_label = "[new]";
2470         }
2471  
2472 +       api_plugin_hook_function('user_admin_edit', (isset($user) ? get_request_var("id") : 0));
2473 +
2474         html_start_box("<strong>User Management</strong> $header_label", "100%", $colors["header"], "3", "center", "");
2475  
2476         draw_edit_form(array(
2477 diff -Naur cacti-0.8.7g-old/utilities.php cacti-0.8.7g/utilities.php
2478 --- cacti-0.8.7g-old/utilities.php      2010-07-09 18:33:46.000000000 -0400
2479 +++ cacti-0.8.7g/utilities.php  2010-07-09 18:34:11.000000000 -0400
2480 @@ -123,11 +123,14 @@
2481                 include_once("./include/bottom_footer.php");
2482                 break;
2483         default:
2484 -               include_once("./include/top_header.php");
2485  
2486 -               utilities();
2487 +               if (!api_plugin_hook_function('utilities_action', $_REQUEST['action'])) {
2488 +                       include_once('./include/top_header.php');
2489  
2490 -               include_once("./include/bottom_footer.php");
2491 +                       utilities();
2492 +
2493 +                       include_once('./include/bottom_footer.php');
2494 +               }
2495                 break;
2496  }
2497  
2498 @@ -1644,6 +1647,8 @@
2499  
2500         <?php
2501  
2502 +       api_plugin_hook('utilities_list');
2503 +
2504         html_end_box();
2505  }
2506  
This page took 0.268061 seconds and 4 git commands to generate.