Fix retarded mistake in 57997, move break to within the if block or it defeats the...
[lhc/web/wiklou.git] / includes / ImagePage.php
index 6c87006..f95e536 100644 (file)
@@ -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( '<div class="fullImageLink" id="file">' .
-                                       $icon->toHtml( array( 'desc-link' => true ) ) .
+                                       $icon->toHtml( array( 'file-link' => true ) ) .
                                        "</div>\n" );
                                }
 
@@ -720,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( "<div class='error'>\n$1</div>\n", array( 'filedelete-maintenance' ) );
+                       return;
+               }
+
                $this->loadFile();
                if( !$this->img->exists() || !$this->img->isLocal() || $this->img->getRedirected() ) {
                        // Standard article deletion
@@ -789,7 +798,7 @@ class ImageHistoryList {
                $this->img = $imagePage->getDisplayedFile();
                $this->title = $imagePage->getTitle();
                $this->imagePage = $imagePage;
-               $this->showThumb = $wgShowArchiveThumbnails;
+               $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender();
        }
 
        public function getImagePage() {
@@ -812,7 +821,7 @@ class ImageHistoryList {
                        . $navLinks . "\n"
                        . Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n"
                        . '<tr><td></td>'
-                       . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ? '<td></td>' : '' )
+                       . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deletedhistory') ) ? '<td></td>' : '' )
                        . '<th>' . wfMsgHtml( 'filehist-datetime' ) . '</th>'
                        . ( $this->showThumb ? '<th>' . wfMsgHtml( 'filehist-thumb' ) . '</th>' : '' )
                        . '<th>' . wfMsgHtml( 'filehist-dimensions' ) . '</th>'
@@ -838,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 .= '<td>';
                        # Link to remove from history
                        if( $wgUser->isAllowed( 'delete' ) ) {
@@ -851,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 .= '<br/>';
                                }
-                               $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',
@@ -876,7 +885,7 @@ class ImageHistoryList {
                                        if( $file->isDeleted(File::DELETED_RESTRICTED) )
                                                $del = "<strong>$del</strong>";
                                }
-                               $row .= "<tt style='white-space: nowrap;'><small>$del</small></tt>";
+                               $row .= "<span class='mw-revdelundel-link'>$del</span>";
                        }
                        $row .= '</td>';
                }