From 4daafefd0c29440c6fbad2239be2803ad04b92cd Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 2 Nov 2010 12:40:21 +0000 Subject: moderators can block/unblock users - part 2 --- .../Application/Controllers/GenericController.php | 12 +++++ .../Application/Controllers/HistoryController.php | 46 ++++++++++-------- .../Application/Controllers/IssuesController.php | 5 ++ h-source/Application/Controllers/MyController.php | 3 ++ h-source/Application/Views/Help/index.php | 53 ++++++++++++++++++++- h-source/Application/Views/Help/index_es.php | 54 +++++++++++++++++++++- h-source/Application/Views/Help/index_fr.php | 53 ++++++++++++++++++++- h-source/Application/Views/Help/index_it.php | 54 +++++++++++++++++++++- h-source/Application/Views/My/panel.php | 6 +++ 9 files changed, 262 insertions(+), 24 deletions(-) (limited to 'h-source') 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); diff --git a/h-source/Application/Views/Help/index.php b/h-source/Application/Views/Help/index.php index c7c0bb9..7929cbe 100644 --- a/h-source/Application/Views/Help/index.php +++ b/h-source/Application/Views/Help/index.php @@ -40,7 +40,7 @@

List of wiki tags

- +
@@ -153,6 +153,57 @@
name
+

Some more examples:

+ + + + + + + + + + + + +
+ List + +
    +
  • first item
  • +
  • second item
  • +
+
+
    +
  • [list]
  • +
  • +
      +
    • [*]first item[/*]
    • +
    • [*]second item[/*]
    • +
    +
  • +
  • [/list]
  • +
+
+ Numbered list + +
    +
  1. first item
  2. +
  3. second item
  4. +
+
+
    +
  • [enum]
  • +
  • +
      +
    • [*]first item[/*]
    • +
    • [*]second item[/*]
    • +
    +
  • +
  • [/enum]
  • +
+
+

Compatibility classes

Notebooks

diff --git a/h-source/Application/Views/Help/index_es.php b/h-source/Application/Views/Help/index_es.php index 5ecc7f0..bf19b5b 100644 --- a/h-source/Application/Views/Help/index_es.php +++ b/h-source/Application/Views/Help/index_es.php @@ -40,7 +40,7 @@

Lista de las etiquetas wiki de

- +
@@ -153,6 +153,58 @@
nombre
+

Some more examples:

+ + + + + + + + + + + + +
+ List + +
    +
  • first item
  • +
  • second item
  • +
+
+
    +
  • [list]
  • +
  • +
      +
    • [*]first item[/*]
    • +
    • [*]second item[/*]
    • +
    +
  • +
  • [/list]
  • +
+
+ Numbered list + +
    +
  1. first item
  2. +
  3. second item
  4. +
+
+
    +
  • [enum]
  • +
  • +
      +
    • [*]first item[/*]
    • +
    • [*]second item[/*]
    • +
    +
  • +
  • [/enum]
  • +
+
+ +

Clases de Compatibilidad

Laptops

diff --git a/h-source/Application/Views/Help/index_fr.php b/h-source/Application/Views/Help/index_fr.php index c74e06f..d98d13b 100644 --- a/h-source/Application/Views/Help/index_fr.php +++ b/h-source/Application/Views/Help/index_fr.php @@ -40,7 +40,7 @@

Liste des tags Wiki sur

- +
@@ -153,6 +153,57 @@
name
+

Some more examples:

+ + + + + + + + + + + + +
+ List + +
    +
  • first item
  • +
  • second item
  • +
+
+
    +
  • [list]
  • +
  • +
      +
    • [*]first item[/*]
    • +
    • [*]second item[/*]
    • +
    +
  • +
  • [/list]
  • +
+
+ Numbered list + +
    +
  1. first item
  2. +
  3. second item
  4. +
+
+
    +
  • [enum]
  • +
  • +
      +
    • [*]first item[/*]
    • +
    • [*]second item[/*]
    • +
    +
  • +
  • [/enum]
  • +
+
+

Niveau de compatibilitée

Notebooks

diff --git a/h-source/Application/Views/Help/index_it.php b/h-source/Application/Views/Help/index_it.php index e55d88f..d4f6f7d 100644 --- a/h-source/Application/Views/Help/index_it.php +++ b/h-source/Application/Views/Help/index_it.php @@ -40,7 +40,7 @@

Lista dei tag della wiki di

- +
@@ -170,6 +170,58 @@
+

Alcuni esempi aggiuntivi:

+ + + + + + + + + + + + +
+ Lista + +
    +
  • primo elemento
  • +
  • secondo elemento
  • +
+
+
    +
  • [list]
  • +
  • +
      +
    • [*]primo elemento[/*]
    • +
    • [*]secondo elemento[/*]
    • +
    +
  • +
  • [/list]
  • +
+
+ Lista numerata + +
    +
  1. first item
  2. +
  3. second item
  4. +
+
+
    +
  • [enum]
  • +
  • +
      +
    • [*]first item[/*]
    • +
    • [*]second item[/*]
    • +
    +
  • +
  • [/enum]
  • +
+
+ +

Classi di compatibilità

Notebooks

diff --git a/h-source/Application/Views/My/panel.php b/h-source/Application/Views/My/panel.php index 006869f..44f159e 100644 --- a/h-source/Application/Views/My/panel.php +++ b/h-source/Application/Views/My/panel.php @@ -26,6 +26,12 @@ ">Home » panel + +
+ Your account has been blocked by a moderator of the website. You can neither insert/modify devices nor submit new issues or messages until some other moderator un-block your account. +
+ +