diff --git a/formats/AtomFormat.php b/formats/AtomFormat.php index 7ec7d504..56c36963 100644 --- a/formats/AtomFormat.php +++ b/formats/AtomFormat.php @@ -2,8 +2,6 @@ /** * Atom * Documentation Source http://en.wikipedia.org/wiki/Atom_%28standard%29 and http://tools.ietf.org/html/rfc4287 -* -* @name Atom */ class AtomFormat extends FormatAbstract{ diff --git a/formats/HtmlFormat.php b/formats/HtmlFormat.php index 211a1371..c0f88557 100644 --- a/formats/HtmlFormat.php +++ b/formats/HtmlFormat.php @@ -1,10 +1,4 @@ items and return it to browser. -* -* @name Json */ class JsonFormat extends FormatAbstract{ diff --git a/formats/MrssFormat.php b/formats/MrssFormat.php index 7d939f36..d7cb682e 100644 --- a/formats/MrssFormat.php +++ b/formats/MrssFormat.php @@ -2,8 +2,6 @@ /** * Mrss * Documentation Source http://www.rssboard.org/media-rss -* -* @name Media RSS */ class MrssFormat extends FormatAbstract{ diff --git a/formats/PlaintextFormat.php b/formats/PlaintextFormat.php index 32b4e020..7916bc61 100644 --- a/formats/PlaintextFormat.php +++ b/formats/PlaintextFormat.php @@ -2,8 +2,6 @@ /** * Plaintext * Returns $this->items as raw php data. -* -* @name Plaintext */ class PlaintextFormat extends FormatAbstract{ diff --git a/index.php b/index.php index cfc98ea2..25f5b549 100644 --- a/index.php +++ b/index.php @@ -91,15 +91,25 @@ try{ Format::setDir(__DIR__ . '/formats/'); Cache::setDir(__DIR__ . '/caches/'); - if( isset($_REQUEST) && isset($_REQUEST['action']) ){ - switch($_REQUEST['action']){ - case 'display': - if( isset($_REQUEST['bridge']) ){ - unset($_REQUEST['action']); - $bridge = $_REQUEST['bridge']; - unset($_REQUEST['bridge']); - $format = $_REQUEST['format']; - unset($_REQUEST['format']); + $action=filter_input(INPUT_GET,'action'); + $bridge=filter_input(INPUT_GET,'bridge'); + if($action === 'display' && !empty($bridge)){ + unset($_REQUEST['action']); + unset($_REQUEST['bridge']); + // DEPRECATED: 'nameBridge' scheme is replaced by 'name' in bridge parameter values + // this is to keep compatibility until futher complete removal + if(($pos=strpos($bridge,'Bridge'))===(strlen($bridge)-strlen('Bridge'))){ + $bridge=substr($bridge,0,$pos); + } + + $format = filter_input(INPUT_GET,'format'); + unset($_REQUEST['format']); + // DEPRECATED: 'nameFormat' scheme is replaced by 'name' in format parameter values + // this is to keep compatibility until futher complete removal + if(($pos=strpos($format,'Format'))===(strlen($format)-strlen('Format'))){ + $format=substr($format,0,$pos); + } + // whitelist control if(!Bridge::isWhitelisted($whitelist_selection, $bridge)) { @@ -111,13 +121,12 @@ try{ // Data retrieval $bridge = Bridge::create($bridge); - if(defined("DEBUG")) { - } else { - $bridge->setCache($cache); // just add disable cache to your query to disable caching + if(!defined("DEBUG")) { + $bridge->setCache($cache); } - if(defined('PROXY_URL') && PROXY_BYBRIDGE && - isset($_REQUEST['_noproxy']) - ){ + + $noproxy=filter_input(INPUT_GET,'_noproxy',FILTER_VALIDATE_BOOLEAN); + if(defined('PROXY_URL') && PROXY_BYBRIDGE && $noproxy){ $bridge->useProxy=false; } $bridge->loadMetadatas(); @@ -138,10 +147,8 @@ try{ } die; - } - break; - } - } + + } } catch(HttpException $e){ header('HTTP/1.1 ' . $e->getCode() . ' ' . Http::getMessageForCode($e->getCode())); @@ -173,7 +180,7 @@ $formats = Format::searchInformation(); $infos ){ - if ( isset($infos['name']) ) - $buttons .= '' . PHP_EOL; + foreach( $formats as $name){ + $buttons .= '' . PHP_EOL; } return $buttons;