aboutsummaryrefslogtreecommitdiff
path: root/w/class/controller.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-11-11 17:19:26 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-11-11 17:19:26 +0100
commitd7f3313ff4514e38c9f53439cd1a1287e56e45f7 (patch)
treeabff39ab11cb317f5fcd2db558da1c59bdae9239 /w/class/controller.php
parent2f363e8fa26ab849539e64ff7caa21bd164e8979 (diff)
downloadwcms-d7f3313ff4514e38c9f53439cd1a1287e56e45f7.tar.gz
wcms-d7f3313ff4514e38c9f53439cd1a1287e56e45f7.zip
reboot folder
Diffstat (limited to 'w/class/controller.php')
-rw-r--r--w/class/controller.php96
1 files changed, 0 insertions, 96 deletions
diff --git a/w/class/controller.php b/w/class/controller.php
deleted file mode 100644
index c97c99f..0000000
--- a/w/class/controller.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-class Controller
-{
-
- protected $user;
- protected $usermanager;
- protected $plates;
-
- public function __construct() {
- $this->setuser();
- $this->initplates();
- $this->initconfig();
- }
-
- public function setuser()
- {
- $this->usermanager = new Modeluser;
- $this->user = $this->usermanager->readsession();
- }
-
- public function initplates()
- {
- $this->plates = new League\Plates\Engine(Model::TEMPLATES_DIR);
- }
-
- public function useriseditor()
- {
- if ($this->user->level() >= $this->usermanager::EDITOR) {
- echo '<h3>Editor access</h3>';
- return true;
- } else {
- echo '<h3>Not enought rights to see more...</h3>';
- return false;
- }
- }
-
- public function initconfig()
- {
- Config::readconfig();
- }
-
- public function showtemplate($template, $params)
- {
- $params = array_merge($this->commonsparams(), $params);
- echo $this->plates->render($template, $params);
- }
-
- public function commonsparams()
- {
- $commonsparams = [];
- $commonsparams['user'] = $this->user;
- return $commonsparams;
- }
-
- public function login($redirect = 'home')
- {
- if(isset($_POST['pass'])) {
- $this->user = $this->usermanager->login($_POST['pass']);
- $this->usermanager->writesession($this->user);
- }
- if($redirect == 'art') {
- $this->redirect('?id=' . $this->art->id());
- } else {
- $this->redirect('?aff=' . $redirect);
- }
- }
-
- public function logout($redirect = 'home')
- {
- $this->user = $this->usermanager->logout();
- $this->usermanager->writesession($this->user);
- if($redirect == 'art') {
- $this->redirect('?id=' . $this->art->id());
- } else {
- $this->redirect('?aff=' . $redirect);
- }
- }
-
-
-
-
- public function redirect($url)
- {
- header('Location: ' . $url);
- }
-
-
-
-}
-
-
-
-
-
-?> \ No newline at end of file