DataObjects/Images.php
[Pman.Core] / DataObjects / Images.php
index 15a9101..1250f51 100644 (file)
@@ -29,6 +29,18 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
     
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
+    function applyFilters($q, $au, $roo)
+    {
+        $tn = $this->tableName();
+        
+        if(!empty($q['search']['filename'])){
+            $this->whereAdd("
+                $tn.filename LIKE '%{$this->escape($q['search']['filename'])}%' OR $tn.title LIKE '%{$this->escape($q['search']['filename'])}%'
+            ");
+        }
+        
+
+    }
     
     function checkPerm($lvl, $au)
     {
@@ -743,7 +755,8 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         
         $ext = $y->toExt(trim((string) $this->mimetype ));
         
-        if(array_pop(explode('.', $this->filename)) != $ext){
+        $explode_filename = explode('.', $this->filename);
+        if(array_pop($explode_filename) != $ext){
             $this->filename = $this->filename .'.'. $ext; 
         }
         
@@ -760,7 +773,9 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         
         $this->mimetype= strtolower($this->mimetype);
         
-        if (array_shift(explode('/', $this->mimetype)) == 'image') { 
+        $explode_mimetype = explode('/', $this->mimetype);
+        
+        if (array_shift($explode_mimetype) == 'image') { 
         
             $imgs = @getimagesize($data);