예제 #1
0
 /**
  * Save changes to a record
  *
  * @return  void
  */
 public function saveTask()
 {
     // Check for request forgeries
     Request::checkToken();
     if (!User::authorise('core.edit', $this->_option) && !User::authorise('core.create', $this->_option)) {
         App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
     }
     // Trim and addslashes all posted items
     $fields = Request::getVar('fields', array(), 'post');
     // Initiate class and bind posted items to database fields
     $row = Status::oneOrNew($fields['id'])->set($fields);
     // Store new content
     if (!$row->save()) {
         Notify::error($row->getError());
         return $this->editTask($row);
     }
     Notify::success(Lang::txt('COM_SUPPORT_STATUS_SUCCESSFULLY_SAVED'));
     // Output messsage and redirect
     if ($this->getTask() == 'apply') {
         return $this->editTask($row);
     }
     $this->cancelTask();
 }