summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/actions.inc.php2
-rw-r--r--frontends/php/include/blocks.inc.php79
-rw-r--r--frontends/php/include/forms.inc.php6
-rw-r--r--frontends/php/include/items.inc.php3
-rw-r--r--frontends/php/include/locales/en_gb.inc.php1
-rw-r--r--frontends/php/include/maps.inc.php6
-rw-r--r--frontends/php/include/profiles.inc.php4
-rw-r--r--frontends/php/include/screens.inc.php14
8 files changed, 89 insertions, 26 deletions
diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php
index e50b51f6..ec9f54e8 100644
--- a/frontends/php/include/actions.inc.php
+++ b/frontends/php/include/actions.inc.php
@@ -22,7 +22,7 @@ include_once 'include/discovery.inc.php';
?>
<?php
- function action_accessiable($actionid,$perm){
+ function action_accessible($actionid,$perm){
global $USER_DETAILS;
$result = false;
diff --git a/frontends/php/include/blocks.inc.php b/frontends/php/include/blocks.inc.php
index 53cec68c..f6071658 100644
--- a/frontends/php/include/blocks.inc.php
+++ b/frontends/php/include/blocks.inc.php
@@ -19,7 +19,10 @@
**/
?>
<?php
+require_once "include/graphs.inc.php";
require_once "include/screens.inc.php";
+require_once "include/maps.inc.php";
+
// Author: Aly
function make_favorite_graphs($available_hosts=false){
@@ -51,7 +54,8 @@ function make_favorite_graphs($available_hosts=false){
}
else{
if(!$graph = get_graph_by_graphid($resourceid)) continue;
-
+ if(!graph_accessible($resourceid)) continue;
+
$result = get_hosts_by_graphid($resourceid);
$ghost = DBFetch($result);
@@ -85,8 +89,9 @@ function make_favorite_screens(){
$fav_screens = get4favorites('web.favorite.screenids');
foreach($fav_screens['id'] as $key => $resourceid){
- if('slideid' == $fav_screens['resource'][$key]){
+ if('slideshowid' == $fav_screens['resource'][$key]){
if(!$slide = get_slideshow_by_slideshowid($resourceid)) continue;
+ if(!slideshow_accessible($resourceid, PERM_READ_ONLY)) continue;
$link = new CLink($slide['name'],'screens.php?config=1&elementid='.$resourceid);
$link->SetTarget('blank');
@@ -99,6 +104,7 @@ function make_favorite_screens(){
}
else{
if(!$screen = get_screen_by_screenid($resourceid)) continue;
+ if(!screen_accessible($resourceid, PERM_READ_ONLY)) continue;
$link = new CLink($screen['name'],'screens.php?config=0&elementid='.$resourceid);
$link->SetTarget('blank');
@@ -133,7 +139,8 @@ function make_favorite_maps(){
foreach($fav_sysmaps['id'] as $key => $resourceid){
if(!$sysmap = get_sysmap_by_sysmapid($resourceid)) continue;
-
+ if(!sysmap_accessible($resourceid,PERM_READ_ONLY)) continue;
+
$link = new CLink($sysmap['name'],'maps.php?sysmapid='.$resourceid);
$link->SetTarget('blank');
@@ -887,11 +894,13 @@ function make_graph_menu(&$menu,&$submenu){
function make_graph_submenu(){
$graphids = array();
-
+
$fav_graphs = get4favorites('web.favorite.graphids');
foreach($fav_graphs['id'] as $key => $resourceid){
if('itemid' == $fav_graphs['resource'][$key]){
if(!$item = get_item_by_itemid($resourceid)) continue;
+
+ $item_added = true;
$host = get_host_by_itemid($resourceid);
$item["description"] = item_description($item["description"],$item["key_"]);
@@ -905,10 +914,12 @@ function make_graph_submenu(){
}
else{
if(!$graph = get_graph_by_graphid($resourceid)) continue;
+
+ $graph_added = true;
$result = get_hosts_by_graphid($resourceid);
$ghost = DBFetch($result);
-
+
$graphids[] = array(
'name' => $ghost['host'].':'.$graph['name'],
'favobj'=> 'graphid',
@@ -917,6 +928,24 @@ function make_graph_submenu(){
);
}
}
+
+ if(isset($graph_added)){
+ $graphids[] = array(
+ 'name' => S_REMOVE.SPACE.S_ALL.SPACE.S_GRAPHS,
+ 'favobj'=> 'graphid',
+ 'favid' => 0,
+ 'action'=> 'remove'
+ );
+ }
+
+ if(isset($item_added)){
+ $graphids[] = array(
+ 'name' => S_REMOVE.SPACE.S_ALL.SPACE.S_SIMPLE_GRAPHS,
+ 'favobj'=> 'itemid',
+ 'favid' => 0,
+ 'action'=> 'remove'
+ );
+ }
return $graphids;
}
@@ -957,6 +986,15 @@ function make_sysmap_submenu(){
);
}
+ if(!empty($sysmapids)){
+ $sysmapids[] = array(
+ 'name' => S_REMOVE.SPACE.S_ALL.SPACE.S_MAPS,
+ 'favobj'=> 'sysmapid',
+ 'favid' => 0,
+ 'action'=> 'remove'
+ );
+ }
+
return $sysmapids;
}
@@ -1000,20 +1038,22 @@ function make_screen_submenu(){
$fav_screens = get4favorites('web.favorite.screenids');
foreach($fav_screens['id'] as $key => $resourceid){
- if('slides' == $fav_screens['resource'][$key]){
+ if('slideshowid' == $fav_screens['resource'][$key]){
if(!$slide = get_slideshow_by_slideshowid($resourceid)) continue;
-
+ $slide_added = true;
+
$screenids[] = array(
'name' => $slide['name'],
- 'favobj'=> 'slideid',
+ 'favobj'=> 'slideshowid',
'favid' => $resourceid,
'action'=> 'remove'
);
}
else{
- if(!$screen = get_screen_by_screenid($resourceid)) continue;
-
+ if(!$screen = get_screen_by_screenid($resourceid)) continue;
+ $screen_added = true;
+
$screenids[] = array(
'name' => $screen['name'],
'favobj'=> 'screenid',
@@ -1023,6 +1063,25 @@ function make_screen_submenu(){
}
}
+
+ if(isset($screen_added)){
+ $screenids[] = array(
+ 'name' => S_REMOVE.SPACE.S_ALL.SPACE.S_SCREENS,
+ 'favobj'=> 'screenid',
+ 'favid' => 0,
+ 'action'=> 'remove'
+ );
+ }
+
+ if(isset($slide_added)){
+ $screenids[] = array(
+ 'name' => S_REMOVE.SPACE.S_ALL.SPACE.S_SLIDES,
+ 'favobj'=> 'slideshowid',
+ 'favid' => 0,
+ 'action'=> 'remove'
+ );
+ }
+
return $screenids;
}
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index b5abd8a7..edae641f 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -3772,7 +3772,7 @@ include_once 'include/discovery.inc.php';
' WHERE s.sysmapid='.$resourceid);
while($row=DBfetch($result)){
- if(!sysmap_accessiable($row['sysmapid'],PERM_READ_ONLY)) continue;
+ if(!sysmap_accessible($row['sysmapid'],PERM_READ_ONLY)) continue;
$row['node_name'] = isset($row['node_name']) ? '('.$row['node_name'].') ' : '';
$caption = $row['node_name'].$row['name'];
@@ -3878,7 +3878,7 @@ include_once 'include/discovery.inc.php';
' WHERE s.screenid='.$resourceid);
while($row=DBfetch($result)){
- if(!screen_accessiable($row['screenid'], PERM_READ_ONLY)) continue;
+ if(!screen_accessible($row['screenid'], PERM_READ_ONLY)) continue;
if(check_screen_recursion($_REQUEST['screenid'],$row['screenid'])) continue;
$row['node_name'] = isset($row['node_name']) ? '('.$row['node_name'].') ' : '';
@@ -4907,7 +4907,7 @@ include_once 'include/discovery.inc.php';
' order by node_name,s.name');
while($db_map = DBfetch($db_maps))
{
- if(!sysmap_accessiable($db_map["sysmapid"],PERM_READ_ONLY)) continue;
+ if(!sysmap_accessible($db_map["sysmapid"],PERM_READ_ONLY)) continue;
$node_name = isset($db_map['node_name']) ? '('.$db_map['node_name'].') ' : '';
$cmbMaps->AddItem($db_map["sysmapid"],$node_name.$db_map["name"]);
}
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php
index e56eda39..45233964 100644
--- a/frontends/php/include/items.inc.php
+++ b/frontends/php/include/items.inc.php
@@ -889,6 +889,7 @@
function get_items_data_overview($groupid,$view_style=null)
{
global $USER_DETAILS;
+ $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid());
if(is_null($view_style)) $view_style = get_profile('web.overview.view.style',STYLE_TOP);
@@ -906,7 +907,7 @@ COpt::profiling_start('prepare data');
' i.description, t.priority, i.valuemapid, t.value as tr_value, t.triggerid '.
' from hosts h,items i left join functions f on f.itemid=i.itemid left join triggers t on t.triggerid=f.triggerid '.
$group_where.
- ' h.hostid in ('.get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid()).') '.
+ ' h.hostid in ('.$available_hosts.') '.
' and h.status='.HOST_STATUS_MONITORED.' and h.hostid=i.hostid and i.status='.ITEM_STATUS_ACTIVE.
' order by i.description,i.itemid');
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 7b8bfd5e..25de5be1 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -1083,6 +1083,7 @@
'S_RIGHTS_OF_RESOURCES'=> 'User rights',
'S_NO_RESOURCES_DEFINED'=> 'No resources defined',
'S_SIMPLE_GRAPH'=> 'Simple graph',
+ 'S_SIMPLE_GRAPHS'=> 'Simple graphs',
'S_SIMPLE_GRAPH_BIG'=> 'SIMPLE GRAPH',
'S_GRAPH_NAME'=> 'Graph name',
'S_WIDTH'=> 'Width',
diff --git a/frontends/php/include/maps.inc.php b/frontends/php/include/maps.inc.php
index 098484ed..6c7c24e6 100644
--- a/frontends/php/include/maps.inc.php
+++ b/frontends/php/include/maps.inc.php
@@ -66,7 +66,7 @@
}
/*
- * Function: sysmap_accessiable
+ * Function: sysmap_accessible
*
* Description:
* Check permission for map
@@ -77,7 +77,7 @@
* Eugene Grigorjev
*
*/
- function sysmap_accessiable($sysmapid,$perm)
+ function sysmap_accessible($sysmapid,$perm)
{
global $USER_DETAILS;
@@ -99,7 +99,7 @@
}
break;
case SYSMAP_ELEMENT_TYPE_MAP:
- $result &= sysmap_accessiable($se_data['elementid'], PERM_READ_ONLY);
+ $result &= sysmap_accessible($se_data['elementid'], PERM_READ_ONLY);
break;
case SYSMAP_ELEMENT_TYPE_TRIGGER:
if(DBfetch(DBselect('SELECT triggerid FROM triggers WHERE triggerid='.$se_data['elementid']))){
diff --git a/frontends/php/include/profiles.inc.php b/frontends/php/include/profiles.inc.php
index f308430e..3289b71b 100644
--- a/frontends/php/include/profiles.inc.php
+++ b/frontends/php/include/profiles.inc.php
@@ -203,13 +203,15 @@ function rm4favorites($favobj,$favid,$favcnt=null,$resource=null){
$resource = (is_null($resource))?0:$resource;
$favcnt = (is_null($favcnt))?0:$favcnt;
+
+ if($favid == 0) $favcnt = ZBX_FAVORITES_ALL;
foreach($favorites as $key => $value){
if(((bccomp($favid,$value) == 0) || ($favid == 0)) && ($fav_rsrc[$key] == $resource)){
if($favcnt < 1){
unset($favorites[$key]);
unset($fav_rsrc[$key]);
- if($favcnt > ZBX_FAVORITES_ALL) break;
+ if($favcnt > ZBX_FAVORITES_ALL) break; // foreach
}
}
$favcnt--;
diff --git a/frontends/php/include/screens.inc.php b/frontends/php/include/screens.inc.php
index af344d78..65da8df3 100644
--- a/frontends/php/include/screens.inc.php
+++ b/frontends/php/include/screens.inc.php
@@ -22,7 +22,7 @@
require_once "include/actions.inc.php";
?>
<?php
- function screen_accessiable($screenid,$perm)
+ function screen_accessible($screenid,$perm)
{
global $USER_DETAILS;
@@ -64,10 +64,10 @@
unset($itemid);
break;
case SCREEN_RESOURCE_MAP:
- $result &= sysmap_accessiable($ac_data['resourceid'], PERM_READ_ONLY);
+ $result &= sysmap_accessible($ac_data['resourceid'], PERM_READ_ONLY);
break;
case SCREEN_RESOURCE_SCREEN:
- $result &= screen_accessiable($ac_data['resourceid'],PERM_READ_ONLY);
+ $result &= screen_accessible($ac_data['resourceid'],PERM_READ_ONLY);
break;
case SCREEN_RESOURCE_SERVER_INFO:
case SCREEN_RESOURCE_HOSTS_INFO:
@@ -222,7 +222,7 @@
// editmode: 0 - view with actions, 1 - edit mode, 2 - view without any actions
function get_screen($screenid, $editmode, $effectiveperiod=NULL)
{
- if(!screen_accessiable($screenid, $editmode ? PERM_READ_WRITE : PERM_READ_ONLY))
+ if(!screen_accessible($screenid, $editmode ? PERM_READ_WRITE : PERM_READ_ONLY))
access_deny();
if(is_null($effectiveperiod))
@@ -550,7 +550,7 @@
return $table;
}
- function slideshow_accessiable($slideshowid, $perm)
+ function slideshow_accessible($slideshowid, $perm)
{
$result = false;
@@ -561,7 +561,7 @@
$db_slides = DBselect('select distinct screenid from slides where slideshowid='.$slideshowid);
while($slide_data = DBfetch($db_slides))
{
- if( !($result = screen_accessiable($slide_data["screenid"], PERM_READ_ONLY)) ) break;
+ if( !($result = screen_accessible($slide_data["screenid"], PERM_READ_ONLY)) ) break;
}
}
return $result;
@@ -574,7 +574,7 @@
function validate_slide($slide)
{
- if(!screen_accessiable($slide["screenid"], PERM_READ_ONLY)) return false;
+ if(!screen_accessible($slide["screenid"], PERM_READ_ONLY)) return false;
if( !is_numeric($slide['delay']) ) return false;