protected function get_modules(Query $query) { if ($query->url(0) == 'slideshow') { return array('body' => new HtmlSlideshow($query)); } return array('header' => new HtmlHeader($query), 'body' => new HtmlBody($query), 'footer' => new HtmlFooter($query)); }
protected function get_modules(Query $query) { $url = $query->url(); array_shift($url); $url = array_filter($url); if (empty($url)) { return array(); } $last = array_pop($url); $last = preg_replace_callback('/_([a-z])/', function($res){ return strtoupper($res[1]); }, $last); $url[] = $last; $class = implode('', array_map('ucfirst', $url)); $class = \Autoload::getDefaultNamespace() . '\Module\Ajax' . $class; if (!class_exists($class)) { if ($query->get('format') == 'json') { return new AjaxJsonError($query); } else { return new AjaxError($query); } } return new $class($query); }
protected function get_params(Query $query) { if (Session::getInstance()->is_moderator()) { Database::replace('help', array('key' => 'add', 'text' => (string) $query->get('text')), array('key')); } $this->set_success(true); }
protected function get_params(Query $query) { $this->set_param('query', $query->to_url_string()); $this->set_param('id', $query->url(0)); $this->set_param('next', false); $this->set_param('prev', false); }
protected function get_params(Query $query) { $parsed = $query->parsed(); if (!empty($parsed['tag']['is'])) { $this->set_param('tags', implode(' ', $parsed['tag']['is']) . ' '); } else { $this->set_param('tags', ''); } }
protected function get_params(Query $query) { $id = $query->get('id'); if (empty($id)) { $this->set_error(420); return; } Database::delete('head_menu_user', $id); $this->set_success(true); }
protected function get_params(Query $query) { $this->set_param('query', $query->to_url_string()); $this->set_param('start', max(1, $query->get('start'))); $this->set_param('auto', Config::getInstance()->get('slideshow', 'auto')); $delay = Config::getInstance()->get('slideshow', 'delay'); if ($delay < 10) { $delay = '0' . $delay; } $this->set_param('delay', $delay); }
protected function get_params(Query $query) { if ($query->get('page')) { $this->page = (int) $query->get('page'); } $this->base_url = '/' . implode('/', $query->url()) . '?'; $get = $query->get(); unset($get['page']); foreach ($get as $key => $value) { $this->base_url .= $key . '=' . $value . '&'; } }
protected function get_modules(Query $query) { if ($query->url(0) == 'download') { return new Download($query); } if ($query->url(0) == 'ajax') { return new Ajax($query); } if ($query->url(0) == 'rss') { return new Rss($query); } return new Html($query); }
protected function get_modules(Query $query) { $type = (string) $query->get('type'); $type = explode('_', $type); $type = implode('', array_map('ucfirst', $type)); $class = \Autoload::getDefaultNamespace() . '\Module\Download' . $type; if (!class_exists($class)) { return []; } return new $class($query); }
protected function get_modules(Query $query) { if ($query->url(1) == 'group') { return new HtmlAddGroup($query); } if ($query->url(1) == 'pack') { return new HtmlAddPack($query); } if ($query->url(1) == 'manga') { return new HtmlAddManga($query); } return new HtmlAddArt($query); }
protected function get_params(Query $query) { $data = Config::getInstance()->get(); if (isset($data['default']['name'])) { $this->set_param('name', $data['default']['name']); } elseif (isset($data['user']['login'])) { $this->set_param('name', $data['user']['login']); } if (isset($data['default']['mail'])) { $this->set_param('mail', $data['default']['mail']); } elseif (isset($data['user']['email'])) { $this->set_param('mail', $data['user']['email']); } $this->set_param('id_item', (int) $query->url(0)); }
protected function get_params(Query $query) { $url = $query->get('url'); $name = $query->get('name'); if (empty($url) || empty($name)) { $this->set_error(420); return; } $session = Session::getInstance(); $cookie = $session->get_hash(); $order = Database::get_field('head_menu_user', 'max(`order`)', 'cookie = ?', $cookie); Database::insert('head_menu_user', ['cookie' => $cookie, 'name' => $name, 'url' => $url, 'order' => (int) $order + 1]); $this->set_success(true); $this->set_params(['id' => Database::last_id(), 'name' => $name, 'url' => $url]); }
protected function get_params(Query $query) { $this->set_param('query', $query->to_url_string()); $parsed = $query->parsed(); if (!empty($parsed['tag']['is'])) { $this->set_param('tags', implode(' ', $parsed['tag']['is']) . ' '); } else { $this->set_param('tags', ''); } $this->set_param('groups', []); $this->set_param('have_groups', 0); $this->set_param('packs', []); $this->set_param('have_packs', 0); $this->set_param('manga', []); $this->set_param('have_manga', 0); }
protected function get_modules(Query $query) { if (!Session::getInstance()->is_moderator()) { return []; } $return = [new HtmlAdminMenu($query)]; if ($query->url(1) == 'tag') { $return[] = new HtmlAdminTag($query); } if ($query->url(1) == 'help') { $return[] = new HtmlAdminHelp($query); } if ($query->url(1) == 'similar') { $return[] = new HtmlAdminSimilar($query); } return $return; }
protected function get_params(Query $query) { $section = $query->get('section'); $key = $query->get('key'); $value = $query->get('value'); $values = (array) $query->get('values'); if (empty($values)) { $values = [$key => $value]; } foreach ($values as $key => $value) { if (preg_match('/[^a-z_\\d]/ui', $section)) { $this->set_error(430); return; } $session = Session::getInstance(); $session->set($section, $key, $value); } $this->set_success(true); }
protected function get_params(Query $query) { $id = $query->get('id'); if (empty($id)) { return; } $session = Session::getInstance(); $cookie = $session->get_hash(); $item = Database::get_full_row('head_menu_user', 'cookie = ? and id = ?', [$cookie, $id]); foreach ($item as $key => $value) { $this->set_param($key, $value); } $order = Database::order('order', 'asc')->get_vector('head_menu_user', ['id', 'order'], 'cookie = ?', $cookie); $set_order = []; $i = 0; foreach ($order as $order_id => $value) { $set_order[] = ['selected' => $order_id == $id, 'order' => ++$i]; } $this->set_param('order', $set_order); }
protected function get_params(Query $query) { $legal = $query->all(); unset($legal['page']); $legal = array_keys($legal); $search = array(); foreach ($query->get() as $key => $items) { $negated = ''; if (strpos($key, '-') === 0) { $key = substr($key, 1); $negated = '-'; } if (!in_array($key, $legal)) { continue; } foreach ((array) $items as $item) { $search[] = $negated . ($key == 'tag' ? $item : $key . ':' . $item); } } // Если отдельный арт, то добавим страницу на которой он был if ($query->get('pos')) { $page = ceil($query->get('pos') / $query->per_page()); if ($page > 1) { $search[] = 'page:' . $page; } } $this->set_param('query', implode(' ', $search)); }
protected function get_params(Query $query) { $id = $query->get('id'); $url = $query->get('url'); $name = $query->get('name'); $order = $query->get('order'); if (empty($url) || empty($name) || empty($id) || empty($order)) { $this->set_error(420); return; } Database::update('head_menu_user', ['url' => $url, 'name' => $name], $id); $session = Session::getInstance(); $cookie = $session->get_hash(); $items = Database::order('order', 'asc')->get_table('head_menu_user', array('id', 'order'), 'cookie = ?', $cookie); foreach ($items as &$item) { if ($item['id'] == $id) { $item['new_order'] = $order; } } unset($item); $new_order = 1; foreach ($items as &$item) { if (!empty($item['new_order'])) { continue; } if ($new_order == $order) { $new_order++; } $item['new_order'] = $new_order; $new_order++; } unset($item); foreach ($items as $item) { if ($item['new_order'] != $item['order']) { Database::update('head_menu_user', ['order' => $item['new_order']], $item['id']); } } $this->set_success(true); $this->set_params(['name' => $name, 'url' => $url, 'order' => $items]); }
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; }
protected function get_params(Query $query) { if ($query->get('page')) { $this->page = (int) $query->get('page'); } if ($query->get('filter')) { $this->filter = (string) $query->get('filter'); } if ($query->get('strict')) { $this->strict = true; } if ($query->get('namesort')) { $this->sort = 'name'; } if ($query->get('reverse')) { $this->order = 'asc'; } $this->set_param('filter', $this->filter); $this->set_param('strict', $this->strict); $this->set_param('namesort', (bool) $query->get('namesort')); $this->set_param('reverse', (bool) $query->get('reverse')); $this->set_param('colors', $this->color); }
protected function get_params(Query $query) { if ($query->get('manga')) { $this->manga = (int) $query->get('manga'); } elseif ($query->get('pack')) { $this->pack = (int) $query->get('pack'); } parent::get_params($query); }
protected function get_params(Query $query) { if ($query->get('comment_page')) { $page = $query->get('comment_page'); if ($page == 'all') { $this->per_page = 99999; $page = 1; } $this->page = max($this->page, (int) $page); } if ($query->url(0)) { $this->id = (int) $query->url(0); } if ($query->get('id_art')) { $this->id = (int) $query->get('id_art'); } if ($query->get('id_comment')) { $this->id_comment = (int) $query->get('id_comment'); } }
protected function get_modules(Query $query) { if (is_numeric($query->url(0))) { $this->title = 'Арт №' . $query->url(0); return new HtmlArtItem($query); } if ($query->url(0) == 'admin') { $this->title = 'Админка'; return new HtmlAdmin($query); } if ($query->url(0) == 'add') { $this->title = 'Загрузка новых артов'; return new HtmlAdd($query); } if ($query->url(0) == 'add_to') { return new HtmlCollect($query); } return new HtmlArtList($query); }
protected function get_params(Query $query) { $this->id = $query->get('id'); $this->set_param('id', $this->id); }
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)); } }
protected function get_params(Query $query) { $this->id = $query->get('id'); $this->approve = $query->get('approve'); }
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()); }
protected function get_params(Query $query) { $this->params = $query->get(); unset($this->params['format']); }
protected function get_params(Query $query) { if ((int) $query->get('page')) { $this->page = (int) $query->get('page'); } }