[icinga-checkins] icinga.org: icinga-web/jmosshammer/default: * Fixed sql-issue in status-summary and missing quoting in legacy filter

git at icinga.org git at icinga.org
Mon Aug 22 09:51:19 CEST 2011


Module: icinga-web
Branch: jmosshammer/default
Commit: 7f0d70c0167a5300e196ff1e30e5de8c41873554
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=7f0d70c0167a5300e196ff1e30e5de8c41873554

Author: root <root at linux-7kv8.site>
Date:   Sun Aug 21 18:08:59 2011 +0200

* Fixed sql-issue in status-summary and missing quoting in legacy filter

---

 .../legacylib/filter/IcingaApiSearchFilterIdo.php  |    2 +-
 .../LegacyLayer/TargetModifierModel.class.php      |    9 ++++++++-
 .../System/MonitorPerformanceDataModel.class.php   |   12 ++++--------
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/app/modules/Api/lib/legacylib/filter/IcingaApiSearchFilterIdo.php b/app/modules/Api/lib/legacylib/filter/IcingaApiSearchFilterIdo.php
index 81e415c..c55a430 100644
--- a/app/modules/Api/lib/legacylib/filter/IcingaApiSearchFilterIdo.php
+++ b/app/modules/Api/lib/legacylib/filter/IcingaApiSearchFilterIdo.php
@@ -26,7 +26,7 @@ class IcingaApiSearchFilterIdo extends IcingaApiSearchFilter {
         if ($match == IcingaApiConstants::MATCH_LIKE || $match == IcingaApiConstants::MATCH_NOT_LIKE) {
             $value = str_replace("*","%",$value);
         }
-
+        $value = preg_replace("/'/","\'",$value);
         $field = preg_replace("/(.*?) +AS +.+ */i","$1",$field);
 
         $statementSkeleton = $field." ".$match." '".$value."' ";
diff --git a/app/modules/Api/models/Store/LegacyLayer/TargetModifierModel.class.php b/app/modules/Api/models/Store/LegacyLayer/TargetModifierModel.class.php
index 8f1b3d7..c5758d1 100644
--- a/app/modules/Api/models/Store/LegacyLayer/TargetModifierModel.class.php
+++ b/app/modules/Api/models/Store/LegacyLayer/TargetModifierModel.class.php
@@ -8,6 +8,9 @@ class Api_Store_LegacyLayer_TargetModifierModel extends IcingaStoreTargetModifie
             return $alias;
         }
     }
+    
+    protected $ignoreIds = false;
+    
     public $columns = array(
                           'PROBLEMS_OBJECT_ID'           =>        'op.object_id',
                           // Program information
@@ -321,6 +324,10 @@ class Api_Store_LegacyLayer_TargetModifierModel extends IcingaStoreTargetModifie
         parent::reset();
     }
 
+    public function setIgnoreIds($boolean) {
+        $this->ignoreIds = $boolean;
+    }
+    
     /**
     * @deprecated
     * Takes depracted icinga_api target names and sets up this modifier
@@ -871,7 +878,7 @@ class Api_Store_LegacyLayer_TargetModifierModel extends IcingaStoreTargetModifie
 
         $this->addStaticWhereField($statement/*,$searchAggregator*/);
     }
-    protected $ignoreIds = false;
+
     protected function modifyImpl(Doctrine_Query &$o) {
         if (!$this->ignoreIds) {
             $table = $o->getConnection()->getTable($this->getTarget());
diff --git a/app/modules/Cronks/models/System/MonitorPerformanceDataModel.class.php b/app/modules/Cronks/models/System/MonitorPerformanceDataModel.class.php
index 92e8e0e..be81b8b 100644
--- a/app/modules/Cronks/models/System/MonitorPerformanceDataModel.class.php
+++ b/app/modules/Cronks/models/System/MonitorPerformanceDataModel.class.php
@@ -82,7 +82,7 @@ class Cronks_System_MonitorPerformanceDataModel extends CronksBaseModel {
                        ->setSearchTarget($source[0])
                        ->setResultColumns($source[1]);
                 IcingaPrincipalTargetTool::applyApiSecurityPrincipals($res);
-
+                $res->setIgnoreIds(true);
                 if (isset($source[2])) {
                     $res->setSearchType($source[2]);
                 }
@@ -91,13 +91,9 @@ class Cronks_System_MonitorPerformanceDataModel extends CronksBaseModel {
                     $res->setSearchFilter($source[3]);
                 }
 
-
-                $arr = $res->fetch()->getRow();
-
-                if (!$arr) {
-                    continue;
-                }
-
+                
+                $arr = $res->fetch()->getRow();       
+             
                 foreach($arr as $key=>$value) {
 
                     if (isset($source[4])) {





More information about the icinga-checkins mailing list