public function onAddSite() { $form = $this->getForm(); if (false !== ($error = $form->validate($this->module))) { return $error . $this->templateSiteAdd(); } $site = new WC_Site(array('site_status' => 'wanted', 'site_name' => $form->getVar('site_name'), 'site_classname' => $form->getVar('site_classname'), 'site_country' => 0, 'site_language' => 0, 'site_joindate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'site_launchdate' => '', 'site_authkey' => GWF_Random::randomKey(32), 'site_xauthkey' => GWF_Random::randomKey(32), 'site_irc' => '', 'site_url' => '', 'site_url_mail' => '', 'site_url_score' => '', 'site_url_profile' => '', 'site_score' => 0, 'site_basescore' => 0, 'site_avg' => 0, 'site_vote_dif' => 0, 'site_vote_fun' => 0, 'site_challcount' => 0, 'site_usercount' => 0, 'site_visit_in' => 0, 'site_visit_out' => 0, 'site_options' => 0, 'site_boardid' => 0, 'site_threadid' => 0, 'site_tags' => '')); if (false === $site->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } Module_WeChall::includeVotes(); if (false === $site->onCreateVotes()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } Module_WeChall::includeForums(); if (false === $site->onCreateBoard()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $site->onCreateThread($this->module)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteDescr.php'; if (false === WC_SiteDescr::insertDescr($site->getID(), 1, 'Please edit me :)')) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_site_added'); }
public function templateVotes(WC_Challenge $chall) { $user = GWF_User::getStaticOrGuest(); $userid = $user->getID(); $has_solved = WC_ChallSolved::hasSolved($userid, $chall->getID()); Module_WeChall::includeForums(); $form_vote = $this->getFormVote($chall, $has_solved, $userid); $tVars = array('chall' => $chall, 'has_solved' => $has_solved, 'form_vote' => $form_vote->templateX($this->module->lang('ft_vote_chall', array($chall->display('chall_title'))))); return $this->module->templatePHP('chall_votes.php', $tVars); }
public function execute() { Module_WeChall::includeForums(); if (false !== ($cid = Common::getGet('solver'))) { return $this->templateSolvers($cid); } WC_HTML::$RIGHT_PANEL = WC_HTML::$LEFT_PANEL = -1; $for_userid = GWF_Session::getUserID(); $from_userid = false; $tag = Common::getGetString('tag', ''); $by = $_GET['by'] = Common::getGetString('by', self::DEFAULT_BY); $dir = $_GET['dir'] = Common::getGetString('dir', self::DEFAULT_DIR); return $this->templateChalls($for_userid, $from_userid, $tag, $by, $dir); }
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'); }
<?php Module_WeChall::includeForums(); $chall = $tVars['chall']; $chall instanceof WC_Challenge; $headers = array(array($tLang->lang('th_length'), 'wmc_length'), array($tLang->lang('th_csolve_date'), 'wmc_date'), array($tLang->lang('th_user_name'), 'user_name'), array($tLang->lang('th_solution'), 'wmc_solution')); $chall->showHeader(true); echo GWF_Box::box($tVars['table_title']); echo $tVars['page_menu']; echo GWF_Table::start(); //echo GWF_Table::displayHeaders1($headers, $tVars['sort_url'], 'wmc_date', 'ASC', 'by', 'dir', $tVars['table_title']); echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']); $guest = GWF_Guest::getGuest(); $userr = new GWF_User(false); foreach ($tVars['data'] as $row) { if ($row['user_name'] === NULL) { $username = GWF_HTML::lang('guest'); } else { $userr->setGDOData($row); $username = $userr->displayProfileLink(); } echo GWF_Table::rowStart(); echo GWF_Table::column($row['wmc_length'], 'gwf_num'); echo GWF_Table::column(GWF_Time::displayDate($row['wmc_date']), 'gwf_date'); echo GWF_Table::column($username); echo GWF_Table::column($row['wmc_solution']); echo GWF_Table::rowEnd(); } echo GWF_Table::end(); echo $tVars['page_menu'];
public static function onInstall(Module_WeChall $module, $dropTable) { Module_WeChall::includeForums(); $module->onStartup(); return self::installMoreClasses($module, $dropTable) . GWF_ModuleLoader::installVars($module, array('wc_uid' => array('0', 'script'), 'wc_basescore' => array('1000', 'int', '1'), 'wc_score_chall' => array('25', 'int', '0', '1000'), 'wc_ipp' => array('50', 'int', '1', '255'), 'wc_sitename_len' => array('32', 'int', '1', '63'), 'wc_jpgraph' => array('/data/tools/code/JPGraph/jpgraph-3.0.7/src/', 'text', '0', '255'), 'wc_graph_w' => array('640', 'int', '1', '4096'), 'wc_graph_h' => array('480', 'int', '1', '2048'), 'wc_lpt' => array(GWF_Time::ONE_DAY * 14, 'time', '0', GWF_Time::ONE_YEAR), 'wc_sol_board' => array('0', 'script'), 'wc_site_board' => array('0', 'script'), 'wc_chall_board' => array('0', 'script'), 'wc_sitemas_dur' => array('1 week', 'time', GWF_Time::ONE_DAY, GWF_Time::ONE_MONTH), 'wc_active_time' => array('1 day', 'time', 0, GWF_Time::ONE_WEEK), 'wc_warbox_url' => array('warbox.wechall.net', 'text', '5', '255'), 'wc_warbox_port' => array('1336', 'int', '1', '65535'), 'wc_logo_url' => array('/', 'text', '1', '255'))) . self::createForums($module, $dropTable) . self::createDBIMGDIR($module, $dropTable) . self::recalcVotes($module, $dropTable) . self::fixSiteLinkCount($module, $dropTable) . self::fixChallTags($module) . self::fixWeChallUser($module) . self::installSiteWeChall($module) . self::installSiteColors($module); }