From 8e2724711f4ab6b796fb26d99b10f2317311140a Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Sun, 3 Jul 2005 04:56:53 +0000 Subject: [PATCH] fixes for action=render on image pages --- includes/ImagePage.php | 8 +++++++- includes/OutputPage.php | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/ImagePage.php b/includes/ImagePage.php index dd78e39ec4..549b121970 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -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); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index f58fde9f06..336539bd92 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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. -- 2.20.1