/** * Quick load a post * * @param int $post_id * @return \titania_post * @throws \OutOfBoundsException Throws exception if the post does not exist. */ public function load_post($post_id) { $post = new \titania_post(); $post->post_id = $post_id; if ($post->load() === false) { throw new \OutOfBoundsException($this->user->lang('NO_POST')); } $post->topic = $this->load_topic($post->topic_id); return $post; }
} phpbb::$db->sql_query($sql); } add_form_key('attention'); // Display the current attention items $options = array('attention_object_id' => $object_id); attention_overlord::display_attention_list($options); // Display the old (closed) attention items $options['only_closed'] = true; $options['template_block'] = 'attention_closed'; attention_overlord::display_attention_list($options); switch ($object_type) { case TITANIA_POST: $post = new titania_post(); $post->post_id = $object_id; if (!$post->load()) { $attention_object->delete(); trigger_error('NO_POST'); } // Close the report if ($close) { $post->post_reported = false; $post->submit(); $sql = 'SELECT COUNT(post_id) AS cnt FROM ' . TITANIA_POSTS_TABLE . ' WHERE topic_id = ' . $post->topic_id . ' AND post_reported = 1'; phpbb::$db->sql_query($sql); $cnt = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); if (!$cnt) { $sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
/** * Rebuild (or create) the first post in the queue topic */ public function update_first_queue_post($post_subject = false) { $this->user->add_lang_ext('phpbb/titania', 'manage'); if (!$this->queue_topic_id) { $sql = 'SELECT contrib_type FROM ' . TITANIA_CONTRIBS_TABLE . ' WHERE contrib_id = ' . $this->contrib_id; phpbb::$db->sql_query($sql); $contrib_type = phpbb::$db->sql_fetchfield('contrib_type'); phpbb::$db->sql_freeresult(); // Create the topic $post = new titania_post(TITANIA_QUEUE); $post->post_access = access::TEAM_LEVEL; $post->topic->parent_id = $this->queue_id; $post->topic->topic_category = $contrib_type; $post->topic->topic_url = serialize(array('id' => $this->queue_id)); } else { // Load the first post $topic = new titania_topic(); $topic->topic_id = $this->queue_topic_id; $topic->load(); $post = new titania_post($topic->topic_type, $topic, $topic->topic_first_post_id); $post->load(); } if ($post_subject) { $post->post_subject = $post_subject; } $post->post_user_id = $this->submitter_user_id; $post->post_time = $this->queue_submit_time; $revision = $this->get_revision(); // Reset the post text $post->post_text = ''; // Queue Discussion Link $queue_topic = $this->get_queue_discussion_topic(); $post->post_text .= '[url=' . $queue_topic->get_url() . ']' . phpbb::$user->lang['QUEUE_DISCUSSION_TOPIC'] . "[/url]\n\n"; if ($revision->revision_status == TITANIA_REVISION_ON_HOLD) { $post->post_text .= '<strong>' . phpbb::$user->lang['REVISION_FOR_NEXT_PHPBB'] . "</strong>\n\n"; } // Put text saying whether repacking is allowed or not $post->post_text .= phpbb::$user->lang[$this->queue_allow_repack ? 'QUEUE_REPACK_ALLOWED' : 'QUEUE_REPACK_NOT_ALLOWED'] . "\n\n"; // Add the queue notes if ($this->queue_notes) { $queue_notes = $this->queue_notes; message::decode($queue_notes, $this->queue_notes_uid); $post->post_text .= '[quote="' . users_overlord::get_user($this->submitter_user_id, 'username', true) . '"]' . $queue_notes . "[/quote]\n"; } // Add the MPV results if ($this->mpv_results) { $mpv_results = $this->mpv_results; message::decode($mpv_results, $this->mpv_results_uid); $post->post_text .= '[quote="' . phpbb::$user->lang['VALIDATION_PV'] . '"]' . $mpv_results . "[/quote]\n"; } // Add the Automod results if ($this->automod_results) { $post->post_text .= '[quote="' . phpbb::$user->lang['VALIDATION_AUTOMOD'] . '"]' . $this->automod_results . "[/quote]\n"; } // Prevent errors from different configurations phpbb::$config['min_post_chars'] = 1; phpbb::$config['max_post_chars'] = 0; // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $post, $this); // Store the post $post->generate_text_for_storage(true, true, true); $post->submit(); $this->queue_topic_id = $post->topic_id; }
/** * Quick load a post * * @param mixed $post_id * @return object */ public function load_post($post_id) { $post = new titania_post(); $post->post_id = $post_id; if ($post->load() === false) { trigger_error('NO_POST'); } $post->topic = $this->load_topic($post->topic_id); return $post; }