class LogEventsList {
const NO_ACTION_LINK = 1;
-
+
private $skin;
private $out;
public $flags;
}
}
}
-
+
/**
* Set page title and show header for this log type
* @param strin $type
$action = htmlspecialchars( $wgScript );
$title = SpecialPage::getTitleFor( 'Log' );
$special = htmlspecialchars( $title->getPrefixedDBkey() );
-
+
$this->out->addHTML( "<form action=\"$action\" method=\"get\"><fieldset>" .
Xml::element( 'legend', array(), wfMsg( 'log' ) ) .
Xml::hidden( 'title', $special ) . "\n" .
*/
private function getTypeMenu( $queryType ) {
global $wgLogRestrictions, $wgUser;
-
+
$html = "<select name='type'>\n";
$validTypes = LogPage::validTypes();
private function getTitleInput( $title ) {
return Xml::inputLabel( wfMsg( 'speciallogtitlelabel' ), 'page', 'page', 20, $title );
}
-
+
/**
* @return string Formatted HTML
* @param int $year
Xml::checkLabel( wfMsg( 'log-title-wildcard' ), 'pattern', 'pattern', $pattern ) .
'</span>';
}
-
+
public function beginLogEventsList() {
return "<ul>\n";
}
-
+
public function endLogEventsList() {
return "</ul>\n";
}
-
+
/**
* @param Row $row a single row from the result set
* @return string Formatted HTML list item
*/
public function logLine( $row ) {
global $wgLang, $wgUser, $wgContLang;
-
+
$title = Title::makeTitle( $row->log_namespace, $row->log_title );
$time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->log_timestamp), true );
// User links
} else if ( self::typeAction($row,'merge','merge') ) {
$merge = SpecialPage::getTitleFor( 'Mergehistory' );
$revert = '(' . $this->skin->makeKnownLinkObj( $merge, $this->message['revertmerge'],
- wfArrayToCGI(
- array('target' => $paramArray[0], 'dest' => $title->getPrefixedText(), 'mergepoint' => $paramArray[1] )
- )
+ wfArrayToCGI(
+ array('target' => $paramArray[0], 'dest' => $title->getPrefixedText(), 'mergepoint' => $paramArray[1] )
+ )
) . ')';
// If an edit was hidden from a page give a review link to the history
} else if( self::typeAction($row,'delete','revision') && $wgUser->isAllowed( 'deleterevision' ) && isset($paramArray[2]) ) {
}
$revert = "($revert)";
} else {
- wfRunHooks( 'LogLine', array( $row->log_type, $row->log_action, $title, $paramArray,
+ wfRunHooks( 'LogLine', array( $row->log_type, $row->log_action, $title, $paramArray,
&$comment, &$revert, $row->log_timestamp ) );
// wfDebug( "Invoked LogLine hook for " $row->log_type . ", " . $row->log_action . "\n" );
// Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
} else {
$action = LogPage::actionText( $row->log_type, $row->log_action, $title, $this->skin, $paramArray, true );
}
-
+
return "<li>$del$time $userLink $action $comment $revert</li>\n";
}
-
+
/**
* @param Row $row
* @return string
*/
private function showhideLinks( $row ) {
global $wgAllowLogDeletion;
-
+
if( !$wgAllowLogDeletion )
return "";
-
+
$revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
// If event was hidden from sysops
if( !self::userCan( $row, LogPage::DELETED_RESTRICTED ) ) {
}
return "<tt>(<small>$del</small>)</tt>";
}
-
+
/**
* @param Row $row
* @param string $type
public static function typeAction( $row, $type, $action ) {
return ( $row->log_type == $type && $row->log_action == $action );
}
-
+
/**
* Determine if the current user is allowed to view a particular
* field of this log row, if it's marked as deleted.
public static function isDeleted( $row, $field ) {
return ($row->log_deleted & $field) == $field;
}
-
+
/**
* Quick function to show a short log extract
* @param OutputPage $out
$out->addWikiMsg( 'logempty' );
}
}
-
+
/**
* SQL clause to skip forbidden log types for this user
* @param Database $db
function __construct( $list, $type='', $user='', $title='', $pattern='', $conds=array(), $y=false, $m=false ) {
parent::__construct();
$this->mConds = $conds;
-
+
$this->mLogEventsList = $list;
-
+
$this->limitType( $type );
$this->limitUser( $user );
$this->limitTitle( $title, $pattern );
$this->limitDate( $y, $m );
}
-
+
function getDefaultQuery() {
$query = parent::getDefaultQuery();
$query['type'] = $this->type;
$query['year'] = $this->year;
return $query;
}
-
+
/**
* Set the log reader to return only entries of the given type.
* Type restrictions enforced here
$this->type = $type;
$this->mConds['log_type'] = $type;
}
-
+
/**
* Set the log reader to return only entries by the given user.
* @param string $name (In)valid user name
/* Fetch userid at first, if known, provides awesome query plan afterwards */
$userid = User::idFromName( $name );
if( !$userid ) {
- /* It should be nicer to abort query at all,
+ /* It should be nicer to abort query at all,
but for now it won't pass anywhere behind the optimizer */
$this->mConds[] = "NULL";
} else {
*/
function limitTitle( $page, $pattern ) {
global $wgMiserMode;
-
+
$title = Title::newFromText( $page );
if( strlen($page) == 0 || !$title instanceof Title )
return false;
-
+
$this->title = $title->getPrefixedText();
$ns = $title->getNamespace();
if( $pattern && !$wgMiserMode ) {
$this->mConds['log_title'] = $title->getDBkey();
}
}
-
+
/**
* Set the log reader to return only entries from given date.
* @param int $year
function limitDate( $year, $month ) {
$year = intval($year);
$month = intval($month);
-
+
$this->year = ($year > 0 && $year < 10000) ? $year : '';
$this->month = ($month > 0 && $month < 13) ? $month : '';
-
+
if( $this->year || $this->month ) {
// Assume this year if only a month is given
if( $this->year ) {
$year_start--;
}
}
-
+
if( $this->month ) {
$month_end = str_pad($this->month + 1, 2, '0', STR_PAD_LEFT);
$year_end = $year_start;
}
return array(
'tables' => array( 'logging', 'user' ),
- 'fields' => array( 'log_type', 'log_action', 'log_user', 'log_namespace', 'log_title', 'log_params',
+ 'fields' => array( 'log_type', 'log_action', 'log_user', 'log_namespace', 'log_title', 'log_params',
'log_comment', $log_id, 'log_deleted', 'log_timestamp', 'user_name', 'user_editcount' ),
'conds' => $this->mConds,
'options' => $index
function getIndexField() {
return 'log_timestamp';
}
-
+
function getStartBody() {
wfProfileIn( __METHOD__ );
# Do a link batch query
function formatRow( $row ) {
return $this->mLogEventsList->logLine( $row );
}
-
+
public function getType() {
return $this->type;
}
-
+
public function getUser() {
return $this->user;
}
-
+
public function getPage() {
return $this->title;
}
-
+
public function getPattern() {
return $this->pattern;
}
-
+
public function getYear() {
return $this->year;
}
-
+
public function getMonth() {
return $this->month;
}
$loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
$this->pager = new LogPager( $loglist, $type, $user, $title, $pattern, $y, $m );
}
-
+
/**
* Is there at least one row?
* @return bool
# Set title and add header
$this->list->showHeader( $pager->getType() );
# Show form options
- $this->list->showOptions( $this->pager->getType(), $this->pager->getUser(), $this->pager->getPage(),
+ $this->list->showOptions( $this->pager->getType(), $this->pager->getUser(), $this->pager->getPage(),
$this->pager->getPattern(), $this->pager->getYear(), $this->pager->getMonth() );
# Insert list
$logBody = $this->pager->getBody();
if( $logBody ) {
$wgOut->addHTML(
- $this->pager->getNavigationBar() .
+ $this->pager->getNavigationBar() .
$this->list->beginLogEventsList() .
$logBody .
$this->list->endLogEventsList() .
}
}
}
-