titania::$contrib->assign_details(true); if (!titania::$config->support_in_titania && titania::$access_level == TITANIA_ACCESS_PUBLIC) { titania::needs_auth(); } // Handle replying/editing/etc $posting_helper = new titania_posting(); $posting_helper->act('contributions/contribution_support_post.html', titania::$contrib->contrib_id, titania::$contrib->get_url('support'), TITANIA_SUPPORT); phpbb::$user->add_lang('viewforum'); if ($topic_id) { // Subscriptions titania_subscriptions::handle_subscriptions(TITANIA_TOPIC, $topic_id, $topic->get_url()); // Check access level if ($topic->topic_access < titania::$access_level || $topic->topic_type == TITANIA_QUEUE_DISCUSSION && !titania::$contrib->is_author && !titania::$contrib->is_active_coauthor && !titania_types::$types[titania::$contrib->contrib_type]->acl_get('queue_discussion')) { titania::needs_auth(); } posts_overlord::display_topic_complete($topic); titania::page_header(censor_text($topic->topic_subject) . ' - ' . titania::$contrib->contrib_name); if (phpbb::$auth->acl_get('u_titania_post')) { phpbb::$template->assign_var('U_POST_REPLY', titania_url::append_url($topic->get_url(), array('action' => 'reply'))); } // Canonical URL phpbb::$template->assign_var('U_CANONICAL', $topic->get_url()); } else { // Subscriptions titania_subscriptions::handle_subscriptions(TITANIA_SUPPORT, titania::$contrib->contrib_id, titania::$contrib->get_url('support')); // Mark all topics read if (request_var('mark', '') == 'topics') { titania_tracking::track(TITANIA_SUPPORT, titania::$contrib->contrib_id); } $data = topics_overlord::display_forums_complete('support', titania::$contrib); titania::page_header(titania::$contrib->contrib_name . ' - ' . phpbb::$user->lang['CONTRIB_SUPPORT']);
protected function common_delete($post_id, $undelete = false) { $this->user->add_lang('posting'); // Load the stuff we need $post = $this->load_post($post_id); // Check permissions if (!$undelete && !$post->acl_get('delete') || $undelete && !$post->acl_get('undelete')) { return $this->controller_helper->needs_auth(); } if (confirm_box(true)) { if (!$undelete) { // Delete the post if ($this->request->is_set_post('hard_delete') || $post->post_deleted) { if (!$this->auth->acl_get('u_titania_post_hard_delete')) { return $this->controller_helper->needs_auth(); } $post->hard_delete(); // Try to redirect to the next or previous post $redirect_post_id = \posts_overlord::next_prev_post_id($post->topic_id, $post->post_id); if ($redirect_post_id) { return new RedirectResponse($post->topic->get_url(false, array('p' => $redirect_post_id, '#' => "p{$redirect_post_id}"))); } return new RedirectResponse($post->topic->get_parent_url()); } else { $post->soft_delete(); if ($this->auth->acl_get('u_titania_mod_post_mod')) { // They can see the post, redirect back to it return new RedirectResponse($post->get_url()); } else { // They cannot see the post, try to redirect to the next or previous post $redirect_post_id = \posts_overlord::next_prev_post_id($post->topic_id, $post->post_id); if ($redirect_post_id) { return new RedirectResponse($post->topic->get_url(false, array('p' => $redirect_post_id, '#' => "p{$redirect_post_id}"))); } } } return new RedirectResponse($post->topic->get_url()); } else { $post->undelete(); return new RedirectResponse($post->get_url()); } } else { $s_hard_delete = !$undelete && !$post->post_deleted && $this->auth->acl_get('u_titania_post_hard_delete'); $this->template->assign_var('S_HARD_DELETE', $s_hard_delete); confirm_box(false, !$undelete ? 'DELETE_POST' : 'UNDELETE_POST', '', 'posting/delete_confirm.html'); } return new RedirectResponse($post->get_url()); }
/** * Display queue topic review. * * @return null */ protected function display_topic_review() { // Setup the sort tool $topic_sort = \posts_overlord::build_sort(); $topic_sort->set_defaults(false, false, 'd'); // Load the topic $topic = new \titania_topic(); $topic->load($this->queue->queue_topic_id); // Display the posts for review \posts_overlord::display_topic($topic, $topic_sort); }
} $queue->move($new_tag); } else { // Generate the list of tags we can move it to $extra = '<select name="id">'; foreach ($tags as $tag_id => $row) { $extra .= '<option value="' . $tag_id . '">' . (isset(phpbb::$user->lang[$row['tag_field_name']]) ? phpbb::$user->lang[$row['tag_field_name']] : $row['tag_field_name']) . '</option>'; } $extra .= '</select>'; phpbb::$template->assign_var('CONFIRM_EXTRA', $extra); titania::confirm_box(false, 'MOVE_QUEUE'); } redirect(titania_url::append_url($base_url, array('q' => $queue->queue_id))); break; } // Display the main queue item $data = queue_overlord::display_queue_item($queue_id); // Handle replying/editing/etc $posting_helper = new titania_posting(); $posting_helper->act('manage/queue_post.html'); // Display the posts in the queue (after the posting helper acts) posts_overlord::display_topic_complete($data['topic']); titania::page_header(queue_overlord::$queue[$queue_id]['topic_subject']); } else { // Subscriptions titania_subscriptions::handle_subscriptions(TITANIA_QUEUE, $queue_type, titania_url::$current_page_url); queue_overlord::display_queue($queue_type, $tag); queue_overlord::display_categories($queue_type, $tag); titania::page_header('VALIDATION_QUEUE'); } titania::page_footer(true, 'manage/queue.html');
private function common_delete($post_id, $undelete = false) { titania::add_lang('posting'); phpbb::$user->add_lang('posting'); // Load the stuff we need $post_object = $this->load_post($post_id); // Check permissions if (!$undelete && !$post_object->acl_get('delete') || $undelete && !$post_object->acl_get('undelete')) { titania::needs_auth(); } if (titania::confirm_box(true)) { if (!$undelete) { $redirect_post_id = false; // Delete the post if (isset($_POST['hard_delete']) || $post_object->post_deleted) { if (!phpbb::$auth->acl_get('u_titania_post_hard_delete')) { titania::needs_auth(); } $post_object->hard_delete(); // Try to redirect to the next or previous post $redirect_post_id = posts_overlord::next_prev_post_id($post_object->topic_id, $post_object->post_id); if ($redirect_post_id) { redirect(titania_url::append_url($post_object->topic->get_url(), array('p' => $redirect_post_id, '#p' => $redirect_post_id))); } redirect(titania_url::build_url($post_object->topic->topic_url)); } else { $post_object->soft_delete(); if (phpbb::$auth->acl_get('u_titania_mod_post_mod')) { // They can see the post, redirect back to it redirect($post_object->get_url()); } else { // They cannot see the post, try to redirect to the next or previous post $redirect_post_id = posts_overlord::next_prev_post_id($post_object->topic_id, $post_object->post_id); if ($redirect_post_id) { redirect(titania_url::append_url($post_object->topic->get_url(), array('p' => $redirect_post_id, '#p' => $redirect_post_id))); } } } redirect($post_object->topic->get_url()); } else { $post_object->undelete(); redirect($post_object->get_url()); } } else { phpbb::$template->assign_var('S_HARD_DELETE', !$undelete && !$post_object->post_deleted && phpbb::$auth->acl_get('u_titania_post_hard_delete') ? true : false); titania::confirm_box(false, !$undelete ? 'DELETE_POST' : 'UNDELETE_POST', '', array(), 'posting/delete_confirm.html'); } redirect($post_object->get_url()); }
/** * Display topic. * * @param string $contrib_type Contrib type URL identifier. * @param string $contrib Contrib name clean. * @param int $topic_id Topic id. * * @return \Symfony\Component\HttpFoundation\Response */ public function display_topic($contrib_type, $contrib, $topic_id) { // Load the contrib item $this->load_contrib($contrib_type, $contrib); $this->load_topic($topic_id); if (!$this->check_auth(true)) { return $this->helper->needs_auth(); } $this->user->add_lang('viewforum'); // Subscriptions $this->subscriptions->handle_subscriptions(TITANIA_TOPIC, $topic_id, $this->topic->get_url(), 'SUBSCRIBE_TOPIC'); \posts_overlord::display_topic_complete($this->topic); $this->template->assign_vars(array('U_CANONICAL' => $this->topic->get_url(), 'U_POST_REPLY' => $this->auth->acl_get('u_titania_post') ? $this->topic->get_url('reply') : '')); $this->assign_vars(); return $this->helper->render('contributions/contribution_support.html', censor_text($this->topic->topic_subject) . ' - ' . $this->contrib->contrib_name); }
/** * Display the complete queue item (includes the topic) * * @param int $queue_id * @return array data from display_queue_item */ public static function display_queue_item_complete($queue_id) { $data = self::display_queue_item($queue_id); // Display the posts posts_overlord::display_topic_complete($data['topic']); return $data; }