r62567 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62566‎ | r62567 | r62568 >
Date:01:32, 16 February 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.2.2
* Added html escaping to the error messages
Modified paths:
  • /trunk/extensions/Validator/Validator_Manager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/Validator_Manager.php
@@ -67,7 +67,7 @@
6868 $errors = array();
6969
7070 foreach ( $this->errors as $error ) {
71 - $error['name'] = '<b>' . $error['name'] . '</b>';
 71+ $error['name'] = '<b>' . Sanitizer::escapeId($error['name']) . '</b>';
7272
7373 if ($error['type'] == 'unknown') {
7474 $errors[] = wfMsgExt( 'validator_error_unknown_argument', array( 'parsemag' ), $error['name'] );
@@ -96,11 +96,13 @@
9797 case 'invalid' : default :
9898 $msg = wfMsgExt( 'validator_list_error_invalid_argument', array( 'parsemag' ), $error['name'] );
9999 break;
100 - }
 100+ }
101101
102102 if (array_key_exists('invalid-items', $error)) {
103 - $msg .= wfMsgExt( 'validator_list_omitted', array( 'parsemag' ),
104 - $wgLang->listToText($error['invalid-items']), count($error['invalid-items']) );
 103+ $omitted = array();
 104+ foreach($error['invalid-items'] as $item) $omitted[] = Sanitizer::escapeId($item);
 105+ $msg .= ' ' . wfMsgExt( 'validator_list_omitted', array( 'parsemag' ),
 106+ $wgLang->listToText($omitted), count($omitted) );
105107 }
106108
107109 $errors[] = $msg;
@@ -124,7 +126,7 @@
125127 $errors[] = wfMsgExt( 'validator_error_accepts_only', array( 'parsemag' ), $error['name'], $itemsText, count( $error['args'] ) );
126128 break;
127129 case 'invalid' : default :
128 - $errors[] = wfMsgExt( 'validator_error_invalid_argument', array( 'parsemag' ), '<b>' . $error['value'] . '</b>', $error['name'] );
 130+ $errors[] = wfMsgExt( 'validator_error_invalid_argument', array( 'parsemag' ), '<b>' . Sanitizer::escapeId( $error['value'] ) . '</b>', $error['name'] );
129131 break;
130132 }
131133 }

Status & tagging log