summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-06-20 08:42:25 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-06-20 08:42:25 +0000
commit3f8cf5f0da75fa8312c173e9e2c1e1e843811091 (patch)
tree1cb9f4841cb20bc2fd65a696181e70cbdf2cfb88 /frontends/php
parent2804bdc7c298f114802a93d7c3312370c8602ba0 (diff)
downloadzabbix-3f8cf5f0da75fa8312c173e9e2c1e1e843811091.tar.gz
zabbix-3f8cf5f0da75fa8312c173e9e2c1e1e843811091.tar.xz
zabbix-3f8cf5f0da75fa8312c173e9e2c1e1e843811091.zip
- [DEV-137] changes in users profile system (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5782 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/actionconf.php8
-rw-r--r--frontends/php/authentication.php2
-rw-r--r--frontends/php/chart2.php2
-rw-r--r--frontends/php/chart7.php4
-rw-r--r--frontends/php/charts.php8
-rw-r--r--frontends/php/config.php10
-rw-r--r--frontends/php/dashboard.php4
-rw-r--r--frontends/php/events.php10
-rw-r--r--frontends/php/history.php62
-rw-r--r--frontends/php/hosts.php12
-rw-r--r--frontends/php/httpconf.php6
-rw-r--r--frontends/php/httpmon.php4
-rw-r--r--frontends/php/include/config.inc.php4
-rw-r--r--frontends/php/include/db.inc.php1
-rw-r--r--frontends/php/include/defines.inc.php12
-rw-r--r--frontends/php/include/discovery.inc.php2
-rw-r--r--frontends/php/include/graphs.inc.php4
-rw-r--r--frontends/php/include/html.inc.php19
-rw-r--r--frontends/php/include/httptest.inc.php9
-rw-r--r--frontends/php/include/import.inc.php6
-rw-r--r--frontends/php/include/page_header.php2
-rw-r--r--frontends/php/include/perm.inc.php5
-rw-r--r--frontends/php/include/profiles.inc.php335
-rw-r--r--frontends/php/items.php58
-rw-r--r--frontends/php/latest.php7
-rw-r--r--frontends/php/nodes.php4
-rw-r--r--frontends/php/overview.php4
-rw-r--r--frontends/php/popup.php29
-rw-r--r--frontends/php/popup_right.php7
-rw-r--r--frontends/php/report2.php8
-rw-r--r--frontends/php/screenconf.php4
-rw-r--r--frontends/php/screens.php6
-rw-r--r--frontends/php/services.php2
-rw-r--r--frontends/php/srv_status.php2
-rw-r--r--frontends/php/sysmaps.php2
-rw-r--r--frontends/php/tr_events.php2
-rw-r--r--frontends/php/tr_status.php8
-rw-r--r--frontends/php/triggers.php2
-rw-r--r--frontends/php/users.php2
39 files changed, 363 insertions, 315 deletions
diff --git a/frontends/php/actionconf.php b/frontends/php/actionconf.php
index 753790fe..01205ca5 100644
--- a/frontends/php/actionconf.php
+++ b/frontends/php/actionconf.php
@@ -190,7 +190,7 @@ include_once 'include/page_header.php';
}
}
else if(inarr_isset(array('delete','actionid'))){
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
$action_data = DBfetch(DBselect('select name from actions where actionid='.$_REQUEST['actionid']));
@@ -292,7 +292,7 @@ include_once 'include/page_header.php';
}
/* GROUP ACTIONS */
else if(isset($_REQUEST['group_enable'])&&isset($_REQUEST['g_actionid'])){
- if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
$query = 'select distinct actionid from actions'.
@@ -318,7 +318,7 @@ include_once 'include/page_header.php';
}
else if(isset($_REQUEST['group_disable'])&&isset($_REQUEST['g_actionid'])){
- if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
$query = 'select distinct actionid from actions'.
@@ -342,7 +342,7 @@ include_once 'include/page_header.php';
}
}
else if(isset($_REQUEST['group_delete'])&&isset($_REQUEST['g_actionid'])){
- if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
$result=DBselect('select distinct actionid from actions'.
diff --git a/frontends/php/authentication.php b/frontends/php/authentication.php
index a9d97402..f23436f4 100644
--- a/frontends/php/authentication.php
+++ b/frontends/php/authentication.php
@@ -63,7 +63,7 @@ include_once('include/page_header.php');
$_REQUEST['config'] = get_request('config',get_profile('web.authentication.config',ZBX_AUTH_LDAP));
check_fields($fields);
- update_profile('web.authentication.config',$_REQUEST['config']);
+ update_profile('web.authentication.config',$_REQUEST['config'], PROFILE_TYPE_INT);
$_REQUEST['authentication_type'] = get_request('authentication_type',ZBX_AUTH_INTERNAL);
diff --git a/frontends/php/chart2.php b/frontends/php/chart2.php
index ac050628..73bdf194 100644
--- a/frontends/php/chart2.php
+++ b/frontends/php/chart2.php
@@ -58,7 +58,7 @@ include_once 'include/page_header.php';
$effectiveperiod = navigation_bar_calc();
if(($_REQUEST['graphid']>0) && ($_REQUEST['period'] >= ZBX_MIN_PERIOD)){
- update_profile('web.graph['.$_REQUEST['graphid'].'].period',$_REQUEST['period']);
+ update_profile('web.graph.period',$_REQUEST['period'],PROFILE_TYPE_INT,$_REQUEST['graphid']);
}
update_profile('web.charts.graphid',$_REQUEST['graphid']);
diff --git a/frontends/php/chart7.php b/frontends/php/chart7.php
index df6d0e6a..883b1180 100644
--- a/frontends/php/chart7.php
+++ b/frontends/php/chart7.php
@@ -67,9 +67,9 @@ include_once "include/page_header.php";
$effectiveperiod = navigation_bar_calc();
if(count($items) == 1){
- $_REQUEST['period'] = get_request('period',get_profile('web.item['.$items['itemid'].'].graph.period', ZBX_PERIOD_DEFAULT));
+ $_REQUEST['period'] = get_request('period',get_profile('web.item.graph.period', ZBX_PERIOD_DEFAULT, null, $items['itemid']));
if($_REQUEST['period'] >= ZBX_MIN_PERIOD){
- update_profile('web.item['.$items['itemid'].'].graph.period',$_REQUEST['period']);
+ update_profile('web.item.graph.period',$_REQUEST['period'], PROFILE_TYPE_INT, $items['itemid']);
}
}
diff --git a/frontends/php/charts.php b/frontends/php/charts.php
index 7970bf50..56ee2e4c 100644
--- a/frontends/php/charts.php
+++ b/frontends/php/charts.php
@@ -92,11 +92,11 @@ include_once 'include/page_header.php';
$_REQUEST["groupid"] = $_REQUEST["hostid"] = 0;
}
- $_REQUEST["graphid"] = get_request("graphid", get_node_profile("web.charts.graphid", 0));//get_profile("web.charts.graphid", 0));
+ $_REQUEST['graphid'] = get_request('graphid', get_profile('web.charts.graphid', 0));
if(!in_node($_REQUEST["graphid"])) $_REQUEST["graphid"] = 0;
- $_REQUEST["keep"] = get_request("keep", 1); // possible excessed REQUEST variable !!!
- $_REQUEST["period"] = get_request("period",get_profile("web.graph[".$_REQUEST["graphid"]."].period", ZBX_PERIOD_DEFAULT));
+ $_REQUEST["keep"] = get_request('keep', 1); // possible excessed REQUEST variable !!!
+ $_REQUEST["period"] = get_request('period',get_profile('web.graph.period', ZBX_PERIOD_DEFAULT, PROFILE_TYPE_INT, $_REQUEST['graphid']));
$effectiveperiod = navigation_bar_calc();
@@ -120,7 +120,7 @@ include_once 'include/page_header.php';
}
if(($_REQUEST['graphid']>0) && ($_REQUEST['period'] >= ZBX_MIN_PERIOD)){
- update_profile('web.graph['.$_REQUEST['graphid'].'].period',$_REQUEST['period']);
+ update_profile('web.graph.period',$_REQUEST['period'],PROFILE_TYPE_INT,$_REQUEST['graphid']);
}
update_profile('web.charts.graphid',$_REQUEST['graphid']);
diff --git a/frontends/php/config.php b/frontends/php/config.php
index 7892aba9..61a5bdd0 100644
--- a/frontends/php/config.php
+++ b/frontends/php/config.php
@@ -96,7 +96,7 @@ include_once "include/page_header.php";
}
else {
/* ADD */
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
{
access_deny();
}
@@ -127,7 +127,7 @@ include_once "include/page_header.php";
}
}
else if(isset($_REQUEST["save"]) && ($_REQUEST["config"]==8)){
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
/* OTHER ACTIONS */
@@ -153,7 +153,7 @@ include_once "include/page_header.php";
}
}
else if(isset($_REQUEST["save"]) && ($_REQUEST["config"]==9)){
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
/* OTHER ACTIONS */
@@ -171,7 +171,7 @@ include_once "include/page_header.php";
}
else if(isset($_REQUEST["save"])&&uint_in_array($_REQUEST["config"],array(0,5,7))){
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
/* OTHER ACTIONS */
@@ -242,7 +242,7 @@ include_once "include/page_header.php";
$valuemapid = $_REQUEST["valuemapid"];
}
else{
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
{
access_deny();
}
diff --git a/frontends/php/dashboard.php b/frontends/php/dashboard.php
index 4fe6be53..f80a2de0 100644
--- a/frontends/php/dashboard.php
+++ b/frontends/php/dashboard.php
@@ -61,7 +61,7 @@ include_once "include/page_header.php";
// ACTION /////////////////////////////////////////////////////////////////////////////
if(isset($_REQUEST['favobj'])){
if('hat' == $_REQUEST['favobj']){
- update_profile('web.dashboard.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state']);
+ update_profile('web.dashboard.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state'], PROFILE_TYPE_INT);
}
if('refresh' == $_REQUEST['favobj']){
switch($_REQUEST['favid']){
@@ -90,7 +90,7 @@ include_once "include/page_header.php";
if('set_rf_rate' == $_REQUEST['favobj']){
if(in_array($_REQUEST['favid'],array('hat_syssum','hat_stszbx','hat_lastiss','hat_webovr','hat_dscvry'))){
- update_profile('web.dahsboard.rf_rate.'.$_REQUEST['favid'],$_REQUEST['favcnt']);
+ update_profile('web.dahsboard.rf_rate.'.$_REQUEST['favid'],$_REQUEST['favcnt'], PROFILE_TYPE_INT);
$_REQUEST['favcnt'] = get_profile('web.dahsboard.rf_rate.'.$_REQUEST['favid'],60);
echo get_refresh_obj_script(
diff --git a/frontends/php/events.php b/frontends/php/events.php
index 9f4a89b1..55de7e1b 100644
--- a/frontends/php/events.php
+++ b/frontends/php/events.php
@@ -80,7 +80,7 @@ include_once "include/page_header.php";
/* AJAX */
if(isset($_REQUEST['favobj'])){
if('filter' == $_REQUEST['favobj']){
- update_profile('web.events.filter.state',$_REQUEST['state']);
+ update_profile('web.events.filter.state',$_REQUEST['state'], PROFILE_TYPE_INT);
}
}
@@ -112,17 +112,17 @@ include_once "include/page_header.php";
if(isset($_REQUEST['filter_set']) || isset($_REQUEST['filter_rst'])){
update_profile('web.events.filter.triggerid',$_REQUEST['triggerid']);
- update_profile('web.events.filter.show_unknown',$show_unknown);
+ update_profile('web.events.filter.show_unknown',$show_unknown, PROFILE_TYPE_INT);
- update_profile('web.events.filter.timesince',$_REQUEST['filter_timesince']);
- update_profile('web.events.filter.timetill',$_REQUEST['filter_timetill']);
+ update_profile('web.events.filter.timesince',$_REQUEST['filter_timesince'], PROFILE_TYPE_INT);
+ update_profile('web.events.filter.timetill',$_REQUEST['filter_timetill'], PROFILE_TYPE_INT);
}
// --------------
validate_sort_and_sortorder('e.clock',ZBX_SORT_DOWN);
$source = get_request('source', EVENT_SOURCE_TRIGGERS);
- update_profile('web.events.source',$source);
+ update_profile('web.events.source',$source, PROFILE_TYPE_INT);
?>
<?php
diff --git a/frontends/php/history.php b/frontends/php/history.php
index 20ce8324..a3688b6f 100644
--- a/frontends/php/history.php
+++ b/frontends/php/history.php
@@ -149,32 +149,32 @@ include_once "include/page_header.php";
$item_type = $item_data["value_type"];
$l_header = null;
- if(!is_array($_REQUEST["itemid"])){
- $main_header = $item_data["host"].": ".item_description($item_data["description"],$item_data["key_"]);
+ if(!is_array($_REQUEST['itemid'])){
+ $main_header = $item_data['host'].': '.item_description($item_data['description'],$item_data['key_']);
- if(isset($_REQUEST["plaintext"]))
+ if(isset($_REQUEST['plaintext']))
echo $main_header.SBR;
- if($_REQUEST["action"]=="showgraph"){
- $_REQUEST["period"] = get_request("period",get_profile("web.item[".$_REQUEST["itemid"]."].graph.period", ZBX_PERIOD_DEFAULT));
- if($_REQUEST["period"] >= ZBX_MIN_PERIOD){
- update_profile("web.item[".$_REQUEST["itemid"]."].graph.period",$_REQUEST["period"]);
+ if($_REQUEST['action']=='showgraph'){
+ $_REQUEST['period'] = get_request('period',get_profile('web.item.graph.period', ZBX_PERIOD_DEFAULT, PROFILE_TYPE_INT, $_REQUEST['itemid']));
+ if($_REQUEST['period'] >= ZBX_MIN_PERIOD){
+ update_profile('web.item.graph.period',$_REQUEST['period'], PROFILE_TYPE_INT, $_REQUEST['itemid']);
}
}
- $l_header = array(new CLink($item_data['host'],"latest.php?hostid=".$item_data['hostid']),": ",
- item_description($item_data["description"],$item_data["key_"]));
+ $l_header = array(new CLink($item_data['host'],'latest.php?hostid='.$item_data['hostid']),': ',
+ item_description($item_data['description'],$item_data['key_']));
if('showgraph' == $_REQUEST['action']){
if(infavorites('web.favorite.graphids',$_REQUEST['itemid'],'itemid')){
$icon = new CDiv(SPACE,'iconminus');
$icon->AddOption('title',S_REMOVE_FROM.' '.S_FAVORITES);
- $icon->AddAction('onclick',new CScript("javascript: rm4favorites('itemid','".$_REQUEST['itemid']."',0);"));
+ $icon->AddAction('onclick',new CScript('javascript: rm4favorites('itemid',''.$_REQUEST['itemid'].'',0);'));
}
else{
$icon = new CDiv(SPACE,'iconplus');
$icon->AddOption('title',S_ADD_TO.' '.S_FAVORITES);
- $icon->AddAction('onclick',new CScript("javascript: add2favorites('itemid','".$_REQUEST['itemid']."');"));
+ $icon->AddAction('onclick',new CScript('javascript: add2favorites('itemid',''.$_REQUEST['itemid'].'');'));
}
$icon->AddOption('id','addrm_fav');
@@ -194,34 +194,30 @@ include_once "include/page_header.php";
if( !isset($_REQUEST['plaintext']) && ($_REQUEST['fullscreen']==0) ){
if($item_type == ITEM_VALUE_TYPE_LOG){
$l_header = new CForm();
- $l_header->SetName("loglist");
- $l_header->AddVar("action",$_REQUEST["action"]);
- $l_header->AddVar("from",$_REQUEST["from"]);
- $l_header->AddVar("period",$_REQUEST["period"]);
- $l_header->AddVar("itemid",$_REQUEST["itemid"]);
-
- if(isset($_REQUEST["filter_task"])) $l_header->AddVar("filter_task",$_REQUEST["filter_task"]);
- if(isset($_REQUEST["filter"])) $l_header->AddVar("filter",$_REQUEST["filter"]);
- if(isset($_REQUEST["mark_color"])) $l_header->AddVar("mark_color",$_REQUEST["mark_color"]);
-
- $cmbLogList = new CComboBox("cmbloglist");
- if(is_array($_REQUEST["itemid"]))
- {
+ $l_header->SetName('loglist');
+ $l_header->AddVar('action',$_REQUEST['action']);
+ $l_header->AddVar('from',$_REQUEST['from']);
+ $l_header->AddVar('period',$_REQUEST['period']);
+ $l_header->AddVar('itemid',$_REQUEST['itemid']);
+
+ if(isset($_REQUEST['filter_task'])) $l_header->AddVar('filter_task',$_REQUEST['filter_task']);
+ if(isset($_REQUEST['filter'])) $l_header->AddVar('filter',$_REQUEST['filter']);
+ if(isset($_REQUEST['mark_color'])) $l_header->AddVar('mark_color',$_REQUEST['mark_color']);
+
+ $cmbLogList = new CComboBox('cmbloglist');
+ if(is_array($_REQUEST['itemid'])){
$cmbLogList->AddItem(0, $main_header);
- foreach($_REQUEST["itemid"] as $itemid)
- {
- if(!($item = get_item_by_itemid($itemid)) || $item["value_type"] != ITEM_VALUE_TYPE_LOG)
- {
+ foreach($_REQUEST['itemid'] as $itemid){
+ if(!($item = get_item_by_itemid($itemid)) || $item['value_type'] != ITEM_VALUE_TYPE_LOG){
invalid_url();
}
- $host = get_host_by_hostid($item["hostid"]);
- $cmbLogList->AddItem($itemid,$host["host"].": ".item_description($item["description"],$item["key_"]));
+ $host = get_host_by_hostid($item['hostid']);
+ $cmbLogList->AddItem($itemid,$host['host'].': '.item_description($item['description'],$item['key_']));
}
}
- else
- {
- $cmbLogList->AddItem($_REQUEST["itemid"], $main_header);
+ else{
+ $cmbLogList->AddItem($_REQUEST['itemid'], $main_header);
}
$l_header->AddItem(array(
diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php
index 730ce160..e27227f0 100644
--- a/frontends/php/hosts.php
+++ b/frontends/php/hosts.php
@@ -128,7 +128,7 @@ include_once 'include/page_header.php';
else if($_REQUEST['config']==0 || $_REQUEST['config']==3)
validate_group(PERM_READ_WRITE,array(),'web.last.conf.groupid');
- update_profile('web.hosts.config',$_REQUEST['config']);
+ update_profile('web.hosts.config',$_REQUEST['config'], PROFILE_TYPE_INT);
?>
<?php
@@ -232,7 +232,7 @@ include_once 'include/page_header.php';
}
}
else{
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
}
@@ -325,7 +325,7 @@ include_once 'include/page_header.php';
}
}
else{
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
}
@@ -369,7 +369,7 @@ include_once 'include/page_header.php';
}
if($result){
- update_profile('HOST_PORT',$_REQUEST['port']);
+ update_profile('HOST_PORT',$_REQUEST['port'], PROFILE_TYPE_INT);
DBstart();
delete_host_profile($hostid);
@@ -526,7 +526,7 @@ include_once 'include/page_header.php';
$groupid = $_REQUEST["groupid"];
}
else {
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
DBstart();
@@ -728,7 +728,7 @@ include_once 'include/page_header.php';
$hostid = $_REQUEST["hostid"];
}
else {
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
$hostid &= add_proxy($_REQUEST["host"], $hosts);
diff --git a/frontends/php/httpconf.php b/frontends/php/httpconf.php
index 95a27cc3..52e84b48 100644
--- a/frontends/php/httpconf.php
+++ b/frontends/php/httpconf.php
@@ -88,10 +88,10 @@ include_once "include/page_header.php";
validate_group_with_host(PERM_READ_WRITE,array("always_select_first_host","only_current_node"),'web.last.conf.groupid', 'web.last.conf.hostid');
- update_profile("web.httpconf.showdisabled",$showdisabled);
+ update_profile("web.httpconf.showdisabled",$showdisabled, PROFILE_TYPE_STR);
?>
<?php
- $_REQUEST["applications"] = get_request("applications",get_profile("web.httpconf.applications",array()),PROFILE_TYPE_ARRAY);
+ $_REQUEST["applications"] = get_request("applications",get_profile("web.httpconf.applications",array(),PROFILE_TYPE_ARRAY_ID));
if(isset($_REQUEST["open"])){
if(!isset($_REQUEST["applicationid"])){
@@ -117,7 +117,7 @@ include_once "include/page_header.php";
array_shift($_REQUEST["applications"]);
}
- update_profile("web.httpconf.applications",$_REQUEST["applications"],PROFILE_TYPE_ARRAY);
+ update_profile("web.httpconf.applications",$_REQUEST["applications"],PROFILE_TYPE_ARRAY_ID);
if(isset($_REQUEST['del_sel_step'])&&isset($_REQUEST['sel_step'])&&is_array($_REQUEST['sel_step'])){
foreach($_REQUEST['sel_step'] as $sid)
diff --git a/frontends/php/httpmon.php b/frontends/php/httpmon.php
index ef3bde46..2a27a607 100644
--- a/frontends/php/httpmon.php
+++ b/frontends/php/httpmon.php
@@ -57,7 +57,7 @@ include_once "include/page_header.php";
// validate_group_with_host(PERM_READ_ONLY,array('allow_all_hosts','always_select_first_host','monitored_hosts'));
?>
<?php
- $_REQUEST["applications"] = get_request("applications",get_profile("web.httpmon.applications",array()),PROFILE_TYPE_ARRAY);
+ $_REQUEST["applications"] = get_request("applications",get_profile("web.httpmon.applications",array(),PROFILE_TYPE_ARRAY_ID));
if(isset($_REQUEST["open"])){
if(!isset($_REQUEST["applicationid"])){
@@ -83,7 +83,7 @@ include_once "include/page_header.php";
array_shift($_REQUEST["applications"]);
}
- update_profile("web.httpmon.applications",$_REQUEST["applications"],PROFILE_TYPE_ARRAY);
+ update_profile("web.httpmon.applications",$_REQUEST["applications"],PROFILE_TYPE_ARRAY_ID);
?>
<?php
// Table HEADER
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 7ea70118..9011da62 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -216,7 +216,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
$ZBX_NODES_IDS = array();
$ZBX_NODES = array();
if(!defined('ZBX_PAGE_NO_AUTHERIZATION') && ZBX_DISTRIBUTED){
-
+//SDI($_REQUEST);
$ZBX_CURRENT_NODEID = get_cookie('zbx_current_nodeid', $ZBX_LOCALNODEID); // Selected node
$ZBX_WITH_SUBNODES = get_cookie('zbx_with_subnodes', false); // Show elements from subnodes
@@ -285,7 +285,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
$result = ( is_show_subnodes($forse_with_subnodes) ? $ZBX_CURRENT_SUBNODES : $ZBX_CURRENT_NODEID );
if(!is_null($perm)){
- $result = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_ONLY);
+ $result = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY, $ZBX_CURRENT_SUBNODES);
}
return $result;
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index 38e412c4..31f018c3 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -736,7 +736,6 @@ else {
function DBcondition($fieldname, &$array, $notin=false){
global $DB;
-
$condition = '';
$in = $notin?' NOT IN ':' IN ';
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 0e7024a8..b217c340 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -320,12 +320,14 @@
define('MARK_COLOR_GREEN', 2);
define('MARK_COLOR_BLUE', 3);
- define('PROFILE_TYPE_UNKNOWN', 0);
- define('PROFILE_TYPE_ARRAY', 1);
+ define('PROFILE_TYPE_UNKNOWN', 0);
+ define('PROFILE_TYPE_ID', 1);
+ define('PROFILE_TYPE_INT', 2);
+ define('PROFILE_TYPE_STR', 3);
+ define('PROFILE_TYPE_ARRAY_ID', 4);
+ define('PROFILE_TYPE_ARRAY_INT', 5);
+ define('PROFILE_TYPE_ARRAY_STR', 6);
- define('PROFILE_TYPE_MULTI', 2);
- define('PROFILE_TYPE_MULTI_ARRAY', 3);
-
define('CALC_FNC_MIN', 1);
define('CALC_FNC_AVG', 2);
define('CALC_FNC_MAX', 4);
diff --git a/frontends/php/include/discovery.inc.php b/frontends/php/include/discovery.inc.php
index f0e7b5cf..e1410565 100644
--- a/frontends/php/include/discovery.inc.php
+++ b/frontends/php/include/discovery.inc.php
@@ -25,7 +25,7 @@
global $USER_DETAILS;
if( $USER_DETAILS['type'] >= USER_TYPE_ZABBIX_ADMIN ){
- if(count(get_accessible_nodes_by_user($USER_DETAILS, $permission, PERM_RES_IDS_ARRAY, get_current_nodeid())))
+ if(count(get_accessible_nodes_by_user($USER_DETAILS, $permission, PERM_RES_IDS_ARRAY)))
return true;
}
return false;
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php
index 0251b177..dae343fd 100644
--- a/frontends/php/include/graphs.inc.php
+++ b/frontends/php/include/graphs.inc.php
@@ -198,7 +198,7 @@
$perm_res = PERM_RES_STRING_LINE;
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, $perm, null, $nodeid);
-
+
$denied_graphs = array();
$result = array();
@@ -233,7 +233,7 @@
else
$result = implode(',',$result);
}
-
+
return $result;
}
diff --git a/frontends/php/include/html.inc.php b/frontends/php/include/html.inc.php
index 5771e868..db6d95f4 100644
--- a/frontends/php/include/html.inc.php
+++ b/frontends/php/include/html.inc.php
@@ -36,33 +36,28 @@
return $str;
}
- function bfirst($str) // mark first symbol of string as bold
- {
+ function bfirst($str){
+// mark first symbol of string as bold
$res = bold($str[0]);
for($i=1,$max=strlen($str); $i<$max; $i++) $res .= $str[$i];
$str = $res;
return $str;
}
- function nbsp($str)
- {
+ function nbsp($str){
return str_replace(" ",SPACE,$str);
}
- function url1_param($parameter)
- {
- if(isset($_REQUEST[$parameter]))
- {
+ function url1_param($parameter){
+ if(isset($_REQUEST[$parameter])){
return "$parameter=".$_REQUEST[$parameter];
}
- else
- {
+ else{
return "";
}
}
- function prepare_url(&$var, $varname=null)
- {
+ function prepare_url(&$var, $varname=null){
$result = "";
if(is_array($var)){
diff --git a/frontends/php/include/httptest.inc.php b/frontends/php/include/httptest.inc.php
index a0282034..57855b65 100644
--- a/frontends/php/include/httptest.inc.php
+++ b/frontends/php/include/httptest.inc.php
@@ -45,16 +45,13 @@
return $status;
}
- function db_save_step($hostid, $applicationid, $httptestid, $testname, $name, $no, $timeout, $url, $posts, $required, $status_codes, $delay, $history, $trends)
- {
- if( $no <= 0 )
- {
+ function db_save_step($hostid, $applicationid, $httptestid, $testname, $name, $no, $timeout, $url, $posts, $required, $status_codes, $delay, $history, $trends){
+ if( $no <= 0 ){
error('Scenario step number can\'t be less then 1');
return false;
}
- if (!eregi('^([0-9a-zA-Z\_\.[.-.]\$ ]+)$', $name))
- {
+ if (!eregi('^([0-9a-zA-Z\_\.[.-.]\$ ]+)$', $name)) {
error("Scenario step name should contain '0-9a-zA-Z_ .$'- characters only");
return false;
}
diff --git a/frontends/php/include/import.inc.php b/frontends/php/include/import.inc.php
index 8329f5a8..84389754 100644
--- a/frontends/php/include/import.inc.php
+++ b/frontends/php/include/import.inc.php
@@ -34,11 +34,11 @@
$this->trigger = array('exist' => 0, 'missed' => 0);
$this->graph = array('exist' => 0, 'missed' => 0);
- $this->available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY, get_current_nodeid());
+ $this->available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY);
- $this->available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY, get_current_nodeid());
+ $this->available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY);
- $this->available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY, get_current_nodeid());
+ $this->available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY);
}
function CharacterData($parser, $data) {
diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php
index ec92dc94..87526d15 100644
--- a/frontends/php/include/page_header.php
+++ b/frontends/php/include/page_header.php
@@ -324,7 +324,7 @@ COpt::profiling_start("page");
if(isset($menu_url)){ /* active menu */
$class = 'active';
- update_profile('web.menu.'.$label.'.last', $menu_url);
+ update_profile('web.menu.'.$label.'.last', $menu_url, PROFILE_TYPE_STR);
if(isset($deny)){
$denyed_page_requested = true;
diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php
index 17299831..65bcf4c1 100644
--- a/frontends/php/include/perm.inc.php
+++ b/frontends/php/include/perm.inc.php
@@ -399,8 +399,9 @@ COpt::counter_up('perm');
function get_accessible_nodes_by_user(&$user_data,$perm,$perm_res=null,$nodeid=null){
global $ZBX_LOCALNODEID, $ZBX_NODES_IDS;
-
+
if(is_null($nodeid)) $nodeid = $ZBX_NODES_IDS;
+ if(!is_array($nodeid)) $nodeid = array($nodeid);
if(is_null($perm_res)) $perm_res=PERM_RES_STRING_LINE;
$userid =& $user_data['userid'];
@@ -414,7 +415,7 @@ function get_accessible_nodes_by_user(&$user_data,$perm,$perm_res=null,$nodeid=n
//COpt::counter_up('perm');
if(USER_TYPE_SUPER_ADMIN == $user_type){
- $nodes = DBselect('SELECT nodeid FROM nodes WHERE '.DBcondition('nodeid',$nodeid));
+ $nodes = DBselect('SELECT nodeid FROM nodes WHERE '.DBcondition('nodeid', $nodeid));
while($node = DBfetch($nodes)){
$node_data[$node['nodeid']] = $node;
$node_data[$node['nodeid']]['permission'] = PERM_READ_WRITE;
diff --git a/frontends/php/include/profiles.inc.php b/frontends/php/include/profiles.inc.php
index c2be5fc3..929b8527 100644
--- a/frontends/php/include/profiles.inc.php
+++ b/frontends/php/include/profiles.inc.php
@@ -22,32 +22,38 @@
/********** USER PROFILE ***********/
//---------- GET USER VALUE -------------
-function get_profile($idx,$default_value=null,$type=PROFILE_TYPE_UNKNOWN,$source=null){
+
+function get_profile($idx,$default_value=null,$type=PROFILE_TYPE_UNKNOWN,$idx2=null,$source=null){
global $USER_DETAILS;
$result = $default_value;
if($USER_DETAILS["alias"]!=ZBX_GUEST_USER){
- $sql = 'SELECT value, valuetype '.
+ $sql_cond = '';
+ if(ctype_digit($idx2)) $sql_cond = ' AND idx2='.$idx2.' AND '.DBin_node('idx2');
+ if(!is_null($source)) $sql_cond.= ' AND source='.zbx_dbstr($source);
+
+ $sql = 'SELECT value_id, value_int, value_str, type '.
' FROM profiles '.
' WHERE userid='.$USER_DETAILS["userid"].
' AND idx='.zbx_dbstr($idx).
- (is_null($source)?'':' AND source='.zbx_dbstr($source)).
+ $sql_cond.
' ORDER BY profileid ASC';
$db_profiles = DBselect($sql);
if($profile=DBfetch($db_profiles)){
- if(PROFILE_TYPE_UNKNOWN == $type) $type = $profile["valuetype"];
-
- if(PROFILE_TYPE_ARRAY == $type){
- $result[] = $profile['value'];
+ if(PROFILE_TYPE_UNKNOWN == $type) $type = $profile['type'];
+ $value_type = profile_field_by_type($type);
+
+ if(profile_type_array($type)){
+ $result[] = $profile[$value_type];
while($profile=DBfetch($db_profiles)){
- $result[] = $profile['value'];
+ $result[] = $profile[$value_type];
}
}
else{
- $result = strval($profile["value"]);
+ $result = $profile[$value_type];
}
}
}
@@ -57,36 +63,43 @@ return $result;
// multi value
-function get_multi_profile($idx,$default_value=array(),$type=PROFILE_TYPE_UNKNOWN,$source=null){
+function get_source_profile($idx,$default_value=array(),$type=PROFILE_TYPE_UNKNOWN,$idx2=null,$source=null){
global $USER_DETAILS;
- $result = $default_value;
+ $result = array();
if($USER_DETAILS["alias"]!=ZBX_GUEST_USER){
- $sql = 'SELECT value,value2,source,valuetype '.
+ $sql_cond = '';
+ if(ctype_digit($idx2)) $sql_cond.= ' AND idx2='.$idx2.' AND '.DBin_node('idx2');
+ if(!is_null($source)) $sql_cond.= ' AND source='.zbx_dbstr($source);
+
+ $sql = 'SELECT value_id,value_int,value_str,source,type '.
' FROM profiles '.
' WHERE userid='.$USER_DETAILS["userid"].
' AND idx='.zbx_dbstr($idx).
- (is_null($source)?'':' AND source='.zbx_dbstr($source)).
+ $sql_cond.
' ORDER BY profileid ASC';
- $db_profiles = DBselect($sql);
+ $db_profiles = DBselect($sql);
if($profile=DBfetch($db_profiles)){
-
- if(PROFILE_TYPE_UNKNOWN == $type) $type = $profile["valuetype"];
-
- if(PROFILE_TYPE_MULTI_ARRAY == $type){
- $result[] = $profile;
+ if(PROFILE_TYPE_UNKNOWN == $type) $type = $profile['type'];
+ $value_type = profile_field_by_type($type);
+
+ if(profile_type_array($type)){
+ $result[] = array('value'=>$profile[$value_type], 'source'=>$profile['source']);
+
while($profile=DBfetch($db_profiles)){
- $result[] = $profile;
+ $result[] = array('value'=>$profile[$value_type], 'source'=>$profile['source']);
}
}
else{
- $result = $profile;
+ $result = array('value'=>$profile[$value_type], 'source'=>$profile['source']);
}
+
}
}
-
+ $result = count($result)?$result:$default_value;
+
return $result;
}
@@ -96,46 +109,72 @@ return (zbx_empty($profile))?$default_value:$profile;
}
//----------- ADD/EDIT USERPROFILE -------------
-function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN,$source=null){
+function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN,$idx2=null,$source=null){
global $USER_DETAILS;
+ if($USER_DETAILS["alias"]==ZBX_GUEST_USER) return false;
- if($USER_DETAILS["alias"]==ZBX_GUEST_USER){
- return false;
- }
-
- if($type==PROFILE_TYPE_UNKNOWN && is_array($value)) $type = PROFILE_TYPE_ARRAY;
- if(($type==PROFILE_TYPE_ARRAY) && !is_array($value)) $value = array($value);
+ if(PROFILE_TYPE_UNKNOWN == $type) $type = profile_type_by_value($value);
+ else $value = profile_value_by_type($value,$type);
- DBstart();
+ if($value === false) return false;
+
+ $sql_cond = '';
+ if(ctype_digit($idx2)) $sql_cond = ' AND idx2='.$idx2.' AND '.DBin_node('idx2');
- if(PROFILE_TYPE_ARRAY == $type){
+ DBstart();
+ if(profile_type_array($type)){
$sql='DELETE FROM profiles '.
' WHERE userid='.$USER_DETAILS["userid"].
- ' AND idx='.zbx_dbstr($idx);
- DBExecute($sql);
-
+ ' AND idx='.zbx_dbstr($idx).
+ $sql_cond;
+
+ DBexecute($sql);
foreach($value as $id => $val){
- insert_profile($idx,$val,$type,$source);
+ insert_profile($idx,$val,$type,$idx2,$source);
}
}
else{
$sql = 'SELECT profileid '.
' FROM profiles '.
- ' WHERE userid='.$USER_DETAILS["userid"].
+ ' WHERE userid='.$USER_DETAILS['userid'].
' AND idx='.zbx_dbstr($idx).
- (is_null($source)?'':' AND source='.zbx_dbstr($source));
+ $sql_cond;
$row = DBfetch(DBselect($sql));
if(!$row){
- insert_profile($idx,$value,$type,$source);
+ insert_profile($idx,$value,$type,$idx2,$source);
}
else{
- $sql='UPDATE profiles SET value='.zbx_dbstr($value).',valuetype='.$type.
+ $val = array();
+ $value_type = profile_field_by_type($type);
+
+ $val['value_id'] = 0;
+ $val['value_int'] = 0;
+ $val['value_str'] = '';
+
+ $val[$value_type] = $value;
+
+ $idx2 = ctype_digit($idx2)?$idx2:0;
+ $src = is_null($source)?'':$source;
+
+ if(is_array($value)){
+ $val[$value_type] = isset($value['value'])?$value['value']:'';
+ $src = isset($value['source'])?$value['source']:$src;
+ }
+ if(is_null($val[$value_type])) return false;
+
+ $sql='UPDATE profiles '.
+ ' SET value_id='.$val['value_id'].','.
+ ' value_int='.$val['value_int'].','.
+ ' value_str='.zbx_dbstr($val['value_str']).','.
+ ' type='.$type.','.
+ ' source='.zbx_dbstr($src).
' WHERE userid='.$USER_DETAILS["userid"].
' AND idx='.zbx_dbstr($idx).
- (is_null($source)?'':' AND source='.zbx_dbstr($source));
+ $sql_cond;
+
DBexecute($sql);
}
}
@@ -145,116 +184,146 @@ function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN,$source=null){
return $result;
}
-function update_multi_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN,$source=null){
+
+// Author: Aly
+function insert_profile($idx,$value,$type,$idx2,$source){
global $USER_DETAILS;
- if($USER_DETAILS["alias"]==ZBX_GUEST_USER){
- return false;
+ $profileid = get_dbid('profiles', 'profileid');
+ $value_type = profile_field_by_type($type);
+
+ $val['value_id'] = 0;
+ $val['value_int'] = 0;
+ $val['value_str'] = '';
+
+ $val[$value_type] = $value;
+
+ $idx2 = ctype_digit($idx2)?$idx2:0;
+ $src = is_null($source)?'':$source;
+
+ if(is_array($value)){
+ $val[$value_type] = isset($value['value'])?$value['value']:'';
+ $src = isset($value['source'])?$value['source']:$src;
}
- if(empty($value)) $type = PROFILE_TYPE_MULTI_ARRAY;
- if(!is_array($value)) $value = array('value' => $value);
+ if(is_null($val[$value_type])) return false;
- if($type==PROFILE_TYPE_UNKNOWN && isset($value['value'])) $type = PROFILE_TYPE_MULTI;
- if($type==PROFILE_TYPE_UNKNOWN && isset($value[0]['value'])) $type = PROFILE_TYPE_MULTI_ARRAY;
-
- if(($type==PROFILE_TYPE_MULTI_ARRAY) && isset($value['value'])) $value = array($value);
+ $sql='INSERT INTO profiles (profileid,userid,idx,idx2,value_id,value_int,value_str,source,type)'.
+ ' VALUES ('.$profileid.','.
+ $USER_DETAILS['userid'].','.
+ zbx_dbstr($idx).','.
+ $idx2.','.
+ $val['value_id'].','.
+ $val['value_int'].','.
+ zbx_dbstr($val['value_str']).','.
+ zbx_dbstr($src).','.
+ $type.')';
- DBstart();
+ $result = DBexecute($sql);
+
+return $result;
+}
- if(PROFILE_TYPE_MULTI_ARRAY == $type){
- $sql='DELETE FROM profiles '.
- ' WHERE userid='.$USER_DETAILS["userid"].
- ' AND idx='.zbx_dbstr($idx);
- DBExecute($sql);
+// ----------- MISC PROFILE FUNCTIONS -----------
+function profile_type_array($type){
+ return uint_in_array($type,array(PROFILE_TYPE_ARRAY_ID,PROFILE_TYPE_ARRAY_INT,PROFILE_TYPE_ARRAY_STR));
+}
- foreach($value as $id => $val){
- insert_profile($idx,$val,$type,$source);
- }
+function profile_field_by_type($type){
+ switch($type){
+ case PROFILE_TYPE_INT:
+ case PROFILE_TYPE_ARRAY_INT:
+ $field = 'value_int';
+ break;
+ case PROFILE_TYPE_STR:
+ case PROFILE_TYPE_ARRAY_STR:
+ $field = 'value_str';
+ break;
+ case PROFILE_TYPE_ID:
+ case PROFILE_TYPE_ARRAY_ID:
+ case PROFILE_TYPE_UNKNOWN:
+ default:
+ $field = 'value_id';
}
- else {
- $sql = 'SELECT profileid '.
- ' FROM profiles '.
- ' WHERE userid='.$USER_DETAILS["userid"].
- ' AND idx='.zbx_dbstr($idx).
- (is_null($source)?'':' AND source='.zbx_dbstr($source));
-
- $row = DBfetch(DBselect($sql));
+return $field;
+}
- if(!$row){
- insert_profile($idx,$value,$type,$source);
+function profile_type_by_value($value,$type=PROFILE_TYPE_UNKNOWN){
+ if(is_array($value)){
+ $value = $value[0];
+
+ if(is_array($value)){
+ if(isset($value['value']))
+ $type=ctype_digit($value['value'])?PROFILE_TYPE_ARRAY_ID:PROFILE_TYPE_ARRAY_STR;
}
else{
- $val1 = isset($value['value'])?$value['value']:'';
- $val2 = isset($value['value2'])?$value['value2']:'';
- $rsrc = isset($value['source'])?$value['source']:(is_null($source)?'':source);
-
- $sql='UPDATE profiles '.
- ' SET value='.zbx_dbstr($val1).
- ',value2='.zbx_dbstr($val2).
- ',source='.zbx_dbstr($rsrc).
- ',valuetype='.$type.
- ' WHERE userid='.$USER_DETAILS["userid"].
- ' AND idx='.zbx_dbstr($idx).
- (is_null($source)?'':' AND source='.zbx_dbstr($source));
- DBexecute($sql);
+ $type=ctype_digit($value)?PROFILE_TYPE_ARRAY_ID:PROFILE_TYPE_ARRAY_STR;
}
}
-
- $result = DBend();
-
-return $result;
+ else{
+ if(ctype_digit($value)) $type = PROFILE_TYPE_ID;
+ else $type = PROFILE_TYPE_STR;
+ }
+return $type;
}
-
-// Author: Aly
-function insert_profile($idx,$value,$type,$source=null){
- global $USER_DETAILS;
-
- $profileid = get_dbid('profiles', 'profileid');
-
- $val1 = $value;
- $val2 = '';
- $rsrc = is_null($source)?'':$source;
+function profile_value_by_type(&$value,$type){
- if(($type == PROFILE_TYPE_MULTI_ARRAY) ||
- ($type == PROFILE_TYPE_MULTI) ||
- is_array($value))
- {
- $val1 = isset($value['value'])?$value['value']:'';
- $val2 = isset($value['value2'])?$value['value2']:'';
- $rsrc = isset($value['source'])?$value['source']:$rsrc;
+ if(profile_type_array($type)){
+ $result = is_array($value)?$value:array($value);
+ }
+ else if(is_array($value)){
+ if(!isset($value['value'])) return false;
+
+ $result = $value;
+ switch($type){
+ case PROFILE_TYPE_ID:
+ case PROFILE_TYPE_INT:
+ if(ctype_digit($value['value'])){
+ $result['value'] = intval($value['value']);
+ }
+ else{
+ $result = false;
+ }
+ break;
+ case PROFILE_TYPE_STR:
+ $result['value'] = strval($value['value']);
+ break;
+ default:
+ $result = false;
+ }
+ }
+ else{
+ switch($type){
+ case PROFILE_TYPE_ID:
+ case PROFILE_TYPE_INT:
+ $result = ctype_digit($value)?intval($value):false;
+ break;
+ case PROFILE_TYPE_STR:
+ $result = strval($value);
+ break;
+ default:
+ $result = false;
+ }
}
-
- if(is_null($val1)) return false;
-
- $sql='INSERT INTO profiles (profileid,userid,idx,value,value2,source,valuetype)'.
- ' VALUES ('.$profileid.','.
- $USER_DETAILS["userid"].','.
- zbx_dbstr($idx).','.
- zbx_dbstr($val1).','.
- zbx_dbstr($val2).','.
- zbx_dbstr($rsrc).','.
- $type.')';
-
- $result = DBexecute($sql);
-
return $result;
}
/***********************************/
+
+
/************ HISTORY **************/
// Author: Aly
function get_user_history(){
$history=array();
$delimiter = new CSpan('&raquo;','delimiter');
for($i = 0; $i < ZBX_HISTORY_COUNT; $i++){
- if($rows = get_multi_profile('web.history.'.$i,false,PROFILE_TYPE_MULTI)){
+ if($rows = get_source_profile('web.history.'.$i,false)){
if($i>0){
array_push($history,$delimiter);
}
- $url = new CLink($rows['value'],$rows['value2'],'history');
+ $url = new CLink($rows['source'],$rows['value'],'history');
array_push($history,array(SPACE,$url,SPACE));
}
}
@@ -268,15 +337,15 @@ function get_last_history_page($same_page=false){
$rows=false;
for($i = 0; $i < ZBX_HISTORY_COUNT; $i++){
- $new_rows = get_multi_profile('web.history.'.$i,false,PROFILE_TYPE_MULTI);
+ $new_rows = get_source_profile('web.history.'.$i,false);
- if(!$same_page && ($title == $new_rows['value'])) continue;
+ if(!$same_page && ($title == $new_rows['source'])) continue;
$rows = $new_rows;
}
if(is_array($rows)){
- $rows['page'] = $rows['value'];
- $rows['url'] = $rows['value2'];
+ $rows['page'] = $rows['source'];
+ $rows['url'] = $rows['value'];
}
return $rows;
@@ -304,28 +373,28 @@ function add_user_history($page){
$curr = 0;
$profile = array();
for($i = 0; $i < ZBX_HISTORY_COUNT; $i++){
- if($history = get_multi_profile('web.history.'.$i,false)){
- if($history['value'] != $title){
+ if($history = get_source_profile('web.history.'.$i,false)){
+ if($history['source'] != $title){
$profile[$curr] = $history;
$curr++;
}
}
}
- $history = array('value' => $title,
- 'value2' => $url);
+ $history = array('source' => $title,
+ 'value' => $url);
if($curr < ZBX_HISTORY_COUNT){
for($i = 0; $i < $curr; $i++){
- update_multi_profile('web.history.'.$i,$profile[$i]);
+ update_profile('web.history.'.$i,$profile[$i], PROFILE_TYPE_STR);
}
- $result = update_multi_profile('web.history.'.$curr,$history);
+ $result = update_profile('web.history.'.$curr,$history, PROFILE_TYPE_STR);
}
else {
for($i = 1; $i < ZBX_HISTORY_COUNT; $i++){
- update_multi_profile('web.history.'.($i-1),$profile[$i]);
+ update_profile('web.history.'.($i-1),$profile[$i], PROFILE_TYPE_STR);
}
- $result = update_multi_profile('web.history.'.(ZBX_HISTORY_COUNT-1),$history);
+ $result = update_profile('web.history.'.(ZBX_HISTORY_COUNT-1),$history, PROFILE_TYPE_STR);
}
return $result;
@@ -335,7 +404,7 @@ return $result;
/********** USER FAVORITES ***********/
// Author: Aly
function get_favorites($favobj,$nodeid=null){
- $fav = get_multi_profile($favobj);
+ $fav = get_source_profile($favobj);
if(is_null($nodeid))
$nodeid = get_current_nodeid();
@@ -355,7 +424,7 @@ function add2favorites($favobj,$favid,$source=null){
$favorites[] = array('value' => $favid);
- $result = update_multi_profile($favobj,$favorites,PROFILE_TYPE_MULTI_ARRAY,$source);
+ $result = update_profile($favobj,$favorites,null,null,$source);
return $result;
}
@@ -376,7 +445,7 @@ function rm4favorites($favobj,$favid,$favcnt=null,$source=null){
$favcnt--;
}
- $result = update_multi_profile($favobj,$favorites,PROFILE_TYPE_MULTI_ARRAY);
+ $result = update_profile($favobj,$favorites);
return $result;
}
diff --git a/frontends/php/items.php b/frontends/php/items.php
index aa1992d7..383f69dd 100644
--- a/frontends/php/items.php
+++ b/frontends/php/items.php
@@ -174,7 +174,7 @@ include_once "include/page_header.php";
/* AJAX */
if(isset($_REQUEST['favobj'])){
if('filter' == $_REQUEST['favobj']){
- update_profile('web.items.filter.state',$_REQUEST['state']);
+ update_profile('web.items.filter.state',$_REQUEST['state'], PROFILE_TYPE_INT);
}
}
@@ -186,10 +186,10 @@ include_once "include/page_header.php";
/* FILTER */
if(isset($_REQUEST['filter_set']))
- update_profile('web.items.filter.enabled',1);
+ update_profile('web.items.filter.enabled',1, PROFILE_TYPE_INT);
if(isset($_REQUEST['filter_rst']))
- update_profile('web.items.filter.enabled',0);
+ update_profile('web.items.filter.enabled',0, PROFILE_TYPE_INT);
$filter_enabled = get_profile('web.items.filter.enabled',0);
@@ -261,32 +261,32 @@ include_once "include/page_header.php";
}
if(isset($_REQUEST['filter_set']) || isset($_REQUEST['filter_rst']) || ($prev_selection_mode != $_REQUEST['selection_mode'])){
- update_profile('web.items.filter.selection_mode' , $_REQUEST['selection_mode']);
+ update_profile('web.items.filter.selection_mode' , $_REQUEST['selection_mode'], PROFILE_TYPE_STR);
- update_profile('web.items.filter.node' , $_REQUEST['filter_node']);
- update_profile('web.items.filter.group' , $_REQUEST['filter_group']);
- update_profile('web.items.filter.host' , $_REQUEST['filter_host']);
- update_profile('web.items.filter.application' , $_REQUEST['filter_application']);
- update_profile('web.items.filter.description' , $_REQUEST['filter_description']);
- update_profile('web.items.filter.type' , $_REQUEST['filter_type']);
- update_profile('web.items.filter.key' , $_REQUEST['filter_key']);
- update_profile('web.items.filter.snmp_community' , $_REQUEST['filter_snmp_community']);
- update_profile('web.items.filter.snmp_oid' , $_REQUEST['filter_snmp_oid']);
- update_profile('web.items.filter.snmp_port' , $_REQUEST['filter_snmp_port']);
- update_profile('web.items.filter.snmpv3_securityname' , $_REQUEST['filter_snmpv3_securityname']);
- update_profile('web.items.filter.snmpv3_securitylevel' , $_REQUEST['filter_snmpv3_securitylevel']);
- update_profile('web.items.filter.snmpv3_authpassphrase', $_REQUEST['filter_snmpv3_authpassphrase']);
- update_profile('web.items.filter.snmpv3_privpassphrase', $_REQUEST['filter_snmpv3_privpassphrase']);
- update_profile('web.items.filter.value_type' , $_REQUEST['filter_value_type']);
- update_profile('web.items.filter.units' , $_REQUEST['filter_units']);
- update_profile('web.items.filter.formula' , $_REQUEST['filter_formula']);
- update_profile('web.items.filter.delay' , $_REQUEST['filter_delay']);
- update_profile('web.items.filter.history' , $_REQUEST['filter_history']);
- update_profile('web.items.filter.trends' , $_REQUEST['filter_trends']);
- update_profile('web.items.filter.status' , $_REQUEST['filter_status']);
- update_profile('web.items.filter.logtimefmt' , $_REQUEST['filter_logtimefmt']);
- update_profile('web.items.filter.delta' , $_REQUEST['filter_delta']);
- update_profile('web.items.filter.trapper_hosts' , $_REQUEST['filter_trapper_hosts']);
+ update_profile('web.items.filter.node' , $_REQUEST['filter_node'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.group' , $_REQUEST['filter_group'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.host' , $_REQUEST['filter_host'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.application' , $_REQUEST['filter_application'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.description' , $_REQUEST['filter_description'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.type' , $_REQUEST['filter_type'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.key' , $_REQUEST['filter_key'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.snmp_community' , $_REQUEST['filter_snmp_community'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.snmp_oid' , $_REQUEST['filter_snmp_oid'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.snmp_port' , $_REQUEST['filter_snmp_port'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.snmpv3_securityname' , $_REQUEST['filter_snmpv3_securityname'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.snmpv3_securitylevel' , $_REQUEST['filter_snmpv3_securitylevel'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.snmpv3_authpassphrase', $_REQUEST['filter_snmpv3_authpassphrase'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.snmpv3_privpassphrase', $_REQUEST['filter_snmpv3_privpassphrase'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.value_type' , $_REQUEST['filter_value_type'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.units' , $_REQUEST['filter_units'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.formula' , $_REQUEST['filter_formula'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.delay' , $_REQUEST['filter_delay'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.history' , $_REQUEST['filter_history'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.trends' , $_REQUEST['filter_trends'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.status' , $_REQUEST['filter_status'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.logtimefmt' , $_REQUEST['filter_logtimefmt'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.delta' , $_REQUEST['filter_delta'], PROFILE_TYPE_STR);
+ update_profile('web.items.filter.trapper_hosts' , $_REQUEST['filter_trapper_hosts'], PROFILE_TYPE_STR);
}
if(!empty($_REQUEST['filter_hostid'])) $_REQUEST['hostid'] = $_REQUEST['filter_hostid'];
@@ -301,7 +301,7 @@ include_once "include/page_header.php";
validate_group_with_host(PERM_READ_WRITE,array('always_select_first_host','only_current_node'),'web.last.conf.groupid', 'web.last.conf.hostid');
- update_profile('web.items.showdisabled',$showdisabled);
+ update_profile('web.items.showdisabled',$showdisabled, PROFILE_TYPE_INT);
?>
<?php
$result = 0;
diff --git a/frontends/php/latest.php b/frontends/php/latest.php
index 79331fc7..8ccf0f6f 100644
--- a/frontends/php/latest.php
+++ b/frontends/php/latest.php
@@ -72,9 +72,9 @@ include_once "include/page_header.php";
$_REQUEST['select'] = get_request('select','');
$_REQUEST['groupbyapp'] = get_request('groupbyapp',get_profile('web.latest.groupbyapp',1));
- update_profile('web.latest.groupbyapp',$_REQUEST['groupbyapp']);
+ update_profile('web.latest.groupbyapp',$_REQUEST['groupbyapp'],PROFILE_TYPE_INT);
- $_REQUEST['applications'] = get_request('applications',get_profile('web.latest.applications',array()),PROFILE_TYPE_ARRAY);
+ $_REQUEST['applications'] = get_request('applications',get_profile('web.latest.applications',array(),PROFILE_TYPE_ARRAY_ID));
if(isset($_REQUEST['open'])){
if(!isset($_REQUEST['applicationid'])){
@@ -100,8 +100,7 @@ include_once "include/page_header.php";
array_shift($_REQUEST['applications']);
}
-
- update_profile('web.latest.applications',$_REQUEST['applications'],PROFILE_TYPE_ARRAY);
+ update_profile('web.latest.applications',$_REQUEST['applications'],PROFILE_TYPE_ARRAY_ID);
?>
<?php
$r_form = new CForm();
diff --git a/frontends/php/nodes.php b/frontends/php/nodes.php
index 158e5ac4..6dc12b4b 100644
--- a/frontends/php/nodes.php
+++ b/frontends/php/nodes.php
@@ -57,7 +57,7 @@ include_once "include/page_header.php";
check_fields($fields);
validate_sort_and_sortorder();
- $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,PERM_RES_IDS_ARRAY, get_current_nodeid(true));
+ $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,PERM_RES_IDS_ARRAY);
if (0 == count($available_nodes) ){
access_deny();
@@ -110,7 +110,7 @@ include_once "include/page_header.php";
}
?>
<?php
- $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,null, get_current_nodeid(true));
+ $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST);
if(isset($_REQUEST["form"])){
insert_node_form();
diff --git a/frontends/php/overview.php b/frontends/php/overview.php
index 8cea9dbe..26ff1b0e 100644
--- a/frontends/php/overview.php
+++ b/frontends/php/overview.php
@@ -48,7 +48,7 @@ if(isset($_REQUEST["select"])&&($_REQUEST["select"]!="")){
check_fields($fields);
$_REQUEST['view_style'] = get_request('view_style',get_profile('web.overview.view.style',STYLE_TOP));
- update_profile('web.overview.view.style',$_REQUEST['view_style']);
+ update_profile('web.overview.view.style',$_REQUEST['view_style'],PROFILE_TYPE_INT);
$options = array('allow_all_hosts','monitored_hosts','with_monitored_items');
@@ -61,7 +61,7 @@ if(isset($_REQUEST["select"])&&($_REQUEST["select"]!="")){
validate_group(PERM_READ_ONLY,$options,'web.overview.groupid');
$_REQUEST["type"] = get_request("type",get_profile("web.overview.type",SHOW_TRIGGERS));
- update_profile("web.overview.type",$_REQUEST["type"]);
+ update_profile("web.overview.type",$_REQUEST["type"],PROFILE_TYPE_INT);
$form = new CForm();
$form->SetMethod('get');
diff --git a/frontends/php/popup.php b/frontends/php/popup.php
index b32d5b6a..5153eb10 100644
--- a/frontends/php/popup.php
+++ b/frontends/php/popup.php
@@ -189,14 +189,12 @@ include_once "include/page_header.php";
<?php
global $USER_DETAILS;
- if($min_user_type > $USER_DETAILS['type'])
- {
+ if($min_user_type > $USER_DETAILS['type']){
access_deny();
}
?>
<?php
- function get_window_opener($frame, $field, $value)
- {
+ function get_window_opener($frame, $field, $value){
// return empty($field) ? "" : "window.opener.document.forms['".addslashes($frame)."'].elements['".addslashes($field)."'].value='".addslashes($value)."';";
if(empty($field)) return '';
@@ -228,8 +226,7 @@ include_once "include/page_header.php";
if(isset($_REQUEST['reference']))
$frmTitle->AddVar("reference", $_REQUEST['reference']);
- if(isset($only_hostid))
- {
+ if(isset($only_hostid)){
$_REQUEST['hostid'] = $only_hostid;
$frmTitle->AddVar("only_hostid",$only_hostid);
unset($_REQUEST["groupid"],$_REQUEST["nodeid"]);
@@ -251,12 +248,11 @@ include_once "include/page_header.php";
validate_group(PERM_READ_LIST,$validation_param);
}
- $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,null,get_current_nodeid(true));
- $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_RES_IDS_ARRAY);
- $nodeid = get_current_nodeid();
+ $nodeid = get_request('nodeid', get_current_nodeid());
+ $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,PERM_RES_IDS_ARRAY);
+ $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_RES_IDS_ARRAY,$nodeid);
- if(isset($only_hostid))
- {
+ if(isset($only_hostid)){
if(!isset($_REQUEST["hostid"]) || (bccomp($_REQUEST["hostid"], $only_hostid) != 0)) access_deny();
$hostid = $only_hostid;
}
@@ -266,9 +262,8 @@ include_once "include/page_header.php";
'sysmaps','plain_text','screens2','overview','host_group_scr')))
{
if(ZBX_DISTRIBUTED){
- $nodeid = get_request('nodeid', $nodeid);
$cmbNode = new CComboBox('nodeid', $nodeid, 'submit()');
- $db_nodes = DBselect('select * from nodes where nodeid in ('.$available_nodes.')');
+ $db_nodes = DBselect('SELECT * FROM nodes WHERE '.DBcondition('nodeid',$available_nodes));
while($node_data = DBfetch($db_nodes)){
$cmbNode->AddItem($node_data['nodeid'], $node_data['name']);
@@ -529,7 +524,7 @@ include_once "include/page_header.php";
}
else if(str_in_array($srctbl,array("host_group")))
{
- $available_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY);
+ $available_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY,null,$nodeid);
$table = new CTableInfo(S_NO_GROUPS_DEFINED);
$table->SetHeader(array(S_NAME));
@@ -682,7 +677,7 @@ include_once "include/page_header.php";
$table->Show();
}
else if($srctbl == "triggers"){
- $available_triggers = get_accessible_triggers(PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid());
+ $available_triggers = get_accessible_triggers(PERM_READ_ONLY, PERM_RES_IDS_ARRAY, $nodeid);
$table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
$table->SetHeader(array(
@@ -940,15 +935,13 @@ include_once "include/page_header.php";
S_GRAPH_TYPE
));
- $available_graphs = get_accessible_graphs(PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid());
-
+ $available_graphs = get_accessible_graphs(PERM_READ_ONLY, PERM_RES_IDS_ARRAY, $nodeid);
$sql = 'SELECT DISTINCT g.graphid,g.name,g.graphtype,h.host '.
' FROM graphs g,graphs_items gi,items i,hosts h '.
' WHERE gi.graphid=g.graphid '.
' AND i.itemid=gi.itemid '.
' AND h.hostid=i.hostid '.
' AND h.status='.HOST_STATUS_MONITORED.
- ' AND '.DBin_node('g.graphid').
' AND '.DBcondition('g.graphid',$available_graphs);
if(isset($hostid))
diff --git a/frontends/php/popup_right.php b/frontends/php/popup_right.php
index ff403f5e..e952b813 100644
--- a/frontends/php/popup_right.php
+++ b/frontends/php/popup_right.php
@@ -34,19 +34,16 @@ include_once "include/page_header.php";
$fields=array(
"dstfrm"=> array(T_ZBX_STR, O_MAND,P_SYS, NOT_EMPTY, NULL),
"permission"=> array(T_ZBX_INT, O_MAND,P_SYS, IN(PERM_DENY.','.PERM_READ_ONLY.','.PERM_READ_WRITE), NULL),
-// "type"=> array(T_ZBX_INT, O_OPT, P_SYS, IN(RESOURCE_TYPE_GROUP.(ZBX_DISTRIBUTED ? ','.RESOURCE_TYPE_NODE : '')), NULL),
'nodeid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL),
-
);
check_fields($fields);
$dstfrm = get_request("dstfrm", 0); // destination form
$permission = get_request("permission", PERM_DENY); // right
- $type = get_request("type", RESOURCE_TYPE_GROUP); // type of resource
- $nodeid = get_request('nodeid', get_current_nodeid(false));
+ $nodeid = get_request('nodeid', get_profile('web.popup_right.nodeid.last',get_current_nodeid(false)));
- update_profile('web.right_type.last', $type);
+ update_profile('web.popup_right.nodeid.last', $nodeid);
?>
<script language="JavaScript" type="text/javascript">
<!--
diff --git a/frontends/php/report2.php b/frontends/php/report2.php
index cf338762..0853cd3c 100644
--- a/frontends/php/report2.php
+++ b/frontends/php/report2.php
@@ -62,7 +62,7 @@ include_once 'include/page_header.php';
/* AJAX */
if(isset($_REQUEST['favobj'])){
if('filter' == $_REQUEST['favobj']){
- update_profile('web.avail_report.filter.state',$_REQUEST['state']);
+ update_profile('web.avail_report.filter.state',$_REQUEST['state'], PROFILE_TYPE_INT);
}
}
@@ -87,13 +87,13 @@ include_once 'include/page_header.php';
}
if(isset($_REQUEST['filter_set']) || isset($_REQUEST['filter_rst'])){
- update_profile('web.avail_report.filter.timesince',$_REQUEST['filter_timesince']);
- update_profile('web.avail_report.filter.timetill',$_REQUEST['filter_timetill']);
+ update_profile('web.avail_report.filter.timesince',$_REQUEST['filter_timesince'], PROFILE_TYPE_INT);
+ update_profile('web.avail_report.filter.timetill',$_REQUEST['filter_timetill'], PROFILE_TYPE_INT);
}
// --------------
$config = get_request('config',get_profile('web.avail_report.config',0));
- update_profile('web.avail_report.config',$config);
+ update_profile('web.avail_report.config',$config, PROFILE_TYPE_INT);
$options = array('allow_all_hosts','always_select_first_host','with_items');
diff --git a/frontends/php/screenconf.php b/frontends/php/screenconf.php
index defcb9d1..989fe681 100644
--- a/frontends/php/screenconf.php
+++ b/frontends/php/screenconf.php
@@ -71,7 +71,7 @@ include_once "include/page_header.php";
$config = $_REQUEST['config'] = get_request('config', 0);
- update_profile('web.screenconf.config', $_REQUEST['config']);
+ update_profile('web.screenconf.config', $_REQUEST['config'],PROFILE_TYPE_INT);
?>
<?php
if( 0 == $config ){
@@ -92,7 +92,7 @@ include_once "include/page_header.php";
show_messages($result, S_SCREEN_UPDATED, S_CANNOT_UPDATE_SCREEN);
}
else {
- if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_MODE_LT,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
DBstart();
diff --git a/frontends/php/screens.php b/frontends/php/screens.php
index 83f7aee4..5e731b3a 100644
--- a/frontends/php/screens.php
+++ b/frontends/php/screens.php
@@ -101,16 +101,16 @@ include_once "include/page_header.php";
$config = $_REQUEST['config'] = get_request('config', 0);
if( 2 != $_REQUEST["fullscreen"] )
- update_profile('web.screens.config', $_REQUEST['config']);
+ update_profile('web.screens.config', $_REQUEST['config'],PROFILE_TYPE_INT);
$_REQUEST["elementid"] = get_request("elementid",get_profile("web.screens.elementid", null));
if( 2 != $_REQUEST["fullscreen"] )
update_profile("web.screens.elementid",$_REQUEST["elementid"]);
- $_REQUEST["period"] = get_request('period',get_profile('web.screens'.$_REQUEST['elementid'].'.period', ZBX_PERIOD_DEFAULT));
+ $_REQUEST["period"] = get_request('period',get_profile('web.screens.period', ZBX_PERIOD_DEFAULT, null, $_REQUEST['elementid']));
if($_REQUEST["period"] >= ZBX_MIN_PERIOD){
- update_profile('web.screens'.$_REQUEST['elementid'].'.period',$_REQUEST['period']);
+ update_profile('web.screens.period',$_REQUEST['period'], PROFILE_TYPE_INT, $_REQUEST['elementid']);
}
?>
<?php
diff --git a/frontends/php/services.php b/frontends/php/services.php
index ab9bcd13..ad888b78 100644
--- a/frontends/php/services.php
+++ b/frontends/php/services.php
@@ -49,7 +49,7 @@ include_once "include/page_header.php";
/* AJAX */
if(isset($_REQUEST['favobj'])){
if('hat' == $_REQUEST['favobj']){
- update_profile('web.services.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state']);
+ update_profile('web.services.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state'],PROFILE_TYPE_INT);
}
}
diff --git a/frontends/php/srv_status.php b/frontends/php/srv_status.php
index 0979d426..8a0e6d65 100644
--- a/frontends/php/srv_status.php
+++ b/frontends/php/srv_status.php
@@ -50,7 +50,7 @@ include_once "include/page_header.php";
/* AJAX */
if(isset($_REQUEST['favobj'])){
if('hat' == $_REQUEST['favobj']){
- update_profile('web.srv_status.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state']);
+ update_profile('web.srv_status.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state'],PROFILE_TYPE_INT);
}
}
diff --git a/frontends/php/sysmaps.php b/frontends/php/sysmaps.php
index 7368239e..d685db3b 100644
--- a/frontends/php/sysmaps.php
+++ b/frontends/php/sysmaps.php
@@ -76,7 +76,7 @@ include_once "include/page_header.php";
show_messages($result,"Network map updated","Cannot update network map");
}
else {
- if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ if(!count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY)))
access_deny();
DBstart();
diff --git a/frontends/php/tr_events.php b/frontends/php/tr_events.php
index 09369ecd..360c3566 100644
--- a/frontends/php/tr_events.php
+++ b/frontends/php/tr_events.php
@@ -59,7 +59,7 @@
/* AJAX */
if(isset($_REQUEST['favobj'])){
if('hat' == $_REQUEST['favobj']){
- update_profile('web.tr_events.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state']);
+ update_profile('web.tr_events.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state'],PROFILE_TYPE_INT);
}
}
diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php
index 68f4f2f5..61f3844e 100644
--- a/frontends/php/tr_status.php
+++ b/frontends/php/tr_status.php
@@ -120,11 +120,11 @@ include_once "include/page_header.php";
validate_group_with_host(PERM_READ_ONLY,$options,'web.tr_status.groupid','web.tr_status.hostid');
- update_profile('web.tr_status.show_triggers',$_REQUEST['show_triggers']);
- update_profile('web.tr_status.show_events',$_REQUEST['show_events']);
+ update_profile('web.tr_status.show_triggers',$_REQUEST['show_triggers'], PROFILE_TYPE_INT);
+ update_profile('web.tr_status.show_events',$_REQUEST['show_events'], PROFILE_TYPE_INT);
- update_profile('web.tr_status.noactions',$_REQUEST['noactions']);
- update_profile('web.tr_status.compact',$_REQUEST['compact']);
+ update_profile('web.tr_status.noactions',$_REQUEST['noactions'], PROFILE_TYPE_STR);
+ update_profile('web.tr_status.compact',$_REQUEST['compact'], PROFILE_TYPE_STR);
$config=select_config();
diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php
index 60f12b27..703323b7 100644
--- a/frontends/php/triggers.php
+++ b/frontends/php/triggers.php
@@ -94,7 +94,7 @@ include_once "include/page_header.php";
'web.last.conf.groupid', 'web.last.conf.hostid');
?>
<?php
- update_profile('web.triggers.showdisabled',$showdisabled);
+ update_profile('web.triggers.showdisabled',$showdisabled,PROFILE_TYPE_INT);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY);
diff --git a/frontends/php/users.php b/frontends/php/users.php
index 3eccdae2..5643ba57 100644
--- a/frontends/php/users.php
+++ b/frontends/php/users.php
@@ -35,7 +35,7 @@ include_once "include/page_header.php";
?>
<?php
$_REQUEST["config"]=get_request("config",get_profile("web.users.config",0));
- update_profile("web.users.config",$_REQUEST["config"]);
+ update_profile("web.users.config",$_REQUEST["config"],PROFILE_TYPE_INT);
?>
<?php
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION