From 4f7fbae861e2f7f4e879fcba7d7b1ccb51dd2a08 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 28 Aug 2016 20:38:01 +0200 Subject: [PATCH] [bridges] Fix conditional checks on getInput isset($this->getInput('')) does not work --- bridges/FlickrTagBridge.php | 4 ++-- bridges/FourchanBridge.php | 2 +- bridges/GelbooruBridge.php | 4 ++-- bridges/GiphyBridge.php | 4 ++-- bridges/GithubIssueBridge.php | 4 ++-- bridges/GitlabCommitsBridge.php | 2 +- bridges/GooglePlusPostBridge.php | 2 +- bridges/IsoHuntBridge.php | 10 +++++----- bridges/KonachanBridge.php | 4 ++-- bridges/KununuBridge.php | 2 +- bridges/LolibooruBridge.php | 4 ++-- bridges/MangareaderBridge.php | 6 +++--- bridges/MilbooruBridge.php | 4 ++-- bridges/MspabooruBridge.php | 4 ++-- bridges/NovelUpdatesBridge.php | 2 +- bridges/ParuVenduImmoBridge.php | 12 ++++++------ bridges/PickyWallpapersBridge.php | 2 +- bridges/PinterestBridge.php | 4 ++-- bridges/RTBFBridge.php | 2 +- bridges/Rule34Bridge.php | 4 ++-- bridges/Rule34pahealBridge.php | 4 ++-- bridges/SafebooruBridge.php | 4 ++-- bridges/SakugabooruBridge.php | 4 ++-- bridges/SensCritiqueBridge.php | 12 ++++++------ bridges/TbibBridge.php | 4 ++-- bridges/ThePirateBayBridge.php | 2 +- bridges/TwitchApiBridge.php | 2 +- bridges/VkBridge.php | 2 +- bridges/WallpaperStopBridge.php | 2 +- bridges/XbooruBridge.php | 4 ++-- bridges/YandereBridge.php | 4 ++-- bridges/YoutubeBridge.php | 10 +++++----- 32 files changed, 68 insertions(+), 68 deletions(-) diff --git a/bridges/FlickrTagBridge.php b/bridges/FlickrTagBridge.php index 869025ed..1a91c95c 100644 --- a/bridges/FlickrTagBridge.php +++ b/bridges/FlickrTagBridge.php @@ -18,11 +18,11 @@ class FlickrTagBridge extends BridgeAbstract{ public function collectData(){ $html = $this->getSimpleHTMLDOM('http://www.flickr.com/search/?q=vendee&s=rec') or $this->returnServerError('Could not request Flickr.'); - if (isset($this->getInput('q'))) { /* keyword search mode */ + if ($this->getInput('q')) { /* keyword search mode */ $this->request = $this->getInput('q'); $html = $this->getSimpleHTMLDOM('http://www.flickr.com/search/?q='.urlencode($this->request).'&s=rec') or $this->returnServerError('No results for this query.'); } - elseif (isset($this->getInput('u'))) { /* user timeline mode */ + elseif ($this->getInput('u')) { /* user timeline mode */ $this->request = $this->getInput('u'); $html = $this->getSimpleHTMLDOM('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnServerError('Requested username can\'t be found.'); } diff --git a/bridges/FourchanBridge.php b/bridges/FourchanBridge.php index ad92ac10..f1954d77 100644 --- a/bridges/FourchanBridge.php +++ b/bridges/FourchanBridge.php @@ -12,7 +12,7 @@ class FourchanBridge extends BridgeAbstract{ public function collectData(){ - if (!isset($this->getInput('t'))) + if (!$this->getInput('t')) $this->returnClientError('You must specify the thread URL (?t=...)'); $thread = parse_url($this->getInput('t')) or $this->returnClientError('This URL seems malformed, please check it.'); diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php index 67ec92b3..16f3f205 100644 --- a/bridges/GelbooruBridge.php +++ b/bridges/GelbooruBridge.php @@ -16,12 +16,12 @@ class GelbooruBridge extends BridgeAbstract{ public function collectData(){ $page = 0; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); $page = $page - 1; $page = $page * 63; } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://gelbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Gelbooru.'); diff --git a/bridges/GiphyBridge.php b/bridges/GiphyBridge.php index 6705a0d1..79665189 100644 --- a/bridges/GiphyBridge.php +++ b/bridges/GiphyBridge.php @@ -19,7 +19,7 @@ class GiphyBridge extends BridgeAbstract{ public function collectData(){ $html = ''; $base_url = 'http://giphy.com'; - if (isset($this->getInput('s'))) { /* keyword search mode */ + if ($this->getInput('s')) { /* keyword search mode */ $html = $this->getSimpleHTMLDOM($base_url.'/search/'.urlencode($this->getInput('s').'/')) or $this->returnServerError('No results for this query.'); } else { @@ -27,7 +27,7 @@ class GiphyBridge extends BridgeAbstract{ } $max = GIPHY_LIMIT; - if (isset($this->getInput('n'))) { + if ($this->getInput('n')) { $max = (integer) $this->getInput('n'); } diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index 8b520e9b..3708956f 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -29,11 +29,11 @@ class GithubIssueBridge extends BridgeAbstract{ ); public function collectData(){ - $uri = 'https://github.com/'.$this->getInput('u').'/'.$this->getInput('p').'/issues/'.(isset($this->getInput('i'))?$this->getInput('i'):''); + $uri = 'https://github.com/'.$this->getInput('u').'/'.$this->getInput('p').'/issues/'.($this->getInput('i')?$this->getInput('i'):''); $html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p')); - if(isset($this->getInput('i'))){ + if($this->getInput('i')){ foreach($html->find('.js-comment-container') as $comment){ $item = array(); diff --git a/bridges/GitlabCommitsBridge.php b/bridges/GitlabCommitsBridge.php index dd7af0c4..93328ed5 100644 --- a/bridges/GitlabCommitsBridge.php +++ b/bridges/GitlabCommitsBridge.php @@ -27,7 +27,7 @@ class GitlabCommitsBridge extends BridgeAbstract{ public function collectData(){ $uri = $this->getInput('uri').'/'.$this->getInput('u').'/'.$this->getInput('p').'/commits/'; - if(isset($this->getInput('b'))){ + if($this->getInput('b')){ $uri.=$this->getInput('b'); }else{ $uri.='master'; diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php index ad780edc..9d3ef28b 100644 --- a/bridges/GooglePlusPostBridge.php +++ b/bridges/GooglePlusPostBridge.php @@ -21,7 +21,7 @@ class GooglePlusPostBridge extends BridgeAbstract public function collectData() { $param=$this->parameters[$queriedContext]; - if (!isset($this->getInput('username'))) + if (!$this->getInput('username')) { $this->returnClientError('You must specify a username (?username=...).'); } diff --git a/bridges/IsoHuntBridge.php b/bridges/IsoHuntBridge.php index 8defbd86..b438940f 100644 --- a/bridges/IsoHuntBridge.php +++ b/bridges/IsoHuntBridge.php @@ -92,17 +92,17 @@ class IsoHuntBridge extends BridgeAbstract{ public function collectData(){ $request_path = '/'; // We'll request the main page by default - if(isset($this->getInput('latest_category'))){ // Requesting one of the latest categories + if($this->getInput('latest_category')){ // Requesting one of the latest categories $this->request_latest_category($this->getInput('latest_category')); - } elseif(isset($this->getInput('torrent_category'))){ // Requesting one of the torrent categories + } elseif($this->getInput('torrent_category')){ // Requesting one of the torrent categories $order_popularity = false; - if(isset($this->getInput('torrent_popularity'))) + if($this->getInput('torrent_popularity')) $order_popularity = $this->getInput('torrent_popularity'); $this->request_torrent_category($this->getInput('torrent_category'), $order_popularity); - } else if(isset($this->getInput('search_name'))){ // Requesting search - if(isset($this->getInput('search_category'))) + } else if($this->getInput('search_name')){ // Requesting search + if($this->getInput('search_category')) $this->request_search($this->getInput('search_name'), $this->getInput('search_category')); else $this->request_search($this->getInput('search_name')); diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php index dcdb9d90..ec941efb 100644 --- a/bridges/KonachanBridge.php +++ b/bridges/KonachanBridge.php @@ -16,10 +16,10 @@ class KonachanBridge extends BridgeAbstract{ public function collectData(){ $page = 1;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://konachan.com/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Konachan.'); diff --git a/bridges/KununuBridge.php b/bridges/KununuBridge.php index 9aa7d80d..29a6a199 100644 --- a/bridges/KununuBridge.php +++ b/bridges/KununuBridge.php @@ -52,7 +52,7 @@ class KununuBridge extends HttpCachingBridgeAbstract { $this->returnClientError('You must specify a company (&company=...)!'); $full = false; // By default we'll load only short article - if(isset($this->getInput('full'))) + if($this->getInput('full')) $full = strtolower(trim($this->getInput('full'))); // Get reviews section name (depends on site) diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php index 76288600..c324dcc2 100644 --- a/bridges/LolibooruBridge.php +++ b/bridges/LolibooruBridge.php @@ -16,10 +16,10 @@ class LolibooruBridge extends BridgeAbstract{ public function collectData(){ $page = 1; $tags = ''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Lolibooru.'); diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 7df542d7..a6bc8531 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -83,7 +83,7 @@ class MangareaderBridge extends BridgeAbstract{ $path = "latest"; $limit = MANGAREADER_LIMIT; - if(isset($this->getInput('category'))){ // Get popular updates + if($this->getInput('category')){ // Get popular updates $type = "popular"; $path = "popular"; if($this->getInput('category') !== "all"){ @@ -91,12 +91,12 @@ class MangareaderBridge extends BridgeAbstract{ } } - if(isset($this->getInput('path'))){ // Get manga updates + if($this->getInput('path')){ // Get manga updates $type = "path"; $path = $this->getInput('path'); } - if(isset($this->getInput('limit')) && $this->getInput('limit') !== ""){ // Get manga updates (optional parameter) + if($this->getInput('limit') && $this->getInput('limit') !== ""){ // Get manga updates (optional parameter) $limit = $this->getInput('limit'); } diff --git a/bridges/MilbooruBridge.php b/bridges/MilbooruBridge.php index 46a84a66..a4534d48 100644 --- a/bridges/MilbooruBridge.php +++ b/bridges/MilbooruBridge.php @@ -17,10 +17,10 @@ class MilbooruBridge extends BridgeAbstract{ public function collectData(){ $page = 0;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://sheslostcontrol.net/moe/shimmie/index.php?q=/post/list/$tags/$page") or $this->returnServerError('Could not request Milbooru.'); diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php index 5ade1855..21dc76fa 100644 --- a/bridges/MspabooruBridge.php +++ b/bridges/MspabooruBridge.php @@ -17,12 +17,12 @@ class MspabooruBridge extends BridgeAbstract{ public function collectData(){ $page = 0;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); $page = $page - 1; $page = $page * 50; } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://mspabooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Mspabooru.'); diff --git a/bridges/NovelUpdatesBridge.php b/bridges/NovelUpdatesBridge.php index de69087d..ad1f9bc8 100644 --- a/bridges/NovelUpdatesBridge.php +++ b/bridges/NovelUpdatesBridge.php @@ -13,7 +13,7 @@ class NovelUpdatesBridge extends BridgeAbstract{ )); public function collectData(){ - if (!isset($this->getInput('n'))) + if (!$this->getInput('n')) $this->returnClientError('You must specify the novel URL (/series/...)'); $thread = parse_url($this->getInput('n')) or $this->returnClientError('This URL seems malformed, please check it.'); if($thread['host'] !== 'www.novelupdates.com') diff --git a/bridges/ParuVenduImmoBridge.php b/bridges/ParuVenduImmoBridge.php index 5a1cb5cb..d3c38460 100644 --- a/bridges/ParuVenduImmoBridge.php +++ b/bridges/ParuVenduImmoBridge.php @@ -31,19 +31,19 @@ class ParuVenduImmoBridge extends BridgeAbstract $maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1'; $link = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison; - if (isset($this->getInput('minarea'))) { + if ($this->getInput('minarea')) { $link .= '&sur0='.urlencode($this->getInput('minarea')); } - if (isset($this->getInput('maxprice'))) { + if ($this->getInput('maxprice')) { $link .= '&px1='.urlencode($this->getInput('maxprice')); } - if (isset($this->getInput('pa'))) { + if ($this->getInput('pa')) { $link .= '&pa='.urlencode($this->getInput('pa')); } - if (isset($this->getInput('lo'))) { + if ($this->getInput('lo')) { $link .= '&lo='.urlencode($this->getInput('lo')); } @@ -81,12 +81,12 @@ class ParuVenduImmoBridge extends BridgeAbstract public function getName(){ $request=''; - if(isset($this->getInput('minarea')) && + if($this->getInput('minarea') && !empty($this->getInput('minarea')) ){ $request .= ' '.$this->getInput('minarea').' m2'; } - if(isset($this->getInput('lo')) && + if($this->getInput('lo') && !empty($this->getInput('lo'))){ $request .= ' In: '.$this->getInput('lo'); } diff --git a/bridges/PickyWallpapersBridge.php b/bridges/PickyWallpapersBridge.php index 79cedf5c..6fa77ca0 100644 --- a/bridges/PickyWallpapersBridge.php +++ b/bridges/PickyWallpapersBridge.php @@ -27,7 +27,7 @@ class PickyWallpapersBridge extends BridgeAbstract { public function collectData(){ $html = ''; - if (!isset($this->getInput('c'))) { + if (!$this->getInput('c')) { $this->returnClientError('You must specify at least a category (?c=...).'); } else { $baseUri = 'http://www.pickywallpapers.com'; diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php index 91ff2b25..1bd868ed 100644 --- a/bridges/PinterestBridge.php +++ b/bridges/PinterestBridge.php @@ -22,7 +22,7 @@ class PinterestBridge extends BridgeAbstract{ public function collectData(){ $html = ''; - if (isset($this->getInput('u')) || isset($this->getInput('b'))) { + if ($this->getInput('u') || $this->getInput('b')) { if (empty($this->getInput('u'))) { @@ -38,7 +38,7 @@ class PinterestBridge extends BridgeAbstract{ $this->board = $this->getInput('b'); $html = $this->getSimpleHTMLDOM($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnServerError('Username and/or board not found'); - } else if (isset($this->getInput('q'))) + } else if ($this->getInput('q')) { $this->query = $this->getInput('q'); $html = $this->getSimpleHTMLDOM($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnServerError('Could not request Pinterest.'); diff --git a/bridges/RTBFBridge.php b/bridges/RTBFBridge.php index 2f02d4a8..6097dcfc 100644 --- a/bridges/RTBFBridge.php +++ b/bridges/RTBFBridge.php @@ -18,7 +18,7 @@ class RTBFBridge extends BridgeAbstract { $limit = 10; $count = 0; - if (isset($this->getInput('c'))) { + if ($this->getInput('c')) { $html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$this->getInput('c')) or $this->returnServerError('Could not request RTBF.'); foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) { diff --git a/bridges/Rule34Bridge.php b/bridges/Rule34Bridge.php index 6f72c230..d18297b0 100644 --- a/bridges/Rule34Bridge.php +++ b/bridges/Rule34Bridge.php @@ -16,12 +16,12 @@ class Rule34Bridge extends BridgeAbstract{ public function collectData(){ $page = 0;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); $page = $page - 1; $page = $page * 50; } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://rule34.xxx/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Rule34.'); diff --git a/bridges/Rule34pahealBridge.php b/bridges/Rule34pahealBridge.php index 2f24c8ad..2a4a61db 100644 --- a/bridges/Rule34pahealBridge.php +++ b/bridges/Rule34pahealBridge.php @@ -17,10 +17,10 @@ class Rule34pahealBridge extends BridgeAbstract{ public function collectData(){ $page = 0;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnServerError('Could not request Rule34paheal.'); diff --git a/bridges/SafebooruBridge.php b/bridges/SafebooruBridge.php index 4fb147c0..495a8391 100644 --- a/bridges/SafebooruBridge.php +++ b/bridges/SafebooruBridge.php @@ -16,12 +16,12 @@ class SafebooruBridge extends BridgeAbstract{ public function collectData(){ $page = 0;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); $page = $page - 1; $page = $page * 40; } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://safebooru.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Safebooru.'); diff --git a/bridges/SakugabooruBridge.php b/bridges/SakugabooruBridge.php index 246b40af..ab74d6db 100644 --- a/bridges/SakugabooruBridge.php +++ b/bridges/SakugabooruBridge.php @@ -16,10 +16,10 @@ class SakugabooruBridge extends BridgeAbstract{ public function collectData(){ $page = 1;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://sakuga.yshi.org/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Sakugabooru.'); diff --git a/bridges/SensCritiqueBridge.php b/bridges/SensCritiqueBridge.php index f877dcfe..f3d1a2df 100644 --- a/bridges/SensCritiqueBridge.php +++ b/bridges/SensCritiqueBridge.php @@ -34,17 +34,17 @@ class SensCritiqueBridge extends BridgeAbstract { )); public function collectData(){ - if ((isset($this->getInput('m')) && $this->getInput('m'))) { + if (($this->getInput('m') && $this->getInput('m'))) { $this->collectMoviesData(); - } else if ((isset($this->getInput('s')) && $this->getInput('s'))) { + } else if (($this->getInput('s') && $this->getInput('s'))) { $this->collectSeriesData(); - } else if ((isset($this->getInput('g')) && $this->getInput('g'))) { + } else if (($this->getInput('g') && $this->getInput('g'))) { $this->collectGamesData(); - } else if ((isset($this->getInput('b')) && $this->getInput('b'))) { + } else if (($this->getInput('b') && $this->getInput('b'))) { $this->collectBooksData(); - } else if ((isset($this->getInput('bd')) && $this->getInput('bd'))) { + } else if (($this->getInput('bd') && $this->getInput('bd'))) { $this->collectBDsData(); - } else if ((isset($this->getInput('mu')) && $this->getInput('mu'))) { + } else if (($this->getInput('mu') && $this->getInput('mu'))) { $this->collectMusicsData(); } else { $this->returnClientError('You must choose a category'); diff --git a/bridges/TbibBridge.php b/bridges/TbibBridge.php index 4d796a3d..3c708464 100644 --- a/bridges/TbibBridge.php +++ b/bridges/TbibBridge.php @@ -16,12 +16,12 @@ class TbibBridge extends BridgeAbstract{ public function collectData(){ $page = 0;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); $page = $page - 1; $page = $page * 50; } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://tbib.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Tbib.'); diff --git a/bridges/ThePirateBayBridge.php b/bridges/ThePirateBayBridge.php index a0473416..d4e1cd66 100644 --- a/bridges/ThePirateBayBridge.php +++ b/bridges/ThePirateBayBridge.php @@ -49,7 +49,7 @@ class ThePirateBayBridge extends BridgeAbstract{ } - if (!isset($this->getInput('q'))) + if (!$this->getInput('q')) $this->returnClientError('You must specify keywords (?q=...)'); $keywordsList = explode(";",$this->getInput('q')); diff --git a/bridges/TwitchApiBridge.php b/bridges/TwitchApiBridge.php index 0f9e5906..ce31c35d 100644 --- a/bridges/TwitchApiBridge.php +++ b/bridges/TwitchApiBridge.php @@ -39,7 +39,7 @@ class TwitchApiBridge extends BridgeAbstract{ $context = stream_context_create($opts); - if(!isset($this->getInput('limit')) || + if(!$this->getInput('limit') || empty($this->getInput('limit'))){ $limit = TWITCH_LIMIT; }else{ diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index 67f13a33..0372f0a9 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -17,7 +17,7 @@ class VkBridge extends BridgeAbstract { public function collectData(){ $html = ''; - if (isset($this->getInput('u'))) { + if ($this->getInput('u')) { $text_html = $this->getSimpleHTMLDOM(urldecode($this->getInput('u'))) or $this->returnServerError('No results for this query.'); $text_html = iconv('windows-1251', 'utf-8', $text_html); diff --git a/bridges/WallpaperStopBridge.php b/bridges/WallpaperStopBridge.php index c789b8d1..e2c7e113 100644 --- a/bridges/WallpaperStopBridge.php +++ b/bridges/WallpaperStopBridge.php @@ -26,7 +26,7 @@ class WallpaperStopBridge extends BridgeAbstract { public function collectData(){ $html = ''; - if (!isset($this->getInput('c'))) { + if (!$this->getInput('c')) { $this->returnClientError('You must specify at least a category (?c=...).'); } else { $baseUri = 'http://www.wallpaperstop.com'; diff --git a/bridges/XbooruBridge.php b/bridges/XbooruBridge.php index 4e1e17ea..ba06cf60 100644 --- a/bridges/XbooruBridge.php +++ b/bridges/XbooruBridge.php @@ -16,12 +16,12 @@ class XbooruBridge extends BridgeAbstract{ public function collectData(){ $page = 0;$tags=''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); $page = $page - 1; $page = $page * 50; } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("http://xbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Xbooru.'); diff --git a/bridges/YandereBridge.php b/bridges/YandereBridge.php index 6a57fdf2..8bea06a2 100644 --- a/bridges/YandereBridge.php +++ b/bridges/YandereBridge.php @@ -16,10 +16,10 @@ class YandereBridge extends BridgeAbstract{ public function collectData(){ $page = 1; $tags = ''; - if (isset($this->getInput('p'))) { + if ($this->getInput('p')) { $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p')); } - if (isset($this->getInput('t'))) { + if ($this->getInput('t')) { $tags = urlencode($this->getInput('t')); } $html = $this->getSimpleHTMLDOM("https://yande.re/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Yandere.'); diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php index a0471a0b..53dd0c56 100644 --- a/bridges/YoutubeBridge.php +++ b/bridges/YoutubeBridge.php @@ -108,11 +108,11 @@ class YoutubeBridge extends BridgeAbstract { $url_feed = ''; $url_listing = ''; - if (isset($this->getInput('u'))) { /* User and Channel modes */ + if ($this->getInput('u')) { /* User and Channel modes */ $this->request = $this->getInput('u'); $url_feed = $this->uri.'feeds/videos.xml?user='.urlencode($this->request); $url_listing = $this->uri.'user/'.urlencode($this->request).'/videos'; - } else if (isset($this->getInput('c'))) { + } else if ($this->getInput('c')) { $this->request = $this->getInput('c'); $url_feed = $this->uri.'feeds/videos.xml?channel_id='.urlencode($this->request); $url_listing = $this->uri.'channel/'.urlencode($this->request).'/videos'; @@ -125,7 +125,7 @@ class YoutubeBridge extends BridgeAbstract { } else $this->returnServerError("Could not request YouTube. Tried:\n - $url_feed\n - $url_listing"); } - else if (isset($this->getInput('p'))) { /* playlist mode */ + else if ($this->getInput('p')) { /* playlist mode */ $this->request = $this->getInput('p'); $url_listing = $this->uri.'playlist?list='.urlencode($this->request); $html = $this->getSimpleHTMLDOM($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing"); @@ -133,8 +133,8 @@ class YoutubeBridge extends BridgeAbstract { $this->request = 'Playlist: '.str_replace(' - YouTube', '', $html->find('title', 0)->plaintext); } - else if (isset($this->getInput('s'))) { /* search mode */ - $this->request = $this->getInput('s'); $page = 1; if (isset($this->getInput('pa'))) $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('pa')); + else if ($this->getInput('s')) { /* search mode */ + $this->request = $this->getInput('s'); $page = 1; if ($this->getInput('pa')) $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('pa')); $url_listing = $this->uri.'results?search_query='.urlencode($this->request).'&page='.$page.'&filters=video&search_sort=video_date_uploaded'; $html = $this->getSimpleHTMLDOM($url_listing) or $this->returnServerError("Could not request YouTube. Tried:\n - $url_listing"); $this->ytBridgeParseHtmlListing($html, 'div.yt-lockup', 'h3');