8 if( !defined( 'MEDIAWIKI' ) )
12 * Special handling for image description pages
14 class ImagePage
extends Article
{
16 /* private */ var $img; // Image object this page is shown for
17 var $mExtraDescription = false;
20 * Handler for action=render
21 * Include body text only; none of the image extras
25 $wgOut->setArticleBodyOnly( true );
26 $wgOut->addSecondaryWikitext( $this->getContent() );
30 global $wgOut, $wgShowEXIF, $wgRequest, $wgUser;
32 $this->img
= new Image( $this->mTitle
);
34 $diff = $wgRequest->getVal( 'diff' );
35 $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
37 if ( $this->mTitle
->getNamespace() != NS_IMAGE ||
( isset( $diff ) && $diffOnly ) )
38 return Article
::view();
40 if ($wgShowEXIF && $this->img
->exists()) {
41 $exif = $this->img
->getExifData();
42 $showmeta = count($exif) ?
true : false;
48 if ($this->img
->exists())
49 $wgOut->addHTML($this->showTOC($showmeta));
51 $this->openShowImage();
53 # No need to display noarticletext, we use our own message, output in openShowImage()
54 if ( $this->getID() ) {
57 # Just need to set the right headers
58 $wgOut->setArticleFlag( true );
59 $wgOut->setRobotpolicy( 'index,follow' );
60 $wgOut->setPageTitle( $this->mTitle
->getPrefixedText() );
64 # Show shared description, if needed
65 if ( $this->mExtraDescription
) {
66 $fol = wfMsg( 'shareddescriptionfollows' );
68 $wgOut->addWikiText( $fol );
70 $wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription
. '</div>' );
73 $this->closeShowImage();
74 $this->imageHistory();
78 global $wgStylePath, $wgStyleVersion;
79 $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) );
80 $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) );
81 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ). "\n" );
82 $wgOut->addWikiText( $this->makeMetadataTable( $exif ) );
84 "<script type=\"text/javascript\" src=\"$wgStylePath/common/metadata.js?$wgStyleVersion\"></script>\n" .
85 "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '$expand', '$collapse');</script>\n" );
94 * @param bool $metadata Whether or not to show the metadata link
97 function showTOC( $metadata ) {
99 $r = '<ul id="filetoc">
100 <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE
) . '</a></li>
101 <li><a href="#filehistory">' . wfMsgHtml( 'imghistory' ) . '</a></li>
102 <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
103 ($metadata ?
'<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
109 * Make a table with metadata to be shown in the output page.
113 * @param array $exif The array containing the EXIF data
116 function makeMetadataTable( $exif ) {
117 $r = wfMsg( 'metadata-help' ) . "\n\n";
118 $r .= "{| id=mw_metadata class=mw_metadata\n";
119 $visibleFields = $this->visibleMetadataFields();
120 foreach( $exif as $k => $v ) {
121 $tag = strtolower( $k );
122 $msg = wfMsg( "exif-$tag" );
123 $class = "exif-$tag";
124 if( !in_array( $tag, $visibleFields ) ) {
125 $class .= ' collapsable';
127 $r .= "|- class=\"$class\"\n";
136 * Get a list of EXIF metadata items which should be displayed when
137 * the metadata table is collapsed.
139 * @return array of strings
142 function visibleMetadataFields() {
144 $lines = explode( "\n", wfMsgForContent( 'metadata-fields' ) );
145 foreach( $lines as $line ) {
147 if( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) {
148 $fields[] = $matches[1];
155 * Overloading Article's getContent method.
157 * Omit noarticletext if sharedupload; text will be fetched from the
158 * shared upload server if possible.
160 function getContent() {
161 if( $this->img
&& $this->img
->fromSharedDirectory
&& 0 == $this->getID() ) {
164 return Article
::getContent();
167 function openShowImage() {
168 global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgLang;
169 global $wgUseImageResize, $wgGenerateThumbnailOnParse;
171 $full_url = $this->img
->getURL();
174 $sizeSel = intval( $wgUser->getOption( 'imagesize') );
175 if( !isset( $wgImageLimits[$sizeSel] ) ) {
176 $sizeSel = User
::getDefaultOption( 'imagesize' );
178 // The user offset might still be incorrect, specially if
179 // $wgImageLimits got changed (see bug #8858).
180 if( !isset( $wgImageLimits[$sizeSel] ) ) {
181 // Default to the first offset in $wgImageLimits
185 $max = $wgImageLimits[$sizeSel];
187 $maxHeight = $max[1];
188 $sk = $wgUser->getSkin();
190 if ( $this->img
->exists() ) {
192 $page = $wgRequest->getIntOrNull( 'page' );
193 if ( ! is_null( $page ) ) {
194 $this->img
->selectPage( $page );
198 $width_orig = $this->img
->getWidth();
199 $width = $width_orig;
200 $height_orig = $this->img
->getHeight();
201 $height = $height_orig;
202 $mime = $this->img
->getMimeType();
205 if ( $this->img
->allowInlineDisplay() and $width and $height) {
208 # "Download high res version" link below the image
209 $msgbig = wfMsgHtml('show-big-image');
210 $msgsize = wfMsgHtml('file-info-size', $width_orig, $height_orig, $sk->formatSize( $this->img
->getSize() ), $mime );
211 # We'll show a thumbnail of this image
212 if ( $width > $maxWidth ||
$height > $maxHeight ) {
213 # Calculate the thumbnail size.
214 # First case, the limiting factor is the width, not the height.
215 if ( $width / $height >= $maxWidth / $maxHeight ) {
216 $height = round( $height * $maxWidth / $width);
218 # Note that $height <= $maxHeight now.
220 $newwidth = floor( $width * $maxHeight / $height);
221 $height = round( $height * $newwidth / $width );
223 # Note that $height <= $maxHeight now, but might not be identical
224 # because of rounding.
227 if( $wgUseImageResize ) {
228 $thumbnail = $this->img
->getThumbnail( $width, -1, $wgGenerateThumbnailOnParse );
229 if ( $thumbnail == null ) {
230 $url = $this->img
->getViewURL();
232 $url = $thumbnail->getURL();
235 # No resize ability? Show the full image, but scale
236 # it down in the browser so it fits on the page.
237 $url = $this->img
->getViewURL();
239 $anchoropen = "<a href=\"{$full_url}\">";
240 $anchorclose = "</a><br />";
241 if( $this->img
->mustRender() ) {
244 $anchorclose .= wfMsg('show-big-image-thumb', $width, $height ) .
245 '<br />' . "\n$anchoropen{$msgbig}</a> " . $msgsize;
248 $url = $this->img
->getViewURL();
252 if ( $this->img
->isMultipage() ) {
253 $wgOut->addHTML( '<table class="multipageimage"><tr><td>' );
256 $wgOut->addHTML( '<div class="fullImageLink" id="file">' . $anchoropen .
257 "<img border=\"0\" src=\"{$url}\" width=\"{$width}\" height=\"{$height}\" alt=\"" .
258 htmlspecialchars( $this->img
->getTitle()->getPrefixedText() ).'" />' . $anchorclose . '</div>' );
260 if ( $this->img
->isMultipage() ) {
261 $count = $this->img
->pageCount();
264 $label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
265 $link = $sk->makeLinkObj( $this->mTitle
, $label, 'page='. ($page-1) );
266 $this->img
->selectPage( $page - 1 );
267 $thumb1 = $sk->makeThumbLinkObj( $this->img
, $link, $label, 'none' );
272 if ( $page < $count ) {
273 $label = wfMsg( 'imgmultipagenext' );
274 $this->img
->selectPage( $page +
1 );
275 $link = $sk->makeLinkObj( $this->mTitle
, $label, 'page='. ($page+
1) );
276 $thumb2 = $sk->makeThumbLinkObj( $this->img
, $link, $label, 'none' );
282 $select = '<form name="pageselector" action="' .
283 htmlspecialchars( $wgScript ) .
284 '" method="get" onchange="document.pageselector.submit();">' .
285 Xml
::hidden( 'title', $this->getTitle()->getPrefixedDbKey() );
286 $select .= $wgOut->parse( wfMsg( 'imgmultigotopre' ), false ) .
287 ' <select id="pageselector" name="page">';
288 for ( $i=1; $i <= $count; $i++
) {
289 $select .= Xml
::option( $wgLang->formatNum( $i ), $i,
292 $select .= '</select>' . $wgOut->parse( wfMsg( 'imgmultigotopost' ), false ) .
293 '<input type="submit" value="' .
294 htmlspecialchars( wfMsg( 'imgmultigo' ) ) . '"></form>';
296 $wgOut->addHTML( '</td><td><div class="multipageimagenavbox">' .
297 "$select<hr />$thumb1\n$thumb2<br clear=\"all\" /></div></td></tr></table>" );
300 #if direct link is allowed but it's not a renderable image, show an icon.
301 if ($this->img
->isSafeFile()) {
302 $icon= $this->img
->iconThumb();
304 $wgOut->addHTML( '<div class="fullImageLink" id="file"><a href="' . $full_url . '">' .
314 $filename = wfEscapeWikiText( $this->img
->getName() );
315 // Hacky workaround: for some reason we use the incorrect MIME type
316 // image/svg for SVG. This should be fixed internally, but at least
317 // make the displayed type right.
318 if ($mime == 'image/svg') $mime = 'image/svg+xml';
319 // Check for MIME type. Other types may have more information in the future.
321 if ( substr($mime,0,5) == 'image' ) {
322 $infores = wfMsg('file-nohires') . '<br />';
325 $width_orig, $height_orig,
326 $sk->formatSize( $this->img
->getSize() ),
331 $sk->formatSize( $this->img
->getSize() ),
336 $dirmark = $wgContLang->getDirMark();
337 if (!$this->img
->isSafeFile()) {
338 $warning = wfMsg( 'mediawarning' );
339 $wgOut->addWikiText( <<<END
340 <div class="fullMedia">$infores
341 <span class="dangerousLink">[[Media:$filename|$filename]]</span>$dirmark
342 <span class="fileInfo"> $info</span>
345 <div class="mediaWarning">$warning</div>
349 $wgOut->addWikiText( <<<END
350 <div class="fullMedia">$infores
351 [[Media:$filename|$filename]]$dirmark <span class="fileInfo"> $info</span>
358 if($this->img
->fromSharedDirectory
) {
359 $this->printSharedImageText();
362 # Image does not exist
364 $title = SpecialPage
::getTitleFor( 'Upload' );
365 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
366 'wpDestFile=' . urlencode( $this->img
->getName() ) );
367 $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
371 function printSharedImageText() {
372 global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut, $wgUser;
374 $url = $wgRepositoryBaseUrl . urlencode($this->mTitle
->getDBkey());
375 $sharedtext = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml("sharedupload");
376 if ($wgRepositoryBaseUrl && !$wgFetchCommonsDescriptions) {
378 $sk = $wgUser->getSkin();
379 $title = SpecialPage
::getTitleFor( 'Upload' );
380 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
381 array( 'wpDestFile' => urlencode( $this->img
->getName() )));
382 $sharedtext .= " " . wfMsgWikiHtml('shareduploadwiki', $link);
384 $sharedtext .= "</div>";
385 $wgOut->addHTML($sharedtext);
387 if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
388 $text = Http
::get($url . '?action=render');
390 $this->mExtraDescription
= $text;
394 function getUploadUrl() {
396 $uploadTitle = SpecialPage
::getTitleFor( 'Upload' );
397 return $wgServer . $uploadTitle->getLocalUrl( 'wpDestFile=' . urlencode( $this->img
->getName() ) );
401 * Print out the various links at the bottom of the image page, e.g. reupload,
402 * external editing (and instructions link) etc.
404 function uploadLinksBox() {
405 global $wgUser, $wgOut;
407 if( $this->img
->fromSharedDirectory
)
410 $sk = $wgUser->getSkin();
412 $wgOut->addHtml( '<br /><ul>' );
414 # "Upload a new version of this file" link
415 if( $wgUser->isAllowed( 'reupload' ) ) {
416 $ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
417 $wgOut->addHtml( "<li><div class='plainlinks'>{$ulink}</div></li>" );
420 # External editing link
421 $elink = $sk->makeKnownLinkObj( $this->mTitle
, wfMsgHtml( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
422 $wgOut->addHtml( '<li>' . $elink . '<div>' . wfMsgWikiHtml( 'edit-externally-help' ) . '</div></li>' );
424 $wgOut->addHtml( '</ul>' );
427 function closeShowImage()
434 * If the page we've just displayed is in the "Image" namespace,
435 * we follow it with an upload history of the image and its usage.
437 function imageHistory()
439 global $wgUser, $wgOut, $wgUseExternalEditor;
441 $sk = $wgUser->getSkin();
443 $line = $this->img
->nextHistoryLine();
446 $list = new ImageHistoryList( $sk );
447 $s = $list->beginImageHistoryList() .
448 $list->imageHistoryLine( true, wfTimestamp(TS_MW
, $line->img_timestamp
),
449 $this->mTitle
->getDBkey(), $line->img_user
,
450 $line->img_user_text
, $line->img_size
, $line->img_description
,
451 $line->img_width
, $line->img_height
454 while ( $line = $this->img
->nextHistoryLine() ) {
455 $s .= $list->imageHistoryLine( false, $line->img_timestamp
,
456 $line->oi_archive_name
, $line->img_user
,
457 $line->img_user_text
, $line->img_size
, $line->img_description
,
458 $line->img_width
, $line->img_height
461 $s .= $list->endImageHistoryList();
463 $wgOut->addHTML( $s );
465 # Exist check because we don't want to show this on pages where an image
466 # doesn't exist along with the noimage message, that would suck. -ævar
467 if( $wgUseExternalEditor && $this->img
->exists() ) {
468 $this->uploadLinksBox();
473 function imageLinks()
475 global $wgUser, $wgOut;
477 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
479 $dbr = wfGetDB( DB_SLAVE
);
480 $page = $dbr->tableName( 'page' );
481 $imagelinks = $dbr->tableName( 'imagelinks' );
483 $sql = "SELECT page_namespace,page_title FROM $imagelinks,$page WHERE il_to=" .
484 $dbr->addQuotes( $this->mTitle
->getDBkey() ) . " AND il_from=page_id";
485 $sql = $dbr->limitResult($sql, 500, 0);
486 $res = $dbr->query( $sql, "ImagePage::imageLinks" );
488 if ( 0 == $dbr->numRows( $res ) ) {
489 $wgOut->addHtml( '<p>' . wfMsg( "nolinkstoimage" ) . "</p>\n" );
492 $wgOut->addHTML( '<p>' . wfMsg( 'linkstoimage' ) . "</p>\n<ul>" );
494 $sk = $wgUser->getSkin();
495 while ( $s = $dbr->fetchObject( $res ) ) {
496 $name = Title
::MakeTitle( $s->page_namespace
, $s->page_title
);
497 $link = $sk->makeKnownLinkObj( $name, "" );
498 $wgOut->addHTML( "<li>{$link}</li>\n" );
500 $wgOut->addHTML( "</ul>\n" );
505 global $wgUser, $wgOut, $wgRequest;
507 $confirm = $wgRequest->wasPosted();
508 $reason = $wgRequest->getVal( 'wpReason' );
509 $image = $wgRequest->getVal( 'image' );
510 $oldimage = $wgRequest->getVal( 'oldimage' );
512 # Only sysops can delete images. Previously ordinary users could delete
513 # old revisions, but this is no longer the case.
514 if ( !$wgUser->isAllowed('delete') ) {
515 $wgOut->permissionRequired( 'delete' );
518 if ( $wgUser->isBlocked() ) {
519 return $this->blockedIPpage();
521 if ( wfReadOnly() ) {
522 $wgOut->readOnlyPage();
526 # Better double-check that it hasn't been deleted yet!
527 $wgOut->setPagetitle( wfMsg( 'confirmdelete' ) );
528 if ( ( !is_null( $image ) )
529 && ( '' == trim( $image ) ) ) {
530 $wgOut->showFatalError( wfMsg( 'cannotdelete' ) );
534 $this->img
= new Image( $this->mTitle
);
536 # Deleting old images doesn't require confirmation
537 if ( !is_null( $oldimage ) ||
$confirm ) {
538 if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
539 $this->doDelete( $reason );
541 $wgOut->showFatalError( wfMsg( 'sessionfailure' ) );
546 if ( !is_null( $image ) ) {
547 $q = '&image=' . urlencode( $image );
548 } else if ( !is_null( $oldimage ) ) {
549 $q = '&oldimage=' . urlencode( $oldimage );
553 return $this->confirmDelete( $q, $wgRequest->getText( 'wpReason' ) );
558 * @param $reason User provided reason for deletion.
560 function doDelete( $reason ) {
561 global $wgOut, $wgRequest;
563 $oldimage = $wgRequest->getVal( 'oldimage' );
565 if ( !is_null( $oldimage ) ) {
566 if ( strlen( $oldimage ) < 16 ) {
567 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
570 if ( strstr( $oldimage, "/" ) ||
strstr( $oldimage, "\\" ) ) {
571 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
574 if ( !$this->doDeleteOldImage( $oldimage ) ) {
577 $deleted = $oldimage;
579 $ok = $this->img
->delete( $reason );
581 # If the deletion operation actually failed, bug out:
582 $wgOut->showFileDeleteError( $this->img
->getName() );
586 # Image itself is now gone, and database is cleaned.
587 # Now we remove the image description page.
589 $article = new Article( $this->mTitle
);
590 $article->doDeleteArticle( $reason ); # ignore errors
592 $deleted = $this->img
->getName();
595 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
596 $wgOut->setRobotpolicy( 'noindex,nofollow' );
598 $loglink = '[[Special:Log/delete|' . wfMsg( 'deletionlog' ) . ']]';
599 $text = wfMsg( 'deletedtext', $deleted, $loglink );
601 $wgOut->addWikiText( $text );
603 $wgOut->returnToMain( false, $this->mTitle
->getPrefixedText() );
609 function doDeleteOldImage( $oldimage )
613 $ok = $this->img
->deleteOld( $oldimage, '' );
615 # If we actually have a file and can't delete it, throw an error.
616 # Something went awry...
617 $wgOut->showFileDeleteError( "$oldimage" );
620 $log = new LogPage( 'delete' );
621 $log->addEntry( 'delete', $this->mTitle
, wfMsg('deletedrevision',$oldimage) );
627 global $wgOut, $wgRequest, $wgUser;
629 $oldimage = $wgRequest->getText( 'oldimage' );
630 if ( strlen( $oldimage ) < 16 ) {
631 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
634 if ( strstr( $oldimage, "/" ) ||
strstr( $oldimage, "\\" ) ) {
635 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
639 if ( wfReadOnly() ) {
640 $wgOut->readOnlyPage();
643 if( $wgUser->isAnon() ) {
644 $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' );
647 if ( ! $this->mTitle
->userCan( 'edit' ) ) {
648 $wgOut->readOnlyPage( $this->getContent(), true );
651 if ( $wgUser->isBlocked() ) {
652 return $this->blockedIPpage();
654 if( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
655 $wgOut->showErrorPage( 'internalerror', 'sessionfailure' );
658 $name = substr( $oldimage, 15 );
660 $dest = wfImageDir( $name );
661 $archive = wfImageArchiveDir( $name );
662 $curfile = "{$dest}/{$name}";
664 if ( !is_dir( $dest ) ) wfMkdirParents( $dest );
665 if ( !is_dir( $archive ) ) wfMkdirParents( $archive );
667 if ( ! is_file( $curfile ) ) {
668 $wgOut->showFileNotFoundError( htmlspecialchars( $curfile ) );
671 $oldver = wfTimestampNow() . "!{$name}";
673 if ( ! rename( $curfile, "${archive}/{$oldver}" ) ) {
674 $wgOut->showFileRenameError( $curfile, "${archive}/{$oldver}" );
677 if ( ! copy( "{$archive}/{$oldimage}", $curfile ) ) {
678 $wgOut->showFileCopyError( "${archive}/{$oldimage}", $curfile );
682 # Record upload and update metadata cache
683 $img = Image
::newFromName( $name );
684 $img->recordUpload( $oldver, wfMsg( "reverted" ) );
686 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
687 $wgOut->setRobotpolicy( 'noindex,nofollow' );
688 $wgOut->addHTML( wfMsg( 'imagereverted' ) );
690 $descTitle = $img->getTitle();
691 $wgOut->returnToMain( false, $descTitle->getPrefixedText() );
694 function blockedIPpage() {
695 $edit = new EditPage( $this );
696 return $edit->blockedIPpage();
700 * Override handling of action=purge
703 $this->img
= new Image( $this->mTitle
);
704 if( $this->img
->exists() ) {
705 wfDebug( "ImagePage::doPurge purging " . $this->img
->getName() . "\n" );
706 $update = new HTMLCacheUpdate( $this->mTitle
, 'imagelinks' );
708 $this->img
->purgeCache();
710 wfDebug( "ImagePage::doPurge no image\n" );
720 class ImageHistoryList
{
721 function ImageHistoryList( &$skin ) {
722 $this->skin
=& $skin;
725 function beginImageHistoryList() {
727 Xml
::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'imghistory' ) ) .
728 "\n<p>" . wfMsg( 'imghistlegend' ) . "</p>\n".'<ul class="special">';
732 function endImageHistoryList() {
737 function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description, $width, $height ) {
738 global $wgUser, $wgLang, $wgTitle, $wgContLang;
740 $datetime = $wgLang->timeanddate( $timestamp, true );
741 $del = wfMsgHtml( 'deleteimg' );
742 $delall = wfMsgHtml( 'deleteimgcompletely' );
743 $cur = wfMsgHtml( 'cur' );
746 $url = Image
::imageUrl( $img );
748 if ( $wgUser->isAllowed('delete') ) {
749 $link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
751 $style = $this->skin
->getInternalLinkAttributes( $link, $delall );
753 $dlink = '<a href="'.$link.'"'.$style.'>'.$delall.'</a>';
758 $url = htmlspecialchars( wfImageArchiveUrl( $img ) );
759 if( $wgUser->getID() != 0 && $wgTitle->userCan( 'edit' ) ) {
760 $token = urlencode( $wgUser->editToken( $img ) );
761 $rlink = $this->skin
->makeKnownLinkObj( $wgTitle,
762 wfMsgHtml( 'revertimg' ), 'action=revert&oldimage=' .
763 urlencode( $img ) . "&wpEditToken=$token" );
764 $dlink = $this->skin
->makeKnownLinkObj( $wgTitle,
765 $del, 'action=delete&oldimage=' . urlencode( $img ) .
766 "&wpEditToken=$token" );
768 # Having live active links for non-logged in users
769 # means that bots and spiders crawling our site can
770 # inadvertently change content. Baaaad idea.
771 $rlink = wfMsgHtml( 'revertimg' );
776 $userlink = $this->skin
->userLink( $user, $usertext ) . $this->skin
->userToolLinks( $user, $usertext );
777 $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
778 $wgLang->formatNum( $size ) );
779 $widthheight = wfMsgHtml( 'widthheight', $width, $height );
780 $style = $this->skin
->getInternalLinkAttributes( $url, $datetime );
782 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$datetime}</a> . . {$userlink} . . {$widthheight} ({$nbytes})";
784 $s .= $this->skin
->commentBlock( $description, $wgTitle );