r18264 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r18263‎ | r18264 | r18265 >
Date:19:49, 11 December 2006
Author:hashar
Status:old
Tags:
Comment:
remove some white spaces, add some for clarity
Modified paths:
  • /trunk/phase3/includes/SpecialWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialWatchlist.php
@@ -57,10 +57,10 @@
5858 $prefs['hidebots'] = $wgUser->getBoolOption( 'watchlisthidebots' );
5959
6060 # Get query variables
61 - $days = $wgRequest->getVal( 'days', $prefs['days'] );
62 - $hideOwn = $wgRequest->getBool( 'hideOwn', $prefs['hideown'] );
 61+ $days = $wgRequest->getVal( 'days', $prefs['days'] );
 62+ $hideOwn = $wgRequest->getBool( 'hideOwn', $prefs['hideown'] );
6363 $hideBots = $wgRequest->getBool( 'hideBots', $prefs['hidebots'] );
64 -
 64+
6565 # Get namespace value, if supplied, and prepare a WHERE fragment
6666 $nameSpace = $wgRequest->getIntOrNull( 'namespace' );
6767 if( !is_null( $nameSpace ) ) {
@@ -74,14 +74,14 @@
7575 # Watchlist editing
7676 $action = $wgRequest->getVal( 'action' );
7777 $remove = $wgRequest->getVal( 'remove' );
78 - $id = $wgRequest->getArray( 'id' );
 78+ $id = $wgRequest->getArray( 'id' );
7979
8080 $uid = $wgUser->getID();
8181 if( $wgEnotifWatchlist && $wgRequest->getVal( 'reset' ) && $wgRequest->wasPosted() ) {
8282 $wgUser->clearAllNotifications( $uid );
8383 }
8484
85 - # Deleting items from watchlist
 85+ # Deleting items from watchlist
8686 if(($action == 'submit') && isset($remove) && is_array($id)) {
8787 $wgOut->addWikiText( wfMsg( 'removingchecked' ) );
8888 $wgOut->addHTML( '<p>' );
@@ -118,7 +118,7 @@
119119 $sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_user=$uid";
120120 $res = $dbr->query( $sql, $fname );
121121 $s = $dbr->fetchObject( $res );
122 -
 122+
123123 # Patch *** A1 *** (see A2 below)
124124 # adjust for page X, talk:page X, which are both stored separately, but treated together
125125 $nitems = floor($s->n / 2);
@@ -144,10 +144,10 @@
145145 // Dump everything here
146146 $nondefaults = array();
147147
148 - wfAppendToArrayIfNotDefault( 'days', $days, $defaults, $nondefaults);
149 - wfAppendToArrayIfNotDefault( 'hideOwn', (int)$hideOwn, $defaults, $nondefaults);
150 - wfAppendToArrayIfNotDefault( 'hideBots', (int)$hideBots, $defaults, $nondefaults);
151 - wfAppendToArrayIfNotDefault( 'namespace', $nameSpace, $defaults, $nondefaults );
 148+ wfAppendToArrayIfNotDefault('days' , $days , $defaults, $nondefaults);
 149+ wfAppendToArrayIfNotDefault('hideOwn' , (int)$hideOwn , $defaults, $nondefaults);
 150+ wfAppendToArrayIfNotDefault('hideBots' , (int)$hideBots, $defaults, $nondefaults);
 151+ wfAppendToArrayIfNotDefault('namespace', $nameSpace , $defaults, $nondefaults);
152152
153153 if ( $days <= 0 ) {
154154 $cutoff = false;
@@ -178,15 +178,16 @@
179179 $sql = "SELECT wl_namespace, wl_title, page_is_redirect FROM $watchlist LEFT JOIN $page ON wl_namespace = page_namespace AND wl_title = page_title WHERE wl_user=$uid";
180180
181181 $res = $dbr->query( $sql, $fname );
182 -
 182+
183183 # Batch existence check
184184 $linkBatch = new LinkBatch();
185185 while( $row = $dbr->fetchObject( $res ) )
186186 $linkBatch->addObj( Title::makeTitleSafe( $row->wl_namespace, $row->wl_title ) );
187187 $linkBatch->execute();
 188+
188189 if( $dbr->numRows( $res ) > 0 )
189190 $dbr->dataSeek( $res, 0 ); # Let's do the time warp again!
190 -
 191+
191192 $sk = $wgUser->getSkin();
192193
193194 $list = array();
@@ -223,7 +224,7 @@
224225 } else {
225226 $spanopen = $spanclosed = '';
226227 }
227 -
 228+
228229 $wgOut->addHTML( "<li>{$checkbox}{$spanopen}{$pageLink}{$spanclosed} {$toolLinks}</li>\n" );
229230 }
230231 }
@@ -260,7 +261,7 @@
261262
262263 # Toggle watchlist content (all recent edits or just the latest)
263264 if( $wgUser->getOption( 'extendwatchlist' )) {
264 - $andLatest='';
 265+ $andLatest='';
265266 $limitWatchlist = 'LIMIT ' . intval( $wgUser->getOption( 'wllimit' ) );
266267 } else {
267268 $andLatest= 'AND rc_this_oldid=page_latest';
@@ -322,7 +323,7 @@
323324 # Spit out some control panel links
324325 $thisTitle = SpecialPage::getTitleFor( 'Watchlist' );
325326 $skin = $wgUser->getSkin();
326 -
 327+
327328 # Problems encountered using the fancier method
328329 $label = $hideBots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' );
329330 $linkBits = wfArrayToCGI( array( 'hideBots' => 1 - (int)$hideBots ), $nondefaults );
@@ -445,18 +446,18 @@
446447 */
447448 function wlCountItems( &$user, $talk = true ) {
448449 $dbr =& wfGetDB( DB_SLAVE );
449 -
 450+
450451 # Fetch the raw count
451452 $res = $dbr->select( 'watchlist', 'COUNT(*) AS count', array( 'wl_user' => $user->mId ), 'wlCountItems' );
452453 $row = $dbr->fetchObject( $res );
453454 $count = $row->count;
454455 $dbr->freeResult( $res );
455 -
 456+
456457 # Halve to remove talk pages if needed
457458 if( !$talk )
458459 $count = floor( $count / 2 );
459 -
460 - return( $count );
 460+
 461+ return( $count );
461462 }
462463
463464 /**