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; }
function post_module_load() { /* Misc tasks which need to get done */ /* If the setting to auto-retired pilots is on, then do that and only check every 24 hours */ if (Config::Get('USE_CRON') == false) { if (Config::Get('PILOT_AUTO_RETIRE') == true) { $within_timelimit = CronData::check_hoursdiff('find_retired_pilots', '24'); if ($within_timelimit === false) { PilotData::findRetiredPilots(); CronData::set_lastupdate('find_retired_pilots'); } } if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) { $within_timelimit = CronData::check_hoursdiff('check_expired_bids', '24'); if ($within_timelimit === false) { SchedulesData::deleteExpiredBids(); CronData::set_lastupdate('check_expired_bids'); } } /* Expenses, make sure they're all populated */ $within_timelimit = CronData::check_hoursdiff('populate_expenses', 18); if ($within_timelimit === false) { FinanceData::updateAllExpenses(); CronData::set_lastupdate('populate_expenses'); } /* And finally, clear expired sessions */ Auth::clearExpiredSessions(); } if (Config::Get('TWITTER_AIRLINE_ACCOUNT') != '') { $within_timelimit = CronData::check_hoursdiff('twitter_update', '3'); if ($within_timelimit === false) { ActivityData::readTwitter(); CronData::set_lastupdate('twitter_update'); } } // @TODO: Clean ACARS records older than one month if (Config::Get('MAINTENANCE_MODE') == true && !Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) { Template::Show('maintenance.tpl'); die; } return true; }
function post_module_load() { /* Misc tasks which need to get done */ /* If the setting to auto-retired pilots is on, then do that and only check every 24 hours */ if (Config::Get('USE_CRON') === true) { if (Config::Get('PILOT_AUTO_RETIRE') == true) { $within_timelimit = CronData::check_hoursdiff('find_retired_pilots', '24'); if ($within_timelimit == false) { PilotData::findRetiredPilots(); CronData::set_lastupdate('find_retired_pilots'); } } if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) { $within_timelimit = CronData::check_hoursdiff('check_expired_bids', '24'); if ($within_timelimit == false) { SchedulesData::deleteExpiredBids(); CronData::set_lastupdate('check_expired_bids'); } } /* Expenses, make sure they're all populated */ $within_timelimit = CronData::check_hoursdiff('populate_expenses', '18'); if ($within_timelimit == false) { FinanceData::updateAllExpenses(); CronData::set_lastupdate('populate_expenses'); } /* And finally, clear expired sessions */ Auth::clearExpiredSessions(); } // @TODO: Clean ACARS records older than one month if (Config::Get('MAINTENANCE_MODE') == true && !Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) { echo '<html><head><title>Down for maintenance - ' . SITE_NAME . '</title></head><body>'; Debug::showCritical(Config::Get('MAINTENANCE_MESSAGE'), 'Down for maintenance'); echo '</body></html>'; die; } return true; }
/** * UserTest::testUserDataIntegrity() * * @return void */ public function testUserDataIntegrity() { # See if basic data matched $pilot = PilotData::getPilotByEmail('*****@*****.**'); foreach ($this->registrationData as $key => $value) { if ($key == 'password') { continue; } $this->assertEquals($value, $pilot->{$key}, "Checking {$key}"); } # Did they get added to the default group? $defaultGroup = SettingsData::getSettingValue('DEFAULT_GROUP'); $pilotGroups = PilotGroups::getUserGroups($pilot->pilotid); $this->assertNotEmpty($pilotGroups, 'PilotGroups::getUserGroups()'); $found = false; foreach ($pilotGroups as $group) { if (strtolower(trim($group->name)) == strtolower(trim($defaultGroup))) { $found = true; break; } } $this->assertTrue($found, 'User found in default group'); }
* @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.nsslive.net/codon * @license BSD License * @package codon_core */ /** * @author Nabeel Shahzad <www.phpvms.net> * @desc Admin panel home */ define('ADMIN_PANEL', true); include '../core/codon.config.php'; if (!Auth::LoggedIn()) { Debug::showCritical('Please login first'); die; } if (!PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { Debug::showCritical('Unauthorized access'); die; } $BaseTemplate = new TemplateSet(); $tplname = Config::Get('ADMIN_SKIN'); if ($tplname == '') { $tplname = 'layout'; } //load the main skin $settings_file = SITE_ROOT . '/admin/lib/' . $tplname . '/' . $tplname . '.php'; if (file_exists($settings_file)) { include $settings_file; } $BaseTemplate->template_path = SITE_ROOT . '/admin/lib/' . $tplname; $BaseTemplate->Set('title', SITE_NAME);
/** * Add a User * * $data = array( * 'firstname' => '', * 'lastname' => '', * 'email' => '', * 'password' => '', * 'code' => '', * 'location' => '', * 'hub' => '', * 'confirm' => false); */ public static function addUser($data) { /*$data = array( 'firstname' => '', 'lastname' => '', 'email' => '', 'password' => '', 'code' => '', 'location' => '', 'hub' => '', 'confirm' => false);*/ $exists = self::CheckUserEmail($data['email']); if (is_object($exists)) { self::$error = 'Email already exists'; return false; } //Set the password, add some salt $salt = md5(date('His')); $password = md5($data['password'] . $salt); //Stuff it into here, the confirmation email will use it. self::$salt = $salt; $code = DB::escape(strtoupper($data['code'])); $firstname = DB::escape(ucwords($data['firstname'])); $lastname = DB::escape(ucwords($data['lastname'])); $location = DB::escape(strtoupper($data['location'])); //Add this stuff in if ($data['confirm'] === true) { $confirm = 1; } else { $confirm = 0; } $sql = "INSERT INTO " . TABLE_PREFIX . "pilots (firstname, lastname, email,\n\t\t\t\t\tcode, location, hub, password, salt, confirmed, joindate, lastip)\n\t\t\t\t VALUES ('{$firstname}', '{$lastname}', '{$data['email']}', '{$code}',\n\t\t\t\t\t\t\t'{$location}', '{$data['hub']}', '{$password}', '{$salt}', {$confirm}, NOW(), '{$_SERVER['REMOTE_ADDR']}')"; $res = DB::query($sql); if (DB::errno() != 0) { if (DB::errno() == 1062) { self::$error = 'This email address is already registered'; return false; } self::$error = DB::error(); return false; } //Grab the new pilotid, we need it to insert those "custom fields" $pilotid = DB::$insert_id; RanksData::CalculateUpdatePilotRank($pilotid); PilotData::GenerateSignature($pilotid); /* Add them to the default group */ $defaultGroup = SettingsData::getSettingValue('DEFAULT_GROUP'); PilotGroups::addUsertoGroup($pilotid, $defaultGroup); // For later self::$pilotid = $pilotid; //Get customs fields $fields = self::GetCustomFields(); if (!$fields) { return true; } foreach ($fields as $field) { $value = Vars::POST($field->fieldname); $value = DB::escape($value); if ($value != '') { $sql = "INSERT INTO " . TABLE_PREFIX . "fieldvalues (fieldid, pilotid, value)\n\t\t\t\t\t\t\tVALUES ({$field->fieldid}, {$pilotid}, '{$value}')"; DB::query($sql); } } return true; }
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.nsslive.net/codon * @license BSD License * @package codon_core */ /** * @author Nabeel Shahzad <www.phpvms.net> * @desc Handles AJAX calls */ define('ADMIN_PANEL', true); include '../core/codon.config.php'; error_reporting(E_ALL ^ E_NOTICE); if (!Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { Debug::showCritical('Unauthorized access!'); die; } $tplname = Config::Get('ADMIN_SKIN'); if ($tplname == '') { $tplname = 'layout'; } $settings_file = SITE_ROOT . '/admin/lib/' . $tplname . '/' . $tplname . '.php'; if (file_exists($settings_file)) { include $settings_file; } Template::setTemplatePath(dirname(__FILE__) . '/templates'); Template::setSkinPath(SITE_ROOT . '/admin/lib/' . $tplname); MainController::runAllActions(); # Force connection close
private static function checkPerm($perm) { if (!PilotGroups::group_has_perm(Auth::$usergroups, $perm)) { Debug::showCritical('Unauthorized access - Invalid Permissions.'); die; } }
public static function SiteSetup() { /*$_POST['SITE_NAME'] == '' || $_POST['firstname'] == '' || $_POST['lastname'] == '' || $_POST['email'] == '' || $_POST['password'] == '' || $_POST['vaname'] == '' || $_POST['vacode'] == ''*/ // first add the airline $_POST['vacode'] = strtoupper($_POST['vacode']); if (!OperationsData::AddAirline($_POST['vacode'], $_POST['vaname'])) { self::$error = DB::$error; return false; } // Add an initial airport/hub, because I love KJFK so much $data = array('icao' => 'KJFK', 'name' => 'Kennedy International', 'country' => 'USA', 'lat' => '40.6398', 'lng' => '-73.7787', 'hub' => false, 'fuelprice' => 0); $ret = OperationsData::AddAirport($data); // Add the user $data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'email' => $_POST['email'], l, 'password' => $_POST['password'], 'code' => $_POST['vacode'], 'location' => 'US', 'hub' => 'KJFK', 'confirm' => true); if (!RegistrationData::AddUser($data)) { self::$error = DB::$error; return false; } // Add a rank RanksData::updateRank(1, 'New Hire', 0, fileurl('/lib/images/ranks/newhire.jpg'), 18.0); # Add to admin group $pilotdata = PilotData::GetPilotByEmail($_POST['email']); if (!PilotGroups::AddUsertoGroup($pilotdata->pilotid, 'Administrators')) { self::$error = DB::$error; return false; } # Add the final settings in SettingsData::SaveSetting('SITE_NAME', $_POST['SITE_NAME']); SettingsData::SaveSetting('ADMIN_EMAIL', $_POST['email']); SettingsData::SaveSetting('GOOGLE_KEY', $_POST['googlekey']); return true; }
?> "> <p> <strong>Subject: </strong> <input type="text" name="subject" value="" /> </p> <p> <strong>Message:</strong> </p> <p> <textarea name="message" id="editor" style="width: 600px; height: 250px;">To: {PILOT_FNAME} {PILOT_LNAME}, </textarea> </p> <p>Select groups to send to:<br /> <?php $total = StatsData::PilotCount(); ?> <input type="checkbox" name="groups[]" value="all" />All Pilots (<?php echo $total; ?> pilots)<br /> <?php foreach ($allgroups as $group) { $total = count(PilotGroups::getUsersInGroup($group->groupid)); echo "<input type=\"checkbox\" name=\"groups[]\" value=\"{$group->groupid}\" />{$group->name} - ({$total} pilots)<br />"; } ?> </p> <p> <input type="submit" name="submit" value="Send Email" /> </p> </form>
<p>Welcome back, <?php echo Auth::$userinfo->firstname; ?> !</p> <h3>Latest Stats</h3> <p> <?php if (PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_PIREPS)) { ?> <strong><a href="<?php echo SITE_URL; ?> /admin/index.php/pirepadmin/viewpending"><?php echo count(PIREPData::GetAllReportsByAccept(PIREP_PENDING)); ?> </strong> PIREPs pending</a><br /> <?php } if (PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_REGISTRATIONS)) { ?> <strong><a href="<?php echo SITE_URL; ?> /admin/index.php/pilotadmin/pendingpilots"><?php echo count(PilotData::GetPendingPilots()); ?> </strong> Pilot registrations pending</a> </p> <?php }
/** * Update a pilot, $params is an array of column_name=>value * * @param mixed $pilotid This is a description * @param mixed $params This is a description * @return mixed This is the return value description * */ public static function updateProfile($pilotid, $params) { /*$params = array( 'pilotid' => '', 'code' => '', 'email' => '', 'location' => '', 'hub' => '', 'bgimage' => '', 'retired' => false, ); */ if (empty($pilotid)) { return false; } if (!is_array($params)) { return false; } /* Cleanup any specific parameters */ if (isset($params['location'])) { $params['location'] = strtoupper($params['location']); } if (isset($params['pilotid'])) { unset($params['pilotid']); } $sql = "UPDATE " . TABLE_PREFIX . "pilots SET "; $sql .= DB::build_update($params); $sql .= " WHERE `pilotid`={$pilotid}"; $res = DB::query($sql); if (DB::errno() != 0) { return false; } # Auto groups? $groups = Config::get('PILOT_STATUS_TYPES'); if (isset($params['retired'])) { $info = $groups[$params['retired']]; # Automatically add into these groups if (is_array($info['group_add']) && count($info['group_add']) > 0) { foreach ($info['group_add'] as $group) { PilotGroups::addUsertoGroup($pilotid, $group); } } if (is_array($info['group_remove']) && count($info['group_remove']) > 0) { foreach ($info['group_remove'] as $group) { PilotGroups::removeUserFromGroup($pilotid, $group); } } } return true; }
<?php //simpilotgroup addon module for phpVMS virtual airline system // //simpilotgroup addon modules are licenced under the following license: //Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) //To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/ // //@author David Clark (simpilot) //@copyright Copyright (c) 2009-2010, David Clark //@license http://creativecommons.org/licenses/by-nc-sa/3.0/ ?> <h3>Events</h3> <br /> <center> <?php if (PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_PIREPS)) { ?> <a href="<?php echo SITE_URL; ?> /admin/index.php/Events_admin">Events Main</a><br /> <a href="<?php echo SITE_URL; ?> /admin/index.php/Events_admin/new_event">Create New Event</a><br /> <?php } ?> </center> <br />
<tr> <td>Group Permissions: </td> <td> <?php if ($group->permissions == 0) { $checked = 'checked'; } ?> <input type="checkbox" name="permissions[]" value="0" <?php echo $checked; ?> />No admin access<br /> <?php foreach ($permission_set as $p_name => $p_value) { # Does group have this permission? if (PilotGroups::check_permission($group->permissions, $p_value)) { $checked = 'checked'; } else { $checked = ''; } echo '<input type="checkbox" name="permissions[]" value="' . $p_value . '" ' . $checked . ' />' . $p_name . '<br />'; } ?> </td> </tr> <tr> <td></td> <td><input type="hidden" name="action" value="<?php echo $action; ?>
protected function ShowGroups() { $this->set('allgroups', PilotGroups::GetAllGroups()); $this->render('groups_grouplist.tpl'); }
} echo "Pilots have a total of <strong>{$total} hours</strong><br /><br />"; echo "<strong>Updating PIREPS Hours</strong><br />"; StatsData::UpdateTotalHours(); echo 'Found ' . StatsData::TotalHours() . ' total hours, updated<br />'; } if ($version < 20854) { Installer::add_to_config('USERS_ONLINE_TIME', 20, 'The StatsData::UserOnline() function - how many minutes to check'); Installer::sql_file_update(SITE_ROOT . '/install/update_854.sql'); } Installer::sql_file_update(SITE_ROOT . '/install/update.sql'); OperationsData::updateAircraftRankLevels(); /* Add them to the default group */ $allpilots = PilotData::GetAllPilots(); foreach ($allpilots as $pilot) { PilotGroups::AddUsertoGroup($pilot->pilotid, DEFAULT_GROUP); } /* Update expenses */ //FinanceData::updateAllExpenses(); /* Manually specify a revenue value for all PIREPs */ /*$allpireps = PIREPData::findPIREPS(array()); if(is_array($allpireps)) { foreach($allpireps as $pirep) { $data = array( 'price' => $pirep->price, 'load' => $pirep->load, 'fuelprice' => $pirep->fuelprice, 'pilotpay' => $pirep->pilotpay, 'flighttime' => $pirep->flighttime,
/** * Get all the users from a group * * @param mixed $groupid Group name or group ID * @return array Return the array with the pilot details * */ public static function getUsersInGroup($groupid) { return PilotGroups::getUsersInGroup($groupid); }
/** * Log the user in */ public static function ProcessLogin($useridoremail, $password) { # Allow them to login in any manner: # Email: blah@blah.com # Pilot ID: VMA0001, VMA 001, etc # Just ID: 001 if (is_numeric($useridoremail)) { $useridoremail = $useridoremail - intval(Config::Get('PILOTID_OFFSET')); $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots WHERE pilotid=' . $useridoremail; } else { # They're logging in with an email if (preg_match('/^.*\\@.*$/i', $useridoremail) > 0) { $emailaddress = DB::escape($useridoremail); $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots WHERE email=\'' . $useridoremail . '\''; } elseif (preg_match('/^([A-Za-z]*)(.*)(\\d*)/', $useridoremail, $matches) > 0) { $id = trim($matches[2]); $id = $id - intval(Config::Get('PILOTID_OFFSET')); $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots WHERE pilotid=' . $id; } else { self::$error_message = 'Invalid user ID'; return false; } } $password = DB::escape($password); $userinfo = DB::get_row($sql); if (!$userinfo) { self::$error_message = 'This user does not exist'; return false; } /* Implement the pilot statuses, see if they are allowed in according to their status */ $pilotStatuses = Config::get('PILOT_STATUS_TYPES'); foreach ($pilotStatuses as $id => $info) { if ($userinfo->retired == $id && $info['canlogin'] == false) { self::$error_message = $info['message']; return false; } } /*if($userinfo->retired == 1) { self::$error_message = 'Your account was deactivated, please contact an admin'; return false; }*/ //ok now check it $hash = md5($password . $userinfo->salt); if ($hash == $userinfo->password) { self::$userinfo = $userinfo; #deprecated self::$pilot = self::$userinfo; self::update_session(self::$session_id, self::$userinfo->pilotid); SessionManager::Set('loggedin', 'true'); SessionManager::Set('userinfo', $userinfo); SessionManager::Set('usergroups', PilotGroups::GetUserGroups($userinfo->pilotid)); PilotData::updateProfile($pilotid, array('lastlogin' => 'NOW()', 'lastip' => $_SERVER['REMOTE_ADDR'])); return true; } else { self::$error_message = 'Invalid login, please check your username and password'; self::LogOut(); return false; } }
} } OperationsData::updateAircraftRankLevels(); /* Add them to the default group */ $status_type_list = Config::get('PILOT_STATUS_TYPES'); $pilot_list = PilotData::getAllPilots(); foreach ($pilot_list as $pilot) { echo "Fixing settings for " . $pilot->firstname . " " . $pilot->lastname . "<br>"; PilotData::resetLedgerforPilot($pilot->pilotid); PilotGroups::addUsertoGroup($pilot->pilotid, DEFAULT_GROUP); # Reset the default groups $status = $status_type_list[$pilot->retired]; foreach ($status['group_add'] as $group) { PilotGroups::addUsertoGroup($pilot->pilotid, $group); } foreach ($status['group_remove'] as $group) { PilotGroups::removeUserFromGroup($pilot->pilotid, $group); } } SettingsData::saveSetting('PHPVMS_VERSION', $FULL_VERSION_STRING); # Don't count forced updates if (!isset($_GET['force'])) { Installer::RegisterInstall($FULL_VERSION_STRING); } echo '<p><strong>Update completed!</strong></p> <hr> <p >If there were any errors, you may have to manually run the SQL update, or correct the errors, and click the following to re-run the update: <br /> <a href="update.php?force">Click here to force the update to run again</a></p> <p>Click here to <a href="' . SITE_URL . '">goto your site</a>, or <a href="' . SITE_URL . '/admin">your admin panel</a></p> '; Template::Show('footer');
case 'TOTAL_HOURS': echo $setting->value; break; case 'CURRENT_SKIN': $skins = SiteData::GetAvailableSkins(); $skin = SettingsData::GetSetting('CURRENT_SKIN'); echo '<SELECT name="CURRENT_SKIN">'; $tot = count($skins); for ($i = 0; $i < $tot; $i++) { $sel = $skin->value == $skins[$i] ? 'selected' : ''; echo '<option value="' . $skins[$i] . '" ' . $sel . '>' . $skins[$i] . '</option>'; } echo '</SELECT>'; break; case 'DEFAULT_GROUP': $allgroups = PilotGroups::getAllGroups(); $current = SettingsData::getSetting('DEFAULT_GROUP'); echo '<select name="DEFAULT_GROUP">'; foreach ($allgroups as $group) { $sel = $current->value == $group->groupid ? 'selected="selected"' : ''; echo '<option value="' . $group->groupid . '" ' . $sel . '>' . $group->name . '</option>'; } echo '</select>'; break; break; default: if ($setting->value == 'true' || $setting->value == 'false') { if ($setting->value == 'true') { $sel_true = 'selected'; $sel_false = ''; } else {
/** * UserTest::testUserStatusChanges() * * @return void */ public function testUserStatusChanges() { $pilot = PilotData::getPilotByEmail('*****@*****.**'); # Go through all the statuses $status_type_list = Config::get('PILOT_STATUS_TYPES'); foreach ($status_type_list as $id => $status) { $save = PilotData::updateProfile($pilot->pilotid, array('retired' => $id)); $pilotGroups = PilotGroups::getUserGroups($pilot->pilotid); # Check if they are in the proper groups: foreach ($status['group_add'] as $group) { #$this->assertTrue(PilotGroups::checkUserInGroup($pilot->pilotid, $group), "Error adding to \"$group\" for {$status['name']}"); $found = false; foreach ($pilotGroups as $pilot_group) { if ($pilot_group->name === $group) { $found = true; break; } } $this->assertTrue($found, "Error adding to \"{$group}\" for {$status['name']}"); } foreach ($status['group_remove'] as $group) { $this->assertNotTrue(PilotGroups::CheckUserInGroup($pilot->pilotid, $group)); } } /* Set the user back to the default status */ foreach ($status_type_list as $id => $status) { if ($status['default'] == false) { continue; } $save = PilotData::updateProfile($pilot->pilotid, array('retired' => $id)); # Check if they are in the proper groups: foreach ($status['group_add'] as $group) { $this->assertTrue(PilotGroups::CheckUserInGroup($pilot->pilotid, $group), "Error adding to \"{$group}\" for {$status['name']}"); } foreach ($status['group_remove'] as $group) { $this->assertNotTrue(PilotGroups::CheckUserInGroup($pilot->pilotid, $group)); } } }
Template::Show('pilots_addawards.tpl'); ?> </div> <?php } if (PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_PIREPS)) { ?> <div id="pireps"> <?php Template::Show('pireps_list.tpl'); ?> </div> <?php } if (PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) { ?> <div id="resetpass"> <?php Template::Show('pilots_options.tpl'); ?> </div> <?php } ?> </div> </div> <script type="text/javascript">
/** * Installer::SiteSetup() * * @return */ public static function SiteSetup() { /*$_POST['SITE_NAME'] == '' || $_POST['firstname'] == '' || $_POST['lastname'] == '' || $_POST['email'] == '' || $_POST['password'] == '' || $_POST['vaname'] == '' || $_POST['vacode'] == ''*/ // first add the airline $_POST['vacode'] = strtoupper($_POST['vacode']); if (!OperationsData::addAirline($_POST['vacode'], $_POST['vaname'])) { self::$error = __FILE__ . ' ' . __LINE__ . ' ' . DB::$error; return false; } // Add the user $data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'email' => $_POST['email'], l, 'password' => $_POST['password'], 'code' => $_POST['vacode'], 'location' => 'US', 'hub' => 'KJFK', 'confirm' => true); if (!RegistrationData::addUser($data)) { self::$error = __FILE__ . ' ' . __LINE__ . ' ' . DB::$error; return false; } RanksData::calculatePilotRanks(); # Add to admin group $pilotdata = PilotData::getPilotByEmail($_POST['email']); if (!PilotGroups::addUsertoGroup($pilotdata->pilotid, 'Administrators')) { self::$error = __FILE__ . ' ' . __LINE__ . ' ' . DB::$error; return false; } # Add the final settings in SettingsData::SaveSetting('SITE_NAME', $_POST['SITE_NAME']); SettingsData::SaveSetting('ADMIN_EMAIL', $_POST['email']); SettingsData::SaveSetting('GOOGLE_KEY', $_POST['googlekey']); return true; }
<dt>Enter password again</dt> <dd><input type="password" name="password2" /></dd> <dt></dt> <dd><input type="hidden" name="pilotid" value="<?php echo $pilotid; ?> " /> <input type="hidden" name="action" value="changepassword" /> <input type="submit" name="submit" value="Change Password" /></dd> </dl> </form> <?php } if ($pilotid != Auth::$userinfo->pilotid && PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) { ?> <h3>Delete Pilot</h3> <p><strong>Warning!</strong> This is NOT reversible. This removes all of this pilot's information and data, including PIREPS and their registration.</p> <form id="deletepilot" action="<?php echo SITE_URL; ?> /admin/index.php/pilotadmin/viewpilots" method="post"> <dl> <dt></dt> <dd><input type="hidden" name="pilotid" value="<?php echo $pilotid; ?> " /> <input type="hidden" name="action" value="deletepilot" />