Esempio n. 1
0
 /**
  * URL rewritting for search.php
  */
 public function search()
 {
     if (isset($this->core->get_vars['fid'])) {
         $this->core->get_vars = array();
         $this->core->url = $this->core->url_in;
         return;
     }
     $this->core->path = $this->core->seo_path['phpbb_urlR'];
     $user_id = !empty($this->core->get_vars['author_id']) ? $this->core->get_vars['author_id'] : (isset($this->core->seo_url['username'][rawurldecode(@$this->core->get_vars['author'])]) ? $this->core->seo_url['username'][rawurldecode(@$this->core->get_vars['author'])] : 0);
     if ($user_id && isset($this->core->seo_url['user'][$user_id])) {
         $sr = @$this->core->get_vars['sr'] == 'topics' ? 'topics' : 'posts';
         $paginate_method_name = $this->core->paginate_method['user'];
         // Filter default params
         $this->core->filter_get_var($this->core->get_filter['search']);
         $this->core->{$paginate_method_name}($this->core->seo_ext['user']);
         $this->core->url = $this->core->seo_url['user'][$user_id] . $this->core->seo_delim['sr'] . $sr . $this->core->start;
         unset($this->core->get_vars['author_id'], $this->core->get_vars['author'], $this->core->get_vars['sr']);
         return;
     } else {
         if ($this->core->seo_opt['profile_noids'] && !empty($this->core->get_vars['author'])) {
             $sr = @$this->core->get_vars['sr'] == 'topics' ? '/topics' : '/posts';
             // Filter default params
             $this->core->filter_get_var($this->core->get_filter['search']);
             $this->core->rewrite_pagination_page();
             $this->core->url = $this->core->seo_static['user'] . '/' . $this->core->seo_url_encode($this->core->get_vars['author']) . $sr . $this->core->start;
             unset($this->core->get_vars['author'], $this->core->get_vars['author_id'], $this->core->get_vars['sr']);
             return;
         } else {
             if (!empty($this->core->get_vars['search_id'])) {
                 switch ($this->core->get_vars['search_id']) {
                     case 'active_topics':
                         $paginate_method_name = $this->core->paginate_method['atopic'];
                         $this->core->filter_get_var($this->core->get_filter['search']);
                         $this->core->{$paginate_method_name}($this->core->seo_ext['atopic']);
                         $this->core->url = $this->core->seo_static['atopic'] . $this->core->start;
                         unset($this->core->get_vars['search_id'], $this->core->get_vars['sr']);
                         if (@$this->core->get_vars['st'] == 7) {
                             unset($this->core->get_vars['st']);
                         }
                         return;
                     case 'unanswered':
                         $paginate_method_name = $this->core->paginate_method['utopic'];
                         $this->core->filter_get_var($this->core->get_filter['search']);
                         $this->core->{$paginate_method_name}($this->core->seo_ext['utopic']);
                         $this->core->url = $this->core->seo_static['utopic'] . $this->core->start;
                         unset($this->core->get_vars['search_id']);
                         if (@$this->core->get_vars['sr'] == 'topics') {
                             unset($this->core->get_vars['sr']);
                         }
                         return;
                     case 'egosearch':
                         $this->core->set_user_url($this->user->data['username'], $this->user->data['user_id']);
                         $this->core->url = $this->core->seo_url['user'][$this->user->data['user_id']] . $this->core->seo_delim['sr'] . 'topics' . $this->core->seo_ext['user'];
                         unset($this->core->get_vars['search_id']);
                         return;
                     case 'newposts':
                         $paginate_method_name = $this->core->paginate_method['npost'];
                         $this->core->filter_get_var($this->core->get_filter['search']);
                         $this->core->{$paginate_method_name}($this->core->seo_ext['npost']);
                         $this->core->url = $this->core->seo_static['npost'] . $this->core->start;
                         unset($this->core->get_vars['search_id']);
                         if (@$this->core->get_vars['sr'] == 'topics') {
                             unset($this->core->get_vars['sr']);
                         }
                         return;
                     case 'unreadposts':
                         $paginate_method_name = $this->core->paginate_method['urpost'];
                         $this->core->filter_get_var($this->core->get_filter['search']);
                         $this->core->{$paginate_method_name}($this->core->seo_ext['urpost']);
                         $this->core->url = $this->core->seo_static['urpost'] . $this->core->start;
                         unset($this->core->get_vars['search_id']);
                         if (@$this->core->get_vars['sr'] == 'topics') {
                             unset($this->core->get_vars['sr']);
                         }
                         return;
                 }
             }
         }
     }
     $this->core->path = $this->core->seo_path['phpbb_url'];
     return;
 }