Revision: 1082
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1082&view=rev
Author:   cimorrison
Date:     2009-04-01 13:55:22 +0000 (Wed, 01 Apr 2009)

Log Message:
-----------
Fixed problem with recent change to nl2br calls.   The optional second 
parameter to nl2br is only available from PHP 5.3.0 onwards, so implemented 
mrbs_nl2br which takes account of this.

Modified Paths:
--------------
    mrbs/trunk/web/functions.inc
    mrbs/trunk/web/report.php
    mrbs/trunk/web/view_entry.php

Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc        2009-04-01 12:58:57 UTC (rev 1081)
+++ mrbs/trunk/web/functions.inc        2009-04-01 13:55:22 UTC (rev 1082)
@@ -645,6 +645,20 @@
   }
 }
 
+// version of the standard PHP function nl2br that takes account of the fact
+// that the optional second parameter is only available from PHP 5.3.0 onwards.
+function mrbs_nl2br($string)
+{
+  if (function_exists('version_compare') && version_compare(PHP_VERSION, 
'5.3.0', 'ge') === 1)
+  {
+    return nl2br($string, IS_XHTML);
+  }
+  else
+  {
+    return nl2br($string);
+  }
+}
+
 // validates a comma separated list of email addresses
 // returns FALSE if any one of them is invalid, otherwise TRUE
 function validate_email_list($list)

Modified: mrbs/trunk/web/report.php
===================================================================
--- mrbs/trunk/web/report.php   2009-04-01 12:58:57 UTC (rev 1081)
+++ mrbs/trunk/web/report.php   2009-04-01 13:55:22 UTC (rev 1082)
@@ -172,7 +172,7 @@
 
   // Description:
   echo "<tr><td>" . get_vocab("description") . ":</td><td>" .
-    nl2br(htmlspecialchars($row['description']), IS_XHTML) . "</td></tr>\n";
+    mrbs_nl2br(htmlspecialchars($row['description'])) . "</td></tr>\n";
 
   // Entry Type:
   $et = empty($typel[$row['type']]) ? "?".$row['type']."?" : 
$typel[$row['type']];

Modified: mrbs/trunk/web/view_entry.php
===================================================================
--- mrbs/trunk/web/view_entry.php       2009-04-01 12:58:57 UTC (rev 1081)
+++ mrbs/trunk/web/view_entry.php       2009-04-01 13:55:22 UTC (rev 1082)
@@ -239,11 +239,11 @@
  <table id="entry">
    <tr>
     <td><?php echo get_vocab("description") ?>:</td>
-    <td><?php echo nl2br($description, IS_XHTML) ?></td>
+    <td><?php echo mrbs_nl2br($description) ?></td>
    </tr>
    <tr>
     <td><?php echo get_vocab("room") ?>:</td>
-    <td><?php    echo  nl2br($area_name . " - " . $room_name, IS_XHTML) ?></td>
+    <td><?php    echo  mrbs_nl2br($area_name . " - " . $room_name) ?></td>
    </tr>
    <tr>
     <td><?php echo get_vocab("start_date") ?>:</td>


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

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to