$queue = queue_overlord::get_queue_object($queue_id, true); $topic = $queue->get_queue_discussion_topic(); $post = new titania_post(TITANIA_QUEUE_DISCUSSION, $topic); $post->__set_array(array('post_subject' => 'Re: ' . $post->topic->topic_subject)); // Load the message object $message_object = new titania_message($post); $message_object->set_auth(array('bbcode' => true, 'smilies' => true)); $message_object->set_settings(array('display_subject' => false)); // Submit check...handles running $post->post_data() if required $submit = $message_object->submit_check(); if ($submit) { $queue->allow_author_repack = true; $contrib = contribs_overlord::get_contrib_object($queue->contrib_id, true); $for_edit = $post->generate_text_for_edit(); $post->post_text = $for_edit['message'] . "\n\n[url=" . titania_url::append_url($contrib->get_url('revision'), array('repack' => $queue->revision_id)) . ']' . phpbb::$user->lang['AUTHOR_REPACK_LINK'] . '[/url]'; $post->generate_text_for_storage($for_edit['allow_bbcode'], $for_edit['allow_smilies'], $for_edit['allow_urls']); $post->submit(); $queue->submit(); $queue->topic_reply('QUEUE_REPLY_ALLOW_REPACK'); $queue->submit(); redirect(titania_url::append_url($base_url, array('q' => $queue->queue_id))); } $message_object->display(); // Common stuff phpbb::$template->assign_vars(array('S_POST_ACTION' => titania_url::$current_page_url, 'L_POST_A' => phpbb::$user->lang['DISCUSSION_REPLY_MESSAGE'])); titania::page_header('DISCUSSION_REPLY_MESSAGE'); titania::page_footer(true, 'manage/queue_post.html'); break; case 'move': $queue = queue_overlord::get_queue_object($queue_id, true); $tags = titania::$cache->get_tags(TITANIA_QUEUE);
/** * Get the queue discussion topic or create one if needed * * @param bool $check_only Return false if topic does not exist instead of creating it * * @return titania_topic object */ public function get_queue_discussion_topic($check_only = false) { $sql = 'SELECT * FROM ' . TITANIA_TOPICS_TABLE . ' WHERE parent_id = ' . $this->contrib_id . ' AND topic_type = ' . TITANIA_QUEUE_DISCUSSION; $result = phpbb::$db->sql_query($sql); $row = phpbb::$db->sql_fetchrow($result); phpbb::$db->sql_freeresult($result); if ($row) { $topic = new titania_topic(); $topic->__set_array($row); $this->queue_discussion_topic_id = $topic->topic_id; return $topic; } else { if ($check_only) { return false; } } // No queue discussion topic...so we must create one $this->user->add_lang_ext('phpbb/titania', 'posting'); $contrib = contribs_overlord::get_contrib_object($this->contrib_id, true); $post = new titania_post(TITANIA_QUEUE_DISCUSSION); $post->topic->__set_array(array('parent_id' => $this->contrib_id, 'topic_category' => $contrib->contrib_type, 'topic_url' => serialize(array('contrib_type' => $contrib->type->url, 'contrib' => $contrib->contrib_name_clean)), 'topic_sticky' => true)); $post->__set_array(array('post_access' => access::AUTHOR_LEVEL, 'post_subject' => sprintf(phpbb::$user->lang['QUEUE_DISCUSSION_TOPIC_TITLE'], $contrib->contrib_name), 'post_text' => phpbb::$user->lang['QUEUE_DISCUSSION_TOPIC_MESSAGE'])); $post->generate_text_for_storage(true, true, true); $post->submit(); $this->queue_discussion_topic_id = $post->topic->topic_id; return $post->topic; }
/** * Get the queue discussion topic or create one if needed * * @return titania_topic object */ public function get_queue_discussion_topic() { $sql = 'SELECT * FROM ' . TITANIA_TOPICS_TABLE . ' WHERE parent_id = ' . $this->contrib_id . ' AND topic_type = ' . TITANIA_QUEUE_DISCUSSION; $result = phpbb::$db->sql_query($sql); $row = phpbb::$db->sql_fetchrow($result); phpbb::$db->sql_freeresult($result); if ($row) { $topic = new titania_topic(); $topic->__set_array($row); return $topic; } // No queue discussion topic...so we must create one titania::add_lang('posting'); $contrib = contribs_overlord::get_contrib_object($this->contrib_id, true); $post = new titania_post(TITANIA_QUEUE_DISCUSSION); $post->topic->__set_array(array('parent_id' => $this->contrib_id, 'topic_category' => $contrib->contrib_type, 'topic_url' => titania_types::$types[$contrib->contrib_type]->url . '/' . $contrib->contrib_name_clean . '/support/', 'topic_sticky' => true)); $post->__set_array(array('post_access' => TITANIA_ACCESS_AUTHORS, 'post_subject' => sprintf(phpbb::$user->lang['QUEUE_DISCUSSION_TOPIC_TITLE'], $contrib->contrib_name), 'post_text' => phpbb::$user->lang['QUEUE_DISCUSSION_TOPIC_MESSAGE'])); $post->generate_text_for_storage(true, true, true); $post->submit(); return $post->topic; }