Index: trunk/phase3/includes/SpecialWatchlist.php |
— | — | @@ -57,10 +57,10 @@ |
58 | 58 | $prefs['hidebots'] = $wgUser->getBoolOption( 'watchlisthidebots' ); |
59 | 59 | |
60 | 60 | # 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'] ); |
63 | 63 | $hideBots = $wgRequest->getBool( 'hideBots', $prefs['hidebots'] ); |
64 | | - |
| 64 | + |
65 | 65 | # Get namespace value, if supplied, and prepare a WHERE fragment |
66 | 66 | $nameSpace = $wgRequest->getIntOrNull( 'namespace' ); |
67 | 67 | if( !is_null( $nameSpace ) ) { |
— | — | @@ -74,14 +74,14 @@ |
75 | 75 | # Watchlist editing |
76 | 76 | $action = $wgRequest->getVal( 'action' ); |
77 | 77 | $remove = $wgRequest->getVal( 'remove' ); |
78 | | - $id = $wgRequest->getArray( 'id' ); |
| 78 | + $id = $wgRequest->getArray( 'id' ); |
79 | 79 | |
80 | 80 | $uid = $wgUser->getID(); |
81 | 81 | if( $wgEnotifWatchlist && $wgRequest->getVal( 'reset' ) && $wgRequest->wasPosted() ) { |
82 | 82 | $wgUser->clearAllNotifications( $uid ); |
83 | 83 | } |
84 | 84 | |
85 | | - # Deleting items from watchlist |
| 85 | + # Deleting items from watchlist |
86 | 86 | if(($action == 'submit') && isset($remove) && is_array($id)) { |
87 | 87 | $wgOut->addWikiText( wfMsg( 'removingchecked' ) ); |
88 | 88 | $wgOut->addHTML( '<p>' ); |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | $sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_user=$uid"; |
120 | 120 | $res = $dbr->query( $sql, $fname ); |
121 | 121 | $s = $dbr->fetchObject( $res ); |
122 | | - |
| 122 | + |
123 | 123 | # Patch *** A1 *** (see A2 below) |
124 | 124 | # adjust for page X, talk:page X, which are both stored separately, but treated together |
125 | 125 | $nitems = floor($s->n / 2); |
— | — | @@ -144,10 +144,10 @@ |
145 | 145 | // Dump everything here |
146 | 146 | $nondefaults = array(); |
147 | 147 | |
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); |
152 | 152 | |
153 | 153 | if ( $days <= 0 ) { |
154 | 154 | $cutoff = false; |
— | — | @@ -178,15 +178,16 @@ |
179 | 179 | $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"; |
180 | 180 | |
181 | 181 | $res = $dbr->query( $sql, $fname ); |
182 | | - |
| 182 | + |
183 | 183 | # Batch existence check |
184 | 184 | $linkBatch = new LinkBatch(); |
185 | 185 | while( $row = $dbr->fetchObject( $res ) ) |
186 | 186 | $linkBatch->addObj( Title::makeTitleSafe( $row->wl_namespace, $row->wl_title ) ); |
187 | 187 | $linkBatch->execute(); |
| 188 | + |
188 | 189 | if( $dbr->numRows( $res ) > 0 ) |
189 | 190 | $dbr->dataSeek( $res, 0 ); # Let's do the time warp again! |
190 | | - |
| 191 | + |
191 | 192 | $sk = $wgUser->getSkin(); |
192 | 193 | |
193 | 194 | $list = array(); |
— | — | @@ -223,7 +224,7 @@ |
224 | 225 | } else { |
225 | 226 | $spanopen = $spanclosed = ''; |
226 | 227 | } |
227 | | - |
| 228 | + |
228 | 229 | $wgOut->addHTML( "<li>{$checkbox}{$spanopen}{$pageLink}{$spanclosed} {$toolLinks}</li>\n" ); |
229 | 230 | } |
230 | 231 | } |
— | — | @@ -260,7 +261,7 @@ |
261 | 262 | |
262 | 263 | # Toggle watchlist content (all recent edits or just the latest) |
263 | 264 | if( $wgUser->getOption( 'extendwatchlist' )) { |
264 | | - $andLatest=''; |
| 265 | + $andLatest=''; |
265 | 266 | $limitWatchlist = 'LIMIT ' . intval( $wgUser->getOption( 'wllimit' ) ); |
266 | 267 | } else { |
267 | 268 | $andLatest= 'AND rc_this_oldid=page_latest'; |
— | — | @@ -322,7 +323,7 @@ |
323 | 324 | # Spit out some control panel links |
324 | 325 | $thisTitle = SpecialPage::getTitleFor( 'Watchlist' ); |
325 | 326 | $skin = $wgUser->getSkin(); |
326 | | - |
| 327 | + |
327 | 328 | # Problems encountered using the fancier method |
328 | 329 | $label = $hideBots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' ); |
329 | 330 | $linkBits = wfArrayToCGI( array( 'hideBots' => 1 - (int)$hideBots ), $nondefaults ); |
— | — | @@ -445,18 +446,18 @@ |
446 | 447 | */ |
447 | 448 | function wlCountItems( &$user, $talk = true ) { |
448 | 449 | $dbr =& wfGetDB( DB_SLAVE ); |
449 | | - |
| 450 | + |
450 | 451 | # Fetch the raw count |
451 | 452 | $res = $dbr->select( 'watchlist', 'COUNT(*) AS count', array( 'wl_user' => $user->mId ), 'wlCountItems' ); |
452 | 453 | $row = $dbr->fetchObject( $res ); |
453 | 454 | $count = $row->count; |
454 | 455 | $dbr->freeResult( $res ); |
455 | | - |
| 456 | + |
456 | 457 | # Halve to remove talk pages if needed |
457 | 458 | if( !$talk ) |
458 | 459 | $count = floor( $count / 2 ); |
459 | | - |
460 | | - return( $count ); |
| 460 | + |
| 461 | + return( $count ); |
461 | 462 | } |
462 | 463 | |
463 | 464 | /** |