openrat-cms

# OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

commit b602970d84cce34c55087ed974da52849a023559
parent eb310155f028ae9817d29b0ca68f4861b9b7e115
Author: Jan Dankert <develop@jandankert.de>
Date:   Mon, 11 Nov 2019 23:47:17 +0100

New: Support for including files.

Diffstat:
modules/cms-core/model/Page.class.php | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/modules/cms-core/model/Page.class.php b/modules/cms-core/model/Page.class.php @@ -632,11 +632,24 @@ SQL $template = new Mustache(); $template->escape = null; // No HTML escaping, this is the job of this CMS ;) $template->partialLoader = function( $name ) { - if ( $name == $this->template->name ) - throw new RuntimeException('Template recursion is not possible.'); + + if ( substr($name,0,5) == 'file:') { + $fileid = intval( substr($name,5) ); + $file = new File( $fileid ); + return $file->loadValue(); + } + $project = new Project($this->projectid); $templateid = array_search($name,$project->getTemplates() ); + + if ( ! $templateid ) + return $this->publisher->isPublic()?'':"template '$name' not found"; + + if ( $templateid == $this->template->templateid ) + return $this->publisher->isPublic()?'':'Template recursion is not supported'; + + $templatemodel = new TemplateModel( $templateid, $this->modelid ); $templatemodel->load();