Merge branch 'develop' into feature/stream

This commit is contained in:
Pierre Rudloff 2016-10-13 17:30:30 +02:00
commit b3632ccd69

View file

@ -47,10 +47,8 @@ class FrontController
{ {
$this->config = Config::getInstance(); $this->config = Config::getInstance();
$this->download = new VideoDownload(); $this->download = new VideoDownload();
if ($container instanceof Container) {
$this->container = $container; $this->container = $container;
} }
}
/** /**
* Display index page. * Display index page.
@ -62,6 +60,7 @@ class FrontController
*/ */
public function index(Request $request, Response $response) public function index(Request $request, Response $response)
{ {
if ($this->container instanceof Container) {
$this->container->view->render( $this->container->view->render(
$response, $response,
'index.tpl', 'index.tpl',
@ -72,6 +71,7 @@ class FrontController
] ]
); );
} }
}
/** /**
* Display a list of extractors. * Display a list of extractors.
@ -83,6 +83,7 @@ class FrontController
*/ */
public function extractors(Request $request, Response $response) public function extractors(Request $request, Response $response)
{ {
if ($this->container instanceof Container) {
$this->container->view->render( $this->container->view->render(
$response, $response,
'extractors.tpl', 'extractors.tpl',
@ -95,6 +96,7 @@ class FrontController
] ]
); );
} }
}
/** /**
* Dislay information about the video. * Dislay information about the video.
@ -129,6 +131,7 @@ class FrontController
} }
} else { } else {
$video = $this->download->getJSON($params['url']); $video = $this->download->getJSON($params['url']);
if ($this->container instanceof Container) {
$this->container->view->render( $this->container->view->render(
$response, $response,
'video.tpl', 'video.tpl',
@ -140,6 +143,7 @@ class FrontController
] ]
); );
} }
}
} else { } else {
return $response->withRedirect($this->container->get('router')->pathFor('index')); return $response->withRedirect($this->container->get('router')->pathFor('index'));
} }
@ -156,6 +160,7 @@ class FrontController
*/ */
public function error(Request $request, Response $response, \Exception $exception) public function error(Request $request, Response $response, \Exception $exception)
{ {
if ($this->container instanceof Container) {
$this->container->view->render( $this->container->view->render(
$response, $response,
'error.tpl', 'error.tpl',
@ -165,6 +170,7 @@ class FrontController
'title' => 'Error', 'title' => 'Error',
] ]
); );
}
return $response->withStatus(500); return $response->withStatus(500);
} }