Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
    }
}
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');