/** * Allow author to repack revision action. * * @return null */ protected function allow_author_repack() { $topic = $this->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 = $this->get_message($post); // Submit check...handles running $post->post_data() if required $submit = $message_object->submit_check(); if ($submit) { $this->queue->allow_author_repack = true; $repack_url = $this->contrib->get_url('revision', array('page' => 'repack', 'id' => $this->queue->revision_id)); $for_edit = $post->generate_text_for_edit(); $post->post_text = $for_edit['message'] . "\n\n\n\t\t\t\t[url=" . $repack_url . ']' . $this->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(); $this->queue->submit(); $this->queue->topic_reply('QUEUE_REPLY_ALLOW_REPACK'); $this->queue->submit(); redirect($this->queue->get_url()); } $message_object->display(); // Common stuff $this->template->assign_vars(array('S_POST_ACTION' => $this->helper->get_current_url(), 'L_POST_A' => $this->user->lang['DISCUSSION_REPLY_MESSAGE'])); return $this->helper->render('manage/queue_post.html', 'DISCUSSION_REPLY_MESSAGE'); }
/** * Create queue item * * @param bool $allow_repack Whether author has allowed repacking. * @param string $test_account Test account details. * @return null */ protected function create_queue_item($allow_repack, $test_account) { // Create the queue $this->revision->update_queue(); $this->queue = $this->revision->get_queue(); // Load the message object $this->get_message(); $this->queue->queue_allow_repack = $allow_repack; if ($test_account) { $this->queue->queue_notes .= "\n\n[b]" . $this->user->lang('TEST_ACCOUNT') . "[/b]\n" . $test_account; } $this->queue->submit(); }
/** * Update/create the queue entry for this revision */ public function update_queue() { // Create the queue entry if required, else update it if (titania::$config->use_queue && titania_types::$types[$this->contrib->contrib_type]->use_queue) { $queue = $this->get_queue(); // Only create the queue for revisions set as new if ($queue === false && $this->revision_status == TITANIA_REVISION_NEW) { $queue = new titania_queue(); } // If we have to create or update one... if ($queue !== false) { $queue->__set_array(array('revision_id' => $this->revision_id, 'contrib_id' => $this->contrib_id, 'contrib_name_clean' => $this->contrib->contrib_name_clean)); // Set the queue status to new if it's submitted and the queue status is set to hide it if ($this->revision_submitted && $queue->queue_status == TITANIA_QUEUE_HIDE) { // Only set the queue as new if there are not any newer revisions in the queue $sql = 'SELECT queue_id FROM ' . TITANIA_QUEUE_TABLE . ' WHERE contrib_id = ' . (int) $this->contrib_id . ' AND revision_id > ' . $this->revision_id; $result = phpbb::$db->sql_query($sql); if (!($row = phpbb::$db->sql_fetchrow($result))) { $queue->queue_status = TITANIA_QUEUE_NEW; } } $queue->submit(); // Set the revision queue id $this->revision_queue_id = $queue->queue_id; parent::submit(); if ($this->revision_submitted) { // Change the status on any old revisions that were in the queue and marked as New to repacked $sql = 'SELECT * FROM ' . TITANIA_QUEUE_TABLE . ' WHERE contrib_id = ' . (int) $this->contrib_id . ' AND revision_id < ' . $this->revision_id . ' AND queue_status = ' . TITANIA_QUEUE_NEW; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $queue = new titania_queue(); $queue->__set_array($row); $queue->close(TITANIA_REVISION_RESUBMITTED); unset($queue); } phpbb::$db->sql_freeresult($result); } } } }