[evolvis-commits] r17655: use htmlspecialchars not htmlentities to avoid … and   and so

mirabilos at evolvis.org mirabilos at evolvis.org
Fri Oct 28 19:29:43 CEST 2011


Author: mirabilos
Date: 2011-10-28 19:29:43 +0200 (Fri, 28 Oct 2011)
New Revision: 17655

Added:
   trunk/gforge_base/evolvisforge-5.1/
Removed:
   trunk/gforge_base/evolvisforge-5.1/
Modified:
   trunk/gforge_base/evolvisforge-5.1/src/common/include/utils.php
Log:
use htmlspecialchars not htmlentities to avoid … and   and so

this both saves space in the output and confuses XML parsers less
to be tested in evolvis first, then fed upstream (these functions
come from FF 5.1)


Modified: trunk/gforge_base/evolvisforge-5.1/src/common/include/utils.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/include/utils.php	2011-10-26 14:07:09 UTC (rev 17645)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/include/utils.php	2011-10-28 17:29:43 UTC (rev 17655)
@@ -1582,14 +1582,14 @@
 	    '|([a-zA-Z][a-zA-Z0-9+.-]*:[#0-9a-zA-Z;/?:@&=+$,_.!~*\'()%-]+)|',
 	    "\x01\$1\x01", $s);
 	if (!$s)
-		return htmlentities($unencoded_string, ENT_QUOTES, "UTF-8");
+		return htmlspecialchars($unencoded_string, ENT_QUOTES, "UTF-8");
 	/* encode the string */
-	$s = htmlentities($s, ENT_QUOTES, "UTF-8");
+	$s = htmlspecialchars($s, ENT_QUOTES, "UTF-8");
 	/* convert 「^Afoo^A」 to 「<a href="foo">foo</a>」 */
 	$s = preg_replace('|\x01([^\x01]+)\x01|',
 	    '<a href="$1">$1</a>', $s);
 	if (!$s)
-		return htmlentities($unencoded_string, ENT_QUOTES, "UTF-8");
+		return htmlspecialchars($unencoded_string, ENT_QUOTES, "UTF-8");
 	/* convert [#123] to links if found */
 	if ($tryaidtid)
 		$s = util_tasktracker_links($s);
@@ -1602,7 +1602,7 @@
 
 /* secure a (possibly already HTML encoded) string */
 function util_html_secure($s) {
-	return htmlentities(html_entity_decode($s, ENT_QUOTES, "UTF-8"),
+	return htmlspecialchars(html_entity_decode($s, ENT_QUOTES, "UTF-8"),
 	    ENT_QUOTES, "UTF-8");
 }
 



More information about the evolvis-commits mailing list