summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/hosts.inc.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-10 09:34:21 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-10 09:34:21 +0000
commitfcc91decd3db84a94505ac2147be987867dcfb41 (patch)
treeec0ba6b36bf92051aca7b5fbcc4e2d4e9a792c9b /frontends/php/include/hosts.inc.php
parentd53a7572a565383d4680361388063acb0a864aaa (diff)
downloadzabbix-fcc91decd3db84a94505ac2147be987867dcfb41.tar.gz
zabbix-fcc91decd3db84a94505ac2147be987867dcfb41.tar.xz
zabbix-fcc91decd3db84a94505ac2147be987867dcfb41.zip
- merged rev. 5602:5604 of branches/1.4 (Artem) [fixed empty cells for IE]
- fixes permissions SQL for different DBs (Artem) git-svn-id: svn://svn.zabbix.com/trunk@5605 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/hosts.inc.php')
-rw-r--r--frontends/php/include/hosts.inc.php31
1 files changed, 18 insertions, 13 deletions
diff --git a/frontends/php/include/hosts.inc.php b/frontends/php/include/hosts.inc.php
index 2b120406..468b3b3e 100644
--- a/frontends/php/include/hosts.inc.php
+++ b/frontends/php/include/hosts.inc.php
@@ -195,10 +195,11 @@ require_once "include/items.inc.php";
}
- if(DBfetch(DBselect(
- "select * from hosts where host=".zbx_dbstr($host).
- ' and '.DBin_node('hostid', get_current_nodeid(false)).
- (isset($hostid) ? ' and hostid<>'.$hostid : '')
+ if(DBfetch(DBselect('SELECT h.host '.
+ ' FROM hosts h '.
+ ' WHERE h.host='.zbx_dbstr($host).
+ ' AND '.DBin_node('h.hostid', get_current_nodeid(false)).
+ (isset($hostid)?' AND h.hostid<>'.$hostid:'')
)))
{
error("Host '$host' already exists");
@@ -207,25 +208,29 @@ require_once "include/items.inc.php";
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.")");
+ $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)){
error("Circle link can't be created");
return false;
}
-
- $result = DBexecute("update hosts set proxy_hostid=$proxy_hostid,host=".zbx_dbstr($host).",".
- "port=$port,useip=$useip,dns=".zbx_dbstr($dns).",ip=".zbx_dbstr($ip)." where hostid=$hostid");
+ $result = DBexecute('UPDATE hosts SET proxy_hostid='.$proxy_hostid.
+ ',host='.zbx_dbstr($host).
+ ',port='.$port.
+ ',status='.$status.
+ ',useip='.$useip.
+ ',dns='.zbx_dbstr($dns).
+ ',ip='.zbx_dbstr($ip).
+ ' WHERE hostid='.$hostid);
update_host_status($hostid, $status);
}
- foreach($templates as $id => $name)
- {
+ foreach($templates as $id => $name){
$hosttemplateid = get_dbid('hosts_templates', 'hosttemplateid');
if(!($result = DBexecute('insert into hosts_templates values ('.$hosttemplateid.','.$hostid.','.$id.')')))
break;