/** * Hard delete the stuff for this topic */ public function delete() { $post = new titania_post(); $post->topic = $this; $sql = 'SELECT * FROM ' . TITANIA_POSTS_TABLE . ' WHERE topic_id = ' . (int) $this->topic_id; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $post->__set_array($row); $post->delete(); } phpbb::$db->sql_freeresult($result); // Remove any subscriptions to this topic $sql = 'DELETE FROM ' . TITANIA_WATCH_TABLE . ' WHERE watch_object_type = ' . TITANIA_TOPIC . ' AND watch_object_id = ' . $this->topic_id; phpbb::$db->sql_query($sql); // Remove any tracking for this topic $this->tracking->clear_item(TITANIA_TOPIC, $this->topic_id); // Delete the now empty topic $sql = 'DELETE FROM ' . TITANIA_TOPICS_TABLE . ' WHERE topic_id = ' . $this->topic_id; phpbb::$db->sql_query($sql); }
// Notify poster about disapproval if ($post->post_user_id != ANONYMOUS) { phpbb::_include('functions_messenger', false, 'messenger'); $lang_path = phpbb::$user->lang_path; phpbb::$user->set_custom_lang_path(titania::$config->language_path); $messenger = new messenger(false); users_overlord::load_users(array($post->post_user_id)); $email_template = $post->post_id == $post->topic->topic_first_post_id && $post->post_id == $post->topic->topic_last_post_id ? 'topic_disapproved' : 'post_disapproved'; $messenger->template($email_template, users_overlord::get_user($post->post_user_id, 'user_lang')); $messenger->to(users_overlord::get_user($post->post_user_id, 'user_email'), users_overlord::get_user($post->post_user_id, '_username')); $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode(users_overlord::get_user($post->post_user_id, '_username')), 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post->post_subject)), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post->topic->topic_subject)))); $messenger->send(); phpbb::$user->set_custom_lang_path($lang_path); } // Delete the post $post->delete(); redirect(titania_url::build_url(titania_url::$current_page)); } // Approve the post if ($approve) { $post->post_approved = 1; // Increment the user's postcount if we must if (!$post->post_deleted && in_array($post->post_type, titania::$config->increment_postcount)) { phpbb::update_user_postcount($post->post_user_id); } $post->submit(); // Load z topic $post->topic->topic_id = $post->topic_id; $post->topic->load(); // Update first/last post? if ($post->topic->topic_first_post_time > $post->post_time) {
/** * Hard delete the stuff for this topic */ public function delete() { $post = new titania_post(); $post->topic = $this; $sql = 'SELECT * FROM ' . TITANIA_POSTS_TABLE . ' WHERE topic_id = ' . (int) $this->topic_id; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $post->__set_array($row); $post->delete(); } phpbb::$db->sql_freeresult($result); // Deleting all the posts results in the last post calling this topic to delete itself }