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 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); }
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 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); }
public function templateComments(Module_Comments $mod_c, GWF_News $news, GWF_Comments $comments) { $ipp = 10; $cid = $comments->getID(); $nItems = $comments->getVar('cmts_count'); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(Common::getGetInt('cpage'), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); // Method $me = $mod_c->getMethod('Reply'); $me instanceof Comments_Reply; $where = "cmt_cid={$cid}"; $with_perms = !GWF_User::isInGroupS('moderator'); if ($with_perms) { $visible = GWF_Comment::VISIBLE; $deleted = GWF_Comment::DELETED; $flags = $visible | $deleted; $where .= " cmt_options & {$flags} = {$visible}"; } $c = GDO::table('GWF_Comment')->selectObjects('*', 'cmt_cid=' . $comments->getID(), 'cmt_date ASC', $ipp, $from); $href = GWF_WEB_ROOT . 'news-comments-' . $news->getID() . '-' . $news->displayTitle() . '-page-' . $page . '.html'; $hrefp = GWF_WEB_ROOT . 'news-comments-' . $news->getID() . '-' . $news->displayTitle() . '-page-%PAGE%.html'; $tVars = array('news' => $news, 'newsitem' => Module_News::displayBoxB(array($news)), 'pagemenu' => GWF_PageMenu::display($page, $nPages, $hrefp), 'comments' => $comments->displayComments($c, $href), 'form' => $me->templateReply($href)); return $this->module->template('comments.tpl', $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); }
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 templateUserTable() { // $href = sprintf('%s/users/by/%s/%s/page-%%PAGE%%', Module_Admin::ADMIN_URL_NAME, $this->by, $this->dir); $href = GWF_WEB_ROOT . sprintf('index.php?mo=Admin&me=Users&by=%s&dir=%s&page=%%PAGE%%', urlencode(Common::getGet('by')), urlencode(Common::getGet('dir'))); // $href = ''; $tVars = array('users' => $this->getUsers(), 'pagemenu' => GWF_PageMenu::display($this->page, $this->nPages, $href), 'sort_url' => $this->getTableSortURL(), 'search_form' => $this->getSearchForm()->templateX($this->module->lang('ft_search'), GWF_WEB_ROOT . 'index.php?mo=Admin&me=UserSearch')); return $this->module->templatePHP('users.php', $tVars); }
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); }
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 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 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 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); }
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); }
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); }
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 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); }
private function templateMyTags() { $user = GWF_Session::getUser(); $uid = $user->getID(); $table = GDO::table('Slay_Song'); $joins = array('tagvotes'); $where = "stv_uid={$uid}"; $nItems = $table->selectVar('COUNT(DISTINCT(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('DISTINCT(ss_id), t.*', $where, $orderby, $joins, self::IPP, GWF_PageMenu::getFrom($page, self::IPP), GDO::ARRAY_O); $tVars = array('sort_url' => GWF_WEB_ROOT . 'index.php?mo=Slaytags&me=MyTags&by=%BY%&dir=%DIR%&page=1', 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('index.php?mo=Slaytags&me=MyTags&by=%s&dir=%s&page=%%PAGE%%', urlencode($by), urlencode($dir))), 'songs' => $songs); return $this->module->template('mytags.tpl', $tVars); }