/** * Save an entry * * @return void */ public function saveTask() { // Check for request forgeries Request::checkToken(); // Bind incoming data to object $row = new Page($this->database); if (!$row->bind($_POST)) { throw new Exception($row->getError(), 500); } if (!$row->alias) { $row->alias = $row->title; } $row->event_id = Request::getInt('event', 0); $row->alias = preg_replace("/[^a-zA-Z0-9]/", '', $row->alias); $row->alias = strtolower($row->alias); //set created date and user if ($row->id == NULL || $row->id == '' || $row->id == 0) { $row->created = \Date::toSql(); $row->created_by = User::get('id'); } //set modified date and user $row->modified = \Date::toSql(); $row->modified_by = User::get('id'); // Check content for missing required data if (!$row->check()) { throw new Exception($row->getError(), 500); } // Store new content if (!$row->store()) { throw new Exception($row->getError(), 500); } // Redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&id[]=' . $row->event_id, false), Lang::txt('COM_EVENTS_PAGE_SAVED')); }