r80942 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80941‎ | r80942 | r80943 >
Date:23:48, 24 January 2011
Author:aaron
Status:ok
Tags:
Comment:
*(Bug 22854) - Special:Checkuser help text was dependent on the checkuser-log user right
*Other small cleanups
Modified paths:
  • /trunk/extensions/CheckUser/CheckUser_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CheckUser/CheckUser_body.php
@@ -50,14 +50,10 @@
5151
5252 if ( !$wgUser->isAllowed( 'checkuser' ) ) {
5353 if ( $wgUser->isAllowed( 'checkuser-log' ) ) {
54 - $wgOut->addWikiText( wfMsg( 'checkuser-summary' ) .
55 - "\n\n[[" . $this->getLogSubpageTitle()->getPrefixedText() .
56 - '|' . wfMsg( 'checkuser-showlog' ) . ']]'
57 - );
58 - return;
 54+ $this->showGuide();
 55+ } else {
 56+ $wgOut->permissionRequired( 'checkuser' );
5957 }
60 -
61 - $wgOut->permissionRequired( 'checkuser' );
6258 return;
6359 }
6460
@@ -92,7 +88,7 @@
9389 $xff = '';
9490 }
9591
96 - $this->doForm( $user, $reason, $checktype, $ip, $xff, $name, $period );
 92+ $this->showForm( $user, $reason, $checktype, $ip, $xff, $name, $period );
9793
9894 # Perform one of the various submit operations...
9995 if ( $wgRequest->wasPosted() ) {
@@ -139,7 +135,15 @@
140136 return $this->logSubpageTitle;
141137 }
142138
143 - protected function doForm( $user, $reason, $checktype, $ip, $xff, $name, $period ) {
 139+ protected function showGuide() {
 140+ global $wgOut;
 141+ $wgOut->addWikiText( wfMsg( 'checkuser-summary' ) .
 142+ "\n\n[[" . $this->getLogSubpageTitle()->getPrefixedText() .
 143+ '|' . wfMsg( 'checkuser-showlog' ) . ']]'
 144+ );
 145+ }
 146+
 147+ protected function showForm( $user, $reason, $checktype, $ip, $xff, $name, $period ) {
144148 global $wgOut, $wgUser;
145149 $action = $this->getTitle()->escapeLocalUrl();
146150 # Fill in requested type if it makes sense
@@ -156,14 +160,9 @@
157161 } else {
158162 $encuserips = 1;
159163 }
160 - # Compile our nice form
161 - # User box length should fit things like "2001:0db8:85a3:08d3:1319:8a2e:0370:7344/100/xff"
162 - if ( $wgUser->isAllowed( 'checkuser-log' ) ) {
163 - $wgOut->addWikiText( wfMsg( 'checkuser-summary' ) .
164 - "\n\n[[" . $this->getLogSubpageTitle()->getPrefixedText() .
165 - '|' . wfMsg( 'checkuser-showlog' ) . ']]'
166 - );
167 - }
 164+ # Compile our nice form...
 165+ # Username field should fit things like "2001:0db8:85a3:08d3:1319:8a2e:0370:7344/100/xff"
 166+ $this->showGuide(); // explanation text
168167
169168 $form = Xml::openElement( 'form', array( 'action' => $action,
170169 'name' => 'checkuserform', 'id' => 'checkuserform', 'method' => 'post' ) );

Status & tagging log