openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e8948f2f42c0f0a1014012ea7daf6f24bca646b9
parent 6d7b4d333a7543f3178ba90f8e88b861759f0fa5
Author: dankert <devnull@localhost>
Date:   Tue, 23 Mar 2010 00:19:07 +0100

Den Inhalt von Seiten nicht zwangsweise durch den PHP-Interpreter schicken.

Diffstat:
actionClasses/FileAction.class.php | 7+++++--
actionClasses/PageAction.class.php | 16+++++++++++++---
config/publish.ini.php | 12++++++++++++
3 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/actionClasses/FileAction.class.php b/actionClasses/FileAction.class.php @@ -151,8 +151,11 @@ class FileAction extends ObjectAction // Der Browser hat so die Moeglichkeit, einen Fortschrittsbalken zu zeigen header('Content-Length: '.filesize($this->file->tmpfile()) ); - - readfile( $this->file->tmpfile() ); + if ( ( config('publish','enable_php_in_file_content')=='auto' && $this->file->getRealExtensionextension()=='php') || + config('publish','enable_php_in_file_content')===true ) + require( $this->file->tmpfile() ); + else + readfile( $this->file->tmpfile() ); exit; } diff --git a/actionClasses/PageAction.class.php b/actionClasses/PageAction.class.php @@ -606,7 +606,12 @@ class PageAction extends ObjectAction $language = Session::getProjectLanguage(); header('Content-Language: '.$language->isoCode); - require( $this->page->tmpfile() ); + // Wenn + if ( ( config('publish','enable_php_in_page_content')=='auto' && $this->page->template->extension == 'php') || + config('publish','enable_php_in_page_content')===true ) + require( $this->page->tmpfile() ); + else + readfile( $this->page->tmpfile() ); } @@ -632,8 +637,13 @@ class PageAction extends ObjectAction header('Content-Language: '.$language->isoCode); - require( $this->page->tmpfile() ); - + // Wenn + if ( ( config('publish','enable_php_in_page_content')=='auto' && $this->page->template->extension == 'php') || + config('publish','enable_php_in_page_content')===true ) + require( $this->page->tmpfile() ); + else + readfile( $this->page->tmpfile() ); + // Inhalt ist ausgegeben... Skript beenden. exit; } diff --git a/config/publish.ini.php b/config/publish.ini.php @@ -45,6 +45,18 @@ style="id" ; 'absolute': Generates URLs like '/path/to/example.html'. url=relative ;url=absolute + +; Should PHP code in page source be interpreted +; 'false': page source is never interpreted as PHP +; 'auto' : interpreted, if page extension = '.php' +; 'true' : always interpret PHP in page source +enable_php_in_page_content=false + +; Should PHP code in file content be interpreted +; 'false': file content is never interpreted as PHP +; 'auto' : interpreted, if file extension = '.php' +; 'true' : always interpret PHP in file content +enable_php_in_file_content=false