public function onSearch() { $form = $this->getForm(); // if (false !== ($error = $form->validate($this->module))) { // return $error.$this->templateSearch(); // } $users = GDO::table('GWF_User'); $term = Common::getRequest('term'); if (false !== ($error = $this->validate_term($this->module, $term))) { return $error; } $fields = array('user_name', 'user_email'); $by = Common::getGet('by', self::DEFAULT_BY); $dir = Common::getGet('dir', self::DEFAULT_DIR); $orderby = $users->getMultiOrderby($by, $dir); if (false === ($conditions = GWF_QuickSearch::getQuickSearchConditions($users, $fields, $term))) { $conditions = '0'; } $hits = $users->countRows($conditions); $ipp = $this->module->cfgUsersPerPage(); $nPages = GWF_PageMenu::getPagecount($ipp, $hits); $page = Common::clamp((int) Common::getGet('page', 1), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $tVars = array('searched' => true, 'form' => $form->templateX($this->module->lang('ft_search')), 'hits' => $hits, 'users' => $users->selectObjects('*', $conditions, $orderby, $ipp, $from), 'term' => $term, 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Admin&me=UserSearch&term=' . urlencode($term) . '&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=1'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Admin&me=UserSearch&term=' . urlencode($term) . '&by=%BY%&dir=%DIR%&page=1'); return $this->module->templatePHP('user_search.php', $tVars); }
public static function display(GWF_Module $module, GDO $gdo, $user, $sortURL, $conditions = '', $ipp = 25, $pageURL = false, $joins = NULL) { $fields = $gdo->getSortableFields($user); $headers = self::getGDOHeaders2($module, $gdo, $user, $sortURL); $nItems = $gdo->countRows($conditions); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $orderby = self::getMultiOrderBy($gdo, $user); $from = GWF_PageMenu::getFrom($page, $ipp); $i = 0; $data = array(); if (false === ($result = $gdo->select('*', $conditions, $orderby, $joins, $ipp, $from))) { echo GWF_HTML::err(ERR_DATABASE, __FILE__, __LINE__); return false; } while (false !== ($row = $gdo->fetch($result, GDO::ARRAY_O))) { $row instanceof GWF_Sortable; $data[$i] = array(); foreach ($fields as $field) { $data[$i][] = $row->displayColumn($module, $user, $field); } $i++; } $gdo->free($result); if ($pageURL === false) { $pageURL = ''; } elseif ($pageURL === true) { $pageURL = str_replace(array('%BY%', '%DIR%'), array(urlencode(Common::getGet('by')), urlencode(Common::getGet('dir'))), $sortURL); $pageURL .= '&page=%PAGE%'; } $pagemenu = $pageURL === '' ? '' : GWF_PageMenu::display($page, $nPages, $pageURL); return $pagemenu . self::display2($headers, $data) . $pagemenu; }
private function templateSites() { require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteAdmin.php'; require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteCats.php'; require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteDescr.php'; $tag = Common::getGet('tag', ''); if (0 === ($tag_bit = WC_SiteCats::getBitForCat($tag))) { $tag = ''; } $this->setPageDescription($tag); $status_query = $this->getStatusQuery(); $lang_query = $this->getLangQuery(); $tag_query = $this->getTagQuery($tag_bit); $ipp = $this->module->cfgItemsPerPage(); $by = Common::getGet('by', 'site_id'); $dir = Common::getGet('dir', 'DESC'); $page = intval(Common::getGet('page', 1)); $table = GDO::table('WC_Site'); $orderby = $table->getMultiOrderby($by, $dir); $conditions = "({$status_query}) AND ({$lang_query}) AND ({$tag_query})"; $nItems = $table->countRows($conditions); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp($page, 1, $nPages); $href = $this->getPageMenuHREF(); $tVars = array('sites' => $table->selectObjects('*', $conditions, $orderby, $ipp, GWF_PageMenu::getFrom($page, $ipp)), 'descrs' => WC_SiteDescr::getAllDescr(), 'site_quickjump' => $this->module->templateSiteQuickjumpDetail(), 'pagemenu' => GWF_PageMenu::display($page, $nPages, $href), 'sortURL' => $this->getTableSortURL(), 'which' => intval(Common::getGet('which')), 'tag' => $tag, 'page_title' => $this->pageTitle); return $this->module->templatePHP('sites.php', $tVars); }
private function templateSongs() { // $user = GWF_Session::getUser(); // $uid = $user->getID(); $table = GDO::table('Slay_Song'); $joins = NULL; $headers = array(); $headers[] = array($this->module->lang('th_artist'), 'ss_artist'); $headers[] = array($this->module->lang('th_title'), 'ss_title'); $headers[] = array($this->module->lang('th_duration'), 'ss_duration'); $headers[] = array($this->module->lang('th_bpm'), 'ss_bpm'); $headers[] = array($this->module->lang('th_key'), 'ss_key'); $headers[] = array($this->module->lang('D')); $headers[] = array($this->module->lang('L')); $headers[] = array($this->module->lang('T')); $headers[] = array($this->module->lang('th_tags')); $where = ""; $nItems = $table->selectVar('COUNT(ss_id)', $where, '', $joins); $nPages = GWF_PageMenu::getPagecount(self::IPP, $nItems); $page = Common::clamp(Common::getGetInt('page'), 1, $nPages); $by = Common::getGetString('by', self::BY); $dir = Common::getGetString('dir', self::DIR); $orderby = $table->getMultiOrderby($by, $dir, false); $songs = $table->selectAll('*', $where, $orderby, $joins, self::IPP, GWF_PageMenu::getFrom($page, self::IPP), GDO::ARRAY_O); $tVars = array('is_dj' => GWF_User::isInGroupS('dj'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Slaytags&me=Songs&by=%BY%&dir=%DIR%&page=1', 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('index.php?mo=Slaytags&me=Songs&by=%s&dir=%s&page=%%PAGE%%', urlencode($by), urlencode($dir))), 'songs' => $songs, 'headers' => $headers); return $this->module->template('songs.tpl', $tVars); }
private function templateUsers($term = '') { $ipp = $this->module->cfgIPP(); $form = $this->getFormQuick(); $usertable = GDO::table('GWF_User'); $by = Common::getGet('by', ''); $dir = Common::getGet('dir', ''); $orderby = $usertable->getMultiOrderby($by, $dir); if ($term === '') { $users = array(); $page = 1; $nPages = 0; } else { $eterm = GDO::escape($term); $deleted = GWF_User::DELETED; $conditions = "user_name LIKE '%{$eterm}%' AND user_options&{$deleted}=0"; $nItems = $usertable->countRows($conditions); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $users = $usertable->selectObjects('*', $conditions, $orderby, $ipp, $from); } $href_pagemenu = GWF_WEB_ROOT . 'index.php?mo=Usergroups&me=Search&term=' . urlencode($term) . '&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%'; $tVars = array('form' => $form->templateX(false, false), 'users' => $users, 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Usergroups&me=Search&term=' . urlencode($term) . '&by=%BY%&dir=%DIR%&page=1', 'page_menu' => GWF_PageMenu::display($page, $nPages, $href_pagemenu), 'href_adv' => $this->module->getMethodURL('SearchAdv')); return $this->module->templatePHP('search.php', $tVars); }
public static function execute(SR_Player $player, array $args) { $pp = Shadowrun4::getParties(); foreach ($pp as $i => $p) { $p instanceof SR_Party; if (!$p->isHuman()) { unset($pp[$i]); } } $page = isset($args[0]) ? intval($args[0]) : 1; $nItems = count($pp); $nPages = GWF_PageMenu::getPagecount(self::PPP, $nItems); $page = Common::clamp($page, 1, $nPages); $from = GWF_PageMenu::getFrom($page, self::PPP); $slice = array_slice($pp, $from, self::PPP); $out = ''; $format = $player->lang('fmt_list'); foreach ($slice as $p) { $p instanceof SR_Party; $leader = $p->getLeader()->displayName(); $l = $p->getSum('level', true); $ll = $p->getSum('level', false); $mc = $p->getMemberCount(); $item = sprintf('%s(L%s(%s))(M%s)', $leader, $l, $ll, $mc); $out .= sprintf($format, $item); // $out .= sprintf(', %s(L%s(%s))(M%s)', $leader, $l, $ll, $mc); } return self::rply($player, '5248', array($page, $nPages, ltrim($out, ',; '))); // $bot = Shadowrap::instance($player); // $bot->reply(sprintf('Parties page %s from %s: %s.', $page, $nPages, substr($out, 2))); }
private function sanitize() { $this->table = new GWF_UserActivation(false); $this->ipp = $this->module->getActivationsPerPage(); $this->nItems = $this->table->countRows(); $this->nPages = GWF_PageMenu::getPagecount($this->ipp, $this->nItems); $this->page = Common::clamp((int) Common::getGet('page', 1), 1, $this->nPages); $this->by = $this->table->getWhitelistedBy(Common::getGetString('by'), 'timestamp'); $this->dir = GDO::getWhitelistedDirS(Common::getGetString('dir'), 'DESC'); $this->orderby = "{$this->by} {$this->dir}"; }
private function onReply(Module_Comments $mod_c, GWF_News $news, GWF_Comments $comments) { $ipp = 10; $nItems = $comments->getVar('cmts_count'); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(Common::getGetInt('cpage'), 1, $nPages); $href = GWF_WEB_ROOT . 'news-comments-' . $news->getID() . '-' . $news->displayTitle() . '-page-' . $page . '.html'; $me = $mod_c->getMethod('Reply'); $me instanceof Comments_Reply; return $me->onReply($href); }
private function sanitize() { $news = GDO::table('GWF_News'); $this->nItems = $news->countRows(); $this->ipp = $this->module->getNewsPerAdminPage(); $this->nPages = GWF_PageMenu::getPagecount($this->ipp, $this->nItems); $this->page = Common::clamp(Common::getGet('page', 1), 1, $this->nPages); $this->by = $news->getWhitelistedBy(Common::getGet('by', 'news_date'), 'news_date', false); $this->dir = GDO::getWhitelistedDirS(Common::getGet('dir', 'DESC'), 'DESC'); $this->orderby = $news->getMultiOrderby($this->by, $this->dir); }
public function templateShow($href = NULL) { $nItems = $this->comments->getVar('cmts_count'); $nPages = GWF_PageMenu::getPagecount($this->module->cfgIPP(), $nItems); $page = Common::clamp(Common::getGetInt('cpage', 1), 1, $nPages); $cid = $this->comments->getID(); $visible = GWF_Comment::VISIBLE; $comments = GDO::table('GWF_Comment')->selectObjects('*', "cmt_cid={$cid} AND cmt_options&{$visible}", 'cmt_date ASC'); $tVars = array('pagemenu' => GWF_PageMenu::display($page, $nPages, $href), 'comments' => $this->comments->displayComments($comments, $href)); return $this->module->template('show.tpl', $tVars); }
private function sanitize() { $this->ipp = $this->module->getHistmsgPerPage(); $channel = Common::getGet('channel', ''); if (Common::startsWith($channel, 'G-')) { $channel = 'G#' . substr($channel, 2); } $this->channel = $this->module->getWhitelistedChannel($channel); $this->nItems = $this->module->countHistoryMessages($this->channel); $this->nPages = GWF_PageMenu::getPagecount($this->ipp, $this->nItems); $this->page = Common::clamp((int) Common::getGet('page', $this->nPages), 1, $this->nPages); }
private function sanitize() { $this->threads = GDO::table('GWF_ForumThread'); $this->conditions = sprintf('thread_postcount>0 AND (%s) AND thread_options&%d=0', GWF_ForumThread::getPermQuery(), GWF_ForumThread::IN_MODERATION | GWF_ForumThread::INVISIBLE); $this->nThreads = $this->threads->countRows($this->conditions); $this->tpp = $this->module->getThreadsPerPage(); $this->nPages = GWF_PageMenu::getPagecount($this->tpp, $this->nThreads); $this->page = Common::clamp(Common::getGet('page', $this->nPages), 1, $this->nPages); $this->by = $_GET['by'] = Common::getGet('by', 'thread_lastdate'); $this->dir = $_GET['dir'] = Common::getGet('dir', 'ASC'); $this->orderby = $this->threads->getMultiOrderby($this->by, $this->dir); }
private function templateHistory() { $table = GDO::table('Slay_PlayHistory'); $ipp = Slay_PlayHistory::IPP; $where = ''; $nItems = $table->countRows($where); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(Common::getGetInt('page'), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $tVars = array('is_admin' => GWF_User::isStaffS(), 'page' => $page, 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Slaytags&me=History&page=%PAGE%'), 'history' => $table->selectAll('*', $where, 'sph_date ASC', array('songs'), $ipp, $from, 'Slay_Song')); return $this->module->template('history.tpl', $tVars); }
private function sanitize() { $this->user = GWF_Session::getUser(); $links = GDO::table('GWF_Links'); $this->by = Common::getGet('by', self::DEFAULT_BY); $this->dir = Common::getGet('dir', self::DEFAULT_DIR); // if ($this->by === false && $this->dir === false) // { // $this->by = self::DEFAULT_BY; // $this->dir = self::DEFAULT_DIR; // $this->orderby = self::DEFAULT_ORDERBY; // } // else // { $this->orderby = $links->getMultiOrderby($this->by, $this->dir); // } $this->tag = GWF_LinksTag::getWhitelistedTag(Common::getGet('tag'), ''); $this->lpp = $this->module->cfgLinksPerPage(); $this->nLinks = $links->countLinks($this->module, $this->user, $this->tag, false); $this->nPages = GWF_PageMenu::getPagecount($this->lpp, $this->nLinks); $this->page = Common::clamp(Common::getGet('page', 1), 1, $this->nPages); $this->from = GWF_PageMenu::getFrom($this->page, $this->lpp); if ($this->tag === '') { $this->sortURL = GWF_WEB_ROOT . 'links/by/%BY%/%DIR%/page-1'; $href = GWF_WEB_ROOT . 'links/by/' . $this->by . '/' . $this->dir . '/page-%PAGE%'; } else { $this->sortURL = GWF_WEB_ROOT . 'links/' . $this->tag . '/by/%BY%/%DIR%/page-1'; $href = GWF_WEB_ROOT . 'links/' . Common::urlencodeSEO($this->tag) . '/by/' . $this->by . '/' . $this->dir . '/page-%PAGE%'; } // var_dump($this->tag); // $unread_query = $this->module->getUnreadQuery($this->user); $tag_query = $links->getTagQuery($this->tag); // var_dump($tag_query); if ($this->module->cfgShowPermitted()) { $conditions = "({$tag_query})"; } else { $perm_query = $this->module->getPermQuery($this->user); $mod_query = $links->getModQuery($this->user); $member_query = $links->getMemberQuery($this->user); $private_query = $links->getPrivateQuery($this->user); $conditions = "({$perm_query}) AND ({$tag_query}) AND ({$mod_query}) AND ({$member_query}) AND ({$private_query})"; # AND (NOT $unread_query))"; } // var_dump($conditions); if (false === ($this->links = $links->selectObjects('*', $conditions, $this->orderby, $this->lpp, $this->from))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $this->pagemenu = GWF_PageMenu::display($this->page, $this->nPages, $href); $this->add_link_text = GWF_LinksValidator::mayAddLink($this->module, $this->user); $this->hrefAdd = $this->add_link_text === false ? $this->module->getMethodURL('Add', '&tag=' . $this->tag) : false; // $this->newLinks = $links->select("(($perm_query) AND ($unread_query) AND ($mod_query) AND ($member_query) AND ($tag_query))", 'link_date ASC'); return false; }
private function sanitize() { $users = GDO::table('GWF_User'); $this->upp = $this->module->cfgUsersPerPage(); $this->nUsers = $users->countRows(); // $this->by = $users->getWhitelistedBy(Common::getGet('by'), 'user_regdate'); // $this->dir = $users->getWhitelistedDir(Common::getGet('dir'), 'DESC'); $this->orderby = $users->getMultiOrderby(Common::getGet('by'), Common::getGet('dir')); $this->nPages = GWF_PageMenu::getPagecount($this->upp, $this->nUsers); $this->page = Common::clamp((int) Common::getGet('page', 1), 1, $this->nPages); return false; }
private function sanitize() { $this->user = GWF_Session::getUser(); $this->table = GDO::table('GWF_AccountAccess'); $where = "accacc_uid={$this->user->getID()}"; $this->nItems = $this->table->countRows($where); $this->nPages = GWF_PageMenu::getPagecount($this->perpage, $this->nItems); $this->page = Common::clamp(Common::getGetInt('page'), 1, $this->nPages); $this->from = GWF_PageMenu::getFrom($this->page, $this->perpage); $this->by = $this->table->getWhitelistedBy(Common::getGetString('by', self::DEFAULT_BY), self::DEFAULT_BY); $this->dir = $this->table->getWhitelistedBy(Common::getGetString('dir', self::DEFAULT_DIR), self::DEFAULT_DIR); $this->result = $this->table->select('*', $where, "{$this->by} {$this->dir}", null, $this->perpage, $this->from); }
private function templateEdit() { $groups = GDO::table('GWF_UserGroup'); $gid = $this->group->getID(); $conditions = "ug_groupid={$gid}"; $ipp = $this->module->cfgUsersPerPage(); $nItems = $groups->countRows($conditions); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(Common::getGet('page', 1), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $tVars = array('group' => $this->group, 'form' => $this->getForm()->templateY($this->module->lang('ft_edit_group', array($this->group->display('group_name')))), 'form_add' => $this->getFormAdd()->templateX($this->module->lang('ft_add_to_group'), $this->getMethodHREF('&gid=' . $gid)), 'userids' => $groups->selectColumn('ug_userid', $conditions, '', NULL, $ipp, $from), 'pagemenu' => GWF_PageMenu::display($page, $nPages, $this->getMethodHref(sprintf('&gid=%d&page=%%PAGE%%', $gid))), 'sort_url' => '', 'headers' => GWF_Table::displayHeaders1(array(array($this->module->lang('th_user_name')), array('')), '')); return $this->module->template('groupedit.tpl', $tVars); }
private function templateEdit(GWF_Group $group, $formDelete = '') { $form = $this->getForm($group); $form_invite = $this->getFormInvite($group); $ipp = $this->module->cfgIPP(); $nUsers = $group->getVar('group_memberc'); $nPagesM = GWF_PageMenu::getPagecount($ipp, $nUsers); $pageM = Common::clamp(intval(Common::getGet('memberpage')), 1, $nPagesM); $nRequests = GWF_UsergroupsInvite::countRequests($group->getID()); $nPagesR = GWF_PageMenu::getPagecount($ipp, $nRequests); $pageR = Common::clamp(intval(Common::getGet('requestpage')), 1, $nPagesM); $tVars = array('group' => $group, 'form_action' => GWF_WEB_ROOT . 'edit_usergroup/' . $group->getVar('group_id') . '/' . $group->urlencodeSEO('group_name'), 'form_edit' => $form->templateY($this->module->lang('ft_edit')), 'form_invite' => $form_invite->templateX($this->module->lang('ft_invite')), 'form_delete' => $formDelete, 'pagemenu_members' => GWF_PageMenu::display($pageM, $nPagesM, GWF_WEB_ROOT . 'index.php?mo=Usergroups&me=Edit&memberpage=%PAGE%&requestpage=' . $pageR), 'pagemenu_requests' => GWF_PageMenu::display($pageR, $nPagesR, GWF_WEB_ROOT . 'index.php?mo=Usergroups&me=Edit&requestpage=%PAGE%&memberpage=' . $pageM), 'users' => $this->getMembers($group), 'requests' => $this->getJoinRequests($group)); return $this->module->templatePHP('edit.php', $tVars); }
private function templateTermine() { $termine = GDO::table('Konzert_Termin'); $where = ''; $by = Common::getGetString('by', self::DEFAULT_BY); $dir = Common::getGetString('dir', self::DEFAULT_DIR); $orderby = $termine->getMultiOrderby($by, $dir); $nItems = $termine->countRows($where); $nPages = GWF_PageMenu::getPagecount(self::IPP, $nItems); $page = Common::clamp(Common::getGetInt('page'), 1, $nPages); $from = GWF_PageMenu::getFrom($page, self::IPP); $tVars = array('add_button' => GWF_Button::add($this->module->lang('btn_add'), $this->module->getMethodURL('AddTermin')), 'termine' => $termine->selectObjects('*', $where, $orderby, self::IPP, $from), 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Konzert&me=AdminTermine&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Konzert&me=AdminTermine&by=%BY%&dir=%DIR%&page=1'); return $this->module->template('a_termine.tpl', $tVars); }
private function templateVotes() { $votes = GDO::table('GWF_VoteScore'); $ipp = 50; $nItems = $votes->countRows(); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $by = Common::getGet('by', ''); $dir = Common::getGet('dir', ''); $orderby = $votes->getMultiOrderby($by, $dir); $tVars = array('page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('index.php?mo=Votes&me=Staff&by=%s&dir=%s&page=%%PAGE%%', urlencode($by), urlencode($dir))), 'votes' => $votes->selectObjects('*', '', $orderby, $ipp, $from), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Votes&me=Staff&by=%BY%&dir=%DIR%'); return $this->module->templatePHP('staff.php', $tVars); }
private function templateAdmin() { $bans = GDO::table('GWF_Ban'); $nItems = $bans->countRows(); $ipp = $this->module->cfgItemsPerPage(); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $by = Common::getGet('by', 'ban_date'); $dir = Common::getGet('dir', 'DESC'); $orderby = $bans->getMultiOrderby($by, $dir); $form = $this->getFormBan(); $tVars = array('form_ban' => $form->templateY($this->module->lang('ft_add_ban')), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Ban&me=Admin&by=%BY%&dir=%DIR%', 'bans' => $bans->selectObjects('*', '', $orderby, $ipp, GWF_PageMenu::getFrom($page, $ipp)), 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Ban&me=Admin&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%')); return $this->module->templatePHP('admin.php', $tVars); }
private function templateFreeze() { $freezes = GDO::table('WC_Freeze'); $ipp = $this->module->cfgItemsPerPage(); $nItems = $freezes->countRows(); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $by = Common::getGet('by', ''); $dir = Common::getGet('dir', ''); $orderby = $freezes->getMultiOrderby($by, $dir); $form = $this->formFreeze(); $tVars = array('frozen' => $freezes->selectObjects('*', '', $orderby, $ipp, $from), 'form' => $form->templateY($this->module->lang('ft_freeze')), 'form_action' => $this->getMethodHref(), 'page_menu' => GWF_PageMenu::display($page, $nPages, sprintf(GWF_WEB_ROOT . 'index.php?mo=WeChall&me=Freeze&by=%s&dir=%s&page=%%PAGE%%', urlencode($by), urlencode($dir))), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=WeChall&me=Freeze&by=%BY%&dir=%DIR%', 'href_ddos' => $this->module->getMethodURL('UpdateAll'), 'href_convert' => $this->module->getMethodURL('Convert'), 'href_update' => $this->module->getMethodURL('Admin', '&remote_update=yes'), 'href_chall_cache' => $this->module->getMethodURL('Admin', '&chall_cache=yes'), 'href_recalc_all' => $this->module->getMethodURL('Admin', '&recalc=all'), 'href_sitetags' => $this->module->getMethodURL('Admin', '&sitetags=yes'), 'href_freeze' => $this->module->getMethodURL('Freeze')); return $this->module->templatePHP('freeze.php', $tVars); }
private function templateAdmin() { $posts = GDO::table('GWF_ForumPost'); $ipp = $this->module->getPostsPerThread(); # In Moderation $mconditions = 'post_options&' . GWF_ForumPost::IN_MODERATION; $mnItems = $posts->countRows($mconditions); $mnPages = GWF_PageMenu::getPagecount($ipp, $mnItems); $mpage = Common::clamp(intval(Common::getGet('mpage')), 1, $mnPages); $mby = Common::getGet('mby', self::DEFAULT_BY); $mdir = Common::getGet('mdir', self::DEFAULT_DIR); $morderby = $posts->getMultiOrderby($mby, $mdir); $tVars = array('posts_mod' => $posts->selectObjects('*', $mconditions, $morderby, $ipp, GWF_PageMenu::getFrom($mpage, $ipp)), 'sort_url_mod' => GWF_WEB_ROOT . 'index.php?mo=Forum&me=Admin&mby=%BY%&mdir=%DIR%', 'page_menu_mod' => GWF_PageMenu::display($mpage, $mnPages, sprintf(GWF_WEB_ROOT . 'index.php?mo=Forum&me=Admin&mby=%s&mdir=%s&mpage=%%PAGE%%', $mby, $mdir)), 'href_fix_counters' => $this->getMethodHref('&fixcounters=now'), 'href_cleanup' => $this->getMethodHref('&cleanup=now')); return $this->module->templatePHP('admin.php', $tVars); }
private function templateList($user) { $dl = GDO::table('GWF_Download'); $permquery = GWF_Download::getPermissionQueryList($user); $ipp = $this->module->cfgIPP(); $nItems = $dl->countRows($permquery); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $by = Common::getGet('by', 'dl_id'); $dir = Common::getGet('dir', 'ASC'); $orderby = $dl->getMultiOrderby($by, $dir); $tVars = array('href_add' => $this->module->hrefAdd(), 'may_upload' => $this->module->mayUpload($user), 'sort_url' => GWF_WEB_ROOT . 'downloads/by/%BY%/%DIR%/page-1', 'downloads' => $dl->selectObjects('*', $permquery, $orderby, $ipp, $from), 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('downloads/by/%s/%s/page-%%PAGE%%', urlencode($by), urlencode($dir)))); return $this->module->templatePHP('list.php', $tVars); }
private function templateGroups() { $grps = GDO::table('GWF_Group'); $by = Common::getGet('by', 'group_id'); $dir = Common::getGet('dir', 'ASC'); $orderby = $grps->getMultiOrderby($by, $dir); $page = intval(Common::getGet('page', 1)); $ipp = $this->module->cfgUsersPerPage(); $nItems = $grps->countRows(); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp($page, 1, $nPages); $pmhref = GWF_WEB_ROOT . sprintf('index.php?mo=Admin&me=Groups&by=%s&dir=%s&page=%%PAGE%%', urlencode($by), urlencode($dir)); $tVars = array('pagemenu' => GWF_PageMenu::display($page, $nPages, $pmhref), 'groups' => $grps->selectObjects('*', '', $orderby, $ipp, GWF_PageMenu::getFrom($page, $ipp)), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Admin&me=Groups&by=%BY%&dir=%DIR%&page=1', 'href_add' => GWF_WEB_ROOT . 'index.php?mo=Admin&me=GroupAdd'); return $this->module->templatePHP('groups.php', $tVars); }
private function templateRanking(GWF_Language $lang, $user) { $db = gdo_db(); $ipp = 50; $iso = $lang->getISO(); $langid = $lang->getID(); $users = GWF_TABLE_PREFIX . 'user'; $regat = GWF_TABLE_PREFIX . 'wc_regat'; # Count number of users playing this language. $query = "SELECT COUNT(DISTINCT regat_uid) AS c FROM {$regat} WHERE regat_langid={$langid} AND regat_options&4=0"; if (false === ($result = $db->queryFirst($query))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } # Page Menu $nItems = intval($result['c']); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); list($page, $hl_rank) = $this->getPageRank($langid, $ipp, $user); GWF_Website::setPageTitle($this->module->lang('pt_langrank', array($lang->displayName(), $page, $nPages))); GWF_Website::setMetaTags($this->module->lang('mt_ranking_lang', array($lang->displayName()))); GWF_Website::setMetaDescr($this->module->lang('md_ranking_lang', array($lang->displayName(), $page, $nPages))); // echo 'PAGE:'; // var_dump($page); // // echo 'RANK:'; // var_dump($hl_rank); // $page = Common::clamp($page, 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); # Query Data $query = "SELECT r1.regat_uid AS user_id, user_name, user_level, user_countryid, r1.regat_sid, r1.regat_solved AS solved, r2.sum AS sum " . "FROM {$regat} AS r1 " . "JOIN (SELECT regat_uid,SUM(regat_score) AS sum FROM {$regat} WHERE regat_langid={$langid} GROUP BY regat_uid ORDER BY SUM(regat_score) DESC LIMIT {$from},{$ipp}) AS r2 ON r1.regat_uid=r2.regat_uid " . "JOIN {$users} AS u ON u.user_id=r1.regat_uid " . "WHERE regat_options&4=0 " . "ORDER BY sum DESC "; if (false === ($result = $db->queryRead($query))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } // var_dump($query); $data = array(); while (false !== ($row = $db->fetchAssoc($result))) { $uid = intval($row['user_id']); if (!isset($data[$uid])) { $data[$uid] = new GWF_User($row); } $sid = $row['regat_sid']; $data[$uid]->setVar('ss_' . $sid, (double) $row['solved']); } $db->free($result); # Show template $tVars = array('rank' => $from + 1, 'hlrank' => $hl_rank, 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'lang_ranking/' . $iso . '/page-%PAGE%'), 'langname' => $lang->displayName(), 'users' => $data, 'sites' => WC_Site::getSitesLang($langid), 'form_action' => $this->getMethodHref(), 'iso' => $lang->getISO()); return $this->module->templatePHP('ranking_lang.php', $tVars); }
private function templateTickets() { $limit = 25; $uid = GWF_Session::getUserID(); $tickets = GDO::table('GWF_HelpdeskTicket'); $where = "hdt_uid={$uid}"; $by = Common::getGetString('by', 'hdt_date'); $dir = Common::getGetString('dir', 'DESC'); $orderby = $tickets->getMultiOrderby($by, $dir); $nItems = $tickets->countRows($where); $nPages = GWF_PageMenu::getPagecount($limit, $nItems); $page = Common::clamp(Common::getGetInt('page'), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $limit); $tVars = array('tickets' => $tickets->selectAll('*, worker.user_name worker_name', $where, $orderby, array('worker'), $limit, $from, GDO::ARRAY_O), 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Helpdesk&me=ShowTickets&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Helpdesk&me=ShowTickets&by=%BY%&dir=%DIR%'); return $this->module->template('user.tpl', $tVars); }
private function templateLogs() { $ipp = self::IPP; $where = "al_type='script'"; $whitelist = array('size'); $table = GDO::table('GWF_AuditLog'); $nRows = $table->countRows($where); $nPages = GWF_PageMenu::getPagecount($ipp, $nRows); $page = Common::clamp(Common::getGetInt('page', 1), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $by = Common::getGetString('by', self::DEFAULT_BY); $dir = Common::getGetString('dir', self::DEFAULT_DIR); $orderby = $table->getMultiOrderby($by, $dir, true, $whitelist); $tVars = array('logs' => $table->selectAll('al_id,al_eusername,al_username,al_time_start,al_time_end,al_rand,LENGTH(al_data) size, al_id, al_id+1', $where, $orderby, NULL, $ipp, $from, GDO::ARRAY_N), 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Audit&me=Logs&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Audit&me=Logs&by=%BY%&dir=%DIR%&page=1'); return $this->module->template('logs.tpl', $tVars); }
private function templateStaff() { $tickets = GDO::table('GWF_HelpdeskTicket'); $limit = 25; $by = Common::getGetString('by', 'hdt_priority'); $dir = Common::getGetString('dir', 'DESC'); $orderby = $tickets->getMultiOrderby($by, $dir); $where = $this->getConditions(); $mode = $this->getMode(); $nItems = $tickets->countRows($where); $nPages = GWF_PageMenu::getPagecount($limit, $nItems); $page = Common::clamp(Common::getGetInt('page', 1), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $limit); $tVars = array('pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Heldpdesk&me=Staff&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%&mode=' . $mode), 'tickets' => $tickets->selectAll('t.*, creator.user_name creator_name, worker.user_name worker_name', $where, $orderby, array('worker', 'creator'), $limit, $from, GDO::ARRAY_O), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Helpdesk&me=Staff&by=%BY%&dir=%DIR%&mode=' . $mode, 'href_all' => $this->getMethodHREF('&mode=all'), 'href_own' => $this->getMethodHREF('&mode=own'), 'href_open' => $this->getMethodHREF('&mode=open'), 'href_work' => $this->getMethodHREF('&mode=work'), 'href_closed' => $this->getMethodHREF('&mode=closed'), 'href_unsolved' => $this->getMethodHREF('&mode=unsolved')); return $this->module->template('staff.tpl', $tVars); }
private function templateTermine() { $l = new GWF_LangTrans($this->module->getModuleFilePath('lang/termine')); GWF_Website::setPageTitle($l->lang('page_title')); $termine = GDO::table('Konzert_Termin'); $where = 'kt_options&1'; $by = Common::getGetString('by', self::DEFAULT_BY); $dir = Common::getGetString('dir', self::DEFAULT_DIR); $orderby = $termine->getMultiOrderby($by, $dir); $nItems = $termine->countRows($where); $nPages = GWF_PageMenu::getPagecount(self::IPP, $nItems); $page = Common::clamp(Common::getGetInt('page'), 1, $nPages); $from = GWF_PageMenu::getFrom($page, self::IPP); $tVars = array('l' => $l, 'href_admin' => $this->module->getMethodURL('AdminTermine'), 'user' => GWF_User::getStaticOrGuest(), 'termine' => $termine->selectObjects('*', $where, $orderby, self::IPP, $from), 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Konzert&me=Termine&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Konzert&me=Termine&by=%BY%&dir=%DIR%&page=1'); return $this->module->template('termine.tpl', $tVars); }