/** * Display support topics from all contributions or of a specific type. * * @param string $type Contribution type's string identifier * @return \Symfony\Component\HttpFoundation\Response */ public function display_topics($type) { $type_id = $this->get_type_id($type); if ($type_id === false) { return $this->helper->error('NO_PAGE', 404); } if ($type == 'all') { // Mark all topics read if ($this->request->variable('mark', '') == 'topics') { $this->tracking->track(TITANIA_ALL_SUPPORT, self::ALL_SUPPORT); } // Mark all topics read $this->template->assign_var('U_MARK_TOPICS', $this->helper->route('phpbb.titania.support', array('type' => 'all', 'mark' => 'topics'))); } $this->display->assign_global_vars(); $u_all_support = $this->helper->route('phpbb.titania.support', array('type' => 'all')); $this->template->assign_var('U_ALL_SUPPORT', $u_all_support); // Generate the main breadcrumbs $this->display->generate_breadcrumbs(array('ALL_SUPPORT' => $u_all_support)); // Links to the support topic lists foreach ($this->types->get_all() as $id => $class) { $this->template->assign_block_vars('support_types', array('U_SUPPORT' => $this->helper->route('phpbb.titania.support', array('type' => $class->url)), 'TYPE_SUPPORT' => $class->langs)); } $data = \topics_overlord::display_forums_complete('all_support', false, array('contrib_type' => $type_id)); // Canonical URL $data['sort']->set_url($this->helper->route('phpbb.titania.support', array('type' => $type))); $this->template->assign_var('U_CANONICAL', $data['sort']->build_canonical()); return $this->helper->render('all_support.html', 'CUSTOMISATION_DATABASE'); }
/** * Assign template variables for a given FAQ item. * * @param array $data Item data. * @param array $auth Array in form of array(edit => (bool), delete => (bool), move => (bool)) * specifying user's permissions. * @return null */ protected function assign_item_row_vars($data, $auth) { $this->faq->__set_array($data); // @todo probably should setup an edit time or something for better read tracking in case it was edited $folder_img = $folder_alt = ''; $unread = $this->tracking->get_track(TITANIA_FAQ, $data['faq_id'], true) === 0; $this->display->topic_folder_img($folder_img, $folder_alt, 0, $unread); $this->template->assign_block_vars('faqlist', array('U_FAQ' => $this->faq->get_url(), 'SUBJECT' => $data['faq_subject'], 'VIEWS' => $data['faq_views'], 'FOLDER_STYLE' => $folder_img, 'FOLDER_IMG' => $this->user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => $this->user->img($folder_img, $folder_alt, false, '', 'src'), 'FOLDER_IMG_ALT' => $this->user->lang[$folder_alt], 'FOLDER_IMG_ALT' => $this->user->lang[$folder_alt], 'FOLDER_IMG_WIDTH' => $this->user->img($folder_img, '', false, '', 'width'), 'FOLDER_IMG_HEIGHT' => $this->user->img($folder_img, '', false, '', 'height'), 'U_MOVE_UP' => $auth['move'] ? $this->faq->get_url('move_up') : false, 'U_MOVE_DOWN' => $auth['move'] ? $this->faq->get_url('move_down') : false, 'U_EDIT' => $auth['edit'] ? $this->faq->get_url('edit') : false, 'U_DELETE' => $auth['delete'] ? $this->faq->get_url('delete') : false, 'S_ACCESS_TEAMS' => $this->access->is_team($data['faq_access']), 'S_ACCESS_AUTHORS' => $this->access->is_author($data['faq_access']))); }
/** * Display queue discussion type. * * @param string $queue_type Queue type URL identifier. * @return \Symfony\Component\HttpFoundation\Response */ public function display_type($queue_type) { $type = $this->load_type($queue_type); if (!$type->acl_get('queue_discussion')) { return $this->helper->needs_auth(); } // Mark all topics read if ($this->request->variable('mark', '') == 'topics') { $this->tracking->track(TITANIA_QUEUE_DISCUSSION, self::ALL_TYPES); } $this->display->assign_global_vars(); $this->generate_navigation('queue_discussion'); // Add to Breadcrumbs $this->display->generate_breadcrumbs(array($type->lang => $this->get_type_url($type))); \topics_overlord::display_forums_complete('queue_discussion', false, array('topic_category' => $type->id)); // Mark all topics read $this->template->assign_var('U_MARK_TOPICS', $this->get_type_url($type, array('mark' => 'topics'))); return $this->helper->render('manage/queue_discussion.html', 'QUEUE_DISCUSSION'); }
/** * Display author's support topics page. * * @return \Symfony\Component\HttpFoundation\Response */ protected function support() { if (!$this->is_owner) { return $this->helper->needs_auth(); } // Mark all topics read if ($this->request->variable('mark', '') == 'topics') { foreach ($this->cache->get_author_contribs($this->author->user_id, $this->types, $this->user) as $contrib_id) { $this->tracking->track(TITANIA_SUPPORT, $contrib_id); } } \topics_overlord::display_forums_complete('author_support', $this->author); // Mark all topics read $this->template->assign_var('U_MARK_TOPICS', $this->author->get_url('support', array('mark' => 'topics'))); return $this->helper->render('contributions/contribution_support.html', $this->get_title('AUTHOR_SUPPORT')); }
/** * Details page. * * @return \Symfony\Component\HttpFoundation\Response */ protected function details() { $this->contrib->get_download(); $this->contrib->get_revisions(); $this->contrib->get_screenshots(); $this->contrib->get_rating(); $this->contrib->assign_details(); if (!$this->user->data['is_bot']) { $this->contrib->increase_view_counter(); } // Set tracking $this->tracking->track(TITANIA_CONTRIB, $this->contrib->contrib_id); // Subscriptions $this->subscriptions->handle_subscriptions(TITANIA_CONTRIB, $this->contrib->contrib_id, $this->contrib->get_url(), 'SUBSCRIBE_CONTRIB'); // Canonical URL $this->template->assign_var('U_CANONICAL', $this->contrib->get_url()); return $this->helper->render('contributions/contribution_details.html', $this->contrib->contrib_name . ' - ' . $this->user->lang['CONTRIB_DETAILS']); }
/** * Get topic template row. * * @param array $row * @return array */ protected function get_topic_tpl_row($row) { $topic = new \titania_topic(); $topic->__set_array($row); $additional_unread_fields = array(array('type' => TITANIA_SUPPORT, 'id' => 0), array('type' => TITANIA_SUPPORT, 'parent_match' => true), array('type' => TITANIA_QUEUE_DISCUSSION, 'id' => 0, 'type_match' => true)); $topic->additional_unread_fields = array_merge($topic->additional_unread_fields, $additional_unread_fields); $subscription_target = ''; $type_lang = array(TITANIA_QUEUE_DISCUSSION => 'SUBSCRIPTION_QUEUE_VALIDATION', TITANIA_QUEUE => 'SUBSCRIPTION_QUEUE', TITANIA_SUPPORT => 'SUBSCRIPTION_SUPPORT_TOPIC'); if (isset($type_lang[$row['topic_type']])) { $subscription_target = $this->user->lang($type_lang[$row['topic_type']]); } // Tracking check $last_read_mark = $this->tracking->get_track(TITANIA_TOPIC, $topic->topic_id, true); $last_read_mark = max($last_read_mark, $this->tracking->find_last_read_mark($topic->additional_unread_fields, $topic->topic_type, $topic->parent_id)); $topic->unread = $topic->topic_last_post_time > $last_read_mark; // Get the folder image $topic->topic_folder_img($folder_img, $folder_alt); return array('FOLDER_STYLE' => $folder_img, 'LAST_POST_IMG' => $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'SUBSCRIPTION_AUTHOR_FULL' => \users_overlord::get_user($row['topic_first_post_user_id'], '_full'), 'SUBSCRIPTION_ID' => $row['topic_id'], 'SUBSCRIPTION_LAST_AUTHOR_FULL' => \users_overlord::get_user($row['topic_last_post_user_id'], '_full'), 'SUBSCRIPTION_LAST_TIME' => $this->user->format_date($row['topic_last_post_time']), 'SUBSCRIPTION_TIME' => $this->user->format_date($row['topic_time']), 'SUBSCRIPTION_TARGET' => $subscription_target, 'SUBSCRIPTION_TITLE' => censor_text($row['topic_subject']), 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'U_VIEW_SUBSCRIPTION' => $this->get_real_url($topic->get_url()), 'U_VIEW_LAST_POST' => $this->get_real_url($topic->get_url(false, array('p' => $topic->topic_last_post_id, '#' => 'p' . $topic->topic_last_post_id))), 'S_ACCESS_TEAMS' => $row['topic_access'] == access::TEAM_LEVEL || $row['topic_type'] == TITANIA_QUEUE, 'S_ACCESS_AUTHORS' => $row['topic_access'] == access::AUTHOR_LEVEL, 'S_TOPIC' => true); }
/** * Display the main index page. * * @return \Symfony\Component\HttpFoundation\Response */ public function display_index($branch) { $this->set_branch($branch); $title = $this->user->lang('CUSTOMISATION_DATABASE'); $sort = $this->list_contributions('', self::ALL_CONTRIBS, ''); $this->params = $this->get_params($sort); $this->display->assign_global_vars(); if ($this->request->is_ajax()) { return $this->get_ajax_response($title, $sort); } $this->display->display_categories(self::ALL_CONTRIBS, 'categories', false, true, $this->params); // Mark all contribs read if ($this->request->variable('mark', '') == 'contribs') { $this->tracking->track(TITANIA_CONTRIB, self::ALL_CONTRIBS); } $this->template->assign_vars(array('CATEGORY_ID' => self::ALL_CONTRIBS, 'U_CREATE_CONTRIBUTION' => $this->get_create_contrib_url(), 'U_MARK_FORUMS' => $this->path_helper->append_url_params($this->helper->get_current_url(), array('mark' => 'contribs')), 'L_MARK_FORUMS_READ' => $this->user->lang['MARK_CONTRIBS_READ'], 'U_ALL_CONTRIBUTIONS' => $this->get_index_url($this->params), 'S_DISPLAY_SEARCHBOX' => true, 'S_SEARCHBOX_ACTION' => $this->helper->route('phpbb.titania.search.contributions.results'))); $this->assign_sorting($sort); $this->assign_branches(); return $this->helper->render('index_body.html', $title); }
/** * Display support page. * * @param string $contrib_type Contrib type URL identifier. * @param string $contrib Contrib name clean. * * @return \Symfony\Component\HttpFoundation\Response */ public function display_support($contrib_type, $contrib) { $this->load_contrib($contrib_type, $contrib); if (!$this->check_auth()) { return $this->helper->needs_auth(); } $this->user->add_lang('viewforum'); // Subscriptions $this->subscriptions->handle_subscriptions(TITANIA_SUPPORT, $this->contrib->contrib_id, $this->contrib->get_url('support'), 'SUBSCRIBE_SUPPORT'); // Mark all topics read if ($this->request->variable('mark', '') == 'topics') { $this->tracking->track(TITANIA_SUPPORT, $this->contrib->contrib_id); } $can_post_topic = $this->ext_config->support_in_titania && $this->auth->acl_get('u_titania_topic'); $data = \topics_overlord::display_forums_complete('support', $this->contrib); $data['sort']->set_url($this->contrib->get_url('support')); $this->template->assign_vars(array('U_POST_TOPIC' => $can_post_topic ? $this->contrib->get_url('posting') : '', 'U_MARK_TOPICS' => $this->contrib->get_url('support', array('mark' => 'topics')), 'U_CANONICAL' => $data['sort']->build_canonical(), 'S_DISPLAY_SEARCHBOX' => true, 'S_SEARCHBOX_ACTION' => $this->helper->route('phpbb.titania.search.results'), 'SEARCH_HIDDEN_FIELDS' => build_hidden_fields(array('type' => TITANIA_SUPPORT, 'contrib' => $this->contrib->contrib_id)))); $this->assign_vars(); return $this->helper->render('contributions/contribution_support.html', $this->contrib->contrib_name . ' - ' . $this->user->lang['CONTRIB_SUPPORT']); }
/** * Assign details * * A little different from those in other classes, this one only returns the info ready for output */ public function assign_details() { // Tracking check $last_read_mark = $this->tracking->get_track(TITANIA_TOPIC, $this->topic_id, true); $last_read_mark = max($last_read_mark, $this->tracking->find_last_read_mark($this->additional_unread_fields, $this->topic_type, $this->parent_id)); $this->unread = $this->topic_last_post_time > $last_read_mark ? true : false; $folder_img = $folder_alt = ''; $this->topic_folder_img($folder_img, $folder_alt); // To find out if we have any posts that need approval $approved = count::from_db($this->topic_posts, count::get_flags(access::PUBLIC_LEVEL, false, false)); $total = count::from_db($this->topic_posts, count::get_flags(access::PUBLIC_LEVEL, false, true)); $u_new_post = ''; if ($this->unread) { $u_new_post = $this->get_url(false, array('view' => 'unread', '#' => 'unread')); } $details = array('TOPIC_ID' => $this->topic_id, 'TOPIC_TYPE' => $this->topic_type, 'TOPIC_ACCESS' => $this->topic_access, 'TOPIC_STATUS' => $this->topic_status, 'TOPIC_STICKY' => $this->topic_sticky, 'TOPIC_LOCKED' => $this->topic_locked, 'POSTS_APPROVED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') && $total > $approved ? false : true, 'TOPIC_APPROVED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->topic_approved : true, 'TOPIC_REPORTED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->topic_reported : false, 'TOPIC_ASSIGNED' => $this->topic_assigned, 'TOPIC_REPLIES' => $this->get_postcount() - 1, 'TOPIC_VIEWS' => $this->topic_views, 'TOPIC_SUBJECT' => censor_text($this->topic_subject), 'TOPIC_FIRST_POST_ID' => $this->topic_first_post_id, 'TOPIC_FIRST_POST_USER_ID' => $this->topic_first_post_user_id, 'TOPIC_FIRST_POST_USER_COLOUR' => $this->topic_first_post_user_colour, 'TOPIC_FIRST_POST_USER_FULL' => get_username_string('full', $this->topic_first_post_user_id, $this->topic_first_post_username, $this->topic_first_post_user_colour, false, phpbb::append_sid('memberlist', 'mode=viewprofile')), 'TOPIC_FIRST_POST_TIME' => phpbb::$user->format_date($this->topic_first_post_time), 'TOPIC_LAST_POST_ID' => $this->topic_last_post_id, 'TOPIC_LAST_POST_USER_ID' => $this->topic_last_post_user_id, 'TOPIC_LAST_POST_USER_COLOUR' => $this->topic_last_post_user_colour, 'TOPIC_LAST_POST_USER_FULL' => get_username_string('full', $this->topic_last_post_user_id, $this->topic_last_post_username, $this->topic_last_post_user_colour, false, phpbb::append_sid('memberlist', 'mode=viewprofile')), 'TOPIC_LAST_POST_TIME' => phpbb::$user->format_date($this->topic_last_post_time), 'TOPIC_LAST_POST_SUBJECT' => censor_text($this->topic_last_post_subject), 'U_NEWEST_POST' => $u_new_post, 'U_VIEW_TOPIC' => $this->get_url(), 'U_VIEW_LAST_POST' => $this->get_url(false, array('p' => $this->topic_last_post_id, '#' => 'p' . $this->topic_last_post_id)), 'S_UNREAD_TOPIC' => $this->unread ? true : false, 'S_ACCESS_TEAMS' => $this->topic_access == access::TEAM_LEVEL ? true : false, 'S_ACCESS_AUTHORS' => $this->topic_access == access::AUTHOR_LEVEL ? true : false, 'FOLDER_STYLE' => $folder_img, 'FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, false, '', 'src'), 'FOLDER_IMG_ALT' => phpbb::$user->lang[$folder_alt], 'FOLDER_IMG_WIDTH' => phpbb::$user->img($folder_img, '', false, '', 'width'), 'FOLDER_IMG_HEIGHT' => phpbb::$user->img($folder_img, '', false, '', 'height')); // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $details, $this); return $details; }