* Fix explicit s-maxage=0 on raw pages; should help with proxy issues in
[lhc/web/wiklou.git] / includes / ImagePage.php
index 31fe083..24b0e48 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 require_once( 'Image.php' );
 
@@ -20,10 +20,14 @@ class ImagePage extends Article {
        /* private */ var $img;  // Image object this page is shown for
        var $mExtraDescription = false;
 
+       /**
+        * Handler for action=render
+        * Include body text only; none of the image extras
+        */
        function render() {
                global $wgOut;
-               $wgOut->setArticleBodyOnly(true);
-               $wgOut->addWikitext($this->getContent(true));
+               $wgOut->setArticleBodyOnly( true );
+               $wgOut->addSecondaryWikitext( $this->getContent() );
        }
 
        function view() {
@@ -53,15 +57,16 @@ class ImagePage extends Article {
                                $wgOut->setArticleFlag( true );
                                $wgOut->setRobotpolicy( 'index,follow' );
                                $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
-                               $wgOut->addMetaTags();
                                $this->viewUpdates();
                        }
 
-                       if ($this->mExtraDescription) {
-                               $fol = wfMsg('shareddescriptionfollows');
-                               if ($fol != '-')
-                                       $wgOut->addWikiText(wfMsg('shareddescriptionfollows'));
-                               $wgOut->addHTML($this->mExtraDescription);
+                       # Show shared description, if needed
+                       if( $this->mExtraDescription ) {
+                               $fol = wfMsg( 'shareddescriptionfollows' );
+                               if( $fol != '-' ) {
+                                       $wgOut->addWikiText( $fol );
+                               }
+                               $wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . '</div>' );
                        }
 
                        $this->closeShowImage();
@@ -127,7 +132,7 @@ class ImagePage extends Article {
                $r .= '|}';
                return $r;
        }
-       
+
        /**
         * Get a list of EXIF metadata items which should be displayed when
         * the metadata table is collapsed.
@@ -148,16 +153,15 @@ class ImagePage extends Article {
 
        /**
         * Overloading Article's getContent method.
-        * Omit noarticletext if sharedupload
-        *
-        * @param $noredir If true, do not follow redirects
+        * 
+        * Omit noarticletext if sharedupload; text will be fetched from the
+        * shared upload server if possible.
         */
-       function getContent( $noredir )
-       {
-               if ( $this->img && $this->img->fromSharedDirectory && 0 == $this->getID() ) {
+       function getContent() {
+               if( $this->img && $this->img->fromSharedDirectory && 0 == $this->getID() ) {
                        return '';
                }
-               return Article::getContent( $noredir );
+               return Article::getContent();
        }
 
        function openShowImage() {
@@ -243,7 +247,7 @@ class ImagePage extends Article {
                                        $icon->toHtml() .
                                        '</a></div>' );
                                }
-                               
+
                                $showLink = true;
                        }
 
@@ -253,7 +257,7 @@ class ImagePage extends Article {
                                $info = wfMsg( 'fileinfo',
                                        ceil($this->img->getSize()/1024.0),
                                        $this->img->getMimeType() );
-       
+
                                if (!$this->img->isSafeFile()) {
                                        $warning = wfMsg( 'mediawarning' );
                                        $wgOut->addWikiText( <<<END
@@ -330,7 +334,7 @@ END
 
                $sk = $wgUser->getSkin();
                $wgOut->addHTML( '<br /><ul>' );
-               if( $wgUser->isAllowed( 'reupload' ) ) {        
+               if( $wgUser->isAllowed( 'reupload' ) ) {
                        $wgOut->addWikiText( "<li>\n<div>". wfMsg( 'uploadnewversion', $this->getUploadUrl() ) ."</div>\n</li>\n" );
                }
                $wgOut->addHTML( '<li>' );
@@ -471,7 +475,7 @@ END
        function doDelete()     {
                global $wgOut, $wgUser, $wgRequest, $wgUseSquid, $wgInternalServer;
                global $wgPostCommitUpdateList;
-               
+
                $fname = 'ImagePage::doDelete';
 
                $reason = $wgRequest->getVal( 'wpReason' );