1
0
Fork 0
forked from blallo/rss-bridge

[bridges] Fix conditional checks on getInput

isset($this->getInput('')) does not work
This commit is contained in:
logmanoriginal 2016-08-28 20:38:01 +02:00
parent 8ed3b02899
commit 4f7fbae861
32 changed files with 68 additions and 68 deletions

View file

@ -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.');
}

View file

@ -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.');

View file

@ -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.');

View file

@ -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');
}

View file

@ -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();

View file

@ -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';

View file

@ -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=...).');
}

View file

@ -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'));

View file

@ -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.');

View file

@ -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)

View file

@ -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.');

View file

@ -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');
}

View file

@ -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.');

View file

@ -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.');

View file

@ -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')

View file

@ -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');
}

View file

@ -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';

View file

@ -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.');

View file

@ -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) {

View file

@ -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.');

View file

@ -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.');

View file

@ -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.');

View file

@ -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.');

View file

@ -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');

View file

@ -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.');

View file

@ -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'));

View file

@ -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{

View file

@ -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);

View file

@ -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';

View file

@ -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.');

View file

@ -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.');

View file

@ -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');