From fafb4596aa0b3878adcf03d8fea0e4f1d1fa313a Mon Sep 17 00:00:00 2001 From: Alexandre Rossi Date: Tue, 6 Jun 2017 09:50:52 +0200 Subject: [PATCH] do not init View twice (it is already set up in BaseController) --- controllers/Index.php | 12 ++++-------- controllers/Opml.php | 1 - 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/controllers/Index.php b/controllers/Index.php index 4f3ab4ecb3..2db0764881 100644 --- a/controllers/Index.php +++ b/controllers/Index.php @@ -102,7 +102,6 @@ public function home() { * @return void */ public function password() { - $this->view = new \helpers\View(); $this->view->password = true; if (isset($_POST['password'])) { $this->view->hash = hash('sha512', \F3::get('salt') . $_POST['password']); @@ -117,8 +116,6 @@ public function password() { * @return void */ public function login() { - $view = new \helpers\View(); - $error = null; if (isset($_REQUEST['username'])) { @@ -136,19 +133,19 @@ public function login() { } if ($error !== null) { - $view->jsonError([ + $this->view->jsonError([ 'success' => false, 'error' => $error ]); } if (\F3::get('auth')->login($username, $password)) { - $view->jsonSuccess([ + $this->view->jsonSuccess([ 'success' => true ]); } - $view->jsonSuccess([ + $this->view->jsonSuccess([ 'success' => false, 'error' => 'invalid username/password' ]); @@ -161,9 +158,8 @@ public function login() { * @return void */ public function logout() { - $view = new \helpers\View(); \F3::get('auth')->logout(); - $view->jsonSuccess([ + $this->view->jsonSuccess([ 'success' => true ]); } diff --git a/controllers/Opml.php b/controllers/Opml.php index f94d8ef7ec..f464b927f6 100644 --- a/controllers/Opml.php +++ b/controllers/Opml.php @@ -47,7 +47,6 @@ public function __construct() { public function show() { $this->needsLoggedIn(); - $this->view = new \helpers\View(); $this->view->msg = $this->msg; $this->view->msgclass = $this->msgclass; echo $this->view->render('templates/opml.phtml');