Don't use $_GET directly

This commit is contained in:
Pierre Rudloff 2016-04-09 00:47:51 +02:00
parent f14bec35ea
commit e07474a3dc

View file

@ -107,11 +107,12 @@ class FrontController
public function video($request, $response) public function video($request, $response)
{ {
global $container; global $container;
$params = $request->getQueryParams();
$this->config = Config::getInstance(); $this->config = Config::getInstance();
if (isset($_GET["url"])) { if (isset($params["url"])) {
if (isset($_GET['audio'])) { if (isset($params['audio'])) {
try { try {
$video = $this->download->getJSON($_GET["url"]); $video = $this->download->getJSON($params["url"]);
//Vimeo needs a correct user-agent //Vimeo needs a correct user-agent
$UA = $this->download->getUA(); $UA = $this->download->getUA();
@ -172,7 +173,7 @@ class FrontController
} }
} else { } else {
try { try {
$video = $this->download->getJSON($_GET["url"]); $video = $this->download->getJSON($params["url"]);
$container->view->render( $container->view->render(
$response, $response,
'head.tpl', 'head.tpl',
@ -223,9 +224,10 @@ class FrontController
public function redirect($request, $response) public function redirect($request, $response)
{ {
global $app; global $app;
if (isset($_GET["url"])) { $params = $request->getQueryParams();
if (isset($params["url"])) {
try { try {
$url = $this->download->getURL($_GET["url"]); $url = $this->download->getURL($params["url"]);
return $response->withRedirect($url); return $response->withRedirect($url);
} catch (\Exception $e) { } catch (\Exception $e) {
echo $e->getMessage().PHP_EOL; echo $e->getMessage().PHP_EOL;
@ -245,9 +247,10 @@ class FrontController
public function json($request, $response) public function json($request, $response)
{ {
global $app; global $app;
if (isset($_GET["url"])) { $params = $request->getQueryParams();
if (isset($params["url"])) {
try { try {
$video = $this->download->getJSON($_GET["url"]); $video = $this->download->getJSON($params["url"]);
return $response->withJson($video); return $response->withJson($video);
} catch (\Exception $e) { } catch (\Exception $e) {
return $response->withJson( return $response->withJson(