Tweaks to r25923 for my own peace of mind:
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 19 Sep 2007 14:44:50 +0000 (14:44 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 19 Sep 2007 14:44:50 +0000 (14:44 +0000)
* De-escape &amp;amp; to &amp; rather than &amp; to & -- guarantees that we won't leave stray &s around producing invalid or freaky output
* Use == instead of = when comparing... :)

includes/api/ApiFormatBase.php
includes/api/ApiMain.php

index cead9fc..6cfbfb1 100644 (file)
@@ -173,11 +173,12 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
                // Escape everything first for full coverage
                $text = htmlspecialchars($text);
                
-               /* Temporary fix for bad links in help messages. As a special case, ampersands
-                * are not escaped in the help message. Should be removed once we have completed
-                * a fully-html version of the help message. */
+               /* Temporary fix for bad links in help messages. As a special case, XML-escaped
+                * ampersands are de-escaped one level in the help message for legibility.
+                * Should be removed once we have completed a fully-html version of the
+                * help message. */
                if ( $this->mUnescapeAmps )
-                       $text = ereg_replace ( '&amp;', '&', $text );
+                       $text = str_replace( '&amp;amp;', '&amp;', $text );
 
                // encode all comments or tags as safe blue strings
                $text = preg_replace('/\&lt;(!--.*?--|.*?)\&gt;/', '<span style="color:blue;">&lt;\1&gt;</span>', $text);
index 3e8700f..6a18eaf 100644 (file)
@@ -325,7 +325,7 @@ class ApiMain extends ApiBase {
                 * not break. */
                $params = $this->extractRequestParams();
                $printer->setUnescapeAmps ( $this->mAction == 'help' 
-                               && $params['format'] = ApiMain::API_DEFAULT_FORMAT );
+                               && $params['format'] == ApiMain::API_DEFAULT_FORMAT );
 
                $printer->execute();
                $printer->closePrinter();