9b48d1b4ec8ca164a0030f8f6f3f4dc2ab4d85ab
8 if( !defined( 'MEDIAWIKI' ) )
12 * Special handling for image description pages
16 class ImagePage
extends Article
{
18 /* private */ var $img; // Image object this page is shown for
19 /* private */ var $repo;
20 var $mExtraDescription = false;
22 function __construct( $title, $time = false ) {
23 parent
::__construct( $title );
24 $this->img
= wfFindFile( $this->mTitle
, $time );
26 $this->img
= wfLocalFile( $this->mTitle
);
27 $this->current
= $this->img
;
29 $this->current
= $time ?
wfLocalFile( $this->mTitle
) : $this->img
;
31 $this->repo
= $this->img
->repo
;
35 * Handler for action=render
36 * Include body text only; none of the image extras
40 $wgOut->setArticleBodyOnly( true );
45 global $wgOut, $wgShowEXIF, $wgRequest, $wgUser;
47 if ( $this->img
->getRedirected() )
48 return Article
::view();
50 $diff = $wgRequest->getVal( 'diff' );
51 $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
53 if ( $this->mTitle
->getNamespace() != NS_IMAGE ||
( isset( $diff ) && $diffOnly ) )
54 return Article
::view();
56 if ($wgShowEXIF && $this->img
->exists()) {
57 // FIXME: bad interface, see note on MediaHandler::formatMetadata().
58 $formattedMetadata = $this->img
->formatMetadata();
59 $showmeta = $formattedMetadata !== false;
64 if ($this->img
->exists())
65 $wgOut->addHTML($this->showTOC($showmeta));
67 $this->openShowImage();
69 # No need to display noarticletext, we use our own message, output in openShowImage()
70 if ( $this->getID() ) {
73 # Just need to set the right headers
74 $wgOut->setArticleFlag( true );
75 $wgOut->setRobotpolicy( 'noindex,nofollow' );
76 $wgOut->setPageTitle( $this->mTitle
->getPrefixedText() );
80 # Show shared description, if needed
81 if ( $this->mExtraDescription
) {
82 $fol = wfMsgNoTrans( 'shareddescriptionfollows' );
83 if( $fol != '-' && !wfEmptyMsg( 'shareddescriptionfollows', $fol ) ) {
84 $wgOut->addWikiText( $fol );
86 $wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription
. '</div>' );
88 $this->checkSharedConflict();
91 $this->closeShowImage();
92 $this->imageHistory();
94 if ( $this->img
->isLocal() ) $this->imageRedirects();
97 global $wgStylePath, $wgStyleVersion;
98 $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) );
99 $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) );
100 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ). "\n" );
101 $wgOut->addWikiText( $this->makeMetadataTable( $formattedMetadata ) );
102 $wgOut->addScriptFile( 'metadata.js' );
104 "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '$expand', '$collapse');</script>\n" );
108 public function getRedirectTarget() {
109 if ( $this->img
->isLocal() )
110 return parent
::getRedirectTarget();
112 // Foreign image page
113 $from = $this->img
->getRedirected();
114 $to = $this->img
->getName();
115 if ($from == $to) return null;
116 return $this->mRedirectTarget
= Title
::makeTitle( NS_IMAGE
, $to );
118 public function followRedirect() {
119 if ( $this->img
->isLocal() )
120 return parent
::followRedirect();
122 $from = $this->img
->getRedirected();
123 $to = $this->img
->getName();
124 if ($from == $to) return false;
125 return Title
::makeTitle( NS_IMAGE
, $to );
127 public function isRedirect( $text = false ) {
128 if ( $this->img
->isLocal() )
129 return parent
::isRedirect( $text );
131 return (bool)$this->img
->getRedirected();
134 public function isLocal() {
135 return $this->img
->isLocal();
143 * @param bool $metadata Whether or not to show the metadata link
146 function showTOC( $metadata ) {
148 $r = '<ul id="filetoc">
149 <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE
) . '</a></li>
150 <li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>
151 <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
152 ($metadata ?
' <li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
158 * Make a table with metadata to be shown in the output page.
160 * FIXME: bad interface, see note on MediaHandler::formatMetadata().
164 * @param array $exif The array containing the EXIF data
167 function makeMetadataTable( $metadata ) {
168 $r = wfMsg( 'metadata-help' ) . "\n\n";
169 $r .= "{| id=mw_metadata class=mw_metadata\n";
170 foreach ( $metadata as $type => $stuff ) {
171 foreach ( $stuff as $v ) {
172 $class = Sanitizer
::escapeId( $v['id'] );
173 if( $type == 'collapsed' ) {
174 $class .= ' collapsable';
176 $r .= "|- class=\"$class\"\n";
177 $r .= "!| {$v['name']}\n";
178 $r .= "|| {$v['value']}\n";
186 * Overloading Article's getContent method.
188 * Omit noarticletext if sharedupload; text will be fetched from the
189 * shared upload server if possible.
191 function getContent() {
192 if( $this->img
&& !$this->img
->isLocal() && 0 == $this->getID() ) {
195 return Article
::getContent();
198 function openShowImage() {
199 global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgLang, $wgContLang;
201 $full_url = $this->img
->getURL();
202 $linkAttribs = false;
203 $sizeSel = intval( $wgUser->getOption( 'imagesize') );
204 if( !isset( $wgImageLimits[$sizeSel] ) ) {
205 $sizeSel = User
::getDefaultOption( 'imagesize' );
207 // The user offset might still be incorrect, specially if
208 // $wgImageLimits got changed (see bug #8858).
209 if( !isset( $wgImageLimits[$sizeSel] ) ) {
210 // Default to the first offset in $wgImageLimits
214 $max = $wgImageLimits[$sizeSel];
216 $maxHeight = $max[1];
217 $sk = $wgUser->getSkin();
218 $dirmark = $wgContLang->getDirMark();
220 if ( $this->img
->exists() ) {
222 $page = $wgRequest->getIntOrNull( 'page' );
223 if ( is_null( $page ) ) {
227 $params = array( 'page' => $page );
229 $width_orig = $this->img
->getWidth();
230 $width = $width_orig;
231 $height_orig = $this->img
->getHeight();
232 $height = $height_orig;
233 $mime = $this->img
->getMimeType();
235 $linkAttribs = array( 'href' => $full_url );
236 $longDesc = $this->img
->getLongDesc();
238 wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this , &$wgOut ) ) ;
240 if ( $this->img
->allowInlineDisplay() ) {
243 # "Download high res version" link below the image
244 #$msgsize = wfMsgHtml('file-info-size', $width_orig, $height_orig, $sk->formatSize( $this->img->getSize() ), $mime );
245 # We'll show a thumbnail of this image
246 if ( $width > $maxWidth ||
$height > $maxHeight ) {
247 # Calculate the thumbnail size.
248 # First case, the limiting factor is the width, not the height.
249 if ( $width / $height >= $maxWidth / $maxHeight ) {
250 $height = round( $height * $maxWidth / $width);
252 # Note that $height <= $maxHeight now.
254 $newwidth = floor( $width * $maxHeight / $height);
255 $height = round( $height * $newwidth / $width );
257 # Note that $height <= $maxHeight now, but might not be identical
258 # because of rounding.
260 $msgbig = wfMsgHtml( 'show-big-image' );
261 $msgsmall = wfMsgExt( 'show-big-image-thumb',
262 array( 'parseinline' ), $wgLang->formatNum( $width ), $wgLang->formatNum( $height ) );
264 # Image is small enough to show full size on image page
265 $msgbig = htmlspecialchars( $this->img
->getName() );
266 $msgsmall = wfMsgExt( 'file-nohires', array( 'parseinline' ) );
269 $params['width'] = $width;
270 $thumbnail = $this->img
->transform( $params );
272 $anchorclose = "<br />";
273 if( $this->img
->mustRender() ) {
278 '<br />' . Xml
::tags( 'a', $linkAttribs, $msgbig ) . "$dirmark " . $longDesc;
281 if ( $this->img
->isMultipage() ) {
282 $wgOut->addHTML( '<table class="multipageimage"><tr><td>' );
287 'alt' => $this->img
->getTitle()->getPrefixedText(),
290 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
291 $thumbnail->toHtml( $options ) .
292 $anchorclose . '</div>' );
295 if ( $this->img
->isMultipage() ) {
296 $count = $this->img
->pageCount();
299 $label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
300 $link = $sk->makeKnownLinkObj( $this->mTitle
, $label, 'page='. ($page-1) );
301 $thumb1 = $sk->makeThumbLinkObj( $this->mTitle
, $this->img
, $link, $label, 'none',
302 array( 'page' => $page - 1 ) );
307 if ( $page < $count ) {
308 $label = wfMsg( 'imgmultipagenext' );
309 $link = $sk->makeKnownLinkObj( $this->mTitle
, $label, 'page='. ($page+
1) );
310 $thumb2 = $sk->makeThumbLinkObj( $this->mTitle
, $this->img
, $link, $label, 'none',
311 array( 'page' => $page +
1 ) );
319 'name' => 'pageselector',
320 'action' => $wgScript,
321 'onchange' => 'document.pageselector.submit();',
325 for ( $i=1; $i <= $count; $i++
) {
326 $options[] = Xml
::option( $wgLang->formatNum($i), $i, $i == $page );
328 $select = Xml
::tags( 'select',
329 array( 'id' => 'pageselector', 'name' => 'page' ),
330 implode( "\n", $options ) );
333 '</td><td><div class="multipageimagenavbox">' .
334 Xml
::openElement( 'form', $formParams ) .
335 Xml
::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) .
336 wfMsgExt( 'imgmultigoto', array( 'parseinline', 'replaceafter' ), $select ) .
337 Xml
::submitButton( wfMsg( 'imgmultigo' ) ) .
338 Xml
::closeElement( 'form' ) .
339 "<hr />$thumb1\n$thumb2<br clear=\"all\" /></div></td></tr></table>"
343 #if direct link is allowed but it's not a renderable image, show an icon.
344 if ($this->img
->isSafeFile()) {
345 $icon= $this->img
->iconThumb();
347 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
348 $icon->toHtml( array( 'desc-link' => true ) ) .
357 $filename = wfEscapeWikiText( $this->img
->getName() );
359 if (!$this->img
->isSafeFile()) {
360 $warning = wfMsgNoTrans( 'mediawarning' );
361 $wgOut->addWikiText( <<<EOT
362 <div class="fullMedia">
363 <span class="dangerousLink">[[Media:$filename|$filename]]</span>$dirmark
364 <span class="fileInfo"> $longDesc</span>
367 <div class="mediaWarning">$warning</div>
371 $wgOut->addWikiText( <<<EOT
372 <div class="fullMedia">
373 [[Media:$filename|$filename]]$dirmark <span class="fileInfo"> $longDesc</span>
380 if(!$this->img
->isLocal()) {
381 $this->printSharedImageText();
384 # Image does not exist
386 $title = SpecialPage
::getTitleFor( 'Upload' );
387 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
388 'wpDestFile=' . urlencode( $this->img
->getName() ) );
389 $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
394 * Show a notice that the file is from a shared repository
396 function printSharedImageText() {
397 global $wgOut, $wgUser;
399 $descUrl = $this->img
->getDescriptionUrl();
400 $descText = $this->img
->getDescriptionText();
401 $s = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml( 'sharedupload' );
403 $sk = $wgUser->getSkin();
404 $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadwiki-linktext' ) );
405 $msg = ( $descText ) ?
'shareduploadwiki-desc' : 'shareduploadwiki';
406 $msg = wfMsgExt( $msg, array( 'parseinline', 'replaceafter' ), $link );
408 # Show message only if not voided by local sysops
413 $wgOut->addHTML( $s );
416 $this->mExtraDescription
= $descText;
420 function checkSharedConflict() {
421 global $wgOut, $wgUser;
422 $repoGroup = RepoGroup
::singleton();
423 if( !$repoGroup->hasForeignRepos() ) {
426 if( !$this->img
->isLocal() ) {
430 $this->dupFile
= null;
431 $repoGroup->forEachForeignRepo( array( $this, 'checkSharedConflictCallback' ) );
433 if( !$this->dupFile
)
435 $dupfile = $this->dupFile
;
437 ($this->img
->getSha1() == $dupfile->getSha1()) &&
438 ($this->img
->getSize() == $dupfile->getSize())
441 $sk = $wgUser->getSkin();
442 $descUrl = $dupfile->getDescriptionUrl();
444 $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadduplicate-linktext' ) );
445 $wgOut->addHTML( '<div id="shared-image-dup">' . wfMsgWikiHtml( 'shareduploadduplicate', $link ) . '</div>' );
447 $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadconflict-linktext' ) );
448 $wgOut->addHTML( '<div id="shared-image-conflict">' . wfMsgWikiHtml( 'shareduploadconflict', $link ) . '</div>' );
452 function checkSharedConflictCallback( $repo ) {
453 $dupfile = $repo->newFile( $this->img
->getTitle() );
454 if( $dupfile->exists() )
455 $this->dupFile
= $dupfile;
456 return $dupfile->exists();
459 function getUploadUrl() {
460 $uploadTitle = SpecialPage
::getTitleFor( 'Upload' );
461 return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img
->getName() ) );
465 * Print out the various links at the bottom of the image page, e.g. reupload,
466 * external editing (and instructions link) etc.
468 function uploadLinksBox() {
469 global $wgUser, $wgOut;
471 if( !$this->img
->isLocal() )
474 $sk = $wgUser->getSkin();
476 $wgOut->addHtml( '<br /><ul>' );
478 # "Upload a new version of this file" link
479 if( UploadForm
::userCanReUpload($wgUser,$this->img
->name
) ) {
480 $ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
481 $wgOut->addHtml( "<li><div class='plainlinks'>{$ulink}</div></li>" );
484 # Link to Special:FileDuplicateSearch
485 $dupeLink = $sk->makeKnownLinkObj( SpecialPage
::getTitleFor( 'FileDuplicateSearch', $this->mTitle
->getDBkey() ), wfMsgHtml( 'imagepage-searchdupe' ) );
486 $wgOut->addHtml( "<li>{$dupeLink}</li>" );
488 # External editing link
489 $elink = $sk->makeKnownLinkObj( $this->mTitle
, wfMsgHtml( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
490 $wgOut->addHtml( '<li>' . $elink . '<div>' . wfMsgWikiHtml( 'edit-externally-help' ) . '</div></li>' );
492 $wgOut->addHtml( '</ul>' );
495 function closeShowImage()
502 * If the page we've just displayed is in the "Image" namespace,
503 * we follow it with an upload history of the image and its usage.
505 function imageHistory()
507 global $wgUser, $wgOut, $wgUseExternalEditor;
509 $sk = $wgUser->getSkin();
511 if ( $this->img
->exists() ) {
512 $list = new ImageHistoryList( $sk, $this->current
);
513 $file = $this->current
;
514 $dims = $file->getDimensionsString();
515 $s = $list->beginImageHistoryList() .
516 $list->imageHistoryLine( true, $file );
517 // old image versions
518 $hist = $this->img
->getHistory();
519 foreach( $hist as $file ) {
520 $dims = $file->getDimensionsString();
521 $s .= $list->imageHistoryLine( false, $file );
523 $s .= $list->endImageHistoryList();
525 $wgOut->addHTML( $s );
527 $this->img
->resetHistory(); // free db resources
529 # Exist check because we don't want to show this on pages where an image
530 # doesn't exist along with the noimage message, that would suck. -ævar
531 if( $wgUseExternalEditor && $this->img
->exists() ) {
532 $this->uploadLinksBox();
537 function imageLinks()
539 global $wgUser, $wgOut;
543 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
545 $dbr = wfGetDB( DB_SLAVE
);
548 array( 'imagelinks', 'page' ),
549 array( 'page_namespace', 'page_title' ),
550 array( 'il_to' => $this->mTitle
->getDBkey(), 'il_from = page_id' ),
552 array( 'LIMIT' => $limit +
1)
555 if ( 0 == $dbr->numRows( $res ) ) {
556 $wgOut->addWikiMsg( 'nolinkstoimage' );
559 $wgOut->addWikiMsg( 'linkstoimage' );
560 $wgOut->addHTML( "<ul>\n" );
562 $sk = $wgUser->getSkin();
564 while ( $s = $res->fetchObject() ) {
566 if ( $count <= $limit ) {
567 // We have not yet reached the extra one that tells us there is more to fetch
568 $name = Title
::makeTitle( $s->page_namespace
, $s->page_title
);
569 $link = $sk->makeKnownLinkObj( $name, "" );
570 $wgOut->addHTML( "<li>{$link}</li>\n" );
573 $wgOut->addHTML( "</ul>\n" );
576 // Add a links to [[Special:Whatlinkshere]]
577 if ( $count > $limit )
578 $wgOut->addWikiMsg( 'morelinkstoimage', $this->mTitle
->getPrefixedDBkey() );
581 function imageRedirects()
583 global $wgUser, $wgOut;
585 $dbr = wfGetDB( DB_SLAVE
);
587 array( 'redirect', 'page' ),
588 array( 'page_title' ),
590 'rd_namespace' => NS_IMAGE
,
591 'rd_title' => $this->mTitle
->getDBkey(),
592 'page_namespace' => NS_IMAGE
,
599 if ( 0 == $dbr->numRows( $res ) )
602 $wgOut->addWikiMsg( 'redirectstofile' );
603 $wgOut->addHTML( "<ul>\n" );
605 $sk = $wgUser->getSkin();
606 while ( $row = $dbr->fetchObject( $res ) ) {
607 $name = Title
::makeTitle( NS_IMAGE
, $row->page_title
);
608 $link = $sk->makeKnownLinkObj( $name, "" );
609 wfDebug("Image redirect: {$row->page_title}\n");
610 $wgOut->addHTML( "<li>{$link}</li>\n" );
612 $wgOut->addHTML( "</ul>\n" );
618 * Delete the file, or an earlier version of it
620 public function delete() {
621 if( !$this->img
->exists() ||
!$this->img
->isLocal() ) {
622 // Standard article deletion
626 $deleter = new FileDeleteForm( $this->img
);
631 * Revert the file to an earlier version
633 public function revert() {
634 $reverter = new FileRevertForm( $this->img
);
635 $reverter->execute();
639 * Override handling of action=purge
642 if( $this->img
->exists() ) {
643 wfDebug( "ImagePage::doPurge purging " . $this->img
->getName() . "\n" );
644 $update = new HTMLCacheUpdate( $this->mTitle
, 'imagelinks' );
646 $this->img
->upgradeRow();
647 $this->img
->purgeCache();
649 wfDebug( "ImagePage::doPurge no image\n" );
655 * Display an error with a wikitext description
657 function showError( $description ) {
659 $wgOut->setPageTitle( wfMsg( "internalerror" ) );
660 $wgOut->setRobotpolicy( "noindex,nofollow" );
661 $wgOut->setArticleRelated( false );
662 $wgOut->enableClientCache( false );
663 $wgOut->addWikiText( $description );
669 * Builds the image revision log shown on image pages
673 class ImageHistoryList
{
675 protected $img, $skin, $title, $repo;
677 public function __construct( $skin, $img ) {
680 $this->title
= $img->getTitle();
683 public function beginImageHistoryList() {
684 global $wgOut, $wgUser;
685 $deleteColumn = $wgUser->isAllowed( 'delete' ) ||
$wgUser->isAllowed( 'deleterevision' );
686 return Xml
::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) )
687 . $wgOut->parse( wfMsgNoTrans( 'filehist-help' ) )
688 . Xml
::openElement( 'table', array( 'class' => 'filehistory' ) ) . "\n"
690 . ( $this->img
->isLocal() && $deleteColumn ?
'<td></td>' : '' )
691 . '<th>' . wfMsgHtml( 'filehist-datetime' ) . '</th>'
692 . '<th>' . wfMsgHtml( 'filehist-user' ) . '</th>'
693 . '<th>' . wfMsgHtml( 'filehist-dimensions' ) . '</th>'
694 . '<th class="mw-imagepage-filesize">' . wfMsgHtml( 'filehist-filesize' ) . '</th>'
695 . '<th>' . wfMsgHtml( 'filehist-comment' ) . '</th>'
699 public function endImageHistoryList() {
703 public function imageHistoryLine( $iscur, $file ) {
704 global $wgUser, $wgLang, $wgContLang, $wgTitle;
706 $timestamp = wfTimestamp(TS_MW
, $file->getTimestamp());
707 $img = $iscur ?
$file->getName() : $file->getArchiveName();
708 $user = $file->getUser('id');
709 $usertext = $file->getUser('text');
710 $size = $file->getSize();
711 $description = $file->getDescription();
712 $dims = $file->getDimensionsString();
713 $sha1 = $file->getSha1();
715 $local = $this->img
->isLocal();
719 if( $local && ($wgUser->isAllowed('delete') ||
$wgUser->isAllowed('deleterevision') ) ) {
721 # Link to remove from history
722 if( $wgUser->isAllowed( 'delete' ) ) {
724 $q[] = 'action=delete';
726 $q[] = 'oldimage=' . urlencode( $img );
727 $row .= $this->skin
->makeKnownLinkObj(
729 wfMsgHtml( $iscur ?
'filehist-deleteall' : 'filehist-deleteone' ),
734 # Link to hide content
735 if( $wgUser->isAllowed( 'deleterevision' ) ) {
736 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
737 // If file is top revision or locked from this user, don't link
738 if( $iscur ||
!$file->userCan(File
::DELETED_RESTRICTED
) ) {
739 $del = wfMsgHtml( 'rev-delundel' );
741 // If the file was hidden, link to sha-1
742 list($ts,$name) = explode('!',$img,2);
743 $del = $this->skin
->makeKnownLinkObj( $revdel, wfMsg( 'rev-delundel' ),
744 'target=' . urlencode( $wgTitle->getPrefixedText() ) .
745 '&oldimage=' . urlencode( $ts ) );
746 // Bolden oversighted content
747 if( $file->isDeleted(File
::DELETED_RESTRICTED
) )
748 $del = "<strong>$del</strong>";
750 $row .= "<tt><small>$del</small></tt>";
755 // Reversion link/current indicator
758 $row .= wfMsgHtml( 'filehist-current' );
759 } elseif( $local && $wgUser->isLoggedIn() && $this->title
->userCan( 'edit' ) ) {
760 if( $file->isDeleted(File
::DELETED_FILE
) ) {
761 $row .= wfMsgHtml('filehist-revert');
764 $q[] = 'action=revert';
765 $q[] = 'oldimage=' . urlencode( $img );
766 $q[] = 'wpEditToken=' . urlencode( $wgUser->editToken( $img ) );
767 $row .= $this->skin
->makeKnownLinkObj( $this->title
,
768 wfMsgHtml( 'filehist-revert' ),
769 implode( '&', $q ) );
774 // Date/time and image link
776 if( !$file->userCan(File
::DELETED_FILE
) ) {
777 # Don't link to unviewable files
778 $row .= '<span class="history-deleted">' . $wgLang->timeAndDate( $timestamp, true ) . '</span>';
779 } else if( $file->isDeleted(File
::DELETED_FILE
) ) {
780 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
781 # Make a link to review the image
782 $url = $this->skin
->makeKnownLinkObj( $revdel, $wgLang->timeAndDate( $timestamp, true ),
783 "target=".$wgTitle->getPrefixedText()."&file=$sha1.".$this->img
->getExtension() );
784 $row .= '<span class="history-deleted">'.$url.'</span>';
786 $url = $iscur ?
$this->img
->getUrl() : $this->img
->getArchiveUrl( $img );
787 $row .= Xml
::element( 'a',
788 array( 'href' => $url ),
789 $wgLang->timeAndDate( $timestamp, true ) );
797 // Hide deleted usernames
798 if( $file->isDeleted(File
::DELETED_USER
) )
799 $row .= '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
801 $row .= $this->skin
->userLink( $user, $usertext ) .
802 $this->skin
->userToolLinks( $user, $usertext );
804 $row .= htmlspecialchars( $usertext );
809 $row .= '<td>' . htmlspecialchars( $dims ) . '</td>';
812 $row .= '<td class="mw-imagepage-filesize">' . $this->skin
->formatSize( $size ) . '</td>';
814 // Don't show deleted descriptions
815 if ( $file->isDeleted(File
::DELETED_COMMENT
) )
816 $row .= '<td><span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span></td>';
818 $row .= '<td>' . $this->skin
->commentBlock( $description, $this->title
) . '</td>';
820 return "<tr>{$row}</tr>\n";