Merge branch 'develop' of github.com:Rudloff/alltube into develop

This commit is contained in:
Pierre Rudloff 2016-10-26 17:16:36 +02:00
commit bd26756246

View file

@ -46,6 +46,13 @@ class FrontController
*/ */
private $sessionSegment; private $sessionSegment;
/**
* Smarty view.
*
* @var \Slim\Views\Smarty
*/
private $view;
/** /**
* FrontController constructor. * FrontController constructor.
* *
@ -56,6 +63,7 @@ class FrontController
$this->config = Config::getInstance(); $this->config = Config::getInstance();
$this->download = new VideoDownload(); $this->download = new VideoDownload();
$this->container = $container; $this->container = $container;
$this->view = $this->container->get('view');
$session_factory = new \Aura\Session\SessionFactory(); $session_factory = new \Aura\Session\SessionFactory();
$session = $session_factory->newInstance($_COOKIE); $session = $session_factory->newInstance($_COOKIE);
$this->sessionSegment = $session->getSegment('Alltube\Controller\FrontController'); $this->sessionSegment = $session->getSegment('Alltube\Controller\FrontController');
@ -71,8 +79,7 @@ class FrontController
*/ */
public function index(Request $request, Response $response) public function index(Request $request, Response $response)
{ {
if ($this->container instanceof Container) { $this->view->render(
$this->container->view->render(
$response, $response,
'index.tpl', 'index.tpl',
[ [
@ -82,7 +89,6 @@ class FrontController
] ]
); );
} }
}
/** /**
* Display a list of extractors. * Display a list of extractors.
@ -94,8 +100,7 @@ class FrontController
*/ */
public function extractors(Request $request, Response $response) public function extractors(Request $request, Response $response)
{ {
if ($this->container instanceof Container) { $this->view->render(
$this->container->view->render(
$response, $response,
'extractors.tpl', 'extractors.tpl',
[ [
@ -107,7 +112,6 @@ class FrontController
] ]
); );
} }
}
/** /**
* Display a password prompt. * Display a password prompt.
@ -119,8 +123,7 @@ class FrontController
*/ */
public function password(Request $request, Response $response) public function password(Request $request, Response $response)
{ {
if ($this->container instanceof Container) { $this->view->render(
$this->container->view->render(
$response, $response,
'password.tpl', 'password.tpl',
[ [
@ -130,7 +133,6 @@ class FrontController
] ]
); );
} }
}
/** /**
* Dislay information about the video. * Dislay information about the video.
@ -176,8 +178,7 @@ class FrontController
} catch (PasswordException $e) { } catch (PasswordException $e) {
return $this->password($request, $response); return $this->password($request, $response);
} }
if ($this->container instanceof Container) { $this->view->render(
$this->container->view->render(
$response, $response,
'video.tpl', 'video.tpl',
[ [
@ -188,7 +189,6 @@ class FrontController
] ]
); );
} }
}
} else { } else {
return $response->withRedirect($this->container->get('router')->pathFor('index')); return $response->withRedirect($this->container->get('router')->pathFor('index'));
} }
@ -205,8 +205,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->view->render(
$this->container->view->render(
$response, $response,
'error.tpl', 'error.tpl',
[ [
@ -215,7 +214,6 @@ class FrontController
'title' => 'Error', 'title' => 'Error',
] ]
); );
}
return $response->withStatus(500); return $response->withStatus(500);
} }