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