예제 #1
0
 public function overwrite_template_vars($event)
 {
     if (!$this->in_titania) {
         return;
     }
     $this->template->assign_vars(array('U_FAQ' => $this->controller_helper->route('phpbb.titania.faq'), 'U_SEARCH' => $this->controller_helper->route('phpbb.titania.search')));
     if ($this->user->data['user_id'] == ANONYMOUS) {
         $this->template->assign_vars(array('U_LOGIN_LOGOUT' => append_sid("{$this->phpbb_root_path}ucp.{$this->php_ext}", array('mode' => 'login', 'redirect' => urlencode($this->controller_helper->get_current_url())))));
     }
 }
예제 #2
0
 /**
  * Act on a posting action.
  *
  * @param \titania_contribution|null	$contrib
  * @param string $action
  * @param int $topic_id
  * @param string $template_body
  * @param int|bool $parent_id
  * @param array|bool $parent_url
  * @param int|bool $post_type
  * @param string|bool $s_post_action
  * @return JsonResponse|RedirectResponse|Response
  * @throws \LogicException
  */
 public function act($contrib, $action, $topic_id, $template_body, $parent_id = false, $parent_url = false, $post_type = false, $s_post_action = false)
 {
     $this->user->add_lang_ext('phpbb/titania', 'posting');
     $this->contrib = $contrib;
     $this->template_file = $template_body;
     $post_id = $this->request->variable('p', 0);
     switch ($action) {
         case 'post':
             if ($parent_id === false || $parent_url == false || $post_type === false) {
                 throw new \LogicException('Must send parent_id, parent_url, and new post type to allow posting new topics');
             }
             $s_post_action = $s_post_action === false ? $this->controller_helper->get_current_url() : $s_post_action;
             return $this->post($parent_id, $parent_url, $post_type, $s_post_action);
             break;
         case 'edit':
         case 'quick_edit':
         case 'delete':
         case 'undelete':
         case 'report':
             return $this->{$action}($post_id);
             break;
         case 'quote':
             return $this->reply($topic_id, $post_id);
             break;
         case 'sticky_topic':
         case 'unsticky_topic':
             return $this->toggle_sticky($topic_id);
             break;
         case 'reply':
         case 'lock_topic':
         case 'unlock_topic':
         case 'delete_topic':
         case 'undelete_topic':
             return $this->{$action}($topic_id);
             break;
         case 'split_topic':
         case 'move_posts':
             return $this->split_topic($topic_id, $action);
             break;
         case 'hard_delete_topic':
             return $this->delete_topic($topic_id, true);
             break;
     }
 }
예제 #3
0
 /**
  * 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);
 }
예제 #4
0
 /**
  * Assign result page template variables.
  *
  * @param int $match_count		Number of matches found.
  * @return null
  */
 protected function assign_result_vars($match_count)
 {
     $this->template->assign_vars(array('SEARCH_WORDS' => $this->request->variable('keywords', '', true), 'SEARCH_MATCHES' => $this->user->lang('FOUND_SEARCH_MATCHES', $match_count), 'U_SEARCH_WORDS' => $this->helper->get_current_url(), 'S_IN_SEARCH' => true, 'S_SEARCH_ACTION' => $this->helper->get_current_url()));
 }