Skip to content
Snippets Groups Projects
Commit 6c24e867 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 f2998d95
No related branches found
No related tags found
No related merge requests found
......@@ -472,7 +472,7 @@ class ExternElement {
if ($this->config->getValue($args['main_module'], 'incdata')) {
$link = $sri_link;
if ($args['link_args']) {
if (mb_strrpos($link, '?')) {
if (strpos($link, '?')) {
$link .= '&' . $args['link_args'];
} else {
$link .= '?' . $args['link_args'];
......@@ -494,7 +494,7 @@ class ExternElement {
}
$link .= 'page_url=' . $sri_link;
} elseif ($extern_link) {
if (mb_strrpos($extern_link, '?')) {
if (strpos($extern_link, '?')) {
$link = "$extern_link&module=$module_name";
} else {
$link = "$extern_link?module=$module_name";
......@@ -525,4 +525,4 @@ class ExternElement {
}
return ExternModule::ExtHtmlReady($link);
}
}
\ No newline at end of file
}
......@@ -460,9 +460,9 @@ class ExternModule {
}
$query_parts = [];
if (is_array($params)) {
$param_key = 'ext_' . mb_strtolower($this->name);
$param_key = 'ext_' . strtolower($this->name);
foreach ($params as $name => $value) {
$query_parts[] = "{$param_key}[{$name}]=" . $value;
$query_parts[] = "{$param_key}[{$name}]=" . urlencode($value);
}
}
......@@ -501,7 +501,6 @@ class ExternModule {
}
if (is_array($config_meta_data)) {
$module = $config_meta_data['module_name'];
// var_dump($this->config);
} else {
return '';
}
......@@ -511,7 +510,7 @@ class ExternModule {
if (is_array($query_parts) && count($query_parts)) {
$url .= '&' . implode('&', $query_parts);
}
return $url;
return self::ExtHtmlReady($url);
}
function getLinkToSelf ($params = null, $with_module_params = false, $linked_element_name = null) {
......@@ -519,28 +518,15 @@ class ExternModule {
}
function getModuleParams ($params = null) {
$param_key = 'ext_' . mb_strtolower($this->name);
$param_key = 'ext_' . strtolower($this->name);
if (is_array($_REQUEST[$param_key])) {
$ret = [];
if (is_null($params)) {
if (is_array($_GET[$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;
return $_REQUEST[$param_key];
}
foreach ($params as $param) {
if (isset($_GET[$param_key][$param])) {
$ret[$param] = urldecode($_GET[$param_key][$param]);
}
if (isset($_POST[$param_key][$param])) {
$ret[$param] = $_POST[$param_key][$param];
if (isset($_REQUEST[$param_key][$param])) {
$ret[$param] = $_REQUEST[$param_key][$param];
}
}
return $ret;
......@@ -585,4 +571,4 @@ class ExternModule {
}
return false;
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment