Skip to content

Commit 80ff547

Browse files
authored
fix(comments): Links encodage (#1033) (#1044)
1 parent bf6de4b commit 80ff547

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

web/pages/admin.bans.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
$cdata['added'] = Config::time($commentres->fields['added']);
242242
$commentText = html_entity_decode($commentres->fields['commenttxt'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
243243
$commentText = encodePreservingBr($commentText);
244-
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="\$1" target="_blank">\$1</a>', $commentText);
244+
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1" target="_blank">$1</a>', $commentText);
245245
$cdata['commenttxt'] = $commentText;
246246

247247
if (!empty($commentres->fields['edittime'])) {
@@ -404,7 +404,7 @@
404404
$cdata['added'] = Config::time($commentres->fields['added']);
405405
$commentText = html_entity_decode($commentres->fields['commenttxt'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
406406
$commentText = encodePreservingBr($commentText);
407-
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="\$1" target="_blank">\$1</a>', $commentText);
407+
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1" target="_blank">$1</a>', $commentText);
408408
$cdata['commenttxt'] = $commentText;
409409

410410
if (!empty($commentres->fields['edittime'])) {
@@ -561,7 +561,7 @@
561561
$commentText = html_entity_decode($commentres->fields['commenttxt'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
562562
$commentText = encodePreservingBr($commentText);
563563
// Parse links and wrap them in a <a href=""></a> tag to be easily clickable
564-
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="\$1" target="_blank">\$1</a>', $commentText);
564+
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1" target="_blank">$1</a>', $commentText);
565565
$cdata['commenttxt'] = $commentText;
566566

567567
if (!empty($commentres->fields['edittime'])) {
@@ -704,7 +704,7 @@
704704
$commentText = html_entity_decode($commentres->fields['commenttxt'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
705705
$commentText = encodePreservingBr($commentText);
706706
// Parse links and wrap them in a <a href=""></a> tag to be easily clickable
707-
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="\$1" target="_blank">\$1</a>', $commentText);
707+
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1" target="_blank">$1</a>', $commentText);
708708
$cdata['commenttxt'] = $commentText;
709709

710710
if (!empty($commentres->fields['edittime'])) {

web/pages/page.banlist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ function setPostKey()
688688
$commentText = html_entity_decode($commentres->fields['commenttxt'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
689689
$commentText = encodePreservingBr($commentText);
690690
// Parse links and wrap them in a <a href=""></a> tag to be easily clickable
691-
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="\$1" target="_blank">\$1</a>', $commentText);
691+
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1" target="_blank">$1</a>', $commentText);
692692
$cdata['commenttxt'] = $commentText;
693693

694694
if (!empty($commentres->fields['edittime'])) {
@@ -808,7 +808,7 @@ function setPostKey()
808808
$commentText = html_entity_decode($cotherdata->fields['commenttxt'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
809809
$commentText = encodePreservingBr($commentText);
810810
// Parse links and wrap them in a <a href=""></a> tag to be easily clickable
811-
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="\$1" target="_blank">\$1</a>', $commentText);
811+
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1" target="_blank">$1</a>', $commentText);
812812
$coment['commenttxt'] = $commentText;
813813

814814
if ($cotherdata->fields['editname'] != "") {

web/pages/page.commslist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ function setPostKey()
647647
$commentText = html_entity_decode($commentres->fields['commenttxt'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
648648
$commentText = encodePreservingBr($commentText);
649649
// Parse links and wrap them in a <a href=""></a> tag to be easily clickable
650-
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="\$1" target="_blank">\$1</a>', $commentText);
650+
$commentText = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1" target="_blank">$1</a>', $commentText);
651651
$cdata['commenttxt'] = $commentText;
652652

653653
if (!empty($commentres->fields['edittime'])) {

0 commit comments

Comments
 (0)