Пример #1
0
 public function sendmail()
 {
     $this->checkPermission(EMAIL_PILOTS);
     echo '<h3>Sending email</h3>';
     if ($this->post->subject == '' || trim($this->post->message) == '') {
         $this->set('message', 'You must enter a subject and message!');
         $this->render('core_error.php');
         return;
     }
     if (count($this->post->groups) == 0) {
         $this->set('message', 'You must select groups to send to!');
         $this->render('core_error.php');
         return;
     }
     echo 'Sending email...<br />';
     $pilotarray = array();
     //Begin the nice long assembly of e-mail addresses
     foreach ($this->post->groups as $groupid) {
         if ($groupid == 'all') {
             $all_pilots = PilotData::findPilots(array());
             foreach ($all_pilots as $pilot) {
                 $pilotarray[$pilot->pilotid] = $pilot;
             }
             break;
         } else {
             $tmp = PilotGroups::getUsersInGroup($groupid);
             if (count($tmp) == 0 || !is_array($tmp)) {
                 continue;
             }
             foreach ($tmp as $pilot) {
                 $pilotarray[$pilot->pilotid] = $pilot;
             }
         }
     }
     $subject = DB::escape($this->post->subject);
     $message = stripslashes($this->post->message) . PHP_EOL . PHP_EOL;
     # Do some quick fixing of obvious formatting errors
     $message = str_replace('<br>', '<br />', $message);
     foreach ($pilotarray as $pilot) {
         echo 'Sending for ' . $pilot->firstname . ' ' . $pilot->lastname . '<br />';
         # Variable replacements
         $send_message = str_replace('{PILOT_FNAME}', $pilot->firstname, $message);
         $send_message = str_replace('{PILOT_LNAME}', $pilot->lastname, $send_message);
         $send_message = str_replace('{PILOT_ID}', PilotData::GetPilotCode($pilot->code, $pilot->pilotid), $send_message);
         $send_message = utf8_encode($send_message);
         Util::SendEmail($pilot->email, $subject, $send_message);
     }
     echo 'Complete!';
     LogData::addLog(Auth::$userinfo->pilotid, 'Sent pass mail');
     return;
 }
Пример #2
0
 public function index()
 {
     require_once CORE_LIB_PATH . '/recaptcha/recaptchalib.php';
     if ($this->post->submit) {
         if (Auth::LoggedIn() == false) {
             # Make sure they entered an email address
             if (trim($this->post->name) == '' || trim($this->post->email) == '') {
                 $this->set('message', 'You must enter a name and email!');
                 $this->render('core_error.tpl');
                 return;
             }
         }
         $resp = recaptcha_check_answer(Config::Get('RECAPTCHA_PRIVATE_KEY'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
         // Check the captcha thingy
         if (!$resp->is_valid) {
             $this->set('captcha_error', $resp->error);
             $this->set('message', 'You failed the captcha test!');
             $this->render('contact_form.tpl');
             return;
         }
         if ($this->post->subject == '' || trim($this->post->message) == '') {
             $this->set('message', 'You must enter a subject and message!');
             $this->render('core_error.tpl');
             return;
         }
         $subject = 'New message from ' . $this->post->name . ' - "' . $this->post->subject . '"';
         $message = DB::escape($this->post->message) . PHP_EOL . PHP_EOL;
         unset($_POST['recaptcha_challenge_field']);
         unset($_POST['recaptcha_response_field']);
         foreach ($_POST as $field => $value) {
             $message .= "-{$field} = {$value}" . PHP_EOL;
         }
         $message = nl2br($message);
         $message = utf8_encode($message);
         Util::SendEmail(ADMIN_EMAIL, $subject, $message);
         $this->render('contact_sent.tpl');
         return;
     }
     # Just a simple addition
     $rand1 = rand(1, 10);
     $rand2 = rand(1, 10);
     $this->set('rand1', $rand1);
     $this->set('rand2', $rand2);
     $tot = $rand1 + $rand2;
     //echo "total: $tot <br />";
     SessionManager::Set('captcha_sum', $tot);
     //echo 'output of $_SESSION: <br />';
     //print_r($_SESSION);
     $this->render('contact_form.tpl');
 }
Пример #3
0
 public function index()
 {
     //Google reCaptcha
     //updated to Google noCaptcha 1/15
     require_once CORE_LIB_PATH . '/recaptcha/recaptchalib.php';
     $this->set('sitekey', RECAPTCHA_PUBLIC_KEY);
     $this->set('lang', 'en');
     if ($this->post->submit) {
         if (Auth::LoggedIn() == false) {
             # Make sure they entered an email address
             if (trim($this->post->name) == '' || trim($this->post->email) == '') {
                 $this->set('message', 'You must enter a name and email!');
                 $this->render('core_error.tpl');
                 return;
             }
         }
         //Google reCaptcha
         //updated to Google noCaptcha 1/15
         $resp = null;
         $reCaptcha = new ReCaptcha(RECAPTCHA_PRIVATE_KEY);
         // Was there a reCAPTCHA response?
         if ($_POST["g-recaptcha-response"]) {
             $resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"]);
         }
         //check if reCaptcha response was valid
         if ($resp == null) {
             $this->set('captcha_error', 'reCaptcha Validation Error');
             $this->render('contact_form.tpl');
             return;
         }
         //end Google reCaptcha
         if ($this->post->subject == '' || trim($this->post->message) == '') {
             $this->set('message', 'You must enter a subject and message!');
             $this->render('core_error.tpl');
             return;
         }
         $subject = 'New message from ' . $this->post->name . ' - "' . $this->post->subject . '"';
         $message = DB::escape($this->post->message) . PHP_EOL . PHP_EOL;
         foreach ($_POST as $field => $value) {
             $message .= "-{$field} = {$value}" . PHP_EOL;
         }
         $message = nl2br($message);
         $message = utf8_encode($message);
         Util::SendEmail(ADMIN_EMAIL, $subject, $message);
         $this->render('contact_sent.tpl');
         return;
     }
     $this->render('contact_form.tpl');
 }
Пример #4
0
 public function ResetPassword()
 {
     $email = $this->post->email;
     if (!$email) {
         return false;
     } else {
         $pilot = PilotData::GetPilotByEmail($email);
         if (!$pilot) {
             $this->render('login_notfound.tpl');
             return;
         }
         $newpw = substr(md5(date('mdYhs')), 0, 6);
         RegistrationData::ChangePassword($pilot->pilotid, $newpw);
         $this->set('firstname', $pilot->firstname);
         $this->set('lastname', $pilot->lastname);
         $this->set('newpw', $newpw);
         $message = Template::GetTemplate('email_lostpassword.tpl', true);
         Util::SendEmail($pilot->email, 'Password Reset', $message);
         $this->render('login_passwordreset.tpl');
     }
 }
Пример #5
0
 /**
  * Find and set any pilots as retired
  *
  * @return mixed This is the return value description
  *
  */
 public static function findRetiredPilots()
 {
     $days = Config::Get('PILOT_INACTIVE_TIME');
     if ($days == '') {
         $days = 90;
     }
     $sql = "SELECT * FROM " . TABLE_PREFIX . "pilots\n\t\t\t\tWHERE DATE_SUB(CURDATE(), INTERVAL  {$days} DAY) > `lastlogin`  \n\t\t\t\t\tAND `totalflights` = 0 AND `lastlogin` != 0\n\t\t\t\t\tAND `retired` = 0";
     $results = DB::get_results($sql);
     $sql = "SELECT * FROM " . TABLE_PREFIX . "pilots\n\t\t\t\tWHERE DATE_SUB(CURDATE(), INTERVAL  {$days} DAY) > `lastpirep` \n\t\t\t\t\tAND `totalflights` > 0 AND `lastpirep` != 0\n\t\t\t\t\tAND `retired` = 0";
     $results2 = DB::get_results($sql);
     // messy but two queries, merge them both
     if (!is_array($results) && !is_array($results2)) {
         return false;
     } else {
         if (is_array($results) && is_array($results2)) {
             $results = array_merge($results, $results2);
         }
         if (!is_array($results) && is_array($results2)) {
             $results = $results2;
         }
     }
     if (!$results) {
         return false;
     }
     # Find the retired status
     $statuses = Config::get('PILOT_STATUS_TYPES');
     foreach ($statuses as $retired_id => $status) {
         if ($status['autoretire'] == true) {
             break;
         }
     }
     foreach ($results as $row) {
         // Set them retired
         self::updateProfile($row->pilotid, array('retired' => $retired_id));
         Template::Set('pilot', $row);
         $pilot_retired_template = Template::Get('email_pilot_retired.tpl', true, true, true);
         Util::SendEmail($row->email, Lang::get('email.pilot.retired.subject'), $pilot_retired_template);
     }
 }
Пример #6
0
 /**
  * Reject the report, and then send them the comment
  * that was entered into the report
  */
 protected function reject_pirep_post()
 {
     $pirepid = $this->post->pirepid;
     $comment = $this->post->comment;
     if ($pirepid == '' || $comment == '') {
         return;
     }
     PIREPData::ChangePIREPStatus($pirepid, PIREP_REJECTED);
     // 2 is rejected
     $pirep_details = PIREPData::GetReportDetails($pirepid);
     // If it was previously accepted, subtract the flight data
     if (intval($pirep_details->accepted) == PIREP_ACCEPTED) {
         PilotData::UpdateFlightData($pirep_details->pilotid, -1 * floatval($pirep->flighttime), -1);
     }
     //PilotData::UpdatePilotStats($pirep_details->pilotid);
     RanksData::CalculateUpdatePilotRank($pirep_details->pilotid);
     PilotData::resetPilotPay($pirep_details->pilotid);
     StatsData::UpdateTotalHours();
     // Send comment for rejection
     if ($comment != '') {
         $commenter = Auth::$userinfo->pilotid;
         // The person logged in commented
         PIREPData::AddComment($pirepid, $commenter, $comment);
         // Send them an email
         $this->set('firstname', $pirep_details->firstname);
         $this->set('lastname', $pirep_details->lastname);
         $this->set('pirepid', $pirepid);
         $message = Template::GetTemplate('email_commentadded.tpl', true);
         Util::SendEmail($pirep_details->email, 'Comment Added', $message);
     }
     LogData::addLog(Auth::$userinfo->pilotid, 'Rejected PIREP #' . $pirepid);
     # Call the event
     CodonEvent::Dispatch('pirep_rejected', 'PIREPAdmin', $pirep_details);
 }
Пример #7
0
 public function send_blank()
 {
     $this->set('title', 'Pilot Manager');
     $email = $this->post->blank;
     $subject = $this->post->subject;
     $message = $this->post->message;
     $pilotinfo = PManagerData::getpilotbyemail($email);
     $pilot = $pilotinfo->pilotid;
     Template::Set('pilot', PManagerData::getpilotbyemail($email));
     Template::Set('subject', $subject);
     Template::Set('email', $email);
     Template::Set('message', $message);
     if ($subject == '') {
         $this->set('title', 'Pilot Manager');
         $this->set('message', 'You must enter a subject!');
         $this->render('core_error.tpl');
         $this->set('email', $email);
         $this->show('/pm/blank_email.php');
         return;
     }
     if ($message == '') {
         $this->set('title', 'Pilot Manager');
         $this->set('message', 'You must enter a message!');
         $this->render('core_error.tpl');
         $this->set('email', $email);
         $this->show('/pm/blank_email.php');
         return;
     }
     Util::SendEmail($email, $subject, $message);
     PManagerData::blanksent($pilot, $message);
     $this->show('/pm/email_confirm.php');
 }
Пример #8
0
 public static function SendEmailConfirm($email, $firstname, $lastname, $newpw = '')
 {
     /*$firstname = Vars::POST('firstname');
       $lastname = Vars::POST('lastname');
       $email = Vars::POST('email');*/
     $confid = self::$salt;
     $subject = SITE_NAME . ' Registration';
     Template::Set('firstname', $firstname);
     Template::Set('lastname', $lastname);
     Template::Set('confid', $confid);
     $message = Template::GetTemplate('email_registered.tpl', true);
     //email them the confirmation
     Util::SendEmail($email, $subject, $message);
 }
Пример #9
0
 /**
  * PIREPData::fileReport()
  * 
  * @param mixed $pirepdata
  * @return
  */
 public static function fileReport($pirepdata)
 {
     /*$pirepdata = array('pilotid'=>'',
       'code'=>'',
       'flightnum'=>'',
       'depicao'=>'',
       'arricao'=>'',
       'aircraft'=>'',
       'flighttime'=>'',
       'submitdate'=>'',
       'comment'=>'',
       'fuelused'=>'',
       'source'=>''
       'log'=>''
       );*/
     if (!is_array($pirepdata)) {
         return false;
     }
     $pirepdata['code'] = strtoupper($pirepdata['code']);
     $pirepdata['flightnum'] = strtoupper($pirepdata['flightnum']);
     $pirepdata['depicao'] = strtoupper($pirepdata['depicao']);
     $pirepdata['arricao'] = strtoupper($pirepdata['arricao']);
     /* Check if this PIREP was just submitted, check the last 10 minutes
      */
     if (Config::Get('PIREP_CHECK_DUPLICATE') == true) {
         $time_limit = Config::Get('PIREP_TIME_CHECK');
         if (empty($time_limit)) {
             $time_limit = 1;
         }
         $sql = "SELECT `pirepid` FROM " . TABLE_PREFIX . "pireps\n\t\t\t\t\tWHERE `pilotid` = {$pirepdata['pilotid']} \n\t\t\t\t\t\tAND `code` = '{$pirepdata['code']}'\n\t\t\t\t\t\tAND `flightnum` = '{$pirepdata['flightnum']}' \n\t\t\t\t\t\tAND DATE_SUB(NOW(), INTERVAL {$time_limit} MINUTE) <= `submitdate`";
         $res = DB::get_row($sql);
         if ($res) {
             self::$lasterror = 'This PIREP was just submitted!';
             return $res->pirepid;
         }
     }
     if ($pirepdata['depicao'] == '' || $pirepdata['arricao'] == '') {
         self::$lasterror = 'The departure or arrival airports are blank';
         return false;
     }
     # Check the aircraft
     if (!is_numeric($pirepdata['aircraft'])) {
         // Check by registration
         $ac = OperationsData::getAircraftByReg($pirepdata['aircraft']);
         if ($ac) {
             $pirepdata['aircraft'] = $ac->id;
         } else {
             // Check by name
             $ac = OperationsData::getAircraftByName($pirepdata['aircraft']);
             if ($ac) {
                 $pirepdata['aircraft'] = $ac->id;
             } else {
                 $pirepdata['aircraft'] = '0';
             }
         }
     }
     # Check the airports, add to database if they don't exist
     $depapt = OperationsData::getAirportInfo($pirepdata['depicao']);
     if (!$depapt) {
         $depapt = OperationsData::RetrieveAirportInfo($pirepdata['depicao']);
     }
     $arrapt = OperationsData::getAirportInfo($pirepdata['arricao']);
     if (!$arrapt) {
         $arrapt = OperationsData::RetrieveAirportInfo($pirepdata['arricao']);
     }
     # Look up the schedule
     $sched = SchedulesData::getScheduleByFlight($pirepdata['code'], $pirepdata['flightnum']);
     /*	Get route information, and also the detailed layout of the route
        Store it cached, in case the schedule changes later, then the route
        information remains intact. Also, if the nav data changes, then 
        the route is saved as it was 
        */
     if (!empty($pirepdata['route'])) {
         /*	They supplied some route information, so build up the data
            based on that. It needs a certain structure passed, so build that */
         $pirepdata['route'] = str_replace('SID', '', $pirepdata['route']);
         $pirepdata['route'] = str_replace('STAR', '', $pirepdata['route']);
         $pirepdata['route'] = str_replace('DCT', '', $pirepdata['route']);
         $pirepdata['route'] = trim($pirepdata['route']);
         $tmp = new stdClass();
         $tmp->deplat = $depapt->lat;
         $tmp->deplng = $depapt->lng;
         $tmp->route = $pirepdata['route'];
         $pirepdata['route_details'] = NavData::parseRoute($tmp);
         $pirepdata['route_details'] = serialize($pirepdata['route_details']);
         unset($tmp);
     }
     if (empty($pirepdata['route']) && !empty($sched->route)) {
         $pirepdata['route'] = $sched->route;
         $pirepdata['route'] = str_replace('SID', '', $pirepdata['route']);
         $pirepdata['route'] = str_replace('STAR', '', $pirepdata['route']);
         $pirepdata['route'] = str_replace('DCT', '', $pirepdata['route']);
         $pirepdata['route'] = trim($pirepdata['route']);
         /*	The schedule doesn't have any route_details, so let's populate
               the schedule while we're here. Then we'll use that same info
               to populate our details information 
            */
         if (empty($sched->route_details)) {
             $pirepdata['route_details'] = serialize(SchedulesData::getRouteDetails($sched->id));
         } else {
             /*	The schedule does have route information, and it's already been cached */
             $pirepdata['route_details'] = $sched->route_details;
         }
     }
     /*	This setting forces the next code to automatically
        calculate a load value for this current PIREP */
     if (Config::Get('PIREP_OVERRIDE_LOAD') == true) {
         $pirepdata['load'] == '';
     }
     # Check the load, if it's blank then look it up
     #	Based on the aircraft that was flown
     if (!isset($pirepdata['load']) || empty($pirepdata['load'])) {
         $pirepdata['load'] = FinanceData::getLoadCount($pirepdata['aircraft'], $sched->flighttype);
     }
     /* If the distance isn't supplied, then calculate it */
     if (!isset($pirepdata['distance']) || empty($pirepdata['distance'])) {
         $pirepdata['distance'] = OperationsData::getAirportDistance($depapt, $arrapt);
     }
     /* See if there's a landing rate */
     if (!isset($pirepdata['landingrate']) || empty($pirepdata['landingrate'])) {
         $pirepdata['landingrate'] = 0;
     }
     /* Any "raw" parameterized data which needs to be added */
     if (isset($pirepdata['rawdata'])) {
         $pirepdata['rawdata'] = serialize($pirepdata['rawdata']);
     } else {
         $pirepdata['rawdata'] = '';
     }
     /* Escape the comment field */
     //$pirepdata['log'] = DB::escape($pirepdata['log']);
     if (isset($pirepdata['comment'])) {
         $comment = DB::escape($pirepdata['comment']);
         unset($pirepdata['comment']);
     }
     /* Proper timestamp */
     $pirepdata['flighttime'] = str_replace(':', '.', $pirepdata['flighttime']);
     $pirepdata['flighttime_stamp'] = str_replace('.', ':', $pirepdata['flighttime']) . ':00';
     /* Export status as 0 */
     $pirepdata['exported'] = 0;
     $pirepdata['submitdate'] = 'NOW()';
     $pirepdata['modifieddate'] = 'NOW()';
     $pirepdata['accepted'] = PIREP_PENDING;
     $pirepdata['expenselist'] = '0';
     $pirepdata['flighttype'] = $sched->flighttype;
     # Do the insert based on the columns here
     $cols = array();
     $col_values = array();
     foreach ($pirepdata as $key => $value) {
         if ($key == 'submitdate') {
             $value = 'NOW()';
         } elseif ($key == 'comment') {
             continue;
         } else {
             $value = "'" . DB::escape($value) . "'";
         }
         $cols[] = "`{$key}`";
         $col_values[] = $value;
     }
     $cols = implode(', ', $cols);
     $col_values = implode(', ', $col_values);
     $sql = 'INSERT INTO ' . TABLE_PREFIX . "pireps ({$cols}) VALUES ({$col_values});";
     DB::query($sql);
     $pirepid = DB::$insert_id;
     // Add the comment if its not blank
     if ($comment != '') {
         self::addComment($pirepid, $pirepdata['pilotid'], $comment);
     }
     # Update the financial information for the PIREP, true to refresh fuel
     self::PopulatePIREPFinance($pirepid, true);
     # Do other assorted tasks that are along with a PIREP filing
     # Update the flown count for that route
     self::UpdatePIREPFeed();
     # Update any pilot's information
     $pilotinfo = PilotData::getPilotData($pirepdata['pilotid']);
     $pilotcode = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
     PilotData::UpdateLastPIREPDate($pilotinfo->pilotid);
     if (Config::Get('EMAIL_SEND_PIREP') === true) {
         # Send an email to the admin that a PIREP was submitted
         $sub = "A PIREP has been submitted by {$pilotcode} ({$pirepdata['depicao']} - {$pirepdata['arricao']})";
         $message = "A PIREP has been submitted by {$pilotcode} " . "({$pilotinfo->firstname} {$pilotinfo->lastname})\n\n" . "{$pirepdata['code']}{$pirepdata['flightnum']}: {$pirepdata['depicao']} to {$pirepdata['arricao']}\n" . "Aircraft: {$pirepdata['aircraft']}\n" . "Flight Time: {$pirepdata['flighttime']}\n" . "Landing Rate: {$pirepdata['landingrate']}\n" . "Filed using: {$pirepdata['source']}\n\n" . "Comment: {$comment}\n\n" . "Click to approve this pirep (admin must be signed in):\n" . adminurl('/pirepadmin/approvepirep/' . $pirepid);
         $email = Config::Get('EMAIL_NEW_PIREP');
         if (empty($email)) {
             $email = ADMIN_EMAIL;
         }
         Util::SendEmail($email, $sub, $message);
     }
     /* Add this into the activity feed */
     $message = Lang::get('activity.new.pirep');
     foreach ($pirepdata as $key => $value) {
         $message = str_replace('$' . $key, $value, $message);
     }
     # Add it to the activity feed
     ActivityData::addActivity(array('pilotid' => $pirepdata['pilotid'], 'type' => ACTIVITY_NEW_PIREP, 'refid' => $pirepid, 'message' => htmlentities($message)));
     /* Now send data to vaCentral */
     CentralData::send_pirep($pirepid);
     // Reset this ID back
     DB::$insert_id = $pirepid;
     self::$pirepid = $pirepid;
     return $pirepid;
 }
Пример #10
0
 /**
  * Reject the report, and then send them the comment
  * that was entered into the report
  */
 protected function reject_pirep_post()
 {
     $pirepid = $this->post->pirepid;
     $comment = $this->post->comment;
     if ($pirepid == '' || $comment == '') {
         return;
     }
     PIREPData::changePIREPStatus($pirepid, PIREP_REJECTED);
     // 2 is rejected
     $pirep_details = PIREPData::getReportDetails($pirepid);
     // Send comment for rejection
     if ($comment != '') {
         $commenter = Auth::$userinfo->pilotid;
         // The person logged in commented
         PIREPData::AddComment($pirepid, $commenter, $comment);
         // Send them an email
         $this->set('firstname', $pirep_details->firstname);
         $this->set('lastname', $pirep_details->lastname);
         $this->set('pirepid', $pirepid);
         $message = Template::GetTemplate('email_commentadded.tpl', true);
         Util::SendEmail($pirep_details->email, 'Comment Added', $message);
     }
     LogData::addLog(Auth::$userinfo->pilotid, 'Rejected PIREP #' . $pirepid);
     # Call the event
     CodonEvent::Dispatch('pirep_rejected', 'PIREPAdmin', $pirep_details);
 }
Пример #11
0
 /**
  * Registration::ProcessRegistration()
  *
  * @return
  */
 protected function ProcessRegistration()
 {
     // Yes, there was an error
     if (!$this->VerifyData()) {
         $this->ShowForm();
         return;
     }
     $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 {
             /* Otherwise, wait until an admin confirms the registration */
             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');
     $pilot_list = PilotData::GetLatestPilots();
     foreach ($pilot_list 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');
 }
Пример #12
0
 protected function RejectPilot()
 {
     $pilot = PilotData::GetPilotData($this->post->id);
     # Send pilot notification
     $subject = Lang::gs('email.register.rejected.subject');
     $this->set('pilot', $pilot);
     $message = Template::Get('email_registrationdenied.tpl', true, true, true);
     Util::SendEmail($pilot->email, $subject, $message);
     # Reject in the end, since it's delted
     PilotData::RejectPilot($this->post->id);
     CodonEvent::Dispatch('pilot_rejected', 'PilotAdmin', $pilot);
     LogData::addLog(Auth::$userinfo->pilotid, 'Approved ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname);
 }
Пример #13
0
 /**
  * PilotAdmin::RejectPilot()
  * 
  * @return
  */
 protected function RejectPilot()
 {
     $this->checkPermission(MODERATE_REGISTRATIONS);
     $pilot = PilotData::GetPilotData($this->post->id);
     # Send pilot notification
     $subject = Lang::gs('email.register.rejected.subject');
     $this->set('pilot', $pilot);
     $oldPath = Template::setTemplatePath(TEMPLATES_PATH);
     $oldSkinPath = Template::setSkinPath(ACTIVE_SKIN_PATH);
     $message = Template::Get('email_registrationdenied.php', true, true, true);
     Template::setTemplatePath($oldPath);
     Template::setSkinPath($oldSkinPath);
     Util::SendEmail($pilot->email, $subject, $message);
     # Reject in the end, since it's delted
     PilotData::RejectPilot($this->post->id);
     CodonEvent::Dispatch('pilot_rejected', 'PilotAdmin', $pilot);
     LogData::addLog(Auth::$userinfo->pilotid, 'Approved ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname);
 }