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); }
public function templateShow() { if (false === ($news = GWF_News::getNewsQuick($this->module->getNewsPerPage(), $this->catid, $this->page, GWF_Language::getCurrentID()))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $date = count($news) > 0 ? $news[0]['news_date'] : GWF_Settings::getSetting('gwf_site_birthday') . '090000'; $date = GWF_Time::displayDate($date); GWF_Website::setPageTitle($this->module->lang('pt_news', array($date))); GWF_Website::setMetaTags($this->module->lang('mt_news', array($date))); GWF_Website::setMetaDescr($this->module->lang('md_news', array($this->page, $this->nPages))); // $mod_forum = GWF_Module::getModule('Forum', true); $tVars = array('news' => $news, 'titles' => GWF_News::getTitlesQuick($this->catid, GWF_Language::getCurrentID()), 'cats' => GWF_News::getCategories(), 'catid' => $this->catid, 'cat' => GWF_HTML::display($this->catTitle), 'page_menu' => $this->getPageMenu(), 'page' => $this->page, 'can_sign' => $this->module->canSignNewsletter(GWF_Session::getUser()), 'href_sign_news' => $this->module->hrefSignNewsletter(), 'may_add' => GWF_User::isAdminS() || GWF_User::isStaffS(), 'href_add' => $this->module->hrefAddNews()); return $this->module->templatePHP('show.php', $tVars); }
public function execute() { if (false !== ($lid = Common::getGet('approve'))) { return $this->onApprove($lid, true); } if (false !== ($lid = Common::getGet('disapprove'))) { return $this->onApprove($lid, false); } if (!GWF_User::isStaffS()) { return GWF_HTML::err('ERR_NO_PERMISSION'); } if (false !== ($error = $this->sanitize())) { return $error; } return $this->overview(); }
<?php $module = $tVars['module']; $permitted = $module->cfgShowPermitted(); $user = GWF_Session::getUser(); $staff = GWF_User::isStaffS(); ################# # Table Headers # ################# $headers = array(); $headers['id'] = array($tLang->lang('th_link_id'), 'link_id'); $headers['text'] = array($tLang->lang('th_link_descr'), 'link_descr'); $headers['url'] = array($tLang->lang('th_link_href')); $headers['favs'] = array($tLang->lang('th_favs'), 'link_favcount', 'DESC'); $headers['clicks'] = array($tLang->lang('th_link_clicks'), 'link_clicks', 'DESC'); $wv = $tVars['with_votes']; $headers['vs_count'] = array($tLang->lang('th_vs_count'), 'vs_count', 'DESC'); $headers['vs_avg'] = array($tLang->lang('th_vs_avg'), 'vs_avg', 'DESC'); if ($wv) { $headers['vote'] = array($tLang->lang('th_vote')); } if ($user !== false && $wv) { $headers['fav'] = array(); $headers['unfav'] = array(); } echo GWF_Table::start('wc_links_table'); echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']); $votes = $tVars['with_votes']; $t_edit = $tLang->lang('btn_edit'); $t_fav = $tLang->lang('btn_favorite'); $t_unfav = $tLang->lang('btn_un_favorite');
<div class="ib"><?php echo GWF_Box::box(GWF_Message::display($tVars['descr'])); ?> </div> <table> <thead> <tr> <th colspan="2" id="wc_site_detail_head"><?php echo $site->displayLogo(32, $tLang->lang('hover_logo', array($site->displayName()))) . $site->displayLink(); ?> </th> </tr> </thead> <?php if (GWF_User::isStaffS() || WC_SiteAdmin::isSiteAdmin(GWF_Session::getUserID(), $siteid)) { echo WC_HTML::tableRowForm($tLang->lang('ft_edit_site', array($site->displayName())), $site->getEditButton($tVars['module'], GWF_Session::getUser())); } echo WC_HTML::tableRowForm($tLang->lang('th_site_country_detail'), $site->displayCountry()); $href = GWF_WEB_ROOT . 'all_sites/' . $site->getLangISO(); echo WC_HTML::tableRowForm($tLang->lang('th_site_language'), GWF_HTML::anchor($href, $site->displayLanguage())); echo WC_HTML::tableRowForm($tLang->lang('th_site_tags'), $site->displayTags(true)); if ($is_ranked) { echo WC_HTML::tableRowForm($tLang->lang('th_site_admins'), $site->displaySiteAdmins()); // echo WC_HTML::tableRowForm($tLang->lang('th_site_autoup'), $site->displayAutoUpdate()); // echo WC_HTML::tableRowForm($tLang->lang('th_site_has_osr'), $site->displayOnSiteRank()); if (count($boxes) > 0) { $warboxes = $tVars['boxcount'] . GWF_Button::forward($site->hrefWarboxes(), 'Show Wargames'); echo WC_HTML::tableRowForm($tLang->lang('btn_warboxes'), $warboxes); } // echo WC_HTML::tableRowForm($tLang->lang('th_site_score'), $site->getScore());
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); }
private function onEdit() { $form = $this->getForm(); if (false !== ($error = $form->validate($this->module))) { return $error; } // var_dump($_POST); $this->link->removeTags(); $data = array('link_gid' => $form->getVar('link_gid'), 'link_score' => $form->getVar('link_score'), 'link_href' => $form->getVar('link_href'), 'link_descr' => $form->getVar('link_descr'), 'link_tags' => $form->getVar('link_tags')); if (false !== ($descr2 = $form->getVar('link_descr2'))) { $data['link_descr2'] = $descr2; } if (false === $this->link->saveVars($data)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $this->link->insertTags($this->module); $this->link->saveOption(GWF_Links::UNAFILIATE, isset($_POST['link_options&' . GWF_Links::UNAFILIATE])); $this->link->saveOption(GWF_Links::MEMBER_LINK, isset($_POST['link_options&' . GWF_Links::MEMBER_LINK])); $this->link->saveOption(GWF_Links::ONLY_PRIVATE, isset($_POST['link_options&' . GWF_Links::ONLY_PRIVATE])); if (GWF_User::isStaffS()) { $this->link->saveOption(GWF_Links::STICKY, isset($_POST['link_options&' . GWF_Links::STICKY])); if (false === $this->link->toggleModeration($this->module, isset($_POST['link_options&' . GWF_Links::IN_MODERATION]))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } } return $this->module->message('msg_edited'); }
<?php $headers = array(array($tLang->lang('th_chall_score'), 'chall_score'), array($tLang->lang('th_chall_title'), 'chall_title'), array($tLang->lang('th_chall_creator_name'), 'chall_creator_name'), array($tLang->lang('th_chall_solvecount'), 'chall_solvecount'), array($tLang->lang('th_chall_date'), 'chall_date'), array($tLang->lang('th_dif'), 'chall_dif'), array($tLang->lang('th_edu'), 'chall_edu'), array($tLang->lang('th_fun'), 'chall_fun'), array($tLang->lang('th_csolve_date'), 'csolve_date'), array($tLang->lang('th_forum'))); $is_admin = GWF_User::isStaffS(); if ($is_admin) { $headers[] = array($tLang->lang('th_csolve_time_taken'), 'csolve_time_taken'); } echo '<table class="wc_chall_table" id="wc_profile_challenges">' . PHP_EOL; $raw = '<tr><th colspan="' . count($headers) . '">' . $tVars['table_title'] . '</th></tr>'; echo GWF_Table::displayHeaders1($headers, $tVars['sort_url'], '', '', 'pcby', 'pcdir', $raw); $chall = new WC_Challenge(false); foreach ($tVars['data'] as $row) { $chall->setGDOData($row); $solved = $row['csolve_date'] !== '' && $row['csolve_date'] !== NULL; $href_votes = $chall->hrefVotes(); echo GWF_Table::rowStart(); echo '<td class="gwf_num">' . $row['chall_score'] . '</td>' . PHP_EOL; echo '<td class="nowrap" colspan="2">' . $chall->displayLink($solved) . '</td>' . PHP_EOL; echo '<td class="gwf_num"><a href="' . $chall->getSolverHREF() . '">' . $row['chall_solvecount'] . '</a></td>' . PHP_EOL; echo '<td class="gwf_date">' . $chall->displayAge() . '</td>' . PHP_EOL; echo '<td class="gwf_num">' . sprintf('<a href="%s">%s</a>', $href_votes, $chall->displayDif()) . '</td>' . PHP_EOL; echo '<td class="gwf_num">' . sprintf('<a href="%s">%s</a>', $href_votes, $chall->displayEdu()) . '</td>' . PHP_EOL; echo '<td class="gwf_num">' . sprintf('<a href="%s">%s</a>', $href_votes, $chall->displayFun()) . '</td>' . PHP_EOL; if ($solved) { echo '<td class="gwf_date">' . GWF_Time::displayDate($row['csolve_date']) . '</td>' . PHP_EOL; } else { echo '<td></td>' . PHP_EOL; } echo '<td>' . $chall->displayBoardLinks(true, $solved) . '</td>' . PHP_EOL; if ($is_admin) { if ($solved) {