fixes for action=render on image pages
authorRiver Tarnell <kateturner@users.mediawiki.org>
Sun, 3 Jul 2005 04:56:53 +0000 (04:56 +0000)
committerRiver Tarnell <kateturner@users.mediawiki.org>
Sun, 3 Jul 2005 04:56:53 +0000 (04:56 +0000)
includes/ImagePage.php
includes/OutputPage.php

index dd78e39..549b121 100644 (file)
@@ -19,6 +19,12 @@ class ImagePage extends Article {
 
        /* private */ var $img;  // Image object this page is shown for
 
+       function render() {
+               global $wgOut;
+               $wgOut->setArticleBodyOnly(true);
+               $wgOut->addWikitext($this->getContent(true));
+       }
+
        function view() {
                global $wgUseExternalEditor, $wgOut, $wgShowEXIF;
 
@@ -251,7 +257,7 @@ class ImagePage extends Article {
 
                if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
                        $ur = ini_set('allow_url_fopen', true);
-                       $text = @file($url);
+                       $text = @file_get_contents($url);
                        ini_set('allow_url_fopen', $ur);
                        if ($text)
                                $wgOut->addHTML($text);
index f58fde9..336539b 100644 (file)
@@ -69,6 +69,7 @@ class OutputPage {
 
        function setETag($tag) { $this->mETag = $tag; }
        function setArticleBodyOnly($only) { $this->mArticleBodyOnly = $only; }
+       function getArticleBodyOnly($only) { return $this->mArticleBodyOnly; }
 
        function addLink( $linkarr ) {
                # $linkarr should be an associative array of attributes. We'll escape on output.