Code Monkey home page Code Monkey logo

openflights's Introduction

OpenFlights

Welcome to the code base for OpenFlights, a tool that lets you map your flights around the world, search and filter them in all sorts of interesting ways, calculate statistics automatically, and share your flights and trips with friends and the entire world (if you wish).

Data

Most people come here for the free airport, airline and route data. See the documentation or plunge straight into the data itself.

User interface

See locale for supported languages and instructions for editing them or adding new ones.

Code

I'll be upfront: this codebase is an unholy mess. The bulk of it was written in 2008, back when PHP seemed like a good idea and the only way to learn JavaScript was the hard way. Any vestiges of sanity you may encounter (eg. unit and integration tests or package management) were grafted on as an incomplete afterthought.

Basically, though, it's your classic LNMP app. JavaScript frontend (mostly in the monolithic openflights.js, some bits under js) talking to a Nginx/PHP backend (in php) that wraps around a MySQL database.

Tests

Test coverage is woefully incomplete, but comes in three flavors:

  • client: Client-side full-stack integration tests, require live DB & server
  • server: Server-side (PHP) integration tests, require a live database
  • unit: Client-side JavaScript unit tests

Installation

See INSTALL for system requirements and instructions.

Development Docker

A basic Docker setup is available to simplify setting up a development environment but requires a couple of manual steps to get the site up and running.

  1. cp php/config.sample.php php/config.php and set $host = "db"; so the host name matches the the database container host name.

  2. Run docker-compose up to create the containers.

  3. Install local PHP dependencies inside the container.

    # host shell
    user@host:openflights $ docker exec -it openflights-web-1 bash
    
    # container shell
    root@ee261e8f9103:/# cd /var/www/openflights/ && php /usr/local/bin/composer install
    
  4. You should be able to access the site at http://localhost:8007.

openflights's People

Contributors

andrewachen avatar arcykong avatar brouwer avatar chrisrosset avatar dependabot[bot] avatar dyung avatar gjdv avatar johanricher avatar jpatokal avatar madeco avatar ouuan avatar reedy avatar stevewaring avatar williammck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openflights's Issues

[Bug] Add UCase function to flight number [sf#4]

*Reported by anonymous on 2008-09-12 12:38 UTC
More of a function improvement request than a bug, but...

For the airports you have an onBlur even that converts the text to uppercase. Can you add the same to the onBlur for the flight number field? That way co111 would become CO111 and the airline field would also be populated with the caps version. It is a minor aesthetic thing, but I think it would be nice.

[Bug] Unable to display the first selected airline route [sf#47]

Reported by slasher-fun on 2009-12-23 21:24 UTC
Steps to reproduce :

  • Go on openflights homepage
  • Choose "Virgin America (VX)" in the search field, click "search"

--> An error message appears : "ERROR: No airport with ID undefined found:NaN of undefined.i
Please hit CTRL-F5 to force refresh, and report this error if it does not go away."

[Bug] Flights between time zones don't sort correctly [sf#24]

Reported by redjoe on 2009-06-10 09:19 UTC
The chronological order for flights doesn't take time zones into account. For instance, if you fly NRT-LAX from 12 pm to 7 am, then fly out of LAX at 9 am, the second flight is sorted as if it took place before the NRT-LAX flight.

[Bug] create.sql in SVN not up-to-date [sf#26]

Reported by hscholz on 2009-07-09 15:42 UTC
The table definition in sql/create.sql only contains the fields name, password, email, public and int whereas the create statement
in php/settings.php tries to populate name, password, email, public, editor, locale and units.

Please update create.sql to also incude editor, locale and units.

Also note that the database created is named flightdb while php/db.php tries to read flightdb2.

[Bug] can't add new airport [sf#27]

*Reported by anonymous on 2009-07-13 06:34 UTC
I want to import my flights from flightmemory and if i have to add a new airport it always says!

"sorry you have to be logged into open flights to use this!

what does this mean??

thanks for your help
robert

[Bug] Data for KEUG is incorrect [sf#22]

Reported by apray on 2009-05-12 22:11 UTC
The city data for KEUG says "Redding, United States". Instead, it should say "Eugene". The airport is appearing in the correct location, and its name appears to be correct ("Mahlon Sweet Field"), but the city name is wrong.

[Bug] "Color undefined: NaN" [sf#8]

*Reported by anonymous on 2008-10-01 05:44 UTC
This error message occasionally pops up in a message box when switching from edit flight to statistics view.

[Bug] Ghosted future airports show up funny in IE7 [sf#16]

Reported by jpatokal on 2009-01-22 17:31 UTC
Future airports are set to show at 50% transparency, and Firefox handles this fine. However, IE7 ghosts not only the icon circle, but the space between the circle and the icon edges as well, causing an odd blocky appearance.

[Bug] No Daylight Saving Time on UK Islands [sf#37]

Reported by tismeyer on 2009-08-12 23:33 UTC
When entering data for some new flights I discovered that there is a bug on the Isle of Man (IOM) and the Channel Islands (Jersey JER, Guernsey GCI, Alderney ACI): It seems these Islands are one hour "behind" the time. Meaning on your site they have like 9am when the rest of the UK and Ireland have 10am. In reality, they all have the same time.
It seems to me you "forgot" to add them to a "group" or something that is experiencing Daylight Saving Time? Because the bug only happens during summer time, not in winter!

Would be lovely if you could fix this! Thanks a lot for the great service!

[Bug] Issue with flight number if carrier code ends in a number [sf#5]

*Reported by anonymous on 2008-09-12 13:48 UTC
I just tried to add a JetBlue (B6) flight in. When I add a CO flight and put CO111 in the flight number the system automatically figures out the carrier and puts that in the box below. With B6 it did not, likely because it was a letter/number and not two letters. It looks like the effect is the same if the carrier is a number then a letter (e.g. Jet Airways/9W).

[Bug] airport already exists [sf#28]

*Reported by anonymous on 2009-07-14 11:03 UTC
i try to import my flights, the database doesnt recognice the airport EPS, when i try to add it it says it already exists, so how can i import my flights if i cannot add it and it does not know it?!

thanks for the help

[Bug] Unable to login after session expiry [sf#43]

Reported by jpatokal on 2009-12-15 22:45 UTC
If a user opens the OpenFlights home page and does not log in, the session in the server will eventually expire. Once this happens, the challenge issued to the user and the challenge on the server no longer match, and the user will be unable to log in even if their password is correct.

Fix: the challenge should be sent over, compared, and a refresh forced if it has expired.

[Bug] Color Undefined: NaN error when adding entry [sf#9]

*Reported by anonymous on 2008-11-16 20:33 UTC
The new feature to make the previous destination the new origin is awesome, but it is breaking things in FF3/Vista. When the origin is populated and then destination cleared the time goes to NaN and then a series of ~6 error messages pop up, all saying something to the effect of "Color Undefined: NaN." I can OK through all of them and then add the destination and add my flight, but it is rather annoying.

A side effect of this seems to be that the origin airport is not showing up on the map during the add process.

Otherwise the add works fine.

[Bug] IATA codes for non-airlines [sf#21]

Reported by jpatokal on 2009-04-09 09:32 UTC
Bug 1: Entering "2V123" does not map to "Amtrak" if "Mode=Train" is selected.
Bug 2: Entering "2V123" maps to Amtrak if mode=flight, but does not correct to mode=Train.

Solution: If users enter flight numbers with IATA codes (eg. "2Vxxx"), then...

  1. Check across all travel modes for matches
  2. If found, update the current travel mode to match the result

[Bug] NBO Dislocated [sf#36]

*Reported by anonymous on 2009-08-10 21:01 UTC
NBO Nairobi Jomo-Kenyatta Airport is dislocated. There is a (priv) Entry of Nairobi Jomo-Kenyatta which seems to be correct.

[Bug] LEV airport misplaced [sf#20]

*Reported by anonymous on 2009-03-30 11:22 UTC
LEV airport (in Fiji) shows up at long 177°49'59.99"E when it is 178°49'59.99"E
Could you correct plz ?

thx

[Bug] Display Plots Future Flights [sf#13]

Reported by bdesmond on 2009-01-04 04:45 UTC
I imported my spreadsheet of flights hwich includes a number of planned trips. I notice that even though they have dates in the future, they are plotted on the display (and presumably included in the various computed statistics).

The behavior I was expecting was that only past data would be included.

[Bug] Public page shows as "open" when user is logged in [sf#6]

Reported by jpatokal on 2008-09-14 06:54 UTC
If a user has previously logged in and then goes to their public page (/user/xxx) without first logging out, they are treated as still logged in and eg. allowed to see full flight details, even if the profile's privacy options are set to something different.

[Bug] Miles in table sort incorrectly [sf#1]

Reported by jpatokal on 2008-08-15 14:44 UTC
(from FCYTravis)

When I attempt to sort flight columns by miles, it performs a simple first-number, second number sort, resulting in lists like this:

1014
134
179
179
198
2170
2394
2513
266
355
3422
405

[Bug] TO IATA code [sf#48]

*Reported by anonymous on 2009-12-24 18:17 UTC
The TO IATA code belongs to both President Airlines (Cambodia) and Transavia.com France (french subsidiary of Transavia.com).

It's currently associated to President Airlines in openflights, but since Transavia.com France has a way bigger fleet, I think the attribution should change, regarding the majority use made of this code.

[Bug] Unable to change password [sf#45]

Reported by jpatokal on 2009-12-21 02:23 UTC
Some users are unable to change their passwords, getting a "Sorry, current password is not correct" error even though they are entering the correct password. Seems to happen mostly after manual password resets?

[Bug] Airline editor bugs for user-entered airlines [sf#49]

Reported by jpatokal on 2009-12-26 05:28 UTC
If attempting to edit airliines added by users, the display shows a bunch of NULLs instead of correctly emptying unknown fields. Likewise, on saving the data, they should be written back as null, not the string "null".

[Bug] Can't select the right item in the map search field 1st try [sf#50]

Reported by slasher-fun on 2009-12-26 10:29 UTC
Tested under Ubuntu Linux 9.10, with Firefox 3.5 and 3.6 beta 5

Steps to reproduce :

  • Go on openflights.org
  • In the search field, type something that will return several results. For example, AF or Virgin
  • Try to select any item : the 1st one gets automatically selected, followed by a number

Examples :

  • Virgin gives 5 results, any choice will result in "Durban-Virginia (VIR), South Africa5331" being selected
  • AF gives 4 results, any choice will result in "Afyon (AFY), Turkey137" being selected

This issue only occurs for the 1st search of each session (i.e. reoccurs once after reloading (F5) the page).

[Bug] Top 10 Statistics Formatting [sf#14]

Reported by bdesmond on 2009-01-04 04:47 UTC
The formatting under IE7 for the top 10 statistics makes it such that they all run together since there are multiple columns of disparate data displayed side by side. It's very easy to confuse which statistic the numbers displayed correspond to.

Some simple a/b white/grey background coloring of columns or vertical borders would make this alot easier to read.

[Bug] removing a trip duplicates it [sf#32]

*Reported by anonymous on 2009-07-19 10:49 UTC
A few days ago I added a trip that later had three flights connected to it.
When using the trip URL (http://openflights.org/trip/1787 in this case) the flights are shown under 'list flights' but the map does not show flights nor background tiles.
I tried to fix this by re-adding flights/changing the trip and eventually hit the 'delete' button in the little trip popup window.
The window then showed a red 'undefined' message and as a result the trip name shows up twice wherever I can select trips.
Now whenever I try to delete one of the trips (named 'frst time Ryanair') it gets duplicated to a new trip ID. Trip IDs now are: 1787, 1788, 1791, 1797 and probably even more. No flight per default relates to any of those trip IDs, though.

Btw: username is hs.

[Bug] Login not properly working under Opera [sf#15]

*Reported by anonymous on 2009-01-19 00:59 UTC
Hey,

If I type in my username/password and use ENTER to continue the website won't let me login, if I click with my mouse on the Login button it works fine. Even when I am using the magic wand tool (remember password) it does not let me log in (it also automaticly submits the form). Maybe a JS problem?

thx again,
Kimble

[Bug] Half the airports not visible near dateline [sf#2]

Reported by jpatokal on 2008-08-15 14:48 UTC
If the map is panned so that the view overlaps the International Date Line, airports are visible only on the larger of the two halves. For example, if you center on a NRT-SFO flight, you can see NRT or SFO, but not both.

[Bug] Flights within the same day don't re-sort with dates [sf#40]

*Reported by anonymous on 2009-11-20 06:23 UTC
Let's say you fly SIN-BKK-HKG on a given day. If you sort your flights in descending order by date (newest first, i.e. the default mode), you see BKK-HKG, then SIN-BKK. If you sort in ascending order by date, you still see BKK-HKG first, then SIN-BKK. This may not be a "bug" per se, but it's very counter-intuitive.

[Bug] KML Export failure [sf#19]

*Reported by anonymous on 2009-02-24 15:15 UTC
I get an error in the KML file when I try to export for Google Earth view. At line 572 in the file I get this:
<b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in <b>/var/www/openflights/php/greatcircle.php</b> on line <b>91</b><br />

I'm filtering to only show 2009 flights (only 14 flights) for my account (sbm12). When I switch to a view that has only 3 flights it works OK, so the overall functionality works, but can it be fixed to handle additional flights in a single export?

[Bug] Flights rendered by reported distance, not actual distance [sf#42]

Reported by jpatokal on 2009-12-08 22:45 UTC
The flight rendering engine currently uses the user's reported distance, not the actual great circle distance, when drawing flights. This can result in visibly too long/too short flight lines.

Fix is to simply calculate the GC distance before drawing.

[Bug] php/settings.php MySQL query broken [sf#25]

Reported by hscholz on 2009-07-09 15:39 UTC
Creating a user fails for various reasons; one of them is the fact that the MySQL INSERT statement contains 7 names in the field list but only 6 values.
The field list is populated properly, though.

trivial patch attached.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.