用过Cacti的小伙伴,一定会碰到一个很烦恼的问题,Cacti的页面并不是像我们平时那样写成静态页面,而是通过conf文件+封装的函数生成的。下面将给大家呈现Cacti页面的生成方式,方便大家做二次开发。 1.页面地址(http://xx.xx.xx.xx/cacti/user_admin?action=user_edit&id=…后面省略) /* -------------------------- User Administration -------------------------- */function user_edit() { global $colors, $fields_user_user_edit_host; /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if (!empty($_GET["id"])) { $user = db_fetch_row("SELECT * FROM user_auth WHERE id = " . get_request_var("id")); $header_label = "[edit: " . $user["username"] . "]"; }else{ $header_label = "[new]"; } api_plugin_hook_function('user_admin_edit', (isset($user) ? get_request_var("id") : 0)); html_start_box("用户管理 $header_label", "100%", $colors["header"], "3", "center", ""); draw_edit_form(array( "config" => array("form_name" => "chk"), "fields" => inject_form_variables($fields_user_user_edit_host, (isset($user) ? $user : array())) )); html_end_box(); if (!empty($_GET["id"])) { /* draw user admin nav tabs */ ?> |