Merge branch 'master' into wip_leon_T7330_logo_uploader_padding
[Pman.Core] / Images.php
index 327fa8c..eff84f5 100644 (file)
@@ -85,7 +85,7 @@ class Pman_Core_Images extends Pman
         //if (!empty($_GET['_post'])) {
         //   return $this->post();
         //}
-        
+
         $this->is_local = (!empty($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'localhost') ? true : false;
         
         $this->as_mimetype = empty($_REQUEST['as']) ? '' : $_REQUEST['as'];
@@ -183,7 +183,7 @@ class Pman_Core_Images extends Pman
         
         $img = DB_DataObjecT::factory('Images');
          
-        if (!$id || !$img->get($id)) {
+        if (!$id || !$img->get($id) || !$img->exists()) {
             $this->imgErr("image has been removed or deleted.",$s);
         }
         
@@ -283,7 +283,6 @@ class Pman_Core_Images extends Pman
     function serve($img)
     {
         $this->sessionState(0); // turn off session... - locking...
-        
         require_once 'File/Convert.php';
         if (!file_exists($img->getStoreName())) {
 //            print_r($img);exit;
@@ -468,10 +467,10 @@ class Pman_Core_Images extends Pman
     {
         $url = $dom;
         if (!is_string($url)) {
-            $url = $dom->getAttribute($src);
+            $url = $dom->getAttribute('src');
         }
          $umatch  = false;
-        if(!preg_match('#/(Images|Images/Thumb/[a-z0-9]+|Images/Download)/([0-9]+)/(.*)$#', $attr_url, $umatch))  {
+        if(!preg_match('#/(Images|Images/Thumb/[a-z0-9]+|Images/Download)/([0-9]+)/(.*)$#', $url, $umatch))  {
             return $url;
         }
         $id = $umatch[2];