From f648a38883b89c8486100e6561e0c829362cb2a2 Mon Sep 17 00:00:00 2001 From: Franz Teichmann Date: Mon, 1 Feb 2016 10:06:13 +0100 Subject: [PATCH 1/2] fixed php fatal error line 660/661 to correctly display ontowiki exception when no model is selected --- SiteHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SiteHelper.php b/SiteHelper.php index 83c2f25..5a2fe5c 100644 --- a/SiteHelper.php +++ b/SiteHelper.php @@ -657,8 +657,8 @@ public function loadModel() // TODO: what if no site model configured? if (!Erfurt_Uri::check($siteConfig['model'])) { $site = $this->_privateConfig->defaultSite; - $root = $this->getComponentHelper()->getComponentRoot(); - $configFilePath = sprintf('%s%s/%s/%s', $root, $this->_relativeTemplatePath, $site, SiteHelper::SITE_CONFIG_FILENAME); + $root = $this->getComponentRoot(); + $configFilePath = sprintf('%s%s%s/%s', $root, $this->_relativeTemplatePath, $site, SiteHelper::SITE_CONFIG_FILENAME); throw new OntoWiki_Exception( 'No model selected! Please, configure a site model by setting the option ' . '"model=..." in "' . $configFilePath . '" or specify parameter m in the URL.' From 135aea6169f728458492c81664e9f42c7e474e79 Mon Sep 17 00:00:00 2001 From: Franz Teichmann Date: Mon, 1 Feb 2016 10:06:13 +0100 Subject: [PATCH 2/2] fixed php fatal error line 660/661 to correctly display ontowiki exception when no model is selected and removed possible trailing slash from relativeTemplatePath --- SiteHelper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SiteHelper.php b/SiteHelper.php index 83c2f25..1f98b0a 100644 --- a/SiteHelper.php +++ b/SiteHelper.php @@ -81,7 +81,8 @@ class SiteHelper extends OntoWiki_Component_Helper public function init() { - $this->_relativeTemplatePath = $this->_owApp->extensionManager->getExtensionConfig('site')->templates; + //removing possible trailing slash with rtrim + $this->_relativeTemplatePath = rtrim($this->_owApp->extensionManager->getExtensionConfig('site')->templates, '/'); } public function onAnnounceWorker($event) @@ -657,7 +658,7 @@ public function loadModel() // TODO: what if no site model configured? if (!Erfurt_Uri::check($siteConfig['model'])) { $site = $this->_privateConfig->defaultSite; - $root = $this->getComponentHelper()->getComponentRoot(); + $root = $this->getComponentRoot(); $configFilePath = sprintf('%s%s/%s/%s', $root, $this->_relativeTemplatePath, $site, SiteHelper::SITE_CONFIG_FILENAME); throw new OntoWiki_Exception( 'No model selected! Please, configure a site model by setting the option '