r80857 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80856‎ | r80857 | r80858 >
Date:14:27, 24 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed double escaping issue for info links
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php
@@ -118,8 +118,8 @@
119119 $html .=
120120 '<form name="refreshwiki" action="" method="POST">' .
121121 '<input type="hidden" name="action" value="refreshstore" />' .
122 - '<input type="submit" value="' . wfMsg( 'smw_smwadmin_datarefreshstop' ) . '"/> ' .
123 - ' <input type="checkbox" name="rfsure" value="stop"/> ' . wfMsg( 'smw_smwadmin_datarefreshstopconfirm' ) .
 122+ '<input type="submit" value="' . htmlspecialchars( wfMsg( 'smw_smwadmin_datarefreshstop' ) ) . '" /> ' .
 123+ ' <input type="checkbox" name="rfsure" value="stop"/> ' . htmlspecialchars( wfMsg( 'smw_smwadmin_datarefreshstopconfirm' ) ) .
124124 '</form>' . "\n";
125125 }
126126 } elseif ( $smwgAdminRefreshStore ) {
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php
@@ -610,7 +610,7 @@
611611 }
612612
613613 if ( count( $extralinks ) > 0 ) {
614 - $result .= smwfEncodeMessages( $extralinks, 'info', ', <!--br-->' );
 614+ $result .= smwfEncodeMessages( $extralinks, 'info', ', <!--br-->', false );
615615 }
616616
617617 return $result;
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -224,17 +224,18 @@
225225 * @param array $messages
226226 * @param string $icon Acts like an enum. Callers must ensure safety, since this value is used directly in the output.
227227 * @param string $seperator
 228+ * @param boolean $escape Should the messages be escaped or not (ie when they already are)
228229 *
229230 * @return string
230231 */
231 -function smwfEncodeMessages( array $messages, $icon = 'warning', $seperator = ' <!--br-->' ) {
 232+function smwfEncodeMessages( array $messages, $icon = 'warning', $seperator = ' <!--br-->', $escape = true ) {
232233 if ( count( $messages ) > 0 ) {
233234 SMWOutputs::requireHeadItem( SMW_HEADER_TOOLTIP );
234 - foreach( $messages as &$message ) {
235 - $message = htmlspecialchars( $message );
 235+ if ( $escape ) {
 236+ $messages = array_map( 'htmlspecialchars', $messages );
236237 }
237 - $messageString = implode( $seperator, $messages );
238 - return '<span class="smwttpersist"><span class="smwtticon">' . $icon . '.png</span><span class="smwttcontent">' . $messageString . '</span> </span>';
 238+ return '<span class="smwttpersist"><span class="smwtticon">' . htmlspecialchars( $icon )
 239+ . '.png</span><span class="smwttcontent">' . implode( $seperator, $messages ) . '</span> </span>';
239240 } else {
240241 return '';
241242 }

Status & tagging log