Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -452,20 +452,8 @@ |
453 | 453 | |
454 | 454 | # Yay, more global functions! |
455 | 455 | function wfCheckLimits( $deflimit = 50, $optionname = 'rclimit' ) { |
456 | | - global $wgUser, $wgRequest; |
457 | | - |
458 | | - $limit = $wgRequest->getInt( 'limit', 0 ); |
459 | | - if( $limit < 0 ) $limit = 0; |
460 | | - if( ( $limit == 0 ) && ( $optionname != '' ) ) { |
461 | | - $limit = (int)$wgUser->getOption( $optionname ); |
462 | | - } |
463 | | - if( $limit <= 0 ) $limit = $deflimit; |
464 | | - if( $limit > 5000 ) $limit = 5000; # We have *some* limits... |
465 | | - |
466 | | - $offset = $wgRequest->getInt( 'offset', 0 ); |
467 | | - if( $offset < 0 ) $offset = 0; |
468 | | - |
469 | | - return array( $limit, $offset ); |
| 456 | + global $wgRequest; |
| 457 | + return $wgRequest->getLimitOffset( $deflimit, $optionname ); |
470 | 458 | } |
471 | 459 | |
472 | 460 | # Escapes the given text so that it may be output using addWikiText() |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -145,6 +145,22 @@ |
146 | 146 | return htmlspecialchars( $this->appendQuery( $query ) ); |
147 | 147 | } |
148 | 148 | |
| 149 | + function getLimitOffset( $deflimit = 50, $optionname = 'rclimit' ) { |
| 150 | + global $wgUser; |
| 151 | + |
| 152 | + $limit = $this->getInt( 'limit', 0 ); |
| 153 | + if( $limit < 0 ) $limit = 0; |
| 154 | + if( ( $limit == 0 ) && ( $optionname != '' ) ) { |
| 155 | + $limit = (int)$wgUser->getOption( $optionname ); |
| 156 | + } |
| 157 | + if( $limit <= 0 ) $limit = $deflimit; |
| 158 | + if( $limit > 5000 ) $limit = 5000; # We have *some* limits... |
| 159 | + |
| 160 | + $offset = $this->getInt( 'offset', 0 ); |
| 161 | + if( $offset < 0 ) $offset = 0; |
| 162 | + |
| 163 | + return array( $limit, $offset ); |
| 164 | + } |
149 | 165 | } |
150 | 166 | |
151 | 167 | ?> |