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 = wfMsgExt( 'show-big-image-thumb',
229 array( 'parseinline' ), $width, $height );
231 # Image is small enough to show full size on image page
232 $msgbig = htmlspecialchars( $this->img
->getName() );
233 $msgsmall = wfMsgExt( 'file-nohires', array( 'parseinline' ) );
236 $params['width'] = $width;
237 $thumbnail = $this->img
->transform( $params );
239 $anchorclose = "<br />";
240 if( $this->img
->mustRender() ) {
245 '<br />' . Xml
::tags( 'a', $linkAttribs, $msgbig ) . ' ' . $msgsize;
248 if ( $this->img
->isMultipage() ) {
249 $wgOut->addHTML( '<table class="multipageimage"><tr><td>' );
254 'alt' => $this->img
->getTitle()->getPrefixedText()
258 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
259 $thumbnail->toHtml( $imgAttribs, $linkAttribs ) .
260 $anchorclose . '</div>' );
263 if ( $this->img
->isMultipage() ) {
264 $count = $this->img
->pageCount();
267 $label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
268 $link = $sk->makeKnownLinkObj( $this->mTitle
, $label, 'page='. ($page-1) );
269 $thumb1 = $sk->makeThumbLinkObj( $this->img
, $link, $label, 'none',
270 array( 'page' => $page - 1 ) );
275 if ( $page < $count ) {
276 $label = wfMsg( 'imgmultipagenext' );
277 $link = $sk->makeKnownLinkObj( $this->mTitle
, $label, 'page='. ($page+
1) );
278 $thumb2 = $sk->makeThumbLinkObj( $this->img
, $link, $label, 'none',
279 array( 'page' => $page +
1 ) );
285 $select = '<form name="pageselector" action="' .
286 htmlspecialchars( $wgScript ) .
287 '" method="get" onchange="document.pageselector.submit();">' .
288 Xml
::hidden( 'title', $this->getTitle()->getPrefixedDbKey() );
289 $select .= $wgOut->parse( wfMsg( 'imgmultigotopre' ), false ) .
290 ' <select id="pageselector" name="page">';
291 for ( $i=1; $i <= $count; $i++
) {
292 $select .= Xml
::option( $wgLang->formatNum( $i ), $i,
295 $select .= '</select>' . $wgOut->parse( wfMsg( 'imgmultigotopost' ), false ) .
296 '<input type="submit" value="' .
297 htmlspecialchars( wfMsg( 'imgmultigo' ) ) . '"></form>';
299 $wgOut->addHTML( '</td><td><div class="multipageimagenavbox">' .
300 "$select<hr />$thumb1\n$thumb2<br clear=\"all\" /></div></td></tr></table>" );
303 #if direct link is allowed but it's not a renderable image, show an icon.
304 if ($this->img
->isSafeFile()) {
305 $icon= $this->img
->iconThumb();
307 $wgOut->addHTML( '<div class="fullImageLink" id="file"><a href="' . $full_url . '">' .
317 // Workaround for incorrect MIME type on SVGs uploaded in previous versions
318 if ($mime == 'image/svg') $mime = 'image/svg+xml';
320 $filename = wfEscapeWikiText( $this->img
->getName() );
321 $info = wfMsg( 'file-info', $sk->formatSize( $this->img
->getSize() ), $mime );
324 // Check for MIME type. Other types may have more information in the future.
325 if (substr($mime,0,9) == 'image/svg' ) {
326 $infores = wfMsg('file-svg', $width_orig, $height_orig ) . '<br />';
330 $dirmark = $wgContLang->getDirMark();
331 if (!$this->img
->isSafeFile()) {
332 $warning = wfMsg( 'mediawarning' );
333 $wgOut->addWikiText( <<<END
334 <div class="fullMedia">$infores
335 <span class="dangerousLink">[[Media:$filename|$filename]]</span>$dirmark
336 <span class="fileInfo"> $info</span>
339 <div class="mediaWarning">$warning</div>
343 $wgOut->addWikiText( <<<END
344 <div class="fullMedia">$infores
345 [[Media:$filename|$filename]]$dirmark <span class="fileInfo"> $info</span>
352 if($this->img
->fromSharedDirectory
) {
353 $this->printSharedImageText();
356 # Image does not exist
358 $title = SpecialPage
::getTitleFor( 'Upload' );
359 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
360 'wpDestFile=' . urlencode( $this->img
->getName() ) );
361 $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
365 function printSharedImageText() {
366 global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut, $wgUser;
368 $url = $wgRepositoryBaseUrl . urlencode($this->mTitle
->getDBkey());
369 $sharedtext = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml("sharedupload");
370 if ($wgRepositoryBaseUrl && !$wgFetchCommonsDescriptions) {
372 $sk = $wgUser->getSkin();
373 $title = SpecialPage
::getTitleFor( 'Upload' );
374 $link = $sk->makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
375 array( 'wpDestFile' => urlencode( $this->img
->getName() )));
376 $sharedtext .= " " . wfMsgWikiHtml('shareduploadwiki', $link);
378 $sharedtext .= "</div>";
379 $wgOut->addHTML($sharedtext);
381 if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
382 $renderUrl = wfAppendQuery( $url, 'action=render' );
383 wfDebug( "Fetching shared description from $renderUrl\n" );
384 $text = Http
::get( $renderUrl );
386 $this->mExtraDescription
= $text;
390 function getUploadUrl() {
392 $uploadTitle = SpecialPage
::getTitleFor( 'Upload' );
393 return $wgServer . $uploadTitle->getLocalUrl( 'wpDestFile=' . urlencode( $this->img
->getName() ) );
397 * Print out the various links at the bottom of the image page, e.g. reupload,
398 * external editing (and instructions link) etc.
400 function uploadLinksBox() {
401 global $wgUser, $wgOut;
403 if( $this->img
->fromSharedDirectory
)
406 $sk = $wgUser->getSkin();
408 $wgOut->addHtml( '<br /><ul>' );
410 # "Upload a new version of this file" link
411 if( $wgUser->isAllowed( 'reupload' ) ) {
412 $ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
413 $wgOut->addHtml( "<li><div class='plainlinks'>{$ulink}</div></li>" );
416 # External editing link
417 $elink = $sk->makeKnownLinkObj( $this->mTitle
, wfMsgHtml( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
418 $wgOut->addHtml( '<li>' . $elink . '<div>' . wfMsgWikiHtml( 'edit-externally-help' ) . '</div></li>' );
420 $wgOut->addHtml( '</ul>' );
423 function closeShowImage()
430 * If the page we've just displayed is in the "Image" namespace,
431 * we follow it with an upload history of the image and its usage.
433 function imageHistory()
435 global $wgUser, $wgOut, $wgUseExternalEditor;
437 $sk = $wgUser->getSkin();
439 $line = $this->img
->nextHistoryLine();
442 $list = new ImageHistoryList( $sk );
443 $s = $list->beginImageHistoryList() .
444 $list->imageHistoryLine( true, wfTimestamp(TS_MW
, $line->img_timestamp
),
445 $this->mTitle
->getDBkey(), $line->img_user
,
446 $line->img_user_text
, $line->img_size
, $line->img_description
,
447 $line->img_width
, $line->img_height
450 while ( $line = $this->img
->nextHistoryLine() ) {
451 $s .= $list->imageHistoryLine( false, $line->img_timestamp
,
452 $line->oi_archive_name
, $line->img_user
,
453 $line->img_user_text
, $line->img_size
, $line->img_description
,
454 $line->img_width
, $line->img_height
457 $s .= $list->endImageHistoryList();
459 $wgOut->addHTML( $s );
461 # Exist check because we don't want to show this on pages where an image
462 # doesn't exist along with the noimage message, that would suck. -ævar
463 if( $wgUseExternalEditor && $this->img
->exists() ) {
464 $this->uploadLinksBox();
469 function imageLinks()
471 global $wgUser, $wgOut;
473 $wgOut->addHTML( Xml
::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
475 $dbr = wfGetDB( DB_SLAVE
);
476 $page = $dbr->tableName( 'page' );
477 $imagelinks = $dbr->tableName( 'imagelinks' );
479 $sql = "SELECT page_namespace,page_title FROM $imagelinks,$page WHERE il_to=" .
480 $dbr->addQuotes( $this->mTitle
->getDBkey() ) . " AND il_from=page_id";
481 $sql = $dbr->limitResult($sql, 500, 0);
482 $res = $dbr->query( $sql, "ImagePage::imageLinks" );
484 if ( 0 == $dbr->numRows( $res ) ) {
485 $wgOut->addHtml( '<p>' . wfMsg( "nolinkstoimage" ) . "</p>\n" );
488 $wgOut->addHTML( '<p>' . wfMsg( 'linkstoimage' ) . "</p>\n<ul>" );
490 $sk = $wgUser->getSkin();
491 while ( $s = $dbr->fetchObject( $res ) ) {
492 $name = Title
::MakeTitle( $s->page_namespace
, $s->page_title
);
493 $link = $sk->makeKnownLinkObj( $name, "" );
494 $wgOut->addHTML( "<li>{$link}</li>\n" );
496 $wgOut->addHTML( "</ul>\n" );
501 global $wgUser, $wgOut, $wgRequest;
503 $confirm = $wgRequest->wasPosted();
504 $reason = $wgRequest->getVal( 'wpReason' );
505 $image = $wgRequest->getVal( 'image' );
506 $oldimage = $wgRequest->getVal( 'oldimage' );
508 # Only sysops can delete images. Previously ordinary users could delete
509 # old revisions, but this is no longer the case.
510 if ( !$wgUser->isAllowed('delete') ) {
511 $wgOut->permissionRequired( 'delete' );
514 if ( $wgUser->isBlocked() ) {
515 $wgOut->blockedPage();
518 if ( wfReadOnly() ) {
519 $wgOut->readOnlyPage();
523 # Better double-check that it hasn't been deleted yet!
524 $wgOut->setPagetitle( wfMsg( 'confirmdelete' ) );
525 if ( ( !is_null( $image ) )
526 && ( '' == trim( $image ) ) ) {
527 $wgOut->showFatalError( wfMsg( 'cannotdelete' ) );
531 $this->img
= new Image( $this->mTitle
);
533 # Deleting old images doesn't require confirmation
534 if ( !is_null( $oldimage ) ||
$confirm ) {
535 if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
536 $this->doDelete( $reason );
538 $wgOut->showFatalError( wfMsg( 'sessionfailure' ) );
543 if ( !is_null( $image ) ) {
544 $q = '&image=' . urlencode( $image );
545 } else if ( !is_null( $oldimage ) ) {
546 $q = '&oldimage=' . urlencode( $oldimage );
550 return $this->confirmDelete( $q, $wgRequest->getText( 'wpReason' ) );
555 * @param $reason User provided reason for deletion.
557 function doDelete( $reason ) {
558 global $wgOut, $wgRequest;
560 $oldimage = $wgRequest->getVal( 'oldimage' );
562 if ( !is_null( $oldimage ) ) {
563 if ( strlen( $oldimage ) < 16 ) {
564 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
567 if ( strstr( $oldimage, "/" ) ||
strstr( $oldimage, "\\" ) ) {
568 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
571 if ( !$this->doDeleteOldImage( $oldimage ) ) {
574 $deleted = $oldimage;
576 $ok = $this->img
->delete( $reason );
578 # If the deletion operation actually failed, bug out:
579 $wgOut->showFileDeleteError( $this->img
->getName() );
583 # Image itself is now gone, and database is cleaned.
584 # Now we remove the image description page.
586 $article = new Article( $this->mTitle
);
587 $article->doDeleteArticle( $reason ); # ignore errors
589 $deleted = $this->img
->getName();
592 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
593 $wgOut->setRobotpolicy( 'noindex,nofollow' );
595 $loglink = '[[Special:Log/delete|' . wfMsg( 'deletionlog' ) . ']]';
596 $text = wfMsg( 'deletedtext', $deleted, $loglink );
598 $wgOut->addWikiText( $text );
600 $wgOut->returnToMain( false, $this->mTitle
->getPrefixedText() );
606 function doDeleteOldImage( $oldimage )
610 $ok = $this->img
->deleteOld( $oldimage, '' );
612 # If we actually have a file and can't delete it, throw an error.
613 # Something went awry...
614 $wgOut->showFileDeleteError( "$oldimage" );
617 $log = new LogPage( 'delete' );
618 $log->addEntry( 'delete', $this->mTitle
, wfMsg('deletedrevision',$oldimage) );
624 global $wgOut, $wgRequest, $wgUser;
626 $oldimage = $wgRequest->getText( 'oldimage' );
627 if ( strlen( $oldimage ) < 16 ) {
628 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
631 if ( strstr( $oldimage, "/" ) ||
strstr( $oldimage, "\\" ) ) {
632 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
636 if ( wfReadOnly() ) {
637 $wgOut->readOnlyPage();
640 if( $wgUser->isAnon() ) {
641 $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' );
644 if ( ! $this->mTitle
->userCan( 'edit' ) ) {
645 $wgOut->readOnlyPage( $this->getContent(), true );
648 if ( $wgUser->isBlocked() ) {
649 $wgOut->blockedPage();
652 if( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
653 $wgOut->showErrorPage( 'internalerror', 'sessionfailure' );
656 $name = substr( $oldimage, 15 );
658 $dest = wfImageDir( $name );
659 $archive = wfImageArchiveDir( $name );
660 $curfile = "{$dest}/{$name}";
662 if ( !is_dir( $dest ) ) wfMkdirParents( $dest );
663 if ( !is_dir( $archive ) ) wfMkdirParents( $archive );
665 if ( ! is_file( $curfile ) ) {
666 $wgOut->showFileNotFoundError( htmlspecialchars( $curfile ) );
669 $oldver = wfTimestampNow() . "!{$name}";
671 if ( ! rename( $curfile, "${archive}/{$oldver}" ) ) {
672 $wgOut->showFileRenameError( $curfile, "${archive}/{$oldver}" );
675 if ( ! copy( "{$archive}/{$oldimage}", $curfile ) ) {
676 $wgOut->showFileCopyError( "${archive}/{$oldimage}", $curfile );
680 # Record upload and update metadata cache
681 $img = Image
::newFromName( $name );
682 $img->recordUpload( $oldver, wfMsg( "reverted" ) );
684 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
685 $wgOut->setRobotpolicy( 'noindex,nofollow' );
686 $wgOut->addHTML( wfMsg( 'imagereverted' ) );
688 $descTitle = $img->getTitle();
689 $wgOut->returnToMain( false, $descTitle->getPrefixedText() );
693 * Override handling of action=purge
696 $this->img
= new Image( $this->mTitle
);
697 if( $this->img
->exists() ) {
698 wfDebug( "ImagePage::doPurge purging " . $this->img
->getName() . "\n" );
699 $update = new HTMLCacheUpdate( $this->mTitle
, 'imagelinks' );
701 $this->img
->upgradeRow();
702 $this->img
->purgeCache();
704 wfDebug( "ImagePage::doPurge no image\n" );
715 class ImageHistoryList
{
716 function ImageHistoryList( &$skin ) {
717 $this->skin
=& $skin;
720 function beginImageHistoryList() {
722 Xml
::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'imghistory' ) ) .
723 "\n<p>" . wfMsg( 'imghistlegend' ) . "</p>\n".'<ul class="special">';
727 function endImageHistoryList() {
732 function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description, $width, $height ) {
733 global $wgUser, $wgLang, $wgTitle, $wgContLang;
735 $datetime = $wgLang->timeanddate( $timestamp, true );
736 $del = wfMsgHtml( 'deleteimg' );
737 $delall = wfMsgHtml( 'deleteimgcompletely' );
738 $cur = wfMsgHtml( 'cur' );
741 $url = Image
::imageUrl( $img );
743 if ( $wgUser->isAllowed('delete') ) {
744 $link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
746 $style = $this->skin
->getInternalLinkAttributes( $link, $delall );
748 $dlink = '<a href="'.$link.'"'.$style.'>'.$delall.'</a>';
753 $url = htmlspecialchars( wfImageArchiveUrl( $img ) );
754 if( $wgUser->getID() != 0 && $wgTitle->userCan( 'edit' ) ) {
755 $token = urlencode( $wgUser->editToken( $img ) );
756 $rlink = $this->skin
->makeKnownLinkObj( $wgTitle,
757 wfMsgHtml( 'revertimg' ), 'action=revert&oldimage=' .
758 urlencode( $img ) . "&wpEditToken=$token" );
759 $dlink = $this->skin
->makeKnownLinkObj( $wgTitle,
760 $del, 'action=delete&oldimage=' . urlencode( $img ) .
761 "&wpEditToken=$token" );
763 # Having live active links for non-logged in users
764 # means that bots and spiders crawling our site can
765 # inadvertently change content. Baaaad idea.
766 $rlink = wfMsgHtml( 'revertimg' );
771 $userlink = $this->skin
->userLink( $user, $usertext ) . $this->skin
->userToolLinks( $user, $usertext );
772 $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
773 $wgLang->formatNum( $size ) );
774 $widthheight = wfMsgHtml( 'widthheight', $width, $height );
775 $style = $this->skin
->getInternalLinkAttributes( $url, $datetime );
777 $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$datetime}</a> . . {$userlink} . . {$widthheight} ({$nbytes})";
779 $s .= $this->skin
->commentBlock( $description, $wgTitle );