diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 9d8682d..5f45981 --- a/README.md +++ b/README.md @@ -1,57 +1,64 @@ # Italian petrol pumps comparator ![Italian petrol pumps comparator](http://fuel.reyboz.it/images/fuel-64px.png) This web app allows you to list in a map and sort all fuel suppliers who are in a particular area, also it provides the current prices on every suppliers. We have engineered this solution in a Hackathon that was sponsored by *Facile.it*, an Italian price comparator. This submission **won the competition**. ## Use Use the http://fuel.reyboz.it online mirror. It has data updated on a daily basis. ## More about Heroes and original technologies in the [/about.php](http://fuel.reyboz.it/about.php) page of the online mirror. ## Hacking -Go in your `www` folder and clone the source code using Bazaar: +Go in your `www` folder and clone the source code using GNU Bazaar: bzr branch lp:it-fuel-stations-comparator ## Installation Have GNU/Linux, PHP and MySQL/MariaDB working. This project is built over the [Boz-PHP - Another PHP framework](https://github.com/valerio-bozzolan/boz-php-another-php-framework). Install it in your `/usr/share`: bzr branch lp:boz-php-another-php-framework /usr/share/boz-php-another-php-framework Import in MySQL/MariaDB the `database-schema.sql` from the `installation` folder. Also in the `installation` folder copy the `load-sample.php` in the root folder as `load.php` and fill with your MySQL/MariaDB credentials. ## Import data from MISE Please download data from the Italian [Ministero dello Sviluppo Economico](http://www.sviluppoeconomico.gov.it/index.php/it/open-data/elenco-dataset/2032336-carburanti-prezzi-praticati-e-anagrafica-degli-impianti): * http://www.sviluppoeconomico.gov.it/images/exportCSV/prezzo_alle_8.csv * http://www.sviluppoeconomico.gov.it/images/exportCSV/anagrafica_impianti_attivi.csv They are released under the terms of the Italian [Open Data License v2.0](http://www.dati.gov.it/iodl/2.0/). ### Manually import MISE .csv The `cli/import-mise.php` helps you: php ./cli/import-mise.php anagrafica_impianti_attivi.csv prezzo_alle_8.csv ### Automatically download and import MISE .csv Put a similar line in your cronjob: /var/www/cli/download-import-mise.sh "php /var/www/cli/import-mise.php" .. or: su www-data -s /bin/sh -c '/var/www/cli/download-import-mise.sh "php /var/www/cli/import-mise.php"' ## Pull requests Push in Launchpad: https://code.launchpad.net/it-fuel-stations-comparator +## Translations +Translations are easily made using GNU Gettext. See the `l10n/` folder structure. Use something as Poedit to edit existing `.po` files or to create a new one from the `.pot`. + +Remember to run the `cli/localize.sh` script before editing a `.po` file. Also run it *twice* when you finished. + +The site language switcher is in the `load-post.php`. That part sucks but it works. + ## License This is a **Free** as in **Freedom** project. It comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under the terms of the **GNU Affero General Public License v3+**. diff --git a/cli/download-import-mise.sh b/cli/download-import-mise.sh index 68e1eba..0c79623 100755 --- a/cli/download-import-mise.sh +++ b/cli/download-import-mise.sh @@ -1,53 +1,54 @@ #!/bin/sh ############################################################################# # # Copyright (C) 2015 Valerio Bozzolan # ############################################################################# # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ############################################################################# # This script downloads two files from the MISE and import them path="$1" if [ -z "$path" ]; then echo "Usage: $0 IMPORTER" echo "Example: $0 \"php /var/www/cli/import-mise.php\"" echo "The IMPORTER will receive two args: the petrol stations and the prices, as downloaded from the MISE" exit 1; fi # You are wrong.. I'm not curl! wgets() { curl "http://www.sviluppoeconomico.gov.it/images/exportCSV/$1" -o "$2" \ -H 'Host: www.sviluppoeconomico.gov.it' \ -H 'User-Agent: Mozilla/5.0 (X11; Debian; Linux x86_64; rv:39.0) Gecko/20100101 Iceweasel/39.0' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \ -H 'Accept-Language: en-US,it-IT;q=0.8,it;q=0.5,en;q=0.3' \ - --compressed -H 'Connection: keep-alive' + --compressed -H 'Connection: keep-alive' \ + --silent } stations="$(mktemp)" prices="$(mktemp)" wgets "anagrafica_impianti_attivi.csv" "$stations" wgets "prezzo_alle_8.csv" "$prices" # This will be something as: # php .cli/import-mise.php /tmp/tmp.asduioasd /tmp/tmp.oisuodiasu $1 "$stations" "$prices" rm "$stations" "$prices" diff --git a/cli/import-mise-functions.php b/cli/import-mise-functions.php index 4bdf467..d86a99d 100755 --- a/cli/import-mise-functions.php +++ b/cli/import-mise-functions.php @@ -1,224 +1,234 @@ . */ function indexed_array($rows, $property_index, $property_return) { $indexed = []; foreach($rows as $row) { $indexed[ $row->{$property_index} ] = $row->{$property_return}; } return $indexed; } function get_station_ID($station_miseID, $station_name = null, $station_type = null, $station_address = null, $station_lat = null, $station_lon = null, $comune_ID = null, $stationowner_ID = null, $fuelprovider_ID = null) { global $db, $stations; if( isset( $stations[ $station_miseID ] ) ) { return $stations[ $station_miseID ]; } if( $station_name === null ) { throw new Exception( _("La stazione miseID %d doveva essere già stata inserita"), $station_miseID ); } if($station_type === 'Altro') { $station_type = 'ALTRO'; } elseif($station_type === 'Strada Statale') { $station_type = 'STRADA_STATALE'; } elseif($station_type === 'Autostradale') { $station_type = 'AUTOSTRADALE'; } else { throw new Exception( sprintf( "Tipo di stazione non prevista: %s", esc_html( $station_type ) ) ); } $db->insertRow('station', [ new DBCol('station_miseID', $station_miseID, 'd'), new DBCol('station_name', $station_name, 's'), new DBCol('station_type', $station_type, 's'), new DBCol('station_address', $station_address, 's'), new DBCol('station_lat', $station_lat, 'f'), new DBCol('station_lon', $station_lon, 'f'), new DBCol('comune_ID', $comune_ID, 'd'), new DBCol('stationowner_ID', $stationowner_ID, 'd'), new DBCol('fuelprovider_ID', $fuelprovider_ID, 'd') ] ); $station = $db->getRow( sprintf( "SELECT station_ID, station_miseID " . "FROM {$db->getTable('station')} " . "WHERE station_ID = %d", $db->getLastInsertedID() ), 'Station' ); return $stations[ $station->station_miseID ] = $station->station_ID; } function get_comune_ID($comune_uid, $comune_name, $provincia_name) { global $db, $comuni; if( isset( $comuni[ $comune_uid ] ) ) { return $comuni[ $comune_uid ]; } $db->insertRow('comune', [ new DBCol('comune_uid', $comune_uid, 's'), new DBCol('comune_name', $comune_name, 's') ] ); $comune = $db->getRow( sprintf( "SELECT comune_ID, comune_uid " . "FROM {$db->getTable('comune')} " . "WHERE comune_ID = %d", $db->getLastInsertedID() ), 'Comune' ); $db->insertRow('rel_provincia_comune', [ new DBCol( 'provincia_ID', get_provincia_ID( generate_slug($provincia_name), $provincia_name ), 'd' ), new DBCol('comune_ID', $comune->comune_ID, 'd') ] ); return $comuni[ $comune->comune_uid ] = $comune->comune_ID; } function get_fuelprovider_ID($fuelprovider_uid, $fuelprovider_name) { global $db, $fuelproviders; if( isset( $fuelproviders[ $fuelprovider_uid ] ) ) { return $fuelproviders[ $fuelprovider_uid ]; } $db->insertRow('fuelprovider', [ new DBCol('fuelprovider_uid', $fuelprovider_uid, 's'), new DBCol('fuelprovider_name', $fuelprovider_name, 's') ] ); $fuelprovider = $db->getRow( sprintf( "SELECT fuelprovider_ID, fuelprovider_uid " . "FROM {$db->getTable('fuelprovider')} " . "WHERE fuelprovider_ID = %d", $db->getLastInsertedID() ), 'Fuelprovider' ); return $fuelproviders[ $fuelprovider->fuelprovider_uid ] = $fuelprovider->fuelprovider_ID; } function get_stationowner_ID($stationowner_uid, $stationowner_name) { global $db, $stationowners; if( isset( $stationowners[ $stationowner_uid ] ) ) { return $stationowners[ $stationowner_uid ]; } // Lol if( ($pos = strpos($stationowner_name, ' IL REGISTRO IMPRESE NON GARANTISCE') ) !== false ) { $stationowner_name = substr($stationowner_name, 0, $pos); $stationowner_uid = generate_slug( $stationowner_name ); $stationowner_note = substr($stationowner_name, $pos); } else { $stationowner_note = null; } // Another check if( isset( $stationowners[ $stationowner_uid ] ) ) { return $stationowners[ $stationowner_uid ]; } $db->insertRow('stationowner', [ new DBCol('stationowner_uid', $stationowner_uid, 's'), new DBCol('stationowner_name', $stationowner_name, 's'), new DBCol('stationowner_note', $stationowner_note, 'snull') ] ); $stationowner = $db->getRow( sprintf( "SELECT stationowner_ID, stationowner_uid " . "FROM {$db->getTable('stationowner')} " . "WHERE stationowner_ID = %d", $db->getLastInsertedID() ), 'Stationowner' ); return $stationowners[ $stationowner->stationowner_uid ] = $stationowner->stationowner_ID;; } function get_fuel_ID($fuel_uid, $fuel_name) { global $db, $fuels; if( isset( $fuels[ $fuel_uid ] ) ) { return $fuels[ $fuel_uid ]; } $db->insertRow('fuel', [ new DBCol('fuel_uid', $fuel_uid, 's'), new DBCol('fuel_name', $fuel_name, 's') ] ); $fuel = $db->getRow( sprintf( "SELECT fuel_ID, fuel_uid " . "FROM {$db->getTable('fuel')} " . "WHERE fuel_ID = %d", $db->getLastInsertedID() ), 'Fuel' ); return $fuels[ $fuel->fuel_uid ] = $fuel->fuel_ID; } function get_provincia_ID($provincia_uid, $provincia_name) { global $db, $provincie; if( isset( $provincie[ $provincia_uid ] ) ) { return $provincie[ $provincia_uid ]; } $db->insertRow('provincia', [ new DBCol('provincia_uid', $provincia_uid, 's'), new DBCol('provincia_name', $provincia_name, 's') ] ); $provincia = $db->getRow( sprintf( "SELECT provincia_ID, provincia_uid " . "FROM {$db->getTable('provincia')} " . "WHERE provincia_ID = %d", $db->getLastInsertedID() ), 'Provincia' ); return $provincie[ $provincia->provincia_uid ] = $provincia->provincia_ID; } + +/** + * 11/12/2015 20:30 => 2015-12-11 20:30:00 + * + * @return string MySQL/MariaDB datetime + */ +function itdate2datetime($time) { + $dateTime = DateTime::createFromFormat('d/m/Y H:i:s', $time); + return $dateTime->format('Y-m-d H:i:s'); +} diff --git a/cli/import-mise.php b/cli/import-mise.php index 0a692c5..b81cc6f 100755 --- a/cli/import-mise.php +++ b/cli/import-mise.php @@ -1,145 +1,146 @@ . */ /* * Manually download data from Ministero dello Sviluppo Economico * http://www.sviluppoeconomico.gov.it/index.php/it/open-data/elenco-dataset/2032336-carburanti-prezzi-praticati-e-anagrafica-degli-impianti * * Files: * http://www.sviluppoeconomico.gov.it/images/exportCSV/prezzo_alle_8.csv * http://www.sviluppoeconomico.gov.it/images/exportCSV/anagrafica_impianti_attivi.csv * * The files are licensed under the terms of the Italian Open Data License v2.0 * http://www.dati.gov.it/iodl/2.0/ */ require __DIR__ . '/../load.php'; require __DIR__ . '/import-mise-functions.php'; //$db->query("TRUNCATE {$db->getTable('rel_provincia_comune')}"); //$db->query("TRUNCATE {$db->getTable('provincia')}"); //$db->query("TRUNCATE {$db->getTable('comune')}"); //$db->query("TRUNCATE {$db->getTable('station')}"); //$db->query("TRUNCATE {$db->getTable('stationowner')}"); //$db->query("TRUNCATE {$db->getTable('fuelprovider')}"); //$db->query("TRUNCATE {$db->getTable('fuel')}"); $db->query("TRUNCATE {$db->getTable('price')}"); $comuni = $db->getResults("SELECT comune_ID, comune_uid FROM {$db->getTable('comune')}", 'Comune'); $comuni = indexed_array($comuni, 'comune_uid', 'comune_ID'); $provincie = $db->getResults("SELECT provincia_ID, provincia_uid FROM {$db->getTable('provincia')}", 'Provincia'); $provincie = indexed_array($provincie, 'provincia_uid', 'provincia_ID'); $fuels = $db->getResults("SELECT fuel_ID, fuel_uid FROM {$db->getTable('fuel')}", 'Fuel'); $fuels = indexed_array($fuels, 'fuel_uid', 'fuel_ID'); $stations = $db->getResults("SELECT station_ID, station_miseID FROM {$db->getTable('station')}", 'Station'); $stations = indexed_array($stations, 'station_miseID', 'station_ID'); $stationowners = $db->getResults("SELECT stationowner_ID, stationowner_uid FROM {$db->getTable('stationowner')}", 'Stationowner'); $stationowners = indexed_array($stationowners, 'stationowner_uid', 'stationowner_ID'); $fuelproviders = $db->getResults("SELECT fuelprovider_ID, fuelprovider_uid FROM {$db->getTable('fuelprovider')}", 'Fuelprovider'); $fuelproviders = indexed_array($fuelproviders, 'fuelprovider_uid', 'fuelprovider_ID'); try { if( ! isset( $argv[1], $argv[2] ) ) { throw new Exception( sprintf( _("Utilizzo: %s FILE_STAZIONI.csv PREZZI_ALLE_8.csv"), esc_html( $argv[0] ) ), 1 ); } define('FILENAME_STATIONS', $argv[1]); define('FILENAME_PRICES', $argv[2]); if( ! file_exists(FILENAME_STATIONS) ) { throw new Exception( _("File delle stazioni non trovato"), 2 ); } if( ! $handle = fopen(FILENAME_STATIONS, 'r') ) { throw new Exception( _("Impossibile aprire il file delle stazioni"), 3 ); } // Waste first 2 lines fgetcsv($handle); fgetcsv($handle); while( $data = fgetcsv($handle, 512, ';') ) { get_station_ID( (int) $data[0] /*$station_miseID*/, $data[4] /*$station_name*/, $data[3] /*$station_type*/, $data[5] /*$station_address*/, (float) $data[8] /*$station_lat*/, (float) $data[9] /*$station_lon*/, get_comune_ID( generate_slug( $data[6] ) /*$comune_uid*/, $data[6] /*$comune_name*/, $data[7] /*$provincia_name*/ ), get_stationowner_ID( generate_slug( $data[1] ) /*$stationowner_uid*/, $data[1] /*$stationowner_name*/ ), get_fuelprovider_ID( generate_slug( $data[2] ) /*$fuelprovider_uid*/, $data[2] /*$fuelprovider_name*/ ) ); } fclose($handle); // Prices if( ! file_exists(FILENAME_PRICES) ) { throw new Exception( _("File dei prezzi non trovato"), 4 ); } if( ! $handle = fopen(FILENAME_PRICES, 'r') ) { throw new Exception( _("Impossibile aprire il file dei prezzi"), 5 ); } // Waste first 2 lines fgetcsv($handle); fgetcsv($handle); while( $data = fgetcsv($handle, 255, ';') ) { $db->insertRow('price', [ - new DBCol('price_value', (float) $data[2], 'f'), - new DBCol('price_self', (int) $data[3], 'd'), - new DBCol('price_date', $data[4], 's'), + new DBCol('price_value', (float) $data[2], 'f'), + new DBCol('price_self', (int) $data[3], 'd'), + new DBCol('price_date', itdate2datetime($data[4]), 's'), new DBCol( 'fuel_ID', get_fuel_ID( generate_slug($data[1]) /*$fuel_uid*/, $data[1] /*$fuel_name*/ ), 'd' ), new DBCol('station_ID', get_station_ID( (int) $data[0] ), 'd') ] ); } fclose($handle); } catch(Exception $e) { printf( - _("Errore:\n\t%s.\n"), + _("Errore: %s."), $e->getMessage() ); + echo "\n"; exit( $e->getCode() ); } diff --git a/includes/functions.php b/includes/functions.php index fc7e843..5a8b31e 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -1,60 +1,80 @@ . */ /** * It do what it's written. * @param float $latitude1 * @param float $longitude1 * @param float $latitude2 * @param float $longitude2 * @return float Meters */ function get_distance_between_coordinates($latitude1, $longitude1, $latitude2, $longitude2) { $theta = $longitude1 - $longitude2; $distance = sin(deg2rad($latitude1)) * sin(deg2rad($latitude2)) + ( cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta)) ); $distance = acos($distance); $distance = rad2deg($distance) * 60 * 1.1515; $distance = $distance * 1609.344; // To meters return $distance; } function get_in_touch($url, $who) { return HTML::a($url, mdi_icon('perm_contact_calendar') . _("Entra in contatto"), sprintf( _("Mettiti in contatto con %s"), $who ), 'waves-effect waves-teal btn'); } function legal_notes($url, $license, $project) { return HTML::a($url, $license, sprintf( _("Informazioni legali su %s"), $project ) ); } +/** + * Material Design Icon + */ function mdi_icon($uid, $class = 'left') { return "$uid"; } /** * Run GNU Gettext */ function gettext_rocks($lang = 'it_IT', $domain = 'fuel.reyboz.it', $folder = 'l10n', $encoding = 'UTF-8') { putenv("LANG=$lang.$encoding"); setlocale(LC_MESSAGES, "$lang.$encoding"); bindtextdomain($domain, $folder); textdomain($domain); bind_textdomain_codeset($domain, $encoding); } + +function last_price_date($format = 'd/m/Y H:i') { + global $db; + + static $lastdate = null; + + if($lastdate === null) { + $lastdate = $db->getValue( + "SELECT MAX(price_date) as lastdate FROM {$db->getTable('price')}", + 'lastdate' + ); + } + + $d = DateTime::createFromFormat('Y-m-d H:i:s', $lastdate); + + return $d->format($format); +} diff --git a/includes/leaflet-src.js b/includes/leaflet-src.js old mode 100755 new mode 100644 diff --git a/includes/facile.js b/includes/scripts.js similarity index 100% rename from includes/facile.js rename to includes/scripts.js diff --git a/includes/facile.css b/includes/style.css similarity index 96% rename from includes/facile.css rename to includes/style.css index d8b5dbc..0e748ac 100644 --- a/includes/facile.css +++ b/includes/style.css @@ -1,59 +1,58 @@ /* * Italian petrol pumps comparator - Project born (and winner) at hackaton Facile.it 2015 * Copyright (C) 2015 Valerio Bozzolan, Marcelino Franchini, Fabio Mottan, Alexander Bustamente, Cesare de Cal, Edoardo de Cal * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ html, body { height:100%; } #map { position:absolute; top:0; left:0; width:100%; height:100%; } #overworld { position:absolute; top:0; left:50px; z-index:100; margin-right:10px; } -.leaflet-popup-content { - font-family: "Roboto"; - font-size:15px; -} -.prices td { - padding:4px !important; - white-space: nowrap; +#overworld .last-update { + font-size:0.8em; } #overworld .card-panel { padding: 2px 20px; } #overworld h1 { font-size:3.2rem; } #overworld-buttons { position:absolute; top:5px; left:50px; z-index:100; } -b.station-counter { - position:relative; - width:50px; +.leaflet-popup-content { + font-family: "Roboto"; + font-size:15px; +} +.prices td { + padding:4px !important; + white-space: nowrap; } diff --git a/index.php b/index.php index 7eef7ab..0591553 100755 --- a/index.php +++ b/index.php @@ -1,92 +1,101 @@ . */ -// The map +/* + * The map + */ require 'load.php'; enqueue_css('leaflet'); enqueue_css('my-fuel-map'); enqueue_js('jquery.ui'); enqueue_js('leaflet'); enqueue_js('leaflet.bouncemarker'); enqueue_js('my-fuel-map'); get_header('map'); + +$last_price_rfc3339 = last_price_date(DateTime::RFC3339); +$last_price_text = last_price_date(); ?>

getValue( "SELECT COUNT(*) as count FROM {$db->getTable('station')}", 'count' ), HTML::property('class', 'station-counter') ) ) ?>

+

$last_price_text" + ) ?>

navigation - + " />
, 2015. # msgid "" msgstr "" "Project-Id-Version: it.reyboz.fuel\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-12-21 12:37+0100\n" -"PO-Revision-Date: 2015-11-18 07:22+0100\n" -"Last-Translator: \n" +"POT-Creation-Date: 2015-12-28 23:02+0100\n" +"PO-Revision-Date: 2015-12-28 23:00+0100\n" +"Last-Translator: Valerio Bozzolan \n" "Language-Team: \n" "Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.6\n" +"X-Generator: Poedit 1.5.4\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: about.php:26 msgid "Il Team «Il Cloud non esiste»" msgstr "“Cloud storage doesn’t exist” team" #: about.php:27 msgid "" "«Il Cloud non esiste» è il team che in 24 ore ha realizzato il progetto " "vincitore dell'Hackaton di Facile.it 2015 presentando un comparatore di " "prezzi dei carburanti." msgstr "" "“Cloud storage doesn’t exist” is the team that in 24 hours has developed the " "winning project of the Facile.it 2015 Hackathon, presenting a fuel price " "comparator." #: about.php:32 about.php:41 #, php-format msgid "Articolo su %s" msgstr "Article on %s" #: about.php:33 about.php:42 #, php-format msgid "Leggi l'articolo su %s" msgstr "Read the article on %s" #: about.php:58 msgid "Offensive Security Entusiast" msgstr "Offensive Security Entusiast" #: about.php:74 msgid "Junior Hackathon hacker" msgstr "Junior Hackathon hacker" #: about.php:75 about.php:92 msgid "Smartphone & web developer." msgstr "Smartphone & web developer." #: about.php:91 msgid "Very Junior Hackathon hacker" msgstr "Very Junior Hackathon hacker" #: about.php:108 msgid "Developer - DBA & Marketing Specialist" msgstr "Developer - DBA & Marketing Specialist" #: about.php:109 msgid "" "Sviluppo dell'importatore-bridge in PHP, MySQL fra i dati dello Sviluppo " "Economico. Presentatore del progetto." msgstr "" "Developed the PHP bridge, MySQL using the data supplied by Economic " "Development. Presenter of the project" #: about.php:125 msgid "Tactical Banana" msgstr "Tactical Banana" #: about.php:126 msgid "«Valerio per favore scrivi qui qualcosa di divertente». -Fatto-" msgstr "«Valerio please write down something funny». -Done-" #: about.php:142 msgid "No-sleep Tech Orchestrator" msgstr "No-sleep Tech Orchestrator" #: about.php:143 msgid "Sviluppo del frontend in PHP, MySQL e JavaScript." msgstr "Developed front-end in PHP, MySQL and JavaScript" #: about.php:153 msgid "Tecnologie utilizzate" msgstr "Technologies" #: about.php:157 msgid "Nome tecnologia" msgstr "Technology name" #: about.php:158 msgid "Ruolo" msgstr "Team role" #: about.php:159 msgid "Licenza di software libero" msgstr "Free software license" #: about.php:165 msgid "Server web" msgstr "Server web" #: about.php:170 msgid "Framework casereccio in PHP" msgstr "Homemade framework in PHP" #: about.php:175 msgid "Ambiente server GNU/Linux" msgstr "GNU/Linux server environment" #: about.php:180 msgid "" "Libreria JavaScript per l'attraversamento, manipolazione e animazioni del DOM" msgstr "JavaScript library for manipulating and animating DOM" #: about.php:185 msgid "Libreria JavaScript per mappe interattive" msgstr "JavaScript framework for interactive maps" #: about.php:190 msgid "Framework responsivo ispirato al Material Design" msgstr "Responsive framework inspired by Material Design" #: about.php:195 msgid "Set di icone Material Design" msgstr "Material Design icon set" #: about.php:205 msgid "" "Prezzi praticati e anagrafica degli impianti di carburante dal Ministero " "dello Sviluppo Economico italiano." msgstr "" +"Price table and station list from the Italian Ministry of Economic " +"Development." #: about.php:206 msgid "Carburanti - Prezzi praticati e anagrafica degli impianti" msgstr "Fuels - prices and details info about fuel stations" #: about.php:210 msgid "Mappa collaborativa globale" msgstr "Collaborative global map" #: about.php:215 msgid "Logo e favicon" msgstr "Logo and favicon" #: about.php:216 msgid "Pubblico dominio" msgstr "Public domain" #: about.php:220 msgid "Pre-processore di ipertesti" msgstr "Pre-processor of hypertexts" #: about.php:221 msgid "Licenza PHP" msgstr "PHP licence" #: about.php:225 msgid "" "Software di presentazione HTML utilizzato per presentare il progetto " "all'hackaton" msgstr "" "Software for HTML presentations, used to present the project at the hackathon" #: about.php:226 msgid "Licenza Reveal.JS" msgstr "Reveal.JS license" #: about.php:232 msgid "Torna alla mappa" msgstr "Back to the map" #: about.php:232 #, php-format msgid "Torna a %s" msgstr "Back to %s" -#: index.php:48 +#: index.php:53 #, php-format msgid "Confronta velocemente i prezzi fra %s stazioni di rifornimento." msgstr "Quickly compare fuel prices between %s stations." -#: index.php:72 +#: index.php:64 +#, php-format +msgid "Ultimo aggiornamento: %s." +msgstr "Last update: %s." + +#: index.php:70 +msgid "Cerca un indirizzo" +msgstr "Search an address" + +#: index.php:81 msgid "Risultati ricerca" -msgstr "" +msgstr "Search results" -#: index.php:78 +#: index.php:87 msgid "La tua segnalazione è preziosa. Per ora però sara ignorata <_<" msgstr "Your report is important to us. " -#: index.php:79 +#: index.php:88 msgid "Aggiunta ai preferiti... Se funzionassero <_<" msgstr "Added to favorites. " -#: index.php:80 -msgid "Geolocalizzazione fallita" -msgstr "I couldn’t locate yourself" +#: index.php:89 +msgid "Posizione non disponibile." +msgstr "Position not avaiable." -#: index.php:81 +#: index.php:90 msgid "Trova la tua zona, zomma!" msgstr "Find your area, zoom in!" -#: index.php:82 +#: index.php:91 msgid "Vedo molte stazioni. Fai zoom per scoprirle" msgstr "I see many stations in this area. Zoom in" -#: index.php:83 +#: index.php:92 msgid "Nessuna pompa di benzina in questa zona" msgstr "No fuel station found in this area." -#: index.php:84 +#: index.php:93 msgid "Fai zoom! Qui ci sono {n} stazioni" msgstr "Zoom in! There are {n} stations" -#: index.php:85 +#: index.php:94 msgid "Litri ogni {euro} € per {station}" msgstr "{euro}/liters per {station}" -#: index.php:86 +#: index.php:95 msgid "Preferiti" msgstr "Favorites" -#: index.php:87 +#: index.php:96 msgid "Segnala errore" msgstr "Report error" -#: index.php:88 +#: index.php:97 msgid "Nessun indirizzo trovato. Riprova con parole più semplici." msgstr "No address found. Try with simpler words." -#: load-post.php:55 +#: load-post.php:54 msgid "Compara carburanti" msgstr "Compare fuel prices" -#: load-post.php:56 +#: load-post.php:55 msgid "Confronta i prezzi dei carburanti" msgstr "Compare fuels prices" -#: load-post.php:112 -msgid "La mappa" -msgstr "The map" +#: load-post.php:111 +msgid "Mappa" +msgstr "Map" -#: load-post.php:117 +#: load-post.php:116 msgid "Informazioni sulla piattaforma" msgstr "Platform information" -#: cli/import-functions.php:76 +#: cli/import-mise-functions.php:36 #, php-format msgid "La stazione miseID %d doveva essere già stata inserita" -msgstr "" +msgstr "The station miseID %d should be inserted yet" -#: cli/import.php:73 +#: cli/import-mise.php:61 #, php-format msgid "Utilizzo: %s FILE_STAZIONI.csv PREZZI_ALLE_8.csv" -msgstr "" +msgstr "Usage: %s FILE_STATIONS.csv PRICES_AT_8.csv" -#: cli/import.php:84 +#: cli/import-mise.php:72 msgid "File delle stazioni non trovato" -msgstr "" +msgstr "Station file not found" -#: cli/import.php:88 +#: cli/import-mise.php:76 msgid "Impossibile aprire il file delle stazioni" -msgstr "" +msgstr "Unable to open the station file" -#: cli/import.php:121 +#: cli/import-mise.php:109 msgid "File dei prezzi non trovato" -msgstr "" +msgstr "Prices file not found" -#: cli/import.php:125 +#: cli/import-mise.php:113 msgid "Impossibile aprire il file dei prezzi" -msgstr "" +msgstr "Unable to open the prices file" -#: cli/import.php:153 +#: cli/import-mise.php:141 #, php-format -msgid "" -"Errore:\n" -"\t%s.\n" -msgstr "" +msgid "Errore: %s." +msgstr "Error: %s." #: includes/functions.php:40 msgid "Entra in contatto" msgstr "Get in touch" #: includes/functions.php:40 #, php-format msgid "Mettiti in contatto con %s" msgstr "Get in touch with %s" #: includes/functions.php:44 #, php-format msgid "Informazioni legali su %s" msgstr "Legal information on %s" + +#~ msgid "Geolocalizzazione fallita" +#~ msgstr "I couldn’t locate yourself" diff --git a/l10n/fuel.reyboz.it.pot b/l10n/fuel.reyboz.it.pot index d35ce30..e446916 100644 --- a/l10n/fuel.reyboz.it.pot +++ b/l10n/fuel.reyboz.it.pot @@ -1,291 +1,298 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Valerio Bozzolan # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: fuel.reyboz.it\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-12-21 12:37+0100\n" +"POT-Creation-Date: 2015-12-28 23:02+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: about.php:26 msgid "Il Team «Il Cloud non esiste»" msgstr "" #: about.php:27 msgid "" "«Il Cloud non esiste» è il team che in 24 ore ha realizzato il progetto " "vincitore dell'Hackaton di Facile.it 2015 presentando un comparatore di " "prezzi dei carburanti." msgstr "" #: about.php:32 about.php:41 #, php-format msgid "Articolo su %s" msgstr "" #: about.php:33 about.php:42 #, php-format msgid "Leggi l'articolo su %s" msgstr "" #: about.php:58 msgid "Offensive Security Entusiast" msgstr "" #: about.php:74 msgid "Junior Hackathon hacker" msgstr "" #: about.php:75 about.php:92 msgid "Smartphone & web developer." msgstr "" #: about.php:91 msgid "Very Junior Hackathon hacker" msgstr "" #: about.php:108 msgid "Developer - DBA & Marketing Specialist" msgstr "" #: about.php:109 msgid "" "Sviluppo dell'importatore-bridge in PHP, MySQL fra i dati dello Sviluppo " "Economico. Presentatore del progetto." msgstr "" #: about.php:125 msgid "Tactical Banana" msgstr "" #: about.php:126 msgid "«Valerio per favore scrivi qui qualcosa di divertente». -Fatto-" msgstr "" #: about.php:142 msgid "No-sleep Tech Orchestrator" msgstr "" #: about.php:143 msgid "Sviluppo del frontend in PHP, MySQL e JavaScript." msgstr "" #: about.php:153 msgid "Tecnologie utilizzate" msgstr "" #: about.php:157 msgid "Nome tecnologia" msgstr "" #: about.php:158 msgid "Ruolo" msgstr "" #: about.php:159 msgid "Licenza di software libero" msgstr "" #: about.php:165 msgid "Server web" msgstr "" #: about.php:170 msgid "Framework casereccio in PHP" msgstr "" #: about.php:175 msgid "Ambiente server GNU/Linux" msgstr "" #: about.php:180 msgid "" "Libreria JavaScript per l'attraversamento, manipolazione e animazioni del DOM" msgstr "" #: about.php:185 msgid "Libreria JavaScript per mappe interattive" msgstr "" #: about.php:190 msgid "Framework responsivo ispirato al Material Design" msgstr "" #: about.php:195 msgid "Set di icone Material Design" msgstr "" #: about.php:205 msgid "" "Prezzi praticati e anagrafica degli impianti di carburante dal Ministero " "dello Sviluppo Economico italiano." msgstr "" #: about.php:206 msgid "Carburanti - Prezzi praticati e anagrafica degli impianti" msgstr "" #: about.php:210 msgid "Mappa collaborativa globale" msgstr "" #: about.php:215 msgid "Logo e favicon" msgstr "" #: about.php:216 msgid "Pubblico dominio" msgstr "" #: about.php:220 msgid "Pre-processore di ipertesti" msgstr "" #: about.php:221 msgid "Licenza PHP" msgstr "" #: about.php:225 msgid "" "Software di presentazione HTML utilizzato per presentare il progetto " "all'hackaton" msgstr "" #: about.php:226 msgid "Licenza Reveal.JS" msgstr "" #: about.php:232 msgid "Torna alla mappa" msgstr "" #: about.php:232 #, php-format msgid "Torna a %s" msgstr "" -#: index.php:48 +#: index.php:53 #, php-format msgid "Confronta velocemente i prezzi fra %s stazioni di rifornimento." msgstr "" -#: index.php:72 +#: index.php:64 +#, php-format +msgid "Ultimo aggiornamento: %s." +msgstr "" + +#: index.php:70 +msgid "Cerca un indirizzo" +msgstr "" + +#: index.php:81 msgid "Risultati ricerca" msgstr "" -#: index.php:78 +#: index.php:87 msgid "La tua segnalazione è preziosa. Per ora però sara ignorata <_<" msgstr "" -#: index.php:79 +#: index.php:88 msgid "Aggiunta ai preferiti... Se funzionassero <_<" msgstr "" -#: index.php:80 -msgid "Geolocalizzazione fallita" +#: index.php:89 +msgid "Posizione non disponibile." msgstr "" -#: index.php:81 +#: index.php:90 msgid "Trova la tua zona, zomma!" msgstr "" -#: index.php:82 +#: index.php:91 msgid "Vedo molte stazioni. Fai zoom per scoprirle" msgstr "" -#: index.php:83 +#: index.php:92 msgid "Nessuna pompa di benzina in questa zona" msgstr "" -#: index.php:84 +#: index.php:93 msgid "Fai zoom! Qui ci sono {n} stazioni" msgstr "" -#: index.php:85 +#: index.php:94 msgid "Litri ogni {euro} € per {station}" msgstr "" -#: index.php:86 +#: index.php:95 msgid "Preferiti" msgstr "" -#: index.php:87 +#: index.php:96 msgid "Segnala errore" msgstr "" -#: index.php:88 +#: index.php:97 msgid "Nessun indirizzo trovato. Riprova con parole più semplici." msgstr "" -#: load-post.php:55 +#: load-post.php:54 msgid "Compara carburanti" msgstr "" -#: load-post.php:56 +#: load-post.php:55 msgid "Confronta i prezzi dei carburanti" msgstr "" -#: load-post.php:112 -msgid "La mappa" +#: load-post.php:111 +msgid "Mappa" msgstr "" -#: load-post.php:117 +#: load-post.php:116 msgid "Informazioni sulla piattaforma" msgstr "" -#: cli/import-functions.php:76 +#: cli/import-mise-functions.php:36 #, php-format msgid "La stazione miseID %d doveva essere già stata inserita" msgstr "" -#: cli/import.php:73 +#: cli/import-mise.php:61 #, php-format msgid "Utilizzo: %s FILE_STAZIONI.csv PREZZI_ALLE_8.csv" msgstr "" -#: cli/import.php:84 +#: cli/import-mise.php:72 msgid "File delle stazioni non trovato" msgstr "" -#: cli/import.php:88 +#: cli/import-mise.php:76 msgid "Impossibile aprire il file delle stazioni" msgstr "" -#: cli/import.php:121 +#: cli/import-mise.php:109 msgid "File dei prezzi non trovato" msgstr "" -#: cli/import.php:125 +#: cli/import-mise.php:113 msgid "Impossibile aprire il file dei prezzi" msgstr "" -#: cli/import.php:153 +#: cli/import-mise.php:141 #, php-format -msgid "" -"Errore:\n" -"\t%s.\n" +msgid "Errore: %s." msgstr "" #: includes/functions.php:40 msgid "Entra in contatto" msgstr "" #: includes/functions.php:40 #, php-format msgid "Mettiti in contatto con %s" msgstr "" #: includes/functions.php:44 #, php-format msgid "Informazioni legali su %s" msgstr "" diff --git a/load-post.php b/load-post.php index f2c8ea4..57fa2a1 100755 --- a/load-post.php +++ b/load-post.php @@ -1,119 +1,118 @@ . */ // Customizing Boz PHP - Another PHP framework define('INCLUDES', 'includes'); define('IMAGES', 'images'); define('MATERIALIZE', INCLUDES . _ . 'materialize'); define('JQUERY', INCLUDES . _ . 'jquery'); define('LEAFLET', INCLUDES . _ . 'leaflet'); // Load functions require ABSPATH . _ . INCLUDES . '/functions.php'; require ABSPATH . _ . INCLUDES . '/classes.php'; require ABSPATH . _ . INCLUDES . '/header.php'; require ABSPATH . _ . INCLUDES . '/footer.php'; // Choose language -if( isset( $_GET['l'] ) ) { - $lang = $_GET['l']; - switch( $lang ) { - case 'en_US': - case 'it_IT': - gettext_rocks($lang); - break; - default: - // Choose from browser settings - switch( substr(@$_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) ) { - case 'it': - gettext_rocks('it_IT'); - break; - case 'en': - default: - gettext_rocks('en_US'); - } - } +switch( $lang = @$_GET['l'] ) { + case 'en_US': + case 'it_IT': + gettext_rocks($lang); + break; + default: + // Choose from browser settings + switch( substr(@$_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) ) { + case 'it': + gettext_rocks('it_IT'); + break; + case 'en': + gettext_rocks('en_US'); + break; + default: + gettext_rocks('en_US'); + } } define('SITE_NAME', _("Compara carburanti") ); define('SITE_DESCRIPTION', _("Confronta i prezzi dei carburanti") ); register_js( 'jquery', URL . _ . JQUERY . '/jquery-2.1.4.min.js' ); register_js( 'jquery.ui', URL . _ . INCLUDES . '/jquery-ui/jquery-ui.min.js' ); register_js( 'materialize', URL . _ . MATERIALIZE . '/js/materialize.min.js' ); register_js( 'leaflet', URL . _ . LEAFLET . '/leaflet.js' ); register_js( 'leaflet.bouncemarker', URL . _ . INCLUDES . '/leaflet.bouncemarker/bouncemarker.js' ); register_js( 'my-fuel-map', - URL . _ . INCLUDES . '/facile.js' + URL . _ . INCLUDES . '/scripts.js' ); register_css( 'materialize', URL . _ . MATERIALIZE . '/css/materialize.min.css' ); register_css( 'leaflet', URL . _ . LEAFLET . '/leaflet.css' ); register_css( 'my-fuel-map', - URL . _ . INCLUDES . '/facile.css' + URL . _ . INCLUDES . '/style.css' ); register_css( 'materialize.icons', 'https://fonts.googleapis.com/icon?family=Material+Icons' ); add_menu_entries([ new MenuEntry( 'map', URL, - _("La mappa") + _("Mappa") ), new MenuEntry( 'about', URL . '/about.php', _("Informazioni sulla piattaforma") ) ]);