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 ) );
103 "<script type=\"text/javascript\" src=\"$wgStylePath/common/metadata.js?$wgStyleVersion\"></script>\n" .
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 return $this->mRedirectTarget
= Title
::makeTitle( NS_IMAGE
, $from );
116 public function followRedirect() {
117 if ( $this->img
->isLocal() )
118 return parent
::followRedirect();
120 $from = $this->img
->getRedirected();
121 return Title
::makeTitle( NS_IMAGE
, $from );
123 public function isRedirect() {
124 if ( $this->img
->isLocal() )
125 return parent
::isRedirect();
127 return (bool)$this->img
->getRedirected();
135 * @param bool $metadata Whether or not to show the metadata link
138 function showTOC( $metadata ) {
140 $r = '<ul id="filetoc">
141 <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE
) . '</a></li>
142 <li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>
143 <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
144 ($metadata ?
' <li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
150 * Make a table with metadata to be shown in the output page.
152 * FIXME: bad interface, see note on MediaHandler::formatMetadata().
156 * @param array $exif The array containing the EXIF data
159 function makeMetadataTable( $metadata ) {
160 $r = wfMsg( 'metadata-help' ) . "\n\n";
161 $r .= "{| id=mw_metadata class=mw_metadata\n";
162 foreach ( $metadata as $type => $stuff ) {
163 foreach ( $stuff as $v ) {
164 $class = Sanitizer
::escapeId( $v['id'] );
165 if( $type == 'collapsed' ) {
166 $class .= ' collapsable';
168 $r .= "|- class=\"$class\"\n";
169 $r .= "!| {$v['name']}\n";
170 $r .= "|| {$v['value']}\n";
178 * Overloading Article's getContent method.
180 * Omit noarticletext if sharedupload; text will be fetched from the
181 * shared upload server if possible.
183 function getContent() {
184 if( $this->img
&& !$this->img
->isLocal() && 0 == $this->getID() ) {
187 return Article
::getContent();
190 function openShowImage() {
191 global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgLang, $wgContLang;
193 $full_url = $this->img
->getURL();
194 $linkAttribs = false;
195 $sizeSel = intval( $wgUser->getOption( 'imagesize') );
196 if( !isset( $wgImageLimits[$sizeSel] ) ) {
197 $sizeSel = User
::getDefaultOption( 'imagesize' );
199 // The user offset might still be incorrect, specially if
200 // $wgImageLimits got changed (see bug #8858).
201 if( !isset( $wgImageLimits[$sizeSel] ) ) {
202 // Default to the first offset in $wgImageLimits
206 $max = $wgImageLimits[$sizeSel];
208 $maxHeight = $max[1];
209 $sk = $wgUser->getSkin();
210 $dirmark = $wgContLang->getDirMark();
212 if ( $this->img
->exists() ) {
214 $page = $wgRequest->getIntOrNull( 'page' );
215 if ( is_null( $page ) ) {
219 $params = array( 'page' => $page );
221 $width_orig = $this->img
->getWidth();
222 $width = $width_orig;
223 $height_orig = $this->img
->getHeight();
224 $height = $height_orig;
225 $mime = $this->img
->getMimeType();
227 $linkAttribs = array( 'href' => $full_url );
228 $longDesc = $this->img
->getLongDesc();
230 wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this , &$wgOut ) ) ;
232 if ( $this->img
->allowInlineDisplay() ) {
235 # "Download high res version" link below the image
236 #$msgsize = wfMsgHtml('file-info-size', $width_orig, $height_orig, $sk->formatSize( $this->img->getSize() ), $mime );
237 # We'll show a thumbnail of this image
238 if ( $width > $maxWidth ||
$height > $maxHeight ) {
239 # Calculate the thumbnail size.
240 # First case, the limiting factor is the width, not the height.
241 if ( $width / $height >= $maxWidth / $maxHeight ) {
242 $height = round( $height * $maxWidth / $width);
244 # Note that $height <= $maxHeight now.
246 $newwidth = floor( $width * $maxHeight / $height);
247 $height = round( $height * $newwidth / $width );
249 # Note that $height <= $maxHeight now, but might not be identical
250 # because of rounding.
252 $msgbig = wfMsgHtml( 'show-big-image' );
253 $msgsmall = wfMsgExt( 'show-big-image-thumb',
254 array( 'parseinline' ), $wgLang->formatNum( $width ), $wgLang->formatNum( $height ) );
256 # Image is small enough to show full size on image page
257 $msgbig = htmlspecialchars( $this->img
->getName() );
258 $msgsmall = wfMsgExt( 'file-nohires', array( 'parseinline' ) );
261 $params['width'] = $width;
262 $thumbnail = $this->img
->transform( $params );
264 $anchorclose = "<br />";
265 if( $this->img
->mustRender() ) {
270 '<br />' . Xml
::tags( 'a', $linkAttribs, $msgbig ) . "$dirmark " . $longDesc;
273 if ( $this->img
->isMultipage() ) {
274 $wgOut->addHTML( '<table class="multipageimage"><tr><td>' );
279 'alt' => $this->img
->getTitle()->getPrefixedText(),
282 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
283 $thumbnail->toHtml( $options ) .
284 $anchorclose . '</div>' );
287 if ( $this->img
->isMultipage() ) {
288 $count = $this->img
->pageCount();
291 $label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
292 $link = $sk->makeKnownLinkObj( $this->mTitle
, $label, 'page='. ($page-1) );
293 $thumb1 = $sk->makeThumbLinkObj( $this->mTitle
, $this->img
, $link, $label, 'none',
294 array( 'page' => $page - 1 ) );
299 if ( $page < $count ) {
300 $label = wfMsg( 'imgmultipagenext' );
301 $link = $sk->makeKnownLinkObj( $this->mTitle
, $label, 'page='. ($page+
1) );
302 $thumb2 = $sk->makeThumbLinkObj( $this->mTitle
, $this->img
, $link, $label, 'none',
303 array( 'page' => $page +
1 ) );
309 $select = '<form name="pageselector" action="' .
310 htmlspecialchars( $wgScript ) .
311 '" method="get" onchange="document.pageselector.submit();">' .
312 Xml
::hidden( 'title', $this->getTitle()->getPrefixedDbKey() );
313 $select .= $wgOut->parse( wfMsg( 'imgmultigotopre' ), false ) .
314 ' <select id="pageselector" name="page">';
315 for ( $i=1; $i <= $count; $i++
) {
316 $select .= Xml
::option( $wgLang->formatNum( $i ), $i,
319 $select .= '</select>' . $wgOut->parse( wfMsg( 'imgmultigotopost' ), false ) .
320 '<input type="submit" value="' .
321 htmlspecialchars( wfMsg( 'imgmultigo' ) ) . '"></form>';
323 $wgOut->addHTML( '</td><td><div class="multipageimagenavbox">' .
324 "$select<hr />$thumb1\n$thumb2<br clear=\"all\" /></div></td></tr></table>" );
327 #if direct link is allowed but it's not a renderable image, show an icon.
328 if ($this->img
->isSafeFile()) {
329 $icon= $this->img
->iconThumb();
331 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
332 $icon->toHtml( array( 'desc-link' => true ) ) .
341 $filename = wfEscapeWikiText( $this->img
->getName() );
343 if (!$this->img
->isSafeFile()) {
344 $warning = wfMsgNoTrans( 'mediawarning' );
345 $wgOut->addWikiText( <<<EOT
346 <div class="fullMedia">
347 <span class="dangerousLink">[[Media:$filename|$filename]]</span>$dirmark
348 <span class="fileInfo"> $longDesc</span>
351 <div class="mediaWarning">$warning</div>
355 $wgOut->addWikiText( <<<EOT
356 <div class="fullMedia">
357 [[Media:$filename|$filename]]$dirmark <span class="fileInfo"> $longDesc</span>
364 if(!$this->img
->isLocal()) {
365 $this->printSharedImageText();
368 # Image does not exist
370 $title = SpecialPage
::getTitleFor( 'Upload' );
371 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
372 'wpDestFile=' . urlencode( $this->img
->getName() ) );
373 $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
378 * Show a notice that the file is from a shared repository
380 function printSharedImageText() {
381 global $wgOut, $wgUser;
383 $descUrl = $this->img
->getDescriptionUrl();
384 $descText = $this->img
->getDescriptionText();
385 $s = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml( 'sharedupload' );
387 $sk = $wgUser->getSkin();
388 $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadwiki-linktext' ) );
389 $msg = ( $descText ) ?
'shareduploadwiki-desc' : 'shareduploadwiki';
390 $msg = wfMsgExt( $msg, array( 'parseinline', 'replaceafter' ), $link );
392 # Show message only if not voided by local sysops
397 $wgOut->addHTML( $s );
400 $this->mExtraDescription
= $descText;
404 function checkSharedConflict() {
405 global $wgOut, $wgUser;
406 $repoGroup = RepoGroup
::singleton();
407 if( !$repoGroup->hasForeignRepos() ) {
410 if( !$this->img
->isLocal() ) {
414 $this->dupFile
= null;
415 $repoGroup->forEachForeignRepo( array( $this, 'checkSharedConflictCallback' ) );
417 if( !$this->dupFile
)
419 $dupfile = $this->dupFile
;
421 ($this->img
->getSha1() == $dupfile->getSha1()) &&
422 ($this->img
->getSize() == $dupfile->getSize())
425 $sk = $wgUser->getSkin();
426 $descUrl = $dupfile->getDescriptionUrl();
428 $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadduplicate-linktext' ) );
429 $wgOut->addHTML( '<div id="shared-image-dup">' . wfMsgWikiHtml( 'shareduploadduplicate', $link ) . '</div>' );
431 $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadconflict-linktext' ) );
432 $wgOut->addHTML( '<div id="shared-image-conflict">' . wfMsgWikiHtml( 'shareduploadconflict', $link ) . '</div>' );
436 function checkSharedConflictCallback( $repo ) {
437 $dupfile = $repo->newFile( $this->img
->getTitle() );
438 if( $dupfile->exists() )
439 $this->dupFile
= $dupfile;
440 return $dupfile->exists();
443 function getUploadUrl() {
444 $uploadTitle = SpecialPage
::getTitleFor( 'Upload' );
445 return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img
->getName() ) );
449 * Print out the various links at the bottom of the image page, e.g. reupload,
450 * external editing (and instructions link) etc.
452 function uploadLinksBox() {
453 global $wgUser, $wgOut;
455 if( !$this->img
->isLocal() )
458 $sk = $wgUser->getSkin();
460 $wgOut->addHtml( '<br /><ul>' );
462 # "Upload a new version of this file" link
463 if( UploadForm
::userCanReUpload($wgUser,$this->img
->name
) ) {
464 $ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
465 $wgOut->addHtml( "<li><div class='plainlinks'>{$ulink}</div></li>" );
468 # Link to Special:FileDuplicateSearch
469 $dupeLink = $sk->makeKnownLinkObj( SpecialPage
::getTitleFor( 'FileDuplicateSearch', $this->mTitle
->getDBkey() ), wfMsgHtml( 'imagepage-searchdupe' ) );
470 $wgOut->addHtml( "<li>{$dupeLink}</li>" );
472 # External editing link
473 $elink = $sk->makeKnownLinkObj( $this->mTitle
, wfMsgHtml( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
474 $wgOut->addHtml( '<li>' . $elink . '<div>' . wfMsgWikiHtml( 'edit-externally-help' ) . '</div></li>' );
476 $wgOut->addHtml( '</ul>' );
479 function closeShowImage()
486 * If the page we've just displayed is in the "Image" namespace,
487 * we follow it with an upload history of the image and its usage.
489 function imageHistory()
491 global $wgUser, $wgOut, $wgUseExternalEditor;
493 $sk = $wgUser->getSkin();
495 if ( $this->img
->exists() ) {
496 $list = new ImageHistoryList( $sk, $this->current
);
497 $file = $this->current
;
498 $dims = $file->getDimensionsString();
499 $s = $list->beginImageHistoryList() .
500 $list->imageHistoryLine( true, $file );
501 // old image versions
502 $hist = $this->img
->getHistory();
503 foreach( $hist as $file ) {
504 $dims = $file->getDimensionsString();
505 $s .= $list->imageHistoryLine( false, $file );
507 $s .= $list->endImageHistoryList();
509 $wgOut->addHTML( $s );
511 $this->img
->resetHistory(); // free db resources
513 # Exist check because we don't want to show this on pages where an image
514 # doesn't exist along with the noimage message, that would suck. -ævar
515 if( $wgUseExternalEditor && $this->img
->exists() ) {
516 $this->uploadLinksBox();
521 function imageLinks()
523 global $wgUser, $wgOut;
525 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
527 $dbr = wfGetDB( DB_SLAVE
);
528 $page = $dbr->tableName( 'page' );
529 $imagelinks = $dbr->tableName( 'imagelinks' );
531 $sql = "SELECT page_namespace,page_title FROM $imagelinks,$page WHERE il_to=" .
532 $dbr->addQuotes( $this->mTitle
->getDBkey() ) . " AND il_from=page_id";
533 $sql = $dbr->limitResult($sql, 500, 0);
534 $res = $dbr->query( $sql, "ImagePage::imageLinks" );
536 if ( 0 == $dbr->numRows( $res ) ) {
537 $wgOut->addHtml( '<p>' . wfMsg( "nolinkstoimage" ) . "</p>\n" );
540 $wgOut->addHTML( '<p>' . wfMsg( 'linkstoimage' ) . "</p>\n<ul>" );
542 $sk = $wgUser->getSkin();
543 while ( $s = $dbr->fetchObject( $res ) ) {
544 $name = Title
::MakeTitle( $s->page_namespace
, $s->page_title
);
545 $link = $sk->makeKnownLinkObj( $name, "" );
546 $wgOut->addHTML( "<li>{$link}</li>\n" );
548 $wgOut->addHTML( "</ul>\n" );
551 function imageRedirects()
553 global $wgUser, $wgOut;
555 $dbr = wfGetDB( DB_SLAVE
);
557 array( 'redirect', 'page' ),
558 array( 'page_title' ),
560 'rd_namespace' => NS_IMAGE
,
561 'rd_title' => $this->mTitle
->getDBkey(),
562 'page_namespace' => NS_IMAGE
,
568 if ( 0 == $dbr->numRows( $res ) )
571 $wgOut->addHTML( '<p>' . wfMsg( 'redirectstofile' ) . "</p>\n<ul>" );
573 $sk = $wgUser->getSkin();
574 while ( $row = $dbr->fetchObject( $res ) ) {
575 $name = Title
::makeTitle( NS_IMAGE
, $row->page_title
);
576 $link = $sk->makeKnownLinkObj( $name, "" );
577 wfDebug("Image redirect: {$row->page_title}\n");
578 $wgOut->addHTML( "<li>{$link}</li>\n" );
580 $wgOut->addHTML( "</ul>\n" );
586 * Delete the file, or an earlier version of it
588 public function delete() {
589 if( !$this->img
->exists() ||
!$this->img
->isLocal() ) {
590 // Standard article deletion
594 $deleter = new FileDeleteForm( $this->img
);
599 * Revert the file to an earlier version
601 public function revert() {
602 $reverter = new FileRevertForm( $this->img
);
603 $reverter->execute();
607 * Override handling of action=purge
610 if( $this->img
->exists() ) {
611 wfDebug( "ImagePage::doPurge purging " . $this->img
->getName() . "\n" );
612 $update = new HTMLCacheUpdate( $this->mTitle
, 'imagelinks' );
614 $this->img
->upgradeRow();
615 $this->img
->purgeCache();
617 wfDebug( "ImagePage::doPurge no image\n" );
623 * Display an error with a wikitext description
625 function showError( $description ) {
627 $wgOut->setPageTitle( wfMsg( "internalerror" ) );
628 $wgOut->setRobotpolicy( "noindex,nofollow" );
629 $wgOut->setArticleRelated( false );
630 $wgOut->enableClientCache( false );
631 $wgOut->addWikiText( $description );
637 * Builds the image revision log shown on image pages
641 class ImageHistoryList
{
643 protected $img, $skin, $title, $repo;
645 public function __construct( $skin, $img ) {
648 $this->title
= $img->getTitle();
651 public function beginImageHistoryList() {
652 global $wgOut, $wgUser;
653 $deleteColumn = $wgUser->isAllowed( 'delete' ) ||
$wgUser->isAllowed( 'deleterevision' );
654 return Xml
::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) )
655 . $wgOut->parse( wfMsgNoTrans( 'filehist-help' ) )
656 . Xml
::openElement( 'table', array( 'class' => 'filehistory' ) ) . "\n"
658 . ( $this->img
->isLocal() && $deleteColumn ?
'<td></td>' : '' )
659 . '<th>' . wfMsgHtml( 'filehist-datetime' ) . '</th>'
660 . '<th>' . wfMsgHtml( 'filehist-user' ) . '</th>'
661 . '<th>' . wfMsgHtml( 'filehist-dimensions' ) . '</th>'
662 . '<th class="mw-imagepage-filesize">' . wfMsgHtml( 'filehist-filesize' ) . '</th>'
663 . '<th>' . wfMsgHtml( 'filehist-comment' ) . '</th>'
667 public function endImageHistoryList() {
671 public function imageHistoryLine( $iscur, $file ) {
672 global $wgUser, $wgLang, $wgContLang, $wgTitle;
674 $timestamp = wfTimestamp(TS_MW
, $file->getTimestamp());
675 $img = $iscur ?
$file->getName() : $file->getArchiveName();
676 $user = $file->getUser('id');
677 $usertext = $file->getUser('text');
678 $size = $file->getSize();
679 $description = $file->getDescription();
680 $dims = $file->getDimensionsString();
681 $sha1 = $file->getSha1();
683 $local = $this->img
->isLocal();
687 if( $local && ($wgUser->isAllowed('delete') ||
$wgUser->isAllowed('deleterevision') ) ) {
689 # Link to remove from history
690 if( $wgUser->isAllowed( 'delete' ) ) {
692 $q[] = 'action=delete';
694 $q[] = 'oldimage=' . urlencode( $img );
695 $row .= $this->skin
->makeKnownLinkObj(
697 wfMsgHtml( $iscur ?
'filehist-deleteall' : 'filehist-deleteone' ),
702 # Link to hide content
703 if( $wgUser->isAllowed( 'deleterevision' ) ) {
704 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
705 // If file is top revision or locked from this user, don't link
706 if( $iscur ||
!$file->userCan(File
::DELETED_RESTRICTED
) ) {
707 $del = wfMsgHtml( 'rev-delundel' );
709 // If the file was hidden, link to sha-1
710 list($ts,$name) = explode('!',$img,2);
711 $del = $this->skin
->makeKnownLinkObj( $revdel, wfMsg( 'rev-delundel' ),
712 'target=' . urlencode( $wgTitle->getPrefixedText() ) .
713 '&oldimage=' . urlencode( $ts ) );
714 // Bolden oversighted content
715 if( $file->isDeleted(File
::DELETED_RESTRICTED
) )
716 $del = "<strong>$del</strong>";
718 $row .= "<tt><small>$del</small></tt>";
723 // Reversion link/current indicator
726 $row .= wfMsgHtml( 'filehist-current' );
727 } elseif( $local && $wgUser->isLoggedIn() && $this->title
->userCan( 'edit' ) ) {
728 if( $file->isDeleted(File
::DELETED_FILE
) ) {
729 $row .= wfMsgHtml('filehist-revert');
732 $q[] = 'action=revert';
733 $q[] = 'oldimage=' . urlencode( $img );
734 $q[] = 'wpEditToken=' . urlencode( $wgUser->editToken( $img ) );
735 $row .= $this->skin
->makeKnownLinkObj( $this->title
,
736 wfMsgHtml( 'filehist-revert' ),
737 implode( '&', $q ) );
742 // Date/time and image link
744 if( !$file->userCan(File
::DELETED_FILE
) ) {
745 # Don't link to unviewable files
746 $row .= '<span class="history-deleted">' . $wgLang->timeAndDate( $timestamp, true ) . '</span>';
747 } else if( $file->isDeleted(File
::DELETED_FILE
) ) {
748 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
749 # Make a link to review the image
750 $url = $this->skin
->makeKnownLinkObj( $revdel, $wgLang->timeAndDate( $timestamp, true ),
751 "target=".$wgTitle->getPrefixedText()."&file=$sha1.".$this->img
->getExtension() );
752 $row .= '<span class="history-deleted">'.$url.'</span>';
754 $url = $iscur ?
$this->img
->getUrl() : $this->img
->getArchiveUrl( $img );
755 $row .= Xml
::element( 'a',
756 array( 'href' => $url ),
757 $wgLang->timeAndDate( $timestamp, true ) );
765 // Hide deleted usernames
766 if( $file->isDeleted(File
::DELETED_USER
) )
767 $row .= '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
769 $row .= $this->skin
->userLink( $user, $usertext ) .
770 $this->skin
->userToolLinks( $user, $usertext );
772 $row .= htmlspecialchars( $usertext );
777 $row .= '<td>' . htmlspecialchars( $dims ) . '</td>';
780 $row .= '<td class="mw-imagepage-filesize">' . $this->skin
->formatSize( $size ) . '</td>';
782 // Don't show deleted descriptions
783 if ( $file->isDeleted(File
::DELETED_COMMENT
) )
784 $row .= '<td><span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span></td>';
786 $row .= '<td>' . $this->skin
->commentBlock( $description, $this->title
) . '</td>';
788 return "<tr>{$row}</tr>\n";