Skip to content
Snippets Groups Projects
Commit 859ee448 authored by Elmar Ludwig's avatar Elmar Ludwig Committed by Jan-Hendrik Willms
Browse files

fix handling of url and entity encoding for ExternModule, avoid usage of multibyte API, fixes #460

parent d86c3e6d
No related branches found
No related tags found
No related merge requests found
...@@ -472,7 +472,7 @@ class ExternElement { ...@@ -472,7 +472,7 @@ class ExternElement {
if ($this->config->getValue($args['main_module'], 'incdata')) { if ($this->config->getValue($args['main_module'], 'incdata')) {
$link = $sri_link; $link = $sri_link;
if ($args['link_args']) { if ($args['link_args']) {
if (mb_strrpos($link, '?')) { if (strpos($link, '?')) {
$link .= '&' . $args['link_args']; $link .= '&' . $args['link_args'];
} else { } else {
$link .= '?' . $args['link_args']; $link .= '?' . $args['link_args'];
...@@ -494,7 +494,7 @@ class ExternElement { ...@@ -494,7 +494,7 @@ class ExternElement {
} }
$link .= 'page_url=' . $sri_link; $link .= 'page_url=' . $sri_link;
} elseif ($extern_link) { } elseif ($extern_link) {
if (mb_strrpos($extern_link, '?')) { if (strpos($extern_link, '?')) {
$link = "$extern_link&module=$module_name"; $link = "$extern_link&module=$module_name";
} else { } else {
$link = "$extern_link?module=$module_name"; $link = "$extern_link?module=$module_name";
......
...@@ -460,9 +460,9 @@ class ExternModule { ...@@ -460,9 +460,9 @@ class ExternModule {
} }
$query_parts = []; $query_parts = [];
if (is_array($params)) { if (is_array($params)) {
$param_key = 'ext_' . mb_strtolower($this->name); $param_key = 'ext_' . strtolower($this->name);
foreach ($params as $name => $value) { foreach ($params as $name => $value) {
$query_parts[] = "{$param_key}[{$name}]=" . $value; $query_parts[] = "{$param_key}[{$name}]=" . urlencode($value);
} }
} }
...@@ -501,7 +501,6 @@ class ExternModule { ...@@ -501,7 +501,6 @@ class ExternModule {
} }
if (is_array($config_meta_data)) { if (is_array($config_meta_data)) {
$module = $config_meta_data['module_name']; $module = $config_meta_data['module_name'];
// var_dump($this->config);
} else { } else {
return ''; return '';
} }
...@@ -511,7 +510,7 @@ class ExternModule { ...@@ -511,7 +510,7 @@ class ExternModule {
if (is_array($query_parts) && count($query_parts)) { if (is_array($query_parts) && count($query_parts)) {
$url .= '&' . implode('&', $query_parts); $url .= '&' . implode('&', $query_parts);
} }
return $url; return self::ExtHtmlReady($url);
} }
function getLinkToSelf ($params = null, $with_module_params = false, $linked_element_name = null) { function getLinkToSelf ($params = null, $with_module_params = false, $linked_element_name = null) {
...@@ -519,28 +518,15 @@ class ExternModule { ...@@ -519,28 +518,15 @@ class ExternModule {
} }
function getModuleParams ($params = null) { function getModuleParams ($params = null) {
$param_key = 'ext_' . mb_strtolower($this->name); $param_key = 'ext_' . strtolower($this->name);
if (is_array($_REQUEST[$param_key])) { if (is_array($_REQUEST[$param_key])) {
$ret = []; $ret = [];
if (is_null($params)) { if (is_null($params)) {
if (is_array($_GET[$param_key])) { return $_REQUEST[$param_key];
foreach ($_GET[$param_key] as $key => $value) {
$ret[$key] = urldecode($value);
}
}
if (is_array($_POST[$param_key])) {
foreach ($_POST[$param_key] as $key => $value) {
$ret[$key] = $value;
}
}
return $ret;
} }
foreach ($params as $param) { foreach ($params as $param) {
if (isset($_GET[$param_key][$param])) { if (isset($_REQUEST[$param_key][$param])) {
$ret[$param] = urldecode($_GET[$param_key][$param]); $ret[$param] = $_REQUEST[$param_key][$param];
}
if (isset($_POST[$param_key][$param])) {
$ret[$param] = $_POST[$param_key][$param];
} }
} }
return $ret; return $ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment