예제 #1
0
 public function acarsdata()
 {
     $output = '';
     CodonEvent::Dispatch('refresh_acars', 'XML');
     $flights = ACARSData::GetACARSData();
     $xml = new SimpleXMLElement('<livemap/>');
     if (!$flights) {
         $flights = array();
     }
     foreach ($flights as $flight) {
         $pilot = $xml->addChild('aircraft');
         $pilot->addAttribute('flightnum', $flight->flightnum);
         $pilot->addAttribute('lat', $flight->lat);
         $pilot->addAttribute('lng', $flight->lng);
         $pilot->addChild('pilotid', PilotData::GetPilotCode($flight->code, $flight->pilotid));
         $pilot->addChild('pilotname', $flight->firstname . ' ' . $flight->lastname);
         $pilot->addChild('flightnum', $flight->flightnum);
         $pilot->addChild('lat', $flight->lat);
         $pilot->addChild('lng', $flight->lng);
         $pilot->addChild('depicao', $flight->depicao);
         $pilot->addChild('arricao', $flight->arricao);
         $pilot->addChild('phase', $flight->phasedetail);
         $pilot->addChild('alt', $flight->alt);
         $pilot->addChild('gs', $flight->gs);
         $pilot->addChild('distremain', $flight->distremain);
         $pilot->addChild('timeremain', $flight->timeremain);
     }
     header('Content-type: text/xml');
     echo $xml->asXML();
 }
예제 #2
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;
 }
예제 #3
0
 public function editprofile()
 {
     if (!Auth::LoggedIn()) {
         $this->set('message', 'You must be logged in to access this feature!');
         $this->render('core_error.tpl');
         return;
     }
     $this->set('userinfo', Auth::$userinfo);
     $this->set('customfields', PilotData::GetFieldData(Auth::$pilotid, true));
     $this->set('bgimages', PilotData::GetBackgroundImages());
     $this->set('countries', Countries::getAllCountries());
     $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));
     $this->render('profile_edit.tpl');
 }
예제 #4
0
 protected static function create_acars_flight($flight)
 {
     if (is_object($flight)) {
         $flight = (array) $flight;
     }
     // If a unique was specified
     if (isset($flight['unique_id'])) {
         $flight['id'] = $flight['unique_id'];
     }
     $acars_xml = self::$xml->addChild('flight');
     $acars_xml->addChild('unique_id', $flight['id']);
     $acars_xml->addChild('pilotid', PilotData::GetPilotCode($flight['code'], $flight['pilotid']));
     $acars_xml->addChild('pilotname', $flight['pilotname']);
     $acars_xml->addChild('flightnum', $flight['flightnum']);
     $acars_xml->addChild('aircraft', $flight['aircraft']);
     $acars_xml->addChild('lat', $flight['lat']);
     $acars_xml->addChild('lng', $flight['lng']);
     $acars_xml->addChild('depicao', $flight['depicao']);
     $acars_xml->addChild('arricao', $flight['arricao']);
     $acars_xml->addChild('deptime', $flight['deptime']);
     $acars_xml->addChild('arrtime', $flight['arrtime']);
     $acars_xml->addChild('heading', $flight['heading']);
     $acars_xml->addChild('phase', $flight['phasedetail']);
     $acars_xml->addChild('alt', $flight['alt']);
     $acars_xml->addChild('gs', $flight['gs']);
     $acars_xml->addChild('distremain', $flight['distremain']);
     $acars_xml->addChild('timeremain', $flight['timeremaining']);
     $acars_xml->addChild('client', $flight['client']);
     $acars_xml->addChild('lastupdate', $flight['lastupdate']);
 }
예제 #5
0
 /**
  * Maintenance::resethours()
  * 
  * @return
  */
 public function resethours()
 {
     CodonModule::checkPermission(MAINTENANCE);
     echo '<h3>Updating Total Hours Count</h3>';
     $total = 0;
     echo '<p>Calculating hours for all pilots: <br />';
     $allpilots = PilotData::GetAllPilots();
     foreach ($allpilots as $pilot) {
         $hours = PilotData::UpdateFlightHours($pilot->pilotid);
         $total = Util::AddTime($total, $hours);
         echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid) . " - found {$hours} flight hours for number <br />";
     }
     echo "Pilots have a total of <strong>{$total} hours</strong><br /><br />";
     echo "<strong>Now counting from PIREPS</strong><br />";
     StatsData::UpdateTotalHours();
     echo 'Found ' . StatsData::TotalHours() . ' total hours, updated<br /></p>';
     LogData::addLog(Auth::$userinfo->pilotid, 'Reset hours');
 }
예제 #6
0
 /**
  * CentralData::create_acars_flight()
  * 
  * @param mixed $flight
  * @return
  */
 protected static function create_acars_flight($flight)
 {
     if (is_object($flight)) {
         $flight = (array) $flight;
     }
     // If a unique was specified
     if (isset($flight['unique_id'])) {
         $flight['id'] = $flight['unique_id'];
     }
     $acars_xml = self::addElement(null, 'flight', null, array('unique_id' => $flight['id'], 'pilotid' => PilotData::GetPilotCode($flight['code'], $flight['pilotid']), 'pilotname' => $flight['pilotname'], 'flightnum' => $flight['flightnum'], 'aircraft' => $flight['aircraft'], 'lat' => $flight['lat'], 'lng' => $flight['lng'], 'depicao' => $flight['depicao'], 'arricao' => $flight['arricao'], 'deptime' => $flight['deptime'], 'arrtime' => $flight['arrtime'], 'heading' => $flight['heading'], 'phase' => $flight['phasedetail'], 'alt' => $flight['alt'], 'gs' => $flight['gs'], 'distremain' => $flight['distremain'], 'timeremain' => $flight['timeremaining'], 'client' => $flight['client'], 'lastupdate' => $flight['lastupdate']));
 }
예제 #7
0
				Sign-in with your pilot id or email, or <a href="<?php 
    echo url('/registration');
    ?>
">register</a><br />
			<input type="text" name="email" value="" onClick="this.value=''" />
			<input type="password" name="password" value="" />
			<input type="hidden" name="remember" value="on" />
			<input type="hidden" name="redir" value="index.php/profile" />
			<input type="hidden" name="action" value="login" />
			<input type="submit" name="submit" value="Log In" />
			</form>
			<?php 
} else {
    /*	Auth::$userinfo has the information about the user currently logged in
    			We will use this next line - this gets their full pilot id, formatted properly */
    $pilotid = PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid);
    ?>
		
		<img align="left" height="50px" width="50px" style="margin-right: 10px;"
			src="<?php 
    echo PilotData::getPilotAvatar($pilotid);
    ?>
" />

		<strong>Pilot ID: </strong> <?php 
    echo $pilotid;
    ?>
		<strong>Rank: </strong><?php 
    echo Auth::$userinfo->rank;
    ?>
<br />
예제 #8
0
</tr>
</thead>
<tbody>
<?php 
foreach ($allbids as $bid) {
    ?>
<tr id="row<?php 
    echo $bid->bidid;
    ?>
">
	<td><?php 
    echo $bid->code . $bid->flightnum . "({$bid->depicao} - {$bid->arricao})";
    ?>
</td>
	<td><?php 
    echo PilotData::GetPilotCode($bid->code, $bid->flightnum) . ' - ' . $bid->firstname . ' ' . $bid->lastname;
    ?>
</td>
	<td><?php 
    echo $bid->dateadded;
    ?>
</td>
	<td>
	<button href="<?php 
    echo SITE_URL;
    ?>
/admin/action.php/pilotadmin/viewbids" action="deletebid"
		id="<?php 
    echo $bid->bidid;
    ?>
" class="deleteitem {button:{icons:{primary:'ui-icon-trash'}}}">
 * VERSION: 1.0
 * DATE: 2015.12.25
 * AUTHOR: BASTIAN WAGNER
*/
require './smarty/libs/Smarty.class.php';
//Smarty einbinden
require '../phpvms/core/codon.config.php';
// phpVMS config file einbinden
//Neue Smarty Instanz erstellen
$tpl = new Smarty();
//Pilot-Basisinformationen aus URL und phpVMS auslesen
$pilotid = $_GET["id"];
$userinfo = PilotData::getPilotData($pilotid);
//Alle Daten des Piloten in Variablen speichern
//PilotID
$pilotcode = PilotData::GetPilotCode($userinfo->code, $userinfo->pilotid);
//Pilot Name
$name = $userinfo->firstname . ' ' . $userinfo->lastname;
//Rang Bild
$rankimg = $userinfo->rankimage;
//Rang
$rank = $userinfo->rank;
//Flüge insg.
$totalflights = $userinfo->totalflights;
//Stunden insg.
$totalhours = Util::AddTime($userinfo->totalhours, $userinfo->transferhours);
//Landesflagge
$countryflag = Countries::getCountryImage($userinfo->location);
//Landesname
$countryname = Countries::getCountryName($userinfo->location);
//IVAO Status Badge fieldvalue = IVAO VID
예제 #10
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');
 }
예제 #11
0
 /**
  * Profile::badge()
  *
  * @return
  */
 public function badge()
 {
     $this->set('badge_url', fileurl(SIGNATURE_PATH . '/' . PilotData::GetPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid) . '.png'));
     $this->set('pilotcode', PilotData::getPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid));
     $this->render('profile_badge.tpl');
 }
<?php

if (!defined('IN_PHPVMS') && IN_PHPVMS !== true) {
    die;
}
?>
<h3>Registration Confirmation</h3>
<p>Thanks for joining us! Your registration has been completed! You can login using your pilot ID (<?php 
echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid);
?>
), and the password you used during registration.</p>
예제 #13
0
파일: PIREPS.php 프로젝트: rallin/phpVMS
 protected function FilePIREPForm($bidid = '')
 {
     if (!Auth::LoggedIn()) {
         $this->set('message', 'You must be logged in to access this feature!');
         $this->render('core_error.tpl');
         return;
     }
     $this->set('pilot', Auth::$userinfo->firstname . ' ' . Auth::$userinfo->lastname);
     $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));
     $this->set('pirepfields', PIREPData::GetAllFields());
     if ($bidid != '') {
         $this->set('bid', SchedulesData::GetBid($bidid));
         // get the bid info
     }
     $this->set('allairports', OperationsData::GetAllAirports());
     $this->set('allairlines', OperationsData::GetAllAirlines(true));
     $this->set('allaircraft', OperationsData::GetAllAircraft(true));
     $this->render('pirep_new.tpl');
 }
예제 #14
0
 protected function write_template($name, $save_as)
 {
     $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));
     $this->set('userinfo', Auth::$userinfo);
     $acars_config = Template::GetTemplate($name, true);
     $acars_config = str_replace("\n", "\r\n", $acars_config);
     Util::downloadFile($acars_config, $save_as);
     return;
     # Set the headers so the browser things a file is being sent
     header('Content-Type: text/plain');
     header('Content-Disposition: attachment; filename="' . $save_as . '"');
     header('Content-Length: ' . strlen($acars_config));
     echo $acars_config;
 }
<?php

if (!defined('IN_PHPVMS') && IN_PHPVMS !== true) {
    die;
}
foreach ($pilot_list as $pilot) {
    ?>
    <p>
        <a href="<?php 
    echo url('/profile/view/' . $pilot->pilotid);
    ?>
">
            <?php 
    echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid) . ' ' . $pilot->firstname . ' ' . $pilot->lastname;
    ?>
        </a>
    </p>
<?php 
}
예제 #16
0
 /**
  * Write out a config file to the user, give the template name and
  *	the filename to save the template as to the user
  *
  * @param mixed $template_name Template to use for config (fspax_config.php)
  * @param mixed $save_as File to save as (xacars.ini)
  * @return mixed Nothing, sends the file to the user
  *
  */
 public function write_config($template_name, $save_as)
 {
     if (!Auth::LoggedIn()) {
         echo 'You are not logged in!';
         exit;
     }
     $this->set('pilotcode', PilotData::GetPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid));
     $this->set('userinfo', Auth::$pilot);
     $this->set('pilot', Auth::$pilot);
     $acars_config = Template::GetTemplate($template_name, true);
     $acars_config = str_replace("\n", "\r\n", $acars_config);
     Util::downloadFile($acars_config, $save_as);
 }
예제 #17
0
파일: PIREPS.php 프로젝트: Galihom/phpVMS
 /**
  * PIREPS::FilePIREPForm()
  * 
  * @param string $bidid
  * @return
  */
 protected function FilePIREPForm($bidid = '')
 {
     if (!Auth::LoggedIn()) {
         $this->set('message', 'You must be logged in to access this feature!');
         $this->render('core_error.tpl');
         return;
     }
     $this->set('pilot', Auth::$pilot->firstname . ' ' . Auth::$pilot->lastname);
     $this->set('pilotcode', PilotData::GetPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid));
     $this->set('pirepfields', PIREPData::GetAllFields());
     if ($bidid != '') {
         $this->set('bid', SchedulesData::GetBid($bidid));
         // get the bid info
     }
     $airport_list = OperationsData::getAllAirports();
     $this->set('allairports', $airport_list);
     #deprecated
     $this->set('airport_list', $airport_list);
     $airline_list = OperationsData::getAllAirlines(true);
     $this->set('allairlines', $airline_list);
     #deprecated
     $this->set('airline_list', $airline_list);
     $aircraft_list = OperationsData::getAllAircraft(true);
     /*	Skip any aircraft which have aircraft that the pilot
     			is not rated to fly (according to RANK)
                 This means the aircraft rank level is higher than
     			what the pilot's ranklevel, so just do "continue"
     			and move onto the next route in the list 
     	     */
     if (Config::Get('RESTRICT_AIRCRAFT_RANKS') === true) {
         foreach ($aircraft_list as $index => $aircraft) {
             if ($aircraft->ranklevel > Auth::$pilot->ranklevel) {
                 unset($aircraft_list[$index]);
                 continue;
             }
         }
     }
     $this->set('allaircraft', $aircraft_list);
     #deprecated
     $this->set('aircraft_list', $aircraft_list);
     $this->render('pirep_new.tpl');
 }