summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-10 10:00:45 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-10 10:00:45 +0000
commitad748339f10a258cc566177a8c719744b1715e26 (patch)
treedcddcd8658cfa8d31c5a1f8219c28c83b4027121 /frontends/php/include
parentfcc91decd3db84a94505ac2147be987867dcfb41 (diff)
downloadzabbix-ad748339f10a258cc566177a8c719744b1715e26.tar.gz
zabbix-ad748339f10a258cc566177a8c719744b1715e26.tar.xz
zabbix-ad748339f10a258cc566177a8c719744b1715e26.zip
- [DEV-137] small improvements (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5606 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/db.inc.php24
-rw-r--r--frontends/php/include/events.inc.php2
2 files changed, 12 insertions, 14 deletions
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index 074c5b76..c62b030c 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -719,27 +719,25 @@ else {
return bcmod($id,'100000000000');
}
- function DBin_condition($fieldname, $array)
- {
+ function DBin_condition($fieldname, &$array){
global $DB_TYPE;
- $condition = $fieldname.' IN (';
+ $condition = '';
switch($DB_TYPE) {
case 'ORACLE':
$items = array_chunk($array, 1000);
- $chunks = count($items);
- for ($i = 0; $i < $chunks; $i++) {
- if ($i > 0)
- $condition .= ') OR '.$fieldname.' IN (';
- $condition .= implode(",",$items[$i]);
+ foreach($items as $id => $value){
+ $condition.=!empty($condition)?') OR '.$fieldname.' IN (':'';
+ $condition.= implode(',',$value);
}
- $condition .= ')';
- if ($chunks > 1)
- $condition = '('.$condition.')';
- return $condition;
+ break;
default:
- return $condition.implode(",",$array).')';
+ $condition = implode(',',$array);
}
+
+ if(empty($condition)) $condition = '0';
+
+ return '('.$fieldname.' IN ('.$condition.'))';
}
?>
diff --git a/frontends/php/include/events.inc.php b/frontends/php/include/events.inc.php
index 0117b878..7b450e89 100644
--- a/frontends/php/include/events.inc.php
+++ b/frontends/php/include/events.inc.php
@@ -237,7 +237,7 @@ function get_history_of_discovery_events($start,$num){
if($event_data["value"] == 0){
$value=new CCol(S_UP,"off");
}
- elseif($event_data["value"] == 1){
+ else if($event_data["value"] == 1){
$value=new CCol(S_DOWN,"on");
}
else{