fix: [Discussion] threads cannot link to other events, fixes #5506

pull/5515/head
iglocska 2020-01-14 16:18:09 +01:00
parent 59ff6d9f6e
commit 38c6f05d1b
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 3 additions and 2 deletions

View File

@ -67,11 +67,12 @@ App::uses('AppHelper', 'View/Helper');
if (!is_numeric($data) && ($trigger == 'event' || $trigger == 'thread')) {
$replacement = '%MALFORMED URL%';
} else {
$url = str_replace('$1', $data, $this->__replacement[$trigger]['url']);
if (filter_var(str_replace('$1', $data, $this->__replacement[$trigger]['url']), FILTER_VALIDATE_URL)) {
if (substr($data, 0, 7) === 'http://' || substr($data, 0, 8) === 'https://') {
if (substr($url, 0, 7) === 'http://' || substr($url, 0, 8) === 'https://') {
$replacement = $this->Html->link(
str_replace('$1', $data, $this->__replacement[$trigger]['text']),
str_replace('$1', $data, $this->__replacement[$trigger]['url'])
$url
);
} else {
$replacement = '%MALFORMED URL%';