Beispiel #1
0
 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);
 }
Beispiel #2
0
 public function execute()
 {
     if (false === ($user = GWF_User::getByName(Common::getGetString('username')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false !== ($error = $this->module->isExcludedFromAPI($user, false))) {
         return $error;
     }
     $this->module->includeClass('WC_RegAt');
     $format = Common::getGetString('format', self::FORMAT);
     $bg = Common::getGetString('bg', self::BGCOLOR);
     $fg = Common::getGetString('fg', self::FGCOLOR);
     $size = Common::clamp(Common::getGetInt('s', self::SIZE), 6, 30);
     $spacingx = Common::clamp(Common::getGetInt('sx', 1), 0, 30);
     $spacingy = Common::clamp(Common::getGetInt('sy', 1), 0, 30);
     $marginx = Common::clamp(Common::getGetInt('mx', 1), 0, 30);
     $marginy = Common::clamp(Common::getGetInt('my', 1), 0, 30);
     $divider = Common::getGetString('div', '  ');
     $font = Common::getGetString('font', self::FONT);
     $_GET['font'] = $font;
     if (!preg_match('/^[a-z_0-9]+$/iD', $font) || !Common::isFile(GWF_EXTRA_PATH . 'font/' . $font . '.ttf')) {
         return "Font not found. Available fonts: " . $this->listFonts();
     }
     die($this->displayBanner($user, $format, $bg, $fg, $size, $spacingx, $spacingy, $marginx, $marginy, $divider));
 }
Beispiel #3
0
 public function execute()
 {
     GWF_Website::plaintext();
     GWF3::setConfig('store_last_url', false);
     $lat = $this->module->lat();
     $lon = $this->module->lon();
     $descr = trim(Common::getGetString('pp_descr'));
     $descr = $descr === '' ? null : $descr;
     $id = Common::getGetInt('pp_id', 0);
     $user = GWF_User::getStaticOrGuest();
     $uid = $user->getID();
     if (!GWF_ProfilePOI::changeAllowed($id, $uid)) {
         $this->module->ajaxError('Permission error!');
     }
     $count = $id === 0 ? GWF_ProfilePOI::getPOICount($uid) : 0;
     $max_pois = $this->module->cfgAllowedPOIs();
     if ($count >= $max_pois) {
         $this->module->ajaxErr('err_poi_exceed');
     }
     $poi = new GWF_ProfilePOI(array('pp_id' => $id, 'pp_uid' => $uid, 'pp_lat' => $lat, 'pp_lon' => $lon, 'pp_descr' => $descr));
     $poi->replace();
     $data = $poi->getGDOData();
     $data['user_name'] = $user->getVar('user_name');
     die(json_encode($data));
 }
Beispiel #4
0
 public function execute()
 {
     if (false !== ($bid = Common::getGetInt('subscribe', false))) {
         return $this->onSubscribe($bid);
     } elseif (false !== ($bid = Common::getGetInt('unsubscribe', false))) {
         return $this->onUnSubscribe($bid);
     } else {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
 }
Beispiel #5
0
 private function sanitize()
 {
     if (false === ($this->site = WC_Site::getByID(Common::getGetInt('siteid', 0)))) {
         return array($this->module->lang('err_site'));
     }
     require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteAdmin.php';
     if (!WC_SiteAdmin::isSiteAdmin(GWF_Session::getUserID(), $this->site->getID()) && !GWF_User::isAdminS()) {
         return array(GWF_HTML::lang('ERR_NO_PERMISSION'));
     }
     return false;
 }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 public function execute()
 {
     if (false === ($id = Common::getGetInt('id', false))) {
         return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'id'));
     }
     if (false === ($log = GWF_AuditLog::getByID($id))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     GWF_Website::plaintext();
     die($log->getVar('al_data'));
 }
Beispiel #8
0
 public function execute()
 {
     GWF_Website::plaintext();
     GWF3::setConfig('store_last_url', false);
     $id = Common::getGetInt('pp_id');
     if (!GWF_ProfilePOI::changeAllowed($id, GWF_Session::getUserID())) {
         $this->module->ajaxError('Permission error!');
     }
     GDO::table('GWF_ProfilePOI')->deleteWhere("pp_id = {$id}");
     die("{$id}");
 }
Beispiel #9
0
 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);
 }
Beispiel #10
0
 private function onAddTag()
 {
     $form = $this->formAddTag();
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateAddTag();
     }
     $user = GWF_Session::getUser();
     $uid = $user->isStaff() ? '0' : $user->getID();
     GDO::table('Slay_Tag')->insertAssoc(array('st_id' => 0, 'st_uid' => $uid, 'st_name' => $form->getVar('tag')), false);
     $href = $this->module->getMethodURL('Tag', '&stid=' . Common::getGetInt('stid', '0'));
     return $this->module->message('msg_tag_added', array($href));
 }
Beispiel #11
0
 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);
 }
Beispiel #12
0
 public function execute()
 {
     $nid = Common::getGetInt('nid');
     $id = Common::getGetInt('id');
     $back = '';
     if (isset($_POST['editnavi'])) {
         $back = $this->onEdit($this->module, $nid, $id);
     }
     $this->navigation = GWF_Navigation::getNavigation($nid);
     $this->navigations = GWF_Navigations::getByID($nid);
     return $back . $this->templateEdit();
 }
Beispiel #13
0
 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);
 }
Beispiel #14
0
 public function execute()
 {
     $_GET['ajax'] = 1;
     header('Content-Type: text/plain');
     if (false === ($date = Common::getGetString('datestamp', false))) {
         return 'Missing parameter: datestamp.';
     }
     if (!GWF_Time::isValidDate($date, false, GWF_Date::LEN_SECOND)) {
         return 'Error in parameter: datestamp.';
     }
     $amt = Common::clamp(Common::getGetInt('amt', 5), 1, self::MAX_OUT);
     return $this->templateOutput($date, $amt);
 }
Beispiel #15
0
 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);
 }
Beispiel #16
0
 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);
 }
Beispiel #17
0
 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);
 }
Beispiel #18
0
 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);
 }
Beispiel #19
0
 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);
 }
Beispiel #20
0
 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);
 }
Beispiel #21
0
 private function templateHistory(WC_Site $site)
 {
     require_once GWF_CORE_PATH . 'module/WeChall/WC_HistoryUser2.php';
     $table = GDO::table('WC_HistoryUser2');
     $orderby = 'userhist_date ASC';
     $siteid = $site->getVar('site_id');
     $conditions = "userhist_sid={$siteid}";
     $ipp = 50;
     $nItems = $table->countRows($conditions);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGetInt('page', $nPages), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $rows = $table->select('*', $conditions, $orderby, array('userhist_uid', 'userhist_sid'), 50, $from);
     $href_pagemenu = GWF_WEB_ROOT . 'site/history/' . $site->urlencode2('site_name') . '/page/%PAGE%';
     $tVars = array('pagemenu' => GWF_PageMenu::display($page, $nPages, $href_pagemenu), 'result' => $rows, 'site_quickjump' => $this->module->templateSiteQuickjumpHistory());
     return $this->module->templatePHP('site_history.php', $tVars);
 }
Beispiel #22
0
 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);
 }
Beispiel #23
0
 private function templatePlayers()
 {
     $bid = $this->box->getID();
     $_GET['sid'] = $this->box->getSiteID();
     $_GET['bid'] = $bid;
     $table = GDO::table('WC_Warflags');
     $where = "wf_wbid={$bid} AND wf_solved_at IS NOT NULL";
     $orderby = 'score DESC, solvedate ASC';
     $joins = array('flag', 'flagbox', 'solvers');
     $ipp = 50;
     $nItems = $table->countRows($where, $joins, 'user_name');
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGetInt('page', 1), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $tVars = array('site_quickjump' => $this->module->templateSiteQuickjump('boxranking'), 'data' => $table->selectAll("user_name, user_countryid country, COUNT(*) solved, SUM(wf_score) score, SUM(wf_score)/{$this->box->getVar('wb_totalscore')}*100 percent, MAX(wf_solved_at) solvedate", $where, $orderby, $joins, $ipp, $from, GDO::ARRAY_A, 'user_name'), 'box' => $this->box, 'playercount' => $nItems, 'rank' => $from + 1, 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=WeChall&me=WarboxPlayers&boxid=' . $bid . '&page=%PAGE%'));
     return $this->module->templatePHP('warbox_players.php', $tVars);
 }
Beispiel #24
0
 private function templateSolvers()
 {
     $box = $this->flag->getWarbox();
     $_GET['sid'] = $box->getSiteID();
     $_GET['bid'] = $box->getID();
     $fid = $this->flag->getID();
     $table = GDO::table('WC_Warflags');
     $where = "wf_id={$fid} AND wf_solved_at IS NOT NULL";
     $orderby = 'wf_solved_at ASC';
     $joins = array('flag', 'solvers', 'flagbox', 'flagsite');
     $ipp = 50;
     $nItems = $table->countRows($where, $joins);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGetInt('page'), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $tVars = array('site_quickjump' => $this->module->templateSiteQuickjump('boxdetail'), 'solvers' => $table->selectAll('*', $where, $orderby, $joins, $ipp, $from, GDO::ARRAY_A), 'flag' => $this->flag, 'rank' => $from + 1, 'sort_url' => NULL, 'solvercount' => $nItems, 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . "index.php?mo=WeChall&me=WarflagSolvers&flag={$fid}&page=%PAGE%"));
     return $this->module->templatePHP('warflag_solvers.php', $tVars);
 }
Beispiel #25
0
 public function execute()
 {
     require_once GWF_CORE_PATH . 'module/Slaytags/slay_secrets.php';
     if (0 === ($site = Common::getGetInt('site'))) {
         return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'site'));
     }
     if (0 >= ($userid = Common::getGetInt('uid'))) {
         return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'uid'));
     }
     if ('' === ($token = Common::getGetString('token'))) {
         return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'uid'));
     }
     if ($site === 1) {
         return $this->onCrossLoginSlayradio($userid, $token);
     } else {
         return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'site'));
     }
 }
Beispiel #26
0
 private function templateUsers(GWF_Group $group)
 {
     $users = GDO::table('GWF_User');
     $gid = $group->getVar('group_id');
     $gn = $group->urlencode('group_name');
     $by = Common::getGet('by', '');
     $dir = Common::getGet('dir', '');
     $orderby = $users->getMultiOrderby($by, $dir);
     $ipp = 50;
     $nItems = $group->getVar('group_memberc');
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGetInt('page', 1), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $ug = GWF_TABLE_PREFIX . 'usergroup';
     $hidden = GWF_UserGroup::HIDDEN;
     $conditions = "(SELECT 1 FROM {$ug} WHERE ug_userid=user_id AND ug_groupid={$gid} AND ug_options&{$hidden}=0)";
     $tVars = array('sort_url' => GWF_WEB_ROOT . 'users_in_group/' . $gid . '/' . $gn . '/by/%BY%/%DIR%/page-1', 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('users_in_group/%s/%s/by/%s/%s/page-%%PAGE%%', $gid, $gn, urlencode($by), urlencode($dir))), 'users' => $users->selectObjects('*', $conditions, $orderby, $ipp, $from));
     return $this->module->templatePHP('users.php', $tVars);
 }
Beispiel #27
0
 /**
  * @todo try to get Navi-Name
  * @todo rethink
  */
 public function execute()
 {
     $nid = Common::getGetInt('nid');
     $name = Common::getGetString('nname', 'unknown');
     $back = '';
     # Delete a Navigation?
     if ('delete' === ($action = Common::getGet('action'))) {
         if ($nid <= 0 || false === $this->onDelete($nid)) {
             # couldnt delete the navi! does it exists?
             $back = $this->module->error('err_delete', $name);
         } else {
             $back = $this->module->message('succ_delete', $name);
         }
     } elseif ('copy' === $action) {
         $back = $this->onCopy();
     } elseif (false !== ($delete = Common::getPostArray('delete'))) {
         $back .= $this->onEdit($delete);
     }
     return $back . $this->templateAdmin();
 }
Beispiel #28
0
 private function templateWhitelist()
 {
     $ipp = 20;
     $page = Common::getGetInt('page', 1);
     $userid = GWF_Session::getUserID();
     $where = "pw_uida={$userid}";
     $table = GDO::table('GWF_ProfilePOIWhitelist');
     $numItems = $table->countRows($where);
     $nPages = GWF_PageMenu::getPagecount($ipp, $numItems);
     $page = Common::clamp($page, 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $by = Common::getGetString('by', 'pw_date');
     $dir = Common::getGetString('dir', 'ASC');
     $by = $table->getWhitelistedBy($by);
     $dir = $table->getWhitelistedDirS($dir);
     $pagehref = GWF_WEB_ROOT . "index.php?mo=Profile&me=POISWhitelist&by={$by}&dir={$dir}&page=%PAGE%";
     $tVars = array('form_add' => $this->formAdd(), 'form_clear' => $this->formClear(), 'form_settings' => $this->formSettings(), 'table' => $table, 'where' => $where, 'by' => $by, 'dir' => $dir, 'ipp' => $ipp, 'from' => $from, 'form_action' => GWF_WEB_ROOT . 'index.php?mo=Profile&me=POISWhitelist', 'sort_url' => GWF_WEB_ROOT . "index.php?mo=Profile&me=POISWhitelist&by=%BY%&dir=%DIR%&page=1", 'page_menu' => GWF_PageMenu::display($page, $nPages, $pagehref));
     $back = $this->module->templatePHP('whitelist.php', $tVars);
     return $back;
 }
Beispiel #29
0
 private function sanitize()
 {
     if (false === ($this->thread = GWF_ForumThread::getByID(Common::getGetString('tid')))) {
         return $this->module->error('err_thread');
     }
     $this->ppt = $this->module->getPostsPerThread();
     $this->nPosts = $this->thread->getPostCount();
     $this->nPages = GWF_PageMenu::getPagecount($this->ppt, $this->nPosts);
     $default_page = isset($_GET['last_page']) ? $this->nPages : 1;
     $this->page = Common::clamp(Common::getGetInt('page'), $default_page, $this->nPages);
     if (!$this->thread->getBoard()) {
         return $this->module->error('err_thread_perm');
     }
     if (!$this->thread->hasPermission(GWF_Session::getUser())) {
         return $this->module->error('err_thread_perm');
     }
     if ($this->thread->isInModeration()) {
         return $this->module->error('err_in_mod');
     }
     return false;
 }
Beispiel #30
0
 private function onSearch()
 {
     $form = $this->formSearch();
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateSearch();
     }
     $ipp = self::IPP;
     $term = $form->getVar('searchterm');
     $tagname = NULL;
     $table = GDO::table('Slay_Song');
     $whitelist = array('(ss_lyrics>0)', '(ss_options&1)', '(ss_sid_path!=NULL)');
     $joins = array('lyrics');
     if (false === ($where = GWF_QuickSearch::getQuickSearchConditions($table, array('ss_artist', 'ss_title', 'ss_composer'), $term))) {
         return GWF_HTML::err('ERR_SEARCH_TERM') . $this->templateSearch();
     }
     $term2 = GDO::escape($term);
     //		$term2 = str_replace(array('%', '_'), array('\\%', '\\_'), $term);
     $term3 = '1';
     if ('0' !== ($tag = $form->getVar('searchtag'))) {
         $tagname = Slay_Tag::getNameByID($tag);
         $term3 = 'sst_count>0';
         $joins[] = 'searchtag';
     }
     $where = "(({$where}) OR (ssl_lyrics LIKE '%{$term2}%')) AND ({$term3})";
     $nItems = $table->countRows($where, $joins);
     $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::BY);
     $dir = Common::getGetString('dir', self::DIR);
     $orderby = $table->getMultiOrderby($by, $dir, false, $whitelist);
     $matches = $table->selectAll('*', $where, $orderby, $joins, $ipp, $from, GDO::ARRAY_O);
     $headers = array(array(), array($this->module->lang('L'), '(ss_lyrics>0)'), array($this->module->lang('T'), 'ss_taggers'), array($this->module->lang('D'), '(ss_options&1)'), array($this->module->lang('th_artist'), 'ss_artist'), array($this->module->lang('th_title'), 'ss_title'), array($this->module->lang('th_duration'), 'ss_duration'), array($this->l('th_bpm'), 'ss_bpm'), array($this->l('th_key'), 'ss_key'));
     if ($tag > 0) {
         $headers[] = array($this->module->lang(Slay_Tag::getNameByID($tag)), 'sst_count');
     }
     $headers[] = array($this->module->lang('th_tags'));
     $tVars = array('form' => $form->templateX($this->module->lang('ft_search'), GWF_WEB_ROOT . 'index.php'), 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('index.php?mo=Slaytags&me=Search&searchterm=%s&searchtag=%s&by=%s&dir=%s&page=%%PAGE%%', urlencode($term), $tag, urlencode($by), urlencode($dir))), 'matches' => $matches, 'sort_url' => GWF_WEB_ROOT . sprintf('index.php?mo=Slaytags&me=Search&searchterm=%s&searchtag=%s&by=%%BY%%&dir=%%DIR%%&page=1', urlencode($term), $tag), 'is_admin' => GWF_User::isStaffS(), 'headers' => $headers, 'singletag' => $tagname, 'no_match' => count($matches) === 0);
     return $this->module->template('search.tpl', $tVars);
 }