Jump to content

Bluemax

Members
  • Posts

    114
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    New Jersy
  • Interests
    Flightsim - Science - Writing - Nascar*grin* - Other

Recent Profile Visitors

3945 profile views

Bluemax's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. OK, I realize this is an old post. I have been running the ObsessBlue skin on three different sites since 2009 never had an issue with the live map. The PHPvms version is the original when it came with the Crystal and crystalsidebar skins, anyhow I decide to update one of the sites with first version 5.5 xx and that version is over my head. The only skin i can use is the default crystal. anything else is a washout including the Ocean-Blue which was created for the 5,5xx version. So I went to PHPvms V2 all is well everything works except the Acars Map is blank on every skin except the default cyrstal skin. My api keys is installed... the maps work on my older versions of PHPvms .... So i was trying to build on the cyrstal skin until I realised what i need to know about the skin does not exsit in the layout template,, the .css is not an issue, Its not knowing specifically where the content is that drives that skin, such as the menubar and display content and yet I have no issue getting around the ObsessBlue skin,,,go figure. im a trial and error cut and paste person, don't know the code. If I wern't 73 years old I would learn it...but i could be playing the harp by then.Anyway guys, im open to any suggestions that would put me on the correct path.
  2. Bluemax

    Bluemax

    OMG that template was totally missing...So grateful for your help...now the api key works
  3. Bluemax

    Bluemax

    This is the file ACARSData.class.php <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class ACARSData extends CodonData { public static $lasterror; public static $pirepid; /** * This updates the ACARS live data for a pilot * * @param mixed $data This is the data structure with flight properties * @return mixed Nothing * */ public static function updateFlightData($pilotid, $data) { if(!is_array($data)) { self::$lasterror = 'Data not array'; return false; } if(isset($data['code']) && isset($data['flightnum'])) { $data['flightnum'] = $data['code'].$data['flightnum']; } // Add pilot info $pilotinfo = PilotData::getPilotData($pilotid); $data['pilotid'] = $pilotid; $data['pilotname'] = $pilotinfo->firstname . ' ' . $pilotinfo->lastname; // Store for later if(isset($data['registration'])) { $ac_registration = $data['registration']; unset($data['registration']); } if(isset($data['depicao'])) { $dep_apt = OperationsData::GetAirportInfo($data['depicao']); $data['depapt'] = DB::escape($dep_apt->name); } if(isset($data['arricao'])) { $arr_apt = OperationsData::GetAirportInfo($data['arricao']); $data['arrapt'] = DB::escape($arr_apt->name); } if(isset($data['route']) && empty($data['route'])) { $flight_info = SchedulesData::getProperFlightNum($data['flightnum']); $params = array( 's.code' => $flight_info['code'], 's.flightnum' => $flight_info['flightnum'], ); $schedule = SchedulesData::findSchedules($params); $schedule = $schedule[0]; $data['route'] = $schedule->route; //$data['route_details'] = serialize(SchedulesData::getRouteDetails($schedule->id)); } /* A route was passed in, so get the details about this route */ elseif(isset($data['route']) && !empty($data['route'])) { /*$tmp = new stdClass(); $tmp->deplat = $dep_apt->lat; $tmp->deplng = $dep_apt->lng; $tmp->route = $data['route']; $data['route_details'] = NavData::parseRoute($tmp); $data['route_details'] = serialize($data['route_details']); unset($tmp);*/ } if(!empty($data['route_details'])) { $data['route_details'] = DB::escape($data['route_details']); } if(isset($dep_apt)) { unset($dep_apt); } if(isset($arr_apt)) { unset($arr_apt); } // Clean up times if(isset($data['deptime']) && !is_numeric($data['deptime'])) { $data['deptime'] = strtotime($data['deptime']); } if(isset($data['arrtime']) && !is_numeric($data['arrtime'])) { $data['arrtime'] = strtotime($data['arrtime']); } /* Check the heading for the flight If none is specified, then point it straight to the arrival airport */ if($data['heading'] == '' || (!isset($data['heading']) && isset($data['lat']) && isset($data['lng']))) { /* Calculate an angle based on current coords and the destination coordinates */ $data['heading'] = intval(atan2(($data['lat'] - $arr_apt->lat), ($data['lng'] - $arr_apt->lng)) * 180/3.14); if(($data['lat'] - $data['lng']) < 0) { $data['heading'] += 180; } if($data['heading'] < 0) { $data['heading'] += 360; } } // Manually add the last set $data['lastupdate'] = 'NOW()'; // first see if we exist: $sql = 'SELECT `id` FROM '.TABLE_PREFIX."acarsdata WHERE `pilotid`={$pilotid}"; $exist = DB::get_row($sql); $flight_id = ''; if($exist) { // update $upd = array(); $flight_id = $exist->id; foreach($data as $field => $value) { $value = DB::escape(trim($value)); // Append the message log if($field === 'messagelog') { $upd[] ="`messagelog`=CONCAT(`messagelog`, '{$value}')"; } elseif($field === 'lastupdate') { $upd[] = "`lastupdate`=NOW()"; } // Update times elseif($field === 'deptime' || $field === 'arrtime') { /* If undefined, set a default time to now (penalty for malformed data?) Won't be quite accurate.... */ if($value == '') { $value = time(); } $upd[] = "`{$field}`=FROM_UNIXTIME({$value})"; } else { $upd[] = "`{$field}`='{$value}'"; } } $upd = implode(',', $upd); $query='UPDATE '.TABLE_PREFIX."acarsdata SET {$upd} WHERE `id`='{$flight_id}'"; DB::query($query); } else { // form array with $ins[column]=value and then // give it to quick_insert to finish $ins = array(); $vals = array(); foreach($data as $field => $value) { $ins[] = "`{$field}`"; if($field === 'deptime' || $field === 'arrtime') { if(empty($value)) $value = time(); $vals[] = "FROM_UNIXTIME({$value})"; } elseif($field === 'lastupdate') { $vals[] = 'NOW()'; } else { $value = DB::escape($value); $vals[] = "'{$value}'"; } } $ins = implode(',', $ins); $vals = implode(',', $vals); $query = 'INSERT INTO '.TABLE_PREFIX."acarsdata ({$ins}) VALUES ({$vals})"; DB::query($query); $data['deptime'] = time(); $flight_id = DB::$insert_id; } $flight_info = self::get_flight_by_id($flight_id); // Add this cuz we need it $data['code'] = $pilotinfo->code; $data['pilotid'] = $pilotid; $data['unique_id'] = $flight_id; $data['aircraft'] = $flight_info->aircraftname; $data['registration'] = $flight_info->registration; $res = CentralData::send_acars_data($data); return true; } public static function resetFlights() { $sql = 'DELETE FROM '.TABLE_PREFIX.'acarsdata'; DB::query($sql); return true; } public static function get_flight_by_id($id) { $id = intval($id); $sql = 'SELECT a.*, c.name as aircraftname, c.registration as registration, p.code, p.pilotid as pilotid, p.firstname, p.lastname FROM ' . TABLE_PREFIX .'acarsdata a LEFT JOIN '.TABLE_PREFIX.'aircraft c ON a.`aircraft`= c.`id` LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = a.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = a.arricao LEFT JOIN '.TABLE_PREFIX.'pilots p ON a.`pilotid`= p.`pilotid` WHERE a.id='.$id; return DB::get_row($sql); } public static function get_flight_by_pilot($pilotid) { $pilotid = intval($pilotid); $sql = 'SELECT * FROM '.TABLE_PREFIX."acarsdata WHERE `pilotid`='{$pilotid}'"; return DB::get_row($sql); } public static function get_flight($code, $flight_num) { $code = DB::escape($code); $flight_num = DB::escape($flight_num); $sql = 'SELECT * FROM '.TABLE_PREFIX."acarsdata WHERE flightnum='{$code}{$flight_num}'"; return DB::get_row($sql); } /** * File a PIREP from an ACARS program * * @param mixed $pilotid The pilot ID of the pilot filing the PIREP * @param mixed $data This is the data structure with the PIREP info * @return bool true/false * */ public static function FilePIREP($pilotid, $data) { if(!is_array($data)) { self::$lasterror = 'PIREP data must be array'; return false; } # Call the pre-file event # if(CodonEvent::Dispatch('pirep_prefile', 'PIREPS', $_POST) == false) { return false; } # File the PIREP report # $ret = PIREPData::FileReport($data); # Set them as non-retired PilotData::setPilotRetired($pilotid, 0); if(!$ret) return false; self::$pirepid = DB::$insert_id; # Call the event # CodonEvent::Dispatch('pirep_filed', 'PIREPS', $_POST); # Close out a bid if it exists # $bidid = SchedulesData::GetBidWithRoute($pilotid, $data['code'], $data['flightnum']); if($bidid) { SchedulesData::RemoveBid($bidid->bidid); } return true; } public static function GetAllFlights() { $sql = 'SELECT a.*, c.name as aircraftname, c.registration as registration, p.code, p.pilotid as pilotid, p.firstname, p.lastname FROM ' . TABLE_PREFIX .'acarsdata a LEFT JOIN '.TABLE_PREFIX.'aircraft c ON a.`aircraft`= c.`registration` LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = a.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = a.arricao LEFT JOIN '.TABLE_PREFIX.'pilots p ON a.`pilotid`= p.`pilotid`'; return DB::get_results($sql); } /** * This returns all of the current ACARS flights within the cutoff * * @param int $cutofftime This is the cut-off time in minutes (12 hours return in) * @return array Returns an array of objects with the ACARS data * */ public static function GetACARSData($cutofftime = '') { //cutoff time in days if(empty($cutofftime)) { // Go from minutes to hours $cutofftime = Config::Get('ACARS_LIVE_TIME'); //$cutofftime = $cutofftime / 60; } $sql = 'SELECT a.*, c.name as aircraftname, p.code, p.pilotid as pilotid, p.firstname, p.lastname, dep.name as depname, dep.lat AS deplat, dep.lng AS deplng, arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng FROM ' . TABLE_PREFIX .'acarsdata a LEFT JOIN '.TABLE_PREFIX.'aircraft c ON a.`aircraft`= c.`registration` LEFT JOIN '.TABLE_PREFIX.'pilots p ON a.`pilotid`= p.`pilotid` LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = a.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = a.arricao '; if($cutofftime !== 0) { $sql .= 'WHERE DATE_SUB(NOW(), INTERVAL '.$cutofftime.' MINUTE) <= a.`lastupdate`'; } return DB::get_results($sql); DB::debug(); } } ACARS/ACARS.php <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class ACARS extends CodonModule { public $title = 'ACARS'; public $acarsflights; public function index() { $this->viewmap(); } public function viewmap() { $this->title = 'ACARS Map'; $this->set('acarsdata', ACARSData::GetACARSData()); $this->render('acarsmap.tpl'); } /** * We didn't list a function for each ACARS client, * so call this, which will include the acars peice in */ public function __call($name, $args) { $acars_action = $args[0]; // clean the name... $name = preg_replace("/[^a-z0-9-]/", "", strtolower($name)); if(dirname(__FILE__).DS.$name.'.php') { include_once dirname(__FILE__).DS.$name.'.php'; return; } } public function data() { $flights = ACARSData::GetACARSData(); if(!$flights) $flights = array(); $this->acarsflights = array(); foreach($flights as $flight) { if($flight->route == '') { $flight->route_details = array(); } else { $flight->route_details = NavData::parseRoute($flight->route); } $c = (array) $flight; // Convert the object to an array $c['pilotid'] = PilotData::GetPilotCode($c['code'], $c['pilotid']); // Normalize the data if($c['timeremaining'] == '') { $c['timeremaining'] == '-'; } if(trim($c['phasedetail']) == '') { $c['phasedetail'] = 'Enroute'; } /* If no heading was passed via ACARS app then calculate it This should probably move to inside the ACARSData function, so then the heading is always there for no matter what the calcuation is */ if($flight->heading == '') { /* Calculate an angle based on current coords and the destination coordinates */ $flight->heading = intval(atan2(($flight->lat - $flight->arrlat), ($flight->lng - $flight->arrlng)) * 180 / 3.14); //$flight->heading *= intval(180/3.14159); if(($flight->lng - $flight->arrlng) < 0) { $flight->heading += 180; } if($flight->heading < 0) { $flight->heading += 360; } } // Little one-off fixes to normalize data $c['distremaining'] = $c['distremain']; $c['pilotname'] = $c['firstname'] . ' ' . $c['lastname']; unset($c['messagelog']); $this->acarsflights[] = $c; continue; } CodonEvent::Dispatch('refresh_acars', 'ACARS'); echo json_encode($this->acarsflights); } public function routeinfo() { if($this->get->depicao == '' || $this->get->arricao == '') return; $depinfo = OperationsData::GetAirportInfo($this->get->depicao); if(!$depinfo) { $depinfo = OperationsData::RetrieveAirportInfo($this->get->depicao); } $arrinfo = OperationsData::GetAirportInfo($this->get->arricao); if(!$arrinfo) { $arrinfo = OperationsData::RetrieveAirportInfo($this->get->arricao); } // Convert to json format $c = array(); $c['depapt'] = (array) $depinfo; $c['arrapt'] = (array) $arrinfo; echo json_encode($c); } public function fsacarsconfig() { $this->write_config('fsacars_config.tpl', Auth::$userinfo->code.'.ini'); } public function fspaxconfig() { $this->write_config('fspax_config.tpl', Auth::$userinfo->code.'_config.cfg'); } public function xacarsconfig() { $this->write_config('xacars_config.tpl', 'xacars.ini'); } /** * 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.tpl) * @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!'; break; } $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid)); $this->set('userinfo', Auth::$userinfo); $acars_config = Template::GetTemplate($template_name, true); $acars_config = str_replace("\n", "\r\n", $acars_config); Util::downloadFile($acars_config, $save_as); } }
  4. Bluemax

    Bluemax

    I have givin up on version 5,5 don't have the knowledge in coding. So I put an older version back in have two older versions still working, Anyway it installed all went well ran the db check all is good. when i click on the live map I get this Fatal error message. has nothing to do with the skin..tried it on the default Crystal skin. Im not sure im in the right place for this question so forgive me. I searched everythread related to Acars, came up wit nothing, Fatal error: Class 'ACARSData' not found in /hermes/bosnacweb04/bosnacweb04cf/b1/ipg.XXXXXXX/XXXX/core/modules/ACARS/ACARS.php on line 32
  5. I appreciate very much your help. Re-uploaded the files you mentioned and all is good, thanks again. I don't know how to close this topic. David Zaleski www.valgrp.info
  6. Gentlemen, I would not trouble you if it weren't important. I run six VA's built on phpvms and I have resolved most of my own issues with various skins I use. But right now I am at a loss to my issue. When I go to he admin to post a new news topic or do a bulk email, the editor same as I'm typing in now is missing. have reloaded the admin panel but to no avail. Let me explain what I have done. Rebuilt a site and running it in parallel with the existing site, same database, same prefix code. Thought there was a conflict, so I dropped the local config file from the original site, so only the one site was running, but this didn't resolve the problem. Went and checked the database {Server} and ran a database check, still could not find anything. Ran a checkDB from site, found nothing. This has me stumped. I would appreciate any feedback
  7. For those of you who viewed this post and probably didn't have a response. Turns out the issue was on the server side. By Default they allocated only 18MB Script memory. They increased it to 64MB. Problem solved.
  8. Gents, never seen this error before. While accepting pireps in the admin panel getting error messages, pireps are going through, just don't understand the message. Don't know if it is a server or site issue. Fatal error:Allowed memory size of 18874368 bytes exhausted (tried to allocate bytes) in /hermes/bosweb26d/b2649/ipg.usavamcnet/vsac/core/common/StatsData.class.php on line 183 This is another message on a different pirep....they are going through all the to VA central? Fatal error: Allowed memory size of 18874368 bytes exhausted (tried to allocate 52 bytes) in /hermes/bosweb26d/b2649/ipg.usavamcnet/vsac/core/classes/ezdb/ezdb_mysql.class.php on line 273
  9. Recently we had a recruiting drive that netted us 22 new members, of them 8, never got out of the gate [Never made a flight] so after 72 hours if they fail to report for duty, we drop them from the roster. Now I can understand taking a hit at VA Central for deleting inactive members who have contributed to the program and just moved on. But we lost two slots for deleting pilots who never contributed a single flight? I thought I understood the formula but this has me puzzled. If we want to maintain our ranking, does this mean you never delete pilots whether they have contributed or not?
  10. I appreciate the comeback, I assumed as much. Interesting, One of the four VA's I run is AVAL http://www.virtualamericanairlines.com/aval/
  11. Not that anyone cares, VA Central is not updating. I deleted a site four days ago and it still ranked 36.....but again who cares.
  12. It's good to see VA Central back up and running. I couldn't find a VA Central heading to post this question. I noticed my logo image is missing on one of my accounts, tried to re-upload but its not excepting the images or any other images I try and upload. Also I deleted an old account, but it still shows up on the airline list. Is this something that changes when the stats update?
  13. Gents I have four sites on two servers, never had an install issue until going for my fifth. I run the installer, but the Check database connection does nothing, so if I go to Next, I get this error. I have changed the database twice and replaced the whole installation twice, still get this error. I would appreciate any help with this. Installing the tables... Fatal error: Uncaught <blockquote><font face=arial size=2 color=000099><b>Last Error --</b> [<font color=000000><b>Lost connection to MySQL server at 'reading initial communication packet', system error: 111 (2013)</b></font>]<br />[<font color=000000><b></b></font>]</font><p> </blockquote><hr noshade color=dddddd size=1> thrown in /hermes/bosweb/web121/b1216/ipg.americavaus/paav/core/classes/ezdb/ezdb_mysql.class.php on line 99 [solved]
  14. I'm not sure I understand your response? We don't use manual Pirep's on any of our sites, so I'm not sure where your going with the response. Please clarify.
  15. Nabeel, I have three VA's registered with VA Central, one of them does not show on the live map, although all the pireps do register and show. I have checked the URL and its correct. Side question, this was brought to my attention as I never pay much attention to pireps. I have been asked why all my pireps indicate a zero landing rate. I realize this is probably an FS Products question, but whether I use the kacars_free or my custom Kacars I always register a zero landing rate. Not a big deal but my crew thinks I'm a great pilot *grin*. No one on any of my site are this lucky, just me and I know better. Have any clue?
×
×
  • Create New...