diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
| commit | 28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (patch) | |
| tree | 8281ccd48964ee0dd11c5ea689091fa3cef706fb /frontends/php/graph.php | |
| parent | 495799b2aa61aab23d74d7faa110a0cd09d59bf0 (diff) | |
| download | zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.gz zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.xz zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.zip | |
- developed group permission system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3371 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/graph.php')
| -rw-r--r-- | frontends/php/graph.php | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/frontends/php/graph.php b/frontends/php/graph.php index 5f89a544..dff97582 100644 --- a/frontends/php/graph.php +++ b/frontends/php/graph.php @@ -19,12 +19,16 @@ **/ ?> <?php - include "include/config.inc.php"; - include "include/forms.inc.php"; + require_once "include/config.inc.php"; + require_once "include/items.inc.php"; + require_once "include/graphs.inc.php"; + require_once "include/forms.inc.php"; $page["title"] = "S_CONFIGURATION_OF_GRAPH"; $page["file"] = "graph.php"; - show_header($page["title"],0,0); + +include_once "include/page_header.php"; + insert_confirm_javascript(); ?> <?php @@ -54,16 +58,8 @@ check_fields($fields); ?> <?php - show_table_header(S_CONFIGURATION_OF_GRAPH_BIG); - echo BR; -?> -<?php - if(!check_right("Graph","R",$_REQUEST["graphid"])) - { - show_table_header("<font color=\"AA0000\">".S_NO_PERMISSIONS."</font>"); - show_page_footer(); - exit; - } + show_table_header(S_CONFIGURATION_OF_GRAPH_BIG, + isset($_REQUEST['form']) ? null: new CButton("cancel",S_CANCEL,"return Redirect('graphs.php');")); ?> <?php @@ -79,7 +75,7 @@ $audit= AUDIT_ACTION_UPDATE; $msg_ok = S_ITEM_UPDATED; $msg_fail =S_CANNOT_UPDATE_ITEM; - $action = "Added"; + $action = "Updated"; } else { @@ -91,7 +87,7 @@ $audit = AUDIT_ACTION_ADD; $msg_ok = S_ITEM_ADDED; $msg_fail = S_CANNOT_ADD_ITEM; - $action = "Updated"; + $action = "Added"; } if($result) { @@ -125,13 +121,20 @@ { if($_REQUEST["register"]=="up") { + $graphitem = get_graphitem_by_gitemid($gitemid); $result = move_up_graph_item($_REQUEST["gitemid"]); show_messages($result, S_SORT_ORDER_UPDATED, S_CANNOT_UPDATE_SORT_ORDER); + add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_GRAPH_ELEMENT, + "Graph ID [".$graphitem["graphid"]."] Name [".$graph["name"]."]". + " [".$item["description"]."] moved up."); unset($_REQUEST["gitemid"]); } if($_REQUEST["register"]=="down") { $result = move_down_graph_item($_REQUEST["gitemid"]); + add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_GRAPH_ELEMENT, + "Graph ID [".$graphitem["graphid"]."] Name [".$graph["name"]."]". + " [".$item["description"]."] moved down."); show_messages($result, S_SORT_ORDER_UPDATED, S_CANNOT_UPDATE_SORT_ORDER); unset($_REQUEST["gitemid"]); } @@ -139,10 +142,20 @@ ?> <?php /****** GRAPH ******/ - - $db_graphs = DBselect("select name from graphs where graphid=".$_REQUEST["graphid"]); - $db_graph = DBfetch($db_graphs); - show_table_header($db_graph["name"]);//,new CButton("cancel",S_CANCEL,"return Redirect('graphs.php');")); + $denyed_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_MODE_LT); + + if(! ($db_graph = DBfetch(DBselect("select g.name from graphs g left join graphs_items gi on gi.graphid=g.graphid ". + " left join items i on gi.itemid=i.itemid". + " where g.graphid=".$_REQUEST["graphid"]. + " and ".DBid2nodeid("g.graphid")."=".$ZBX_CURNODEID. + " and ( i.hostid not in (".$denyed_hosts.") OR i.hostid is NULL )" + ) + ))) + { + access_deny(); + } + + show_table_header($db_graph["name"]); $table = new CTable(NULL,"graph"); $table->AddRow(new CImg("chart2.php?graphid=".$_REQUEST["graphid"]."&period=3600&from=0")); @@ -165,9 +178,10 @@ $table = new CTableInfo("..."); $table->SetHeader(array(S_SORT_ORDER,S_HOST,S_PARAMETER,S_FUNCTION,S_TYPE,S_DRAW_STYLE,S_COLOR,S_ACTIONS)); - $result=DBselect("select i.itemid,h.host,i.description,gi.*,i.key_". - " from hosts h,graphs_items gi,items i where i.itemid=gi.itemid". - " and gi.graphid=".$_REQUEST["graphid"]." and h.hostid=i.hostid order by gi.sortorder desc"); + $result=DBselect("select i.itemid,h.host,i.description,gi.*,i.key_ ". + " from hosts h,graphs_items gi,items i where i.itemid=gi.itemid ". + " and gi.graphid=".$_REQUEST["graphid"]." and h.hostid=i.hostid ". + " order by gi.sortorder desc, i.description, i.itemid"); while($row=DBfetch($result)) { @@ -222,5 +236,7 @@ } ?> <?php - show_page_footer(); + +include_once "include/page_footer.php"; + ?> |
