/**
* Constructor from a page id
* @param $id Int article ID to load
+ * @returnImagePage|null
*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
$wgOut->setPageTitle( $this->getTitle()->getPrefixedText() );
$wgOut->addHTML( $this->viewRedirect( Title::makeTitle( NS_FILE, $this->mPage->getFile()->getName() ),
/* $appendSubtitle */ true, /* $forceKnown */ true ) );
- $this->mPage->viewUpdates();
+ $this->mPage->doViewUpdates( $this->getContext()->getUser() );
return;
}
}
# Just need to set the right headers
$wgOut->setArticleFlag( true );
$wgOut->setPageTitle( $this->getTitle()->getPrefixedText() );
- $this->mPage->viewUpdates();
+ $this->mPage->doViewUpdates( $this->getContext()->getUser() );
}
# Show shared description, if needed
protected function openShowImage() {
global $wgOut, $wgUser, $wgImageLimits, $wgRequest,
- $wgLang, $wgEnableUploads;
+ $wgLang, $wgEnableUploads, $wgSend404Code;
$this->loadFile();
}
$msgsmall = wfMessage( 'show-big-image-preview' )->
rawParams( $this->makeSizeLink( $params, $width, $height ) )->
- parse() . ' ' .
+ parse();
+ if ( count( $otherSizes ) && $this->displayImg->getRepo()->canTransformVia404() ) {
+ $msgsmall .= ' ' .
Html::rawElement( 'span', array( 'class' => 'mw-filepage-other-resolutions' ),
wfMessage( 'show-big-image-other' )->rawParams( $wgLang->pipeList( $otherSizes ) )->
params( count( $otherSizes ) )->parse()
);
+ }
} elseif ( $width == 0 && $height == 0 ){
# Some sort of audio file that doesn't have dimensions
# Don't output a no hi res message for such a file
wfMsgExt( 'imgmultigoto', array( 'parseinline', 'replaceafter' ), $select ) .
Xml::submitButton( wfMsg( 'imgmultigo' ) ) .
Xml::closeElement( 'form' ) .
- "<hr />$thumb1\n$thumb2<br clear=\"all\" /></div></td></tr></table>"
+ "<hr />$thumb1\n$thumb2<br style=\"clear: both\" /></div></td></tr></table>"
);
}
} else {
// by Article::View().
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
- if ( !$this->getID() ) {
+ if ( !$this->getID() && $wgSend404Code ) {
// If there is no image, no shared image, and no description page,
// output a 404, to be consistent with articles.
$wgRequest->response()->header( 'HTTP/1.1 404 Not Found' );
* Delete the file, or an earlier version of it
*/
public function delete() {
- global $wgUploadMaintenance;
-
$file = $this->mPage->getFile();
if ( !$file->exists() || !$file->isLocal() || $file->getRedirected() ) {
// Standard article deletion
array(
'action' => 'revert',
'oldimage' => $img,
- 'wpEditToken' => $wgUser->editToken( $img )
+ 'wpEditToken' => $wgUser->getEditToken( $img )
),
array( 'known', 'noclasses' )
);
$row .= "<td $selected style='white-space: nowrap;'>";
if ( !$file->userCan( File::DELETED_FILE ) ) {
# Don't link to unviewable files
- $row .= '<span class="history-deleted">' . $wgLang->timeAndDate( $timestamp, true ) . '</span>';
+ $row .= '<span class="history-deleted">' . $wgLang->timeanddate( $timestamp, true ) . '</span>';
} elseif ( $file->isDeleted( File::DELETED_FILE ) ) {
if ( $local ) {
$this->preventClickjacking();
# Make a link to review the image
$url = Linker::link(
$revdel,
- $wgLang->timeAndDate( $timestamp, true ),
+ $wgLang->timeanddate( $timestamp, true ),
array(),
array(
'target' => $this->title->getPrefixedText(),
'file' => $img,
- 'token' => $wgUser->editToken( $img )
+ 'token' => $wgUser->getEditToken( $img )
),
array( 'known', 'noclasses' )
);
} else {
- $url = $wgLang->timeAndDate( $timestamp, true );
+ $url = $wgLang->timeanddate( $timestamp, true );
}
$row .= '<span class="history-deleted">' . $url . '</span>';
} else {
$url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
- $row .= Xml::element( 'a', array( 'href' => $url ), $wgLang->timeAndDate( $timestamp, true ) );
+ $row .= Xml::element( 'a', array( 'href' => $url ), $wgLang->timeanddate( $timestamp, true ) );
}
$row .= "</td>";
if ( $file->isDeleted( File::DELETED_COMMENT ) ) {
$row .= '<td><span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span></td>';
} else {
- $row .= '<td dir="' . $wgContLang->getDir() . '">' . Linker::commentBlock( $description, $this->title ) . '</td>';
+ $row .= '<td dir="' . $wgContLang->getDir() . '">' . Linker::formatComment( $description, $this->title ) . '</td>';
}
$rowClass = null;
$thumbnail = $file->transform( $params );
$options = array(
'alt' => wfMsg( 'filehist-thumbtext',
- $wgLang->timeAndDate( $timestamp, true ),
+ $wgLang->timeanddate( $timestamp, true ),
$wgLang->date( $timestamp, true ),
$wgLang->time( $timestamp, true ) ),
'file-link' => true,