[Hastymail-cvs] SF.net SVN: hastymail:[1444] trunk/hastymail2/lib/misc_functions.php
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2010-04-23 00:41:27
|
Revision: 1444 http://hastymail.svn.sourceforge.net/hastymail/?rev=1444&view=rev Author: sailfrog Date: 2010-04-23 00:41:21 +0000 (Fri, 23 Apr 2010) Log Message: ----------- better inline image support for HTML messages (support background and src attributes instead of just src) Modified Paths: -------------- trunk/hastymail2/lib/misc_functions.php Modified: trunk/hastymail2/lib/misc_functions.php =================================================================== --- trunk/hastymail2/lib/misc_functions.php 2010-04-22 22:50:11 UTC (rev 1443) +++ trunk/hastymail2/lib/misc_functions.php 2010-04-23 00:41:21 UTC (rev 1444) @@ -646,13 +646,14 @@ function prep_html_part($string, $uid, $mailbox, $image_replace=false, $override=false) { global $user; global $sticky_url; - $regex = "/src=(\"|'|)cid:([^@]+)@[^ ]+(\"|'|)/im"; - $regex2 = "/src=(\"|'|)cid:([^'\"\s]+)(\"|'|)/im"; + $regex = "/(background|src)=(\"|'|)cid:([^@]+)@[^ ]+(\"|'|)/im"; + $regex2 = "/(background|src)=(\"|'|)cid:([^'\"\s]+)(\"|'|)/im"; if (preg_match_all($regex, $string, $matches) || preg_match_all($regex2, $string, $matches)) { $locations = $matches[0]; - $filenames = $matches[2]; + $types = $matches[1]; + $filenames = $matches[3]; foreach ($locations as $i => $v) { - $string = str_replace($v, 'src="?page=inline_image&mailbox='.urlencode($mailbox). + $string = str_replace($v, $types[$i].'="?page=inline_image&mailbox='.urlencode($mailbox). '&uid='.$uid.'&filename='.urlencode($filenames[$i]).'" alt="'. $user->htmlsafe($filenames[$i]).'" ', $string); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |