Esempio n. 1
0
 protected function _actionAdd(Library\CommandContext $context)
 {
     //Force article to unpublished if you cannot edit
     if (!$this->canEdit()) {
         $context->request->data->set('published', 0);
     }
     return parent::_actionAdd($context);
 }
Esempio n. 2
0
 protected function _actionAdd(Library\CommandContext $context)
 {
     $session = $context->user->session;
     //Insert the session into the database
     if (!$session->isActive()) {
         throw new Library\ControllerExceptionActionFailed('Session could not be stored. No active session');
     }
     //Fork the session to prevent session fixation issues
     $session->fork();
     //Prepare the data
     $data = array('id' => $session->getId(), 'guest' => !$context->user->isAuthentic(), 'email' => $context->user->getEmail(), 'data' => '', 'time' => time(), 'application' => 'site');
     $context->request->data->add($data);
     //Store the session
     $entity = parent::_actionAdd($context);
     //Set the session data
     $session->site = $this->getObject('application')->getSite();
     //Redirect to caller
     $context->response->setRedirect($context->request->getReferrer());
     return $entity;
 }
Esempio n. 3
0
 protected function _actionAdd(Library\CommandContext $context)
 {
     $params = $this->getObject('application.extensions')->users->params;
     $context->request->data->role_id = $params->get('new_usertype', 18);
     return parent::_actionAdd($context);
 }