" . wfMsgWikiHtml("sharedupload");
- if ($wgRepositoryBaseUrl && !$wgFetchCommonsDescriptions) {
+ $this->loadFile();
+ $descUrl = $this->img->getDescriptionUrl();
+ $descText = $this->img->getDescriptionText();
+ $s = "
" . wfMsgWikiHtml( 'sharedupload' );
+ if ( $descUrl ) {
$sk = $wgUser->getSkin();
- $title = Title::makeTitle( NS_SPECIAL, 'Upload' );
- $link = $sk->makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
- array( 'wpDestFile' => urlencode( $this->img->getName() )));
- $sharedtext .= " " . wfMsgWikiHtml('shareduploadwiki', $link);
+ $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadwiki-linktext' ) );
+ $msg = ( $descText ) ? 'shareduploadwiki-desc' : 'shareduploadwiki';
+ $msg = wfMsgExt( $msg, array( 'parseinline', 'replaceafter' ), $link );
+ if ( $msg != '-' ) {
+ # Show message only if not voided by local sysops
+ $s .= $msg;
+ }
}
- $sharedtext .= "
";
- $wgOut->addHTML($sharedtext);
+ $s .= "
";
+ $wgOut->addHTML( $s );
- if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
- require_once("HttpFunctions.php");
- $ur = ini_set('allow_url_fopen', true);
- $text = wfGetHTTP($url . '?action=render');
- ini_set('allow_url_fopen', $ur);
- if ($text)
- $this->mExtraDescription = $text;
+ if ( $descText ) {
+ $this->mExtraDescription = $descText;
}
}
- function getUploadUrl() {
- global $wgServer;
- $uploadTitle = Title::makeTitle( NS_SPECIAL, 'Upload' );
- return $wgServer . $uploadTitle->getLocalUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) );
+ /*
+ * Check for files with the same name on the foreign repos.
+ */
+ function checkSharedConflict() {
+ global $wgOut, $wgUser;
+
+ $repoGroup = RepoGroup::singleton();
+ if( !$repoGroup->hasForeignRepos() ) {
+ return;
+ }
+
+ $this->loadFile();
+ if( !$this->img->isLocal() ) {
+ return;
+ }
+
+ $this->dupFile = null;
+ $repoGroup->forEachForeignRepo( array( $this, 'checkSharedConflictCallback' ) );
+
+ if( !$this->dupFile )
+ return;
+ $dupfile = $this->dupFile;
+ $same = (
+ ($this->img->getSha1() == $dupfile->getSha1()) &&
+ ($this->img->getSize() == $dupfile->getSize())
+ );
+
+ $sk = $wgUser->getSkin();
+ $descUrl = $dupfile->getDescriptionUrl();
+ if( $same ) {
+ $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadduplicate-linktext' ) );
+ $wgOut->addHTML( '' . wfMsgWikiHtml( 'shareduploadduplicate', $link ) . '
' );
+ } else {
+ $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadconflict-linktext' ) );
+ $wgOut->addHTML( '' . wfMsgWikiHtml( 'shareduploadconflict', $link ) . '
' );
+ }
}
+ function checkSharedConflictCallback( $repo ) {
+ $this->loadFile();
+ $dupfile = $repo->newFile( $this->img->getTitle() );
+ if( $dupfile && $dupfile->exists() ) {
+ $this->dupFile = $dupfile;
+ return $dupfile->exists();
+ }
+ return false;
+ }
- function uploadLinksBox()
- {
+ function getUploadUrl() {
+ $this->loadFile();
+ $uploadTitle = SpecialPage::getTitleFor( 'Upload' );
+ return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) );
+ }
+
+ /**
+ * Print out the various links at the bottom of the image page, e.g. reupload,
+ * external editing (and instructions link) etc.
+ */
+ function uploadLinksBox() {
global $wgUser, $wgOut;
- if ($this->img->fromSharedDirectory)
+ $this->loadFile();
+ if( !$this->img->isLocal() )
return;
$sk = $wgUser->getSkin();
- $wgOut->addHTML( '' . wfMsg( "nolinkstoimage" ) . "
\n" );
+ $wgOut->addHTML( "' . wfMsg( 'linkstoimage' ) . "
\n" );
+ $wgOut->addHTML( "\n" );
+ $wgOut->addWikiMsg( 'linkstoimage' );
+ $wgOut->addHTML( "
\n" );
$sk = $wgUser->getSkin();
- while ( $s = $dbr->fetchObject( $res ) ) {
- $name = Title::MakeTitle( $s->page_namespace, $s->page_title );
- $link = $sk->makeKnownLinkObj( $name, "" );
- $wgOut->addHTML( "- {$link}
\n" );
+ $count = 0;
+ while ( $s = $res->fetchObject() ) {
+ $count++;
+ if ( $count <= $limit ) {
+ // We have not yet reached the extra one that tells us there is more to fetch
+ $name = Title::makeTitle( $s->page_namespace, $s->page_title );
+ $link = $sk->makeKnownLinkObj( $name, "" );
+ $wgOut->addHTML( "- {$link}
\n" );
+ }
}
- $wgOut->addHTML( "
\n" );
+ $wgOut->addHTML( "
\n" );
+ $res->free();
+
+ // Add a links to [[Special:Whatlinkshere]]
+ if ( $count > $limit )
+ $wgOut->addWikiMsg( 'morelinkstoimage', $this->mTitle->getPrefixedDBkey() );
}
-
- function delete()
+
+ function imageRedirects()
{
- global $wgUser, $wgOut, $wgRequest;
-
- $confirm = $wgRequest->wasPosted();
- $image = $wgRequest->getVal( 'image' );
- $oldimage = $wgRequest->getVal( 'oldimage' );
-
- # Only sysops can delete images. Previously ordinary users could delete
- # old revisions, but this is no longer the case.
- if ( !$wgUser->isAllowed('delete') ) {
- $wgOut->sysopRequired();
- return;
- }
- if ( $wgUser->isBlocked() ) {
- return $this->blockedIPpage();
- }
- if ( wfReadOnly() ) {
- $wgOut->readOnlyPage();
- return;
- }
-
- # Better double-check that it hasn't been deleted yet!
- $wgOut->setPagetitle( wfMsg( 'confirmdelete' ) );
- if ( ( !is_null( $image ) )
- && ( '' == trim( $image ) ) ) {
- $wgOut->fatalError( wfMsg( 'cannotdelete' ) );
- return;
- }
+ global $wgUser, $wgOut;
+
+ $redirects = $this->getTitle()->getRedirectsHere( NS_IMAGE );
+ if ( count( $redirects ) == 0 ) return;
- $this->img = new Image( $this->mTitle );
+ $wgOut->addHTML( "\n" );
+ $wgOut->addWikiMsg( 'redirectstofile' );
+ $wgOut->addHTML( "
\n" );
- # Deleting old images doesn't require confirmation
- if ( !is_null( $oldimage ) || $confirm ) {
- if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
- $this->doDelete();
- } else {
- $wgOut->fatalError( wfMsg( 'sessionfailure' ) );
- }
- return;
+ $sk = $wgUser->getSkin();
+ foreach ( $redirects as $title ) {
+ $link = $sk->makeKnownLinkObj( $title, "" );
+ $wgOut->addHTML( "- {$link}
\n" );
}
+ $wgOut->addHTML( "
\n" );
- if ( !is_null( $image ) ) {
- $q = '&image=' . urlencode( $image );
- } else if ( !is_null( $oldimage ) ) {
- $q = '&oldimage=' . urlencode( $oldimage );
- } else {
- $q = '';
- }
- return $this->confirmDelete( $q, $wgRequest->getText( 'wpReason' ) );
}
+
+ function imageDupes() {
+ global $wgOut, $wgUser;
- function doDelete() {
- global $wgOut, $wgUser, $wgRequest, $wgUseSquid, $wgInternalServer;
- global $wgPostCommitUpdateList;
-
- $fname = 'ImagePage::doDelete';
-
- $reason = $wgRequest->getVal( 'wpReason' );
- $oldimage = $wgRequest->getVal( 'oldimage' );
-
- $dbw =& wfGetDB( DB_MASTER );
-
- if ( !is_null( $oldimage ) ) {
- if ( strlen( $oldimage ) < 16 ) {
- $wgOut->unexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
- return;
- }
- if ( strstr( $oldimage, "/" ) || strstr( $oldimage, "\\" ) ) {
- $wgOut->unexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
- return;
- }
-
- # Invalidate description page cache
- $this->mTitle->invalidateCache();
-
- # Squid purging
- if ( $wgUseSquid ) {
- $urlArr = array(
- $wgInternalServer.wfImageArchiveUrl( $oldimage ),
- $this->mTitle->getInternalURL()
- );
- wfPurgeSquidServers($urlArr);
- }
- $this->doDeleteOldImage( $oldimage );
- $dbw->delete( 'oldimage', array( 'oi_archive_name' => $oldimage ) );
- $deleted = $oldimage;
- } else {
- $image = $this->mTitle->getDBkey();
- $dest = wfImageDir( $image );
- $archive = wfImageDir( $image );
-
- # Delete the image file if it exists; due to sync problems
- # or manual trimming sometimes the file will be missing.
- $targetFile = "{$dest}/{$image}";
- if( file_exists( $targetFile ) && ! @unlink( $targetFile ) ) {
- # If the deletion operation actually failed, bug out:
- $wgOut->fileDeleteError( $targetFile );
- return;
- }
- $dbw->delete( 'image', array( 'img_name' => $image ) );
- $res = $dbw->select( 'oldimage', array( 'oi_archive_name' ), array( 'oi_name' => $image ) );
-
- # Purge archive URLs from the squid
- $urlArr = Array();
- while ( $s = $dbw->fetchObject( $res ) ) {
- $this->doDeleteOldImage( $s->oi_archive_name );
- $urlArr[] = $wgInternalServer.wfImageArchiveUrl( $s->oi_archive_name );
- }
-
- # And also the HTML of all pages using this image
- $linksTo = $this->img->getLinksTo();
- if ( $wgUseSquid ) {
- $u = SquidUpdate::newFromTitles( $linksTo, $urlArr );
- array_push( $wgPostCommitUpdateList, $u );
- }
-
- $dbw->delete( 'oldimage', array( 'oi_name' => $image ) );
-
- # Image itself is now gone, and database is cleaned.
- # Now we remove the image description page.
-
- $article = new Article( $this->mTitle );
- $article->doDeleteArticle( $reason ); # ignore errors
-
- # Invalidate parser cache and client cache for pages using this image
- # This is left until relatively late to reduce lock time
- Title::touchArray( $linksTo );
+ $this->loadFile();
- /* Delete thumbnails and refresh image metadata cache */
- $this->img->purgeCache();
-
-
- $deleted = $image;
- }
+ $dupes = $this->getDuplicates();
+ if ( count( $dupes ) == 0 ) return;
- $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
- $wgOut->setRobotpolicy( 'noindex,nofollow' );
-
- $loglink = '[[Special:Log/delete|' . wfMsg( 'deletionlog' ) . ']]';
- $text = wfMsg( 'deletedtext', $deleted, $loglink );
-
- $wgOut->addWikiText( $text );
-
- $wgOut->returnToMain( false, $this->mTitle->getPrefixedText() );
- }
+ $wgOut->addHTML( "\n" );
+ $wgOut->addWikiMsg( 'duplicatesoffile' );
+ $wgOut->addHTML( "
\n" );
- function doDeleteOldImage( $oldimage )
- {
- global $wgOut;
-
- $name = substr( $oldimage, 15 );
- $archive = wfImageArchiveDir( $name );
-
- # Delete the image if it exists. Sometimes the file will be missing
- # due to manual intervention or weird sync problems; treat that
- # condition gracefully and continue to delete the database entry.
- # Also some records may end up with an empty oi_archive_name field
- # if the original file was missing when a new upload was made;
- # don't try to delete the directory then!
- #
- $targetFile = "{$archive}/{$oldimage}";
- if( $oldimage != '' && file_exists( $targetFile ) && !@unlink( $targetFile ) ) {
- # If we actually have a file and can't delete it, throw an error.
- $wgOut->fileDeleteError( "{$archive}/{$oldimage}" );
- } else {
- # Log the deletion
- $log = new LogPage( 'delete' );
- $log->addEntry( 'delete', $this->mTitle, wfMsg('deletedrevision',$oldimage) );
+ $sk = $wgUser->getSkin();
+ foreach ( $dupes as $file ) {
+ if ( $file->isLocal() )
+ $link = $sk->makeKnownLinkObj( $file->getTitle(), "" );
+ else
+ $link = $sk->makeExternalLink( $file->getDescriptionUrl(),
+ $file->getTitle()->getPrefixedText() );
+ $wgOut->addHTML( "- {$link}
\n" );
}
+ $wgOut->addHTML( "
\n" );
}
- function revert() {
- global $wgOut, $wgRequest, $wgUser;
-
- $oldimage = $wgRequest->getText( 'oldimage' );
- if ( strlen( $oldimage ) < 16 ) {
- $wgOut->unexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
- return;
- }
- if ( strstr( $oldimage, "/" ) || strstr( $oldimage, "\\" ) ) {
- $wgOut->unexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
- return;
- }
-
- if ( wfReadOnly() ) {
- $wgOut->readOnlyPage();
- return;
- }
- if( $wgUser->isAnon() ) {
- $wgOut->errorpage( 'uploadnologin', 'uploadnologintext' );
- return;
- }
- if ( ! $this->mTitle->userCanEdit() ) {
- $wgOut->sysopRequired();
- return;
- }
- if ( $wgUser->isBlocked() ) {
- return $this->blockedIPpage();
- }
- if( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ), $oldimage ) ) {
- $wgOut->errorpage( 'internalerror', 'sessionfailure' );
- return;
- }
- $name = substr( $oldimage, 15 );
-
- $dest = wfImageDir( $name );
- $archive = wfImageArchiveDir( $name );
- $curfile = "{$dest}/{$name}";
-
- if ( ! is_file( $curfile ) ) {
- $wgOut->fileNotFoundError( htmlspecialchars( $curfile ) );
+ /**
+ * Delete the file, or an earlier version of it
+ */
+ public function delete() {
+ $this->loadFile();
+ if( !$this->img->exists() || !$this->img->isLocal() || $this->img->getRedirected() ) {
+ // Standard article deletion
+ Article::delete();
return;
}
- $oldver = wfTimestampNow() . "!{$name}";
+ $deleter = new FileDeleteForm( $this->img );
+ $deleter->execute();
+ }
- $dbr =& wfGetDB( DB_SLAVE );
- $size = $dbr->selectField( 'oldimage', 'oi_size', array( 'oi_archive_name' => $oldimage ) );
+ /**
+ * Revert the file to an earlier version
+ */
+ public function revert() {
+ $this->loadFile();
+ $reverter = new FileRevertForm( $this->img );
+ $reverter->execute();
+ }
- if ( ! rename( $curfile, "${archive}/{$oldver}" ) ) {
- $wgOut->fileRenameError( $curfile, "${archive}/{$oldver}" );
- return;
- }
- if ( ! copy( "{$archive}/{$oldimage}", $curfile ) ) {
- $wgOut->fileCopyError( "${archive}/{$oldimage}", $curfile );
+ /**
+ * Override handling of action=purge
+ */
+ function doPurge() {
+ $this->loadFile();
+ if( $this->img->exists() ) {
+ wfDebug( "ImagePage::doPurge purging " . $this->img->getName() . "\n" );
+ $update = new HTMLCacheUpdate( $this->mTitle, 'imagelinks' );
+ $update->doUpdate();
+ $this->img->upgradeRow();
+ $this->img->purgeCache();
+ } else {
+ wfDebug( "ImagePage::doPurge no image\n" );
}
-
- # Record upload and update metadata cache
- $img = Image::newFromName( $name );
- $img->recordUpload( $oldver, wfMsg( "reverted" ) );
-
- $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
- $wgOut->setRobotpolicy( 'noindex,nofollow' );
- $wgOut->addHTML( wfMsg( 'imagereverted' ) );
-
- $descTitle = $img->getTitle();
- $wgOut->returnToMain( false, $descTitle->getPrefixedText() );
+ parent::doPurge();
}
- function blockedIPpage() {
- require_once( 'EditPage.php' );
- $edit = new EditPage( $this );
- return $edit->blockedIPpage();
+ /**
+ * Display an error with a wikitext description
+ */
+ function showError( $description ) {
+ global $wgOut;
+ $wgOut->setPageTitle( wfMsg( "internalerror" ) );
+ $wgOut->setRobotpolicy( "noindex,nofollow" );
+ $wgOut->setArticleRelated( false );
+ $wgOut->enableClientCache( false );
+ $wgOut->addWikiText( $description );
}
}
/**
- * @todo document
- * @package MediaWiki
+ * Builds the image revision log shown on image pages
+ *
+ * @ingroup Media
*/
class ImageHistoryList {
- function ImageHistoryList( &$skin ) {
- $this->skin =& $skin;
+
+ protected $imagePage, $img, $skin, $title, $repo;
+
+ public function __construct( $imagePage ) {
+ global $wgUser;
+ $this->skin = $wgUser->getSkin();
+ $this->current = $imagePage->getFile();
+ $this->img = $imagePage->getDisplayedFile();
+ $this->title = $imagePage->getTitle();
+ $this->imagePage = $imagePage;
}
- function beginImageHistoryList() {
- $s = "\n" . wfMsg( 'imghistory' ) . "
\n" .
- "" . wfMsg( 'imghistlegend' ) . "
\n".'';
- return $s;
+ function getImagePage() {
+ return $this->imagePage;
}
- function endImageHistoryList() {
- $s = "
\n";
- return $s;
+ function getSkin() {
+ return $this->skin;
}
- function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description, $width, $height ) {
- global $wgUser, $wgLang, $wgTitle, $wgContLang;
+ function getFile() {
+ return $this->img;
+ }
- $datetime = $wgLang->timeanddate( $timestamp, true );
- $del = wfMsg( 'deleteimg' );
- $delall = wfMsg( 'deleteimgcompletely' );
- $cur = wfMsg( 'cur' );
+ public function beginImageHistoryList() {
+ global $wgOut, $wgUser;
+ return Xml::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) )
+ . $wgOut->parse( wfMsgNoTrans( 'filehist-help' ) )
+ . Xml::openElement( 'table', array( 'class' => 'filehistory' ) ) . "\n"
+ . ' | '
+ . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ? ' | ' : '' )
+ . '' . wfMsgHtml( 'filehist-datetime' ) . ' | '
+ . '' . wfMsgHtml( 'filehist-dimensions' ) . ' | '
+ . '' . wfMsgHtml( 'filehist-user' ) . ' | '
+ . '' . wfMsgHtml( 'filehist-comment' ) . ' | '
+ . "
\n";
+ }
- if ( $iscur ) {
- $url = Image::imageUrl( $img );
- $rlink = $cur;
- if ( $wgUser->isAllowed('delete') ) {
- $link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
- '&action=delete' );
- $style = $this->skin->getInternalLinkAttributes( $link, $delall );
+ public function endImageHistoryList() {
+ return "\n";
+ }
- $dlink = ''.$delall.'';
+ public function imageHistoryLine( $iscur, $file ) {
+ global $wgUser, $wgLang, $wgContLang, $wgTitle;
+
+ $timestamp = wfTimestamp(TS_MW, $file->getTimestamp());
+ $img = $iscur ? $file->getName() : $file->getArchiveName();
+ $user = $file->getUser('id');
+ $usertext = $file->getUser('text');
+ $size = $file->getSize();
+ $description = $file->getDescription();
+ $dims = $file->getDimensionsString();
+ $sha1 = $file->getSha1();
+
+ $local = $this->current->isLocal();
+ $row = $css = $selected = '';
+
+ // Deletion link
+ if( $local && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ) {
+ $row .= '';
+ # Link to remove from history
+ if( $wgUser->isAllowed( 'delete' ) ) {
+ $q = array();
+ $q[] = 'action=delete';
+ if( !$iscur )
+ $q[] = 'oldimage=' . urlencode( $img );
+ $row .= $this->skin->makeKnownLinkObj(
+ $this->title,
+ wfMsgHtml( $iscur ? 'filehist-deleteall' : 'filehist-deleteone' ),
+ implode( '&', $q )
+ );
+ }
+ # Link to hide content
+ if( $wgUser->isAllowed( 'deleterevision' ) ) {
+ if( $wgUser->isAllowed('delete') ) {
+ $row .= ' ';
+ }
+ $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
+ // If file is top revision or locked from this user, don't link
+ if( $iscur || !$file->userCan(File::DELETED_RESTRICTED) ) {
+ $del = wfMsgHtml( 'rev-delundel' );
+ } else {
+ // If the file was hidden, link to sha-1
+ list($ts,$name) = explode('!',$img,2);
+ $del = $this->skin->makeKnownLinkObj( $revdel, wfMsg( 'rev-delundel' ),
+ 'target=' . urlencode( $wgTitle->getPrefixedText() ) .
+ '&oldimage=' . urlencode( $ts ) );
+ // Bolden oversighted content
+ if( $file->isDeleted(File::DELETED_RESTRICTED) )
+ $del = "$del";
+ }
+ $row .= "$del";
+ }
+ $row .= ' | ';
+ }
+
+ // Reversion link/current indicator
+ $row .= '';
+ if( $iscur ) {
+ $row .= wfMsgHtml( 'filehist-current' );
+ } elseif( $local && $wgUser->isLoggedIn() && $this->title->userCan( 'edit' ) ) {
+ if( $file->isDeleted(File::DELETED_FILE) ) {
+ $row .= wfMsgHtml('filehist-revert');
} else {
- $dlink = $del;
+ $q = array();
+ $q[] = 'action=revert';
+ $q[] = 'oldimage=' . urlencode( $img );
+ $q[] = 'wpEditToken=' . urlencode( $wgUser->editToken( $img ) );
+ $row .= $this->skin->makeKnownLinkObj( $this->title,
+ wfMsgHtml( 'filehist-revert' ),
+ implode( '&', $q ) );
}
+ }
+ $row .= ' | ';
+
+ // Date/time and image link
+ if( $file->getTimestamp() === $this->img->getTimestamp() ) {
+ $selected = "class='filehistory-selected'";
+ }
+ $row .= "";
+ if( !$file->userCan(File::DELETED_FILE) ) {
+ # Don't link to unviewable files
+ $row .= '' . $wgLang->timeAndDate( $timestamp, true ) . '';
+ } else if( $file->isDeleted(File::DELETED_FILE) ) {
+ $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
+ # Make a link to review the image
+ $url = $this->skin->makeKnownLinkObj( $revdel, $wgLang->timeAndDate( $timestamp, true ),
+ "target=".$wgTitle->getPrefixedText()."&file=$sha1.".$this->current->getExtension() );
+ $row .= ''.$url.'';
} else {
- $url = htmlspecialchars( wfImageArchiveUrl( $img ) );
- if( $wgUser->getID() != 0 && $wgTitle->userCanEdit() ) {
- $token = urlencode( $wgUser->editToken( $img ) );
- $rlink = $this->skin->makeKnownLinkObj( $wgTitle,
- wfMsg( 'revertimg' ), 'action=revert&oldimage=' .
- urlencode( $img ) . "&wpEditToken=$token" );
- $dlink = $this->skin->makeKnownLinkObj( $wgTitle,
- $del, 'action=delete&oldimage=' . urlencode( $img ) .
- "&wpEditToken=$token" );
+ $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
+ $row .= Xml::element( 'a', array( 'href' => $url ), $wgLang->timeAndDate( $timestamp, true ) );
+ }
+
+ $row .= " | ";
+
+ // Image dimensions
+ $row .= htmlspecialchars( $dims );
+
+ // File size
+ $row .= " (" . $this->skin->formatSize( $size ) . ')';
+
+ // Uploading user
+ $row .= ' | ';
+ if( $local ) {
+ // Hide deleted usernames
+ if( $file->isDeleted(File::DELETED_USER) ) {
+ $row .= '' . wfMsgHtml( 'rev-deleted-user' ) . '';
} else {
- # Having live active links for non-logged in users
- # means that bots and spiders crawling our site can
- # inadvertently change content. Baaaad idea.
- $rlink = wfMsg( 'revertimg' );
- $dlink = $del;
+ $row .= $this->skin->userLink( $user, $usertext ) . " " .
+ $this->skin->userToolLinks( $user, $usertext ) . "";
}
+ } else {
+ $row .= htmlspecialchars( $usertext );
}
- if ( 0 == $user ) {
- $userlink = $usertext;
+ $row .= ' | ';
+
+ // Don't show deleted descriptions
+ if ( $file->isDeleted(File::DELETED_COMMENT) ) {
+ $row .= '' . wfMsgHtml('rev-deleted-comment') . '';
} else {
- $userlink = $this->skin->makeLinkObj( Title::makeTitle( NS_USER, $usertext ), $usertext );
- $usertalk = $this->skin->makeLinkObj( Title::makeTitle( NS_USER_TALK, $usertext), $wgContLang->getNsText( NS_TALK ) );
- $userdata = $userlink . ' (' . $usertalk . ')';
+ $row .= $this->skin->commentBlock( $description, $this->title );
}
- $nbytes = wfMsg( 'nbytes', $size );
- $widthheight = wfMsg( 'widthheight', $width, $height );
- $style = $this->skin->getInternalLinkAttributes( $url, $datetime );
+ $row .= ' | ';
- $s = "- ({$dlink}) ({$rlink}) {$datetime} . . {$userdata} . . {$widthheight} ({$nbytes})";
+ wfRunHooks( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) );
+ $classAttr = $rowClass ? " class='$rowClass'" : "";
- $s .= $this->skin->commentBlock( $description, $wgTitle );
- $s .= "
\n";
- return $s;
+ return "{$row}
\n";
}
-
}
-
-
-?>