summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-03 08:37:04 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-03 08:37:04 +0000
commit916277f7e6ad08953f38c949b06cd71716a8b9c4 (patch)
tree9173f6881859e7af371594fb88a52c6974a7a636 /frontends/php/include
parent269993e54f1ba18adc930910d5a4ab6bac5db9e2 (diff)
downloadzabbix-916277f7e6ad08953f38c949b06cd71716a8b9c4.tar.gz
zabbix-916277f7e6ad08953f38c949b06cd71716a8b9c4.tar.xz
zabbix-916277f7e6ad08953f38c949b06cd71716a8b9c4.zip
- fixed template problem in applications (Artem)
- fixes related to compare long id's (Artem) git-svn-id: svn://svn.zabbix.com/trunk@5582 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/forms.inc.php10
-rw-r--r--frontends/php/include/hosts.inc.php30
-rw-r--r--frontends/php/include/items.inc.php4
-rw-r--r--frontends/php/include/nodes.inc.php4
-rw-r--r--frontends/php/include/profiles.inc.php4
-rw-r--r--frontends/php/include/users.inc.php2
6 files changed, 28 insertions, 26 deletions
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 043fd367..b5abd8a7 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -951,7 +951,7 @@
{
$frmUser->AddItemToBottomRow(SPACE);
$delete_b = new CButtonDelete("Delete selected user?",url_param("form").url_param("config").url_param("userid"));
- if($USER_DETAILS['userid'] == $userid){
+ if(bccomp($USER_DETAILS['userid'],$userid) == 0){
$delete_b->AddOption('disabled','disabled');
}
@@ -982,9 +982,11 @@
$gui_access = $usrgrp['gui_access'];
$group_users = array();
- $db_users=DBselect("SELECT distinct u.userid,u.alias FROM users u,users_groups ug ".
- "where u.userid=ug.userid AND ug.usrgrpid=".$_REQUEST["usrgrpid"].
- " order by alias");
+ $db_users=DBselect('SELECT distinct u.userid,u.alias '.
+ ' FROM users u,users_groups ug '.
+ ' WHERE u.userid=ug.userid '.
+ ' AND ug.usrgrpid='.$_REQUEST['usrgrpid'].
+ ' ORDER BY alias');
while($db_user=DBfetch($db_users))
$group_users[$db_user["userid"]] = $db_user['alias'];
diff --git a/frontends/php/include/hosts.inc.php b/frontends/php/include/hosts.inc.php
index 72963034..2b120406 100644
--- a/frontends/php/include/hosts.inc.php
+++ b/frontends/php/include/hosts.inc.php
@@ -65,19 +65,18 @@ require_once "include/items.inc.php";
return false;
}
- if($groupid==null)
+ if(is_null($groupid))
$result = DBselect("select * from groups where ".DBin_node('groupid')." AND name=".zbx_dbstr($name));
else
$result = DBselect("select * from groups where ".DBin_node('groupid')." AND name=".zbx_dbstr($name).
" and groupid<>$groupid");
- if(DBfetch($result))
- {
+ if(DBfetch($result)){
error("Group '$name' already exists");
return false;
}
- if($groupid==null)
- {
+
+ if(is_null($groupid)){
$groupid=get_dbid("groups","groupid");
if(!DBexecute("insert into groups (groupid,name) values (".$groupid.",".zbx_dbstr($name).")"))
return false;
@@ -90,7 +89,7 @@ require_once "include/items.inc.php";
function add_group_to_host($hostid,$newgroup="")
{
- if($newgroup == "" || $newgroup == null)
+ if(empty($newgroup))
return true;
$groupid = db_save_group($newgroup);
@@ -206,18 +205,15 @@ require_once "include/items.inc.php";
return false;
}
- if($hostid==null)
- {
+ if(is_null($hostid)){
$hostid = get_dbid("hosts","hostid");
$result = DBexecute("insert into hosts".
" (hostid,proxy_hostid,host,port,status,useip,dns,ip,disable_until,available)".
" values ($hostid,$proxy_hostid,".zbx_dbstr($host).",$port,$status,$useip,".zbx_dbstr($dns).",".zbx_dbstr($ip).",0,"
.HOST_AVAILABLE_UNKNOWN.")");
}
- else
- {
- if(check_circle_host_link($hostid, $templates))
- {
+ else{
+ if(check_circle_host_link($hostid, $templates)){
error("Circle link can't be created");
return false;
}
@@ -499,7 +495,7 @@ require_once "include/items.inc.php";
return false;
}
- if($proxyid==null)
+ if(is_null($proxyid))
$result = DBselect('select * from hosts where status in ('.HOST_STATUS_PROXY.')'.
' and '.DBin_node('hostid').' AND host='.zbx_dbstr($name));
else
@@ -512,7 +508,7 @@ require_once "include/items.inc.php";
error("Proxy '$name' already exists");
return false;
}
- if($proxyid==null)
+ if(is_null($proxyid))
{
$proxyid=get_dbid('hosts','hostid');
if(!DBexecute('insert into hosts (hostid,host,status)'.
@@ -914,18 +910,18 @@ require_once "include/items.inc.php";
return false;
}
- if($applicationid==null)
+ if(is_null($applicationid))
$result = DBselect("select * from applications where name=".zbx_dbstr($name)." and hostid=".$hostid);
else
$result = DBselect("select * from applications where name=".zbx_dbstr($name)." and hostid=".$hostid.
" and applicationid<>$applicationid");
$db_app = DBfetch($result);
- if($db_app && $templateid==0)
- {
+ if($db_app && $templateid==0){
error("Application '$name' already exists");
return false;
}
+
if($db_app && $applicationid!=null)
{ // delete old application with same name
delete_application($db_app["applicationid"]);
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php
index a1eb118f..e56eda39 100644
--- a/frontends/php/include/items.inc.php
+++ b/frontends/php/include/items.inc.php
@@ -1110,6 +1110,9 @@ COpt::profiling_stop('prepare table');
{
$housekeeperid = get_dbid('housekeeper','housekeeperid');
DBexecute("insert into housekeeper (housekeeperid,tablename,field,value)".
+ " values ($housekeeperid,'history_text','itemid',$itemid)");
+ $housekeeperid = get_dbid('housekeeper','housekeeperid');
+ DBexecute("insert into housekeeper (housekeeperid,tablename,field,value)".
" values ($housekeeperid,'history_log','itemid',$itemid)");
$housekeeperid = get_dbid('housekeeper','housekeeperid');
DBexecute("insert into housekeeper (housekeeperid,tablename,field,value)".
@@ -1123,6 +1126,7 @@ COpt::profiling_stop('prepare table');
return TRUE;
}
+ DBexecute("delete from history_text where itemid=$itemid");
DBexecute("delete from history_log where itemid=$itemid");
DBexecute("delete from history_uint where itemid=$itemid");
DBexecute("delete from history_str where itemid=$itemid");
diff --git a/frontends/php/include/nodes.inc.php b/frontends/php/include/nodes.inc.php
index 1dbd3743..10a1fcae 100644
--- a/frontends/php/include/nodes.inc.php
+++ b/frontends/php/include/nodes.inc.php
@@ -23,12 +23,12 @@
{
global $ZBX_CURMASTERID;
- if($node_data['nodeid'] == get_current_nodeid(false)) $node_type = ZBX_NODE_LOCAL;
+ if(bccomp($node_data['nodeid'],get_current_nodeid(false)) == 0) $node_type = ZBX_NODE_LOCAL;
else if(bccomp($node_data['nodeid'] ,$ZBX_CURMASTERID)==0) $node_type = ZBX_NODE_MASTER;
else if(bccomp($node_data['masterid'], get_current_nodeid(false))==0) $node_type = ZBX_NODE_REMOTE;
else $node_type = -1;
- return $node_type;
+ return $node_type;
}
function node_type2str($node_type)
diff --git a/frontends/php/include/profiles.inc.php b/frontends/php/include/profiles.inc.php
index 241fbefc..f308430e 100644
--- a/frontends/php/include/profiles.inc.php
+++ b/frontends/php/include/profiles.inc.php
@@ -205,7 +205,7 @@ function rm4favorites($favobj,$favid,$favcnt=null,$resource=null){
$favcnt = (is_null($favcnt))?0:$favcnt;
foreach($favorites as $key => $value){
- if(($favid == $value) && ($fav_rsrc[$key] == $resource)){
+ if(((bccomp($favid,$value) == 0) || ($favid == 0)) && ($fav_rsrc[$key] == $resource)){
if($favcnt < 1){
unset($favorites[$key]);
unset($fav_rsrc[$key]);
@@ -238,7 +238,7 @@ function infavorites($favobj,$favid,$resource=null){
$fav = get4favorites($favobj);
if(!empty($fav)){
foreach($fav['id'] as $id => $resourceid){
- if($favid == $resourceid){
+ if(bccomp($favid,$resourceid) == 0){
if(is_null($resource) || ($fav['resource'][$id] == $resource))
return true;
}
diff --git a/frontends/php/include/users.inc.php b/frontends/php/include/users.inc.php
index 99af8c1a..bf2b9e67 100644
--- a/frontends/php/include/users.inc.php
+++ b/frontends/php/include/users.inc.php
@@ -472,7 +472,7 @@
}
$menus=rtrim($menus,',').'),';
- if($USER_DETAILS['userid'] == $userid){
+ if(bccomp($USER_DETAILS['userid'],$userid) == 0){
$menus=rtrim($menus,',').')';
}
else{