Beispiel #1
0
 public function editpirepfield()
 {
     $this->set('title', Lang::gs('pirep.field.edit'));
     $this->set('action', 'savefields');
     $this->set('field', PIREPData::GetFieldInfo($this->get->id));
     $this->render('settings_addpirepfield.tpl');
 }
Beispiel #2
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');
 }
Beispiel #3
0
 public function editpirepfield()
 {
     $this->checkPermission(EDIT_PIREPS_FIELDS);
     $this->set('title', Lang::gs('pirep.field.edit'));
     $this->set('action', 'savefields');
     $this->set('field', PIREPData::GetFieldInfo($this->get->id));
     $this->render('settings_addpirepfield.php');
 }
Beispiel #4
0
 public function viewrecent()
 {
     $this->set('title', Lang::gs('pireps.view.recent'));
     $this->set('pireps', PIREPData::GetRecentReports());
     $this->set('descrip', 'These pilot reports are from the past 48 hours');
     $this->set('pending', false);
     $this->set('load', 'viewrecent');
     $this->render('pireps_list.tpl');
 }
Beispiel #5
0
    DB::$show_errors = Config::Get('DEBUG_MODE');
    DB::$throw_exceptions = false;
    DB::init(DBASE_TYPE);
    DB::set_log_errors(Config::Get('DEBUG_MODE'));
    DB::set_error_handler(array('Debug', 'db_error'));
    DB::set_caching(false);
    DB::$table_prefix = TABLE_PREFIX;
    DB::set_cache_dir(CACHE_PATH);
    DB::$DB->debug_all = false;
    if (Config::Get('DEBUG_MODE') == true) {
        DB::show_errors();
    } else {
        DB::hide_errors();
    }
    if (!DB::connect(DBASE_USER, DBASE_PASS, DBASE_NAME, DBASE_SERVER)) {
        Debug::showCritical(Lang::gs('database.connection.failed') . ' (' . DB::$errno . ': ' . DB::$error . ')');
        die;
    }
    # Set the charset type to send to mysql
    if (Config::Get('DB_CHARSET_NAME') !== '') {
        DB::query('SET NAMES \'' . Config::Get('DB_CHARSET_NAME') . '\'');
    }
    # Include ORM
    #include_once(VENDORS_PATH.DS.'orm'.DS.'idiorm.php');
    #include_once(VENDORS_PATH.DS.'orm'.DS.'paris.php');
    #ORM::configure('mysql:host='.DBASE_SERVER.';dbname='.DBASE_NAME);
    #ORM::configure('username', DBASE_USER);
    #ORM::configure('password', DBASE_PASS);
}
include CORE_PATH . DS . 'bootstrap.inc.php';
if (function_exists('pre_module_load')) {
Beispiel #6
0
 protected function DeleteNewsItem()
 {
     $this->checkPermission(EDIT_NEWS);
     if (!SiteData::DeleteItem($this->post->id)) {
         $this->set('message', Lang::gs('news.delete.error'));
         $this->render('core_error.php');
         return;
     }
     $this->set('message', Lang::gs('news.item.deleted'));
     $this->render('core_success.php');
     LogData::addLog(Auth::$userinfo->pilotid, 'Deleted news ' . $this->post->id);
 }
Beispiel #7
0
 protected function DeleteAward()
 {
     AwardsData::DeletePilotAward($this->post->id);
     if ($award) {
         $this->set('message', Lang::gs('award.deleted'));
         $this->render('core_success.tpl');
         return;
     }
 }