public function submit($update_first_post = true) { if (!$this->queue_id) { titania::add_lang('manage'); $sql = 'SELECT c.contrib_id, c.contrib_name_clean, c.contrib_name, c.contrib_type, r.revision_version FROM ' . TITANIA_CONTRIBS_TABLE . ' c, ' . TITANIA_REVISIONS_TABLE . ' r WHERE r.revision_id = ' . (int) $this->revision_id . ' AND c.contrib_id = r.contrib_id'; $result = phpbb::$db->sql_query($sql); $row = phpbb::$db->sql_fetchrow($result); phpbb::$db->sql_freeresult($result); if (!$row) { trigger_error('NO_CONTRIB'); } $this->queue_type = $row['contrib_type']; // Submit here first to make sure we have a queue_id for the topic url parent::submit(); // Is there a queue discussion topic? If not we should create one $this->get_queue_discussion_topic(); $this->update_first_queue_post(phpbb::$user->lang['VALIDATION'] . ' - ' . $row['contrib_name'] . ' - ' . $row['revision_version']); } else { if ($update_first_post) { $this->update_first_queue_post(); } } parent::submit(); // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this); }
public function report($reason = '') { // Mark the post as reported $this->post_reported = true; // Setup the attention object and submit it $attention = new titania_attention(); $attention->__set_array(array('attention_type' => TITANIA_ATTENTION_REPORTED, 'attention_object_type' => TITANIA_POST, 'attention_object_id' => $this->post_id, 'attention_poster_id' => $this->post_user_id, 'attention_post_time' => $this->post_time, 'attention_url' => $this->get_url(), 'attention_title' => $this->post_subject, 'attention_description' => $reason)); $attention->submit(); // Update the postcount and mark as reported for the topic and submit it $this->update_topic_postcount(); $this->topic->topic_reported = true; $this->topic->submit(); // Self submission parent::submit(); // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this); }
/** * Submit data for storing into the database * * @return bool */ public function submit() { if (!$this->user_id) { throw new exception('No user_id!'); } return parent::submit(); }
/** * Submit data for storing into the database * * @return bool */ public function submit() { // Destroy category cache $this->destroy_cache(); return parent::submit(); }
/** * Update data or submit new faq * * @return void */ public function submit() { // Get the FAQ count to update it $sql = 'SELECT contrib_faq_count FROM ' . TITANIA_CONTRIBS_TABLE . ' WHERE contrib_id = ' . $this->contrib_id; phpbb::$db->sql_query($sql); $contrib_faq_count = phpbb::$db->sql_fetchfield('contrib_faq_count'); phpbb::$db->sql_freeresult(); // If already submitted we need to decrement first if ($this->faq_id) { if (empty($this->sql_data)) { throw new exception('Modifying a FAQ entry requires you load it through the load() function (we require the original information).'); } $original_flags = titania_count::update_flags($this->sql_data['faq_access']); $contrib_faq_count = titania_count::decrement($contrib_faq_count, $original_flags); } // Update the FAQ count $flags = titania_count::update_flags($this->faq_access); $sql = 'UPDATE ' . TITANIA_CONTRIBS_TABLE . ' SET contrib_faq_count = \'' . phpbb::$db->sql_escape(titania_count::increment($contrib_faq_count, $flags)) . '\' WHERE contrib_id = ' . $this->contrib_id; phpbb::$db->sql_query($sql); // Submit this FAQ item parent::submit(); // Index titania_search::index(TITANIA_FAQ, $this->faq_id, array('title' => $this->faq_subject, 'text' => $this->faq_text, 'text_uid' => $this->faq_text_uid, 'text_bitfield' => $this->faq_text_bitfield, 'text_options' => $this->faq_text_options, 'author' => 0, 'date' => 0, 'url' => titania_url::unbuild_url($this->get_url()), 'access_level' => $this->faq_access)); }
/** * Submit data for storing into the database * DO NOT USE THIS FUNCTION TO CHANGE THE STATUS ELSE THE AUTHORS CONTRIB COUNT WILL BE INCORRECT (use change_status function)! */ public function submit() { if (!$this->contrib_id) { // Make sure the author exists, if not we create one (do this before returning if not approved...else we need to duplicate this code in a bunch of places) $user_id = $this->contrib_user_id; $sql = 'SELECT user_id FROM ' . TITANIA_AUTHORS_TABLE . ' WHERE user_id = ' . (int) $user_id; phpbb::$db->sql_query($sql); if (!phpbb::$db->sql_fetchfield('user_id')) { $author = new titania_author($user_id); $author->submit(); } phpbb::$db->sql_freeresult(); } if (!$this->contrib_id && (!titania::$config->require_validation || !titania_types::$types[$this->contrib_type]->require_validation || in_array($this->contrib_status, array(TITANIA_CONTRIB_APPROVED, TITANIA_CONTRIB_DOWNLOAD_DISABLED)))) { // Increment the contrib counter $this->change_author_contrib_count($this->contrib_user_id); // Increment the count for this type titania_types::increment_count($this->contrib_type); } // Clear the author contribs cache titania::$cache->reset_author_contribs($this->contrib_user_id); parent::submit(); // Index! $this->index(); // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this); }