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); }
public function execute() { require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteAdmin.php'; if (false === ($site = WC_Site::getByID(Common::getGet('siteid')))) { return $this->module->error('err_site'); } $this->site = $site; if (false === ($is_admin = GWF_User::isInGroupS(GWF_Group::STAFF))) { if (false === $site->isSiteAdmin(GWF_Session::getUser())) { return GWF_HTML::err('ERR_NO_PERMISSION'); } } if (false !== Common::getPost('add_sitemin')) { return $this->onAddSitemin($site, $is_admin) . $this->templateEdit($site, $is_admin); } if (false !== Common::getPost('rem_sitemin')) { return $this->onRemSitemin($site, $is_admin) . $this->templateEdit($site, $is_admin); } if (false !== Common::getPost('rem_logo')) { return $this->onRemLogo($site, $is_admin) . $this->templateEdit($site, $is_admin); } if (false !== Common::getPost('set_logo')) { return $this->onSetLogo($site, $is_admin) . $this->templateEdit($site, $is_admin); } if (false !== Common::getPost('edit')) { return $this->onEdit($site, $is_admin) . $this->templateEdit($site, $is_admin); } return $this->templateEdit($site, $is_admin); }
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); }
public function execute() { if (false === ($group = GWF_Group::getByID(Common::getGet('gid')))) { return $this->module->error('err_unk_group'); } if ($group->isOptionEnabled(GWF_Group::VISIBLE_MEMBERS)) { } else { switch ($group->getVisibleMode()) { case GWF_Group::VISIBLE: break; case GWF_Group::COMUNITY: if (!GWF_Session::isLoggedIn()) { return GWF_HTML::err('ERR_NO_PERMISSION'); } break; case GWF_Group::HIDDEN: case GWF_Group::SCRIPT: if (!GWF_User::isInGroupS($group->getVar('group_name'))) { return $this->module->error('err_not_invited'); } break; default: return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } } return $this->templateUsers($group); }
public static function onFlushTags(Slay_Song $song) { $sid = $song->getID(); if (!GWF_User::isInGroupS(GWF_Group::STAFF)) { return GWF_HTML::err('ERR_NO_PERMISSION'); } if (false === GDO::table('Slay_SongTag')->deleteWhere("sst_sid={$sid}")) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === GDO::table('Slay_TagVote')->deleteWhere("stv_sid={$sid}")) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $song->saveVars(array('ss_taggers' => '0', 'ss_tag_cache' => NULL))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return false; }
public function execute() { if (false === ($this->user = GWF_Session::getUser())) { return GWF_HTML::err('ERR_LOGIN_REQUIRED'); } if (false === ($this->site = WC_Site::getByID_Class(Common::getGetString('siteid')))) { return $this->module->error('err_site'); } if (!GWF_User::isInGroupS(GWF_Group::STAFF)) { $this->module->includeClass('WC_SiteAdmin'); if (!$this->site->isSiteAdmin($this->user)) { return GWF_HTML::err('ERR_NO_PERMISSION'); } } $this->module->includeClass('WC_Warbox'); # ADD if (isset($_POST['add'])) { return $this->onAdd(); #.$this->templateOverview(); } if (isset($_GET['add'])) { return $this->templateAdd(); } # EDIT if (false !== ($boxid = Common::getGetString('edit', false))) { if (false === ($box = WC_Warbox::getByIDs($boxid, $this->site->getID()))) { return $this->module->error('err_site'); } } if (isset($_POST['flags'])) { GWF_Website::redirect($this->module->getMethodURL('Warflags', '&wbid=' . $boxid)); } if (isset($_POST['edit'])) { return $this->onEdit($box); } if (isset($_GET['edit'])) { return $this->templateEdit($box); } # OVERVIEW return $this->templateOverview(); }
private function onDelete($array) { if (!GWF_User::isInGroupS('moderator')) { return GWF_HTML::err('ERR_NO_PERMISSION'); } if (!is_array($array)) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } if (false !== ($error = GWF_Form::validateCSRF_WeakS())) { return GWF_HTML::error('Shoutbox', $error); } foreach ($array as $id => $foo) { break; } if (false === ($row = GWF_Shoutbox::getByID($id))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $row->delete()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_deleted'); }
<?php $b = $tVars['board']; $b instanceof GWF_ForumBoard; $user = GWF_Session::getUser(); $is_mod = GWF_User::isInGroupS('moderator'); ?> <!-- Banner Ads --> <?php echo GWF_Website::getBanners('forum', 'forum'); ?> <hr/> <!-- Title --> <?php $options = GWF_User::isLoggedIn() ? GWF_Button::options($tVars['href_options'], $tLang->lang('btn_options')) : ''; $bell = GWF_Button::bell($tVars['href_unread'], $tLang->lang('btn_unread')); $newthreads = $tVars['unread_threads'] > 0 ? sprintf('[%s]', $tVars['unread_threads']) . $bell : ''; $search = GWF_Button::search($tVars['href_search'], $tLang->lang('btn_search')); $pollsbtn = GWF_Button::generic($tLang->lang('btn_polls'), $tVars['href_polls']); ?> <h1><?php echo $options . $tLang->lang('forum_title') . $search . $newthreads . $pollsbtn; ?> </h1> <hr/>
/** * A query to check if userid can access boardid. * @return string SQL Query portion */ public static function getPermQuery() { $visible = GWF_User::isInGroupS('moderator') ? '' : " AND board_options&" . self::INVISIBLE . "=0"; if ('0' === ($uid = GWF_Session::getUserID())) { return 'board_gid=0 and board_options&' . self::GUEST_VIEW . $visible; } else { $grp = GWF_TABLE_PREFIX . 'usergroup'; $invisible = GWF_User::isInGroupS('moderator') ? '0' : self::INVISIBLE; return "((board_gid=0) OR (SELECT 1 FROM {$grp} WHERE ug_userid={$uid} AND ug_groupid=board_gid)){$visible}"; } }
public function getMessage($no_check = false) { if ($no_check === false && $this->isInModeration() && !GWF_User::isInGroupS('moderator')) { return '[IN MODERATION]'; } return $this->getVar('post_message'); }