Commit c92b926b authored by Tino Goratsch's avatar Tino Goratsch

added an alternate syntax for the load_module Smarty function

parent 3808f52a
......@@ -57,19 +57,9 @@ class LoadModule extends AbstractFunction
$pathArray = $this->convertPathToArray($params['module']);
$path = $pathArray[0] . '/' . $pathArray[1] . '/' . $pathArray[2] . '/' . $pathArray[3];
$arguments = [];
if (isset($params['args']) && is_array($params['args'])) {
$arguments = array_map(
function($item) {
return urlencode($item);
},
$params['args']
);
}
$response = '';
if ($this->acl->hasPermission($path) === true) {
$response = $this->esiInclude($path, $arguments);
$response = $this->esiInclude($path, $this->parseControllerActionArguments($params));
}
return $response;
......@@ -93,6 +83,34 @@ class LoadModule extends AbstractFunction
return $pathArray;
}
/**
* @param array $arguments
* @return array
*/
protected function parseControllerActionArguments(array $arguments)
{
if (isset($arguments['args']) && is_array($arguments['args'])) {
return $this->urlEncodeArguments($arguments['args']);
}
unset($arguments['module']);
return $this->urlEncodeArguments($arguments);
}
/**
* @param array $arguments
* @return array
*/
protected function urlEncodeArguments(array $arguments)
{
return array_map(
function ($item) {
return urlencode($item);
},
$arguments
);
}
/**
* @param string $path
* @param array $arguments
......@@ -110,8 +128,6 @@ class LoadModule extends AbstractFunction
$debug = ' onerror="continue"';
}
$esiTag = '<esi:include src="' . $this->router->route($path . $routeArguments, true) . '"' . $debug . ' />';
return $esiTag;
return '<esi:include src="' . $this->router->route($path . $routeArguments, true) . '"' . $debug . ' />';
}
}
......@@ -12,11 +12,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Reworked and improved the form handling a little bit
- Updated the CKEditor WYSIWYG-Editor to version 4.6
- Unified the `\ACP3\Core\Helper\Action::handleCreatePostAction()` and `\ACP3\Core\Helper\Action::handleEditPostAction()` methods into the new method `\ACP3\Core\Helper\Action::handleSaveAction()`
- added an alternate syntax for the load_module Smarty function
### Fixed
- Fixed the deleting of the category picture when deleting a category
- Fixed the deleting of the assigned menu item and SEO settings when deleting an article
- Fixed the `dropdown` CSS selector name when generating a bootstrap enabled menu
- Fixed the newsletter subscription via the newsletter widget
### Deprecations
- Deprecated `\ACP3\Core\Controller\Context\AdminContext`, use `\ACP3\Core\Controller\Context\FrontendContext` instead
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment