Example #1
0
 protected function get_params(Query $query)
 {
     $this->set_param('is_variation_list', false);
     if (is_numeric($query->url(0))) {
         $this->set_param('mode', false);
         $this->set_param('id', $query->url(0));
         $this->id_art = $query->url(0);
     } else {
         if (!$query->get_pool_mode()) {
             if (!$query->is_variation_list() || !Session::getInstance()->is_moderator()) {
                 $this->disable();
             } else {
                 $this->set_param('is_variation_list', true);
                 $this->set_param('id', $query->get('parent'));
             }
         } else {
             $this->set_param('mode', $query->get_pool_mode());
             $this->set_param('id', $query->get_pool_value());
             if ($query->get_pool_mode() == 'artist') {
                 $this->id_artist = $query->get_pool_value();
             }
             if ($query->is_pool_full_view()) {
                 $this->set_param('is_list', true);
             } else {
                 $this->set_param('is_list', false);
                 $this->set_param('list_link', $query->get_pool_mode() . '=' . $query->get_pool_value() . '&per_page=all');
             }
         }
     }
     $this->set_param('moderator', Session::getInstance()->is_moderator());
 }
Example #2
0
File: List.php Project: 4otaku/art
 protected function get_modules(Query $query)
 {
     $return = array('title' => new HtmlArtTitle($query), 'search' => new HtmlArtSearch($query), 'error' => new HtmlArtError($query, true), 'list' => new Container(__NAMESPACE__ . '\\HtmlThumbnail' . ucfirst($query->mode())), 'tags' => new HtmlSidebarTag($query), 'tags_pool' => new HtmlSidebarTag($query), 'editmenu' => new HtmlSidebarEditmenu($query), 'editfield' => new HtmlArtEditfield($query), 'tools' => new HtmlSidebarTool($query), 'recent_comments' => new HtmlSidebarComment($query), 'paginator' => new HtmlArtPaginator($query));
     if ($query->is_pool_list()) {
         $return['tags']->set_pool_mode($query->mode());
         $return['tags_pool']->disable();
         $return['editmenu']->disable();
     } elseif ($query->get_pool_mode()) {
         $return['tags_pool']->set_pool_mode($query->get_pool_mode());
         $this->pool_tag_request = ['api' => 'art_' . $query->get_pool_mode(), 'id' => $query->get_pool_value()];
     } else {
         $return['tags_pool']->disable();
     }
     return $return;
 }
Example #3
0
File: Title.php Project: 4otaku/art
 protected function get_params(Query $query)
 {
     $search = array();
     $other = $query->other();
     $parsed = $query->parsed(false);
     if ($query->get_pool_mode()) {
         $search[] = array($query->get_pool_mode() => $query->get_pool_value());
     } elseif ($query->mode() != 'art') {
         $search[] = array('mode' => $query->mode());
     } else {
         if (!empty($other['approved']) && $other['approved'] != 'yes') {
             $search[] = array('approved' => $other['approved']);
         }
         if (!empty($other['tagged']) && $other['tagged'] != 'yes') {
             $search[] = array('tagged' => $other['tagged']);
         }
     }
     foreach ($parsed as $key => $data) {
         if (!empty($data['is'])) {
             $search[] = array($key . '_is' => $data['is']);
         }
     }
     foreach ($parsed as $key => $data) {
         if (!empty($data['more'])) {
             $search[] = array($key . '_more' => $data['more']);
         }
     }
     foreach ($parsed as $key => $data) {
         if (!empty($data['less'])) {
             $search[] = array($key . '_less' => $data['less']);
         }
     }
     foreach ($parsed as $key => $data) {
         if (!empty($data['not'])) {
             $search[] = array($key . '_not' => $data['not']);
         }
     }
     $other['sort'] = empty($other['sort']) ? 'date' : $other['sort'];
     $other['order'] = empty($other['order']) ? 'desc' : $other['order'];
     if ($other['order'] != 'desc' || $other['sort'] != 'date') {
         $search[] = array('sort' => $other['sort']);
         if ($other['sort'] != 'none' && $other['sort'] != 'random') {
             $search[] = array('order' => $other['order']);
         }
     }
     $primary = true;
     foreach ($search as &$part) {
         $value = reset($part);
         $function = 'word_' . key($part);
         if (is_callable(array($this, $function))) {
             $part = $this->{$function}($value, $primary);
             if ($primary) {
                 $part = $this->primary_transform($part);
             }
             $primary = false;
         } else {
             $part = null;
         }
     }
     $this->search = array_filter($search);
     if ($this->request === null) {
         $this->set_param('query', implode(', ', $this->search));
     }
 }
Example #4
0
File: Info.php Project: 4otaku/art
 protected function get_params(Query $query)
 {
     $this->set_param('query', $query->to_url_string());
     $this->set_param('pool_mode', $query->get_pool_mode());
     $this->set_param('pool_value', $query->get_pool_value());
 }