r64540 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64539‎ | r64540 | r64541 >
Date:21:50, 2 April 2010
Author:tparscal
Status:ok
Tags:
Comment:
Minor rearrangement of logged in logic.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php
@@ -223,25 +223,27 @@
224224 $wgOut->addWikiMsg(
225225 'prefswitch-main', array( 'parse' )
226226 );
227 - if ( self::isSwitchedOn( $wgUser ) && !$wgUser->isAnon() ) {
228 - $wgOut->addWikiMsgArray(
229 - 'prefswitch-main-on',
230 - array(
231 - $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'feedback' ) ) ),
232 - $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'off' ) ) )
233 - ),
234 - array( 'parse' )
235 - );
236 - } else if ( !$wgUser->isAnon() ) {
237 - $wgOut->addWikiMsgArray(
238 - 'prefswitch-main-off',
239 - array(
240 - $this->getTitle()->getFullURL(
241 - array_merge( $query, array( 'mode' => 'on', 'token' => $wgUser->editToken() ) )
242 - )
243 - ),
244 - array( 'parse' )
245 - );
 227+ if ( $wgUser->isLoggedIn() ) {
 228+ if ( self::isSwitchedOn( $wgUser ) ) {
 229+ $wgOut->addWikiMsgArray(
 230+ 'prefswitch-main-on',
 231+ array(
 232+ $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'feedback' ) ) ),
 233+ $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'off' ) ) )
 234+ ),
 235+ array( 'parse' )
 236+ );
 237+ } else {
 238+ $wgOut->addWikiMsgArray(
 239+ 'prefswitch-main-off',
 240+ array(
 241+ $this->getTitle()->getFullURL(
 242+ array_merge( $query, array( 'mode' => 'on', 'token' => $wgUser->editToken() ) )
 243+ )
 244+ ),
 245+ array( 'parse' )
 246+ );
 247+ }
246248 }
247249 }
248250 }

Status & tagging log