public function onInclude() { if (false !== ($mod = GWF_Module::loadModuleDB('Votes'))) { $mod->onInclude(); } return parent::onInclude(); }
public function execute() { # Page exists? if (false === ($page = GWF_Page::getByID(Common::getGetString('pageid')))) { header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found"); return $this->module->error('err_404'); } # Have permission to see? if (!$this->checkPermission($page)) { header($_SERVER['SERVER_PROTOCOL'] . " 403 Forbidden"); return GWF_HTML::err('ERR_NO_PERMISSION'); } # Load comments? if ($page->isOptionEnabled(GWF_Page::COMMENTS)) { $this->mod_c = GWF_Module::loadModuleDB('Comments', true, true); if (false === ($this->comments = $page->getComments())) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $_REQUEST['cmts_id'] = $this->comments->getID(); } # Exec ... $back = ''; if (isset($_POST['reply'])) { $back = $this->onReply($page); } return $this->showPage($page) . $back; }
public static function validateCat($arg, $allowZero = true) { if ($arg == 0 && $allowZero || GWF_Category::categoryExists($arg)) { return false; } return GWF_Module::loadModuleDB('Cateogry', false, true)->lang('err_cat'); }
private function sanitize() { if (false === ($this->mod = GWF_Module::loadModuleDB(Common::getGet('module')))) { return GWF_HTML::err('ERR_MODULE_MISSING', array(Common::displayGet('module'))); } // $this->mod->onInclude(); $this->mod->onLoadLanguage(); return false; }
public function execute() { GWF_Module::loadModuleDB('Votes')->onInclude(); if (false !== ($error = $this->sanitize())) { return $error; } GWF_Website::addJavascript(GWF_WEB_ROOT . 'js/module/Links/gwf_links.js'); return $this->overview(); }
public function __call($name, $args) { if (false === ($mo = Common::substrUntil($name, '_'))) { return GWF_HTML::error('ERR_GENERAL', array(__FILE__, __LINE__)); } $me = Common::substrFrom($name, '_'); if (false === ($module = GWF_Module::loadModuleDB($mo))) { return GWF_HTML::error('ERR_MODULE_MISSING', array(__FILE__, __LINE__)); } return $module->execute($me); }
function warscore_function($socket, $pid) { # Init GWF $gwf = new GWF3(getcwd(), array('website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'start_debug' => true, 'get_user' => false, 'log_request' => false, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => false)); gdo_db(); GWF_Debug::setDieOnError(false); GWF_HTML::init(); if (false === ($wechall = GWF_Module::loadModuleDB('WeChall', true, true, true))) { warscore_error($socket, 'Cannot load WeChall!'); } $wechall->includeClass('WC_Warbox'); $wechall->includeClass('WC_WarToken'); $wechall->includeClass('WC_Warflag'); $wechall->includeClass('WC_Warflags'); $wechall->includeClass('sites/warbox/WCSite_WARBOX'); if (false === ($input = socket_read($socket, 2048))) { warscore_error($socket, 'Read Error 1!'); } warscore_debug("GOT INPUT: {$input}"); if (false === ($username = Common::substrUntil($input, "\n", false))) { warscore_error($socket, 'No username sent!'); } if (false === ($user = GWF_User::getByName($username))) { warscore_error($socket, 'Unknown user!'); } warscore_debug("GOT USER: {$username}"); if ('' === ($token = Common::substrFrom($input, "\n", ''))) { warscore_error($socket, 'No token sent!'); } $token = trim(Common::substrUntil($token, "\n", $token)); if (!WC_WarToken::isValidWarToken($user, $token)) { warscore_error($socket, 'Invalid Token!'); } if (!socket_getpeername($socket, $client_ip, $client_port)) { warscore_error($socket, 'Socket Error 2!'); } echo "{$client_ip}\n"; $boxes = WC_Warbox::getByIP($client_ip); if (count($boxes) === 0) { warscore_error($socket, 'Unknown Warbox!'); } warscore_debug("GOT N BOXES: " . count($boxes)); $curr_port = 0; foreach ($boxes as $box) { $box instanceof WC_Warbox; if ($curr_port !== $box->getVar('wb_port')) { $curr_port = $box->getVar('wb_port'); warscore_identd($socket, $box, $user, $client_ip, $client_port); } } socket_write($socket, 'Bailing out! You should not see me.'); socket_close($socket); die(0); }
public function execute() { GWF_Module::loadModuleDB('Forum', true); if (false !== ($array = Common::getPostArray('part'))) { return $this->onPart($array) . $this->templateGroups(); } if (false !== ($array = Common::getPostArray('join'))) { return $this->onJoin($array) . $this->templateGroups(); } return $this->templateGroups(); }
private function formEdit() { $mod_cat = GWF_Module::loadModuleDB('Category', true, true); $page = $this->page; $user = $this->user; $data = array(); $data['url'] = array(GWF_Form::STRING, $page->getVar('page_url'), $this->module->lang('th_url')); // if ($this->is_author) // { $data['type'] = array(GWF_Form::SELECT, GWF_PageType::select($this->module, $page->getMode()), $this->module->lang('th_type')); // } if ($this->is_oowner) { $data['groups'] = array(GWF_Form::SELECT_A, GWF_GroupSelect::multi('groups', $this->getSelectedGroups($page), true, true), $this->module->lang('th_groups')); } $data['noguests'] = array(GWF_Form::CHECKBOX, $page->isLoginRequired(), $this->module->lang('th_noguests')); if ($this->is_author) { $data['index'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::INDEXED), $this->module->lang('th_index')); $data['follow'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::FOLLOW), $this->module->lang('th_follow')); $data['sitemap'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::IN_SITEMAP), $this->module->lang('th_in_sitemap')); } $data['enabled'] = array(GWF_Form::CHECKBOX, $page->isEnabled(), $this->module->lang('th_enabled')); $data['title'] = array(GWF_Form::STRING, $page->getVar('page_title'), $this->module->lang('th_title')); if ($mod_cat !== false) { $data['cat'] = array(GWF_Form::SELECT, GWF_CategorySelect::single('cat', Common::getPostString('cat')), $this->module->lang('th_cat')); } $data['descr'] = array(GWF_Form::STRING, $page->getVar('page_meta_desc'), $this->module->lang('th_descr')); $data['tags'] = array(GWF_Form::STRING, trim($page->getVar('page_meta_tags'), ','), $this->module->lang('th_tags')); $data['show_author'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_AUTHOR), $this->module->lang('th_show_author')); $data['show_similar'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_SIMILAR), $this->module->lang('th_show_similar')); $data['show_modified'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_MODIFIED), $this->module->lang('th_show_modified')); $data['show_trans'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_TRANS), $this->module->lang('th_show_trans')); $data['show_comments'] = array(GWF_Form::CHECKBOX, $page->wantComments(), $this->module->lang('th_show_comments')); if ($this->is_author) { $data['home_page'] = array(GWF_Form::CHECKBOX, $this->module->cfgHomePage() === $page->getOtherID(), $this->module->lang('th_home_page')); } $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file')); $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload')); if ($this->is_author) { $data['inline_css'] = array(GWF_Form::MESSAGE_NOBB, $page->getVar('page_inline_css'), $this->module->lang('th_inline_css')); } if ($page->getMode() === GWF_Page::BBCODE) { $data['content'] = array(GWF_Form::MESSAGE, $page->getVar('page_content'), $this->module->lang('th_content')); } else { $data['content'] = array(GWF_Form::MESSAGE_NOBB, $page->getVar('page_content'), $this->module->lang('th_content')); } $buttons = array('edit' => $this->module->lang('btn_edit'), 'translate' => $this->module->lang('btn_translate')); if ($this->is_author && $page->isLocked()) { $buttons['unlock'] = $this->module->lang('btn_unlock'); } $buttons['delete'] = $this->module->lang('btn_delete'); $data['buttons'] = array(GWF_Form::SUBMITS, $buttons); return new GWF_Form($this, $data); }
private static function recalcVotes(Module_WeChall $module, $dropTable) { if (false === ($mod_votes = GWF_Module::loadModuleDB('Votes', true))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes')); } if (false === WC_Site::onRecalcAllVotes()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === WC_Challenge::onRecalcAllVotes()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return ''; }
public function execute() { if (false === ($mod_votes = GWF_Module::loadModuleDB('Votes', true))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes')); } if (false === ($chall = WC_Challenge::getByID(Common::getGet('cid', 0)))) { return $this->module->error('err_chall'); } require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php'; if (false !== Common::getPost('vote')) { return $this->onVote($chall) . $this->templateVotes($chall); } return $this->templateVotes($chall); }
public function onStartup() { $this->onLoadLanguage(); self::$instance = $this; $payment_modules = GDO::table('GWF_Module')->selectColumn('module_name', 'module_options&1 AND module_name like \'Payment%\'', 'module_priority ASC'); foreach ($payment_modules as $modulename) { GWF_Module::loadModuleDB($modulename); } // $modules = GWF_Module::getModules(); // foreach ($modules as $name => $module) // { // if (Common::startsWith($name, 'Payment') && is_array($module)) // { // GWF_Module::getModule($name, true); // } // } // $this->onLoadLanguage(); }
public function execute() { if (false === ($mod_votes = GWF_Module::loadModuleDB('Votes'))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes')); } $mod_votes->onInclude(); if (!($this->thread = GWF_ForumThread::getThread(Common::getGet('tid')))) { return $this->module->error('err_thread'); } $this->user = GWF_Session::getUser(); if (!$this->thread->mayAddPoll($this->user)) { return GWF_HTML::err('ERR_NO_PERMISSION'); } if (false !== Common::getPost('assign')) { return $this->onAssign() . $this->template(); } return $this->template(); }
private static function checkLinksDown(Module_Links $module) { GWF_Module::loadModuleDB('Votes')->onInclude(); $links = GDO::table('GWF_Links'); $limit = $module->cfgCheckAmount(); $cut = time() - $module->cfgCheckInterval(); $dead = GWF_Links::DEAD; if (false === ($result = $links->selectObjects('*', "link_lastcheck<{$cut} AND link_options&{$dead}=0", 'link_lastcheck DESC', $limit))) { return self::error("Database error Links-1"); } if (0 === ($left = count($result))) { return self::notice('No links to check.'); } self::notice("Checking {$left} links."); foreach ($result as $link) { self::checkLinkDown($module, $link); } }
public function execute() { if (false === ($mod_c = GWF_Module::loadModuleDB('Comments', true, true))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Comments')); } if (false === ($news = GWF_News::getByID(Common::getGetString('newsid')))) { return $this->module->error('err_news'); } $key = $news->getCommentsKey(); $gid = GWF_Group::getByName(GWF_Group::MODERATOR)->getID(); if (false === ($comments = GWF_Comments::getOrCreateComments($key, 0, $gid))) { return $this->module->error('err_news'); } $_REQUEST['cmts_id'] = $comments->getID(); $back = ''; if (isset($_POST['reply'])) { return $this->onReply($mod_c, $news, $comments); } return $back . $this->templateComments($mod_c, $news, $comments); }
public function execute() { if (false === ($mod_gb = GWF_Module::loadModuleDB('Guestbook', true))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Guestbook')); } $mod_gb instanceof Module_Guestbook; $user = GWF_Session::getUser(); if (!$mod_gb->canCreateGuestbook($user)) { return $this->module->error('err_create_gb'); } if (false !== ($gb = $mod_gb->getGuestbook($user->getID()))) { GWF_Website::redirect($gb->hrefEdit()); return ''; // return $this->module->error('err_have_gb'); } $options = GWF_Guestbook::DEFAULT_OPTIONS; $gb = new GWF_Guestbook(array('gb_uid' => $user->getID(), 'gb_title' => $user->getVar('user_name') . 's Guestbook', 'gb_descr' => $user->getVar('user_name') . 's Guestbook', 'gb_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'gb_options' => $options)); if (false === $gb->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_created_gb', array(GWF_WEB_ROOT . 'guestbook/edit/' . $gb->getID())); }
private function formAdd() { $mod_cat = GWF_Module::loadModuleDB('Category', true, true); $data = array(); $data['url'] = array(GWF_Form::STRING, '', $this->module->lang('th_url')); $data['type'] = array(GWF_Form::SELECT, GWF_PageType::select($this->module), $this->module->lang('th_type')); $data['lang'] = array(GWF_Form::SELECT, GWF_LangSelect::single(1, 'lang'), $this->module->lang('th_lang')); $data['groups'] = array(GWF_Form::SELECT_A, GWF_GroupSelect::multi('groups', true, true, true), $this->module->lang('th_groups')); $data['noguests'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_noguests')); if ($this->is_author) { $data['index'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_index')); $data['follow'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_follow')); $data['sitemap'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_in_sitemap')); } $data['title'] = array(GWF_Form::STRING, '', $this->module->lang('th_title')); if ($mod_cat !== false) { $data['cat'] = array(GWF_Form::SELECT, GWF_CategorySelect::single('cat', Common::getPostString('cat')), $this->module->lang('th_cat')); } $data['descr'] = array(GWF_Form::STRING, '', $this->module->lang('th_descr')); $data['tags'] = array(GWF_Form::STRING, '', $this->module->lang('th_tags')); $data['show_author'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_author')); $data['show_similar'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_similar')); $data['show_modified'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_modified')); $data['show_trans'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_trans')); $data['show_comments'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_comments')); if ($this->is_author) { $data['home_page'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_home_page')); } $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file')); $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload')); if ($this->is_author) { $data['inline_css'] = array(GWF_Form::MESSAGE_NOBB, '', $this->module->lang('th_inline_css')); } $data['content'] = array(GWF_Form::MESSAGE_NOBB, '', $this->module->lang('th_content')); $buttons = array('preview' => $this->module->lang('btn_preview'), 'add' => $this->module->lang('btn_add')); $data['buttons'] = array(GWF_Form::SUBMITS, $buttons); return new GWF_Form($this, $data); }
function crackcha_answer(WC_Challenge $chall) { if ('' === ($answer = Common::getGetString('answer', ''))) { echo $chall->lang('err_no_answer'); return; } if (false === ($solution = GWF_Session::getOrDefault('WCC_CRACKCHA_CHARS', false))) { echo $chall->lang('err_no_problem'); return; } if ($answer === $solution) { crackcha_increase_solved(); echo $chall->lang('msg_success', array(GWF_Session::getOrDefault('WCC_CRACKCHA_SOLVED', 0), WCC_CRACKCHA_NEED)); if (crackcha_solved()) { GWF_Module::loadModuleDB('Forum', true, true); Module_WeChall::includeForums(); $chall->onChallengeSolved(GWF_Session::getUserID()); } } else { echo $chall->lang('msg_failed', array($answer, $solution)); } GWF_Session::remove('WCC_CRACKCHA_CHARS'); }
function salesman_check_answer(WC_Challenge $chall, $answer) { if (salesman_has_problem() === true) { if (salesman_check_answer_B($chall, $answer) === true) { $level = salesman_getLevel(); $level++; if ($level > WCC_TR_CU_COUNT) { if (false !== ($module = GWF_Module::loadModuleDB('Forum'))) { $module->onInclude(); } $chall->onChallengeSolved(GWF_Session::getUserID()); $level = 1; GWF_Session::set('WCC_TR_CU_LEVEL', $level); return $chall->lang('msg_solved'); } GWF_Session::set('WCC_TR_CU_LEVEL', $level); return $chall->lang('msg_next_level', array($level)); } else { return salesman_fail($chall); } } else { return $chall->lang('err_no_prob'); } }
public static function loadModuleFS($name) { if (isset(GWF_Module::$MODULES[$name])) { return GWF_Module::$MODULES[$name]; } $modulename = "Module_{$name}"; $filename = GWF_CORE_PATH . "module/{$name}/{$modulename}.php"; if (false === Common::isFile($filename)) { return false; } require_once $filename; if (false === class_exists($modulename)) { return false; } $module = new $modulename(); $module instanceof GWF_Module; if (false === ($module_db = GWF_Module::loadModuleDB($name))) { $options = 0; $options |= $module->getDefaultAutoLoad() ? GWF_Module::AUTOLOAD : 0; // $options |= $module->getDefaultEnabled() ? GWF_Module::ENABLED : 0; $data = array('module_id' => 0, 'module_name' => $name, 'module_priority' => $module->getDefaultPriority(), 'module_version' => 0.0, 'module_options' => $options); } else { $data = $module_db->getGDOData(); } GWF_Module::$MODULES[$name] = $module; $module->setGDOData($data); $module->setOption(GWF_Module::AUTOLOAD, $module->getDefaultAutoLoad()); $module->loadVars(); if (true === $module->isEnabled()) { $module->onStartup(); } return $module; }
/** * Get the comments thread. * @return GWF_Comments */ public function getComments() { if (false === ($mod_c = GWF_Module::loadModuleDB('Comments', true, true))) { return false; } return GWF_Comments::getOrCreateComments('_GWF_PBC_' . $this->getID(), $this->getVar('page_author')); }
</td> <td class="gwf_num"><?php echo $c->getVar('board_postcount'); ?> </td> <?php echo GWF_Table::rowEnd(); } echo GWF_Table::end(); } ?> <?php # SHOUTBOX if ($b->isRoot()) { if (false !== ($mod_shout = GWF_Module::loadModuleDB('Shoutbox'))) { echo GWF_HTML::div(Module_Shoutbox::templateBoxS(), 'gwf_forum_shoutbox fl'); } } ?> <div class="cl"></div> <?php echo $tVars['pagemenu_boards']; ?> <!-- Threads --> <?php if (count($tVars['threads']) > 0) { $t_headers = array(array($tLang->lang('th_title'), 'thread_title'), array(''), array($tLang->lang('th_firstposter'), 'thread_firstposter'), array($tLang->lang('th_postcount'), 'thread_postcount'), array($tLang->lang('th_lastposter'), 'thread_lastposter'), array($tLang->lang('th_lastdate'), 'thread_lastdate'), array($tLang->lang('th_thanks'), 'thread_thanks'), array($tLang->lang('th_votes_up'), 'thread_votes_up'), array($tLang->lang('th_thread_viewcount'), 'thread_viewcount'));
public static function includeForums() { if (false !== GWF_Module::loadModuleDB('Forum', true)) { GWF_ForumBoard::init(true); } }
/** * Load the $_GET['mo'] or GWF_DEFAULT_MODULE and execute it * @return GWF3 */ public function onLoadModule() { # Load the module $db = gdo_db(); if (false === (self::$MODULE = GWF_Module::loadModuleDB($_GET['mo']))) { if (false === (self::$MODULE = GWF_Module::loadModuleDB(GWF_DEFAULT_MODULE))) { self::logDie('No module found.'); } $_GET['me'] = GWF_DEFAULT_METHOD; } # Module is enabled? if (true === self::$MODULE->isEnabled()) { # Execute the method self::$MODULE->onInclude(); self::$MODULE->onLoadLanguage(); $db = gdo_db(); $db->transactionStart(); self::$page = self::$MODULE->execute($_GET['me']); if (true === isset($_GET['ajax'])) { self::$page = GWF_Website::getDefaultOutput() . self::$page; } } else { # TODO: HTTP Response code (by GWF_Exception(?)) self::$page = GWF_HTML::err('ERR_MODULE_DISABLED', array(self::$MODULE->display('module_name'))); } return $this; }
/** * Call a hook. User is a default argument. calls hook($user, array $args) * @param string $name unique ID * @param GWF_User $user the current user * @param array $args */ public static function call($name, GWF_User $user, array $args = array()) { self::initHooks(); if (!isset(self::$HOOKS[$name])) { // GWF_Log::logCritical('Unknown hook: '.$name); return true; } $output = ''; foreach (self::$HOOKS[$name] as $hook) { $modulename = Common::substrFrom($hook[0], '_'); if (false !== ($module = GWF_Module::loadModuleDB($modulename, true, true))) { $output .= self::cleanResult($hook, call_user_func(array($module, $hook[1]), $user, $args)); } } if ($output === '') { return true; } GWF_Website::addDefaultOutput($output); return false; }
} require_once GWF_CORE_PATH . 'module/WeChall/WC_HistoryUser2.php'; # Graphs and Activity if ($u->getLevel() > 0) { echo wcProfileLastActivity($u, 10, $priv); // echo '<div class="cb"></div>'.PHP_EOL; echo '<section class="profile_graphs">'; echo wcProfileGraphRank($u); echo wcProfileGraphScore($u); echo '</section>'; } else { echo '<div class="cb"></div>' . PHP_EOL; } # Links //if ( (false !== ($mod_links = GWF_Module::getModule('Links'))) && (false !== ($mod_votes = GWF_Module::getModule('Votes'))) ) if (false !== ($mod_links = GWF_Module::loadModuleDB('Links', true, true)) && false !== ($mod_votes = GWF_Module::loadModuleDB('Votes', true))) { // $mod_votes->onInclude(); // $mod_links->onInclude(); // $mod_links->onLoadLanguage(); echo wcProfileFavLinks($u, $mod_links); echo wcProfileOwnLinks($u, $mod_links); } # Challs if (WC_Challenge::getScoreForUser($u) > 0) { Module_WeChall::includeForums(); // GWF_Module::getModule('Forum')->onInclude(); # Profile Challs $method = $wechall->getMethod('ChallsProfile'); $method instanceof WeChall_ChallsProfile; echo $method->templateChalls($u); # Created By
public function form() { $form = $this->getForm(); $tVars = array('form' => $form->templateY($this->module->lang('title_login')), 'have_cookies' => GWF_Session::haveCookies(), 'tooltip' => $form->getTooltipText('bind_ip'), 'register' => GWF_Module::loadModuleDB('Register', false, false, true) !== false, 'recovery' => GWF_Module::loadModuleDB('PasswordForgot', false, false, true) !== false); return $this->module->template($this->_tpl, $tVars); }
echo $tLang->lang('it_graph_sitechalls', array($name)); ?> " alt="<?php echo $tLang->lang('it_graph_sitechalls', array($name)); ?> "></img></div> <?php } ?> <?php #} ?> <div class="cl"></div> <?php } ?> <?php if ('0' !== ($tid = $site->getVar('site_threadid'))) { $_GET['tid'] = $tid; $_GET['last_page'] = true; if (false !== ($forum = GWF_Module::loadModuleDB('Forum', true, true))) { GWF_ForumBoard::init(true, false); echo $forum->requestMethodB('ShowThread'); } } $dtitle = $site->getVar('site_name'); $args = array($dtitle); GWF_Website::setPageTitle($tLang->lang('pt_site_detail', $args)); GWF_Website::setMetaTags($tLang->lang('mt_site_detail', $args)); GWF_Website::setMetaDescr($tLang->lang('md_site_detail', $args));
<?php header('Content-Type: text/plain'); chdir('../../../../'); define('GWF_PAGE_TITLE', 'The Travelling Customer'); require_once 'challenge/gwf_include.php'; GWF_Website::init(getcwd()); require_once 'challenge/training/programming/knapsaak/salesman.php'; $wechall = GWF_Module::loadModuleDB('WeChall', true, true); if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) { $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 4, 'challenge/training/programming/knapsaak/index.php'); } echo salesman_on_submit_answer($chall); //GWF_Session::commit();
public static function displayHeaderLoginBROKEN(Module_WeChall $module) { if (GWF_User::isLoggedIn() || !GWF_Session::haveCookies()) { return ''; } if (false === ($mod_login = GWF_Module::loadModuleDB('Login', false, true))) { return ''; } $formhash = GWF_Password::getToken('_username_password_bind_ip_login'); return '<form action="' . GWF_WEB_ROOT . 'login" method="post" id="wc_toplogin">' . '<div>' . GWF_CSRF::hiddenForm($formhash) . '</div>' . '<div>' . $mod_login->lang('th_username') . ' <input type="text" name="username" value="" />' . '</div>' . '<div>' . $mod_login->lang('th_password') . ' <input type="password" name="password" value="" />' . '</div>' . '<div>' . $mod_login->lang('th_bind_ip') . ' <input type="checkbox" name="bind_ip" checked="checked" />' . '<input type="submit" name="login" value="' . $mod_login->lang('btn_login') . '" />' . '</div>' . '</form>'; }