Skip to content
Snippets Groups Projects
Commit 37d1e867 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: include external image link is impossible

parent edb17906
No related branches found
No related tags found
No related merge requests found
...@@ -975,30 +975,31 @@ class CMailFile ...@@ -975,30 +975,31 @@ class CMailFile
$i=0; $i=0;
foreach ($matches[1] as $full) foreach ($matches[1] as $full)
{ {
preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs); if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs))
$img = $regs[1];
if (file_exists($images_dir.'/'.$img))
{ {
// Image path in src $img = $regs[1];
$src = preg_quote($full,'/');
if (file_exists($images_dir.'/'.$img))
// Image full path {
$this->html_images[$i]["fullpath"] = $images_dir.'/'.$img; // Image path in src
$src = preg_quote($full,'/');
// Image name
$this->html_images[$i]["name"] = $img; // Image full path
$this->html_images[$i]["fullpath"] = $images_dir.'/'.$img;
// Content type
$ext = preg_replace('/^.*\.(\w{3,4})$/e', 'strtolower("$1")', $img); // Image name
$this->html_images[$i]["content_type"] = $this->image_types[$ext]; $this->html_images[$i]["name"] = $img;
// cid // Content type
$this->html_images[$i]["cid"] = md5(uniqid(time())); $ext = preg_replace('/^.*\.(\w{3,4})$/e', 'strtolower("$1")', $img);
$this->html_images[$i]["content_type"] = $this->image_types[$ext];
$this->html = preg_replace("/src=\"$src\"|src='$src'/i", "src=\"cid:".$this->html_images[$i]["cid"]."\"", $this->html);
// cid
$this->html_images[$i]["cid"] = md5(uniqid(time()));
$this->html = preg_replace("/src=\"$src\"|src='$src'/i", "src=\"cid:".$this->html_images[$i]["cid"]."\"", $this->html);
}
$i++;
} }
$i++;
} }
if (!empty($this->html_images)) if (!empty($this->html_images))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment