summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/hosts.inc.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-05-06 11:52:09 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-05-06 11:52:09 +0000
commit26ee00a8526a15de827768c715a0fc27a4cee925 (patch)
treee4544ad543e3d4cd1a69bc43f28aa153f44f8ebe /frontends/php/include/hosts.inc.php
parent639aac687504d1c00010a4295c22f3e6fb878ffb (diff)
downloadzabbix-26ee00a8526a15de827768c715a0fc27a4cee925.tar.gz
zabbix-26ee00a8526a15de827768c715a0fc27a4cee925.tar.xz
zabbix-26ee00a8526a15de827768c715a0fc27a4cee925.zip
- better error reporting for GUI (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@1757 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/hosts.inc.php')
-rw-r--r--frontends/php/include/hosts.inc.php22
1 files changed, 7 insertions, 15 deletions
diff --git a/frontends/php/include/hosts.inc.php b/frontends/php/include/hosts.inc.php
index 8befe5aa..f1e399f9 100644
--- a/frontends/php/include/hosts.inc.php
+++ b/frontends/php/include/hosts.inc.php
@@ -23,17 +23,15 @@
function add_host($host,$port,$status,$useip,$ip,$host_templateid,$newgroup,$groups)
{
- global $ERROR_MSG;
-
if(!check_right("Host","A",0))
{
- $ERROR_MSG="Insufficient permissions";
+ error("Insufficient permissions");
return 0;
}
if (!eregi('^([0-9a-zA-Z\_\.-]+)$', $host, &$arr))
{
- $ERROR_MSG="Hostname should contain 0-9a-zA-Z_.- characters only";
+ error("Hostname should contain 0-9a-zA-Z_.- characters only");
return 0;
}
@@ -41,7 +39,7 @@
$result=DBexecute($sql);
if(DBnum_rows($result)>0)
{
- $ERROR_MSG="Host '$host' already exists";
+ error("Host '$host' already exists");
return 0;
}
@@ -83,17 +81,15 @@
function update_host($hostid,$host,$port,$status,$useip,$ip,$newgroup,$groups)
{
- global $ERROR_MSG;
-
if(!check_right("Host","U",$hostid))
{
- $ERROR_MSG="Insufficient permissions";
+ error("Insufficient permissions");
return 0;
}
if (!eregi('^([0-9a-zA-Z\_\.-]+)$', $host, &$arr))
{
- $ERROR_MSG="Hostname should contain 0-9a-zA-Z_.- characters only";
+ error("Hostname should contain 0-9a-zA-Z_.- characters only");
return 0;
}
@@ -101,7 +97,7 @@
$result=DBexecute($sql);
if(DBnum_rows($result)>0)
{
- $ERROR_MSG="Host '$host' already exists";
+ error("Host '$host' already exists");
return 0;
}
@@ -178,8 +174,6 @@
function delete_host_group($groupid)
{
- global $ERROR_MSG;
-
$sql="delete from hosts_groups where groupid=$groupid";
DBexecute($sql);
$sql="delete from groups where groupid=$groupid";
@@ -188,8 +182,6 @@
function get_host_by_hostid($hostid)
{
- global $ERROR_MSG;
-
$sql="select hostid,host,useip,ip,port,status from hosts where hostid=$hostid";
$result=DBselect($sql);
if(DBnum_rows($result) == 1)
@@ -203,7 +195,7 @@
}
else
{
- $ERROR_MSG="No host with hostid=[$hostid]";
+ error("No host with hostid=[$hostid]");
}
return $host;
}