* Overridden by RevDel_ArchiveItem.
*/
protected function getRevisionLink() {
- global $wgLang;
- $date = $wgLang->timeanddate( $this->revision->getTimestamp(), true );
+ $date = $this->getLang()->timeanddate( $this->revision->getTimestamp(), true );
if ( $this->isDeleted() && !$this->canViewContent() ) {
return $date;
}
- return $this->special->skin->link(
+ return Linker::link(
$this->list->title,
$date,
array(),
return wfMsgHtml('diff');
} else {
return
- $this->special->skin->link(
+ Linker::link(
$this->list->title,
wfMsgHtml('diff'),
array(),
public function getHTML() {
$difflink = $this->getDiffLink();
$revlink = $this->getRevisionLink();
- $userlink = $this->special->skin->revUserLink( $this->revision );
- $comment = $this->special->skin->revComment( $this->revision );
+ $userlink = Linker::revUserLink( $this->revision );
+ $comment = Linker::revComment( $this->revision );
if ( $this->isDeleted() ) {
$revlink = "<span class=\"history-deleted\">$revlink</span>";
}
}
protected function getRevisionLink() {
- global $wgLang;
$undelete = SpecialPage::getTitleFor( 'Undelete' );
- $date = $wgLang->timeanddate( $this->revision->getTimestamp(), true );
+ $date = $this->getLang()->timeanddate( $this->revision->getTimestamp(), true );
if ( $this->isDeleted() && !$this->canViewContent() ) {
return $date;
}
- return $this->special->skin->link( $undelete, $date, array(),
+ return Linker::link( $undelete, $date, array(),
array(
'target' => $this->list->title->getPrefixedText(),
'timestamp' => $this->revision->getTimestamp()
return wfMsgHtml( 'diff' );
}
$undelete = SpecialPage::getTitleFor( 'Undelete' );
- return $this->special->skin->link( $undelete, wfMsgHtml('diff'), array(),
+ return Linker::link( $undelete, wfMsgHtml('diff'), array(),
array(
'target' => $this->list->title->getPrefixedText(),
'diff' => 'prev',
* Overridden by RevDel_ArchivedFileItem.
*/
protected function getLink() {
- global $wgLang, $wgUser;
- $date = $wgLang->timeanddate( $this->file->getTimestamp(), true );
+ $date = $this->getLang()->timeanddate( $this->file->getTimestamp(), true );
if ( $this->isDeleted() ) {
# Hidden files...
if ( !$this->canViewContent() ) {
$link = $date;
} else {
- $link = $this->special->skin->link(
+ $link = Linker::link(
$this->special->getTitle(),
$date, array(),
array(
'target' => $this->list->title->getPrefixedText(),
'file' => $this->file->getArchiveName(),
- 'token' => $wgUser->editToken( $this->file->getArchiveName() )
+ 'token' => $this->getUser()->editToken( $this->file->getArchiveName() )
)
);
}
*/
protected function getUserTools() {
if( $this->file->userCan( Revision::DELETED_USER ) ) {
- $link = $this->special->skin->userLink( $this->file->user, $this->file->user_text ) .
- $this->special->skin->userToolLinks( $this->file->user, $this->file->user_text );
+ $link = Linker::userLink( $this->file->user, $this->file->user_text ) .
+ Linker::userToolLinks( $this->file->user, $this->file->user_text );
} else {
$link = wfMsgHtml( 'rev-deleted-user' );
}
*/
protected function getComment() {
if( $this->file->userCan( File::DELETED_COMMENT ) ) {
- $block = $this->special->skin->commentBlock( $this->file->description );
+ $block = Linker::commentBlock( $this->file->description );
} else {
$block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
}
}
public function getHTML() {
- global $wgLang;
$data =
wfMsg(
'widthheight',
- $wgLang->formatNum( $this->file->getWidth() ),
- $wgLang->formatNum( $this->file->getHeight() )
+ $this->getLang()->formatNum( $this->file->getWidth() ),
+ $this->getLang()->formatNum( $this->file->getHeight() )
) .
' (' .
- wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $this->file->getSize() ) ) .
+ wfMsgExt( 'nbytes', 'parsemag', $this->getLang()->formatNum( $this->file->getSize() ) ) .
')';
return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
}
protected function getLink() {
- global $wgLang, $wgUser;
- $date = $wgLang->timeanddate( $this->file->getTimestamp(), true );
+ $date = $this->getLang()->timeanddate( $this->file->getTimestamp(), true );
$undelete = SpecialPage::getTitleFor( 'Undelete' );
$key = $this->file->getKey();
# Hidden files...
if( !$this->canViewContent() ) {
$link = $date;
} else {
- $link = $this->special->skin->link( $undelete, $date, array(),
+ $link = Linker::link( $undelete, $date, array(),
array(
'target' => $this->list->title->getPrefixedText(),
'file' => $key,
- 'token' => $wgUser->editToken( $key )
+ 'token' => $this->getUser()->editToken( $key )
)
);
}
}
public function getHTML() {
- global $wgLang;
-
- $date = htmlspecialchars( $wgLang->timeanddate( $this->row->log_timestamp ) );
+ $date = htmlspecialchars( $this->getLang()->timeanddate( $this->row->log_timestamp ) );
$paramArray = LogPage::extractParams( $this->row->log_params );
$title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
// Log link for this page
- $loglink = $this->special->skin->link(
+ $loglink = Linker::link(
SpecialPage::getTitleFor( 'Log' ),
wfMsgHtml( 'log' ),
array(),
$action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$action = LogPage::actionText( $this->row->log_type, $this->row->log_action, $title,
- $this->special->skin, $paramArray, true, true );
+ $this->special->getSkin(), $paramArray, true, true );
if( $this->row->log_deleted & LogPage::DELETED_ACTION )
$action = '<span class="history-deleted">' . $action . '</span>';
}
// User links
- $userLink = $this->special->skin->userLink( $this->row->log_user,
+ $userLink = Linker::userLink( $this->row->log_user,
User::WhoIs( $this->row->log_user ) );
if( LogEventsList::isDeleted($this->row,LogPage::DELETED_USER) ) {
$userLink = '<span class="history-deleted">' . $userLink . '</span>';
}
// Comment
- $comment = $wgLang->getDirMark() . $this->special->skin->commentBlock( $this->row->log_comment );
+ $comment = $this->getLang()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
if( LogEventsList::isDeleted($this->row,LogPage::DELETED_COMMENT) ) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
* @ingroup SpecialPage
*/
class SpecialRevisionDelete extends UnlistedSpecialPage {
- /** Skin object */
- var $skin;
-
/** True if the submit button was clicked, and the form was posted */
var $submitClicked;
}
public function execute( $par ) {
- global $wgOut, $wgUser, $wgRequest;
- if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
- $wgOut->permissionRequired( 'deletedhistory' );
+ $output = $this->getOutput();
+ $user = $this->getUser();
+ if( !$user->isAllowed( 'deletedhistory' ) ) {
+ $output->permissionRequired( 'deletedhistory' );
return;
} else if( wfReadOnly() ) {
- $wgOut->readOnlyPage();
+ $output->readOnlyPage();
return;
}
- $this->mIsAllowed = $wgUser->isAllowed('deleterevision'); // for changes
- $this->skin = $wgUser->getSkin();
+ $this->mIsAllowed = $user->isAllowed('deleterevision'); // for changes
$this->setHeaders();
$this->outputHeader();
- $this->submitClicked = $wgRequest->wasPosted() && $wgRequest->getBool( 'wpSubmit' );
+ $request = $this->getRequest();
+ $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' );
# Handle our many different possible input types.
- $ids = $wgRequest->getVal( 'ids' );
+ $ids = $request->getVal( 'ids' );
if ( !is_null( $ids ) ) {
# Allow CSV, for backwards compatibility, or a single ID for show/hide links
$this->ids = explode( ',', $ids );
} else {
# Array input
- $this->ids = array_keys( $wgRequest->getArray('ids',array()) );
+ $this->ids = array_keys( $request->getArray('ids',array()) );
}
// $this->ids = array_map( 'intval', $this->ids );
$this->ids = array_unique( array_filter( $this->ids ) );
- if ( $wgRequest->getVal( 'action' ) == 'historysubmit' ) {
- # For show/hide form submission from history page
- $this->targetObj = $GLOBALS['wgTitle'];
+ if ( $request->getVal( 'action' ) == 'historysubmit' ) {
+ // For show/hide form submission from history page
+ // Since we are access through index.php?title=XXX&action=historysubmit
+ // getFullTitle() will contain the target title and not our title
+ $this->targetObj = $this->getFullTitle();
$this->typeName = 'revision';
} else {
- $this->typeName = $wgRequest->getVal( 'type' );
- $this->targetObj = Title::newFromText( $wgRequest->getText( 'target' ) );
+ $this->typeName = $request->getVal( 'type' );
+ $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
}
# For reviewing deleted files...
- $this->archiveName = $wgRequest->getVal( 'file' );
- $this->token = $wgRequest->getVal( 'token' );
+ $this->archiveName = $request->getVal( 'file' );
+ $this->token = $request->getVal( 'token' );
if ( $this->archiveName && $this->targetObj ) {
$this->tryShowFile( $this->archiveName );
return;
# No targets?
if( !isset( self::$allowedTypes[$this->typeName] ) || count( $this->ids ) == 0 ) {
- $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
+ $output->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
return;
}
$this->typeInfo = self::$allowedTypes[$this->typeName];
$this->targetObj = $rev ? $rev->getTitle() : $this->targetObj;
}
- $this->otherReason = $wgRequest->getVal( 'wpReason' );
+ $this->otherReason = $request->getVal( 'wpReason' );
# We need a target page!
if( is_null($this->targetObj) ) {
- $wgOut->addWikiMsg( 'undelete-header' );
+ $output->addWikiMsg( 'undelete-header' );
return;
}
# Give a link to the logs/hist for this page
array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ),
array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER )
);
- if( $wgUser->isAllowed('suppressrevision') ) {
+ if( $user->isAllowed('suppressrevision') ) {
$this->checks[] = array( 'revdelete-hide-restricted',
'wpHideRestricted', Revision::DELETED_RESTRICTED );
}
# Either submit or create our form
if( $this->mIsAllowed && $this->submitClicked ) {
- $this->submit( $wgRequest );
+ $this->submit( $request );
} else {
$this->showForm();
}
$qc = $this->getLogQueryCond();
# Show relevant lines from the deletion log
- $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $wgOut, 'delete',
+ $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
+ LogEventsList::showLogExtract( $output, 'delete',
$this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
# Show relevant lines from the suppression log
- if( $wgUser->isAllowed( 'suppressionlog' ) ) {
- $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $wgOut, 'suppress',
+ if( $user->isAllowed( 'suppressionlog' ) ) {
+ $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
+ LogEventsList::showLogExtract( $output, 'suppress',
$this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
}
}
* Show some useful links in the subtitle
*/
protected function showConvenienceLinks() {
- global $wgOut, $wgUser, $wgLang;
# Give a link to the logs/hist for this page
if( $this->targetObj ) {
$links = array();
- $links[] = $this->skin->linkKnown(
+ $links[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Log' ),
wfMsgHtml( 'viewpagelogs' ),
array(),
);
if ( $this->targetObj->getNamespace() != NS_SPECIAL ) {
# Give a link to the page history
- $links[] = $this->skin->linkKnown(
+ $links[] = Linker::linkKnown(
$this->targetObj,
wfMsgHtml( 'pagehist' ),
array(),
array( 'action' => 'history' )
);
# Link to deleted edits
- if( $wgUser->isAllowed('undelete') ) {
+ if( $this->getUser()->isAllowed('undelete') ) {
$undelete = SpecialPage::getTitleFor( 'Undelete' );
- $links[] = $this->skin->linkKnown(
+ $links[] = Linker::linkKnown(
$undelete,
wfMsgHtml( 'deletedhist' ),
array(),
}
}
# Logs themselves don't have histories or archived revisions
- $wgOut->setSubtitle( '<p>' . $wgLang->pipeList( $links ) . '</p>' );
+ $this->getOutput()->setSubtitle( '<p>' . $this->getLang()->pipeList( $links ) . '</p>' );
}
}
* TODO Mostly copied from Special:Undelete. Refactor.
*/
protected function tryShowFile( $archiveName ) {
- global $wgOut, $wgRequest, $wgUser, $wgLang;
-
$repo = RepoGroup::singleton()->getLocalRepo();
$oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName );
$oimage->load();
// Check if user is allowed to see this file
if ( !$oimage->exists() ) {
- $wgOut->addWikiMsg( 'revdelete-no-file' );
+ $this->getOutput()->addWikiMsg( 'revdelete-no-file' );
return;
}
if( !$oimage->userCan(File::DELETED_FILE) ) {
if( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
- $wgOut->permissionRequired( 'suppressrevision' );
+ $this->getOutput()->permissionRequired( 'suppressrevision' );
} else {
- $wgOut->permissionRequired( 'deletedtext' );
+ $this->getOutput()->permissionRequired( 'deletedtext' );
}
return;
}
- if ( !$wgUser->matchEditToken( $this->token, $archiveName ) ) {
- $wgOut->addWikiMsg( 'revdelete-show-file-confirm',
+ if ( !$this->getUser()->matchEditToken( $this->token, $archiveName ) ) {
+ $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm',
$this->targetObj->getText(),
- $wgLang->date( $oimage->getTimestamp() ),
- $wgLang->time( $oimage->getTimestamp() ) );
- $wgOut->addHTML(
+ $this->getLang()->date( $oimage->getTimestamp() ),
+ $this->getLang()->time( $oimage->getTimestamp() ) );
+ $this->getOutput()->addHTML(
Xml::openElement( 'form', array(
'method' => 'POST',
'action' => $this->getTitle()->getLocalUrl(
'target=' . urlencode( $oimage->getName() ) .
'&file=' . urlencode( $archiveName ) .
- '&token=' . urlencode( $wgUser->editToken( $archiveName ) ) )
+ '&token=' . urlencode( $this->getUser()->editToken( $archiveName ) ) )
)
) .
Xml::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) .
);
return;
}
- $wgOut->disable();
+ $this->getOutput()->disable();
# We mustn't allow the output to be Squid cached, otherwise
# if an admin previews a deleted image, and it's cached, then
# a user without appropriate permissions can toddle off and
# nab the image, and Squid will serve it
- $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
- $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
- $wgRequest->response()->header( 'Pragma: no-cache' );
+ $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
+ $this->getRequest()->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
+ $this->getRequest()->response()->header( 'Pragma: no-cache' );
# Stream the file to the client
global $IP;
* which will allow the user to choose new visibility settings.
*/
protected function showForm() {
- global $wgOut, $wgUser, $wgLang;
$UserAllowed = true;
if ( $this->typeName == 'logging' ) {
- $wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->ids) ) );
+ $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLang()->formatNum( count($this->ids) ) );
} else {
- $wgOut->addWikiMsg( 'revdelete-selected',
+ $this->getOutput()->addWikiMsg( 'revdelete-selected',
$this->targetObj->getPrefixedText(), count( $this->ids ) );
}
- $wgOut->addHTML( "<ul>" );
+ $this->getOutput()->addHTML( "<ul>" );
$numRevisions = 0;
// Live revisions...
$item = $list->current();
if ( !$item->canView() ) {
if( !$this->submitClicked ) {
- $wgOut->permissionRequired( 'suppressrevision' );
+ $this->getOutput()->permissionRequired( 'suppressrevision' );
return;
}
$UserAllowed = false;
}
$numRevisions++;
- $wgOut->addHTML( $item->getHTML() );
+ $this->getOutput()->addHTML( $item->getHTML() );
}
if( !$numRevisions ) {
- $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
+ $this->getOutput()->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
return;
}
- $wgOut->addHTML( "</ul>" );
+ $this->getOutput()->addHTML( "</ul>" );
// Explanation text
$this->addUsageText();
'</td>' .
"</tr>\n" .
Xml::closeElement( 'table' ) .
- Html::hidden( 'wpEditToken', $wgUser->editToken() ) .
+ Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) .
Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
Html::hidden( 'type', $this->typeName ) .
Html::hidden( 'ids', implode( ',', $this->ids ) ) .
if( $this->mIsAllowed ) {
$out .= Xml::closeElement( 'form' ) . "\n";
// Show link to edit the dropdown reasons
- if( $wgUser->isAllowed( 'editinterface' ) ) {
+ if( $this->getUser()->isAllowed( 'editinterface' ) ) {
$title = Title::makeTitle( NS_MEDIAWIKI, 'revdelete-reason-dropdown' );
- $link = $wgUser->getSkin()->link(
+ $link = Linker::link(
$title,
wfMsgHtml( 'revdelete-edit-reasonlist' ),
array(),
$out .= Xml::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n";
}
}
- $wgOut->addHTML( $out );
+ $this->getOutput()->addHTML( $out );
}
/**
* @todo FIXME: Wikimedia-specific policy text
*/
protected function addUsageText() {
- global $wgOut, $wgUser;
- $wgOut->addWikiMsg( 'revdelete-text' );
- if( $wgUser->isAllowed( 'suppressrevision' ) ) {
- $wgOut->addWikiMsg( 'revdelete-suppress-text' );
+ $this->getOutput()->addWikiMsg( 'revdelete-text' );
+ if( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
+ $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
}
if( $this->mIsAllowed ) {
- $wgOut->addWikiMsg( 'revdelete-confirm' );
+ $this->getOutput()->addWikiMsg( 'revdelete-confirm' );
}
}
* @return String: HTML
*/
protected function buildCheckBoxes() {
- global $wgRequest;
-
$html = '<table>';
// If there is just one item, use checkboxes
$list = $this->getList();
$list->reset();
$bitfield = $list->current()->getBits(); // existing field
if( $this->submitClicked ) {
- $bitfield = $this->extractBitfield( $this->extractBitParams($wgRequest), $bitfield );
+ $bitfield = $this->extractBitfield( $this->extractBitParams(), $bitfield );
}
foreach( $this->checks as $item ) {
list( $message, $name, $field ) = $item;
list( $message, $name, $field ) = $item;
// If there are several items, use third state by default...
if( $this->submitClicked ) {
- $selected = $wgRequest->getInt( $name, 0 /* unchecked */ );
+ $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
} else {
$selected = -1; // use existing field
}
/**
* UI entry point for form submission.
- * @param $request WebRequest
*/
- protected function submit( $request ) {
- global $wgUser, $wgOut;
+ protected function submit() {
# Check edit token on submission
- if( $this->submitClicked && !$wgUser->matchEditToken( $request->getVal('wpEditToken') ) ) {
- $wgOut->addWikiMsg( 'sessionfailure' );
+ if( $this->submitClicked && !$this->getUser()->matchEditToken( $this->getRequest()->getVal('wpEditToken') ) ) {
+ $this->getOutput()->addWikiMsg( 'sessionfailure' );
return false;
}
- $bitParams = $this->extractBitParams( $request );
- $listReason = $request->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown
+ $bitParams = $this->extractBitParams();
+ $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown
$comment = $listReason;
if( $comment != 'other' && $this->otherReason != '' ) {
// Entry from drop down menu + additional comment
$comment = $this->otherReason;
}
# Can the user set this field?
- if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$wgUser->isAllowed('suppressrevision') ) {
- $wgOut->permissionRequired( 'suppressrevision' );
+ if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$this->getUser()->isAllowed('suppressrevision') ) {
+ $this->getOutput()->permissionRequired( 'suppressrevision' );
return false;
}
# If the save went through, go to success message...
* Report that the submit operation succeeded
*/
protected function success() {
- global $wgOut;
- $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
- $wgOut->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeInfo['success'] );
+ $this->getOutput()->setPagetitle( wfMsg( 'actioncomplete' ) );
+ $this->getOutput()->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeInfo['success'] );
$this->list->reloadFromMaster();
$this->showForm();
}
* Report that the submit operation failed
*/
protected function failure( $status ) {
- global $wgOut;
- $wgOut->setPagetitle( wfMsg( 'actionfailed' ) );
- $wgOut->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) );
+ $this->getOutput()->setPagetitle( wfMsg( 'actionfailed' ) );
+ $this->getOutput()->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) );
$this->showForm();
}
/**
* Put together an array that contains -1, 0, or the *_deleted const for each bit
- * @param $request WebRequest
+ *
* @return array
*/
- protected function extractBitParams( $request ) {
+ protected function extractBitParams() {
$bitfield = array();
foreach( $this->checks as $item ) {
list( /* message */ , $name, $field ) = $item;
- $val = $request->getInt( $name, 0 /* unchecked */ );
+ $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
if( $val < -1 || $val > 1) {
$val = -1; // -1 for existing value
}