public function execute() { # Not sane ext_all if (false !== ($token = Common::getGet('ext_all'))) { return $this->onUnSubscribeExtAll($token); } # Sanitize if (false !== ($error = $this->sanitize())) { return $error; } # Sane guest: ext_thread if (false !== ($token = Common::getGet('ext_thread'))) { return $this->onUnSubscribeExtThread($token); } # Login Below here if (!GWF_Session::isLoggedIn()) { return GWF_HTML::err('ERR_LOGIN_REQUIRED'); } # Subscribe if (Common::getGet('sub') !== false) { return $this->onSubscribe(); } if (Common::getGet('unsub') !== false) { return $this->onUnSubscribe(); } }
private function onSign() { if (!$this->module->isNewsletterForGuests() && !GWF_Session::isLoggedIn()) { return GWF_HTML::err('ERR_LOGIN_REQUIRED'); } $user = GWF_Session::getUser(); $row = GWF_Newsletter::getRowForUser($user); $form = $this->getForm($row); if (false !== ($error = $form->validate($this->module))) { return $error . $this->templateSign(); } $email = $form->getVar('email'); $type = (int) $form->getVar('type'); $langid = $form->getVar('langid'); $newsletter = new GWF_Newsletter(false); if (false === ($row = $newsletter->getRow($email))) { return $this->onNewSign($email, $type, $langid) . $this->templateSign(); } $back = ''; if ($langid !== $row->getVar('nl_langid')) { $back .= $this->module->message('msg_changed_lang'); $row->saveVar('nl_langid', $langid); } if ($row->getType() !== $type) { $back .= $this->module->message('msg_changed_type'); $row->saveType($type); } return $back . $this->templateSign(); }
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 function execute() { $this->module->includeClass('WC_Warbox'); $this->module->includeClass('WC_Warflag'); $this->module->includeClass('WC_WarToken'); $this->module->includeClass('sites/warbox/WCSite_WARBOX'); # CHECK TOKEN if (isset($_GET['CHECK'])) { $_GET['ajax'] = 1; if (false === ($username = Common::getGetString('username', false))) { return GWF_HTML::err('ERR_PARAMETER', array('username')); } if (false === ($token = Common::getGetString('token', false))) { return GWF_HTML::err('ERR_PARAMETER', array('token')); } return WC_WarToken::isValidWarToken($username, $token) ? '1' : '0'; } # GET CONFIG if (isset($_GET['CONFIG'])) { return $this->genConfig(); } if (!GWF_Session::isLoggedIn()) { return GWF_HTML::err('ERR_LOGIN_REQUIRED'); } # GEN AND SHOW return $this->templateToken(); }
private function displayStats() { $db = gdo_db(); $posts = GWF_TABLE_PREFIX . 'forumpost'; $postcount = $db->queryFirst("SELECT COUNT(*) c FROM {$posts}"); $postcount = $postcount['c']; $btn = GWF_Session::isLoggedIn() ? $this->getHideButton() : ''; $box = '<div><a href="' . GWF_WEB_ROOT . 'active_sites">' . $this->module->lang('rp_sitecount', array(count(WC_Site::getActiveSites()))) . '</a></div>' . PHP_EOL . '<div><a href="' . GWF_WEB_ROOT . 'challs">' . $this->module->lang('rp_challcount', array(GDO::table('WC_Challenge')->countRows())) . '</a></div>' . PHP_EOL . '<div><a href="' . GWF_WEB_ROOT . 'forum">' . $this->module->lang('rp_postcount', array($postcount)) . '</a></div>' . PHP_EOL . '<div><a href="' . GWF_WEB_ROOT . 'users">' . $this->module->lang('rp_usercount', array(GDO::table('GWF_User')->countRows())) . '</a></div>' . PHP_EOL; return $this->sidebox($this->module->lang('rp_stats') . $btn, $box); }
private function templatePage() { $form = $this->getForm(); if (false === ($nick = $this->module->getNickname())) { $nick = ''; } // Focus input by js $focus = GWF_Session::isLoggedIn() ? 'message' : 'yournick'; GWF_Javascript::focusElementByName($focus); $tVars = array('form' => $form->templateX(), 'msgs' => $this->module->getChannelMessages(), 'privmsgs' => $this->module->getPrivateMessages(), 'online' => $this->module->getOnlineUsers(), 'maxmsg_pub' => $this->module->getChanmsgPerPage(), 'maxmsg_priv' => $this->module->getPrivmsgPerPage(), 'nickname' => $nick, 'onlinetime' => $this->module->getOnlineTime(), 'peaktime' => $this->module->getMessagePeak(), 'lagtime' => $this->module->cfgLagPing(), 'href_history' => GWF_WEB_ROOT . 'chat/history', 'href_webchat' => GWF_WEB_ROOT . 'chat', 'href_ircchat' => GWF_WEB_ROOT . 'irc_chat', 'mibbit_url' => $this->module->cfgMibbitURL(), 'mibbit' => $this->module->cfgMibbit(), 'gwf_chat' => $this->module->cfgGWFChat()); return $this->module->templatePHP('page.php', $tVars); }
function shadowlamb3solver(WC_Challenge $chall, $answer) { if (!GWF_Session::isLoggedIn()) { echo GWF_HTML::error('Shadowlamb', 'Better login first!'); return; } $code = WC5Lamb_Solution::validateSolution3($answer, GWF_Session::getUserID()); switch ($code) { case 1: echo GWF_HTML::message('Shadowlamb', $chall->lang('msg_right')); $chall->onChallengeSolved(GWF_Session::getUserID()); break; default: echo GWF_HTML::error('Shadowlamb', $chall->lang('err_wrong_' . $code)); break; } }
private function getForm() { $tags = Common::getPostString('link_tags', Common::getGet('tag')); $data = array('link_lang' => array(GWF_Form::SELECT, GWF_LangSelect::single(GWF_LangSelect::TYPE_SUPPORTED, 'link_lang'), $this->module->lang('th_link_lang')), 'link_score' => array(GWF_Form::STRING, '0', $this->module->lang('th_link_score'), $this->module->lang('tt_link_score')), 'link_gid' => array(GWF_Form::SELECT, GWF_GroupSelect::single('link_gid'), $this->module->lang('th_link_gid'), $this->module->lang('tt_link_gid')), 'tag_info' => array(GWF_Form::HEADLINE, '', $this->module->lang('info_tag')), 'known_tags' => array(GWF_Form::HEADLINE, '', $this->collectTags()), 'link_tags' => array(GWF_Form::STRING, $tags, $this->module->lang('th_link_tags')), 'div1' => array(GWF_Form::DIVIDER), 'link_href' => array(GWF_Form::STRING, '', $this->module->lang('th_link_href'), $this->module->lang('tt_link_href')), 'link_descr' => array(GWF_Form::STRING, '', $this->module->lang('th_link_descr'))); if ($this->module->cfgLongDescription()) { $data['link_descr2'] = array(GWF_Form::MESSAGE, '', $this->module->lang('th_link_descr2')); } $data['link_options&' . GWF_Links::MEMBER_LINK] = array(GWF_Form::CHECKBOX, isset($_POST['link_options&' . GWF_Links::MEMBER_LINK]), $this->module->lang('th_link_options&' . GWF_Links::MEMBER_LINK)); if (GWF_User::isLoggedIn()) { $data['link_options&' . GWF_Links::UNAFILIATE] = array(GWF_Form::CHECKBOX, isset($_POST['link_options&' . GWF_Links::UNAFILIATE]), $this->module->lang('th_link_options&' . GWF_Links::UNAFILIATE)); $data['link_options&' . GWF_Links::ONLY_PRIVATE] = array(GWF_Form::CHECKBOX, isset($_POST['link_options&' . GWF_Links::ONLY_PRIVATE]), $this->module->lang('th_link_options&' . GWF_Links::ONLY_PRIVATE)); } if (!GWF_Session::isLoggedIn() && $this->module->cfgGuestCaptcha()) { $data['captcha'] = array(GWF_Form::CAPTCHA); } $data['buttons'] = array(GWF_Form::SUBMITS, array('preview' => $this->module->lang('btn_preview'), 'add' => $this->module->lang('btn_add'))); return new GWF_Form($this, $data); }
private function templateNewLinks() { $user = GWF_Session::getUser(); $links = GDO::table('GWF_Links'); $by = Common::getGet('by', self::DEFAULT_BY); $dir = Common::getGet('dir', self::DEFAULT_DIR); $orderby = $links->getMultiOrderby($by, $dir); $ipp = $this->module->cfgLinksPerPage(); $nItems = $this->module->countUnread($user); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page')), 1, $nPages); $from = GWF_PageMenu::getFrom($page, $ipp); $pmhref = GWF_WEB_ROOT . ''; $conditions = $this->module->getUnreadConditions($user); $new_links = $links->selectObjects('*', $conditions, $orderby, $ipp, $from); $sortURL = GWF_WEB_ROOT . 'index.php?mo=Links&me=NewLinks&by=%BY%&dir=%DIR%&page=1'; $with_votes = GWF_Session::isLoggedIn() ? true : $this->module->cfgGuestVotes(); $tVars = array('cloud' => $this->module->templateCloud(), 'page_menu' => GWF_PageMenu::display($page, $nPages, $pmhref), 'new_links' => $this->module->templateLinks($new_links, $sortURL, $by, $dir, false, false, false, $with_votes)); return $this->module->templatePHP('new_links.php', $tVars); }
<h1><?php echo $tVars['tag_title'] . GWF_Button::search($tVars['href_search'], $tLang->lang('btn_search')); ?> </h1> <?php if ($tVars['new_link_count'] > 0) { echo '<div class="gwf_buttons_outer">' . PHP_EOL; echo '<div class="gwf_buttons">' . PHP_EOL; if (GWF_Session::isLoggedIn()) { echo GWF_Button::checkmark(true, $tLang->lang('btn_mark_read'), $tVars['href_mark_read']); } echo GWF_Button::bell($tVars['href_new_links'], $tLang->lang('btn_new_links')); echo $tLang->lang('info_newlinks', array($tVars['new_link_count'])); echo '</div></div>' . PHP_EOL; } echo $tVars['cloud']; echo $tVars['page_menu']; echo $tVars['links']; echo $tVars['search']; echo $tVars['page_menu']; if ($tVars['may_add_link']) { echo GWF_Button::wrapStart(); echo GWF_Button::add($tLang->lang('btn_add'), $tVars['href_add']); echo GWF_Button::wrapEnd(); } else { echo GWF_Box::box($tVars['text_add']); }
public static function displayHeaderLogin() { if (GWF_Session::isLoggedIn()) { return ''; } $module = Module_WeChall::instance(); $formhash = '_username_password_bind_ip'; $formhash = GWF_Password::getToken($formhash); $username = $module->lang('th_user_name'); $password = $module->lang('th_password'); $bind_ip = $module->lang('th_bind_ip'); $register = $module->lang('menu_register'); $forgot = $module->lang('btn_forgot_pw'); $login = $module->lang('btn_login'); return '<div id="header_login" class="wc_head_bigbox">' . PHP_EOL . '<div class="wc_head_box">' . PHP_EOL . '<form action="' . GWF_WEB_ROOT . 'login" method="post" id="wc_toplogin">' . PHP_EOL . '<div><img src="' . GWF_WEB_ROOT . 'tpl/wc4/img/icon_user.gif" title="' . $username . '" alt="' . $username . ':" /> <input type="text" name="username" value="" /></div>' . PHP_EOL . '<div><img src="' . GWF_WEB_ROOT . 'tpl/wc4/img/icon_pass.gif" title="' . $password . '" alt="' . $password . ':" /> <input type="password" name="password" value="" /></div>' . PHP_EOL . '<div class="le">' . $bind_ip . ' <input type="checkbox" name="bind_ip" checked="checked" /></div>' . PHP_EOL . '<div class="le">' . '<input type="submit" name="login" value="' . $login . '" />' . '</div>' . PHP_EOL . '<div><a href="' . GWF_WEB_ROOT . 'recovery">' . $forgot . '</a></div>' . PHP_EOL . '</form>' . PHP_EOL . '</div></div>' . PHP_EOL; }
private static function menuPM(Module_BAIM $module) { if (!GWF_Session::isLoggedIn()) { return ''; } $sel = Common::getGet('mo') === 'PM'; $sel = $sel ? ' class="menu_sel"' : ''; $href = GWF_WEB_ROOT . 'pm'; return sprintf('<a %shref="%s">%s</a>', $sel, $href, $module->lang('menu_pm') . self::menuPMAppend($module)); }
public function isCaptchaEnabled() { return GWF_Session::isLoggedIn() ? $this->cfgCaptchaMember() : $this->cfgCaptchaGuest(); }
} } if ($count || $tag === $tVars['tag']) { $href = GWF_WEB_ROOT . $tVars['filter_prefix'] . 'challs/' . $tag . '/by/' . urlencode($by) . '/' . urlencode($dir) . '/page-1'; $text = $tag . '(' . $count . ')'; $cloud_tags .= ', ' . GWF_HTML::anchor($href, $text); } } $href = GWF_WEB_ROOT . $tVars['filter_prefix'] . 'challs/by/' . urlencode($by) . '/' . urlencode($dir) . '/page-1'; $text = 'All(' . count($challs) . ')'; $cloud .= GWF_HTML::anchor($href, $text) . $cloud_tags; $cloud .= '</div>' . PHP_EOL; $cloud .= '</div>' . PHP_EOL; echo $cloud . PHP_EOL; } if ($show_tags_and_filters and GWF_Session::isLoggedIn()) { echo GWF_Button::wrapStart(); echo GWF_Button::generic($tLang->lang('btn_all'), $tVars['href_all'], 'generic', '', $tVars['sel_all']); echo GWF_Button::generic($tLang->lang('th_regat_solved'), $tVars['href_solved'], 'generic', '', $tVars['sel_solved']); echo GWF_Button::generic($tLang->lang('btn_open'), $tVars['href_unsolved'], 'generic', '', $tVars['sel_unsolved']); echo GWF_Button::wrapEnd(); } $headers = array(array($tLang->lang('th_chall_score'), 'chall_score', 'ASC'), array($tLang->lang('th_chall_title'), 'chall_title', 'ASC'), array($tLang->lang('th_chall_creator_name'), 'chall_creator_name', 'ASC'), array($tLang->lang('th_chall_solvecount'), 'chall_solvecount', 'DESC'), array($tLang->lang('th_chall_date'), 'chall_date', 'DESC'), array($tLang->lang('th_chall_votecount'), 'chall_votecount', 'DESC'), array($tLang->lang('th_dif'), 'chall_dif', 'DESC'), array($tLang->lang('th_edu'), 'chall_edu', 'DESC'), array($tLang->lang('th_fun'), 'chall_fun', 'DESC'), array($tLang->lang('th_forum'))); if (!$show_tags_and_filters) { foreach ($headers as &$header) { array_splice($header, 1); } } echo '<table class="wc_chall_table">'; $raw = '<tr><th colspan="10">' . $tVars['table_title'] . '</th></tr>'; echo GWF_Table::displayHeaders1($headers, $tVars['sort_url'], 'chall_date', 'DESC', 'by', 'dir', $raw);
private function overview() { if ($this->tag === '') { $tag_title = $this->module->lang('pt_links'); GWF_Website::setPageTitle($this->module->lang('pt_links')); GWF_Website::setMetaTags($this->module->lang('mt_links')); GWF_Website::setMetaDescr($this->module->lang('md_links')); } else { $dtag = GWF_HTML::display($this->tag); $tag_title = $this->module->lang('pt_linksec', array($dtag)); GWF_Website::setPageTitle($this->module->lang('pt_linksec', array($dtag))); GWF_Website::setMetaTags($this->module->lang('mt_linksec', array($dtag))); GWF_Website::setMetaDescr($this->module->lang('md_linksec', array($dtag))); } $with_votes = GWF_Session::isLoggedIn() ? true : $this->module->cfgGuestVotes(); // $sortURLNew = $this->module->getMethodURL('NewLinks', '&by=%BY%&dir=%DIR%&page=1'); $tVars = array('cloud' => $this->module->templateCloud(), 'search' => '', 'new_link_count' => $this->module->countUnread(GWF_Session::getUser()), 'links' => $this->module->templateLinks($this->links, $this->sortURL, $this->by, $this->dir, false, false, false, $with_votes), 'page_menu' => $this->pagemenu, 'href_add' => $this->hrefAdd, 'href_search' => GWF_WEB_ROOT . 'link/search', 'href_new_links' => GWF_WEB_ROOT . 'index.php?mo=Links&me=NewLinks', 'href_mark_read' => GWF_WEB_ROOT . 'index.php?mo=Links&me=NewLinks&markread=all', 'may_add_link' => $this->hrefAdd !== false, 'tag_title' => $tag_title, 'text_add' => $this->add_link_text); return $this->module->templatePHP('overview.php', $tVars); }