private function templateLevels() { $bid = $this->box->getID(); $_GET['sid'] = $this->box->getSiteID(); $_GET['bid'] = $bid; $tVars = array('site_quickjump' => $this->module->templateSiteQuickjump('boxdetail'), 'data' => $this->getData(), 'box' => $this->box, 'site' => $this->box->getSite(), 'method' => $this, 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=WeChall&me=WarboxDetails&boxid=' . $bid . '&by=%BY%&dir=%DIR%'); return $this->module->templatePHP('warbox_details.php', $tVars); }
private function onEdit() { $form = $this->formEdit(); if (false !== ($error = $form->validate($this->module))) { return $error . $this->templateEdit(); } $data = array('wf_cat' => $form->getVar('wf_cat'), 'wf_score' => $form->getVar('wf_score'), 'wf_title' => $form->getVar('wf_title'), 'wf_url' => $form->getVar('wf_url'), 'wf_authors' => $form->getVar('wf_authors'), 'wf_status' => $form->getVar('wf_status'), 'wf_login' => $form->getVar('wf_login'), 'wf_created_at' => $form->getVar('wf_created_at')); $f = $form->getVar('password'); if ($f !== '') { $data['wf_flag_enc'] = WC_Warflag::hashPassword($f); } if (!$this->flag->saveVars($data)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateOverview(); } $site = $this->warbox->getSite(); if ($site->isLinear()) { $site->saveVar('site_maxscore', WC_Warflag::getTotalscoreForSite($site)); } $this->warbox->recalcTotalscore(); $site->recalcSite(); return $this->module->message('msg_edit_flag') . $this->templateOverview(); }
public function onAnswer(WC_Warflag $flag, $password) { if (false === ($this->user = GWF_Session::getUser())) { return GWF_HTML::err('ERR_LOGIN_REQUIRED'); } if (false === ($this->box = $flag->getWarbox())) { return $this->module->error('err_warbox'); } if (false === ($this->site = $this->box->getSite())) { return $this->module->error('err_site'); } if (!$flag->isWarflag()) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } if (false !== ($error = $this->checkBrute($flag))) { return $error; } $password = WC_Warflag::hashPassword($password); if ($password !== $flag->getVar('wf_flag_enc')) { return $this->onFailed($flag); } else { return $this->onSolved($flag); } }
function warscore_update($socket, WC_Warbox $box, GWF_User $user, $level) { $site = $box->getSite(); $result = $site->onUpdateUser($user); warscore_error($socket, $result->getMessage()); }