diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-05-06 11:52:09 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-05-06 11:52:09 +0000 |
| commit | 26ee00a8526a15de827768c715a0fc27a4cee925 (patch) | |
| tree | e4544ad543e3d4cd1a69bc43f28aa153f44f8ebe /frontends/php/include/items.inc.php | |
| parent | 639aac687504d1c00010a4295c22f3e6fb878ffb (diff) | |
| download | zabbix-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/items.inc.php')
| -rw-r--r-- | frontends/php/include/items.inc.php | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index cc0e73c5..56e4a3f0 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -23,11 +23,9 @@ function add_item($description,$key,$hostid,$delay,$history,$status,$type,$snmp_community,$snmp_oid,$value_type,$trapper_hosts,$snmp_port,$units,$multiplier,$delta,$snmpv3_securityname,$snmpv3_securitylevel,$snmpv3_authpassphrase,$snmpv3_privpassphrase,$formula,$trends) { - global $ERROR_MSG; - if(!check_right("Item","A",0)) { - $ERROR_MSG="Insufficient permissions"; + error("Insufficient permissions"); return 0; } @@ -35,19 +33,19 @@ $result=DBexecute($sql); if(DBget_field($result,0,0)>0) { - $ERROR_MSG="An item with the same Key already exists for this host. The key must be unique."; + error("An item with the same Key already exists for this host. The key must be unique."); return 0; } if($delay<1) { - $ERROR_MSG="Delay cannot be less than 1 second"; + error("Delay cannot be less than 1 second"); return 0; } if( ($snmp_port<1)||($snmp_port>65535)) { - $ERROR_MSG="Invalid SNMP port"; + error("Invalid SNMP port"); return 0; } @@ -71,11 +69,9 @@ function update_item_status($itemid,$status) { - global $ERROR_MSG; - if(!check_right("Item","U",0)) { - $ERROR_MSG="Insufficient permissions"; + error("Insufficient permissions"); return 0; } if($status==ITEM_STATUS_ACTIVE) @@ -90,22 +86,20 @@ function update_item($itemid,$description,$key,$hostid,$delay,$history,$status,$type,$snmp_community,$snmp_oid,$value_type,$trapper_hosts,$snmp_port,$units,$multiplier,$delta,$snmpv3_securityname,$snmpv3_securitylevel,$snmpv3_authpassphrase,$snmpv3_privpassphrase,$formula,$trends) { - global $ERROR_MSG; - if(!check_right("Item","U",$itemid)) { - $ERROR_MSG="Insufficient permissions"; + error("Insufficient permissions"); return 0; } if($delay<1) { - $ERROR_MSG="Delay cannot be less than 1 second"; + error("Delay cannot be less than 1 second"); return 0; } if( ($snmp_port<1)||($snmp_port>65535)) { - $ERROR_MSG="Invalid SNMP port"; + error("Invalid SNMP port"); return 0; } @@ -218,8 +212,6 @@ function get_item_by_itemid($itemid) { - global $ERROR_MSG; - $sql="select * from items where itemid=$itemid"; $result=DBselect($sql); if(DBnum_rows($result) == 1) @@ -228,7 +220,7 @@ } else { - $ERROR_MSG="No item with itemid=[$itemid]"; + error("No item with itemid=[$itemid]"); } return $item; } |
