Browse Source

Fix ampersand encoding in message URLs

Resolves #235.
pull/257/head
Trevor Slocum 3 months ago
parent
commit
93c91aec20
  1. 7
      inc/functions.php
  2. 4
      inc/html.php

7
inc/functions.php

@ -26,6 +26,13 @@ function cleanString($string) { @@ -26,6 +26,13 @@ function cleanString($string) {
return str_replace($search, $replace, $string);
}
function cleanQuotes($string) {
$search = array("'", "\"");
$replace = array("'", """);
return str_replace($search, $replace, $string);
}
function plural($count, $singular, $plural) {
if ($plural == 's') {
$plural = $singular . $plural;

4
inc/html.php

@ -95,8 +95,8 @@ function _makeLinksClickable($matches) { @@ -95,8 +95,8 @@ function _makeLinksClickable($matches) {
if (!isset($matches[1])) {
return '';
}
$url = str_replace('&', '&', htmlspecialchars($matches[1], ENT_QUOTES));
$text = htmlentities($matches[1], ENT_QUOTES);
$url = cleanQuotes($matches[1]);
$text = $matches[1];
return '<a href="' . $url . '" target="_blank">' . $text . '</a>';
}

Loading…
Cancel
Save