/** * Update an existing post * * @access private */ private function update() { if ($this->check_post_data()) { try { $old = new Post(); $old->_id = $this->_post->_id; $old->read('_status'); //if post move from draft to published, creation date is updated if ($old->_status == 'draft' && $this->_post->_status == 'publish') { $this->_post->_date = date('Y-m-d H:i:s'); $this->_post->update('_date', 'str'); } $this->_post->update('_title', 'str'); $this->_post->update('_content', 'str'); $this->_post->update('_allow_comment', 'str'); $this->_post->update('_date', 'str'); $this->_post->update('_status', 'str'); $this->_post->update('_tags', 'str'); $this->_post->update('_category', 'str'); if ($this->_post->_status == 'publish') { $this->_post->_updated = 'yes'; $this->_post->_update_author = $this->_user['user_id']; $this->_post->update('_updated', 'str'); $this->_post->update('_update_author', 'int'); } $this->_action_msg = ActionMessages::post_update(true); Session::monitor_activity('updated the post "' . $this->_post->_title . '" (status: ' . $this->_post->_status . ')'); } catch (Exception $e) { $this->_action_msg = ActionMessages::post_update(ucfirst($e->getMessage())); } } $this->_action = 'to_update'; }