Beispiel #1
0
 /**
  * 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');
 }
Beispiel #2
0
 public function display_list()
 {
     $this->user->add_lang_ext('phpbb/titania', 'faq', false, true);
     /**
      * From phpBB faq.php
      */
     // Pull the array data from the lang pack
     $switch_column = $found_switch = false;
     $help_blocks = array();
     foreach ($this->user->help as $help_ary) {
         if ($help_ary[0] == '--') {
             if ($help_ary[1] == '--') {
                 $switch_column = true;
                 $found_switch = true;
                 continue;
             }
             $this->template->assign_block_vars('faq_block', array('BLOCK_TITLE' => $help_ary[1], 'SWITCH_COLUMN' => $switch_column));
             if ($switch_column) {
                 $switch_column = false;
             }
             continue;
         }
         $this->template->assign_block_vars('faq_block.faq_row', array('FAQ_QUESTION' => $help_ary[0], 'FAQ_ANSWER' => $help_ary[1]));
     }
     // Lets build a page ...
     $this->template->assign_vars(array('L_FAQ_TITLE' => $this->user->lang['FAQ_EXPLAIN'], 'L_BACK_TO_TOP' => $this->user->lang['BACK_TO_TOP'], 'SWITCH_COLUMN_MANUALLY' => !$found_switch));
     $this->display->assign_global_vars();
     return $this->helper->render('faq_body.html', 'FAQ_EXPLAIN');
 }
Beispiel #3
0
 /**
  * Perform search and output results.
  *
  * @param string $sort_url		Base sort url.
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function show_results($sort_url)
 {
     // Setup the sort tool
     $this->sort->set_defaults($this->config['posts_per_page'])->request();
     // Do the search
     $results = $this->query_index();
     // Grab the users
     \users_overlord::load_users($results['user_ids']);
     $this->display->assign_global_vars();
     $this->assign_doc_vars($results['documents']);
     $this->assign_result_vars($this->sort->total);
     $parameters = array();
     $expected_parameters = array('versions' => array(array(''), false), 'c' => array(array(0), false), 'sc' => array(false, false), 'keywords' => array('', true), 'sf' => array('', false), 'author' => array('', true), 'u' => array(0, false), 'type' => array(0, false), 'contrib' => array(0, false));
     foreach ($expected_parameters as $name => $properties) {
         if ($this->request->is_set($name)) {
             list($default_value, $multibyte) = $properties;
             $value = $this->request->variable($name, $default_value, $multibyte);
             // Clean up URL by not including default values.
             if ($value !== $default_value) {
                 $parameters[$name] = $value;
             }
         }
     }
     $this->sort->build_pagination($sort_url, $parameters);
     return $this->helper->render('search_results.html', $this->user->lang['SEARCH']);
 }
Beispiel #4
0
 /**
  * Display a category, its children, and its contributions.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function display_category($category1, $category2, $category3, $category4)
 {
     $categories = array($category1, $category2, $category3, $category4);
     try {
         $this->load_category($categories);
     } catch (\Exception $e) {
         // If the category does not exist, check whether this is an old link
         // that may have been caught by the route matcher.
         $rerouter = new \phpbb\titania\controller\legacy_rerouter($this->helper);
         $url = '/' . implode('/', array_filter($categories, 'strlen'));
         return $rerouter->redirect($url);
     }
     $this->set_branch($this->get_branch($categories));
     $children = $this->get_children_ids();
     // Include the current category in the ones selected
     $children[] = $this->id;
     $sort = $this->list_contributions($children, $this->category->get_url());
     $this->params = $this->get_params($sort);
     $title = $this->category->get_name() . ' - ' . $this->user->lang['CUSTOMISATION_DATABASE'];
     $this->display->assign_global_vars();
     $this->generate_breadcrumbs();
     if ($this->request->is_ajax()) {
         return $this->get_ajax_response($title, $sort);
     }
     $this->display->display_categories($this->id, 'categories', false, true, $this->params);
     $this->template->assign_vars(array('CATEGORY_ID' => $this->id, 'S_DISPLAY_SEARCHBOX' => true, 'S_SEARCHBOX_ACTION' => $this->helper->route('phpbb.titania.search.contributions.results'), 'U_QUEUE_STATS' => $this->get_queue_stats_url(), 'U_CREATE_CONTRIBUTION' => $this->get_create_contrib_url(), 'U_ALL_CONTRIBUTIONS' => $this->get_index_url($this->params)));
     $this->assign_sorting($sort);
     $this->assign_branches();
     return $this->helper->render('index_body.html', $title);
 }
 /**
  * Display queue stats.
  *
  * @param string $contrib_type	Contribution type URL value.
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function display_stats($contrib_type)
 {
     $this->user->add_lang_ext('phpbb/titania', array('queue_stats', 'contributions'));
     $this->set_type($contrib_type);
     if (!$this->stats_supported()) {
         return $this->helper->error('NO_QUEUE_STATS');
     }
     $this->stats->set_queue_type($this->type->id);
     if (!$this->generate_stats()) {
         return $this->helper->error('NO_QUEUE_STATS');
     }
     $this->generate_history();
     $this->display->assign_global_vars();
     $page_title = $this->user->lang['QUEUE_STATS'] . ' - ' . $this->type->langs;
     $this->display->generate_breadcrumbs(array($page_title => $this->helper->route('phpbb.titania.queue_stats', array('contrib_type' => $this->type->url))));
     return $this->helper->render('queue_stats_body.html', $page_title);
 }
Beispiel #6
0
 /**
  * Delegates requested page to appropriate method.
  *
  * @param string $author		Author's username clean value.
  * @param string $page		Requested page.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function base($author, $page)
 {
     $page = $page ?: 'details';
     if (!in_array($page, array('details', 'contributions', 'support', 'create', 'manage'))) {
         return $this->helper->error('NO_PAGE', 404);
     }
     $author = urldecode($author);
     $this->load_author($author);
     $this->display->assign_global_vars();
     $this->generate_navigation($page);
     $this->author->assign_details();
     return $this->{$page}();
 }