r65193 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65192‎ | r65193 | r65194 >
Date:21:53, 17 April 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Escaping fixes, fixmes...

..only until I realised that the whole thing is just one
big continuous fixme.
Modified paths:
  • /trunk/extensions/CheckUser/CheckUser_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CheckUser/CheckUser_body.php
@@ -95,7 +95,7 @@
9696 if ( $wgRequest->getVal( 'action' ) === 'block' ) {
9797 $this->doMassUserBlock( $users, $blockreason, $tag, $talkTag );
9898 } elseif ( !$this->checkReason( $reason ) ) {
99 - $wgOut->addWikiText( wfMsgExt( 'checkuser-noreason', array( 'parsemag' ) ) );
 99+ $wgOut->addWikiMsg( 'checkuser-noreason' );
100100 } elseif ( $checktype == 'subuserips' ) {
101101 $this->doUserIPsRequest( $name, $reason, $period );
102102 } elseif ( $xff && $checktype == 'subipedits' ) {
@@ -162,6 +162,7 @@
163163 '|' . wfMsg( 'checkuser-showlog' ) . ']]'
164164 );
165165 }
 166+ // FIXME: use more Xml/Html methods
166167 $form = "<form name='checkuserform' id='checkuserform' action=\"$action\" method='post'>";
167168 $form .= '<fieldset><legend>' . wfMsgHtml( 'checkuser-query' ) . '</legend>';
168169 $form .= '<table border="0" cellpadding="2"><tr>';
@@ -171,18 +172,18 @@
172173 $form .= '</tr><tr>';
173174 $form .= '<td></td><td class="checkuserradios"><table border="0" cellpadding="3"><tr>';
174175 $form .= '<td>' . Xml::radio( 'checktype', 'subuserips', $encuserips, array( 'id' => 'subuserips' ) );
175 - $form .= ' ' . Xml::label( wfMsgHtml( 'checkuser-ips' ), 'subuserips' ) . '</td>';
 176+ $form .= ' ' . Xml::label( wfMsg( 'checkuser-ips' ), 'subuserips' ) . '</td>';
176177 $form .= '<td>' . Xml::radio( 'checktype', 'subipedits', $encipedits, array( 'id' => 'subipedits' ) );
177 - $form .= ' ' . Xml::label( wfMsgHtml( 'checkuser-edits' ), 'subipedits' ) . '</td>';
 178+ $form .= ' ' . Xml::label( wfMsg( 'checkuser-edits' ), 'subipedits' ) . '</td>';
178179 $form .= '<td>' . Xml::radio( 'checktype', 'subipusers', $encipusers, array( 'id' => 'subipusers' ) );
179 - $form .= ' ' . Xml::label( wfMsgHtml( 'checkuser-users' ), 'subipusers' ) . '</td>';
 180+ $form .= ' ' . Xml::label( wfMsg( 'checkuser-users' ), 'subipusers' ) . '</td>';
180181 $form .= '<td>' . Xml::radio( 'checktype', 'subuseredits', $encuseredits, array( 'id' => 'subuseredits' ) );
181 - $form .= ' ' . Xml::label( wfMsgHtml( 'checkuser-account' ), 'subuseredits' ) . '</td>';
 182+ $form .= ' ' . Xml::label( wfMsg( 'checkuser-account' ), 'subuseredits' ) . '</td>';
182183 $form .= '</tr></table></td>';
183184 $form .= '</tr><tr>';
184185 $form .= '<td>' . wfMsgHtml( 'checkuser-reason' ) . '</td>';
185186 $form .= '<td>' . Xml::input( 'reason', 46, $reason, array( 'maxlength' => '150', 'id' => 'checkreason' ) );
186 - $form .= '&nbsp; &nbsp;' . Xml::submitButton( wfMsgHtml( 'checkuser-check' ),
 187+ $form .= '&nbsp; &nbsp;' . Xml::submitButton( wfMsg( 'checkuser-check' ),
187188 array( 'id' => 'checkusersubmit', 'name' => 'checkusersubmit' ) ) . '</td>';
188189 $form .= '</tr></table></fieldset></form>';
189190 # Output form
@@ -194,6 +195,7 @@
195196 */
196197 protected function addStyles() {
197198 global $wgScriptPath, $wgCheckUserStyleVersion, $wgOut;
 199+ // FIXME, use Html::
198200 $encJSFile = htmlspecialchars( "$wgScriptPath/extensions/CheckUser/checkuser.js?$wgCheckUserStyleVersion" );
199201 $wgOut->addScript( "<script type=\"text/javascript\" src=\"$encJSFile\"></script>" );
200202 }
@@ -229,6 +231,7 @@
230232 }
231233
232234 /**
 235+ * FIXME: documentation incomplete
233236 * Block a list of selected users
234237 * @param array $users
235238 * @param string $reason
@@ -237,23 +240,22 @@
238241 protected function doMassUserBlock( $users, $reason = '', $tag = '', $talkTag = '' ) {
239242 global $wgOut, $wgUser, $wgCheckUserMaxBlocks, $wgLang;
240243 if ( empty( $users ) || $wgUser->isBlocked( false ) ) {
241 - $wgOut->addWikiText( wfMsgExt( 'checkuser-block-failure', array( 'parsemag' ) ) );
 244+ $wgOut->addWikiMsg( 'checkuser-block-failure' );
242245 return;
243246 } elseif ( count( $users ) > $wgCheckUserMaxBlocks ) {
244 - $wgOut->addWikiText( wfMsgExt( 'checkuser-block-limit', array( 'parsemag' ) ) );
 247+ $wgOut->addWikiMsg( 'checkuser-block-limit' );
245248 return;
246249 } elseif ( !$reason ) {
247 - $wgOut->addWikiText( wfMsgExt( 'checkuser-block-noreason', array( 'parsemag' ) ) );
 250+ $wgOut->addWikiMsg( 'checkuser-block-noreason' );
248251 return;
249252 }
250253 $safeUsers = IPBlockForm::doMassUserBlock( $users, $reason, $tag, $talkTag );
251254 if ( !empty( $safeUsers ) ) {
252255 $n = count( $safeUsers );
253256 $ulist = $wgLang->listToText( $safeUsers );
254 - $wgOut->addWikiText( wfMsgExt( 'checkuser-block-success', 'parsemag',
255 - $ulist, $wgLang->formatNum( $n ) ) );
 257+ $wgOut->addWikiMsg( 'checkuser-block-success', $ulist, $wgLang->formatNum( $n ) );
256258 } else {
257 - $wgOut->addWikiText( wfMsgExt( 'checkuser-block-failure', 'parsemag' ) );
 259+ $wgOut->addWikiMsg( 'checkuser-block-failure' );
258260 }
259261 }
260262
@@ -289,6 +291,7 @@
290292 if ( $lastEdit ) {
291293 $lastEditDate = $wgLang->date( wfTimestamp( TS_MW, $lastEdit ), true );
292294 $lastEditTime = $wgLang->time( wfTimestamp( TS_MW, $lastEdit ), true );
 295+ // FIXME: don't pass around parsed messages
293296 return wfMsgExt( 'checkuser-nomatch-edits', 'parse', $lastEditDate, $lastEditTime );
294297 }
295298 return wfMsgExt( 'checkuser-nomatch', 'parse' );
@@ -300,8 +303,9 @@
301304 }
302305
303306 /**
304 - * @param string $ip
305 - * @param bool $xfor
 307+ * FIXME: documentation out of date
 308+ * @param string $ip <???
 309+ * @param bool $xfor <???
306310 * @param string $reason
307311 * Get all IPs used by a user
308312 * Shows first and last date and number of edits
@@ -324,6 +328,7 @@
325329
326330 # If user is not IP or nonexistent
327331 if ( !$user_id ) {
 332+ // FIXME: addWikiMsg
328333 $s = wfMsgExt( 'nosuchusershort', array( 'parse' ), $user );
329334 $wgOut->addHTML( $s );
330335 return;
@@ -331,6 +336,7 @@
332337
333338 # Record check...
334339 if ( !$this->addLogEntry( 'userips', 'user', $user, $reason, $user_id ) ) {
 340+ // FIXME: addWikiMsg
335341 $wgOut->addHTML( '<p>' . wfMsgHtml( 'checkuser-log-fail' ) . '</p>' );
336342 }
337343 $dbr = wfGetDB( DB_SLAVE );
@@ -352,6 +358,7 @@
353359 $counter = 0;
354360 while ( $row = $dbr->fetchObject( $ret ) ) {
355361 if ( $counter >= 5000 ) {
 362+ // FIXME: addWikiMSG
356363 $wgOut->addHTML( wfMsgExt( 'checkuser-limited', array( 'parse' ) ) );
357364 break;
358365 }
@@ -440,6 +447,7 @@
441448 * @param string $ip
442449 * @param bool $xfor
443450 * @param string $reason
 451+ * FIXME: $period ???
444452 * Shows all edits in Recent Changes by this IP (or range) and who made them
445453 */
446454 protected function doIPEditsRequest( $ip, $xfor = false, $reason = '', $period = 0 ) {
@@ -501,6 +509,7 @@
502510 $s .= '<ol>';
503511 while ( $row = $ret->fetchObject() ) {
504512 if ( $counter >= 5000 ) {
 513+ // FIXME: addWikiMsg
505514 $wgOut->addHTML( wfMsgExt( 'checkuser-limited', array( 'parse' ) ) );
506515 break;
507516 }
@@ -559,6 +568,7 @@
560569 $s = '<div id="checkuserresults">';
561570 while ( $row = $ret->fetchObject() ) {
562571 if ( $counter >= 5000 ) {
 572+ // FIXME: addWikiMsg
563573 $wgOut->addHTML( wfMsgExt( 'checkuser-limited', array( 'parse' ) ) );
564574 break;
565575 }

Status & tagging log