From 7ef72fe0dc0f360e04e15a46d137a12a518450b9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 1 Mar 2021 10:20:21 +0300 Subject: move startup checks to Config, set a bunch of @deprecated annotations --- classes/sanitizer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'classes/sanitizer.php') diff --git a/classes/sanitizer.php b/classes/sanitizer.php index 52feb5e28..5bb5f2efc 100644 --- a/classes/sanitizer.php +++ b/classes/sanitizer.php @@ -49,6 +49,10 @@ class Sanitizer { return false; } + private static function is_prefix_https() { + return parse_url(Config::get(Config::SELF_URL_PATH), PHP_URL_SCHEME) == 'https'; + } + public static function sanitize($str, $force_remove_images = false, $owner = false, $site_url = false, $highlight_words = false, $article_id = false) { if (!$owner && isset($_SESSION["uid"])) @@ -125,7 +129,7 @@ class Sanitizer { if (!self::iframe_whitelisted($entry)) { $entry->setAttribute('sandbox', 'allow-scripts'); } else { - if (is_prefix_https()) { + if (self::is_prefix_https()) { $entry->setAttribute("src", str_replace("http://", "https://", $entry->getAttribute("src"))); -- cgit v1.2.3