Revision: 1178
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1178&view=rev
Author:   cimorrison
Date:     2009-08-26 23:26:28 +0000 (Wed, 26 Aug 2009)

Log Message:
-----------
Fixed a bug which meant that when using periods, any HTML entities or tags in 
the period name string (which are allowed) were left as is in email 
notifications, which are sent as plain text emails.   (HTML entities are only 
replaced in PHP5 and above, to avoid any complications with lack of support for 
multi-byte character sets).

Modified Paths:
--------------
    mrbs/trunk/web/functions_mail.inc

Modified: mrbs/trunk/web/functions_mail.inc
===================================================================
--- mrbs/trunk/web/functions_mail.inc   2009-08-24 09:06:29 UTC (rev 1177)
+++ mrbs/trunk/web/functions_mail.inc   2009-08-26 23:26:28 UTC (rev 1178)
@@ -90,9 +90,22 @@
   $p_num = $time['minutes'] + $mod_time;
   ( $p_num < 0 ) ? $p_num = 0 : '';
   ( $p_num >= count($periods) - 1 ) ? $p_num = count($periods ) - 1 : '';
-  // I have made the separater a ',' as a '-' leads to an ambiguious
+  // I have made the separator a ',' as a '-' leads to an ambiguous
   // display in report.php when showing end times.
-  return array($p_num, $periods[$p_num] . strftime(", %A %d %B %Y",$t));
+  
+  // As HTML entities and tags are allowed in period names, we need to 
replace/strip
+  // them out before putting them in emails, which are sent as plain text
+  $mailperiod = $periods[$p_num];
+  // Although html_entity_decode() was introduced in PHP 4.3.0, support for
+  // multi-byte character sets was only introduced in PHP 5.0.0.   So rather 
than
+  // trying to do anything complicated for PHP 4, we'll just do the decode if
+  // we're running PHP 5 or higher.   Sorry, PHP 4 users!
+  if (function_exists('version_compare') && version_compare(PHP_VERSION, 
'5.0.0', 'ge') === 1)
+  {
+    $mailperiod = html_entity_decode($mailperiod, ENT_COMPAT, 
get_mail_charset());
+  }
+  $mailperiod = strip_tags($mailperiod);
+  return array($p_num, $mailperiod . strftime(", %A %d %B %Y",$t));
 }
 
 // }}}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to