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 var $mExtraDescription = false;
22 * Handler for action=render
23 * Include body text only; none of the image extras
27 $wgOut->setArticleBodyOnly( true );
28 $wgOut->addSecondaryWikitext( $this->getContent() );
32 global $wgOut, $wgShowEXIF, $wgRequest, $wgUser;
34 $this->img
= new Image( $this->mTitle
);
36 $diff = $wgRequest->getVal( 'diff' );
37 $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
39 if ( $this->mTitle
->getNamespace() != NS_IMAGE ||
( isset( $diff ) && $diffOnly ) )
40 return Article
::view();
42 if ($wgShowEXIF && $this->img
->exists()) {
43 $exif = $this->img
->getExifData();
44 $showmeta = count($exif) ?
true : false;
50 if ($this->img
->exists())
51 $wgOut->addHTML($this->showTOC($showmeta));
53 $this->openShowImage();
55 # No need to display noarticletext, we use our own message, output in openShowImage()
56 if ( $this->getID() ) {
59 # Just need to set the right headers
60 $wgOut->setArticleFlag( true );
61 $wgOut->setRobotpolicy( 'index,follow' );
62 $wgOut->setPageTitle( $this->mTitle
->getPrefixedText() );
66 # Show shared description, if needed
67 if ( $this->mExtraDescription
) {
68 $fol = wfMsg( 'shareddescriptionfollows' );
69 if( $fol != '-' && !wfEmptyMsg( 'shareddescriptionfollows', $fol ) ) {
70 $wgOut->addWikiText( $fol );
72 $wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription
. '</div>' );
75 $this->closeShowImage();
76 $this->imageHistory();
80 global $wgStylePath, $wgStyleVersion;
81 $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) );
82 $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) );
83 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ). "\n" );
84 $wgOut->addWikiText( $this->makeMetadataTable( $exif ) );
86 "<script type=\"text/javascript\" src=\"$wgStylePath/common/metadata.js?$wgStyleVersion\"></script>\n" .
87 "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '$expand', '$collapse');</script>\n" );
96 * @param bool $metadata Whether or not to show the metadata link
99 function showTOC( $metadata ) {
101 $r = '<ul id="filetoc">
102 <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE
) . '</a></li>
103 <li><a href="#filehistory">' . wfMsgHtml( 'imghistory' ) . '</a></li>
104 <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
105 ($metadata ?
'<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
111 * Make a table with metadata to be shown in the output page.
115 * @param array $exif The array containing the EXIF data
118 function makeMetadataTable( $exif ) {
119 $r = wfMsg( 'metadata-help' ) . "\n\n";
120 $r .= "{| id=mw_metadata class=mw_metadata\n";
121 $visibleFields = $this->visibleMetadataFields();
122 foreach( $exif as $k => $v ) {
123 $tag = strtolower( $k );
124 $msg = wfMsg( "exif-$tag" );
125 $class = "exif-$tag";
126 if( !in_array( $tag, $visibleFields ) ) {
127 $class .= ' collapsable';
129 $r .= "|- class=\"$class\"\n";
138 * Get a list of EXIF metadata items which should be displayed when
139 * the metadata table is collapsed.
141 * @return array of strings
144 function visibleMetadataFields() {
146 $lines = explode( "\n", wfMsgForContent( 'metadata-fields' ) );
147 foreach( $lines as $line ) {
149 if( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) {
150 $fields[] = $matches[1];
157 * Overloading Article's getContent method.
159 * Omit noarticletext if sharedupload; text will be fetched from the
160 * shared upload server if possible.
162 function getContent() {
163 if( $this->img
&& $this->img
->fromSharedDirectory
&& 0 == $this->getID() ) {
166 return Article
::getContent();
169 function openShowImage() {
170 global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgLang;
172 $full_url = $this->img
->getURL();
173 $linkAttribs = false;
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 ) ) {
197 $params = array( 'page' => $page );
199 $width_orig = $this->img
->getWidth();
200 $width = $width_orig;
201 $height_orig = $this->img
->getHeight();
202 $height = $height_orig;
203 $mime = $this->img
->getMimeType();
205 $linkAttribs = array( 'href' => $full_url );
207 wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this , &$wgOut ) ) ;
209 if ( $this->img
->allowInlineDisplay() and $width and $height) {
212 # "Download high res version" link below the image
213 $msgsize = wfMsgHtml('file-info-size', $width_orig, $height_orig, $sk->formatSize( $this->img
->getSize() ), $mime );
214 # We'll show a thumbnail of this image
215 if ( $width > $maxWidth ||
$height > $maxHeight ) {
216 # Calculate the thumbnail size.
217 # First case, the limiting factor is the width, not the height.
218 if ( $width / $height >= $maxWidth / $maxHeight ) {
219 $height = round( $height * $maxWidth / $width);
221 # Note that $height <= $maxHeight now.
223 $newwidth = floor( $width * $maxHeight / $height);
224 $height = round( $height * $newwidth / $width );
226 # Note that $height <= $maxHeight now, but might not be identical
227 # because of rounding.
229 $msgbig = wfMsgHtml( 'show-big-image' );
230 $msgsmall = wfMsgExt( 'show-big-image-thumb',
231 array( 'parseinline' ), $width, $height );
233 # Image is small enough to show full size on image page
234 $msgbig = htmlspecialchars( $this->img
->getName() );
235 $msgsmall = wfMsgExt( 'file-nohires', array( 'parseinline' ) );
238 $params['width'] = $width;
239 $thumbnail = $this->img
->transform( $params );
241 $anchorclose = "<br />";
242 if( $this->img
->mustRender() ) {
247 '<br />' . Xml
::tags( 'a', $linkAttribs, $msgbig ) . ' ' . $msgsize;
250 if ( $this->img
->isMultipage() ) {
251 $wgOut->addHTML( '<table class="multipageimage"><tr><td>' );
256 'alt' => $this->img
->getTitle()->getPrefixedText()
260 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
261 $thumbnail->toHtml( $imgAttribs, $linkAttribs ) .
262 $anchorclose . '</div>' );
265 if ( $this->img
->isMultipage() ) {
266 $count = $this->img
->pageCount();
269 $label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
270 $link = $sk->makeKnownLinkObj( $this->mTitle
, $label, 'page='. ($page-1) );
271 $thumb1 = $sk->makeThumbLinkObj( $this->img
, $link, $label, 'none',
272 array( 'page' => $page - 1 ) );
277 if ( $page < $count ) {
278 $label = wfMsg( 'imgmultipagenext' );
279 $link = $sk->makeKnownLinkObj( $this->mTitle
, $label, 'page='. ($page+
1) );
280 $thumb2 = $sk->makeThumbLinkObj( $this->img
, $link, $label, 'none',
281 array( 'page' => $page +
1 ) );
287 $select = '<form name="pageselector" action="' .
288 htmlspecialchars( $wgScript ) .
289 '" method="get" onchange="document.pageselector.submit();">' .
290 Xml
::hidden( 'title', $this->getTitle()->getPrefixedDbKey() );
291 $select .= $wgOut->parse( wfMsg( 'imgmultigotopre' ), false ) .
292 ' <select id="pageselector" name="page">';
293 for ( $i=1; $i <= $count; $i++
) {
294 $select .= Xml
::option( $wgLang->formatNum( $i ), $i,
297 $select .= '</select>' . $wgOut->parse( wfMsg( 'imgmultigotopost' ), false ) .
298 '<input type="submit" value="' .
299 htmlspecialchars( wfMsg( 'imgmultigo' ) ) . '"></form>';
301 $wgOut->addHTML( '</td><td><div class="multipageimagenavbox">' .
302 "$select<hr />$thumb1\n$thumb2<br clear=\"all\" /></div></td></tr></table>" );
305 #if direct link is allowed but it's not a renderable image, show an icon.
306 if ($this->img
->isSafeFile()) {
307 $icon= $this->img
->iconThumb();
309 $wgOut->addHTML( '<div class="fullImageLink" id="file"><a href="' . $full_url . '">' .
319 // Workaround for incorrect MIME type on SVGs uploaded in previous versions
320 if ($mime == 'image/svg') $mime = 'image/svg+xml';
322 $filename = wfEscapeWikiText( $this->img
->getName() );
323 $info = wfMsg( 'file-info', $sk->formatSize( $this->img
->getSize() ), $mime );
326 // Check for MIME type. Other types may have more information in the future.
327 if (substr($mime,0,9) == 'image/svg' ) {
328 $infores = wfMsg('file-svg', $width_orig, $height_orig ) . '<br />';
332 $dirmark = $wgContLang->getDirMark();
333 if (!$this->img
->isSafeFile()) {
334 $warning = wfMsg( 'mediawarning' );
335 $wgOut->addWikiText( <<<END
336 <div class="fullMedia">$infores
337 <span class="dangerousLink">[[Media:$filename|$filename]]</span>$dirmark
338 <span class="fileInfo"> $info</span>
341 <div class="mediaWarning">$warning</div>
345 $wgOut->addWikiText( <<<END
346 <div class="fullMedia">$infores
347 [[Media:$filename|$filename]]$dirmark <span class="fileInfo"> $info</span>
354 if($this->img
->fromSharedDirectory
) {
355 $this->printSharedImageText();
358 # Image does not exist
360 $title = SpecialPage
::getTitleFor( 'Upload' );
361 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
362 'wpDestFile=' . urlencode( $this->img
->getName() ) );
363 $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
367 function printSharedImageText() {
368 global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut, $wgUser;
370 $url = $wgRepositoryBaseUrl . urlencode($this->mTitle
->getDBkey());
371 $sharedtext = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml("sharedupload");
372 if ($wgRepositoryBaseUrl && !$wgFetchCommonsDescriptions) {
374 $sk = $wgUser->getSkin();
375 $title = SpecialPage
::getTitleFor( 'Upload' );
376 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
377 array( 'wpDestFile' => urlencode( $this->img
->getName() )));
378 $sharedtext .= " " . wfMsgWikiHtml('shareduploadwiki', $link);
380 $sharedtext .= "</div>";
381 $wgOut->addHTML($sharedtext);
383 if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
384 $renderUrl = wfAppendQuery( $url, 'action=render' );
385 wfDebug( "Fetching shared description from $renderUrl\n" );
386 $text = Http
::get( $renderUrl );
388 $this->mExtraDescription
= $text;
392 function getUploadUrl() {
394 $uploadTitle = SpecialPage
::getTitleFor( 'Upload' );
395 return $wgServer . $uploadTitle->getLocalUrl( 'wpDestFile=' . urlencode( $this->img
->getName() ) );
399 * Print out the various links at the bottom of the image page, e.g. reupload,
400 * external editing (and instructions link) etc.
402 function uploadLinksBox() {
403 global $wgUser, $wgOut;
405 if( $this->img
->fromSharedDirectory
)
408 $sk = $wgUser->getSkin();
410 $wgOut->addHtml( '<br /><ul>' );
412 # "Upload a new version of this file" link
413 if( $wgUser->isAllowed( 'reupload' ) ) {
414 $ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
415 $wgOut->addHtml( "<li><div class='plainlinks'>{$ulink}</div></li>" );
418 # External editing link
419 $elink = $sk->makeKnownLinkObj( $this->mTitle
, wfMsgHtml( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
420 $wgOut->addHtml( '<li>' . $elink . '<div>' . wfMsgWikiHtml( 'edit-externally-help' ) . '</div></li>' );
422 $wgOut->addHtml( '</ul>' );
425 function closeShowImage()
432 * If the page we've just displayed is in the "Image" namespace,
433 * we follow it with an upload history of the image and its usage.
435 function imageHistory()
437 global $wgUser, $wgOut, $wgUseExternalEditor;
439 $sk = $wgUser->getSkin();
441 $line = $this->img
->nextHistoryLine();
444 $list = new ImageHistoryList( $sk );
445 $s = $list->beginImageHistoryList() .
446 $list->imageHistoryLine( true, wfTimestamp(TS_MW
, $line->img_timestamp
),
447 $this->mTitle
->getDBkey(), $line->img_user
,
448 $line->img_user_text
, $line->img_size
, $line->img_description
,
449 $line->img_width
, $line->img_height
452 while ( $line = $this->img
->nextHistoryLine() ) {
453 $s .= $list->imageHistoryLine( false, $line->img_timestamp
,
454 $line->oi_archive_name
, $line->img_user
,
455 $line->img_user_text
, $line->img_size
, $line->img_description
,
456 $line->img_width
, $line->img_height
459 $s .= $list->endImageHistoryList();
461 $wgOut->addHTML( $s );
463 # Exist check because we don't want to show this on pages where an image
464 # doesn't exist along with the noimage message, that would suck. -ævar
465 if( $wgUseExternalEditor && $this->img
->exists() ) {
466 $this->uploadLinksBox();
471 function imageLinks()
473 global $wgUser, $wgOut;
475 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
477 $dbr = wfGetDB( DB_SLAVE
);
478 $page = $dbr->tableName( 'page' );
479 $imagelinks = $dbr->tableName( 'imagelinks' );
481 $sql = "SELECT page_namespace,page_title FROM $imagelinks,$page WHERE il_to=" .
482 $dbr->addQuotes( $this->mTitle
->getDBkey() ) . " AND il_from=page_id";
483 $sql = $dbr->limitResult($sql, 500, 0);
484 $res = $dbr->query( $sql, "ImagePage::imageLinks" );
486 if ( 0 == $dbr->numRows( $res ) ) {
487 $wgOut->addHtml( '<p>' . wfMsg( "nolinkstoimage" ) . "</p>\n" );
490 $wgOut->addHTML( '<p>' . wfMsg( 'linkstoimage' ) . "</p>\n<ul>" );
492 $sk = $wgUser->getSkin();
493 while ( $s = $dbr->fetchObject( $res ) ) {
494 $name = Title
::MakeTitle( $s->page_namespace
, $s->page_title
);
495 $link = $sk->makeKnownLinkObj( $name, "" );
496 $wgOut->addHTML( "<li>{$link}</li>\n" );
498 $wgOut->addHTML( "</ul>\n" );
503 global $wgUser, $wgOut, $wgRequest;
505 $confirm = $wgRequest->wasPosted();
506 $reason = $wgRequest->getVal( 'wpReason' );
507 $image = $wgRequest->getVal( 'image' );
508 $oldimage = $wgRequest->getVal( 'oldimage' );
510 # Only sysops can delete images. Previously ordinary users could delete
511 # old revisions, but this is no longer the case.
512 if ( !$wgUser->isAllowed('delete') ) {
513 $wgOut->permissionRequired( 'delete' );
516 if ( $wgUser->isBlocked() ) {
517 $wgOut->blockedPage();
520 if ( wfReadOnly() ) {
521 $wgOut->readOnlyPage();
525 # Better double-check that it hasn't been deleted yet!
526 $wgOut->setPagetitle( wfMsg( 'confirmdelete' ) );
527 if ( ( !is_null( $image ) )
528 && ( '' == trim( $image ) ) ) {
529 $wgOut->showFatalError( wfMsg( 'cannotdelete' ) );
533 $this->img
= new Image( $this->mTitle
);
535 # Deleting old images doesn't require confirmation
536 if ( !is_null( $oldimage ) ||
$confirm ) {
537 if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
538 $this->doDelete( $reason );
540 $wgOut->showFatalError( wfMsg( 'sessionfailure' ) );
545 if ( !is_null( $image ) ) {
546 $q = '&image=' . urlencode( $image );
547 } else if ( !is_null( $oldimage ) ) {
548 $q = '&oldimage=' . urlencode( $oldimage );
552 return $this->confirmDelete( $q, $wgRequest->getText( 'wpReason' ) );
557 * @param $reason User provided reason for deletion.
559 function doDelete( $reason ) {
560 global $wgOut, $wgRequest;
562 $oldimage = $wgRequest->getVal( 'oldimage' );
564 if ( !is_null( $oldimage ) ) {
565 if ( strlen( $oldimage ) < 16 ) {
566 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
569 if ( strstr( $oldimage, "/" ) ||
strstr( $oldimage, "\\" ) ) {
570 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
573 if ( !$this->doDeleteOldImage( $oldimage ) ) {
576 $deleted = $oldimage;
578 $ok = $this->img
->delete( $reason );
580 # If the deletion operation actually failed, bug out:
581 $wgOut->showFileDeleteError( $this->img
->getName() );
585 # Image itself is now gone, and database is cleaned.
586 # Now we remove the image description page.
588 $article = new Article( $this->mTitle
);
589 $article->doDeleteArticle( $reason ); # ignore errors
591 $deleted = $this->img
->getName();
594 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
595 $wgOut->setRobotpolicy( 'noindex,nofollow' );
597 $loglink = '[[Special:Log/delete|' . wfMsg( 'deletionlog' ) . ']]';
598 $text = wfMsg( 'deletedtext', $deleted, $loglink );
600 $wgOut->addWikiText( $text );
602 $wgOut->returnToMain( false, $this->mTitle
->getPrefixedText() );
608 function doDeleteOldImage( $oldimage )
612 $ok = $this->img
->deleteOld( $oldimage, '' );
614 # If we actually have a file and can't delete it, throw an error.
615 # Something went awry...
616 $wgOut->showFileDeleteError( "$oldimage" );
619 $log = new LogPage( 'delete' );
620 $log->addEntry( 'delete', $this->mTitle
, wfMsg('deletedrevision',$oldimage) );
626 global $wgOut, $wgRequest, $wgUser;
628 $oldimage = $wgRequest->getText( 'oldimage' );
629 if ( strlen( $oldimage ) < 16 ) {
630 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
633 if ( strstr( $oldimage, "/" ) ||
strstr( $oldimage, "\\" ) ) {
634 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
638 if ( wfReadOnly() ) {
639 $wgOut->readOnlyPage();
642 if( $wgUser->isAnon() ) {
643 $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' );
646 if ( ! $this->mTitle
->userCan( 'edit' ) ) {
647 $wgOut->readOnlyPage( $this->getContent(), true );
650 if ( $wgUser->isBlocked() ) {
651 $wgOut->blockedPage();
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() );
695 * Override handling of action=purge
698 $this->img
= new Image( $this->mTitle
);
699 if( $this->img
->exists() ) {
700 wfDebug( "ImagePage::doPurge purging " . $this->img
->getName() . "\n" );
701 $update = new HTMLCacheUpdate( $this->mTitle
, 'imagelinks' );
703 $this->img
->upgradeRow();
704 $this->img
->purgeCache();
706 wfDebug( "ImagePage::doPurge no image\n" );
717 class ImageHistoryList
{
718 function ImageHistoryList( &$skin ) {
719 $this->skin
=& $skin;
722 function beginImageHistoryList() {
724 Xml
::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'imghistory' ) ) .
725 "\n<p>" . wfMsg( 'imghistlegend' ) . "</p>\n".'<ul class="special">';
729 function endImageHistoryList() {
734 function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description, $width, $height ) {
735 global $wgUser, $wgLang, $wgTitle, $wgContLang;
737 $datetime = $wgLang->timeanddate( $timestamp, true );
738 $del = wfMsgHtml( 'deleteimg' );
739 $delall = wfMsgHtml( 'deleteimgcompletely' );
740 $cur = wfMsgHtml( 'cur' );
743 $url = Image
::imageUrl( $img );
745 if ( $wgUser->isAllowed('delete') ) {
746 $link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
748 $style = $this->skin
->getInternalLinkAttributes( $link, $delall );
750 $dlink = '<a href="'.$link.'"'.$style.'>'.$delall.'</a>';
755 $url = htmlspecialchars( wfImageArchiveUrl( $img ) );
756 if( $wgUser->getID() != 0 && $wgTitle->userCan( 'edit' ) ) {
757 $token = urlencode( $wgUser->editToken( $img ) );
758 $rlink = $this->skin
->makeKnownLinkObj( $wgTitle,
759 wfMsgHtml( 'revertimg' ), 'action=revert&oldimage=' .
760 urlencode( $img ) . "&wpEditToken=$token" );
761 $dlink = $this->skin
->makeKnownLinkObj( $wgTitle,
762 $del, 'action=delete&oldimage=' . urlencode( $img ) .
763 "&wpEditToken=$token" );
765 # Having live active links for non-logged in users
766 # means that bots and spiders crawling our site can
767 # inadvertently change content. Baaaad idea.
768 $rlink = wfMsgHtml( 'revertimg' );
773 $userlink = $this->skin
->userLink( $user, $usertext ) . $this->skin
->userToolLinks( $user, $usertext );
774 $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
775 $wgLang->formatNum( $size ) );
776 $widthheight = wfMsgHtml( 'widthheight', $width, $height );
777 $style = $this->skin
->getInternalLinkAttributes( $url, $datetime );
779 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$datetime}</a> . . {$userlink} . . {$widthheight} ({$nbytes})";
781 $s .= $this->skin
->commentBlock( $description, $wgTitle );