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 if ( $this->img
->allowInlineDisplay() and $width and $height) {
210 # "Download high res version" link below the image
211 $msgsize = wfMsgHtml('file-info-size', $width_orig, $height_orig, $sk->formatSize( $this->img
->getSize() ), $mime );
212 # We'll show a thumbnail of this image
213 if ( $width > $maxWidth ||
$height > $maxHeight ) {
214 # Calculate the thumbnail size.
215 # First case, the limiting factor is the width, not the height.
216 if ( $width / $height >= $maxWidth / $maxHeight ) {
217 $height = round( $height * $maxWidth / $width);
219 # Note that $height <= $maxHeight now.
221 $newwidth = floor( $width * $maxHeight / $height);
222 $height = round( $height * $newwidth / $width );
224 # Note that $height <= $maxHeight now, but might not be identical
225 # because of rounding.
227 $msgbig = wfMsgHtml('show-big-image');
228 $msgsmall = wfMsg('show-big-image-thumb', $width, $height );
230 # Image is small enough to show full size on image page
231 $msgbig = $this->img
->getName();
232 $msgsmall = wfMsg( 'file-nohires' );
235 $params['width'] = $width;
236 $thumbnail = $this->img
->transform( $params );
238 $anchorclose = "<br />";
239 if( $this->img
->mustRender() ) {
244 '<br />' . Xml
::tags( 'a', $linkAttribs, $msgbig ) . ' ' . $msgsize;
247 if ( $this->img
->isMultipage() ) {
248 $wgOut->addHTML( '<table class="multipageimage"><tr><td>' );
253 'alt' => $this->img
->getTitle()->getPrefixedText()
257 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
258 $thumbnail->toHtml( $imgAttribs, $linkAttribs ) .
259 $anchorclose . '</div>' );
262 if ( $this->img
->isMultipage() ) {
263 $count = $this->img
->pageCount();
266 $label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
267 $link = $sk->makeLinkObj( $this->mTitle
, $label, 'page='. ($page-1) );
268 $thumb1 = $sk->makeThumbLinkObj( $this->img
, $link, $label, 'none',
269 array( 'page' => $page - 1 ) );
274 if ( $page < $count ) {
275 $label = wfMsg( 'imgmultipagenext' );
276 $link = $sk->makeLinkObj( $this->mTitle
, $label, 'page='. ($page+
1) );
277 $thumb2 = $sk->makeThumbLinkObj( $this->img
, $link, $label, 'none',
278 array( 'page' => $page +
1 ) );
284 $select = '<form name="pageselector" action="' .
285 htmlspecialchars( $wgScript ) .
286 '" method="get" onchange="document.pageselector.submit();">' .
287 Xml
::hidden( 'title', $this->getTitle()->getPrefixedDbKey() );
288 $select .= $wgOut->parse( wfMsg( 'imgmultigotopre' ), false ) .
289 ' <select id="pageselector" name="page">';
290 for ( $i=1; $i <= $count; $i++
) {
291 $select .= Xml
::option( $wgLang->formatNum( $i ), $i,
294 $select .= '</select>' . $wgOut->parse( wfMsg( 'imgmultigotopost' ), false ) .
295 '<input type="submit" value="' .
296 htmlspecialchars( wfMsg( 'imgmultigo' ) ) . '"></form>';
298 $wgOut->addHTML( '</td><td><div class="multipageimagenavbox">' .
299 "$select<hr />$thumb1\n$thumb2<br clear=\"all\" /></div></td></tr></table>" );
302 #if direct link is allowed but it's not a renderable image, show an icon.
303 if ($this->img
->isSafeFile()) {
304 $icon= $this->img
->iconThumb();
306 $wgOut->addHTML( '<div class="fullImageLink" id="file"><a href="' . $full_url . '">' .
316 // Workaround for incorrect MIME type on SVGs uploaded in previous versions
317 if ($mime == 'image/svg') $mime = 'image/svg+xml';
319 $filename = wfEscapeWikiText( $this->img
->getName() );
320 $info = wfMsg( 'file-info', $sk->formatSize( $this->img
->getSize() ), $mime );
323 // Check for MIME type. Other types may have more information in the future.
324 if (substr($mime,0,9) == 'image/svg' ) {
325 $infores = wfMsg('file-svg', $width_orig, $height_orig ) . '<br />';
329 $dirmark = $wgContLang->getDirMark();
330 if (!$this->img
->isSafeFile()) {
331 $warning = wfMsg( 'mediawarning' );
332 $wgOut->addWikiText( <<<END
333 <div class="fullMedia">$infores
334 <span class="dangerousLink">[[Media:$filename|$filename]]</span>$dirmark
335 <span class="fileInfo"> $info</span>
338 <div class="mediaWarning">$warning</div>
342 $wgOut->addWikiText( <<<END
343 <div class="fullMedia">$infores
344 [[Media:$filename|$filename]]$dirmark <span class="fileInfo"> $info</span>
351 if($this->img
->fromSharedDirectory
) {
352 $this->printSharedImageText();
355 # Image does not exist
357 $title = SpecialPage
::getTitleFor( 'Upload' );
358 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
359 'wpDestFile=' . urlencode( $this->img
->getName() ) );
360 $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
364 function printSharedImageText() {
365 global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut, $wgUser;
367 $url = $wgRepositoryBaseUrl . urlencode($this->mTitle
->getDBkey());
368 $sharedtext = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml("sharedupload");
369 if ($wgRepositoryBaseUrl && !$wgFetchCommonsDescriptions) {
371 $sk = $wgUser->getSkin();
372 $title = SpecialPage
::getTitleFor( 'Upload' );
373 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
374 array( 'wpDestFile' => urlencode( $this->img
->getName() )));
375 $sharedtext .= " " . wfMsgWikiHtml('shareduploadwiki', $link);
377 $sharedtext .= "</div>";
378 $wgOut->addHTML($sharedtext);
380 if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
381 $renderUrl = wfAppendQuery( $url, 'action=render' );
382 wfDebug( "Fetching shared description from $renderUrl\n" );
383 $text = Http
::get( $renderUrl );
385 $this->mExtraDescription
= $text;
389 function getUploadUrl() {
391 $uploadTitle = SpecialPage
::getTitleFor( 'Upload' );
392 return $wgServer . $uploadTitle->getLocalUrl( 'wpDestFile=' . urlencode( $this->img
->getName() ) );
396 * Print out the various links at the bottom of the image page, e.g. reupload,
397 * external editing (and instructions link) etc.
399 function uploadLinksBox() {
400 global $wgUser, $wgOut;
402 if( $this->img
->fromSharedDirectory
)
405 $sk = $wgUser->getSkin();
407 $wgOut->addHtml( '<br /><ul>' );
409 # "Upload a new version of this file" link
410 if( $wgUser->isAllowed( 'reupload' ) ) {
411 $ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
412 $wgOut->addHtml( "<li><div class='plainlinks'>{$ulink}</div></li>" );
415 # External editing link
416 $elink = $sk->makeKnownLinkObj( $this->mTitle
, wfMsgHtml( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
417 $wgOut->addHtml( '<li>' . $elink . '<div>' . wfMsgWikiHtml( 'edit-externally-help' ) . '</div></li>' );
419 $wgOut->addHtml( '</ul>' );
422 function closeShowImage()
429 * If the page we've just displayed is in the "Image" namespace,
430 * we follow it with an upload history of the image and its usage.
432 function imageHistory()
434 global $wgUser, $wgOut, $wgUseExternalEditor;
436 $sk = $wgUser->getSkin();
438 $line = $this->img
->nextHistoryLine();
441 $list = new ImageHistoryList( $sk );
442 $s = $list->beginImageHistoryList() .
443 $list->imageHistoryLine( true, wfTimestamp(TS_MW
, $line->img_timestamp
),
444 $this->mTitle
->getDBkey(), $line->img_user
,
445 $line->img_user_text
, $line->img_size
, $line->img_description
,
446 $line->img_width
, $line->img_height
449 while ( $line = $this->img
->nextHistoryLine() ) {
450 $s .= $list->imageHistoryLine( false, $line->img_timestamp
,
451 $line->oi_archive_name
, $line->img_user
,
452 $line->img_user_text
, $line->img_size
, $line->img_description
,
453 $line->img_width
, $line->img_height
456 $s .= $list->endImageHistoryList();
458 $wgOut->addHTML( $s );
460 # Exist check because we don't want to show this on pages where an image
461 # doesn't exist along with the noimage message, that would suck. -ævar
462 if( $wgUseExternalEditor && $this->img
->exists() ) {
463 $this->uploadLinksBox();
468 function imageLinks()
470 global $wgUser, $wgOut;
472 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
474 $dbr = wfGetDB( DB_SLAVE
);
475 $page = $dbr->tableName( 'page' );
476 $imagelinks = $dbr->tableName( 'imagelinks' );
478 $sql = "SELECT page_namespace,page_title FROM $imagelinks,$page WHERE il_to=" .
479 $dbr->addQuotes( $this->mTitle
->getDBkey() ) . " AND il_from=page_id";
480 $sql = $dbr->limitResult($sql, 500, 0);
481 $res = $dbr->query( $sql, "ImagePage::imageLinks" );
483 if ( 0 == $dbr->numRows( $res ) ) {
484 $wgOut->addHtml( '<p>' . wfMsg( "nolinkstoimage" ) . "</p>\n" );
487 $wgOut->addHTML( '<p>' . wfMsg( 'linkstoimage' ) . "</p>\n<ul>" );
489 $sk = $wgUser->getSkin();
490 while ( $s = $dbr->fetchObject( $res ) ) {
491 $name = Title
::MakeTitle( $s->page_namespace
, $s->page_title
);
492 $link = $sk->makeKnownLinkObj( $name, "" );
493 $wgOut->addHTML( "<li>{$link}</li>\n" );
495 $wgOut->addHTML( "</ul>\n" );
500 global $wgUser, $wgOut, $wgRequest;
502 $confirm = $wgRequest->wasPosted();
503 $reason = $wgRequest->getVal( 'wpReason' );
504 $image = $wgRequest->getVal( 'image' );
505 $oldimage = $wgRequest->getVal( 'oldimage' );
507 # Only sysops can delete images. Previously ordinary users could delete
508 # old revisions, but this is no longer the case.
509 if ( !$wgUser->isAllowed('delete') ) {
510 $wgOut->permissionRequired( 'delete' );
513 if ( $wgUser->isBlocked() ) {
514 return $this->blockedIPpage();
516 if ( wfReadOnly() ) {
517 $wgOut->readOnlyPage();
521 # Better double-check that it hasn't been deleted yet!
522 $wgOut->setPagetitle( wfMsg( 'confirmdelete' ) );
523 if ( ( !is_null( $image ) )
524 && ( '' == trim( $image ) ) ) {
525 $wgOut->showFatalError( wfMsg( 'cannotdelete' ) );
529 $this->img
= new Image( $this->mTitle
);
531 # Deleting old images doesn't require confirmation
532 if ( !is_null( $oldimage ) ||
$confirm ) {
533 if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
534 $this->doDelete( $reason );
536 $wgOut->showFatalError( wfMsg( 'sessionfailure' ) );
541 if ( !is_null( $image ) ) {
542 $q = '&image=' . urlencode( $image );
543 } else if ( !is_null( $oldimage ) ) {
544 $q = '&oldimage=' . urlencode( $oldimage );
548 return $this->confirmDelete( $q, $wgRequest->getText( 'wpReason' ) );
553 * @param $reason User provided reason for deletion.
555 function doDelete( $reason ) {
556 global $wgOut, $wgRequest;
558 $oldimage = $wgRequest->getVal( 'oldimage' );
560 if ( !is_null( $oldimage ) ) {
561 if ( strlen( $oldimage ) < 16 ) {
562 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
565 if ( strstr( $oldimage, "/" ) ||
strstr( $oldimage, "\\" ) ) {
566 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
569 if ( !$this->doDeleteOldImage( $oldimage ) ) {
572 $deleted = $oldimage;
574 $ok = $this->img
->delete( $reason );
576 # If the deletion operation actually failed, bug out:
577 $wgOut->showFileDeleteError( $this->img
->getName() );
581 # Image itself is now gone, and database is cleaned.
582 # Now we remove the image description page.
584 $article = new Article( $this->mTitle
);
585 $article->doDeleteArticle( $reason ); # ignore errors
587 $deleted = $this->img
->getName();
590 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
591 $wgOut->setRobotpolicy( 'noindex,nofollow' );
593 $loglink = '[[Special:Log/delete|' . wfMsg( 'deletionlog' ) . ']]';
594 $text = wfMsg( 'deletedtext', $deleted, $loglink );
596 $wgOut->addWikiText( $text );
598 $wgOut->returnToMain( false, $this->mTitle
->getPrefixedText() );
604 function doDeleteOldImage( $oldimage )
608 $ok = $this->img
->deleteOld( $oldimage, '' );
610 # If we actually have a file and can't delete it, throw an error.
611 # Something went awry...
612 $wgOut->showFileDeleteError( "$oldimage" );
615 $log = new LogPage( 'delete' );
616 $log->addEntry( 'delete', $this->mTitle
, wfMsg('deletedrevision',$oldimage) );
622 global $wgOut, $wgRequest, $wgUser;
624 $oldimage = $wgRequest->getText( 'oldimage' );
625 if ( strlen( $oldimage ) < 16 ) {
626 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
629 if ( strstr( $oldimage, "/" ) ||
strstr( $oldimage, "\\" ) ) {
630 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
634 if ( wfReadOnly() ) {
635 $wgOut->readOnlyPage();
638 if( $wgUser->isAnon() ) {
639 $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' );
642 if ( ! $this->mTitle
->userCan( 'edit' ) ) {
643 $wgOut->readOnlyPage( $this->getContent(), true );
646 if ( $wgUser->isBlocked() ) {
647 return $this->blockedIPpage();
649 if( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
650 $wgOut->showErrorPage( 'internalerror', 'sessionfailure' );
653 $name = substr( $oldimage, 15 );
655 $dest = wfImageDir( $name );
656 $archive = wfImageArchiveDir( $name );
657 $curfile = "{$dest}/{$name}";
659 if ( !is_dir( $dest ) ) wfMkdirParents( $dest );
660 if ( !is_dir( $archive ) ) wfMkdirParents( $archive );
662 if ( ! is_file( $curfile ) ) {
663 $wgOut->showFileNotFoundError( htmlspecialchars( $curfile ) );
666 $oldver = wfTimestampNow() . "!{$name}";
668 if ( ! rename( $curfile, "${archive}/{$oldver}" ) ) {
669 $wgOut->showFileRenameError( $curfile, "${archive}/{$oldver}" );
672 if ( ! copy( "{$archive}/{$oldimage}", $curfile ) ) {
673 $wgOut->showFileCopyError( "${archive}/{$oldimage}", $curfile );
677 # Record upload and update metadata cache
678 $img = Image
::newFromName( $name );
679 $img->recordUpload( $oldver, wfMsg( "reverted" ) );
681 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
682 $wgOut->setRobotpolicy( 'noindex,nofollow' );
683 $wgOut->addHTML( wfMsg( 'imagereverted' ) );
685 $descTitle = $img->getTitle();
686 $wgOut->returnToMain( false, $descTitle->getPrefixedText() );
689 function blockedIPpage() {
690 $edit = new EditPage( $this );
691 return $edit->blockedIPpage();
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
->purgeCache();
705 wfDebug( "ImagePage::doPurge no image\n" );
716 class ImageHistoryList
{
717 function ImageHistoryList( &$skin ) {
718 $this->skin
=& $skin;
721 function beginImageHistoryList() {
723 Xml
::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'imghistory' ) ) .
724 "\n<p>" . wfMsg( 'imghistlegend' ) . "</p>\n".'<ul class="special">';
728 function endImageHistoryList() {
733 function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description, $width, $height ) {
734 global $wgUser, $wgLang, $wgTitle, $wgContLang;
736 $datetime = $wgLang->timeanddate( $timestamp, true );
737 $del = wfMsgHtml( 'deleteimg' );
738 $delall = wfMsgHtml( 'deleteimgcompletely' );
739 $cur = wfMsgHtml( 'cur' );
742 $url = Image
::imageUrl( $img );
744 if ( $wgUser->isAllowed('delete') ) {
745 $link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
747 $style = $this->skin
->getInternalLinkAttributes( $link, $delall );
749 $dlink = '<a href="'.$link.'"'.$style.'>'.$delall.'</a>';
754 $url = htmlspecialchars( wfImageArchiveUrl( $img ) );
755 if( $wgUser->getID() != 0 && $wgTitle->userCan( 'edit' ) ) {
756 $token = urlencode( $wgUser->editToken( $img ) );
757 $rlink = $this->skin
->makeKnownLinkObj( $wgTitle,
758 wfMsgHtml( 'revertimg' ), 'action=revert&oldimage=' .
759 urlencode( $img ) . "&wpEditToken=$token" );
760 $dlink = $this->skin
->makeKnownLinkObj( $wgTitle,
761 $del, 'action=delete&oldimage=' . urlencode( $img ) .
762 "&wpEditToken=$token" );
764 # Having live active links for non-logged in users
765 # means that bots and spiders crawling our site can
766 # inadvertently change content. Baaaad idea.
767 $rlink = wfMsgHtml( 'revertimg' );
772 $userlink = $this->skin
->userLink( $user, $usertext ) . $this->skin
->userToolLinks( $user, $usertext );
773 $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
774 $wgLang->formatNum( $size ) );
775 $widthheight = wfMsgHtml( 'widthheight', $width, $height );
776 $style = $this->skin
->getInternalLinkAttributes( $url, $datetime );
778 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$datetime}</a> . . {$userlink} . . {$widthheight} ({$nbytes})";
780 $s .= $this->skin
->commentBlock( $description, $wgTitle );