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 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 templateHistory() { $pagemenuHREF = $this->channel === '' ? 'chat/history/page-%PAGE%' : 'chat/history/for/' . $this->channel . '/page-%PAGE%'; $pagemenuHREF = GWF_WEB_ROOT . $pagemenuHREF; $tVars = array('friends' => $this->module->getFriends(), 'history' => $this->module->getHistoryMessages($this->channel, $this->page), 'pagemenu' => GWF_PageMenu::display($this->page, $this->nPages, $pagemenuHREF), 'prevpage' => GWF_PageMenu::prevPage($this->page, $this->nPages, $pagemenuHREF), 'nextpage' => GWF_PageMenu::nextPage($this->page, $this->nPages, $pagemenuHREF)); return $this->module->templatePHP('history.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); }
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); }
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; }
public function getPageForSession($ipp, $user) { if ($user === false || $user->isWebspider() || $user->isOptionEnabled(0x10000000)) { return array(1, 1); } $rank = WC_RegAt::calcExactRank($user); $page = GWF_PageMenu::getPageForPos($rank, $ipp); return array($page, WC_RegAt::calcRank($user)); }
private function templateOverview() { GWF_Website::setPageTitle($this->module->lang('pt_pm')); $fname = $this->folder->urlencodeSEO('pmf_name'); $hrefPage = GWF_WEB_ROOT . sprintf('pm/folder/%s/%s/by/%s/%s/page-%%PAGE%%', $this->fid, $fname, urlencode(Common::getGet('by')), urlencode(Common::getGet('dir'))); $hrefSort = GWF_WEB_ROOT . 'pm/folder/' . $this->fid . '/' . $fname . '/by/%BY%/%DIR%/page-1'; $tVars = array('folder' => $this->folder, 'folders' => $this->folderTable(), 'form_new_folder' => $this->getFormNewFolder()->templateX($this->module->lang('ft_new_folder')), 'pms' => $this->pms, 'pagemenu' => GWF_PageMenu::display($this->page, $this->nPages, $hrefPage), 'sort_url' => $hrefSort, 'new_pm' => $this->getNewPMForm(), 'href_options' => $this->module->getOptionsHREF(), 'href_search' => $this->module->getSearchHREF(), 'folder_select' => GWF_PMFolder::getSelectS($this->module, Common::getRequest('folders', '0')), 'form_action' => isset($_SERVER['REQUEST_URI']) ? GWF_HTML::display($_SERVER['REQUEST_URI']) : GWF_WEB_ROOT . 'pm', 'href_trashcan' => $this->module->getMethodURL('Trashcan&by=pm_date&dir=DESC')); return $this->module->templatePHP('overview.php', $tVars); }
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 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); }
public function templateForum() { $by = urlencode(Common::getGetString('tby', 'thread_lastdate')); $dir = urlencode(Common::getGetString('tdir', 'DESC')); $bby = urlencode(Common::getGetString('bby', 'board_pos')); $bdir = urlencode(Common::getGetString('bdir', 'ASC')); $orderby = GDO::table('GWF_ForumThread')->getMultiOrderby($by, $dir); $bid = $this->board->getVar('board_bid'); $bt = $this->board->urlencodeSEO('board_title'); $tVars = array('boards' => $this->board->getBoardPage($this->bPage, $this->tpp), 'board' => $this->board, 'pagemenu_boards' => GWF_PageMenu::display($this->bPage, $this->nBPages, sprintf(GWF_WEB_ROOT . 'forum-b%s/bby/%s/%s/%s-p%%PAGE%%.html', $bid, $bby, $bdir, $bt)), 'threads' => $this->board->getThreads($this->tpp, $this->page, $orderby), 'pagemenu_threads' => GWF_PageMenu::display($this->page, $this->nPages, sprintf(GWF_WEB_ROOT . 'forum-b%s/tby/%s/%s/%s-p%%PAGE%%.html', $bid, $by, $dir, $bt)), 'new_thread_allowed' => $this->board->isNewThreadAllowed(), 'unread_threads' => GWF_ForumThread::getUnreadThreadCount(GWF_Session::getUser()), 'latest_threads' => GWF_ForumThread::getLatestThreads($this->module->getNumLatestThreads()), 'href_options' => GWF_WEB_ROOT . 'forum/options', 'href_unread' => $this->module->getMethodURL('Unread'), 'href_search' => GWF_WEB_ROOT . 'forum/search', 'board_sort_url' => GWF_WEB_ROOT . sprintf('forum-b%s/bby/%%BY%%/%%DIR%%/%s-p1.html', $bid, $bt), 'thread_sort_url' => GWF_WEB_ROOT . sprintf('forum-b%s/bby/%s/%s/bp-%d/tby/%%BY%%/%%DIR%%/%s-p1.html', $bid, $bby, $bdir, $this->bPage, $bt), 'href_polls' => GWF_WEB_ROOT . 'poll_overview'); return $this->module->templatePHP('forum.php', $tVars); }
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 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 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 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 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 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 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 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 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 getPageNum($ipp, $bit) { if (false !== ($user = GWF_Session::getUser()) && !$user->isWebspider() && !$user->isOptionEnabled(0x10000000)) { if (false !== ($page = Common::getGet('page'))) { $hlrank = ($page - 1) * $ipp + 1; } else { // $page = Common::getGet('page', 1); $hlrank = $this->calcRank($user, $bit); $page = GWF_PageMenu::getPageForPos($hlrank, $ipp); } } else { $page = Common::getGet('page', 1); $hlrank = 1; } return array($page, $hlrank); }
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); }
public function templateUsers() { $letter = Common::getGet('with', 'All'); $conditions = $this->getConditions($letter); $ipp = $this->module->cfgIPP(); $users = GDO::table('GWF_User'); $nUsers = $users->countRows($conditions); $nPages = GWF_PageMenu::getPagecount($ipp, $nUsers); $page = Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $by = Common::getGet('by', 'user_name'); $dir = Common::getGet('dir', 'ASC'); $orderby = $users->getMultiOrderby($by, $dir); $from = GWF_PageMenu::getFrom($page, $ipp); $tVars = array('users' => $users->selectObjects('*', $conditions, $orderby, $ipp, $from), 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'users/with/' . urlencode($letter) . '/by/' . urlencode($by) . '/' . urlencode($dir) . '/page-%PAGE%'), 'lettermenu' => GWF_PageMenu::displayLetterMenu($letter, GWF_WEB_ROOT . 'users/with/%LETTER%/page-1'), 'sort_url' => GWF_WEB_ROOT . 'users/with/' . urlencode($letter) . '/by/%BY%/%DIR%/page-1'); return $this->module->templatePHP('users.php', $tVars); }
public function masterTable($old) { $masters = GDO::table('WC_SiteMaster'); $conditions = $old === true ? 'sitemas_options&1=0' : 'sitemas_options&1=1'; $pre = $old === true ? 'old_' : ''; $nItems = $masters->countRows($conditions); $ipp = $this->module->cfgItemsPerPage(); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = (int) Common::clamp(intval(Common::getGet('page', 1)), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $by = Common::getGet('by', 'sitemas_date'); $dir = Common::getGet('dir', 'DESC'); $orderby = $masters->getMultiOrderby($by, $dir); $tVars = array('page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . $pre . 'site_masters/by/' . urlencode($by) . '/' . urlencode($dir) . '/page-%PAGE%'), 'masters' => $masters->selectObjects('*', $conditions, $orderby, $ipp, $from), 'sort_url' => GWF_WEB_ROOT . $pre . 'site_masters/by/%BY%/%DIR%/page-1', 'old' => $old); return $this->module->templatePHP('site_masters.php', $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); }
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 templateStaff() { $table = GDO::table('GWF_Comments'); $where = $this->getWhere(); $ipp = 25; $nItems = $table->countRows($where); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(Common::getGetInt('page'), 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); $hrefp = GWF_WEB_ROOT . sprintf('index.php?mo=Comments&me=Staff&by=%s&dir=%s&mode=%s&page=%%PAGE%%', urlencode($by), urlencode($dir), urlencode(Common::getGetString('mode'))); $tVars = array('pagemenu' => GWF_PageMenu::display($page, $nPages, $hrefp), 'comments' => $table->selectObjects('*', $where, $orderby, $ipp, $from)); return $this->module->template('staff.tpl', $tVars); }