diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2010-11-02 12:40:21 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2010-11-02 12:40:21 +0000 |
commit | 4daafefd0c29440c6fbad2239be2803ad04b92cd (patch) | |
tree | 05015ae5c876c7cc60ccca207f21e398ce99b5f2 /h-source/Application/Controllers | |
parent | 049e37619a1ea7de4eed2695139645d6d6b9f397 (diff) |
moderators can block/unblock users - part 2
Diffstat (limited to 'h-source/Application/Controllers')
4 files changed, 46 insertions, 20 deletions
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php index f29f01d..57b22ec 100644 --- a/h-source/Application/Controllers/GenericController.php +++ b/h-source/Application/Controllers/GenericController.php @@ -30,6 +30,8 @@ class GenericController extends BaseController public function __construct($model, $controller, $queryString) { parent::__construct($model, $controller, $queryString); + $this->model('UsersModel'); + $popup = new Popup(); $popup->name = gtext('sort by'); switch ($this->controller) @@ -67,6 +69,8 @@ class GenericController extends BaseController { if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..'); + if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..'); + if (isset($_POST['insertAction'])) { if ($this->checkDist()) @@ -127,6 +131,8 @@ class GenericController extends BaseController { if (!$this->s['registered']->checkCsrf($clean['token'])) die("wrong token"); + if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) die("your account has been blocked"); + $clean['id_user'] = (int)$this->s['registered']->status['id_user']; $clean['id_hard'] = $this->request->post('id_hard',0,'forceInt'); @@ -190,6 +196,8 @@ class GenericController extends BaseController { if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..'); + if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..'); + $deleted = $this->m['HardwareModel']->select("hardware.deleted")->where(array("id_hard"=>$clean['id_hard']))->limit(1)->toList('deleted')->send(); if (strcmp($deleted[0],'no') === 0) @@ -575,6 +583,8 @@ class GenericController extends BaseController { if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..'); + if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..'); + if (isset($_POST['confirmAction'])) { if (strcmp($deleted[0],'no') === 0) @@ -622,6 +632,8 @@ class GenericController extends BaseController { if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..'); + if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..'); + $this->m['TalkModel']->values['created_by'] = $this->s['registered']->status['id_user']; $this->m['TalkModel']->values['id_hard'] = $clean['id_hard']; diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index 7702ac9..997878b 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -106,6 +106,7 @@ class HistoryController extends BaseController parent::__construct($model, $controller, $queryString); $this->model('HistoryModel'); + $this->model('UsersModel'); } @@ -145,6 +146,8 @@ class HistoryController extends BaseController { if (!$this->s['registered']->checkCsrf($clean['token'])) die("wrong token"); + if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) die("your account has been blocked"); + $clean['id_user'] = (int)$this->s['registered']->status['id_user']; $clean['id'] = $this->request->post('id',0,'forceInt'); $type = $this->request->post('type',0,'sanitizeAll'); @@ -216,28 +219,31 @@ class HistoryController extends BaseController { if ($this->ismoderator) { - $clean['id'] = (int)$id; - if (array_key_exists($type,$this->types)) + if (!$this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) { - $clean['type'] = $this->types[$type]['clean_type']; - - switch ($clean['type']) { - case 'user': - $data['object'] = 'user'; - $data['box_class'] = 'details_of_actions_inner_user'; - break; - default: - $data['object'] = 'message'; - $data['box_class'] = 'details_of_actions_inner'; - break; + $clean['id'] = (int)$id; + if (array_key_exists($type,$this->types)) + { + $clean['type'] = $this->types[$type]['clean_type']; + + switch ($clean['type']) { + case 'user': + $data['object'] = 'user'; + $data['box_class'] = 'details_of_actions_inner_user'; + break; + default: + $data['object'] = 'message'; + $data['box_class'] = 'details_of_actions_inner'; + break; + } + + $data['res'] = $this->m['HistoryModel']->select()->where(array('id'=>$clean['id'],'type'=>$clean['type']))->send(); + + $data['md_action'] = array('hide'=>'hidden','show'=>'restored','block'=>'blocked','unblock'=>'un-blocked'); + + $this->append($data); + $this->load('viewall'); } - - $data['res'] = $this->m['HistoryModel']->select()->where(array('id'=>$clean['id'],'type'=>$clean['type']))->send(); - - $data['md_action'] = array('hide'=>'hidden','show'=>'restored','block'=>'blocked','unblock'=>'un-blocked'); - - $this->append($data); - $this->load('viewall'); } } } diff --git a/h-source/Application/Controllers/IssuesController.php b/h-source/Application/Controllers/IssuesController.php index 86fc49c..efda83e 100644 --- a/h-source/Application/Controllers/IssuesController.php +++ b/h-source/Application/Controllers/IssuesController.php @@ -32,6 +32,7 @@ class IssuesController extends BaseController $this->model('IssuesModel'); $this->model('MessagesModel'); + $this->model('UsersModel'); $argKeys = array( 'page:forceNat' => 1, @@ -58,6 +59,8 @@ class IssuesController extends BaseController { if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect('home/index'.$this->lang,2,'wrong token..'); + if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..'); + //set the page to 1 in the viewStatus $this->viewArgs['page'] = 1; $this->buildStatus(); @@ -125,6 +128,8 @@ class IssuesController extends BaseController { if (!$this->s['registered']->checkCsrf($this->viewArgs['token'])) $this->redirect('home/index'.$this->lang,2,'wrong token..'); + if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..'); + $this->m['MessagesModel']->values['created_by'] = (int)$this->s['registered']->status['id_user']; $this->m['MessagesModel']->values['id_issue'] = $clean['id_issue']; $this->m['MessagesModel']->updateTable('insert'); diff --git a/h-source/Application/Controllers/MyController.php b/h-source/Application/Controllers/MyController.php index 07c6190..c2b715f 100644 --- a/h-source/Application/Controllers/MyController.php +++ b/h-source/Application/Controllers/MyController.php @@ -46,9 +46,12 @@ class MyController extends BaseController $data['title'] = 'my panel - '.Website::$generalName; $this->s['registered']->check(); + $clean['id_user'] = (int)$this->s['registered']->status['id_user']; $data['username'] = $this->m['UsersModel']->getUser($clean['id_user']); + $data['isBlocked'] = $this->m['UsersModel']->isBlocked($clean['id_user']); + $this->append($data); $this->load('panel'); $this->right($this->lang); |