c77c0776cf8c5678da64173c915c6cec93ff08e4
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;
527 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
529 $dbr = wfGetDB( DB_SLAVE
);
532 array( 'imagelinks', 'page' ),
533 array( 'page_namespace', 'page_title' ),
534 array( 'il_to' => $this->mTitle
->getDBkey(), 'il_from = page_id' ),
536 array( 'LIMIT' => $limit +
1)
539 if ( 0 == $dbr->numRows( $res ) ) {
540 $wgOut->addHtml( Xml
::element('p', null ,wfMsg( "nolinkstoimage" ) )."\n" );
543 $wgOut->addHTML( Xml
::element('p', null, wfMsg( 'linkstoimage' ) )."\n" );
544 $wgOut->addHTML( Xml
::openElement( 'ul' ));
546 $sk = $wgUser->getSkin();
548 while ( $s = $res->fetchObject() ) {
550 if ( $count <= $limit ) {
551 // We have not yet reached the extra one that tells us there is more to fetch
552 $name = Title
::makeTitle( $s->page_namespace
, $s->page_title
);
553 $link = $sk->makeKnownLinkObj( $name, "" );
554 $wgOut->addHTML( "<li>{$link}</li>\n" );
557 $wgOut->addHTML( "</ul>\n" );
560 // Add a links to [[Special:Whatlinkshere]]
561 if ( $count > $limit )
562 $wgOut->addWikiText( wfMsg( 'morelinkstoimage', $this->mTitle
->getPrefixedDBkey() ) );
565 function imageRedirects()
567 global $wgUser, $wgOut;
569 $dbr = wfGetDB( DB_SLAVE
);
571 array( 'redirect', 'page' ),
572 array( 'page_title' ),
574 'rd_namespace' => NS_IMAGE
,
575 'rd_title' => $this->mTitle
->getDBkey(),
576 'page_namespace' => NS_IMAGE
,
583 if ( 0 == $dbr->numRows( $res ) )
586 $wgOut->addHTML( '<p>' . wfMsg( 'redirectstofile' ) . "</p>\n<ul>" );
588 $sk = $wgUser->getSkin();
589 while ( $row = $dbr->fetchObject( $res ) ) {
590 $name = Title
::makeTitle( NS_IMAGE
, $row->page_title
);
591 $link = $sk->makeKnownLinkObj( $name, "" );
592 wfDebug("Image redirect: {$row->page_title}\n");
593 $wgOut->addHTML( "<li>{$link}</li>\n" );
595 $wgOut->addHTML( "</ul>\n" );
601 * Delete the file, or an earlier version of it
603 public function delete() {
604 if( !$this->img
->exists() ||
!$this->img
->isLocal() ) {
605 // Standard article deletion
609 $deleter = new FileDeleteForm( $this->img
);
614 * Revert the file to an earlier version
616 public function revert() {
617 $reverter = new FileRevertForm( $this->img
);
618 $reverter->execute();
622 * Override handling of action=purge
625 if( $this->img
->exists() ) {
626 wfDebug( "ImagePage::doPurge purging " . $this->img
->getName() . "\n" );
627 $update = new HTMLCacheUpdate( $this->mTitle
, 'imagelinks' );
629 $this->img
->upgradeRow();
630 $this->img
->purgeCache();
632 wfDebug( "ImagePage::doPurge no image\n" );
638 * Display an error with a wikitext description
640 function showError( $description ) {
642 $wgOut->setPageTitle( wfMsg( "internalerror" ) );
643 $wgOut->setRobotpolicy( "noindex,nofollow" );
644 $wgOut->setArticleRelated( false );
645 $wgOut->enableClientCache( false );
646 $wgOut->addWikiText( $description );
652 * Builds the image revision log shown on image pages
656 class ImageHistoryList
{
658 protected $img, $skin, $title, $repo;
660 public function __construct( $skin, $img ) {
663 $this->title
= $img->getTitle();
666 public function beginImageHistoryList() {
667 global $wgOut, $wgUser;
668 $deleteColumn = $wgUser->isAllowed( 'delete' ) ||
$wgUser->isAllowed( 'deleterevision' );
669 return Xml
::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) )
670 . $wgOut->parse( wfMsgNoTrans( 'filehist-help' ) )
671 . Xml
::openElement( 'table', array( 'class' => 'filehistory' ) ) . "\n"
673 . ( $this->img
->isLocal() && $deleteColumn ?
'<td></td>' : '' )
674 . '<th>' . wfMsgHtml( 'filehist-datetime' ) . '</th>'
675 . '<th>' . wfMsgHtml( 'filehist-user' ) . '</th>'
676 . '<th>' . wfMsgHtml( 'filehist-dimensions' ) . '</th>'
677 . '<th class="mw-imagepage-filesize">' . wfMsgHtml( 'filehist-filesize' ) . '</th>'
678 . '<th>' . wfMsgHtml( 'filehist-comment' ) . '</th>'
682 public function endImageHistoryList() {
686 public function imageHistoryLine( $iscur, $file ) {
687 global $wgUser, $wgLang, $wgContLang, $wgTitle;
689 $timestamp = wfTimestamp(TS_MW
, $file->getTimestamp());
690 $img = $iscur ?
$file->getName() : $file->getArchiveName();
691 $user = $file->getUser('id');
692 $usertext = $file->getUser('text');
693 $size = $file->getSize();
694 $description = $file->getDescription();
695 $dims = $file->getDimensionsString();
696 $sha1 = $file->getSha1();
698 $local = $this->img
->isLocal();
702 if( $local && ($wgUser->isAllowed('delete') ||
$wgUser->isAllowed('deleterevision') ) ) {
704 # Link to remove from history
705 if( $wgUser->isAllowed( 'delete' ) ) {
707 $q[] = 'action=delete';
709 $q[] = 'oldimage=' . urlencode( $img );
710 $row .= $this->skin
->makeKnownLinkObj(
712 wfMsgHtml( $iscur ?
'filehist-deleteall' : 'filehist-deleteone' ),
717 # Link to hide content
718 if( $wgUser->isAllowed( 'deleterevision' ) ) {
719 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
720 // If file is top revision or locked from this user, don't link
721 if( $iscur ||
!$file->userCan(File
::DELETED_RESTRICTED
) ) {
722 $del = wfMsgHtml( 'rev-delundel' );
724 // If the file was hidden, link to sha-1
725 list($ts,$name) = explode('!',$img,2);
726 $del = $this->skin
->makeKnownLinkObj( $revdel, wfMsg( 'rev-delundel' ),
727 'target=' . urlencode( $wgTitle->getPrefixedText() ) .
728 '&oldimage=' . urlencode( $ts ) );
729 // Bolden oversighted content
730 if( $file->isDeleted(File
::DELETED_RESTRICTED
) )
731 $del = "<strong>$del</strong>";
733 $row .= "<tt><small>$del</small></tt>";
738 // Reversion link/current indicator
741 $row .= wfMsgHtml( 'filehist-current' );
742 } elseif( $local && $wgUser->isLoggedIn() && $this->title
->userCan( 'edit' ) ) {
743 if( $file->isDeleted(File
::DELETED_FILE
) ) {
744 $row .= wfMsgHtml('filehist-revert');
747 $q[] = 'action=revert';
748 $q[] = 'oldimage=' . urlencode( $img );
749 $q[] = 'wpEditToken=' . urlencode( $wgUser->editToken( $img ) );
750 $row .= $this->skin
->makeKnownLinkObj( $this->title
,
751 wfMsgHtml( 'filehist-revert' ),
752 implode( '&', $q ) );
757 // Date/time and image link
759 if( !$file->userCan(File
::DELETED_FILE
) ) {
760 # Don't link to unviewable files
761 $row .= '<span class="history-deleted">' . $wgLang->timeAndDate( $timestamp, true ) . '</span>';
762 } else if( $file->isDeleted(File
::DELETED_FILE
) ) {
763 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
764 # Make a link to review the image
765 $url = $this->skin
->makeKnownLinkObj( $revdel, $wgLang->timeAndDate( $timestamp, true ),
766 "target=".$wgTitle->getPrefixedText()."&file=$sha1.".$this->img
->getExtension() );
767 $row .= '<span class="history-deleted">'.$url.'</span>';
769 $url = $iscur ?
$this->img
->getUrl() : $this->img
->getArchiveUrl( $img );
770 $row .= Xml
::element( 'a',
771 array( 'href' => $url ),
772 $wgLang->timeAndDate( $timestamp, true ) );
780 // Hide deleted usernames
781 if( $file->isDeleted(File
::DELETED_USER
) )
782 $row .= '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
784 $row .= $this->skin
->userLink( $user, $usertext ) .
785 $this->skin
->userToolLinks( $user, $usertext );
787 $row .= htmlspecialchars( $usertext );
792 $row .= '<td>' . htmlspecialchars( $dims ) . '</td>';
795 $row .= '<td class="mw-imagepage-filesize">' . $this->skin
->formatSize( $size ) . '</td>';
797 // Don't show deleted descriptions
798 if ( $file->isDeleted(File
::DELETED_COMMENT
) )
799 $row .= '<td><span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span></td>';
801 $row .= '<td>' . $this->skin
->commentBlock( $description, $this->title
) . '</td>';
803 return "<tr>{$row}</tr>\n";