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 execute() { if (false === ($chall = WC_Challenge::getByID(Common::getGet('cid')))) { return $this->module->error('err_chall'); } if (false !== Common::getPost('edit')) { return $this->onEdit($chall) . $this->templateEdit($chall); } if (false !== Common::getPost('reset')) { return $this->onReset($chall) . $this->templateEdit($chall); } if (false !== Common::getPost('delete')) { return $this->onDelete($chall); } return $this->templateEdit($chall); }
public function execute() { if (false === ($chall = WC_Challenge::getByID(Common::getGetString('cid')))) { return $this->module->error('err_chall'); } $user = GWF_User::getStaticOrGuest(); $token = Common::getGetString('token'); $length = Common::clamp(Common::getGetInt('length'), 1); require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php'; require_once GWF_CORE_PATH . 'module/WeChall/WC_MathChall.php'; if (!WC_ChallSolved::hasSolved($user->getID(), $chall->getID())) { if (!WC_MathChall::checkToken($chall, $length, $token)) { return $this->module->error('err_token'); } } return $this->templateSolutions($chall, $user, $length, $token); }
public function templateOutput($date, $amt) { require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php'; $table = GDO::table('WC_ChallSolved'); if (false === ($result = $table->selectAll('*', "csolve_date>='{$date}'", 'csolve_date DESC', NULL, $amt))) { return ''; } $back = ''; foreach ($result as $row) { if (false === ($user = GWF_User::getByID($row['csolve_uid']))) { continue; } if (false === ($chall = WC_Challenge::getByID($row['csolve_cid']))) { continue; } $row['username'] = $user->getVar('user_name'); $row['challname'] = $chall->getVar('chall_title'); $row['solvecount'] = $chall->getVar('chall_solvecount'); $row['curl'] = $chall->getVar('chall_url'); $row = array_map(array(__CLASS__, 'escapeCSV'), $row); $back .= implode('::', $row) . PHP_EOL; } return $back; }
/** * @return WC_Challenge */ public function getChallenge() { return WC_Challenge::getByID($this->getChallID()); }
public function templateSolvers($cid) { if (false === ($chall = WC_Challenge::getByID($cid))) { return $this->module->error('err_chall'); } }