예제 #1
0
 public function process(\w2p_Core_CAppUI $AppUI, array $myArray)
 {
     if (!$this->object->bind($myArray)) {
         $AppUI->setMsg($this->object->getError(), UI_MSG_ERROR);
         $this->resultPath = $this->errorPath;
         return $AppUI;
     }
     /**
      * The nonce validation only throws a warning as of v3.1 so that we don't break anyone's forms. As of v4.0
      *   this validation will be turned on and any form processing using this controller will have to include
      *   the __nonce field. See http://wiki.web2project.net/index.php?title=Security_Nonce for more details.
      */
     if ('' != $AppUI->__nonce && $AppUI->__nonce != $myArray['__nonce']) {
         error_log("Your submission is missing the CSRF nonce. Please see http://wiki.web2project.net/index.php?title=Security_Nonce for details.");
         //            $AppUI->setMsg("There was an error processing the form. Please submit again.", UI_MSG_ERROR);
         //            $AppUI->holdObject($this->object);
         //            $this->resultPath = $this->errorPath;
         //            return $AppUI;
     }
     $action = $this->delete ? 'deleted' : 'stored';
     $this->success = $this->delete ? $this->object->delete() : $this->object->store();
     if ($this->success) {
         $AppUI->setMsg($this->prefix . ' ' . $action, UI_MSG_OK, true);
         $this->resultPath = $this->successPath;
     } else {
         $AppUI->holdObject($this->object);
         $AppUI->setMsg($this->object->getError(), UI_MSG_ERROR);
         $this->resultPath = $this->errorPath;
     }
     return $AppUI;
 }
예제 #2
0
 public function process(\w2p_Core_CAppUI $AppUI, array $myArray)
 {
     if (!canEdit('users')) {
         $this->resultPath = ACCESS_DENIED;
         return $AppUI;
     }
     $action = $this->delete ? 'deleted' : 'stored';
     $this->success = $this->delete ? $this->object->del_acl((int) $myArray['permission_id']) : $this->object->addUserPermission();
     if ($this->success) {
         $AppUI->setMsg($this->prefix . ' ' . $action, UI_MSG_OK, true);
         $this->resultPath = $this->successPath;
         $this->object->recalcPermissions(null, (int) $myArray['permission_user']);
     } else {
         $AppUI->setMsg($this->object->getError(), UI_MSG_ERROR);
         $this->resultPath = $this->errorPath;
         $AppUI->holdObject($this->object);
     }
     return $AppUI;
 }