本文整理汇总了PHP中PilotData::parsePilotID方法的典型用法代码示例。如果您正苦于以下问题:PHP PilotData::parsePilotID方法的具体用法?PHP PilotData::parsePilotID怎么用?PHP PilotData::parsePilotID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PilotData
的用法示例。
在下文中一共展示了PilotData::parsePilotID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* Profile::view()
*
* @param string $pilotid
* @return
*/
public function view($pilotid = '')
{
$pilotid = PilotData::parsePilotID($pilotid);
$pilot = PilotData::getPilotData($pilotid);
$this->title = 'Profile of ' . $pilot->firstname . ' ' . $pilot->lastname;
$this->set('userinfo', $pilot);
$this->set('pilot', $pilot);
$this->set('allfields', PilotData::getFieldData($pilotid, false));
$pirep_list = PIREPData::getAllReportsForPilot($pilotid);
$this->set('pireps', $pirep_list);
$this->set('pirep_list', $pirep_list);
$this->set('pilotcode', PilotData::getPilotCode($pilot->code, $pilot->pilotid));
$this->set('allawards', AwardsData::getPilotAwards($pilot->pilotid));
$this->render('pilot_public_profile.tpl');
$this->render('pireps_viewall.tpl');
}
示例2: view
/**
* Profile::view()
*
* @param string $pilotid
* @return
*/
public function view($pilotid = '')
{
#replacement for OFC charts - Google Charts API - simpilot
$this->set('chart_url', ChartsData::build_pireptable($pilotid, 30));
#end
$pilotid = PilotData::parsePilotID($pilotid);
$pilot = PilotData::getPilotData($pilotid);
$this->title = 'Profile of ' . $pilot->firstname . ' ' . $pilot->lastname;
$this->set('userinfo', $pilot);
$this->set('pilot', $pilot);
$this->set('allfields', PilotData::getFieldData($pilotid, false));
$pirep_list = PIREPData::getAllReportsForPilot($pilotid);
$this->set('pireps', $pirep_list);
$this->set('pirep_list', $pirep_list);
$this->set('pilotcode', PilotData::getPilotCode($pilot->code, $pilot->pilotid));
$this->set('allawards', AwardsData::getPilotAwards($pilot->pilotid));
$this->render('pilot_public_profile.tpl');
$this->render('pireps_viewall.tpl');
}
示例3: index
public function index()
{
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$postText = file_get_contents('php://input');
$rec_xml = trim(utf8_encode(file_get_contents('php://input')));
$xml = simplexml_load_string($rec_xml);
if (!$xml) {
#$this->log("Invalid XML Sent: \n".$rec_xml, 'kacars');
return;
}
#$this->log(print_r($xml->asXML(), true), 'kacars');
$case = strtolower($xml->switch->data);
switch ($case) {
case 'verify':
$results = Auth::ProcessLogin($xml->verify->pilotID, $xml->verify->password);
if ($results) {
$params = array('loginStatus' => '1');
//echo 1;
} else {
$params = array('loginStatus' => '0');
//echo 0;
}
$send = self::sendXML($params);
break;
case 'getbid':
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
$pilotinfo = PilotData::getPilotData($pilotid);
$biddata = SchedulesData::getLatestBid($pilotid);
$aircraftinfo = OperationsData::getAircraftByReg($biddata->registration);
if (count($biddata) == 1) {
if ($aircraftinfo->enabled == 1) {
$params = array('flightStatus' => '1', 'flightNumber' => $biddata->code . $biddata->flightnum, 'aircraftReg' => $biddata->registration, 'aircraftICAO' => $aircraftinfo->icao, 'aircraftFullName' => $aircraftinfo->fullname, 'flightLevel' => $biddata->flightlevel, 'aircraftMaxPax' => $aircraftinfo->maxpax, 'aircraftCargo' => $aircraftinfo->maxcargo, 'depICAO' => $biddata->depicao, 'arrICAO' => $biddata->arricao, 'route' => $biddata->route, 'depTime' => $biddata->deptime, 'arrTime' => $biddata->arrtime, 'flightTime' => $biddata->flighttime, 'flightType' => $biddata->flighttype, 'aircraftName' => $aircraftinfo->name, 'aircraftRange' => $aircraftinfo->range, 'aircraftWeight' => $aircraftinfo->weight, 'aircraftCruise' => $aircraftinfo->cruise);
} else {
$params = array('flightStatus' => '3');
// Aircraft Out of Service.
}
} else {
$params = array('flightStatus' => '2');
// You have no bids!
}
$send = $this->sendXML($params);
break;
case 'getflight':
$flightinfo = SchedulesData::getProperFlightNum($xml->pirep->flightNumber);
$params = array('s.code' => $flightinfo['code'], 's.flightnum' => $flightinfo['flightnum'], 's.enabled' => 1);
$biddata = SchedulesData::findSchedules($params, 1);
$aircraftinfo = OperationsData::getAircraftByReg($biddata[0]->registration);
if (count($biddata) == 1) {
$params = array('flightStatus' => '1', 'flightNumber' => $biddata[0]->code . $biddata[0]->flightnum, 'aircraftReg' => $biddata[0]->registration, 'aircraftICAO' => $aircraftinfo->icao, 'aircraftFullName' => $aircraftinfo->fullname, 'flightLevel' => $biddata[0]->flightlevel, 'aircraftMaxPax' => $aircraftinfo->maxpax, 'aircraftCargo' => $aircraftinfo->maxcargo, 'depICAO' => $biddata[0]->depicao, 'arrICAO' => $biddata[0]->arricao, 'route' => $biddata[0]->route, 'depTime' => $biddata[0]->deptime, 'arrTime' => $biddata[0]->arrtime, 'flightTime' => $biddata[0]->flighttime, 'flightType' => $biddata[0]->flighttype, 'aircraftName' => $aircraftinfo->name, 'aircraftRange' => $aircraftinfo->range, 'aircraftWeight' => $aircraftinfo->weight, 'aircraftCruise' => $aircraftinfo->cruise);
} else {
$params = array('flightStatus' => '2');
}
$send = $this->sendXML($params);
break;
case 'liveupdate':
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
# Get the distance remaining
$depapt = OperationsData::GetAirportInfo($xml->liveupdate->depICAO);
$arrapt = OperationsData::GetAirportInfo($xml->liveupdate->arrICAO);
$dist_remain = round(SchedulesData::distanceBetweenPoints($xml->liveupdate->latitude, $xml->liveupdate->longitude, $arrapt->lat, $arrapt->lng));
# Estimate the time remaining
if ($xml->liveupdate->groundSpeed > 0) {
$Minutes = round($dist_remain / $xml->liveupdate->groundSpeed * 60);
$time_remain = self::ConvertMinutes2Hours($Minutes);
} else {
$time_remain = '00:00';
}
$lat = str_replace(",", ".", $xml->liveupdate->latitude);
$lon = str_replace(",", ".", $xml->liveupdate->longitude);
$fields = array('pilotid' => $pilotid, 'flightnum' => $xml->liveupdate->flightNumber, 'pilotname' => '', 'aircraft' => $xml->liveupdate->registration, 'lat' => $lat, 'lng' => $lon, 'heading' => $xml->liveupdate->heading, 'alt' => $xml->liveupdate->altitude, 'gs' => $xml->liveupdate->groundSpeed, 'depicao' => $xml->liveupdate->depICAO, 'arricao' => $xml->liveupdate->arrICAO, 'deptime' => $xml->liveupdate->depTime, 'arrtime' => '', 'route' => $xml->liveupdate->route, 'distremain' => $dist_remain, 'timeremaining' => $time_remain, 'phasedetail' => $xml->liveupdate->status, 'online' => '', 'client' => 'kACARS');
#$this->log("UpdateFlightData: \n".print_r($fields, true), 'kacars');
ACARSData::UpdateFlightData($pilotid, $fields);
break;
case 'pirep':
$flightinfo = SchedulesData::getProperFlightNum($xml->pirep->flightNumber);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
# Make sure airports exist:
# If not, add them.
if (!OperationsData::GetAirportInfo($xml->pirep->depICAO)) {
OperationsData::RetrieveAirportInfo($xml->pirep->depICAO);
}
if (!OperationsData::GetAirportInfo($xml->pirep->arrICAO)) {
OperationsData::RetrieveAirportInfo($xml->pirep->arrICAO);
}
# Get aircraft information
$reg = trim($xml->pirep->registration);
$ac = OperationsData::GetAircraftByReg($reg);
# Load info
/* If no passengers set, then set it to the cargo */
$load = $xml->pirep->pax;
if (empty($load)) {
$load = $xml->pirep->cargo;
}
/* Fuel conversion - kAcars only reports in lbs */
$fuelused = $xml->pirep->fuelUsed;
if (Config::Get('LiquidUnit') == '0') {
# Convert to KGs, divide by density since d = mass * volume
$fuelused = $fuelused * 0.45359237 / 0.8075;
//.........这里部分代码省略.........
示例4: acars
/**
* Process ACARS messages here
*
*/
public function acars()
{
if (!isset($_REQUEST['DATA1'])) {
die("0|Invalid Data");
}
if (!isset($_REQUEST['DATA1'])) {
die("0|Invalid Data");
}
// TEST, BEGINFLIGHT, PAUSEFLIGHT, ENDFLIGHT and MESSAGE
$method = strtoupper($_REQUEST['DATA2']);
if (!isset($_REQUEST['DATA3'])) {
$value = '';
} else {
$value = $_REQUEST['DATA3'];
}
if (!isset($_REQUEST['DATA4'])) {
$message = '';
} else {
$message = $_REQUEST['DATA4'];
}
$this->log("Method: {$method}", 'fsfk');
$fields = array();
# Go through each method now
if ($method == 'TEST') {
$pilotid = $value;
echo '1|30';
return;
} elseif ($method == 'BEGINFLIGHT') {
$flight_data = explode('|', $value);
if (count($flight_data) < 10) {
echo '0|Invalid login data';
return;
}
/*preg_match('/^([A-Za-z]*)(\d*)/', $flight_data[0], $matches);
$code = $matches[1];
$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');*/
$pilotid = PilotData::parsePilotID($flight_data[0]);
$coords = $this->get_coordinates($flight_data[6]);
$route = explode('~', $flight_data[5]);
$depicao = $route[0];
$arricao = $route[count($route) - 1];
unset($route[0]);
unset($route[count($route) - 1]);
$route = implode(' ', $route);
$flightinfo = SchedulesData::getProperFlightNum($flight_data[2]);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
$aircraft = $flight_data[3];
$heading = $flight_data[12];
$alt = $flight_data[7];
$gs = 0;
$dist_remain = $flight_data[16];
$time_remain = 0;
$deptime = time();
$online = 0;
$fields = array('pilotid' => $pilotid, 'flightnum' => $code . $flightnum, 'aircraft' => $aircraft, 'lat' => $coords['lat'], 'lng' => $coords['lng'], 'heading' => $heading, 'route' => $route, 'alt' => $alt, 'gs' => $gs, 'depicao' => $depicao, 'arricao' => $arricao, 'distremain' => $dist_remain, 'timeremaining' => $time_remain, 'phasedetail' => 'On the ground', 'online' => $online, 'client' => 'fsfk');
} elseif ($method == 'MESSAGE') {
$pilotid = $value;
$flight_data = ACARSData::get_flight_by_pilot($pilotid);
// Get the flight
preg_match("/Flight ID: (.*)\n/", $message, $matches);
$flightinfo = SchedulesData::getProperFlightNum($matches[1]);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
// Get the aircraft
preg_match("/.*Aircraft Reg: \\.\\.(.*)\n/", $message, $matches);
$aircraft_data = OperationsData::GetAircraftByReg(trim($matches[1]));
$aircraft = $aircraft_data->id;
$depicao = $flight_data->depicao;
$arricao = $flight_data->arricao;
// Get coordinates from ACARS message
$count = preg_match("/POS(.*)\n/", $message, $matches);
if ($count > 0) {
$coords = $this->get_coordinates(trim($matches[1]));
} else {
$coords = array('lat' => $flight_data->lat, 'lng' => $flight_data->lng);
}
// Get our heading
preg_match("/\\/HDG.(.*)\n/", $message, $matches);
$heading = $matches[1];
// Get our altitude
preg_match("/\\/ALT.(.*)\n/", $message, $matches);
$alt = $matches[1];
// Get our speed
preg_match("/\\/IAS.(.*)\\//", $message, $matches);
$gs = $matches[1];
$fields = array('pilotid' => $pilotid, 'aircraft' => $aircraft, 'lat' => $coords['lat'], 'lng' => $coords['lng'], 'heading' => $heading, 'alt' => $alt, 'gs' => $gs, 'phasedetail' => 'Enroute');
} elseif ($method == 'UPDATEFLIGHTPLAN') {
$flight_id = $value;
$flight_data = explode("|", $message);
echo '1|';
return;
}
$depapt = OperationsData::GetAirportInfo($depicao);
$dist_remain = SchedulesData::distanceBetweenPoints($coords->lat, $coords->lng, $depapt->lat, $depapt->lng);
# Estimate the time remaining
//.........这里部分代码省略.........
示例5: array
$fields = array('pilotid' => $pilotid, 'flightnum' => $_GET['IATA'], 'pilotname' => '', 'aircraft' => $aircraft, 'registration' => $_GET['Regist'], 'lat' => $_GET['lat'], 'lng' => $_GET['long'], 'heading' => '', 'alt' => $_GET['Alt'], 'gs' => $_GET['GS'], 'route' => '', 'depicao' => $_GET['depaptICAO'], 'depapt' => $_GET['depapt'], 'arricao' => $_GET['destaptICAO'], 'arrapt' => $_GET['destapt'], 'deptime' => '', 'arrtime' => '', 'distremain' => $_GET['disdestapt'], 'timeremaining' => $_GET['timedestapt'], 'phasedetail' => $phase_detail[$_GET['detailph']], 'online' => $_GET['Online'], 'client' => 'FSACARS');
Debug::log(print_r($fields, true), 'fsacars');
ACARSData::updateFlightData($pilotid, $fields);
Debug::log($cont, 'fsacars');
echo 'OK';
break;
#
# File the PIREP
#
#
# File the PIREP
#
case 'pirep':
Debug::log('PIREP FILE', 'fsacars');
Debug::log(serialize($_GET), 'fsacars');
$pilotid = PilotData::parsePilotID($_GET['pilot']);
/*if(is_numeric($_GET['pilot']))
{
$pilotid = $_GET['pilot'];
}
else
{
# see if they are a valid pilot:
preg_match('/^([A-Za-z]*)(\d*)/', $_GET['pilot'], $matches);
$code = $matches[1];
$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');
}*/
if (!($pilot = PilotData::GetPilotData($pilotid))) {
echo 'Invalid Pilot!';
return;
}
示例6: explode
$data = explode('~', $_REQUEST['DATA2']);
$flightinfo = SchedulesData::getProperFlightNum($data[2]);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
/*if(!is_numeric($data[0]))
{
# see if they are a valid pilot:
preg_match('/^([A-Za-z]*)(\d*)/', $data[0], $matches);
$pilot_code = $matches[1];
$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');
}
else
{
$pilotid = $data[0];
}*/
$pilotid = PilotData::parsePilotID($data[0]);
# Make sure airports exist:
# If not, add them.
$depicao = $data[6];
$arricao = $data[7];
if (!OperationsData::GetAirportInfo($depicao)) {
OperationsData::RetrieveAirportInfo($depicao);
}
if (!OperationsData::GetAirportInfo($arricao)) {
OperationsData::RetrieveAirportInfo($arricao);
}
# Get aircraft information
$reg = trim($data[3]);
$ac = OperationsData::GetAircraftByReg($reg);
# Load info
/* If no passengers set, then set it to the cargo */
示例7: intval
}*/
$pilotdata = PilotData::GetPilotData($pilotid);
if (!$pilotdata) {
echo '#Answer# Error - Username don\'t exist or wrong password;';
return;
}
# Give it what it wants
# Derive the config from the main config settings
echo "#Answer# Ok - connected;";
echo 'Weight=' . Config::Get('WeightUnit') . ' Dist=' . Config::Get('DistanceUnit') . ' Speed=' . Config::Get('SpeedUnit') . ' Alt=' . Config::Get('AltUnit') . ' Liqu=' . Config::Get('LiquidUnit');
echo '#welcome#' . Config::Get('WelcomeMessage') . '#endwelcome#';
}
if ($_POST['FsPAskToRegister'] == 'yes') {
$comment = '';
# Get the pilot id:
$pilotid = PilotData::parsePilotID($_POST['UserName']);
/*if(is_numeric($_POST['UserName']))
{
$pilotid = intval(intval(trim( $_POST['UserName']))) - Config::Get('PILOTID_OFFSET');
}
else
{
if(preg_match('/^([A-Za-z]*)(\d*)/', $_POST['UserName'], $matches) == 0)
{
echo "#Answer# Error: Pilot doesn't exist ;";
return;
}
$pilotid = intval(intval(trim($matches[2]))) - Config::Get('PILOTID_OFFSET');
}*/
# Get the flight ID