DataObjects/Core_email.php
authorAlan Knowles <alan@roojs.com>
Thu, 11 Jun 2015 05:53:18 +0000 (13:53 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 11 Jun 2015 05:53:18 +0000 (13:53 +0800)
DataObjects/Core_email.php

index 278c45f..9249f38 100644 (file)
@@ -188,11 +188,16 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
         
         foreach ($xpath->query('//img[@src]') as $img) { // process images!
             $href = $img->getAttribute('src');
-            $cid = explode('-', array_pop(explode('#', $href)));
+            $hash = explode('#', $href);
             // we name all our cid's as attachment-*
+            // however the src url may be #image-*
             
             
-            if(isset($cid[1])){
+            if(!isset($hash[1])){
+                continue;
+            }
+            $cid = explode('-', $hash[1]);
+            if(!empty($cid[1])){
                 $img->setAttribute('src', 'cid:' . $cid[1]);
             }
         }