diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2019-01-15 04:04:01 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2019-01-15 04:04:01 +0100 |
commit | 2ff846f7fb65998cd6cf151554434f56f116d4f2 (patch) | |
tree | 8106cf1744dc7545e1482fd98bae16ea3628c153 /app/class/controllerconnect.php | |
parent | 8e79f279938f0fff64ddd381d073c2c277dd2d5c (diff) | |
parent | de195c2fca2f4b77a54be68fb58cd0ccee10a5b7 (diff) | |
download | wcms-2ff846f7fb65998cd6cf151554434f56f116d4f2.tar.gz wcms-2ff846f7fb65998cd6cf151554434f56f116d4f2.zip |
Merge branch 'implement-timeline' into develop
Diffstat (limited to 'app/class/controllerconnect.php')
-rw-r--r-- | app/class/controllerconnect.php | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/app/class/controllerconnect.php b/app/class/controllerconnect.php index 5328447..d6aa7a2 100644 --- a/app/class/controllerconnect.php +++ b/app/class/controllerconnect.php @@ -6,31 +6,33 @@ class Controllerconnect extends Controller public function log() { if (isset($_POST['log'])) { - if (isset($_POST['id'])) { - $id = $_POST['id']; - } else { - $id = null; - } + $id = $_POST['id'] ?? null; + $route = $_POST['route'] ?? 'home'; if ($_POST['log'] === 'login') { - $this->login($id); + $this->login($route, $id); } elseif ($_POST['log'] === 'logout') { - $this->logout($id); + $this->logout($route, $id); } } - } public function connect() { - $this->showtemplate('connect', []); + if(isset($_SESSION['artupdate'])) { + $artupdate['route'] = 'artedit'; + $artupdate['id'] = $_SESSION['artupdate']['id']; + } else { + $artupdate = [$route = 'home']; + } + $this->showtemplate('connect', $artupdate); } - public function login($id) + public function login($route, $id = null) { if (isset($_POST['pass'])) { $this->user = $this->usermanager->passwordcheck($_POST['pass']); @@ -41,21 +43,21 @@ class Controllerconnect extends Controller } } - if (!empty($id)) { - $this->routedirect('artread/', ['art' => $id]); + if ($id !== null) { + $this->routedirect($route, ['art' => $id]); } else { - $this->routedirect('home'); + $this->routedirect($route); } } - public function logout($id) + public function logout($route, $id = null) { $this->user = $this->usermanager->logout(); $this->usermanager->writesession($this->user); - if (!empty($id)) { - $this->routedirect('artread/', ['art' => $id]); + if ($id !== null && $route !== 'home') { + $this->routedirect($route, ['art' => $id]); } else { - $this->routedirect('home'); + $this->routedirect($route); } } |