protected function ProcessRegistration() { // Yes, there was an error if (!$this->VerifyData()) { $this->ShowForm(); } else { $data = array('firstname' => $this->post->firstname, 'lastname' => $this->post->lastname, 'email' => $this->post->email, 'password' => $this->post->password1, 'code' => $this->post->code, 'location' => $this->post->location, 'hub' => $this->post->hub, 'confirm' => false); if (CodonEvent::Dispatch('registration_precomplete', 'Registration', $_POST) == false) { return false; } $ret = RegistrationData::CheckUserEmail($data['email']); if ($ret) { $this->set('error', Lang::gs('email.inuse')); $this->render('registration_error.tpl'); return false; } $val = RegistrationData::AddUser($data); if ($val == false) { $this->set('error', RegistrationData::$error); $this->render('registration_error.tpl'); return; } else { $pilotid = RegistrationData::$pilotid; /* Automatically confirm them if that option is set */ if (Config::Get('PILOT_AUTO_CONFIRM') == true) { PilotData::AcceptPilot($pilotid); RanksData::CalculatePilotRanks(); $pilot = PilotData::GetPilotData($pilotid); $this->set('pilot', $pilot); $this->render('registration_autoconfirm.tpl'); } else { RegistrationData::SendEmailConfirm($email, $firstname, $lastname); $this->render('registration_sentconfirmation.tpl'); } } CodonEvent::Dispatch('registration_complete', 'Registration', $_POST); // Registration email/show user is waiting for confirmation $sub = 'A user has registered'; $message = "The user {$data['firstname']} {$data['lastname']} ({$data['email']}) has registered, and is awaiting confirmation."; $email = Config::Get('EMAIL_NEW_REGISTRATION'); if (empty($email)) { $email = ADMIN_EMAIL; } Util::SendEmail($email, $sub, $message); // Send email to user $this->set('firstname', $data['firstname']); $this->set('lastname', $data['lastname']); $this->set('userinfo', $data); $message = Template::Get('email_registered.tpl', true); Util::SendEmail($data['email'], 'Registration at ' . SITE_NAME, $message); $rss = new RSSFeed('Latest Pilot Registrations', SITE_URL, 'The latest pilot registrations'); $allpilots = PilotData::GetLatestPilots(); foreach ($allpilots as $pilot) { $rss->AddItem('Pilot ' . PilotData::GetPilotCode($pilot->code, $pilot->pilotid) . ' (' . $pilot->firstname . ' ' . $pilot->lastname . ')', SITE_URL . '/admin/index.php?admin=pendingpilots', '', ''); } $rss->BuildFeed(LIB_PATH . '/rss/latestpilots.rss'); } }
public function approveall() { echo '<h3>Approve All</h3>'; $allpireps = PIREPData::findPIREPS(array('p.accepted' => PIREP_PENDING)); $total = count($allpireps); $count = 0; foreach ($allpireps as $pirep_details) { if ($pirep_details->aircraft == '') { continue; } # Update pilot stats SchedulesData::IncrementFlownCount($pirep_details->code, $pirep_details->flightnum); PIREPData::ChangePIREPStatus($pirep_details->pirepid, PIREP_ACCEPTED); // 1 is accepted //PilotData::UpdateFlightData($pirep_details->pilotid, $pirep_details->flighttime, 1); PilotData::UpdatePilotStats($pirep_details->pilotid); PilotData::UpdatePilotPay($pirep_details->pilotid, $pirep_details->flighttime); RanksData::CalculateUpdatePilotRank($pirep_details->pilotid); RanksData::CalculatePilotRanks(); PilotData::GenerateSignature($pirep_details->pilotid); StatsData::UpdateTotalHours(); $count++; } $skipped = $total - $count; echo "{$count} of {$total} were approved ({$skipped} has errors)"; }
/** * Maintenance::calculateranks() * * @return */ public function calculateranks() { CodonModule::checkPermission(MAINTENANCE); echo '<h3>Resetting Ranks</h3>'; RanksData::CalculatePilotRanks(); echo 'Done!'; LogData::addLog(Auth::$userinfo->pilotid, 'Recalculated ranks'); }
public function calculateranks() { echo '<h3>Resetting Ranks</h3>'; RanksData::CalculatePilotRanks(); echo 'Done!'; LogData::addLog(Auth::$userinfo->pilotid, 'Recalculated ranks'); }
protected function ApprovePilot() { PilotData::AcceptPilot($this->post->id); RanksData::CalculatePilotRanks(); $pilot = PilotData::GetPilotData($this->post->id); # Send pilot notification $subject = Lang::gs('email.register.accepted.subject'); $this->set('pilot', $pilot); $message = Template::GetTemplate('email_registrationaccepted.tpl', true, true, true); Util::SendEmail($pilot->email, $subject, $message); CodonEvent::Dispatch('pilot_approved', 'PilotAdmin', $pilot); LogData::addLog(Auth::$userinfo->pilotid, 'Approved ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname); }
public function approveall() { $this->checkPermission(MODERATE_PIREPS); echo '<h3>Approve All</h3>'; $allpireps = PIREPData::findPIREPS(array('p.accepted' => PIREP_PENDING)); $total = count($allpireps); $count = 0; foreach ($allpireps as $pirep_details) { if ($pirep_details->aircraft == '') { continue; } # Update pilot stats SchedulesData::IncrementFlownCount($pirep_details->code, $pirep_details->flightnum); PIREPData::ChangePIREPStatus($pirep_details->pirepid, PIREP_ACCEPTED); // 1 is accepted #PilotData::UpdatePilotStats($pirep_details->pilotid); #RanksData::CalculateUpdatePilotRank($pirep_details->pilotid); RanksData::CalculatePilotRanks(); #PilotData::GenerateSignature($pirep_details->pilotid); #StatsData::UpdateTotalHours(); CodonEvent::Dispatch('pirep_accepted', 'PIREPAdmin', $pirep_details); $count++; } $skipped = $total - $count; echo "{$count} of {$total} were approved ({$skipped} has errors)"; }
/** * PilotAdmin::ApprovePilot() * * @return */ protected function ApprovePilot() { $this->checkPermission(MODERATE_REGISTRATIONS); PilotData::AcceptPilot($this->post->id); RanksData::CalculatePilotRanks(); $pilot = PilotData::getPilotData($this->post->id); # Send pilot notification $subject = Lang::gs('email.register.accepted.subject'); $this->set('pilot', $pilot); $oldPath = Template::setTemplatePath(TEMPLATES_PATH); $oldSkinPath = Template::setSkinPath(ACTIVE_SKIN_PATH); $message = Template::getTemplate('email_registrationaccepted.php', true, true, true); Template::setTemplatePath($oldPath); Template::setSkinPath($oldSkinPath); Util::SendEmail($pilot->email, $subject, $message); CodonEvent::Dispatch('pilot_approved', 'PilotAdmin', $pilot); LogData::addLog(Auth::$userinfo->pilotid, 'Approved ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname); }