예제 #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the user exists
     if ($this->id !== null && BackendUsersModel::exists($this->id)) {
         parent::execute();
         $this->record = (array) BackendUsersModel::get($this->id);
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }
예제 #2
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the user exist
     if ($this->id !== null && BackendUsersModel::exists($this->id) && BackendAuthentication::getUser()->getUserId() != $this->id) {
         parent::execute();
         // get data
         $user = new BackendUser($this->id);
         // God-users can't be deleted
         if ($user->isGod()) {
             $this->redirect(BackendModel::createURLForAction('index') . '&error=cant-delete-god');
         }
         // delete item
         BackendUsersModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // item was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . $user->getSetting('nickname'));
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }