diff options
author | Andrew Dolgov <[email protected]> | 2021-02-06 09:51:28 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-06 09:51:28 +0300 |
commit | 9fdeb58fd39fb24aafebd67ad88f58be12b8ce7d (patch) | |
tree | 0632cdb4e6b64b9153bec00e53a976404a8ed90d | |
parent | 8b39e6bca74fd8452a1c74936103c0b35afe7101 (diff) |
check a few more php8 warnings
-rw-r--r-- | classes/sanitizer.php | 4 | ||||
-rwxr-xr-x | plugins/af_redditimgur/init.php | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/classes/sanitizer.php b/classes/sanitizer.php index 9f3bfada0..64b2edd36 100644 --- a/classes/sanitizer.php +++ b/classes/sanitizer.php @@ -97,7 +97,7 @@ class Sanitizer { } if ($entry->hasAttribute('src') && - ($owner && get_pref("STRIP_IMAGES", $owner)) || $force_remove_images || $_SESSION["bw_limit"]) { + ($owner && get_pref("STRIP_IMAGES", $owner)) || $force_remove_images || ($_SESSION["bw_limit"] ?? false)) { $p = $doc->createElement('p'); @@ -147,7 +147,7 @@ class Sanitizer { 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace' ); - if ($_SESSION['hasSandbox']) $allowed_elements[] = 'iframe'; + if ($_SESSION['hasSandbox'] ?? false) $allowed_elements[] = 'iframe'; $disallowed_attributes = array('id', 'style', 'class', 'width', 'height', 'allow'); diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 610ff5389..60e00c74c 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -103,13 +103,15 @@ class Af_RedditImgur extends Plugin { if (isset($data["media_metadata"])) { foreach ($data["media_metadata"] as $media) { - $media_url = htmlspecialchars_decode($media["s"]["u"]); + if (!empty($media["s"]["u"])) { + $media_url = htmlspecialchars_decode($media["s"]["u"]); - Debug::log("found media_metadata (gallery): $media_url", Debug::$LOG_VERBOSE); + Debug::log("found media_metadata (gallery): $media_url", Debug::$LOG_VERBOSE); - if ($media_url) { - $this->handle_as_image($doc, $anchor, $media_url); - $found = 1; + if ($media_url) { + $this->handle_as_image($doc, $anchor, $media_url); + $found = 1; + } } } } |