Make the app independent from the server timezone

When getting local time in SQLite, the local time is generated taking
into account the timezone set in the server, not in PHP. Therefore,
this made it compulsory to set the "Europe/Madrid" timezone for the
whole server.

This change fixes this by generating local timestamps directly in PHP
instead than in SQLite, therefore allowing the server timezone to be
set freely without this app malfunctioning.

Change-Id: I5345772d9b7a2521c98143a90e4154eaa4cd35f6
4 files changed
tree: 63714424b6d07381c46f317580c1761db29bba77
  1. ajax/
  2. cron/
  3. css/
  4. img/
  5. inc/
  6. js/
  7. proto/
  8. vendor/
  9. views/
  10. .gitignore
  11. api_deprecated.php
  12. composer.json
  13. composer.lock
  14. config.default.php
  15. core.php
  16. index.php
  17. info.php
  18. LICENSE
  19. offline.html
  20. README.md
  21. sqldeprecated.txt
  22. sw.js
  23. test.php
README.md

schedules

Schedule viewer for the Barcelona subway.

Installation

  1. Clone this repository (usually in Apache's publicly accessible folder).
  2. Install PHP 7.2+ with the ZipArchive and PDO classes (specifically install the PDO_SQLITE driver)
  3. Copy the config.default.php file to config.php and fill in the details (you can get an API key directly from TMB here.
  • In $conf["databaseFile"] enter the absolute path of the location where you want to save your database (including the file name). If the website is located in the /var/www/html/schedules/ folder, you can create a new files folder there and set the variable to /var/www/html/schedules/files/gtfs.sqlite3.

Notes

  • As I've been able to see when using this app around Barcelona, the schedules provided by TMB are a very vague approximation of the departure times for all lines except for the automated lines. In the case of the automated lines, the timing is precise within a second.