Skip to content

Commit

Permalink
[K6.1] E-mail addresses are displayed as plain text #9501
Browse files Browse the repository at this point in the history
  • Loading branch information
xillibit committed Apr 24, 2023
1 parent e093376 commit 8904538
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions src/libraries/kunena/src/BBCode/KunenaBBCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -1280,19 +1280,30 @@ public function DoEmail($bbcode, $action, $name, $default, $params, $content)
}

$email = \is_string($default) ? $default : $bbcode->UnHTMLEncode($content);
$result = filter_var($email, FILTER_VALIDATE_EMAIL);

if (!$result) return;

$text = \is_string($default) ? $bbcode->UnHTMLEncode($content) : $default;
$text = trim($text && $email != $text ? $text : '');
$mailto = $bbcode->IsValidEmail($email);
$textCloak = $bbcode->IsValidEmail($text);
$result = filter_var($email, FILTER_VALIDATE_EMAIL);

if (is_string($result)) {
$isLink = true;
} else {
$isLink = false;
$mailto = $result;
}

$layout = KunenaLayout::factory('BBCode/Email');

if ($layout->getPath()) {
return (string) $layout
->set('email', $email)
->set('isLink', $isLink)
->set('mailto', $mailto)
->set('text', $text)
->set('textCloak', $textCloak);
->set('text', $text);
}

if ($bbcode->canCloakEmail($params)) {
Expand Down
2 changes: 1 addition & 1 deletion src/site/template/aurelia/layouts/bbcode/email/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
echo HTMLHelper::_(
'email.cloak',
$this->escape($this->email),
$this->mailto,
$this->isLink,
$this->escape($this->text),
$this->escape($this->email),
$this->mailto
Expand Down

0 comments on commit 8904538

Please sign in to comment.