From 5c2f0aec63d0305afda0917a31d4cca56ac90605 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 22 Jan 2019 00:58:22 +0200 Subject: [PATCH] Resolved gh-364 to allow greater depth and ensure that all custom code placeholders are always update/replaced at any depth layer. Tweaked the editURL method to also handle access control permissions. --- README.md | 4 ++-- admin/README.txt | 4 ++-- admin/helpers/compiler/a_Get.php | 14 ++++---------- admin/helpers/componentbuilder.php | 7 ++++++- .../language/en-GB/en-GB.com_componentbuilder.ini | 2 +- componentbuilder.xml | 2 +- site/helpers/componentbuilder.php | 7 ++++++- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 4c75aa759..3bc334c57 100644 --- a/README.md +++ b/README.md @@ -144,11 +144,11 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 14th January, 2019 ++ *Last Build*: 21st January, 2019 + *Version*: 2.9.8 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **195803** ++ *Line count*: **195813** + *Field count*: **1087** + *File count*: **1275** + *Folder count*: **201** diff --git a/admin/README.txt b/admin/README.txt index 4c75aa759..3bc334c57 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -144,11 +144,11 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 14th January, 2019 ++ *Last Build*: 21st January, 2019 + *Version*: 2.9.8 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **195803** ++ *Line count*: **195813** + *Field count*: **1087** + *File count*: **1275** + *Folder count*: **201** diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 723ec17da..ed157c52c 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -4915,7 +4915,7 @@ class Get // when the custom code is loaded if ($loaded === true) { - $string = $this->insertCustomCode($string, $debug); + $string = $this->insertCustomCode($bucket, $string, $debug); } // if debug if ($debug) @@ -4936,19 +4936,13 @@ class Get * @return string on success * */ - protected function insertCustomCode($string, $debug = 0) + protected function insertCustomCode($ids, $string, $debug = 0) { $code = array(); - // if debug - if ($debug) - { - echo '$this->customCode:'; - var_dump($this->customCode); - } // load the code - foreach ($this->customCode as $item) + foreach ($ids as $id) { - $this->buildCustomCodePlaceholders($item, $code, $debug); + $this->buildCustomCodePlaceholders($this->customCodeMemory[$id], $code, $debug); } // if debug if ($debug) diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index d01400bcc..5d740ada3 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -3895,8 +3895,13 @@ abstract class ComponentbuilderHelper * @return string On success the edit url * */ - public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true) + public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true) { + // make sure the user has access to view + if (!JFactory::getUser()->authorise($view. '.access', $component)) + { + return false; + } // build record $record = new stdClass(); // check that we have the ID diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 748a74c0e..d49e7bcce 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -3703,7 +3703,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION=" - + diff --git a/componentbuilder.xml b/componentbuilder.xml index 98a3d4904..483d4235a 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 14th January, 2019 + 21st January, 2019 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 12b80039a..8e32c9a03 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -3895,8 +3895,13 @@ abstract class ComponentbuilderHelper * @return string On success the edit url * */ - public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true) + public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true) { + // make sure the user has access to view + if (!JFactory::getUser()->authorise($view. '.access', $component)) + { + return false; + } // build record $record = new stdClass(); // check that we have the ID