Skip to content

Commit

Permalink
Addressing #335
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwb authored Nov 6, 2022
1 parent 8cd7776 commit b1deacf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/classes/writecomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WriteComments extends Secrets
protected $login;
protected $cookies;
protected $crypto;
protected $avatar;
protected $avatars;
protected $templater;
protected $mail;

Expand Down Expand Up @@ -417,7 +417,7 @@ protected function setupCommentData ($editing = false)
$url_regex = '/((http|https|ftp):\/\/[a-z0-9-@:;%_\+.~#?&\/=]+)/i';

// Extract URLs from comment
$clean_code = preg_replace_callback ($url_regex, 'self::urlExtractor', $clean_code);
$clean_code = preg_replace_callback ($url_regex, [$this, 'urlExtractor'], $clean_code);

// Escape all HTML tags excluding allowed tags
$clean_code = $this->htmlSelectiveEscape ($clean_code);
Expand All @@ -429,8 +429,8 @@ protected function setupCommentData ($editing = false)
$clean_code = $this->tagCloser (array ('code'), $clean_code);

// Escape HTML inside of <code> tags and markdown code blocks
$clean_code = preg_replace_callback ('/(<code>)(.*?)(<\/code>)/is', 'self::codeEscaper', $clean_code);
$clean_code = preg_replace_callback ('/(```)(.*?)(```)/is', 'self::codeEscaper', $clean_code);
$clean_code = preg_replace_callback ('/(<code>)(.*?)(<\/code>)/is', [$this, 'codeEscaper'], $clean_code);
$clean_code = preg_replace_callback ('/(```)(.*?)(```)/is', [$this, 'codeEscaper'], $clean_code);

// Close remaining tags
$clean_code = $this->tagCloser ($this->closeTags, $clean_code);
Expand Down

0 comments on commit b1deacf

Please sign in to comment.