X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FImagePage.php;h=f95e536a9af79283bde93e4bc39dd82b3adac83a;hb=48fe5241a539e1d5afcc75a40a9d23f53d092ed4;hp=60d7b3b63eae70ed3ced08733d0d4f6a8d14f272;hpb=88d789e93998868e412d1b40fe003c1e4b0c2492;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index 60d7b3b63e..f95e536a9a 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -84,6 +84,8 @@ class ImagePage extends Article {
if( $this->mTitle->getNamespace() != NS_FILE || ( isset( $diff ) && $diffOnly ) )
return Article::view();
+
+ $this->showRedirectedFromHeader();
if( $wgShowEXIF && $this->displayImg->exists() ) {
// FIXME: bad interface, see note on MediaHandler::formatMetadata().
@@ -441,7 +443,7 @@ class ImagePage extends Article {
$icon= $this->displayImg->iconThumb();
$wgOut->addHTML( '
' .
- $icon->toHtml( array( 'desc-link' => true ) ) .
+ $icon->toHtml( array( 'file-link' => true ) ) .
"
\n" );
}
@@ -451,9 +453,7 @@ class ImagePage extends Article {
if($showLink) {
$filename = wfEscapeWikiText( $this->displayImg->getName() );
- $medialink = $this->displayImg->isMissing() ?
- "'''$filename'''" :
- "[[Media:$filename|$filename]]";
+ $medialink = "[[Media:$filename|$filename]]";
if( !$this->displayImg->isSafeFile() ) {
$warning = wfMsgNoTrans( 'mediawarning' );
@@ -484,17 +484,17 @@ EOT
if ( $wgEnableUploads && $wgUser->isAllowed( 'upload' ) ) {
// Only show an upload link if the user can upload
$uploadTitle = SpecialPage::getTitleFor( 'Upload' );
- $nofile = wfMsgHtml(
+ $nofile = array(
'filepage-nofile-link',
$uploadTitle->getFullUrl( array( 'wpDestFile' => $this->img->getName() ) )
);
}
else
{
- $nofile = wfMsgHtml( 'filepage-nofile' );
+ $nofile = 'filepage-nofile';
}
$wgOut->setRobotPolicy( 'noindex,nofollow' );
- $wgOut->addHTML( '' . $nofile . '
' );
+ $wgOut->wrapWikiMsg( "\n" );
# "Upload a new version of this file" link
- if( UploadForm::userCanReUpload($wgUser,$this->img->name) ) {
+ if( UploadBase::userCanReUpload($wgUser,$this->img->name) ) {
$ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
$wgOut->addHTML( "{$ulink}
\n" );
}
@@ -722,6 +722,13 @@ EOT
* Delete the file, or an earlier version of it
*/
public function delete() {
+ global $wgUploadMaintenance;
+ if( $wgUploadMaintenance && $this->mTitle && $this->mTitle->getNamespace() == NS_FILE ) {
+ global $wgOut;
+ $wgOut->wrapWikiMsg( "\n$1
\n", array( 'filedelete-maintenance' ) );
+ return;
+ }
+
$this->loadFile();
if( !$this->img->exists() || !$this->img->isLocal() || $this->img->getRedirected() ) {
// Standard article deletion
@@ -782,15 +789,16 @@ EOT
*/
class ImageHistoryList {
- protected $imagePage, $img, $skin, $title, $repo;
+ protected $imagePage, $img, $skin, $title, $repo, $showThumb;
public function __construct( $imagePage ) {
- global $wgUser;
+ global $wgUser, $wgShowArchiveThumbnails;
$this->skin = $wgUser->getSkin();
$this->current = $imagePage->getFile();
$this->img = $imagePage->getDisplayedFile();
$this->title = $imagePage->getTitle();
$this->imagePage = $imagePage;
+ $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender();
}
public function getImagePage() {
@@ -811,11 +819,11 @@ class ImageHistoryList {
. "\n"
. $wgOut->parse( wfMsgNoTrans( 'filehist-help' ) )
. $navLinks . "\n"
- . Xml::openElement( 'table', array( 'class' => 'filehistory' ) ) . "\n"
+ . Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n"
. '
| '
- . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ? ' | ' : '' )
+ . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deletedhistory') ) ? ' | ' : '' )
. '' . wfMsgHtml( 'filehist-datetime' ) . ' | '
- . '' . wfMsgHtml( 'filehist-thumb' ) . ' | '
+ . ( $this->showThumb ? '' . wfMsgHtml( 'filehist-thumb' ) . ' | ' : '' )
. '' . wfMsgHtml( 'filehist-dimensions' ) . ' | '
. '' . wfMsgHtml( 'filehist-user' ) . ' | '
. '' . wfMsgHtml( 'filehist-comment' ) . ' | '
@@ -839,7 +847,7 @@ class ImageHistoryList {
$row = $css = $selected = '';
// Deletion link
- if( $local && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ) {
+ if( $local && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deletedhistory') ) ) {
$row .= '';
# Link to remove from history
if( $wgUser->isAllowed( 'delete' ) ) {
@@ -852,19 +860,19 @@ class ImageHistoryList {
array(), $q, array( 'known' )
);
}
- # Link to hide content
- if( $wgUser->isAllowed( 'deleterevision' ) ) {
+ # Link to hide content. Don't show useless link to people who cannot hide revisions.
+ if( $wgUser->isAllowed('deleterevision') || ($wgUser->isAllowed('deletedhistory') && $file->getVisibility()) ) {
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->link( $revdel, wfMsgHtml( 'rev-delundel' ),
+ $del = $this->skin->link(
+ SpecialPage::getTitleFor( 'Revisiondelete' ),
+ wfMsgHtml( 'rev-delundel' ),
array(),
array(
'type' => 'oldimage',
@@ -877,7 +885,7 @@ class ImageHistoryList {
if( $file->isDeleted(File::DELETED_RESTRICTED) )
$del = "$del";
}
- $row .= "$del";
+ $row .= "$del";
}
$row .= ' | ';
}
@@ -921,16 +929,13 @@ class ImageHistoryList {
$wgLang->timeAndDate( $timestamp, true ),
array(),
array(
- 'target' => $wgTitle->getPrefixedUrl(),
+ 'target' => $wgTitle->getPrefixedText(),
'file' => $img,
'token' => $wgUser->editToken( $img )
),
array( 'known', 'noclasses' )
);
$row .= ''.$url.'';
- } elseif( $file->isMissing() ) {
- # Don't link to missing files
- $row .= $wgLang->timeAndDate( $timestamp, true );
} else {
$url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
$row .= Xml::element( 'a', array( 'href' => $url ), $wgLang->timeAndDate( $timestamp, true ) );
@@ -938,7 +943,9 @@ class ImageHistoryList {
$row .= "";
// Thumbnail
- $row .= '' . $this->getThumbForLine( $file ) . ' | ';
+ if ( $this->showThumb ) {
+ $row .= '' . $this->getThumbForLine( $file ) . ' | ';
+ }
// Image dimensions + size
$row .= '';
@@ -978,9 +985,7 @@ class ImageHistoryList {
protected function getThumbForLine( $file ) {
global $wgLang;
- if( $file->isMissing() ) {
- return '' . wfMsgHtml( 'filehist-missing' ) . '';
- } elseif( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE ) && !$file->isDeleted( File::DELETED_FILE ) ) {
+ if( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE ) && !$file->isDeleted( File::DELETED_FILE ) ) {
$params = array(
'width' => '120',
'height' => '120',
|
---|