From c8883d344029baeb83f4285144e734414f7ae737 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 5 Mar 2021 10:07:34 +0300 Subject: [PATCH] af_comics filters: don't try to load empty html --- plugins/af_comics/filters/af_comics_cad.php | 2 +- plugins/af_comics/filters/af_comics_comicclass.php | 2 +- plugins/af_comics/filters/af_comics_comicpress.php | 2 +- plugins/af_comics/filters/af_comics_darklegacy.php | 2 +- plugins/af_comics/filters/af_comics_dilbert.php | 2 +- plugins/af_comics/filters/af_comics_pa.php | 4 +++- plugins/af_comics/filters/af_comics_pvp.php | 2 +- plugins/af_comics/filters/af_comics_tfd.php | 4 +++- plugins/af_comics/filters/af_comics_twp.php | 4 +++- plugins/af_comics/filters/af_comics_whomp.php | 2 +- 10 files changed, 16 insertions(+), 10 deletions(-) diff --git a/plugins/af_comics/filters/af_comics_cad.php b/plugins/af_comics/filters/af_comics_cad.php index 0f5bb52fa..b2b65ee05 100644 --- a/plugins/af_comics/filters/af_comics_cad.php +++ b/plugins/af_comics/filters/af_comics_cad.php @@ -17,7 +17,7 @@ class Af_Comics_Cad extends Af_ComicFilter { if (!$res && UrlHelper::$fetch_last_error_content) $res = UrlHelper::$fetch_last_error_content; - if (@$doc->loadHTML($res)) { + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//div[@class="comicpage"]/a/img')->item(0); diff --git a/plugins/af_comics/filters/af_comics_comicclass.php b/plugins/af_comics/filters/af_comics_comicclass.php index ff32375d3..5e14ea930 100644 --- a/plugins/af_comics/filters/af_comics_comicclass.php +++ b/plugins/af_comics/filters/af_comics_comicclass.php @@ -17,7 +17,7 @@ class Af_Comics_ComicClass extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML($res)) { + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//div[@class="comic"]')->item(0); diff --git a/plugins/af_comics/filters/af_comics_comicpress.php b/plugins/af_comics/filters/af_comics_comicpress.php index 29b064612..741d59672 100755 --- a/plugins/af_comics/filters/af_comics_comicpress.php +++ b/plugins/af_comics/filters/af_comics_comicpress.php @@ -23,7 +23,7 @@ class Af_Comics_ComicPress extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML($res)) { + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//div[@id="comic"]')->item(0); diff --git a/plugins/af_comics/filters/af_comics_darklegacy.php b/plugins/af_comics/filters/af_comics_darklegacy.php index 359c56443..d1f6016cb 100644 --- a/plugins/af_comics/filters/af_comics_darklegacy.php +++ b/plugins/af_comics/filters/af_comics_darklegacy.php @@ -18,7 +18,7 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML($res)) { + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//div[@class="comic"]')->item(0); diff --git a/plugins/af_comics/filters/af_comics_dilbert.php b/plugins/af_comics/filters/af_comics_dilbert.php index 00aad78f2..49fa54cfa 100644 --- a/plugins/af_comics/filters/af_comics_dilbert.php +++ b/plugins/af_comics/filters/af_comics_dilbert.php @@ -19,7 +19,7 @@ class Af_Comics_Dilbert extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML($res)) { + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); // Get the image container diff --git a/plugins/af_comics/filters/af_comics_pa.php b/plugins/af_comics/filters/af_comics_pa.php index 380e84596..a5a81edcb 100644 --- a/plugins/af_comics/filters/af_comics_pa.php +++ b/plugins/af_comics/filters/af_comics_pa.php @@ -25,7 +25,9 @@ class Af_Comics_Pa extends Af_ComicFilter { if (strpos($article["link"], "penny-arcade.com") !== false && strpos($article["title"], "News Post:") !== false) { $doc = new DOMDocument(); - if ($doc->loadHTML(UrlHelper::fetch($article["link"]))) { + $res = UrlHelper::fetch($article["link"]); + + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); $entries = $xpath->query('(//div[@class="post"])'); diff --git a/plugins/af_comics/filters/af_comics_pvp.php b/plugins/af_comics/filters/af_comics_pvp.php index 105d3f490..a27fbca87 100644 --- a/plugins/af_comics/filters/af_comics_pvp.php +++ b/plugins/af_comics/filters/af_comics_pvp.php @@ -14,7 +14,7 @@ class Af_Comics_Pvp extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML($res)) { + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//section[@class="comic-art"]')->item(0); diff --git a/plugins/af_comics/filters/af_comics_tfd.php b/plugins/af_comics/filters/af_comics_tfd.php index e0216705c..19ca43a24 100644 --- a/plugins/af_comics/filters/af_comics_tfd.php +++ b/plugins/af_comics/filters/af_comics_tfd.php @@ -16,7 +16,9 @@ class Af_Comics_Tfd extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { + $res = UrlHelper::fetch($article["link"]); + + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0); diff --git a/plugins/af_comics/filters/af_comics_twp.php b/plugins/af_comics/filters/af_comics_twp.php index 38a8ca32b..6715be3c2 100644 --- a/plugins/af_comics/filters/af_comics_twp.php +++ b/plugins/af_comics/filters/af_comics_twp.php @@ -11,7 +11,9 @@ class Af_Comics_Twp extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { + $res = UrlHelper::fetch($article["link"]); + + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXpath($doc); $basenode = $xpath->query("//td/center/img")->item(0); diff --git a/plugins/af_comics/filters/af_comics_whomp.php b/plugins/af_comics/filters/af_comics_whomp.php index f218890d7..712388449 100644 --- a/plugins/af_comics/filters/af_comics_whomp.php +++ b/plugins/af_comics/filters/af_comics_whomp.php @@ -17,7 +17,7 @@ class Af_Comics_Whomp extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML($res)) { + if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//img[@id="cc-comic"]')->item(0);