From: Ilmari Karonen Date: Wed, 17 Jan 2007 05:01:54 +0000 (+0000) Subject: Quick fix to make diffonly work properly on category and image pages. Should probabl... X-Git-Tag: 1.31.0-rc.0~54350 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=81befad1cf8c4e396cd574373af89a96e804254f;p=lhc%2Fweb%2Fwiklou.git Quick fix to make diffonly work properly on category and image pages. Should probably do something cleaner, but this'll do until I can figure out what the cleanest colution is. --- diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 0086a2f968..462558b9a7 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -14,6 +14,14 @@ if( !defined( 'MEDIAWIKI' ) ) */ class CategoryPage extends Article { function view() { + global $wgRequest, $wgUser; + + $diff = $wgRequest->getVal( 'diff' ); + $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); + + if ( isset( $diff ) && $diffOnly ) + return Article::view(); + if(!wfRunHooks('CategoryPageView', array(&$this))) return; if ( NS_CATEGORY == $this->mTitle->getNamespace() ) { diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 4503c4aa57..226bf26a2b 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -29,59 +29,62 @@ class ImagePage extends Article { } function view() { - global $wgOut, $wgShowEXIF; + global $wgOut, $wgShowEXIF, $wgRequest, $wgUser; $this->img = new Image( $this->mTitle ); - if( $this->mTitle->getNamespace() == NS_IMAGE ) { - if ($wgShowEXIF && $this->img->exists()) { - $exif = $this->img->getExifData(); - $showmeta = count($exif) ? true : false; - } else { - $exif = false; - $showmeta = false; - } + $diff = $wgRequest->getVal( 'diff' ); + $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); - if ($this->img->exists()) - $wgOut->addHTML($this->showTOC($showmeta)); + if ( $this->mTitle->getNamespace() != NS_IMAGE || ( isset( $diff ) && $diffOnly ) ) + return Article::view(); - $this->openShowImage(); + if ($wgShowEXIF && $this->img->exists()) { + $exif = $this->img->getExifData(); + $showmeta = count($exif) ? true : false; + } else { + $exif = false; + $showmeta = false; + } - # No need to display noarticletext, we use our own message, output in openShowImage() - if( $this->getID() ) { - Article::view(); - } else { - # Just need to set the right headers - $wgOut->setArticleFlag( true ); - $wgOut->setRobotpolicy( 'index,follow' ); - $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); - $this->viewUpdates(); - } + if ($this->img->exists()) + $wgOut->addHTML($this->showTOC($showmeta)); - # Show shared description, if needed - if( $this->mExtraDescription ) { - $fol = wfMsg( 'shareddescriptionfollows' ); - if( $fol != '-' ) { - $wgOut->addWikiText( $fol ); - } - $wgOut->addHTML( '
' . $this->mExtraDescription . '
' ); - } + $this->openShowImage(); - $this->closeShowImage(); - $this->imageHistory(); - $this->imageLinks(); - if( $exif ) { - global $wgStylePath, $wgStyleVersion; - $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) ); - $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) ); - $wgOut->addHTML( "

" . wfMsgHtml( 'metadata' ) . "

\n" ); - $wgOut->addWikiText( $this->makeMetadataTable( $exif ) ); - $wgOut->addHTML( - "\n" . - "\n" ); - } - } else { + # No need to display noarticletext, we use our own message, output in openShowImage() + if ( $this->getID() ) { Article::view(); + } else { + # Just need to set the right headers + $wgOut->setArticleFlag( true ); + $wgOut->setRobotpolicy( 'index,follow' ); + $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); + $this->viewUpdates(); + } + + # Show shared description, if needed + if ( $this->mExtraDescription ) { + $fol = wfMsg( 'shareddescriptionfollows' ); + if( $fol != '-' ) { + $wgOut->addWikiText( $fol ); + } + $wgOut->addHTML( '
' . $this->mExtraDescription . '
' ); + } + + $this->closeShowImage(); + $this->imageHistory(); + $this->imageLinks(); + + if ( $exif ) { + global $wgStylePath, $wgStyleVersion; + $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) ); + $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) ); + $wgOut->addHTML( "

" . wfMsgHtml( 'metadata' ) . "

\n" ); + $wgOut->addWikiText( $this->makeMetadataTable( $exif ) ); + $wgOut->addHTML( + "\n" . + "\n" ); } }