2 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>, 2008 Aaron Schulz
3 # http://www.mediawiki.org/
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # http://www.gnu.org/copyleft/gpl.html
21 const NO_ACTION_LINK
= 1;
27 public function __construct( $skin, $out, $flags = 0 ) {
30 $this->flags
= $flags;
31 $this->preCacheMessages();
35 * As we use the same small set of messages in various methods and that
36 * they are called often, we call them once and save them in $this->message
38 private function preCacheMessages() {
39 // Precache various messages
40 if( !isset( $this->message
) ) {
41 $messages = array( 'revertmerge', 'protect_change', 'unblocklink', 'change-blocklink',
42 'revertmove', 'undeletelink', 'revdel-restore', 'rev-delundel', 'hist', 'pipe-separator' );
43 foreach( $messages as $msg ) {
44 $this->message
[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
50 * Set page title and show header for this log type
53 public function showHeader( $type ) {
54 if( LogPage
::isLogType( $type ) ) {
55 $this->out
->setPageTitle( LogPage
::logName( $type ) );
56 $this->out
->addHTML( LogPage
::logHeader( $type ) );
61 * Show options for the log list
65 * @param $pattern String
66 * @param $year Integer: year
67 * @param $month Integer: month
68 * @param $filter: array
69 * @param $tagFilter: array?
71 public function showOptions( $type = '', $user = '', $page = '', $pattern = '', $year = '',
72 $month = '', $filter = null, $tagFilter='' )
74 global $wgScript, $wgMiserMode;
75 $action = htmlspecialchars( $wgScript );
76 $title = SpecialPage
::getTitleFor( 'Log' );
77 $special = htmlspecialchars( $title->getPrefixedDBkey() );
79 $tagSelector = ChangeTags
::buildTagFilterSelector( $tagFilter );
81 $this->out
->addHTML( "<form action=\"$action\" method=\"get\"><fieldset>" .
82 Xml
::element( 'legend', array(), wfMsg( 'log' ) ) .
83 Xml
::hidden( 'title', $special ) . "\n" .
84 $this->getTypeMenu( $type ) . "\n" .
85 $this->getUserInput( $user ) . "\n" .
86 $this->getTitleInput( $page ) . "\n" .
87 ( !$wgMiserMode ?
($this->getTitlePattern( $pattern )."\n") : "" ) .
88 "<p>" . Xml
::dateMenu( $year, $month ) . "\n" .
89 ( $tagSelector ? Xml
::tags( 'p', null, implode( ' ', $tagSelector ) ) :'' ). "\n" .
90 ( $filter ?
"</p><p>".$this->getFilterLinks( $type, $filter )."\n" : "" ) . "\n" .
91 Xml
::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" .
96 private function getFilterLinks( $logType, $filter ) {
97 global $wgTitle, $wgLang;
99 $messages = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
100 // Option value -> message mapping
102 $hiddens = ''; // keep track for "go" button
103 foreach( $filter as $type => $val ) {
104 $hideVal = 1 - intval($val);
105 $link = $this->skin
->makeKnownLinkObj( $wgTitle, $messages[$hideVal],
106 wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() )
108 $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link );
109 $hiddens .= Xml
::hidden( "hide_{$type}_log", $val ) . "\n";
112 return '<small>'.$wgLang->pipeList( $links ) . '</small>' . $hiddens;
115 private function getDefaultQuery() {
116 if ( !isset( $this->mDefaultQuery
) ) {
117 $this->mDefaultQuery
= $_GET;
118 unset( $this->mDefaultQuery
['title'] );
119 unset( $this->mDefaultQuery
['dir'] );
120 unset( $this->mDefaultQuery
['offset'] );
121 unset( $this->mDefaultQuery
['limit'] );
122 unset( $this->mDefaultQuery
['order'] );
123 unset( $this->mDefaultQuery
['month'] );
124 unset( $this->mDefaultQuery
['year'] );
126 return $this->mDefaultQuery
;
130 * @param $queryType String
131 * @return String: Formatted HTML
133 private function getTypeMenu( $queryType ) {
134 global $wgLogRestrictions, $wgUser;
136 $html = "<select name='type'>\n";
138 $validTypes = LogPage
::validTypes();
139 $typesByName = array(); // Temporary array
141 // First pass to load the log names
142 foreach( $validTypes as $type ) {
143 $text = LogPage
::logName( $type );
144 $typesByName[$text] = $type;
147 // Second pass to sort by name
150 // Third pass generates sorted XHTML content
151 foreach( $typesByName as $text => $type ) {
152 $selected = ($type == $queryType);
154 if ( isset($wgLogRestrictions[$type]) ) {
155 if ( $wgUser->isAllowed( $wgLogRestrictions[$type] ) ) {
156 $html .= Xml
::option( $text, $type, $selected ) . "\n";
159 $html .= Xml
::option( $text, $type, $selected ) . "\n";
163 $html .= '</select>';
168 * @param $user String
169 * @return String: Formatted HTML
171 private function getUserInput( $user ) {
172 return Xml
::inputLabel( wfMsg( 'specialloguserlabel' ), 'user', 'user', 15, $user );
176 * @param $title String
177 * @return String: Formatted HTML
179 private function getTitleInput( $title ) {
180 return Xml
::inputLabel( wfMsg( 'speciallogtitlelabel' ), 'page', 'page', 20, $title );
184 * @return boolean Checkbox
186 private function getTitlePattern( $pattern ) {
187 return '<span style="white-space: nowrap">' .
188 Xml
::checkLabel( wfMsg( 'log-title-wildcard' ), 'pattern', 'pattern', $pattern ) .
192 public function beginLogEventsList() {
196 public function endLogEventsList() {
201 * @param $row Row: a single row from the result set
202 * @return String: Formatted HTML list item
204 public function logLine( $row ) {
205 global $wgLang, $wgUser, $wgContLang;
207 $title = Title
::makeTitle( $row->log_namespace
, $row->log_title
);
208 $classes = array( "mw-logline-{$row->log_type}" );
209 $time = $wgLang->timeanddate( wfTimestamp(TS_MW
, $row->log_timestamp
), true );
211 if( self
::isDeleted($row,LogPage
::DELETED_USER
) ) {
212 $userLink = '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
214 $userLink = $this->skin
->userLink( $row->log_user
, $row->user_name
) .
215 $this->skin
->userToolLinks( $row->log_user
, $row->user_name
, true, 0, $row->user_editcount
);
218 if( self
::isDeleted($row,LogPage
::DELETED_COMMENT
) ) {
219 $comment = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>';
221 $comment = $wgContLang->getDirMark() . $this->skin
->commentBlock( $row->log_comment
);
223 // Extract extra parameters
224 $paramArray = LogPage
::extractParams( $row->log_params
);
226 // Some user can hide log items and have review links
227 if( $wgUser->isAllowed( 'deleterevision' ) ) {
228 $del = $this->getShowHideLinks( $row ) . ' ';
230 // Add review links and such...
231 if( ($this->flags
& self
::NO_ACTION_LINK
) ||
($row->log_deleted
& LogPage
::DELETED_ACTION
) ) {
232 // Action text is suppressed...
233 } else if( self
::typeAction($row,'move','move','move') && !empty($paramArray[0]) ) {
234 $destTitle = Title
::newFromText( $paramArray[0] );
236 $revert = '(' . $this->skin
->makeKnownLinkObj( SpecialPage
::getTitleFor( 'Movepage' ),
237 $this->message
['revertmove'],
238 'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) .
239 '&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) .
240 '&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) .
241 '&wpMovetalk=0' ) . ')';
243 // Show undelete link
244 } else if( self
::typeAction($row,array('delete','suppress'),'delete','delete') ) {
245 $revert = '(' . $this->skin
->makeKnownLinkObj( SpecialPage
::getTitleFor( 'Undelete' ),
246 $this->message
['undeletelink'], 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')';
247 // Show unblock/change block link
248 } else if( self
::typeAction($row,array('block','suppress'),array('block','reblock'),'block') ) {
250 $this->skin
->link( SpecialPage
::getTitleFor( 'Ipblocklist' ),
251 $this->message
['unblocklink'],
253 array( 'action' => 'unblock', 'ip' => $row->log_title
),
255 . $this->message
['pipe-separator'] .
256 $this->skin
->link( SpecialPage
::getTitleFor( 'Blockip', $row->log_title
),
257 $this->message
['change-blocklink'],
258 array(), array(), 'known' ) .
260 // Show change protection link
261 } else if( self
::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
263 $this->skin
->link( $title,
264 $this->message
['hist'],
266 array( 'action' => 'history', 'offset' => $row->log_timestamp
) );
267 if( $wgUser->isAllowed( 'protect' ) ) {
268 $revert .= $this->message
['pipe-separator'] .
269 $this->skin
->link( $title,
270 $this->message
['protect_change'],
272 array( 'action' => 'protect' ),
277 } else if( self
::typeAction($row,'merge','merge','mergehistory') ) {
278 $merge = SpecialPage
::getTitleFor( 'Mergehistory' );
279 $revert = '(' . $this->skin
->makeKnownLinkObj( $merge, $this->message
['revertmerge'],
280 wfArrayToCGI( array('target' => $paramArray[0], 'dest' => $title->getPrefixedDBkey(),
281 'mergepoint' => $paramArray[1] ) ) ) . ')';
282 // If an edit was hidden from a page give a review link to the history
283 } else if( self
::typeAction($row,array('delete','suppress'),'revision','deleterevision') ) {
284 if( count($paramArray) == 2 ) {
285 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
286 // Different revision types use different URL params...
287 $key = $paramArray[0];
288 // Link to each hidden object ID, $paramArray[1] is the url param
289 $Ids = explode( ',', $paramArray[1] );
291 foreach( $Ids as $n => $id ) {
292 $revParams .= '&' . urlencode($key) . '[]=' . urlencode($id);
294 $revert = '(' . $this->skin
->makeKnownLinkObj( $revdel, $this->message
['revdel-restore'],
295 'target=' . $title->getPrefixedUrl() . $revParams ) . ')';
297 // Hidden log items, give review link
298 } else if( self
::typeAction($row,array('delete','suppress'),'event','deleterevision') ) {
299 if( count($paramArray) == 1 ) {
300 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
301 $Ids = explode( ',', $paramArray[0] );
302 // Link to each hidden object ID, $paramArray[1] is the url param
304 foreach( $Ids as $n => $id ) {
305 $logParams .= '&logid[]=' . intval($id);
307 $revert = '(' . $this->skin
->makeKnownLinkObj( $revdel, $this->message
['revdel-restore'],
308 'target=' . $title->getPrefixedUrl() . $logParams ) . ')';
310 // Self-created users
311 } else if( self
::typeAction($row,'newusers','create2') ) {
312 if( isset( $paramArray[0] ) ) {
313 $revert = $this->skin
->userToolLinks( $paramArray[0], $title->getDBkey(), true );
315 # Fall back to a blue contributions link
316 $revert = $this->skin
->userToolLinks( 1, $title->getDBkey() );
318 if( $time < '20080129000000' ) {
319 # Suppress $comment from old entries (before 2008-01-29),
320 # not needed and can contain incorrect links
323 // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
325 wfRunHooks( 'LogLine', array( $row->log_type
, $row->log_action
, $title, $paramArray,
326 &$comment, &$revert, $row->log_timestamp
) );
329 if( self
::isDeleted($row,LogPage
::DELETED_ACTION
) ) {
330 $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
332 $action = LogPage
::actionText( $row->log_type
, $row->log_action
, $title,
333 $this->skin
, $paramArray, true );
337 list($tagDisplay, $newClasses) = ChangeTags
::formatSummaryRow( $row->ts_tags
, 'logevent' );
338 $classes = array_merge( $classes, $newClasses );
340 if( $revert != '' ) {
341 $revert = '<span class="mw-logevent-actionlink">' . $revert . '</span>';
344 return Xml
::tags( 'li', array( "class" => implode( ' ', $classes ) ),
345 $del . $time . ' ' . $userLink . ' ' . $action . ' ' . $comment . ' ' . $revert . " $tagDisplay" ) . "\n";
352 private function getShowHideLinks( $row ) {
353 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
354 // If event was hidden from sysops
355 if( !self
::userCan( $row, LogPage
::DELETED_RESTRICTED
) ) {
356 $del = Xml
::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.$this->message
['rev-delundel'].')' );
357 } else if( $row->log_type
== 'suppress' ) {
358 // No one should be hiding from the oversight log
359 $del = Xml
::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.$this->message
['rev-delundel'].')' );
361 $target = SpecialPage
::getTitleFor( 'Log', $row->log_type
);
362 $query = array( 'target' => $target->getPrefixedDBkey(),
363 'logid' => $row->log_id
365 $del = $this->skin
->revDeleteLink( $query, self
::isDeleted( $row, LogPage
::DELETED_RESTRICTED
) );
372 * @param $type Mixed: string/array
373 * @param $action Mixed: string/array
374 * @param $right string
377 public static function typeAction( $row, $type, $action, $right='' ) {
378 $match = is_array($type) ?
in_array($row->log_type
,$type) : $row->log_type
== $type;
380 $match = is_array($action) ?
381 in_array($row->log_action
,$action) : $row->log_action
== $action;
382 if( $match && $right ) {
384 $match = $wgUser->isAllowed( $right );
391 * Determine if the current user is allowed to view a particular
392 * field of this log row, if it's marked as deleted.
394 * @param $field Integer
397 public static function userCan( $row, $field ) {
398 if( ( $row->log_deleted
& $field ) == $field ) {
400 $permission = ( $row->log_deleted
& LogPage
::DELETED_RESTRICTED
) == LogPage
::DELETED_RESTRICTED
403 wfDebug( "Checking for $permission due to $field match on $row->log_deleted\n" );
404 return $wgUser->isAllowed( $permission );
412 * @param $field Integer: one of DELETED_* bitfield constants
415 public static function isDeleted( $row, $field ) {
416 return ($row->log_deleted
& $field) == $field;
420 * Quick function to show a short log extract
421 * @param $out OutputPage
422 * @param $type String
423 * @param $page String
424 * @param $user String
425 * @param $lim Integer
426 * @param $conds Array
428 public static function showLogExtract( $out, $type='', $page='', $user='', $lim=0, $conds=array() ) {
430 # Insert list of top 50 or so items
431 $loglist = new LogEventsList( $wgUser->getSkin(), $out, 0 );
432 $pager = new LogPager( $loglist, $type, $user, $page, '', $conds );
433 if( $lim > 0 ) $pager->mLimit
= $lim;
434 $logBody = $pager->getBody();
437 $loglist->beginLogEventsList() .
439 $loglist->endLogEventsList()
442 $out->addWikiMsg( 'logempty' );
444 return $pager->getNumRows();
448 * SQL clause to skip forbidden log types for this user
449 * @param $db Database
450 * @return mixed (string or false)
452 public static function getExcludeClause( $db ) {
453 global $wgLogRestrictions, $wgUser;
454 // Reset the array, clears extra "where" clauses when $par is used
455 $hiddenLogs = array();
456 // Don't show private logs to unprivileged users
457 foreach( $wgLogRestrictions as $logType => $right ) {
458 if( !$wgUser->isAllowed($right) ) {
459 $safeType = $db->strencode( $logType );
460 $hiddenLogs[] = $safeType;
463 if( count($hiddenLogs) == 1 ) {
464 return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
465 } elseif( $hiddenLogs ) {
466 return 'log_type NOT IN (' . $db->makeList($hiddenLogs) . ')';
475 class LogPager
extends ReverseChronologicalPager
{
476 private $type = '', $user = '', $title = '', $pattern = '';
477 public $mLogEventsList;
481 * @param $list LogEventsList
482 * @param $type String
483 * @param $user String
484 * @param $title String
485 * @param $pattern String
486 * @param $conds Array
487 * @param $year Integer
488 * @param $month Integer
490 public function __construct( $list, $type = '', $user = '', $title = '', $pattern = '',
491 $conds = array(), $year = false, $month = false, $tagFilter = '' )
493 parent
::__construct();
494 $this->mConds
= $conds;
496 $this->mLogEventsList
= $list;
498 $this->limitType( $type ); // also excludes hidden types
499 $this->limitUser( $user );
500 $this->limitTitle( $title, $pattern );
501 $this->getDateCond( $year, $month );
502 $this->mTagFilter
= $tagFilter;
505 public function getDefaultQuery() {
506 $query = parent
::getDefaultQuery();
510 public function getFilterParams() {
511 global $wgFilterLogTypes, $wgUser, $wgRequest;
516 foreach( $wgFilterLogTypes as $type => $default ) {
517 // Avoid silly filtering
518 if( $type !== 'patrol' ||
$wgUser->useNPPatrol() ) {
519 $hide = $wgRequest->getInt( "hide_{$type}_log", $default );
520 $filters[$type] = $hide;
522 $this->mConds
[] = 'log_type != ' . $this->mDb
->addQuotes( $type );
529 * Set the log reader to return only entries of the given type.
530 * Type restrictions enforced here
531 * @param $type String: A log type ('upload', 'delete', etc)
533 private function limitType( $type ) {
534 global $wgLogRestrictions, $wgUser;
535 // Don't even show header for private logs; don't recognize it...
536 if( isset($wgLogRestrictions[$type]) && !$wgUser->isAllowed($wgLogRestrictions[$type]) ) {
539 // Don't show private logs to unpriviledged users
540 $hideLogs = LogEventsList
::getExcludeClause( $this->mDb
);
541 if( $hideLogs !== false ) {
542 $this->mConds
[] = $hideLogs;
548 $this->mConds
['log_type'] = $type;
552 * Set the log reader to return only entries by the given user.
553 * @param $name String: (In)valid user name
555 private function limitUser( $name ) {
559 $usertitle = Title
::makeTitleSafe( NS_USER
, $name );
560 if( is_null($usertitle) ) {
563 /* Fetch userid at first, if known, provides awesome query plan afterwards */
564 $userid = User
::idFromName( $name );
566 /* It should be nicer to abort query at all,
567 but for now it won't pass anywhere behind the optimizer */
568 $this->mConds
[] = "NULL";
570 $this->mConds
['log_user'] = $userid;
571 // Paranoia: avoid brute force searches (bug 17342)
572 $this->mConds
[] = 'log_deleted & ' . LogPage
::DELETED_USER
. ' = 0';
573 $this->user
= $usertitle->getText();
578 * Set the log reader to return only entries affecting the given page.
579 * (For the block and rights logs, this is a user page.)
580 * @param $page String: Title name as text
581 * @param $pattern String
583 private function limitTitle( $page, $pattern ) {
586 $title = Title
::newFromText( $page );
587 if( strlen($page) == 0 ||
!$title instanceof Title
)
590 $this->title
= $title->getPrefixedText();
591 $ns = $title->getNamespace();
592 # Using the (log_namespace, log_title, log_timestamp) index with a
593 # range scan (LIKE) on the first two parts, instead of simple equality,
594 # makes it unusable for sorting. Sorted retrieval using another index
595 # would be possible, but then we might have to scan arbitrarily many
596 # nodes of that index. Therefore, we need to avoid this if $wgMiserMode
599 # This is not a problem with simple title matches, because then we can
600 # use the page_time index. That should have no more than a few hundred
601 # log entries for even the busiest pages, so it can be safely scanned
602 # in full to satisfy an impossible condition on user or similar.
603 if( $pattern && !$wgMiserMode ) {
604 # use escapeLike to avoid expensive search patterns like 't%st%'
605 $safetitle = $this->mDb
->escapeLike( $title->getDBkey() );
606 $this->mConds
['log_namespace'] = $ns;
607 $this->mConds
[] = "log_title LIKE '$safetitle%'";
608 $this->pattern
= $pattern;
610 $this->mConds
['log_namespace'] = $ns;
611 $this->mConds
['log_title'] = $title->getDBkey();
613 // Paranoia: avoid brute force searches (bug 17342)
614 $this->mConds
[] = 'log_deleted & ' . LogPage
::DELETED_ACTION
. ' = 0';
617 public function getQueryInfo() {
618 $this->mConds
[] = 'user_id = log_user';
619 # Don't use the wrong logging index
620 if( $this->title ||
$this->pattern ||
$this->user
) {
621 $index = array( 'USE INDEX' => array( 'logging' => array('page_time','user_time') ) );
622 } else if( $this->type
) {
623 $index = array( 'USE INDEX' => array( 'logging' => 'type_time' ) );
625 $index = array( 'USE INDEX' => array( 'logging' => 'times' ) );
628 'tables' => array( 'logging', 'user' ),
629 'fields' => array( 'log_type', 'log_action', 'log_user', 'log_namespace', 'log_title', 'log_params',
630 'log_comment', 'log_id', 'log_deleted', 'log_timestamp', 'user_name', 'user_editcount' ),
631 'conds' => $this->mConds
,
633 'join_conds' => array( 'user' => array( 'INNER JOIN', 'user_id=log_user' ) ),
636 ChangeTags
::modifyDisplayQuery( $info['tables'], $info['fields'], $info['conds'], $info['join_conds'], $this->mTagFilter
);
641 function getIndexField() {
642 return 'log_timestamp';
645 public function getStartBody() {
646 wfProfileIn( __METHOD__
);
647 # Do a link batch query
648 if( $this->getNumRows() > 0 ) {
650 while( $row = $this->mResult
->fetchObject() ) {
651 $lb->add( $row->log_namespace
, $row->log_title
);
652 $lb->addObj( Title
::makeTitleSafe( NS_USER
, $row->user_name
) );
653 $lb->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->user_name
) );
656 $this->mResult
->seek( 0 );
658 wfProfileOut( __METHOD__
);
662 public function formatRow( $row ) {
663 return $this->mLogEventsList
->logLine( $row );
666 public function getType() {
670 public function getUser() {
674 public function getPage() {
678 public function getPattern() {
679 return $this->pattern
;
682 public function getYear() {
686 public function getMonth() {
687 return $this->mMonth
;
690 public function getTagFilter() {
691 return $this->mTagFilter
;
697 * @ingroup SpecialPage
702 * @param $request WebRequest: for internal use use a FauxRequest object to pass arbitrary parameters.
704 function __construct( $request ) {
705 global $wgUser, $wgOut;
706 wfDeprecated(__METHOD__
);
708 $type = $request->getVal( 'type' );
709 $user = $request->getText( 'user' );
710 $title = $request->getText( 'page' );
711 $pattern = $request->getBool( 'pattern' );
712 $year = $request->getIntOrNull( 'year' );
713 $month = $request->getIntOrNull( 'month' );
714 $tagFilter = $request->getVal( 'tagfilter' );
715 # Don't let the user get stuck with a certain date
716 $skip = $request->getText( 'offset' ) ||
$request->getText( 'dir' ) == 'prev';
721 # Use new list class to output results
722 $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
723 $this->pager
= new LogPager( $loglist, $type, $user, $title, $pattern, $year, $month, $tagFilter );
727 * Is there at least one row?
730 public function hasRows() {
731 return isset($this->pager
) ?
($this->pager
->getNumRows() > 0) : false;
737 * @ingroup SpecialPage
740 const NO_ACTION_LINK
= 1;
748 * @param &$reader LogReader: where to get our data from
749 * @param $flags Integer: Bitwise combination of flags:
750 * LogEventsList::NO_ACTION_LINK Don't show restore/unblock/block links
752 function __construct( &$reader, $flags = 0 ) {
754 wfDeprecated(__METHOD__
);
755 $this->reader
=& $reader;
756 $this->reader
->pager
->mLogEventsList
->flags
= $flags;
757 # Aliases for shorter code...
758 $this->pager
=& $this->reader
->pager
;
759 $this->list =& $this->reader
->pager
->mLogEventsList
;
763 * Take over the whole output page in $wgOut with the log display.
765 public function show() {
766 # Set title and add header
767 $this->list->showHeader( $pager->getType() );
769 $this->list->showOptions( $this->pager
->getType(), $this->pager
->getUser(), $this->pager
->getPage(),
770 $this->pager
->getPattern(), $this->pager
->getYear(), $this->pager
->getMonth() );
772 $logBody = $this->pager
->getBody();
775 $this->pager
->getNavigationBar() .
776 $this->list->beginLogEventsList() .
778 $this->list->endLogEventsList() .
779 $this->pager
->getNavigationBar()
782 $wgOut->addWikiMsg( 'logempty' );
787 * Output just the list of entries given by the linked LogReader,
788 * with extraneous UI elements. Use for displaying log fragments in
789 * another page (eg at Special:Undelete)
790 * @param $out OutputPage: where to send output
792 public function showList( &$out ) {
793 $logBody = $this->pager
->getBody();
796 $this->list->beginLogEventsList() .
798 $this->list->endLogEventsList()
801 $out->addWikiMsg( 'logempty' );