diff options
Diffstat (limited to 'app/class/controllerart.php')
-rw-r--r-- | app/class/controllerart.php | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/app/class/controllerart.php b/app/class/controllerart.php index 9143375..0010f33 100644 --- a/app/class/controllerart.php +++ b/app/class/controllerart.php @@ -86,7 +86,7 @@ class Controllerart extends Controller $artlist = $this->artmanager->list(); - if(isset($_SESSION['workspace'])) { + if (isset($_SESSION['workspace'])) { $showleftpanel = $_SESSION['workspace']['showleftpanel']; $showrightpanel = $_SESSION['workspace']['showrightpanel']; } else { @@ -97,7 +97,7 @@ class Controllerart extends Controller $this->showtemplate('edit', ['art' => $this->art, 'artexist' => true, 'tablist' => $tablist, 'artlist' => $artlist, 'showleftpanel' => $showleftpanel, 'showrightpanel' => $showrightpanel]); } else { - $this->redirect('?id=' . $this->art->id()); + $this->routedirect('artread/', ['art' => $this->art->id()]); } } @@ -112,25 +112,35 @@ class Controllerart extends Controller public function add($id) { $this->setart($id); - $this->art->reset(); - $this->artmanager->add($this->art); - $this->redirect('?id=' . $this->art->id() . '&aff=edit'); + if ($this->user->canedit() && !$this->importart()) { + $this->art->reset(); + $this->artmanager->add($this->art); + $this->routedirect('artedit', ['art' => $this->art->id()]); + } else { + $this->routedirect('artread/', ['art' => $this->art->id()]); + } } - public function delete($id) + public function confirmdelete($id) { $this->setart($id); if ($this->user->canedit() && $this->importart()) { - if (isset($_POST['deleteconfirm']) && $_POST['deleteconfirm'] == true) { - $this->artmanager->delete($this->art); - $this->redirect('?id=' . $this->art->id()); - } else { - $this->showtemplate('delete', ['art' => $this->art, 'artexist' => true]); - } + $this->showtemplate('confirmdelete', ['art' => $this->art, 'artexist' => true]); + } else { - $this->redirect('?id=' . $this->art->id()); + $this->routedirect('artread/', ['art' => $this->art->id()]); + } + } + + public function delete($id) + { + $this->setart($id); + if ($this->user->canedit() && $this->importart()) { + + $this->artmanager->delete($this->art); } + $this->routedirect('backrouter'); } public function update($id) @@ -146,7 +156,7 @@ class Controllerart extends Controller } - $this->redirect('?id=' . $this->art->id() . '&aff=edit'); + $this->routedirect('artupdate', ['art' => $this->art->id()]); |