Revision: 1993
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1993&view=rev
Author:   cimorrison
Date:     2011-09-22 09:04:50 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Decoded HTML entities in Ajax tooltip messages on the edit_entry page

Modified Paths:
--------------
    mrbs/trunk/web/Themes/default/header.inc
    mrbs/trunk/web/functions.inc

Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc    2011-09-22 08:38:29 UTC (rev 
1992)
+++ mrbs/trunk/web/Themes/default/header.inc    2011-09-22 09:04:50 UTC (rev 
1993)
@@ -424,12 +424,12 @@
           if (result.conflicts.length == 0)
           {
             conflictDiv.text(checkMark).attr('class', 'good').attr;
-            titleText = '<?php echo get_vocab("no_conflicts") ?>';
+            titleText = '<?php echo 
mrbs_entity_decode(get_vocab("no_conflicts")) ?>';
           }
           else
           {
             conflictDiv.text(cross).attr('class', 'bad');
-            titleText = '<?php echo get_vocab("conflict") ?>' + ":  \n\n";
+            titleText = '<?php echo mrbs_entity_decode(get_vocab("conflict")) 
?>' + ":  \n\n";
             for (var i=0; i<result.conflicts.length; i++)
             {
               titleText += '(' + (i+1).toString() + ') ';
@@ -442,12 +442,12 @@
           if (result.rules_broken.length == 0)
           {
             policyDiv.text(checkMark).attr('class', 'good');
-            titleText = '<?php echo get_vocab("no_rules_broken") ?>';
+            titleText = '<?php echo 
mrbs_entity_decode(get_vocab("no_rules_broken")) ?>';
           }
           else
           {
             policyDiv.text(cross).attr('class', 'bad');
-            titleText = '<?php echo get_vocab("rules_broken") ?>' + ":  \n\n";
+            titleText = '<?php echo 
mrbs_entity_decode(get_vocab("rules_broken")) ?>' + ":  \n\n";
             for (var i=0; i<result.rules_broken.length; i++)
             {
               titleText += '(' + (i+1).toString() + ') ' + 
result.rules_broken[i] + "  \n";

Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc        2011-09-22 08:38:29 UTC (rev 1992)
+++ mrbs/trunk/web/functions.inc        2011-09-22 09:04:50 UTC (rev 1993)
@@ -885,32 +885,15 @@
 // should be sufficient in most MRBS circumstances.   This could
 // always be extended later to do something more sophisticated if
 // necessary.
-function mrbs_entity_decode($string)
+//
+// Note: the charset defaults to UTF-8.  This is slightly different from the
+// behaviour in the PHP html_entity_decode() function where the default charset
+// was only changed from ISO-8859-1 to UTF-8 in PHP 5.4.0
+function mrbs_entity_decode($string, $quote_style=ENT_COMPAT, $charset = 
'UTF-8')
 {
-  $n_args = func_num_args();
-  if ($n_args > 1)
-  {
-    $quote_style = func_get_arg(1);
-  }
-  if ($n_args > 2)
-  {
-    $charset = func_get_arg(2);
-  }
-  
   if (function_exists('version_compare') && version_compare(PHP_VERSION, 
'5.0.0', 'ge'))
   {
-    switch ($n_args)
-    {
-      case 3:
-        $string = html_entity_decode($string, $quote_style, $charset);
-        break;
-      case 2:
-        $string = html_entity_decode($string, $quote_style);
-        break;
-      default:
-        $string = html_entity_decode($string);
-        break;
-    }  
+    $string = html_entity_decode($string, $quote_style, $charset);
   }
   else
   {

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


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to