phpweather-checkins Mailing List for PHP Weather (Page 7)
Brought to you by:
iridium
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(7) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(1) |
Feb
(1) |
Mar
(184) |
Apr
(31) |
May
(45) |
Jun
(15) |
Jul
(11) |
Aug
(40) |
Sep
(19) |
Oct
(8) |
Nov
(6) |
Dec
(17) |
| 2003 |
Jan
(5) |
Feb
|
Mar
(12) |
Apr
(5) |
May
(2) |
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
(17) |
Oct
(10) |
Nov
|
Dec
(4) |
| 2004 |
Jan
(21) |
Feb
(11) |
Mar
|
Apr
|
May
(3) |
Jun
(7) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2005 |
Jan
(4) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Martin G. <gim...@us...> - 2002-09-22 09:43:41
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv29661 Modified Files: defaults-dist.php Log Message: Ups - wrong filename. Index: defaults-dist.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/defaults-dist.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- defaults-dist.php 20 Sep 2002 20:44:02 -0000 1.13 +++ defaults-dist.php 22 Sep 2002 09:43:37 -0000 1.14 @@ -4,8 +4,8 @@ /* This file holds the original defaults used by PHP Weather. If you * want to change something, you should follow these procedures: * - * Use the script configurator.php. If you don't want to use that for - * some reason, then it's also simple to edit this file manually: + * Use the script config/make_config.. If you don't want to use that + * for some reason, then it's also simple to edit this file manually: * * 1) save this file as 'defaults.php' * 2) change the options you want |
|
From: Martin G. <gim...@us...> - 2002-09-20 20:44:07
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv27584
Modified Files:
data_retrieval.php defaults-dist.php
Log Message:
This should fix bug 611597 by giving the user the option between using
fsockopen() and file() to retrieve the METAR.
Index: data_retrieval.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/data_retrieval.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- data_retrieval.php 18 Sep 2002 13:24:34 -0000 1.26
+++ data_retrieval.php 20 Sep 2002 20:44:02 -0000 1.27
@@ -127,6 +127,63 @@
$this->decoded_metar = $this->decode_metar();
}
}
+
+
+ function get_metar_socket($icao) {
+ $host = 'weather.noaa.gov';
+ $location = "/pub/data/observations/metar/stations/$icao.TXT";
+ $request = "HTTP/1.1\r\n" .
+ "If-Modified-Since: Sat, 29 Oct 1994 09:00:00 GMT\r\n" .
+ "Pragma: no-cache\r\n".
+ "Cache-Contol: no-cache\r\n";
+
+ if ($this->properties['use_proxy']) {
+ /* We use a proxy */
+ $fp = fsockopen($this->properties['proxy_host'],
+ $this->properties['proxy_port']);
+ $request = "GET http://$host$location $request" .
+ "Host: $host\r\n" .
+ "Content-Type: text/html\r\n" .
+ "Connection: Close\r\n\r\n";
+ } else {
+ $fp = fsockopen($host, 80);
+ $request = "GET $location $request" .
+ "Host: $host\r\n" .
+ "Content-Type: text/html\r\n" .
+ "Connection: Close\r\n\r\n";
+ }
+
+ $metar_data = false;
+
+ if ($fp) {
+ fputs($fp, $request);
+ /* We check the status line */
+ if (strpos(fgets($fp, 1024), '200 ')) {
+ /* Then we seek until we find the empty line between the
+ * headers and the contents.
+ */
+ do {
+ $line = fgets($fp, 1024);
+ } while ($line != "\r\n");
+
+ /* We know now, that the following lines are the contents. */
+ while ($line = fgets($fp, 1024)) {
+ $metar_data[] = $line;
+ }
+ fclose($fp);
+ }
+ }
+
+ return $metar_data;
+ }
+
+
+ function get_metar_file($icao) {
+ $host = 'weather.noaa.gov';
+ $location = "/pub/data/observations/metar/stations/$icao.TXT";
+ return @file('http://' . $host . $location);
+ }
+
/**
* Tries to get a METAR from the database.
@@ -202,57 +259,18 @@
*/
function get_metar_from_web($new_station) {
$metar = '';
- $icao = $this->get_icao();
- $host = 'weather.noaa.gov';
- $location = "/pub/data/observations/metar/stations/$icao.TXT";
- $request = "HTTP/1.1\r\n" .
- "If-Modified-Since: Sat, 29 Oct 1994 09:00:00 GMT\r\n" .
- "Pragma: no-cache\r\n".
- "Cache-Contol: no-cache\r\n";
- if ($this->properties['use_proxy']) {
- /* We use a proxy */
- $fp = fsockopen($this->properties['proxy_host'],
- $this->properties['proxy_port']);
- $request = "GET http://$host$location " . $request .
- "Host: $host\r\n" .
- "Content-Type: text/html\r\n" .
- "Connection: Close\r\n\r\n";
- } else {
- // allow_url_fopen is often off.
- // se we can use this method or curl or shell_exec wget
- $fp = fsockopen('weather.noaa.gov', 80);
- $request = "GET $location " . $request .
- "Host: $host\r\n" .
- "Content-Type: text/html\r\n" .
- "Connection: Close\r\n\r\n";
- }
- if ($fp) {
- fputs($fp, $request);
- /* We check the status line */
- if (strpos(fgets($fp, 1024), '200 ')) {
- /* Then we seek until we find the empty line between the
- * headers and the contents.
- */
- do {
- $line = fgets($fp, 1024);
- } while ($line != "\r\n");
+ $icao = $this->get_icao();
+ $func = $this->properties['fetch_function'];
+ $metar_data = $this->$func($icao);
- /* We know now, that the following lines are the contents. */
- $file = array();
- while ($line = fgets($fp, 1024)) {
- $file[] = $line;
- }
- fclose($fp);
- }
- }
/* Here we test to see if we actually got a METAR. */
- if (isset($file) and is_array($file)) {
+ if (!empty($metar_data)) {
/* The first line in the file is the date */
- $date = trim(array_shift($file));
+ $date = trim(array_shift($metar_data));
/* The remaining lines are the METAR itself. This will merge the
* remaining lines into one line by removing new-lines:
*/
- $metar = ereg_replace("[\n\r ]+", ' ', trim(implode(' ', $file)));
+ $metar = ereg_replace("[\n\r ]+", ' ', trim(implode(' ', $metar_data)));
$date = explode(':', strtr($date, '/ ', '::'));
if ($date[2] > gmdate('j')) {
@@ -261,7 +279,8 @@
*/
$date[1]--;
}
- $timestamp = gmmktime($date[3], $date[4], 0, $date[1], $date[2], $date[0]);
+ $timestamp = gmmktime($date[3], $date[4], 0,
+ $date[1], $date[2], $date[0]);
if (!ereg('[0-9]{6}Z', $metar)) {
/* Some reports don't even have a time-part, so we insert the
Index: defaults-dist.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/defaults-dist.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- defaults-dist.php 12 Apr 2002 22:00:27 -0000 1.12
+++ defaults-dist.php 20 Sep 2002 20:44:02 -0000 1.13
@@ -24,6 +24,7 @@
$this->properties['use_proxy'] = false;
$this->properties['proxy_host'] = '';
$this->properties['proxy_port'] = 3128;
+$this->properties['fetch_function'] = 'get_metar_socket';
$this->properties['db_hostname'] = ''; /* pw_db_common.php */
$this->properties['db_database'] = '';
|
|
From: Martin G. <gim...@us...> - 2002-09-18 13:24:37
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv4552
Modified Files:
AUTHORS data_retrieval.php
Log Message:
This is a better place to give credit to Paul Kairis. I've also added
Kari Salovaara and Tage Malmen for doing Swedish and Finnish
translation.
Index: AUTHORS
===================================================================
RCS file: /cvsroot/phpweather/phpweather/AUTHORS,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- AUTHORS 30 Aug 2002 12:58:46 -0000 1.6
+++ AUTHORS 18 Sep 2002 13:24:33 -0000 1.7
@@ -83,3 +83,9 @@
Reini Urban <ru...@xa...>
Fixed some problems with using PHP Weather on a default installation
of PHP 4.2.
+
+Kari Salovaara <kar...@pp...> and Tage Malmen
+ Translated PHP Weater into Swedish and Finnish.
+
+Paul Kairis <Pau...@sa...>
+ Wrote the code that handles connections through a proxy server.
Index: data_retrieval.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/data_retrieval.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- data_retrieval.php 28 Aug 2002 10:10:00 -0000 1.25
+++ data_retrieval.php 18 Sep 2002 13:24:34 -0000 1.26
@@ -211,7 +211,6 @@
"Cache-Contol: no-cache\r\n";
if ($this->properties['use_proxy']) {
/* We use a proxy */
- /* Inspirated by code from Paul Kairis <Pau...@sa...> */
$fp = fsockopen($this->properties['proxy_host'],
$this->properties['proxy_port']);
$request = "GET http://$host$location " . $request .
|
|
From: Martin G. <gim...@us...> - 2002-09-11 20:25:01
|
Update of /cvsroot/phpweather/phpweather-1.x
In directory usw-pr-cvs1:/tmp/cvs-serv29237
Modified Files:
phpweather.inc
Log Message:
This array must have been renamed somewhere along the way... Thanks
goes to CTomas <ct...@cl...> for finding this bug.
Index: phpweather.inc
===================================================================
RCS file: /cvsroot/phpweather/phpweather-1.x/phpweather.inc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- phpweather.inc 3 Sep 2002 12:23:20 -0000 1.13
+++ phpweather.inc 11 Sep 2002 20:24:56 -0000 1.14
@@ -877,7 +877,7 @@
$decoded_metar['cloud_layer'. $cloud_layers.'_condition'] =
$cloud_condition_array[$regs[1]];
$decoded_metar['cloud_layer'.$cloud_layers.'_coverage'] =
- $cloud_coverage_array[$regs[1]];
+ $cloud_coverage[$regs[1]];
} elseif (ereg('^(VV|FEW|SCT|BKN|OVC)([0-9]{3})(CB|TCU)?$',
$part, $regs)) {
/* We have found (another) a cloud-layer-group. There can be up
|
|
From: Martin G. <gim...@us...> - 2002-09-10 10:06:28
|
Update of /cvsroot/phpweather/phpweather/output In directory usw-pr-cvs1:/tmp/cvs-serv9003 Modified Files: pw_text_fi.php pw_text_sv.php Log Message: Added $Id$ tags. Index: pw_text_fi.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/output/pw_text_fi.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- pw_text_fi.php 10 Sep 2002 10:00:58 -0000 1.1 +++ pw_text_fi.php 10 Sep 2002 10:06:23 -0000 1.2 @@ -8,7 +8,7 @@ * * @author Kari Salovaara <kar...@pp...> * @link http://www.ecosyd.net/ My homepage. - * @version pw_text_fi.php,v 1.8 2002/09/09 12:00:00 gimpster Exp + * @version $Id$ */ class pw_text_fi extends pw_text { Index: pw_text_sv.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/output/pw_text_sv.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- pw_text_sv.php 10 Sep 2002 10:00:58 -0000 1.1 +++ pw_text_sv.php 10 Sep 2002 10:06:24 -0000 1.2 @@ -8,7 +8,7 @@ * * @author Kari Salovaara och Tage Malmen <kar...@pp...> * @link http://www.ecosyd.net/ My homepage. - * @version pw_text_sv.php,v 1.8 2002/09/09 12:00:00 gimpster Exp + * @version $Id$ */ class pw_text_sv extends pw_text { |
|
From: Martin G. <gim...@us...> - 2002-09-10 10:01:02
|
Update of /cvsroot/phpweather/phpweather/output In directory usw-pr-cvs1:/tmp/cvs-serv7084 Added Files: pw_text_fi.php pw_text_sv.php Log Message: Kari Salovaara <kar...@pp...> and Tage Malmen has made these two translations of PHP Weather into Finnish and Swedish. --- NEW FILE --- <?php require_once(PHPWEATHER_BASE_DIR . '/output/pw_text.php'); /** * Provides all the strings needed by pw_text to produce Finnish * output. * * @author Kari Salovaara <kar...@pp...> * @link http://www.ecosyd.net/ My homepage. * @version pw_text_fi.php,v 1.8 2002/09/09 12:00:00 gimpster Exp */ class pw_text_fi extends pw_text { /** * This constructor provides all the strings used. * * @param array This is just passed on to pw_text(). */ function pw_text_fi($weather, $input = array()) { $this->strings['charset'] = 'ISO-8859-1'; $this->strings['no_data'] = 'Sorry! Ei tietoja saatavilla %s%s%s sääasemalle.'; $this->strings['list_sentences_and'] = ' ja '; $this->strings['list_sentences_comma'] = ', '; $this->strings['list_sentences_final_and'] = ', ja '; $this->strings['location'] = 'Tämä on raportti %s%s%s sääasemalta.'; $this->strings['minutes'] = ' minuttteja'; $this->strings['time_format'] = 'Tämä raportti tehtiin %s sitten, kello %s%s%s UTC.'; $this->strings['time_minutes'] = 'ja %s%s%s minuuttia'; $this->strings['time_one_hour'] = '%s1%s tunti %s'; $this->strings['time_several_hours'] = '%s%s%s tuntia %s'; $this->strings['time_a_moment'] = 'a moment'; $this->strings['meters_per_second'] = ' metriä/sekunnissa'; $this->strings['miles_per_hour'] = ' mailia/tunnissa'; $this->strings['meter'] = ' metriä'; $this->strings['meters'] = ' metriä'; $this->strings['feet'] = ' jalkaa'; $this->strings['kilometers'] = ' kilometriä'; $this->strings['miles'] = ' mailia'; $this->strings['and'] = ' ja '; $this->strings['plus'] = ' enemmän '; $this->strings['with'] = ' with '; $this->strings['wind_blowing'] = 'Tuulen voimakkuus '; $this->strings['wind_with_gusts'] = ' puskittain aina '; $this->strings['wind_from'] = ' alkaen '; $this->strings['wind_variable'] = ' muuttuen %svariable%s suuntien välillä.'; $this->strings['wind_varying'] = ', vaihdellen %s%s%s (%s%s°%s) ja %s%s%s (%s%s°%s) välillä'; $this->strings['wind_calm'] = 'Tuuli oli %scalm%s'; $this->strings['wind_dir'] = array( 'pohjoinen', 'pohjoinen/koillinen', 'koillinen', 'itä/koillinen', 'itä', 'itä/kaakko', 'kaakko', 'etelä/kaakko', 'etelä', 'etelä/lounas', 'lounas', 'länsi/lounas', 'länsi', 'länsi/luode', 'luode', 'pohjoinen/luode', 'pohjoinen'); $this->strings['wind_dir_short'] = array( 'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N'); $this->strings['wind_dir_short_long'] = array( 'N' => 'pohjoinen', 'NE' => 'koillinen', 'E' => 'itä', 'SE' => 'kaakko', 'S' => 'etelä', 'SW' => 'lounas', 'W' => 'länsi', 'NW' => 'luode' ); $this->strings['temperature'] = 'Lämpötila oli '; $this->strings['dew_point'] = ', kastepisteen ollessa '; $this->strings['altimeter'] = 'Ilmanpaine oli '; $this->strings['hPa'] = ' hPa'; $this->strings['inHg'] = ' inHg'; $this->strings['rel_humidity'] = 'Suhteellinen kosteus oli '; $this->strings['feelslike'] = 'Jolloin lämpötila tuntuu kuin '; $this->strings['cloud_group_beg'] = 'Havainnointihetkellä '; $this->strings['cloud_group_end'] = '.'; $this->strings['cloud_clear'] = 'Taivas oli %sselkeä%s.'; $this->strings['cloud_height'] = ' pilvikorkeuden ollessa '; $this->strings['cloud_overcast'] = 'Taivas oli pilviverhossa %sovercast%s alkaen korkeudesta '; $this->strings['cloud_vertical_visibility'] = ' %s pystysuuntainen näkyvyys oli %s '; $this->strings['cloud_condition'] = array( 'SKC' => 'selkeä', 'CLR' => 'selkeä', 'FEW' => 'muutamia pilviä, ', 'SCT' => 'hajanaisia pilviä, ', 'BKN' => 'rikkonainen pilvikerros, ', 'OVC' => 'täysin pilvinen, '); $this->strings['cumulonimbus'] = ' cumulonimbus'; $this->strings['towering_cumulus'] = ' towering cumulus'; $this->strings['cavok'] = ' ei ollut pilviä alle %s eikä cumulonimbus pilviä'; $this->strings['currently'] = 'Parhaillaan '; $this->strings['weather'] = array( '-' => ' kevyttä', ' ' => ' kohtalaista ', '+' => ' rankkaa ', 'VC' => ' läheisyydessä', 'PR' => ' osittain', 'BC' => ' paikoittain', 'MI' => ' matalalla', 'DR' => ' matalalla ajelehtivia', 'BL' => ' tuulee', 'SH' => ' kuurottaista', 'TS' => ' ukkosmyrsky', 'FZ' => ' jäätävää', 'DZ' => ' tihkusade', 'RA' => ' sadetta', 'SN' => ' lunta', 'SG' => ' snow grains', 'IC' => ' jääkiteitä', 'PL' => ' ice pellets', 'GR' => ' jäärakeita', 'GS' => ' heikkoa raetta', 'UP' => ' tuntematon', 'BR' => ' utua', 'FG' => ' sumua', 'FU' => ' savua', 'VA' => ' vulkaanista tuhkaa', 'DU' => ' runsaasti pölyä', 'SA' => ' hiekkaa', 'HZ' => ' auerta', 'PY' => ' tihkusade', 'PO' => ' well-developed dust/sand whirls', 'SQ' => ' ukkospuuskia', 'FC' => ' trombeja/tornado/vesipyörre', 'SS' => ' hiekkamyrsky/pölymyrsky'); $this->strings['visibility'] = 'Näkyvyys oli '; $this->strings['visibility_greater_than'] = 'suurempi kuin '; $this->strings['visibility_less_than'] = 'vähemmän kuin '; $this->strings['visibility_to'] = ' to the '; $this->strings['runway_upward_tendency'] = ' with an %supward%s tendency'; $this->strings['runway_downward_tendency'] = ' with a %sdownward%s tendency'; $this->strings['runway_no_tendency'] = ' with %sno distinct%s tendency'; $this->strings['runway_between'] = 'välillä '; $this->strings['runway_left'] = ' vasen'; $this->strings['runway_central'] = ' keskellä'; $this->strings['runway_right'] = ' oikea'; $this->strings['runway_visibility'] = 'Näkyvyys oli '; $this->strings['runway_for_runway'] = ' kiitotiellä '; /* We run the parent constructor */ $this->pw_text($weather, $input); } } ?> --- NEW FILE --- <?php require_once(PHPWEATHER_BASE_DIR . '/output/pw_text.php'); /** * Provides all the strings needed by pw_text to produce * Swedish output. * * @author Kari Salovaara och Tage Malmen <kar...@pp...> * @link http://www.ecosyd.net/ My homepage. * @version pw_text_sv.php,v 1.8 2002/09/09 12:00:00 gimpster Exp */ class pw_text_sv extends pw_text { /** * This constructor provides all the strings used. * * @param array This is just passed on to pw_text(). */ function pw_text_sv($weather, $input = array()) { $this->strings['charset'] = 'ISO-8859-1'; $this->strings['no_data'] = 'Beklagar! Det finns ingen data tillgänglig för %s%s%s.'; $this->strings['list_sentences_and'] = ' och '; $this->strings['list_sentences_comma'] = ', '; $this->strings['list_sentences_final_and'] = ', och '; $this->strings['location'] = 'Detta är en rapport för %s%s%s.'; $this->strings['minutes'] = ' minuter'; $this->strings['time_format'] = 'Denna rapport gjordes för %s sedan, klockan %s%s%s UTC.'; $this->strings['time_minutes'] = 'och %s%s%s minuter'; $this->strings['time_one_hour'] = '%sen%s timme %s'; $this->strings['time_several_hours'] = '%s%s%s timmar %s'; $this->strings['time_a_moment'] = 'ett ögonblick'; $this->strings['meters_per_second'] = ' meter per sekund'; $this->strings['miles_per_hour'] = ' miles per timme'; $this->strings['meter'] = ' meter'; $this->strings['meters'] = ' meter'; $this->strings['feet'] = ' fot'; $this->strings['kilometers'] = ' kilometer'; $this->strings['miles'] = ' miles'; $this->strings['and'] = ' och '; $this->strings['plus'] = ' plus '; $this->strings['with'] = ' med '; $this->strings['wind_blowing'] = 'Vindens hastighet var '; $this->strings['wind_with_gusts'] = ' i byarna ända upp till '; $this->strings['wind_from'] = ' från '; $this->strings['wind_variable'] = ' från %svariable%s riktningar.'; $this->strings['wind_varying'] = ', varierande emellan %s%s%s (%s%s°%s) och %s%s%s (%s%s°%s)'; $this->strings['wind_calm'] = 'Vinden var %sstille%s'; $this->strings['wind_dir'] = array( 'nord', 'nord/nordost', 'nordost', 'ost/nordost', 'ost', 'ost/sydost', 'sydost', 'syd/sydost', 'syd', 'syd/sydväst', 'sydväst', 'väst/sydväst', 'väst', 'väst/nordväst', 'nordväst', 'nord/nordväst', 'nord'); $this->strings['wind_dir_short'] = array( 'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N'); $this->strings['wind_dir_short_long'] = array( 'N' => 'nord', 'NE' => 'nordost', 'E' => 'ost', 'SE' => 'sydost', 'S' => 'syd', 'SW' => 'sydväst', 'W' => 'väst', 'NW' => 'nordväst' ); $this->strings['temperature'] = 'Temperaturen var '; $this->strings['dew_point'] = ', med en daggpunkt på '; $this->strings['altimeter'] = 'Lufttrycket var '; $this->strings['hPa'] = ' hPa'; $this->strings['inHg'] = ' inHg'; $this->strings['rel_humidity'] = 'Den relativa fuktigheten var '; $this->strings['feelslike'] = 'Temperaturen känns som '; $this->strings['cloud_group_beg'] = 'Det var '; $this->strings['cloud_group_end'] = '.'; $this->strings['cloud_clear'] = 'Himmelen var %sclear%s.'; $this->strings['cloud_height'] = ' moln på en höjd av '; $this->strings['cloud_overcast'] = 'himmelen var %sovercast%s från en höjd av '; $this->strings['cloud_vertical_visibility'] = 'den %svertical visibility%s var '; $this->strings['cloud_condition'] = array( 'SKC' => 'molnfri', 'CLR' => 'molnfri', 'FEW' => 'några', 'SCT' => 'utspridda', 'BKN' => 'brutna', 'OVC' => 'mulen'); $this->strings['cumulonimbus'] = ' cumulusmoln'; $this->strings['towering_cumulus'] = ' tornande cumulusmoln'; $this->strings['cavok'] = ' inga moln under %s och inga cumulusmoln'; $this->strings['currently'] = 'För tillfället '; $this->strings['weather'] = array( '-' => 'lätt ', ' ' => 'moderat ', '+' => 'kraftig ', 'VC' => 'i närheten av', 'PR' => 'delvis ', 'BC' => 'bankvis ', 'MI' => 'lätt ', 'DR' => 'lågt drivande ', 'BL' => 'blåser ', 'SH' => 'skur ', 'TS' => 'åskväderr ', 'FZ' => 'frysande ', 'DZ' => 'duggregn ', 'RA' => 'regn ', 'SN' => 'snö; ', 'SG' => 'snökorn ', 'IC' => 'iskristaller ', 'PL' => 'iskorn ', 'GR' => 'hagel ', 'GS' => 'småhagel ', 'UP' => 'okänt ', 'BR' => 'dis ', 'FG' => 'dimma ', 'FU' => 'rök ', 'VA' => 'vulkanisk aska ', 'DU' => 'mycket damm ', 'SA' => 'sand ', 'HZ' => 'dis ', 'PY' => 'regnskur ', 'PO' => 'välutvecklade damm/sand virvlar ', 'SQ' => 'stormbyar ', 'FC' => 'tromb/tornado ', 'SS' => 'sandstorm/dammstorm '); $this->strings['visibility'] = 'Den generella sikten var '; $this->strings['visibility_greater_than'] = 'över '; $this->strings['visibility_less_than'] = 'under '; $this->strings['runway_upward_tendency'] = ' med en %supward%s tendens'; $this->strings['runway_downward_tendency'] = ' med en %sdownward%s tendens'; $this->strings['runway_no_tendency'] = ' med %sno distinct%s tendens'; $this->strings['runway_between'] = 'mellan '; $this->strings['runway_left'] = ' vänster'; $this->strings['runway_central'] = ' mitt'; $this->strings['runway_right'] = ' höger'; $this->strings['runway_visibility'] = 'Sikten var '; $this->strings['runway_for_runway'] = ' för landningsbanan '; /* We run the parent constructor */ $this->pw_text($weather, $input); } } ?> |
|
From: Ondrej J. <ne...@us...> - 2002-09-05 01:47:25
|
Update of /cvsroot/phpweather/phpweather/output
In directory usw-pr-cvs1:/tmp/cvs-serv24195
Modified Files:
pw_text_sk.php
Log Message:
Some new sentences/words were translated. There are currently only few
untranslated items.
Weather reporting function print_pretty_weather() and clouds reporting
function print_pretty_clouds() were rewritten to handle much more cases
with proper grammar handling.
Index: pw_text_sk.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text_sk.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- pw_text_sk.php 28 Aug 2002 21:13:40 -0000 1.2
+++ pw_text_sk.php 5 Sep 2002 01:47:18 -0000 1.3
@@ -117,7 +117,7 @@
'SCT' => 'rozptýlené',
'BKN' => 'zatiahnuté',
'OVC' => 'zamraèené');
- $this->strings['cumulonimbus'] = ' cumulonimbus';
+ $this->strings['cumulonimbus'] = ' nahromadené búrkové';
$this->strings['towering_cumulus'] = ' týèiace sa nahromadené';
$this->strings['cavok'] = ' ¾iadne oblaky pod %s a ani ¾iadne iné nahromadené oblaky';
$this->strings['currently'] = 'Aktuálnym poèasím bolo ';
@@ -167,15 +167,15 @@
$this->strings['visibility_to'] = ' do ';
/* this is left untranslated, because I have no metar, that use
* this text -- Nepto [14/07/2002] */
- $this->strings['runway_upward_tendency'] = ' with an %supward%s tendency';
- $this->strings['runway_downward_tendency'] = ' with a %sdownward%s tendency';
- $this->strings['runway_no_tendency'] = ' with %sno distinct%s tendency';
- $this->strings['runway_between'] = 'between ';
+ $this->strings['runway_upward_tendency'] = ' so %sstúpajúcou%s tendenciou';
+ $this->strings['runway_downward_tendency'] = ' s %sklesajúcou%s tendenciou';
+ $this->strings['runway_no_tendency'] = ' s %snejednoznaènou%s tendenciou';
+ $this->strings['runway_between'] = 'medzi ';
$this->strings['runway_left'] = ' left';
$this->strings['runway_central'] = ' central';
$this->strings['runway_right'] = ' right';
$this->strings['runway_visibility'] = 'Viditeµnos» bola ';
- $this->strings['runway_for_runway'] = ' for runway ';
+ $this->strings['runway_for_runway'] = ' pre pristávaciu dráhu èíslo ';
/* We run the parent constructor */
$this->pw_text($weather, $input);
@@ -240,13 +240,33 @@
return parent::print_pretty_wind($wind);
}
+ function print_pretty_clouds($clouds) {
+ for ($i = 0; $i < count($clouds); $i++) {
+ if ($i == 0 && $clouds[$i]['condition'] == 'OVC') {
+ if (1) {
+ $this->strings['cloud_group_beg'] .= ' oblaky, ';
+ } else { // another solution, nicer but incomplete (see TODO below)
+ $this->strings['cloud_group_beg'] = '';
+ $this->strings['cloud_overcast'] =
+ ucfirst(ltrim($this->strings['cloud_overcast']));
+ }
+ }
+ if ($i < count($clouds) - 1) {
+ // TODO: Obloha bola zamracena od vysky XX metrov, ... oblaky.
+ }
+ }
+ return parent::print_pretty_clouds($clouds);
+ }
+
function parse_cloud_group($cloud_group)
{
extract($cloud_group);
- if (isset($condition) && $condition == 'CAVOK') {
- $this->strings['cloud_group_beg'] =
- str_replace(' boli ', ' neboli ', $this->strings['cloud_group_beg']);
+ if (isset($condition)) {
+ if ($condition == 'CAVOK') {
+ $this->strings['cloud_group_beg'] =
+ str_replace(' boli ', ' neboli ', $this->strings['cloud_group_beg']);
+ }
}
return parent::parse_cloud_group($cloud_group);
@@ -273,24 +293,54 @@
}
function print_pretty_weather($weather)
- {
- if ($weather[0]['descriptor'] == 'SH') {
- $this->strings['currently'] = str_replace(' bolo ', ' boli ',
- $this->strings['currently']);
- if ($weather[0]['precipitation'] == 'RA') {
- $this->strings['weather']['-'] = ' riedkeho ';
- $this->strings['weather'][' '] = ' stredného ';
- $this->strings['weather']['+'] = ' hustého ';
- $this->strings['weather']['RA'] = ' da¾ïa';
- }
- } elseif ($weather[0]['precipitation'] == 'RA'
- || $weather[0]['obscuration'] == 'HZ') {
- $this->strings['currently'] = str_replace(' bolo ', ' bol ',
- $this->strings['currently']);
- }
+ {
+ $ret_str = '';
+ for ($k = 0; $k < count($weather); $k++) {
- return parent::print_pretty_weather($weather);
- }
+ if ($weather[$k]['descriptor'] == 'SH') { // prehánky ... da¾ïa
+ $k == 0 && $this->strings['currently'] =
+ str_replace(' bolo ', ' boli ', $this->strings['currently']);
+ if ($weather[$k]['precipitation'] == 'RA') {
+ $this->strings['weather']['-'] = ' riedkeho ';
+ $this->strings['weather'][' '] = ' stredného ';
+ $this->strings['weather']['+'] = ' hustého ';
+ $this->strings['weather']['RA'] = ' da¾ïa';
+ }
+ } elseif ($weather[$k]['descriptor'] == 'TS') { // búrka
+ $k == 0 && $this->strings['currently'] =
+ str_replace(' bolo ', ' bola ', $this->strings['currently']);
+ $this->strings['weather']['-'] = ' riedkym ';
+ $this->strings['weather'][' '] = ' stredným ';
+ $this->strings['weather']['+'] = ' hustým ';
+ $this->strings['weather']['RA'] = ' da¾ïom';
+ $this->strings['with'] = ' a ';
+ } elseif ($weather[$k]['precipitation'] == 'DZ') { // mrholenie
+ $this->strings['weather']['-'] = ' riedke ';
+ $this->strings['weather'][' '] = ' stredné ';
+ $this->strings['weather']['+'] = ' husté ';
+ } elseif ($weather[$k]['precipitation'] == 'RA' // dá¾ï
+ || $weather[$k]['obscuration'] == 'HZ'
+ || $weather[$k]['obscuration'] == 'BR' // hmlový opar
+ ) {
+ $k == 0 && $this->strings['currently'] =
+ str_replace(' bolo ', ' bol ', $this->strings['currently']);
+ } elseif ($weather[$k]['obscuration'] == 'FG') { // ... hmlisto
+ $this->strings['weather']['PR'] = ' èiastoèné';
+ $this->strings['weather']['MI'] = ' plytké';
+ }
+
+ // One part of weather parsing
+ $ret_str .= $this->properties['mark_begin']
+ . $this->parse_weather_group($weather[$k])
+ . $this->properties['mark_end'];
+
+ // Deliminators
+ $k <= count($weather) - 3 && $ret_str .= ',';
+ $k == count($weather) - 2 && $ret_str .= ' a ';
+ }
+
+ return $this->strings['currently'].$ret_str.'.';
+ }
}
/*
|
|
From: Martin G. <gim...@us...> - 2002-09-04 21:04:46
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv13133
Modified Files:
pw_utilities.php
Log Message:
This should clear things up a bit.
Index: pw_utilities.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/pw_utilities.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- pw_utilities.php 2 Sep 2002 18:17:51 -0000 1.6
+++ pw_utilities.php 4 Sep 2002 21:04:41 -0000 1.7
@@ -3,57 +3,69 @@
/* Miscellaneous functions that can help you build an interactive site
* with PHP Weather. */
-function get_countries_select($weather, $old_cc) {
- $output = '<select name="cc">';
-
- $countries = $weather->db->get_countries();
- while (list($cc, $country) = each($countries)) {
- if ($cc == $old_cc) {
- $output .= "\n<option value=\"$cc\" selected=\"selected\">$country</option>";
- } else {
- $output .= "\n<option value=\"$cc\">$country</option>";
- }
- }
- $output .= "\n</select>\n";
- return $output;
-}
-
-
-function get_stations_select($weather, $cc, $old_icao) {
+/**
+ * Builds a select box.
+ *
+ * @param string The name assigned to the select tag.
+ * @param array An associative array with data.
+ * @param string The key that will be marked as the selected key,
+ * if any.
+ */
+function build_select($name, $data, $selected_key = '') {
+ $output = '<select name="' . $name . '">';
- $country = '';
- $icaos = $weather->db->get_icaos($cc, $country);
-
- $output = '<select name="icao">';
-
- while (list($icao, $name) = each($icaos)) {
- if ($icao == $old_icao) {
- $output .= "\n<option value=\"$icao\" selected=\"selected\">$name</option>";
+ while (list($k, $v) = each($data)) {
+ if ($k == $selected_key) {
+ $output .= "\n<option value=\"$k\" selected=\"selected\">$v</option>";
} else {
- $output .= "\n<option value=\"$icao\">$name</option>";
+ $output .= "\n<option value=\"$k\">$v</option>";
}
}
$output .= "\n</select>\n";
-
+
return $output;
}
+/**
+ * Returns HTML code which makes a select box with names of countries.
+ *
+ * @param object The phpweather object to query for available
+ * countries.
+ * @param string The country code that should be selected, if any.
+ * @return string The HTML code.
+ */
+function get_countries_select($weather, $old_cc = '') {
+ $countries = $weather->db->get_countries();
+ return build_select('cc', $countries, $old_cc);
+}
-function get_languages_select($old_language) {
- $output = '<select name="language">';
- $languages = get_languages('text');
+/**
+ * Returns HTML code which makes a select box with the names of
+ * stations in a given country.
+ *
+ * @param object The phpweather object to query for available
+ * stations.
+ * @param string The country code of the country.
+ * @param string The ICAO that should be selected, if any.
+ * @return string The HTML code.
+ */
+function get_stations_select($weather, $cc, $old_icao = '') {
+ $country = ''; // Dummy variable.
+ $icaos = $weather->db->get_icaos($cc, $country);
+ return build_select('icao', $icaos, $old_icao);
+}
- while (list($lc, $language) = each($languages)) {
- if ($lc == $old_language) {
- $output .= "\n<option value=\"$lc\" selected=\"selected\">$language</option>";
- } else {
- $output .= "\n<option value=\"$lc\">$language</option>";
- }
- }
- $output .= "\n</select>\n";
- return $output;
+/**
+ * Returns HTML code which makes a select box with available
+ * languages for the 'text' output module.
+ *
+ * @param string The language that should be selected, if any.
+ * @return string The HTML code.
+ */
+function get_languages_select($old_language = '') {
+ return build_select('language', get_languages('text'), $old_language);
}
|
|
From: Martin G. <gim...@us...> - 2002-09-03 12:27:50
|
Update of /cvsroot/phpweather/phpweather-1.x In directory usw-pr-cvs1:/tmp/cvs-serv21287 Modified Files: AUTHORS Log Message: Added Pavlos Kallias <ka...@ci...>. Index: AUTHORS =================================================================== RCS file: /cvsroot/phpweather/phpweather-1.x/AUTHORS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- AUTHORS 11 Jul 2002 16:10:23 -0000 1.4 +++ AUTHORS 3 Sep 2002 12:27:47 -0000 1.5 @@ -109,3 +109,6 @@ Fabio Parri <pa...@ut...> Converted the images so that they can be used on WAP phones and updated the Italias translation. + +Pavlos Kallias <ka...@ci...> + Translated PHP Weather into Greek. |
|
From: Martin G. <gim...@us...> - 2002-09-03 12:25:08
|
Update of /cvsroot/phpweather/phpweather-1.x
In directory usw-pr-cvs1:/tmp/cvs-serv20133
Modified Files:
demo.php
Added Files:
locale_el.inc
Log Message:
Another language joins the club! This time it's Greek thanks to P.
Kallias <ka...@ci...>.
--- NEW FILE ---
<?php
/*
* Áõôü ôï áñ÷åßï åßíáé õðåýèõíï ãéá ôçí ÅëëçíéêÞ ìåôÜöñáóç ôïõ PHP Weather. Ãéá íá ôï ÷ñçóéìïðïéÞóåôå,
* áðëÜ ôïðïèåôÞóåôÝ ôï óôï include óôï êõñßùò phpweather.inc áñ÷åßï.
*
* Author: Martin Geisler <gim...@gi...>
* Translated by P.Kallias <ka...@ci...>
*/
/* Îåöïñôþíåé ôéò ìåôáâëçôÝò ôçò Üëëçò ãëþóóáò êáé öïñôþíåé ôéò íÝåò. */
if (isset($strings)) {
/* The strings array is loaded - assume the same for the rest. */
unset($strings);
unset($wind_dir_text_short_array);
unset($wind_dir_text_array);
unset($weather_array);
unset($cloud_condition_array);
}
/* Load the new strings */
$strings = array(
'no_data' => '<blockquote><p>Óõããíþìç! Äåí õðÜñ÷ïõí <b>äåäïìÝíá</b> äéáèÝóéìá ãéá %s.</p></blockquote>',
'mm_inches' => '<b>%s</b> mm (<b>%s</b> inches)',
'precip_a_trace' => 'Ýíá ß÷íïò',
'precip_there_was' => 'ÐáñáôçñÞèçêå %s õäáôüðôùóçò ',
'sky_str_format1' => 'ÐáñáôçñÞèçêå <b>%s</b> óå ýøïò <b>%s</b> ìÝôñùí (<b>%s</b> ðïäþí)',
'sky_str_clear' => 'Ï ïõñáíüò Þôáí <b>÷ùñßò íÝöùóç</b>',
'sky_str_format2' => ', <b>%s</b> óå ýøïò <b>%s</b> ìÝôñùí (<b>%s</b> ðïäþí) êáé <b>%s</b> óå ýøïò <b>%s</b> ìÝôñùí (<b>%s</b> ðïäþí)',
'sky_str_format3' => ' êáé <b>%s</b> óå ýøïò <b>%s</b> ìÝôñùí (<b>%s</b> ðïäþí)',
'sky_cavok' => 'ÄÝí õðÜñ÷ïõí íÝöç êÜôù áðü ôá <b>1,524</b> ìÝôñá (<b>5,000</b> ðüäéá)',
'clouds' => ' íÝöùóç',
'clouds_cb' => ' íÝöùóç (óùñåéôïìåëáíßåò)',
'clouds_tcu' => ' íÝöùóç (óùñåßôåò ìåãÜëïõ ýøïõò)',
'visibility_format' => 'Ç ïñáôüôçôá Þôáí <b>%s</b> ÷éëéüìåôñá (<b>%s</b> ìßëéá).',
'wind_str_format1' => 'Ýðíåáí ìå ôá÷ýôçôá <b>%s</b> ìÝôñùí ôï äåõôåñüëåðôï (<b>%s</b> ìßëéá ôçí þñá)',
'wind_str_format2' => ', ìå ñéðÝò ôùí <b>%s</b> ìÝôñùí ôï äåõôåñüëåðôï (<b>%s</b> ìßëéá ôçí þñá),',
'wind_str_format3' => ' <b>%s</b>',
'wind_str_calm' => '<b>Ýðíåáí áóèåíåßò</b>',
'wind_vrb_long' => 'áðü ìåôáâëçôÝò äéåõèýíóåéò',
'wind_vrb_short' => 'VAR',
'windchill' => ' ï ðáãåôüò åß÷å èåñìïêñáóßá <b>%s</b> °C (<b>%s</b> °F) ',
'precip_last_hour' => 'ôçí ôåëåõôáßá ìßá þñá. ',
'precip_last_6_hours' => 'ôéò ôåëåõôáßåò 3 Ýùò 6 þñåò. ',
'precip_last_24_hours' => 'ôéò ôåëåõôáßåò 24 þñåò. ',
'precip_snow' => 'ÌåôñÞèçêáí <b>%s</b> mm (<b>%s</b> inches) ÷éïíéïý óôï Ýäáöïò. ',
'temp_min_max_6_hours' => 'Ç ìÝãéóôç êáé ç åëÜ÷éóôç èåñìïêñáóßá ôéò ôåëåõôáßåò 6 þñåò Þôáí <b>%s</b> êáé <b>%s</b> °C (<b>%s</b> êáé <b>%s</b> °F).',
'temp_max_6_hours' => 'Ç ìÝãéóôç èåñìïêñáóßá ôéò ôåëåõôáßåò 6 þñåò Þôáí <b>%s</b> °C (<b>%s</b> °F). ',
'temp_min_6_hours' => 'Ç åëÜ÷éóôç èåñìïêñáóßá ôéò ôåëåõôáßåò 6 þñåò Þôáí <b>%s</b> °C (<b>%s</b> °F). ',
'temp_min_max_24_hours' => 'Ç ìÝãéóôç êáé ç åëÜ÷éóôç èåñìïêñáóßá ôéò ôåëåõôáßåò 24 þñåò Þôáí <b>%s</b> êáé <b>%s</b> °C (<b>%s</b> êáé <b>%s</b> °F). ',
'runway_vis' => 'Ç ïñáôüôçôá ôïõ áåñïäéáäñüìïõ <b>%s</b> åßíáé <b>%s</b> ìÝôñá (<b>%s</b> ðüäéá).',
'runway_vis_min_max' => 'Ç ïñáôüôçôá ôïõ áåñïäéáäñüìïõ <b>%s</b> êõìáßíåôáé ìåôáîý <b>%s</b> ìÝôñùí (<b>%s</b> ðïäþí) êáé <b>%s</b> ìÝôñùí (<b>%s</b> ðïäþí).',
'light' => 'åëáöñÜ ',
'moderate' => 'ìÝôñéá ',
'Heavy' => 'âáñéÜ ',
'nearby' => 'ðõêíÞ ',
'current_weather' => 'Åðéêñáôåß <b>%s</b>. ',
'pretty_print_metar' => '<blockquote><p>Ðñéí áðü <b>%s</b> ëåðôÜ, óôßò <b>%s</b> UTC, ïé Üíåìïé %s óôï áåñïäñüìéï %s. Ç èåñìïêñáóßá Þôáí <b>%s</b> °C (<b>%s</b> °F), %s êáé ç áôìïóöáéñéêÞ ðßåóç <b>%s</b> hPa (<b>%s</b> inHg). Ç ó÷åôéêÞ õãñáóßá Þôáí <b>%s%%</b>. %s %s %s %s %s %s</p></blockquote>'
);
$wind_dir_text_short_array = array(
'Â',
'Â/ÂÁ',
'ÂÁ',
'Á/ÂÁ',
'Á',
'Á/ÍÁ',
'ÍÁ',
'Í/ÍÁ',
'Í',
'Í/ÍÄ',
'ÍÄ',
'Ä/ÍÄ',
'Ä',
'Ä/ÂÄ',
'ÂÄ',
'Â/ÂÄ',
'Â');
$wind_dir_text_array = array(
'âüñåéïé',
'âüñåéïé/âïñåéïáíáôïëéêïß',
'âïñåéïáíáôïëéêïß',
'áíáôïëéêïß/âïñåéïáíáôïëéêïß',
'áíáôïëéêïß',
'áíáôïëéêïß/íïôéïáíáôïëéêïß',
'íïôéïáíáôïëéêïß',
'íüôéïé/íïôéïáíáôïëéêïß',
'íüôéïé',
'íüôéïé/íïôéïäõôéêïß',
'íïôéïäõôéêïß',
'äõôéêïß/íïôéïäõôéêïß',
'äõôéêïß',
'äõôéêïß/âïñåéïäõôéêïß',
'âïñåéïäõôéêïß',
'âüñåéïé/âïñåéïäõôéêïß',
'âüñåéïé');
$weather_array = array(
'MI' => 'áâáèÞò ',
'PR' => 'ìåñéêþò ',
'BC' => 'åìâïëÝò ',
'DR' => '÷áìçëü ñåýìá ',
'BL' => 'ðíïÞ ',
'SH' => 'ìðüñá(åò) ',
'TS' => 'êáôáéãßäá ',
'FZ' => 'ðáãåôüò',
'DZ' => 'ðôþóç øåêÜäùí ',
'RA' => 'âñï÷üðôùóç ',
'SN' => '÷éïíüðôùóç ',
'SG' => 'ðôþóç íõöÜäùí ÷éïíéïý',
'IC' => 'ðôþóç êñõóôÜëëùí ðÜãïõ ',
'PE' => 'ðôþóç óöáéñéäßùí ðÜãïõ ',
'GR' => 'ðôþóç ÷áëáæéïý ',
'GS' => 'ðôþóç ìéêñïý ÷áëáæéïý ìå Þ ÷ùñßò óöáéñßäéá ÷éïíéïý ',
'UP' => 'Üãíùóôïò ',
'BR' => 'õãñÞ á÷ëýò',
'FG' => 'ïìß÷ëç ',
'FU' => 'áéèÜëç ',
'VA' => 'çöáéóôåéáêÞ ôÝöñá ',
'DU' => 'óêüíç óå ìåãÜëç Ýêôáóç ',
'SA' => 'Üììïò ',
'HZ' => 'îçñÞ á÷ëýò ',
'PY' => 'ðôþóç óôáãïíéäßùí',
'PO' => 'êáëþò áíåðôõãìÝíïé óôñüâéëïé óêüíçò/Üììïõ ',
'SQ' => 'ëáßëáðåò-ìðïõñßíéá ',
'FC' => 'íåöïóôñüâéëïò ',
'SS' => 'áììïèýåëëá/èýåëëá óêüíçò ');
$cloud_condition_array = array(
'SKC' => '÷ùñßò íÝöùóç',
'CLR' => '÷ùñßò íÝöùóç',
'VV' => 'êÜèåôïò ïñáôüôçôá',
'FEW' => 'åëÜ÷éóôç',
'SCT' => 'áñáéÞ',
'BKN' => 'óðïñáäéêÞ',
'OVC' => 'ðõêíÞ íÝöùóç');
?>
Index: demo.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather-1.x/demo.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- demo.php 17 Jul 2002 18:07:08 -0000 1.7
+++ demo.php 3 Sep 2002 12:25:05 -0000 1.8
@@ -40,15 +40,9 @@
<h1>Your version: <?php echo $version ?></h1>
-<p>You can download new versions from <a
-href="http://sourceforge.net/projects/phpweather/">this page</a>. I'm
-currently working on the next version of <a
-href="http://www.sourceforge.net/projects/phpweather/">PHP
-Weather</a>. You can try it by downloading a snapshot of CVS, but as I
-don't make these all the time, the best way to follow the development
-is to check it out of CVS. It's all explained on the <a
-href="http://www.sourceforge.net/projects/phpweather/">SourceForge</a>
-page.</p>
+<p>You can download new versions from the <a
+href="http://sourceforge.net/projects/phpweather/">project page</a> at
+SourceForge.</p>
<p>If you are having problems with <a
href="http://sourceforge.net/projects/phpweather/">PHP Weather</a>,
@@ -60,6 +54,12 @@
href="http://lists.sourceforge.net/lists/listinfo/phpweather-devel">this
page</a>.</p>
+<p>You should know, that active development has stopped on the 1.x
+versions of PHP Weather which are still available because the 2.x
+version doesn't run on PHP version 3. If your server is running PHP
+version 4 or later, then you should download the latest version of PHP
+Weather instead of this.</p>
+
<p>To help speed up the development, you should take a look at the
latest code from CVS. Try and see if you can figure out what is
happening in there, and then tell me what you think. Or even better:
@@ -164,6 +164,7 @@
'en' => 'English',
'fr' => 'French',
'de' => 'German',
+ 'el' => 'Greek',
'hu' => 'Hungarian',
'it' => 'Italian',
'no' => 'Norwegian',
|
|
From: Martin G. <gim...@us...> - 2002-09-03 12:23:24
|
Update of /cvsroot/phpweather/phpweather-1.x
In directory usw-pr-cvs1:/tmp/cvs-serv19406
Modified Files:
phpweather.inc config-dist.inc
Log Message:
One can now specify $db_dir to place the databases somewhere else than
the current directory. The '/tmp' default should probably be adapted
for other platforms...
Index: phpweather.inc
===================================================================
RCS file: /cvsroot/phpweather/phpweather-1.x/phpweather.inc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- phpweather.inc 26 Aug 2002 19:44:40 -0000 1.12
+++ phpweather.inc 3 Sep 2002 12:23:20 -0000 1.13
@@ -31,8 +31,8 @@
} elseif ($useDBM) {
/* Open the DBM databases: */
- $dbmMetar = dbmopen ("metar", "c");
- $dbmTimestamp = dbmopen ("metarTimestamp", "c");
+ $dbmMetar = dbmopen ("$db_dir/metar", "c");
+ $dbmTimestamp = dbmopen ("$db_dir/metarTimestamp", "c");
if (!$dbmMetar || !$dbmTimestamp) {
echo "<p>Unable to open DBM files!</p>";
$useDBM = 0; /* turn off so rest of program won't use */
@@ -40,8 +40,8 @@
} elseif ($useDBA) {
/* Open the DBM databases: */
- $dbmMetar = dba_open ("metar", "c", $DBAmethod);
- $dbmTimestamp = dba_open ("metarTimestamp", "c", $DBAmethod);
+ $dbmMetar = dba_open ("$db_dir/metar", "c", $DBAmethod);
+ $dbmTimestamp = dba_open ("$db_dir/metarTimestamp", "c", $DBAmethod);
if (!$dbmMetar || !$dbmTimestamp) {
echo "<p>Unable to open DBA files!</p>";
$useDBA = 0; /* turn off so rest of program won't use */
@@ -66,13 +66,28 @@
} elseif ($useXML) {
/* Read the XML file: */
- $XMLFile = 'cache.xml';
+ $XMLFile = "$db_dir/cache.xml";
- // Check for existence of the file:
- if (!file_exists($XMLFile) ||
- !is_readable($XMLFile) ||
- !is_writable($XMLFile)){
- echo "<p>XML file does not exist or we couldn't open it for read/write!</p>";
+ // Check state of XML file:
+ if (!file_exists($XMLFile)) {
+ /* We try and make the file: */
+ if (is_writable($db_dir)) {
+ $fp = fopen($XMLFile, 'w');
+ if ($fp) {
+ fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<metardata>\n</metardata>\n");
+ fclose($fp);
+ echo "<p>The XML file was succesfully created.</p>\n";
+ } else {
+ echo "<p>Something went wrong with the creation of the XML file!</p>\n";
+ }
+ } else {
+ /* We couldn't write to the directory... */
+ echo "<p>The XML file does not exist and could not be " .
+ "created because <code>$db_dir</code> isn't writable!</p>\n";
+ $useXML = 0; // Turn off so we do not try to use later
+ }
+ } elseif (!is_readable($XMLFile) || !is_writable($XMLFile)){
+ echo "<p>The XML file does exist but we cannot open it for read/write!</p>";
$useXML = 0; // Turn off so we do not try to use later
} else {
$XMLMetar = array ();
Index: config-dist.inc
===================================================================
RCS file: /cvsroot/phpweather/phpweather-1.x/config-dist.inc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- config-dist.inc 26 Aug 2002 19:44:40 -0000 1.2
+++ config-dist.inc 3 Sep 2002 12:23:20 -0000 1.3
@@ -40,6 +40,12 @@
/* the DBA handler to use, if $useDBA is set to 1: */
$DBAmethod = 'db2'; // or ndbm, gdbm, db3 if db2 doesn't work.
+
+/* The directory used by PHP Weather to store file-based databases.
+ * The webserver has to have write permission to the directory for
+ * this to work. */
+$db_dir = '/tmp';
+
/* If you're using a database that requires you to log on, then set
* the following variables. Make sure to protect the 'config.php' file
* so that other people cannot read your password!
|
|
From: Martin G. <gim...@us...> - 2002-09-02 18:17:58
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv26283
Modified Files:
index.php phpweather.php pw_utilities.php
Log Message:
Move phpweather::get_languages() to pw_utilities as this doesn't
really has anything to do with the phpweather class. Updated
make_config.php to use get_languages() for a dynamic list of available
languages.
Index: index.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/index.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- index.php 28 Aug 2002 10:17:08 -0000 1.37
+++ index.php 2 Sep 2002 18:17:47 -0000 1.38
@@ -51,7 +51,7 @@
$icao = stripslashes($HTTP_GET_VARS['icao']);
}
-$languages = $weather->get_languages('text');
+$languages = get_languages('text');
if (empty($HTTP_GET_VARS['language']) ||
!in_array($HTTP_GET_VARS['language'], array_keys($languages))) {
@@ -85,7 +85,7 @@
/* Show stations selection for particular country ($cc). */
$output .= '<form action="index.php" method="get">' . "\n<p>"
. get_stations_select($weather, $cc, $icao)
- . get_languages_select($weather, $language)
+ . get_languages_select($language)
. '<input type="submit" value="Submit location">'
. "</p>\n</form>\n";
}
Index: phpweather.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/phpweather.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- phpweather.php 26 Aug 2002 13:15:23 -0000 1.31
+++ phpweather.php 2 Sep 2002 18:17:47 -0000 1.32
@@ -10,9 +10,6 @@
* @const PHPWEATHER_BASE_DIR The base directory.
*/
define('PHPWEATHER_BASE_DIR', dirname(__FILE__));
-/* Due to a strange bug in PHPDoc, you must quote dirname(__FILE__)
- * before you run PHPDoc! PHPDoc crashes with a segmentation fault on
- * my system if the value is unquoted... */
/**
* Require the parent class.
@@ -59,41 +56,6 @@
}
- /**
- * Returns a list of languages.
- *
- * @return array An associative array with the language codes as the
- * keys and the names of the languages as the values.
- *
- * @param string The type of output module you're interested in, eg.
- * 'text' for the text output module.
- *
- * @access public
- */
- function get_languages($type) {
-
- static $output = array();
-
- if (empty($output)) {
-
- require(PHPWEATHER_BASE_DIR . '/languages.php');
- $this->debug("Finding language for $type");
-
- $dir = opendir(PHPWEATHER_BASE_DIR . '/output');
- while($file = readdir($dir)) {
- if (ereg("^pw_${type}_([a-z][a-z])\.php$", $file, $regs)) {
- $output[$regs[1]] = $languages[$regs[1]];
- }
- }
- closedir($dir);
- }
-
- asort($output);
-
- return $output;
- }
-
-
/**
* Helper-function used to store temperatures.
*
Index: pw_utilities.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/pw_utilities.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- pw_utilities.php 28 Aug 2002 10:10:01 -0000 1.5
+++ pw_utilities.php 2 Sep 2002 18:17:51 -0000 1.6
@@ -39,10 +39,10 @@
}
-function get_languages_select($weather, $old_language) {
+function get_languages_select($old_language) {
$output = '<select name="language">';
- $languages = $weather->get_languages('text');
+ $languages = get_languages('text');
while (list($lc, $language) = each($languages)) {
if ($lc == $old_language) {
@@ -52,6 +52,41 @@
}
}
$output .= "\n</select>\n";
+
+ return $output;
+}
+
+
+/**
+ * Returns a list of available languages.
+ *
+ * @return array An associative array with the language codes as the
+ * keys and the names of the languages as the values.
+ *
+ * @param string The type of output module you're interested in, eg.
+ * 'text' for the text output module.
+ */
+function get_languages($type) {
+
+ static $output = array();
+
+ if (empty($output)) {
+
+ /* I use dirname(__FILE__) here instead of PHPWEATHER_BASE_DIR
+ * because one might use this function without having included
+ * phpweather.php first. */
+ require(dirname(__FILE__) . '/languages.php');
+
+ $dir = opendir(dirname(__FILE__) . '/output');
+ while($file = readdir($dir)) {
+ if (ereg("^pw_${type}_([a-z][a-z])\.php$", $file, $regs)) {
+ $output[$regs[1]] = $languages[$regs[1]];
+ }
+ }
+ closedir($dir);
+ }
+
+ asort($output);
return $output;
}
|
|
From: Martin G. <gim...@us...> - 2002-09-02 18:17:58
|
Update of /cvsroot/phpweather/phpweather/config
In directory usw-pr-cvs1:/tmp/cvs-serv26283/config
Modified Files:
make_config.php
Log Message:
Move phpweather::get_languages() to pw_utilities as this doesn't
really has anything to do with the phpweather class. Updated
make_config.php to use get_languages() for a dynamic list of available
languages.
Index: make_config.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/config/make_config.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- make_config.php 14 Jul 2002 23:02:41 -0000 1.4
+++ make_config.php 2 Sep 2002 18:17:52 -0000 1.5
@@ -2,6 +2,8 @@
error_reporting(E_ALL);
+require_once('../pw_utilities.php');
+
/* Require a couple of validators: */
require_once('pw_validator.php');
require_once('pw_validator_ereg.php');
@@ -103,14 +105,11 @@
$options['language'] =
new pw_option_select('language',
- 'PHP Weather can produce output in several languages ' .
- '- please select your default from the list.',
+ 'PHP Weather can produce textual output using ' .
+ 'in several languages - please select your default ' .
+ 'from the list.',
array(),
- array('en' => 'English',
- 'da' => 'Danish',
- 'hu' => 'Hungarian',
- 'no' => 'Norwegian',
- 'es' => 'Spanish'));
+ get_languages('text'));
$options['offset'] =
new pw_option_integer('offset',
|
|
From: Martin G. <gim...@us...> - 2002-08-30 13:01:52
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv22608 Modified Files: ChangeLog Log Message: Updated for version 2.0.0. Index: ChangeLog =================================================================== RCS file: /cvsroot/phpweather/phpweather/ChangeLog,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- ChangeLog 20 May 2002 15:56:58 -0000 1.7 +++ ChangeLog 30 Aug 2002 13:01:48 -0000 1.8 @@ -1,3 +1,380 @@ +2002-08-30 13:00 Martin Geisler <gim...@gi...> + + * VERSION: + + Version 2.0.0 is coming your way! + +2002-08-30 12:58 Martin Geisler <gim...@gi...> + + * AUTHORS: + + Let's not forget these two guys :-) + +2002-08-28 21:13 Martin Geisler <gim...@gi...> + + * output/: pw_text_da.php, pw_text_en.php, pw_text_es.php, + pw_text_hu.php, pw_text_no.php, pw_text_sk.php: + + Fixing comments and reindenting code. + +2002-08-28 21:12 Martin Geisler <gim...@gi...> + + * output/pw_text.php: + + Until we get some strings for precipitation, we might as well + disable the output to prevent the ugly warnings. + +2002-08-28 10:17 Martin Geisler <gim...@gi...> + + * index.php: + + Fix from Reini Urban <ru...@x-...> to deal with PHP 4.2 where + the default setting for register_globals is off. + +2002-08-28 10:10 Martin Geisler <gim...@gi...> + + * data_retrieval.php, index.php, pw_utilities.php: + + More good stuff from Ondrej Jombik <ne...@po...>... The + index.php page has been rewritten to provide the same functionality + with less and more clear code. + + I've updated data_rettrieval.php to deal with the changed + lookup_icao method in the database backends. + +2002-08-28 10:05 Martin Geisler <gim...@gi...> + + * db/: pw_db_common.php, pw_db_dba.php, pw_db_mysql.php, + pw_db_null.php, pw_db_pgsql.php, files/stations.db: + + Applied patches from Ondrej Jombik <ne...@po...> - I've changed + them a little from what was sent to the mailing list. + + The lookup_icao($icao) method now returns an three element array + with the name of the station, the name of the country, and the + country code. The new functions get_name($icao), + get_country($icao), and get_country_code($icao) are convenience + functions that return what you think they return :-) + + The stations.db file has been regenerated to reflect the changes in + the pw_db_null class. + +2002-08-28 09:53 Martin Geisler <gim...@gi...> + + * db/files/HU.php: + + Regenerated with accents. + +2002-08-27 23:26 Martin Geisler <gim...@gi...> + + * data_retrieval.php: + + Patch from Reini Urban <ru...@x-...>. In PHP 4.2 the default + for allow_url_fopen is off - so we now download the METAR reports + ourselves. + +2002-08-27 17:37 Mihaly Gyulai gyulai.freeyellow.com/ + + * stations.csv: + + + Adding accents to Hungarian station names, according to iso-8859-1 + code. + +2002-08-26 23:09 Martin Geisler <gim...@gi...> + + * output/pw_text.php: + + Same effect, but easier to understand, IMHO. + +2002-08-26 21:48 Max Hammond <ma...@fl...> + + * index.php: + + Changed text for alt tag, thanks to Ondrej Jombik + +2002-08-26 16:56 Martin Geisler <gim...@gi...> + + * README, README-CVS: + + Minor fixes. + +2002-08-26 16:00 Martin Geisler <gim...@gi...> + + * index.php: + + There's no need (in PHP version 4) to supply an empty array to + functions that already default to the empty array. + + Also, use English as the default language. + +2002-08-26 15:56 Martin Geisler <gim...@gi...> + + * make-release.sh: + + Make some scripts quiet. + +2002-08-26 15:55 Martin Geisler <gim...@gi...> + + * test.php: + + More useful test page. + +2002-08-26 14:56 Martin Geisler <gim...@gi...> + + * index.php: + + Links to documentation. + +2002-08-26 13:29 Martin Geisler <gim...@gi...> + + * doc/phpweather.ps: + + Let's not forget this one... + +2002-08-26 13:17 Martin Geisler <gim...@gi...> + + * db/pw_db_dba.php: + + Sort this as well. + +2002-08-26 13:16 Martin Geisler <gim...@gi...> + + * db/pw_db_common.php: + + A little clarity. + +2002-08-26 13:15 Martin Geisler <gim...@gi...> + + * phpweather.php: + + When we read the directory, we get the entries in a somewhat random + order. This gives a better display in the dropdown boxes. + +2002-08-26 13:12 Martin Geisler <gim...@gi...> + + * phpweather.php: + + A little cache to prevent rereading the directory. + +2002-08-26 13:04 Martin Geisler <gim...@gi...> + + * make-release.sh: + + Better release script. + +2002-08-26 12:47 Martin Geisler <gim...@gi...> + + * doc/: phpweather.dvi, phpweather.html, phpweather.info, + phpweather.info-1, phpweather.info-2, phpweather.pdf, + phpweather.txt: + + Output from Texinfo sources. + +2002-08-26 12:46 Martin Geisler <gim...@gi...> + + * doc/src/: phpweather.texi, texinfo.tex: + + Texinfo sources. + +2002-08-12 23:52 Martin Geisler <gim...@gi...> + + * phpweather.php: + + Support for humidex thanks to Robin Senior + <8r...@ql...>. See this page for an explaination of + humidex: + + http://www.theweathernetwork.com/help/glossary/humidex.htm + +2002-08-12 23:00 Martin Geisler <gim...@gi...> + + * output/pw_text_no.php: + + Updates from sven-erik, this closes 562977. + +2002-07-14 23:05 Martin Geisler <gim...@gi...> + + * AUTHORS: + + Added entry for Ondrej Jombik <ne...@po...>. + +2002-07-14 23:03 Martin Geisler <gim...@gi...> + + * config/speed_test.php: + + Don't hide the errors. + +2002-07-14 23:02 Martin Geisler <gim...@gi...> + + * config/make_config.php: + + Hmm, my Mozilla doesn't treat newlines in the value attribute + correctly... strange and annoying. + +2002-07-14 22:57 Martin Geisler <gim...@gi...> + + * db_updater.php: + + Cool - PHP has an elseif keyword :-) + +2002-07-14 22:52 Martin Geisler <gim...@gi...> + + * output/pw_text_sk.php: + + Slovak translation from Ondrej Jombik <ne...@po...> - thanks! + +2002-06-29 11:13 Martin Geisler <gim...@gi...> + + * output/pw_images.php: + + I hope this fixed the problems with $phenomena being undefined. + +2002-06-29 10:51 Martin Geisler <gim...@gi...> + + * phpweather.php: + + Fixed PE -> PL noticed by Ondrej Jombik <ne...@po...> - thanks. + I also noticed that there wasn't a constructor(!) instead there was + a function called metar_parser()... That's also fixed now. + +2002-06-20 11:17 Martin Geisler <gim...@gi...> + + * output/pw_text_es.php: + + Ups - no default value for the $input variable. + +2002-06-04 12:11 Max Hammond <ma...@fl...> + + * currentimage.php: + + New file to return the current sky image as an image directly. See + file for usage notes. + +2002-05-31 14:11 Max Hammond <ma...@fl...> + + * output/pw_text_es.php: + + Fixed for feelslike + +2002-05-29 20:42 Martin Geisler <gim...@gi...> + + * config/: make_config.php, make_db.php, make_stations.php, + pw_option_text.php, pw_optiongroup.php: + + Hmm, the validator is quite picky... + +2002-05-29 20:12 Martin Geisler <gim...@gi...> + + * config/: index.php, make_config.php, make_db.php, + make_stations.php, speed_test.php: + + More cleanups. The new stylesheet is used, and I hope that the + files can be validated as XHTML documents. + +2002-05-29 20:11 Martin Geisler <gim...@gi...> + + * index.php, pw_style.css: + + Cleanups... I've added a stylesheet since we're starting to have a + couple of XHTML pages by now. + +2002-05-29 19:16 Martin Geisler <gim...@gi...> + + * AUTHORS: + + Great! A Spanish translation of PHP Weather. + +2002-05-29 15:32 Max Hammond <ma...@fl...> + + * output/pw_text_es.php: + + Added Spanish translation, thanks to Jesús Peñas + <jp...@ed...> + +2002-05-28 13:40 Martin Geisler <gim...@gi...> + + * config/: index.php, make_stations.php: + + I've made make_stations.php so that we can go from stations.cvs to + a database (using make_db.php) and back again using + make_stations.php. + +2002-05-28 13:28 Martin Geisler <gim...@gi...> + + * db/files/: AF.php, AG.php, AO.php, AQ.php, AR.php, AT.php, + AU.php, BA.php, BD.php, BE.php, BF.php, BG.php, BJ.php, BO.php, + BR.php, BS.php, BW.php, CA.php, CD.php, CF.php, CG.php, CH.php, + CI.php, CK.php, CL.php, CM.php, CN.php, CO.php, CR.php, CU.php, + CY.php, CZ.php, DE.php, DJ.php, DK.php, DM.php, DO.php, DZ.php, + EC.php, EE.php, EG.php, EH.php, ES.php, ET.php, FI.php, FJ.php, + FK.php, FM.php, FR.php, GA.php, GB.php, GE.php, GF.php, GH.php, + GL.php, GN.php, GP.php, GQ.php, GR.php, GS.php, GT.php, GW.php, + GY.php, HK.php, HN.php, HR.php, HT.php, HU.php, ID.php, IE.php, + IL.php, IN.php, IQ.php, IR.php, IS.php, IT.php, JO.php, JP.php, + KE.php, KH.php, KI.php, KM.php, KP.php, KR.php, LA.php, LK.php, + LR.php, LS.php, LV.php, LY.php, MA.php, MD.php, MG.php, ML.php, + MM.php, MR.php, MU.php, MV.php, MW.php, MX.php, MY.php, MZ.php, + NA.php, NC.php, NE.php, NG.php, NL.php, NO.php, NP.php, NZ.php, + OM.php, PA.php, PE.php, PF.php, PG.php, PH.php, PK.php, PL.php, + PM.php, PT.php, PY.php, RE.php, RO.php, RU.php, RW.php, SA.php, + SB.php, SC.php, SD.php, SE.php, SI.php, SK.php, SN.php, SO.php, + SR.php, ST.php, SY.php, TD.php, TG.php, TH.php, TL.php, TN.php, + TO.php, TR.php, TT.php, TV.php, TZ.php, UA.php, UG.php, UM.php, + US.php, UY.php, UZ.php, VE.php, VN.php, VU.php, WS.php, YE.php, + YU.php, ZA.php, ZM.php, ZW.php, stations.db: + + New stations and new countries! + +2002-05-28 13:26 Martin Geisler <gim...@gi...> + + * db/pw_db_null.php: + + Fix the check for readability and remove the code that generated + countries.php because this file now has all the countries in it + anyway. + +2002-05-28 13:24 Martin Geisler <gim...@gi...> + + * db/files/countries.php: + + I've update the file with the names of all countries, not just the + ones used in stations.cvs at the moment. + +2002-05-28 13:11 Martin Geisler <gim...@gi...> + + * stations.csv: + + Tom Corser <to...@to...> sent me a dump of his list of + stations. There was 2201 new ICAOs in his file, so we now know of + 5131 stations in 210 countries! + + Tom has told me that some of the ICAOs seams to have stopped + working, so the above figures are somewhat optimistic. + +2002-05-20 17:41 Martin Geisler <gim...@gi...> + + * INSTALL: + + Removed text about how it 'was easier for us to put documentation + on phpweather.net'. + + Also updated the part about how to configure PHP Weather. + +2002-05-20 16:04 Martin Geisler <gim...@gi...> + + * db/pw_db_pgsql.php: + + I did some tests with speed_test.php and it turned out, that it + didn't make any difference wether or not I cached the number of + rows in the result set. + +2002-05-20 15:56 Martin Geisler <gim...@gi...> + + * ChangeLog: + + Updated. + 2002-05-20 15:53 Martin Geisler <gim...@gi...> * config/index.php: @@ -157,58 +534,6 @@ Updated documentation. -2002-04-13 13:21 Martin Geisler <gim...@gi...> - - * docs/html/metar_parser.html: - - Remove that one too... - -2002-04-13 13:20 Martin Geisler <gim...@gi...> - - * docs/html/: base_object.html, class_base_object.xml, - class_data_retrieval.xml, class_db_layer.xml, class_phpweather.xml, - class_property.xml, class_pw_db_common.xml, class_pw_db_dba.xml, - class_pw_db_mysql.xml, class_pw_db_null.xml, class_pw_db_pgsql.xml, - class_pw_dependency.xml, class_pw_dependency_or.xml, - class_pw_images.xml, class_pw_option.xml, - class_pw_option_boolean.xml, class_pw_option_integer.xml, - class_pw_option_multi_select.xml, class_pw_option_select.xml, - class_pw_option_text.xml, class_pw_optiongroup.xml, - class_pw_text.xml, class_pw_text_da.xml, class_pw_text_en.xml, - class_pw_text_hu.xml, class_pw_text_no.xml, class_pw_validator.xml, - class_pw_validator_ereg.xml, class_pw_validator_range.xml, - classtree_base_object.xml, classtree_property.xml, - classtree_pw_dependency.xml, classtree_pw_option.xml, - classtree_pw_optiongroup.xml, classtree_pw_validator.xml, - data_retrieval.html, db_layer.html, elementlist.xml, - frame_packagelist.html, index.html, - packageelementlist_No_Package_specified.html, - packageelementlist_PHP_Weather.html, - packageelementlist_PHP_Weather_Configurator.html, packagelist.xml, - phpdoc.dtd, phpdoc_classtree.html, phpdoc_elementlist.html, - phpdoc_packagelist.html, phpdoc_warnings.html, - phpdoc_xmlfiles.html, phpweather.html, property.html, - pw_db_common.html, pw_db_dba.html, pw_db_mysql.html, - pw_db_null.html, pw_db_pgsql.html, pw_dependency.html, - pw_dependency_or.html, pw_images.html, pw_option.html, - pw_option_boolean.html, pw_option_integer.html, - pw_option_multi_select.html, pw_option_select.html, - pw_option_text.html, pw_optiongroup.html, pw_text.html, - pw_text_da.html, pw_text_en.html, pw_text_hu.html, pw_text_no.html, - pw_validator.html, pw_validator_ereg.html, pw_validator_range.html, - warnings_classanalyser.xml, warnings_parser.xml: - - Updated documentation. - -2002-04-13 13:19 Martin Geisler <gim...@gi...> - - * docs/html/: db_common.html, db_dba.html, db_mysql.html, - db_null.html, db_pgsql.html, locale_common.html, locale_da.html, - locale_en.html, locale_hu.html: - - These files are no longer used - the corresponding sourcefiles have - been renamed or removed. - 2002-04-13 13:11 Martin Geisler <gim...@gi...> * config/: pw_validator.php, pw_dependency.php, @@ -325,26 +650,6 @@ The classes still lack documentation... -2002-03-29 16:02 Martin Geisler <gim...@gi...> - - * docs/: ps/phpweather-a4.ps, ps/phpweather-letter.ps, - pdf/phpweather-a4.pdf, pdf/phpweather-letter.pdf: - - Updated documentation. - -2002-03-29 15:18 Martin Geisler <gim...@gi...> - - * docs/src/latex/: databases.tex, installation.tex, intro.tex, - main.tex, translation.tex: - - Various updated. - -2002-03-29 15:18 Martin Geisler <gim...@gi...> - - * docs/src/latex/decoded.tex: - - A description of the decoded METAR array. - 2002-03-29 13:51 Martin Geisler <gim...@gi...> * phpweather.php: @@ -954,26 +1259,6 @@ Added set_metar() for testing etc -2002-03-11 16:50 Martin Geisler <gim...@gi...> - - * docs/src/latex/: apidoc.tex, databases.tex, history.tex, - installation.tex, main.tex, phpweather-a4.tex, translation.tex: - - Added some extra files to the documentation. The documentation - needs a lot of work right now, but if anybody wants to write - something, feel free. - - You shouldn't be intimidated by the fact that it's written in - LaTeX, as long as you're writing plain text, there shouldn't be any - problems. - -2002-03-11 16:27 Martin Geisler <gim...@gi...> - - * docs/ps/: phpweather-a4.ps, phpweather-letter.ps: - - This is mostly a test of the new syncmail script. The idea is that - it shouldn't include a diff of these PostScript files. - 2002-03-07 09:42 Martin Geisler <gim...@gi...> * db_layer.php: @@ -1060,52 +1345,12 @@ Minor comment modifications. -2001-07-18 10:39 Martin Geisler <gim...@gi...> - - * docs/src/latex/intro.tex: - - These couple of sections shouldn't be numbered (that's what the - star does - it removed the numbering of a section.) - -2001-07-18 10:38 Martin Geisler <gim...@gi...> - - * docs/src/latex/: installation.tex, translation.tex: - - Just a couple of chapters... - - If anybody wants to write something for the manual, feel free. I'll - probably do some writing myself on my holiday, but that shouldn't - keep anybody from doing so also. Also, feel free to correct my - grammatical mistakes and my spelling. - -2001-07-18 10:34 Martin Geisler <gim...@gi...> - - * docs/src/latex/main.tex: - - Added the two new chapters installation and translation. Also added - a new command \code which typesets it's contents in a code-style. - That means typewriter-font for now. - 2001-07-17 12:27 Martin Geisler <gim...@gi...> * phpweather.php: Nothing to worry about... -2001-07-17 12:25 Martin Geisler <gim...@gi...> - - * docs/src/latex/: apidoc.tex, main.tex: - - We now include the fdl. - -2001-07-17 12:24 Martin Geisler <gim...@gi...> - - * docs/src/latex/fdl.tex: - - This is the license for the manual. Since we're using the GPL for - the program, I thought that we might as well use the GNU Free - Documentation License (FDL) for the manual. - 2001-07-17 12:22 Martin Geisler <gim...@gi...> * configurator.php: @@ -1145,52 +1390,6 @@ group1, group2 etc, they're now stored as group[0], group[1] etc. This makes it easier to pass them around. -2001-07-14 19:47 Martin Geisler <gim...@gi...> - - * docs/: pdf/.cvsignore, ps/.cvsignore: - - Ups! - -2001-07-14 19:46 Martin Geisler <gim...@gi...> - - * docs/: pdf/.cvsignore, ps/.cvsignore: - - Ignore the compressed files for now... - -2001-07-14 19:44 Martin Geisler <gim...@gi...> - - * docs/: html/db_dba.html, html/locale_common.html, - html/locale_hu.html, html/metar_parser.html, - html/phpdoc_elementlist.html, html/phpweather.html, - pdf/phpweather-a4.pdf, pdf/phpweather-letter.pdf, - ps/phpweather-a4.ps, ps/phpweather-letter.ps, src/latex/apidoc.tex, - src/xml/class_db_dba.xml, src/xml/class_locale_common.xml, - src/xml/class_locale_hu.xml, src/xml/class_metar_parser.xml, - src/xml/class_phpweather.xml, src/xml/elementlist.xml, - src/xml/warnings_classanalyser.xml: - - Update. - -2001-07-14 19:43 Martin Geisler <gim...@gi...> - - * docs/src/: phpdoc2latex.php, latex/main.tex: - - I'm just playing with the formatting... Now things like $this->var - is also marked as a variable. - -2001-07-14 09:07 Martin Geisler <gim...@gi...> - - * docs/: pdf/phpweather-a4.pdf, pdf/phpweather-a4.pdf.bz2, - pdf/phpweather-a4.pdf.gz, pdf/phpweather-a4.pdf.zip, - pdf/phpweather-letter.pdf, pdf/phpweather-letter.pdf.bz2, - pdf/phpweather-letter.pdf.gz, pdf/phpweather-letter.pdf.zip, - ps/phpweather-a4.ps, ps/phpweather-a4.ps.bz2, - ps/phpweather-a4.ps.gz, ps/phpweather-a4.ps.zip, - ps/phpweather-letter.ps, ps/phpweather-letter.ps.bz2, - ps/phpweather-letter.ps.gz, ps/phpweather-letter.ps.zip: - - The compressed files shouldn't be in CVS. - 2001-07-13 18:02 Mihaly Gyulai gyulai.freeyellow.com/ * phpweather.php: @@ -1223,92 +1422,17 @@ directory, and then split the file up into several smaller files so tha PHPDoc can undertand what's going on... -2001-07-13 08:54 Martin Geisler <gim...@gi...> - - * docs/: pdf/phpweather-a4.pdf, pdf/phpweather-a4.pdf.bz2, - pdf/phpweather-a4.pdf.gz, pdf/phpweather-a4.pdf.zip, - pdf/phpweather-letter.pdf, pdf/phpweather-letter.pdf.bz2, - pdf/phpweather-letter.pdf.gz, pdf/phpweather-letter.pdf.zip, - ps/phpweather-a4.ps, ps/phpweather-a4.ps.bz2, - ps/phpweather-a4.ps.gz, ps/phpweather-a4.ps.zip, - ps/phpweather-letter.ps, ps/phpweather-letter.ps.bz2, - ps/phpweather-letter.ps.gz, ps/phpweather-letter.ps.zip: - - The graphs are now made from left to right - much better! - -2001-07-13 08:35 Martin Geisler <gim...@gi...> +2001-07-12 20:11 Martin Geisler <gim...@gi...> - * docs/src/phpdoc2latex.php: - - This is much better! The graphs are now made from left to right - instead from top to bottom. - -2001-07-13 08:34 Martin Geisler <gim...@gi...> - - * docs/src/latex/.cvsignore: - - This should make sure that CVS stops annoying us about all the - files left behind when LaTeX has been run. - -2001-07-12 20:07 Martin Geisler <gim...@gi...> - - * docs/html/: base_object.html, data_retrieval.html, + * doc/: .cvsignore, base_object.html, data_retrieval.html, db_common.html, db_dba.html, db_layer.html, db_mysql.html, db_null.html, db_pgsql.html, empty.html, frame_packagelist.html, - index.html, locale_common.html, locale_da.html, locale_en.html, - locale_hu.html, metar_parser.html, - packageelementlist_PHP_Weather.html, phpdoc.css, + index.html, locale_common.html, locale_en.html, metar_parser.html, + packageelementlist_PHP_Weather.html, phpdoc.css, phpdoc.dtd, phpdoc_classtree.html, phpdoc_elementlist.html, phpdoc_packagelist.html, phpdoc_xmlfiles.html, phpweather.html: - HTML files... - -2001-07-12 20:03 Martin Geisler <gim...@gi...> - - * docs/ps/: phpweather-a4.ps, phpweather-a4.ps.bz2, - phpweather-a4.ps.gz, phpweather-a4.ps.zip, phpweather-letter.ps, - phpweather-letter.ps.bz2, phpweather-letter.ps.gz, - phpweather-letter.ps.zip: - - PostScript files! Beware of the filesize... - -2001-07-12 20:01 Martin Geisler <gim...@gi...> - - * docs/pdf/: phpweather-a4.pdf, phpweather-a4.pdf.bz2, - phpweather-a4.pdf.gz, phpweather-a4.pdf.zip, phpweather-letter.pdf, - phpweather-letter.pdf.bz2, phpweather-letter.pdf.gz, - phpweather-letter.pdf.zip: - - PDF files! - -2001-07-12 19:59 Martin Geisler <gim...@gi...> - - * docs/src/xml/: class_base_object.xml, class_data_retrieval.xml, - class_db_common.xml, class_db_dba.xml, class_db_layer.xml, - class_db_mysql.xml, class_db_null.xml, class_db_pgsql.xml, - class_locale_common.xml, class_locale_da.xml, class_locale_en.xml, - class_locale_hu.xml, class_metar_parser.xml, class_phpweather.xml, - class_property.xml, classtree_base_object.xml, - classtree_property.xml, elementlist.xml, packagelist.xml, - phpdoc.dtd, warnings_classanalyser.xml, warnings_parser.xml: - - XML sources... - -2001-07-12 19:56 Martin Geisler <gim...@gi...> - - * docs/src/latex/: apidoc.tex, intro.tex, main.tex, - phpweather-a4.tex, phpweather-letter.tex: - - The LaTeX sources. By running one of either phpweather-a4.tex or - phpweather-letter.tex you can produce the documentation for either - A4 or Letterpaper. - -2001-07-12 19:54 Martin Geisler <gim...@gi...> - - * docs/src/: make-docs.sh, php.ini, phpdoc2latex.php: - - A shellscript, a phpscript and an inifile for PHP. Use these tools - to regenerate the documentation. + The documentation has been moved to PHPWEATHER_BASE_DIR/docs. 2001-07-09 20:31 Mihaly Gyulai gyulai.freeyellow.com/ @@ -1537,6 +1661,18 @@ It has been moved to PHPWEATHER_BASE_DIR/locales. +2001-06-27 11:35 Martin Geisler <gim...@gi...> + + * doc/: base_object.html, data_retrieval.html, db_common.html, + db_dba.html, db_layer.html, db_mysql.html, db_null.html, + db_pgsql.html, frame_packagelist.html, locale_common.html, + locale_en.html, metar_parser.html, + packageelementlist_PHP_Weather.html, phpdoc_classtree.html, + phpdoc_elementlist.html, phpdoc_packagelist.html, + phpdoc_xmlfiles.html, phpweather.html: + + Doc update... + 2001-06-27 11:32 Martin Geisler <gim...@gi...> * configurator.php: @@ -1792,6 +1928,25 @@ Ups, we have to return true here - if we don't the other function will think that we couldn't connect to the database. +2001-04-27 19:13 Martin Geisler <gim...@gi...> + + * doc/.cvsignore: + + We don't need all those .xml-files. + +2001-04-27 19:09 Martin Geisler <gim...@gi...> + + * doc/: class_base_object.xml, class_data_retrieval.xml, + class_db_common.xml, class_db_dba.xml, class_db_layer.xml, + class_db_mysql.xml, class_db_null.xml, class_db_pgsql.xml, + class_locale_common.xml, class_locale_en.xml, + class_metar_parser.xml, class_phpweather.xml, + classtree_base_object.xml, elementlist.xml, packagelist.xml: + + I don't want these files to be here... They're regenerated every + time I run PHPDoc, so there's no need for them. It's the HTML-files + that are important for the documentation. + 2001-04-27 19:07 Martin Geisler <gim...@gi...> * locale_common.php: @@ -1878,6 +2033,24 @@ I think that's the most important change :-) +2001-04-16 15:09 Martin Geisler <gim...@gi...> + + * doc/: base_object.html, class_base_object.xml, + class_data_retrieval.xml, class_db_common.xml, class_db_dba.xml, + class_db_layer.xml, class_db_mysql.xml, class_db_none.xml, + class_db_null.xml, class_db_pgsql.xml, class_locale_common.xml, + class_locale_en.xml, class_metar_parser.xml, class_phpweather.xml, + classtree_base_object.xml, data_retrieval.html, db_common.html, + db_dba.html, db_layer.html, db_mysql.html, db_none.html, + db_null.html, db_pgsql.html, elementlist.xml, locale_common.html, + locale_en.html, metar_parser.html, + packageelementlist_PHP_Weather.html, packagelist.xml, + phpdoc_classtree.html, phpdoc_elementlist.html, + phpdoc_packagelist.html, phpdoc_xmlfiles.html, phpweather.html: + + Updated documentation a bit... Also removed the 'none' database + type and added the 'null' type instead. + 2001-04-16 14:57 Martin Geisler <gim...@gi...> * defaults-dist.php: @@ -1942,6 +2115,27 @@ I don't like all those <tab>s... +2001-04-02 19:50 Martin Geisler <gim...@gi...> + + * doc/: class_db_dba.xml, db_dba.html: + + More doc updates... + +2001-04-02 19:40 Martin Geisler <gim...@gi...> + + * doc/: class_data_retrieval.xml, class_db_common.xml, + class_db_dba.xml, class_db_layer.xml, class_db_mysql.xml, + class_db_none.xml, class_db_pgsql.xml, class_locale_common.xml, + class_locale_en.xml, class_metar_parser.xml, class_phpweather.xml, + classtree_base_object.xml, data_retrieval.html, db_common.html, + db_dba.html, db_layer.html, db_mysql.html, db_none.html, + db_pgsql.html, elementlist.xml, locale_common.html, locale_en.html, + metar_parser.html, packageelementlist_PHP_Weather.html, + packagelist.xml, phpdoc_classtree.html, phpdoc_elementlist.html, + phpdoc_packagelist.html, phpdoc_xmlfiles.html, phpweather.html: + + Doc update... + 2001-04-02 19:34 Martin Geisler <gim...@gi...> * data_retrieval.php, db_mysql.php, db_none.php, db_pgsql.php, @@ -2001,7 +2195,9 @@ 2001-03-26 20:25 Martin Geisler <gim...@gi...> - * phpweather.php: + * phpweather.php, doc/base_object.html, doc/class_base_object.xml, + doc/class_db_none.xml, doc/class_locale_common.xml, + doc/db_none.html, doc/locale_common.html: Ha-ha!! It works now! When I regenerate the docs, then I don't have to commit all the files to CVS, only those who is actually changed. @@ -2015,6 +2211,25 @@ Even more doc-changes. +2001-03-26 20:13 Martin Geisler <gim...@gi...> + + * doc/: class_locale_common.xml, locale_common.html: + + Just some more documentation-fixes. + +2001-03-26 19:31 Martin Geisler <gim...@gi...> + + * doc/: base_object.html, class_base_object.xml, + class_data_retrieval.xml, class_db_common.xml, class_db_layer.xml, + class_db_mysql.xml, class_db_none.xml, class_db_pgsql.xml, + class_locale_common.xml, class_locale_en.xml, + class_metar_parser.xml, class_phpweather.xml, data_retrieval.html, + db_common.html, db_layer.html, db_mysql.html, db_none.html, + db_pgsql.html, elementlist.xml, locale_common.html, locale_en.html, + metar_parser.html, phpdoc_elementlist.html, phpweather.html: + + Just some whitespace changes in the documentation. + 2001-03-25 08:48 Martin Geisler <gim...@gi...> * README-CVS, db_layer.php: @@ -2052,7 +2267,22 @@ 2001-03-24 16:40 Martin Geisler <gim...@gi...> - * data_retrieval.php: + * data_retrieval.php, doc/base_object.html, + doc/class_base_object.xml, doc/class_data_retrieval.xml, + doc/class_db_common.xml, doc/class_db_layer.xml, + doc/class_db_mysql.xml, doc/class_db_none.xml, + doc/class_db_pgsql.xml, doc/class_locale_common.xml, + doc/class_locale_en.xml, doc/class_metar_parser.xml, + doc/class_phpweather.xml, doc/classtree_base_object.xml, + doc/data_retrieval.html, doc/db_common.html, doc/db_layer.html, + doc/db_mysql.html, doc/db_none.html, doc/db_pgsql.html, + doc/elementlist.xml, doc/empty.html, doc/frame_packagelist.html, + doc/index.html, doc/locale_common.html, doc/locale_en.html, + doc/metar_parser.html, doc/packageelementlist_PHP_Weather.html, + doc/packagelist.xml, doc/phpdoc.css, doc/phpdoc.dtd, + doc/phpdoc_classtree.html, doc/phpdoc_elementlist.html, + doc/phpdoc_packagelist.html, doc/phpdoc_xmlfiles.html, + doc/phpweather.html: Updated the documentation a bit. @@ -2128,16 +2358,44 @@ * index.php, ChangeLog, base_object.php, db_layer.php, db_mysql.php, db_none.php, db_common.php, db_pgsql.php, locale_en.php, phpweather.php, metar_parser.php, - data_retrieval.php, locale_common.php: + data_retrieval.php, locale_common.php, doc/class_db_common.xml, + doc/class_db_mysql.xml, doc/class_db_none.xml, + doc/class_db_pgsql.xml, doc/class_metar_parser.xml, + doc/class_phpweather.xml, doc/class_data_retrieval.xml, + doc/class_db_layer.xml, doc/class_locale_en.xml, + doc/class_base_object.xml, doc/class_locale_common.xml, + doc/classtree_base_object.xml, doc/packagelist.xml, + doc/elementlist.xml, doc/frame_packagelist.html, + doc/phpdoc_elementlist.html, doc/phpdoc_packagelist.html, + doc/packageelementlist_PHP_Weather.html, doc/db_none.html, + doc/db_mysql.html, doc/db_common.html, doc/db_pgsql.html, + doc/phpweather.html, doc/data_retrieval.html, + doc/metar_parser.html, doc/db_layer.html, doc/locale_en.html, + doc/locale_common.html, doc/base_object.html, + doc/phpdoc_classtree.html, doc/phpdoc_xmlfiles.html: - Initial revision + First checkin... 2001-03-22 18:04 Martin Geisler <gim...@gi...> * index.php, ChangeLog, base_object.php, db_layer.php, db_mysql.php, db_none.php, db_common.php, db_pgsql.php, locale_en.php, phpweather.php, metar_parser.php, - data_retrieval.php, locale_common.php: + data_retrieval.php, locale_common.php, doc/class_db_common.xml, + doc/class_db_mysql.xml, doc/class_db_none.xml, + doc/class_db_pgsql.xml, doc/class_metar_parser.xml, + doc/class_phpweather.xml, doc/class_data_retrieval.xml, + doc/class_db_layer.xml, doc/class_locale_en.xml, + doc/class_base_object.xml, doc/class_locale_common.xml, + doc/classtree_base_object.xml, doc/packagelist.xml, + doc/elementlist.xml, doc/frame_packagelist.html, + doc/phpdoc_elementlist.html, doc/phpdoc_packagelist.html, + doc/packageelementlist_PHP_Weather.html, doc/db_none.html, + doc/db_mysql.html, doc/db_common.html, doc/db_pgsql.html, + doc/phpweather.html, doc/data_retrieval.html, + doc/metar_parser.html, doc/db_layer.html, doc/locale_en.html, + doc/locale_common.html, doc/base_object.html, + doc/phpdoc_classtree.html, doc/phpdoc_xmlfiles.html: - First checkin... + Initial revision |
|
From: Martin G. <gim...@us...> - 2002-08-30 13:00:04
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv21919 Modified Files: VERSION Log Message: Version 2.0.0 is coming your way! Index: VERSION =================================================================== RCS file: /cvsroot/phpweather/phpweather/VERSION,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- VERSION 12 Apr 2002 21:38:46 -0000 1.7 +++ VERSION 30 Aug 2002 13:00:01 -0000 1.8 @@ -1 +1 @@ -2.x-CVS +2.0.0 |
|
From: Martin G. <gim...@us...> - 2002-08-30 12:58:50
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv21582 Modified Files: AUTHORS Log Message: Let's not forget these two guys :-) Index: AUTHORS =================================================================== RCS file: /cvsroot/phpweather/phpweather/AUTHORS,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- AUTHORS 14 Jul 2002 23:05:52 -0000 1.5 +++ AUTHORS 30 Aug 2002 12:58:46 -0000 1.6 @@ -76,4 +76,10 @@ Made the Spanish translation. Ondrej Jombik <ne...@po...> - Translated PHP Weather into Slovak. + Translated PHP Weather into Slovak and rewrote the navigation system + used in index.php. He also looked at the MySQL and PostgreSQL + database and found some security flaws. + +Reini Urban <ru...@xa...> + Fixed some problems with using PHP Weather on a default installation + of PHP 4.2. |
|
From: Martin G. <gim...@us...> - 2002-08-28 21:13:42
|
Update of /cvsroot/phpweather/phpweather/output
In directory usw-pr-cvs1:/tmp/cvs-serv968
Modified Files:
pw_text_da.php pw_text_en.php pw_text_es.php pw_text_hu.php
pw_text_no.php pw_text_sk.php
Log Message:
Fixing comments and reindenting code.
Index: pw_text_da.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text_da.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- pw_text_da.php 17 May 2002 16:21:49 -0000 1.7
+++ pw_text_da.php 28 Aug 2002 21:13:40 -0000 1.8
@@ -3,7 +3,8 @@
require_once(PHPWEATHER_BASE_DIR . '/output/pw_text.php');
/**
- * Provides all the strings needed by locale_common to produce Danish output.
+ * Provides all the strings needed by pw_text to produce Danish
+ * output.
*
* @author Martin Geisler <gim...@gi...>
* @version $Id$
@@ -13,7 +14,7 @@
/**
* This constructor provides all the strings used.
*
- * @param array This is just passed on to locale_common()
+ * @param array This is just passed on to pw_text().
*/
function pw_text_da($weather, $input = array()) {
$this->strings['charset'] = 'ISO-8859-1';
Index: pw_text_en.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text_en.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- pw_text_en.php 16 May 2002 20:35:53 -0000 1.7
+++ pw_text_en.php 28 Aug 2002 21:13:40 -0000 1.8
@@ -15,7 +15,7 @@
/**
* This constructor provides all the strings used.
*
- * @param array This is just passed on to locale_common()
+ * @param array This is just passed on to pw_text().
*/
function pw_text_en($weather, $input = array()) {
$this->strings['charset'] = 'ISO-8859-1';
Index: pw_text_es.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text_es.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- pw_text_es.php 20 Jun 2002 11:17:35 -0000 1.3
+++ pw_text_es.php 28 Aug 2002 21:13:40 -0000 1.4
@@ -15,7 +15,7 @@
/**
* This constructor provides all the strings used.
*
- * @param array This is just passed on to locale_common()
+ * @param array This is just passed on to pw_text().
*/
function pw_text_es($weather, $input = array()) {
$this->strings['charset'] = 'ISO-8859-1';
Index: pw_text_hu.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text_hu.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- pw_text_hu.php 16 May 2002 20:02:35 -0000 1.11
+++ pw_text_hu.php 28 Aug 2002 21:13:40 -0000 1.12
@@ -3,9 +3,9 @@
require_once(PHPWEATHER_BASE_DIR . '/output/pw_text.php');
/**
- * Provides all the strings needed by locale_common to produce
+ * Provides all the strings needed by pw_text to produce
* Hungarian output.
- * A magyar szövegû idõjárásjelentéshez a locale_common innen
+ * A magyar szövegû idõjárásjelentéshez a pw_text innen
* veszi a sztringeket.
*
* @author Mihály Gyulai
@@ -17,8 +17,8 @@
/**
* This constructor provides all the strings used.
*
- * @param array This is just passed on to locale_common()
- * Ezt a paramétert átadjuk locale_common() -nak.
+ * @param array This is just passed on to pw_text().
+ * Ezt a paramétert átadjuk pw_text() -nak.
*/
function pw_text_hu($weather, $input = array()) {
$this->strings['charset'] = 'ISO-8859-2';
Index: pw_text_no.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text_no.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- pw_text_no.php 12 Aug 2002 23:00:10 -0000 1.7
+++ pw_text_no.php 28 Aug 2002 21:13:40 -0000 1.8
@@ -3,18 +3,18 @@
require_once(PHPWEATHER_BASE_DIR . '/output/pw_text.php');
/**
- * Provides all the strings needed by locale_common to produce
+ * Provides all the strings needed by pw_text to produce
* Norwegian output.
*
* @author Sven-Erik Andersen <sve...@an...>
- * @version locale_no.php,v 1.3 2001/11/22 02:33:00 sven-erik Exp $
+ * @version $Id$
*/
class pw_text_no extends pw_text {
/**
* This constructor provides all the strings used.
*
- * @param array This is just passed on to locale_common()
+ * @param array This is just passed on to pw_text().
*/
function pw_text_no($weather, $input = array()) {
$this->strings['charset'] = 'ISO-8859-1';
Index: pw_text_sk.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text_sk.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- pw_text_sk.php 14 Jul 2002 22:52:29 -0000 1.1
+++ pw_text_sk.php 28 Aug 2002 21:13:40 -0000 1.2
@@ -17,284 +17,280 @@
class pw_text_sk extends pw_text
{
- /**
- * This constructor provides all the strings used.
- *
- * @param array This is just passed on to locale_common()
- */
- function pw_text_sk($weather, $input = array())
- {
- $this->strings['charset'] = 'ISO-8859-2';
- $this->strings['no_data'] = '¥utujem, momentálne nie sú dostupné ¾iadne informácie pre %s%s%s.';
- $this->strings['list_sentences_and'] = ' a ';
- $this->strings['list_sentences_comma'] = ', ';
- $this->strings['list_sentences_final_and'] = ' a ';
- $this->strings['location'] = 'Toto je meterologický report pre %s%s%s.';
- $this->strings['minutes'] = ' minútami';
- $this->strings['time_format'] = 'Report bol zostavený pred %s, o %s%s%s UTC.';
- $this->strings['time_minutes'] = 'a %s%s%s minútami';
- $this->strings['time_one_hour'] = '%sjednou%s hodinou %s';
- $this->strings['time_several_hours'] = '%s%s%s hodinami %s';
- $this->strings['time_a_moment'] = 'práve teraz';
- $this->strings['meters_per_second'] = ' metrov za sekundu';
- $this->strings['miles_per_hour'] = ' míµ za hodinu';
- $this->strings['meter'] = ' metrov';
- $this->strings['meters'] = ' metre';
- $this->strings['feet'] = ' stôp';
- $this->strings['kilometers'] = ' kilometrov';
- $this->strings['miles'] = ' míl';
- $this->strings['and'] = ' a ';
- $this->strings['plus'] = ' plus ';
- $this->strings['with'] = ' s ';
- $this->strings['wind_blowing'] = 'Rýchlos» vetra bola ';
- $this->strings['wind_with_gusts'] = ' so silným závanom od ';
- $this->strings['wind_from'] = ' z ';
- $this->strings['wind_variable'] = ' z %srôznych%s smerov';
- $this->strings['wind_varying'] = ', meniaca sa medzi smerom z %s%s%s (%s%s°%s) a %s%s%s (%s%s°%s)';
- $this->strings['wind_calm'] = 'Vietor bol %spokojný%s';
- $this->strings['wind_dir'] = array(
- 'severu',
- 'severu/severovýchodu',
- 'severovýchodu',
- 'východu/severovýchodu',
- 'východu',
- 'východu/juhovýchodu',
- 'juhovýchodu',
- 'juhu/juhovýchodu',
- 'juhu',
- 'juhu/juhozápadu',
- 'juhozápadu',
- 'západu/juhozápadu',
- 'západu',
- 'západu/severozápadu',
- 'severozápadu',
- 'severu/severozápadu',
- 'severu');
- $this->strings['wind_dir_short'] = array(
- 'S',
- 'SSV',
- 'SV',
- 'VSV',
- 'V',
- 'VJV',
- 'JV',
- 'JJV',
- 'J',
- 'JJZ',
- 'JZ',
- 'ZJZ',
- 'Z',
- 'ZSZ',
- 'SZ',
- 'SSZ',
- 'S');
- $this->strings['wind_dir_short_long'] = array(
- 'S' => 'sever',
- 'SV' => 'severovýchod',
- 'V' => 'východ',
- 'JV' => 'juhovýchod',
- 'J' => 'juh',
- 'JZ' => 'juhozápad',
- 'Z' => 'západ',
- 'SZ' => 'severozápad'
- );
- $this->strings['temperature'] = 'Teplota bola ';
- $this->strings['dew_point'] = ' s rosným bodom ';
- $this->strings['altimeter'] = 'Atmosférický tlak bol ';
- $this->strings['hPa'] = ' hPa';
- $this->strings['inHg'] = ' inHg';
- $this->strings['rel_humidity'] = 'Relatívna vlhkos» vzduchu bola ';
- $this->strings['feelslike'] = 'Teplota sa zdala by» ';
- $this->strings['cloud_group_beg'] = 'Na oblohe boli ';
- $this->strings['cloud_group_end'] = '.';
- $this->strings['cloud_clear'] = 'Obloha bola %sjasná%s.';
- $this->strings['cloud_height'] = ' oblaky vo vý¹ke ';
- $this->strings['cloud_overcast'] = ' obloha bola %szamraèená%s od vý¹ky ';
- $this->strings['cloud_vertical_visibility'] = '%svertikálna viditeµnos»%s bola ';
- $this->strings['cloud_condition'] =
- array(
- 'SKC' => 'priehµadné',
- 'CLR' => 'jasné',
- 'FEW' => 'niektoré', /*'niekoµko',*/
- 'SCT' => 'rozptýlené',
- 'BKN' => 'zatiahnuté',
- 'OVC' => 'zamraèené');
- $this->strings['cumulonimbus'] = ' cumulonimbus';
- $this->strings['towering_cumulus'] = ' týèiace sa nahromadené';
- $this->strings['cavok'] = ' ¾iadne oblaky pod %s a ani ¾iadne iné nahromadené oblaky';
- $this->strings['currently'] = 'Aktuálnym poèasím bolo ';
- $this->strings['weather'] =
- array(
- /* Intensity */
- '-' => ' riedky ',
- ' ' => ' stredný ',
- '+' => ' hustý ',
- /* Proximity */
- 'VC' => ' v priµahlých oblastiach',
- /* Descriptor */
- 'PR' => ' èiastoèný',
- 'BC' => ' areály',
- 'MI' => ' plytký',
- 'DR' => ' slabé prúdenie vzduchu',
- 'BL' => ' veterno',
- 'SH' => ' prehánky',
- 'TS' => ' búrka s bleskami',
- 'FZ' => ' mrznutie',
- /* Precipitation */
- 'DZ' => ' mrholenie s veµkými kvapkami',
- 'RA' => ' dá¾ï', /* ' da¾divo', */
- 'SN' => ' sne¾enie',
- 'SG' => ' zrnité sne¾enie',
- 'IC' => ' µadové kry¹táliky',
- 'PL' => ' µadovec',
- 'GR' => ' krupobytie',
- 'GS' => ' slabé krupobytie',
- 'UP' => ' neznáme',
- /* Obscuration */
- 'BR' => ' hmlový opar nad vodami',
- 'FG' => ' hmlisto',
- 'FU' => ' dymno',
- 'VA' => ' sopeèný popol',
- 'DU' => ' popra¹ok',
- 'SA' => ' piesoèno', /* piesoèné */
- 'HZ' => ' opar nad pohorím',
- 'PY' => ' mrholenie s malými kvapôèkami',
- /* Other */
- 'PO' => ' piesoèné výry',
- 'SQ' => ' prudký závan vetra',
- 'FC' => ' prietr¾ mraèien',
- 'SS' => ' pra¹ná priesoèná búrka');
- $this->strings['visibility'] = 'Celková viditeµnos» bola ';
- $this->strings['visibility_greater_than'] = 'väè¹ia ako ';
- $this->strings['visibility_less_than'] = 'men¹ia ako ';
- $this->strings['visibility_to'] = ' do ';
- /* this is left untranslated, because I have no metar,
- that use this text
- -- Nepto [14/07/2002] */
- $this->strings['runway_upward_tendency'] = ' with an %supward%s tendency';
- $this->strings['runway_downward_tendency'] = ' with a %sdownward%s tendency';
- $this->strings['runway_no_tendency'] = ' with %sno distinct%s tendency';
- $this->strings['runway_between'] = 'between ';
- $this->strings['runway_left'] = ' left';
- $this->strings['runway_central'] = ' central';
- $this->strings['runway_right'] = ' right';
- $this->strings['runway_visibility'] = 'Viditeµnos» bola ';
- $this->strings['runway_for_runway'] = ' for runway ';
+ /**
+ * This constructor provides all the strings used.
+ *
+ * @param array This is just passed on to pw_text().
+ */
+ function pw_text_sk($weather, $input = array())
+ {
+ $this->strings['charset'] = 'ISO-8859-2';
+ $this->strings['no_data'] = '¥utujem, momentálne nie sú dostupné ¾iadne informácie pre %s%s%s.';
+ $this->strings['list_sentences_and'] = ' a ';
+ $this->strings['list_sentences_comma'] = ', ';
+ $this->strings['list_sentences_final_and'] = ' a ';
+ $this->strings['location'] = 'Toto je meterologický report pre %s%s%s.';
+ $this->strings['minutes'] = ' minútami';
+ $this->strings['time_format'] = 'Report bol zostavený pred %s, o %s%s%s UTC.';
+ $this->strings['time_minutes'] = 'a %s%s%s minútami';
+ $this->strings['time_one_hour'] = '%sjednou%s hodinou %s';
+ $this->strings['time_several_hours'] = '%s%s%s hodinami %s';
+ $this->strings['time_a_moment'] = 'práve teraz';
+ $this->strings['meters_per_second'] = ' metrov za sekundu';
+ $this->strings['miles_per_hour'] = ' míµ za hodinu';
+ $this->strings['meter'] = ' metrov';
+ $this->strings['meters'] = ' metre';
+ $this->strings['feet'] = ' stôp';
+ $this->strings['kilometers'] = ' kilometrov';
+ $this->strings['miles'] = ' míl';
+ $this->strings['and'] = ' a ';
+ $this->strings['plus'] = ' plus ';
+ $this->strings['with'] = ' s ';
+ $this->strings['wind_blowing'] = 'Rýchlos» vetra bola ';
+ $this->strings['wind_with_gusts'] = ' so silným závanom od ';
+ $this->strings['wind_from'] = ' z ';
+ $this->strings['wind_variable'] = ' z %srôznych%s smerov';
+ $this->strings['wind_varying'] = ', meniaca sa medzi smerom z %s%s%s (%s%s°%s) a %s%s%s (%s%s°%s)';
+ $this->strings['wind_calm'] = 'Vietor bol %spokojný%s';
+ $this->strings['wind_dir'] =
+ array('severu',
+ 'severu/severovýchodu',
+ 'severovýchodu',
+ 'východu/severovýchodu',
+ 'východu',
+ 'východu/juhovýchodu',
+ 'juhovýchodu',
+ 'juhu/juhovýchodu',
+ 'juhu',
+ 'juhu/juhozápadu',
+ 'juhozápadu',
+ 'západu/juhozápadu',
+ 'západu',
+ 'západu/severozápadu',
+ 'severozápadu',
+ 'severu/severozápadu',
+ 'severu');
+ $this->strings['wind_dir_short'] =
+ array('S',
+ 'SSV',
+ 'SV',
+ 'VSV',
+ 'V',
+ 'VJV',
+ 'JV',
+ 'JJV',
+ 'J',
+ 'JJZ',
+ 'JZ',
+ 'ZJZ',
+ 'Z',
+ 'ZSZ',
+ 'SZ',
+ 'SSZ',
+ 'S');
+ $this->strings['wind_dir_short_long'] =
+ array('S' => 'sever',
+ 'SV' => 'severovýchod',
+ 'V' => 'východ',
+ 'JV' => 'juhovýchod',
+ 'J' => 'juh',
+ 'JZ' => 'juhozápad',
+ 'Z' => 'západ',
+ 'SZ' => 'severozápad');
+ $this->strings['temperature'] = 'Teplota bola ';
+ $this->strings['dew_point'] = ' s rosným bodom ';
+ $this->strings['altimeter'] = 'Atmosférický tlak bol ';
+ $this->strings['hPa'] = ' hPa';
+ $this->strings['inHg'] = ' inHg';
+ $this->strings['rel_humidity'] = 'Relatívna vlhkos» vzduchu bola ';
+ $this->strings['feelslike'] = 'Teplota sa zdala by» ';
+ $this->strings['cloud_group_beg'] = 'Na oblohe boli ';
+ $this->strings['cloud_group_end'] = '.';
+ $this->strings['cloud_clear'] = 'Obloha bola %sjasná%s.';
+ $this->strings['cloud_height'] = ' oblaky vo vý¹ke ';
+ $this->strings['cloud_overcast'] = ' obloha bola %szamraèená%s od vý¹ky ';
+ $this->strings['cloud_vertical_visibility'] = '%svertikálna viditeµnos»%s bola ';
+ $this->strings['cloud_condition'] =
+ array('SKC' => 'priehµadné',
+ 'CLR' => 'jasné',
+ 'FEW' => 'niektoré', /*'niekoµko',*/
+ 'SCT' => 'rozptýlené',
+ 'BKN' => 'zatiahnuté',
+ 'OVC' => 'zamraèené');
+ $this->strings['cumulonimbus'] = ' cumulonimbus';
+ $this->strings['towering_cumulus'] = ' týèiace sa nahromadené';
+ $this->strings['cavok'] = ' ¾iadne oblaky pod %s a ani ¾iadne iné nahromadené oblaky';
+ $this->strings['currently'] = 'Aktuálnym poèasím bolo ';
+ $this->strings['weather'] =
+ array(/* Intensity */
+ '-' => ' riedky ',
+ ' ' => ' stredný ',
+ '+' => ' hustý ',
+ /* Proximity */
+ 'VC' => ' v priµahlých oblastiach',
+ /* Descriptor */
+ 'PR' => ' èiastoèný',
+ 'BC' => ' areály',
+ 'MI' => ' plytký',
+ 'DR' => ' slabé prúdenie vzduchu',
+ 'BL' => ' veterno',
+ 'SH' => ' prehánky',
+ 'TS' => ' búrka s bleskami',
+ 'FZ' => ' mrznutie',
+ /* Precipitation */
+ 'DZ' => ' mrholenie s veµkými kvapkami',
+ 'RA' => ' dá¾ï', /* ' da¾divo', */
+ 'SN' => ' sne¾enie',
+ 'SG' => ' zrnité sne¾enie',
+ 'IC' => ' µadové kry¹táliky',
+ 'PL' => ' µadovec',
+ 'GR' => ' krupobytie',
+ 'GS' => ' slabé krupobytie',
+ 'UP' => ' neznáme',
+ /* Obscuration */
+ 'BR' => ' hmlový opar nad vodami',
+ 'FG' => ' hmlisto',
+ 'FU' => ' dymno',
+ 'VA' => ' sopeèný popol',
+ 'DU' => ' popra¹ok',
+ 'SA' => ' piesoèno', /* piesoèné */
+ 'HZ' => ' opar nad pohorím',
+ 'PY' => ' mrholenie s malými kvapôèkami',
+ /* Other */
+ 'PO' => ' piesoèné výry',
+ 'SQ' => ' prudký závan vetra',
+ 'FC' => ' prietr¾ mraèien',
+ 'SS' => ' pra¹ná priesoèná búrka');
+ $this->strings['visibility'] = 'Celková viditeµnos» bola ';
+ $this->strings['visibility_greater_than'] = 'väè¹ia ako ';
+ $this->strings['visibility_less_than'] = 'men¹ia ako ';
+ $this->strings['visibility_to'] = ' do ';
+ /* this is left untranslated, because I have no metar, that use
+ * this text -- Nepto [14/07/2002] */
+ $this->strings['runway_upward_tendency'] = ' with an %supward%s tendency';
+ $this->strings['runway_downward_tendency'] = ' with a %sdownward%s tendency';
+ $this->strings['runway_no_tendency'] = ' with %sno distinct%s tendency';
+ $this->strings['runway_between'] = 'between ';
+ $this->strings['runway_left'] = ' left';
+ $this->strings['runway_central'] = ' central';
+ $this->strings['runway_right'] = ' right';
+ $this->strings['runway_visibility'] = 'Viditeµnos» bola ';
+ $this->strings['runway_for_runway'] = ' for runway ';
+
+ /* We run the parent constructor */
+ $this->pw_text($weather, $input);
+ }
+
+ function print_pretty_wind($wind)
+ {
+ extract($wind);
+
+ if (! empty($meters_per_second)) {
+ switch ($meters_per_second) {
+ case 1:
+ $this->strings['meters_per_second'] = ' meter za sekundu';
+ break;
+ case 2:
+ case 3:
+ case 4:
+ $this->strings['meters_per_second'] = ' metre za sekundu';
+ break;
+ default:
+ if ($meters_per_second - floor($meters_per_second) > 0)
+ $this->strings['meters_per_second'] = ' metra za sekundu';
+ break;
+ }
+ }
+ if (! empty($miles_per_hour)) {
+ switch ($miles_per_hour) {
+ case 1:
+ $this->strings['miles_per_hour'] = ' míµa za hodinu';
+ break;
+ case 2:
+ case 3:
+ case 4:
+ $this->strings['miles_per_hour'] = ' míle za hodinu';
+ break;
+ }
+ }
+
+ /*
+ * Z/ZO grammar handling
+ * zo severu, z juhu, zo zapadu, z vychodu
+ */
+ if (isset($deg)) {
+ if ($deg == 'VRB') {
+ } else {
+ $idx = intval(round($deg / 22.5));
+ if ($idx <= 2 || $idx >= 11) {
+ $this->strings['wind_from'] =
+ str_replace(' z ', ' zo ', $this->strings['wind_from']);
+ }
+ }
+ }
+
+ if (isset($var_beg)) {
+ $idx = intval(round($var_beg / 22.5));
+ if ($idx <= 2 || $idx >= 11) {
+ $this->strings['wind_varying'] =
+ str_replace(' z ', ' zo ', $this->strings['wind_varying']);
+ }
+ }
+
+ return parent::print_pretty_wind($wind);
+ }
+
+ function parse_cloud_group($cloud_group)
+ {
+ extract($cloud_group);
+
+ if (isset($condition) && $condition == 'CAVOK') {
+ $this->strings['cloud_group_beg'] =
+ str_replace(' boli ', ' neboli ', $this->strings['cloud_group_beg']);
+ }
+
+ return parent::parse_cloud_group($cloud_group);
+ }
+
+ function print_pretty_time($time)
+ {
+ $minutes_old = round((time() - $time)/60);
+ if ($minutes_old > 60) {
+ $minutes = $minutes_old % 60;
+ if ($minutes == 1) {
+ $this->strings['time_minutes'] = 'a %s%s%s minútou';
+ }
+ } else {
+ if ($minutes_old < 5) {
+ /* we must remove word 'pred', because we wanted string:
+ * 'Report bol zostavený prave teraz, ...' */
+ $this->strings['time_format'] =
+ str_replace(' pred ', ' ', $this->strings['time_format']);
+ }
+ }
+
+ return parent::print_pretty_time($time);
+ }
+
+ function print_pretty_weather($weather)
+ {
+ if ($weather[0]['descriptor'] == 'SH') {
+ $this->strings['currently'] = str_replace(' bolo ', ' boli ',
+ $this->strings['currently']);
+ if ($weather[0]['precipitation'] == 'RA') {
+ $this->strings['weather']['-'] = ' riedkeho ';
+ $this->strings['weather'][' '] = ' stredného ';
+ $this->strings['weather']['+'] = ' hustého ';
+ $this->strings['weather']['RA'] = ' da¾ïa';
+ }
+ } elseif ($weather[0]['precipitation'] == 'RA'
+ || $weather[0]['obscuration'] == 'HZ') {
+ $this->strings['currently'] = str_replace(' bolo ', ' bol ',
+ $this->strings['currently']);
+ }
- /* We run the parent constructor */
- $this->pw_text($weather, $input);
- }
-
- function print_pretty_wind($wind)
- {
- extract($wind);
-
- if (! empty($meters_per_second)) {
- switch ($meters_per_second) {
- case 1:
- $this->strings['meters_per_second'] = ' meter za sekundu';
- break;
- case 2:
- case 3:
- case 4:
- $this->strings['meters_per_second'] = ' metre za sekundu';
- break;
- default:
- if ($meters_per_second - floor($meters_per_second) > 0)
- $this->strings['meters_per_second'] = ' metra za sekundu';
- break;
- }
- }
- if (! empty($miles_per_hour)) {
- switch ($miles_per_hour) {
- case 1:
- $this->strings['miles_per_hour'] = ' míµa za hodinu';
- break;
- case 2:
- case 3:
- case 4:
- $this->strings['miles_per_hour'] = ' míle za hodinu';
- break;
- }
- }
-
- /*
- * Z/ZO grammar handling
- * zo severu, z juhu, zo zapadu, z vychodu
- */
- if (isset($deg)) {
- if ($deg == 'VRB') {
- } else {
- $idx = intval(round($deg / 22.5));
- if ($idx <= 2 || $idx >= 11) {
- $this->strings['wind_from'] =
- str_replace(' z ', ' zo ', $this->strings['wind_from']);
- }
- }
- }
-
- if (isset($var_beg)) {
- $idx = intval(round($var_beg / 22.5));
- if ($idx <= 2 || $idx >= 11) {
- $this->strings['wind_varying'] =
- str_replace(' z ', ' zo ', $this->strings['wind_varying']);
- }
- }
-
- return parent::print_pretty_wind($wind);
- }
-
- function parse_cloud_group($cloud_group)
- {
- extract($cloud_group);
-
- if (isset($condition) && $condition == 'CAVOK') {
- $this->strings['cloud_group_beg'] =
- str_replace(' boli ', ' neboli ', $this->strings['cloud_group_beg']);
- }
-
- return parent::parse_cloud_group($cloud_group);
- }
-
- function print_pretty_time($time)
- {
- $minutes_old = round((time() - $time)/60);
- if ($minutes_old > 60) {
- $minutes = $minutes_old % 60;
- if ($minutes == 1) {
- $this->strings['time_minutes'] = 'a %s%s%s minútou';
- }
- } else {
- if ($minutes_old < 5) {
- /* we must remove word 'pred', because we wanted string:
- 'Report bol zostavený prave teraz, ...' */
- $this->strings['time_format'] = str_replace(' pred ', ' ',
- $this->strings['time_format']);
- }
- }
-
- return parent::print_pretty_time($time);
- }
-
- function print_pretty_weather($weather)
- {
- if ($weather[0]['descriptor'] == 'SH') {
- $this->strings['currently'] = str_replace(' bolo ', ' boli ',
- $this->strings['currently']);
- if ($weather[0]['precipitation'] == 'RA') {
- $this->strings['weather']['-'] = ' riedkeho ';
- $this->strings['weather'][' '] = ' stredného ';
- $this->strings['weather']['+'] = ' hustého ';
- $this->strings['weather']['RA'] = ' da¾ïa';
- }
- } elseif ($weather[0]['precipitation'] == 'RA'
- || $weather[0]['obscuration'] == 'HZ') {
- $this->strings['currently'] = str_replace(' bolo ', ' bol ',
- $this->strings['currently']);
- }
-
- return parent::print_pretty_weather($weather);
- }
+ return parent::print_pretty_weather($weather);
+ }
}
/*
|
|
From: Martin G. <gim...@us...> - 2002-08-28 21:12:21
|
Update of /cvsroot/phpweather/phpweather/output
In directory usw-pr-cvs1:/tmp/cvs-serv32581
Modified Files:
pw_text.php
Log Message:
Until we get some strings for precipitation, we might as well disable
the output to prevent the ugly warnings.
Index: pw_text.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/output/pw_text.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- pw_text.php 26 Aug 2002 23:09:25 -0000 1.14
+++ pw_text.php 28 Aug 2002 21:12:16 -0000 1.15
@@ -1105,10 +1105,14 @@
/*********************
* Precipitation *
*********************/
+ /* Where have the strings gone?! Martin Geisler, 2002-08-28.
+
if (!in_array('precip', $this->properties['exclude']) &&
!empty($precipitation)) {
$output['precip'] = $this->print_pretty_precipitation($precipitation);
}
+
+ */
/********************************
* Min and max temperatures *
|
|
From: Martin G. <gim...@us...> - 2002-08-28 10:17:11
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv23266 Modified Files: index.php Log Message: Fix from Reini Urban <ru...@x-...> to deal with PHP 4.2 where the default setting for register_globals is off. Index: index.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/index.php,v retrieving revision 1.36 retrieving revision 1.37 diff -u -3 -r1.36 -r1.37 --- index.php 28 Aug 2002 10:10:01 -0000 1.36 +++ index.php 28 Aug 2002 10:17:08 -0000 1.37 @@ -39,24 +39,25 @@ * ``http://example.com/weather.php?icao=lztt'' if he or she knows * particular code for airport (icao). */ -if (empty($cc)) { +if (empty($HTTP_GET_VARS['cc'])) { $cc = ''; } else { - $cc = stripslashes($cc); + $cc = stripslashes($HTTP_GET_VARS['cc']); } -if (empty($icao)) { +if (empty($HTTP_GET_VARS['icao'])) { $icao = ''; } else { - $icao = stripslashes($icao); + $icao = stripslashes($HTTP_GET_VARS['icao']); } $languages = $weather->get_languages('text'); -if (empty($language) || !in_array($language, array_keys($languages))) { +if (empty($HTTP_GET_VARS['language']) || + !in_array($HTTP_GET_VARS['language'], array_keys($languages))) { $language = 'en'; } else { - $language = stripslashes($language); + $language = stripslashes($HTTP_GET_VARS['language']); } if ($icao != '') { |
|
From: Martin G. <gim...@us...> - 2002-08-28 10:10:05
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv16372
Modified Files:
data_retrieval.php index.php pw_utilities.php
Log Message:
More good stuff from Ondrej Jombik <ne...@po...>... The index.php
page has been rewritten to provide the same functionality with less
and more clear code.
I've updated data_rettrieval.php to deal with the changed lookup_icao
method in the database backends.
Index: data_retrieval.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/data_retrieval.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- data_retrieval.php 27 Aug 2002 23:26:25 -0000 1.24
+++ data_retrieval.php 28 Aug 2002 10:10:00 -0000 1.25
@@ -26,11 +26,12 @@
var $metar;
/**
- * The location of the station, eg. something like 'Aalborg, Denmark'.
+ * Data associated with the current ICAO.
*
- * @var string
+ * @var array The array has three entries: name, country,
+ * and country code of the ICAO.
*/
- var $location;
+ var $icao_data;
/**
* Constructor
@@ -77,9 +78,9 @@
$new_icao = addslashes($new_icao);
if ($new_icao != $this->get_icao()) {
$this->properties['icao'] = strtoupper($new_icao);
- $this->location = '';
- $this->metar = '';
- $this->decoded_metar = '';
+ $this->icao_data = false;
+ $this->metar = false;
+ $this->decoded_metar = false;
}
}
@@ -121,7 +122,7 @@
if ($new_metar != $this->get_metar()) {
$this->debug('Loading a METAR manually.');
$this->properties['icao'] = strtoupper(substr($new_metar,0,4));
- $this->location = '';
+ $this->icao_data = $this->db->lookup_icao($this->get_icao());
$this->metar = $new_metar;
$this->decoded_metar = $this->decode_metar();
}
@@ -185,6 +186,7 @@
}
}
+
/**
* Fetches a METAR from the Internet.
*
@@ -198,7 +200,6 @@
* @access public
* @return string The raw METAR.
*/
-
function get_metar_from_web($new_station) {
$metar = '';
$icao = $this->get_icao();
@@ -310,18 +311,112 @@
return $metar;
}
+
+ /**
+ * Returns the location of the current station.
+ *
+ * The location is the name of the station followed by the name of
+ * the country. If the ICAO cannot be found in the database, then
+ * the ICAO is just returned again.
+ *
+ * @return string The location of the station.
+ */
function get_location() {
- if (!empty($this->location)) {
- $this->debug('get_location(): Using old location: ' . $this->location);
- return $this->location;
+ if (!empty($this->icao_data)) {
+ $location = $this->icao_data[0] . ', ' . $this->icao_data[1];
+ $this->debug("get_location(): Using old location: $location");
+ return $location;
} elseif ($this->db->connect()) {
$this->debug('get_location(): Looking for location in the database');
- return $this->location = $this->db->lookup_icao($this->get_icao());
+ $this->icao_data = $this->db->lookup_icao($this->get_icao());
+ if (empty($this->icao_data)) {
+ return $this->get_icao(); // ICAO not found in database.
+ } else {
+ return $this->icao_data[0] . ', ' . $this->icao_data[1];
+ }
+ } else {
+ return $this->get_icao();
+ }
+ }
+
+
+ /**
+ * Returns the name of the station for the current ICAO.
+ *
+ * @return string The name of the station or false if the ICAO
+ * wasn't found in the database.
+ * @access public
+ */
+ function get_name() {
+ if (!empty($this->icao_data)) {
+ $this->debug('get_name(): Using old station name: ' . $this->icao_data[0]);
+ return $this->icao_data[0];
+ } elseif ($this->db->connect()) {
+ $this->debug('get_name(): Looking for station name in the database');
+ $this->icao_data = $this->db->lookup_icao($this->get_icao());
+ if (empty($this->icao_data)) {
+ return false; // ICAO not found in database.
+ } else {
+ return $this->icao_data[0];
+ }
} else {
return false;
}
}
+
+ /**
+ * Returns the name of the country for the current ICAO.
+ *
+ * @return string The name of the country or false if the ICAO
+ * wasn't found in the database.
+ * @access public
+ */
+ function get_country() {
+ if (!empty($this->icao_data)) {
+ $this->debug('get_country(): Using old country name: ' . $this->icao_data[1]);
+ return $this->icao_data[1];
+ } elseif ($this->db->connect()) {
+ $this->debug('get_country(): Looking for country name in the database');
+ $this->icao_data = $this->db->lookup_icao($this->get_icao());
+ if (empty($this->icao_data)) {
+ return false; // ICAO not found in database.
+ } else {
+ return $this->icao_data[1];
+ }
+ } else {
+ return false;
+ }
+ }
+
+
+ /**
+ * Returns contry code specified ICAO.
+ *
+ * @return string country code (cc)
+ * @author Ondrej Jombik <ne...@po...>
+ * @access public
+ */
+ function get_country_code() {
+ if (!empty($this->icao_data)) {
+ $this->debug('get_country_code(): Using old country code (cc): ' .
+ $this->icao_data[2]);
+ return $this->icao_data[2];
+ } elseif ($this->db->connect()) {
+ $this->debug('get_country(): Looking for country code (cc) in the database');
+ $this->icao_data = $this->db->lookup_icao($this->get_icao());
+ if (empty($this->icao_data)) {
+ return false; // ICAO not found in database.
+ } else {
+ return $this->icao_data[2];
+ }
+ } else {
+ return false;
+ }
+ }
+
+
+
}
?>
Index: index.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/index.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- index.php 26 Aug 2002 21:48:23 -0000 1.35
+++ index.php 28 Aug 2002 10:10:01 -0000 1.36
@@ -32,66 +32,88 @@
';
-if (empty($action)) {
- /* No action - we display a form from which the user can select a
- country. */
-
- $output .= '<form action="index.php" method="get">' . "\n" .
- '<p><input type="hidden" name="action" value="show_stations" /> ' .
- get_countries_select($weather, '') .
- ' <input type="submit" />' . "</p>\n</form>\n";
-
-} elseif ($action == 'show_stations' && !empty($cc)) {
- /* A country has just been selected - we make a form with all
- stations in that country. */
+/* We should protect ourself against nasty guys passing quoting
+ * characters to CGI variables. We also want to allow lowercase
+ * icao/cc specification. It should improve direct linking to our
+ * weather website. Someone should directly write
+ * ``http://example.com/weather.php?icao=lztt'' if he or she knows
+ * particular code for airport (icao). */
- if (empty($icao)) $icao = '';
- if (empty($language)) $language = 'en';
+if (empty($cc)) {
+ $cc = '';
+} else {
+ $cc = stripslashes($cc);
+}
+
+if (empty($icao)) {
+ $icao = '';
+} else {
+ $icao = stripslashes($icao);
+}
+
+$languages = $weather->get_languages('text');
+
+if (empty($language) || !in_array($language, array_keys($languages))) {
+ $language = 'en';
+} else {
+ $language = stripslashes($language);
+}
+
+if ($icao != '') {
+ $weather->set_icao($icao);
+ /* icao was passed, we resolve country code */
+ $cc_temp = $weather->get_country_code();
+ if ($cc_temp === false) {
+ /* turn icao off, it is not valid */
+ $icao = '';
+ } else {
+ /* use resolved country code */
+ $cc = $cc_temp;
+ }
+}
+
+/* Always display country selection */
+$output .= '<form action="index.php" method="get">' . "\n"
+ .'<p>' . get_countries_select($weather, $cc)
+ .' <input type="submit" value="'
+ .($cc == '' ? 'Submit country' : 'Change country').'" />'
+ .'<input type="hidden" name="language" value="'.htmlspecialchars($language).'"> '
+ . "</p>\n</form>\n";
+
+if (! empty($cc)) {
+ /* Show stations selection for particular country ($cc). */
+ $output .= '<form action="index.php" method="get">' . "\n<p>"
+ . get_stations_select($weather, $cc, $icao)
+ . get_languages_select($weather, $language)
+ . '<input type="submit" value="Submit location">'
+ . "</p>\n</form>\n";
+}
+
+if (! empty($icao)) {
+ /* We should only display the current weather if we have station ($icao) */
+ include(PHPWEATHER_BASE_DIR . "/output/pw_text_$language.php");
+ $type = 'pw_text_' . $language;
+ $text = new $type($weather);
- $output .= '<form action="index.php" method="get">' . "\n<p>" .
- '<input type="hidden" name="action" value="show_weather" /> ' .
- get_countries_select($weather, $cc) .
- get_stations_select($weather, $cc, $icao) .
- get_languages_select($weather, $language) .
- '<input type="submit" />' . "</p>\n</form>\n";
-
-} elseif ($action == 'show_weather' && !empty($language)) {
- /* A station has just been selected - we print the weather. */
- $output .= '<form action="index.php" method="get">' . "\n<p>" .
- '<input type="hidden" name="action" value="show_weather" /> ' .
- get_countries_select($weather, $cc) .
- get_stations_select($weather, $cc, $icao) .
- get_languages_select($weather, $language) .
- '<input type="submit" />' . "</p>\n</form>\n";
+ include(PHPWEATHER_BASE_DIR . "/output/pw_images.php");
+ $icons = new pw_images($weather);
- if ($cc == $old_cc) {
- /* We should only display the current weather is the country isn't
- changed */
- $weather->set_icao($icao);
- include(PHPWEATHER_BASE_DIR . "/output/pw_text_$language.php");
- $type = 'pw_text_' . $language;
- $text = new $type($weather);
-
- include(PHPWEATHER_BASE_DIR . "/output/pw_images.php");
- $icons = new pw_images($weather);
-
- $output .= '<p>This is the current weather in ' .
- $weather->get_location() . ":</p>\n<blockquote>\n" .
- $text->print_pretty() . "\n</blockquote>\n" .
- "<p>The matching icons are:</p>\n<blockquote>\n" .
- '<img src="' . $icons->get_sky_image() .
- '" height="50" width="80" border="1" alt="Current weather in ' .
- $weather->get_location() . '" /> ' .
- '<img src="' . $icons->get_winddir_image() .
- '" height="40" width="40" border="1" alt="Current wind in ' .
- $weather->get_location() . '" /> ' .
- '<img src="' . $icons->get_temp_image() .
- '" height="50" width="20" border="1" alt="Current temperature in ' .
- $weather->get_location() . '" />' .
- "\n</blockquote>\n" .
- "<p>The raw METAR is <code>" .
- $weather->get_metar() . "</code></p>\n";
- }
+ $output .= '<p>This is the current weather in ' .
+ $weather->get_location() . ":</p>\n<blockquote>\n" .
+ $text->print_pretty() . "\n</blockquote>\n" .
+ "<p>The matching icons are:</p>\n<blockquote>\n" .
+ '<img src="' . $icons->get_sky_image() .
+ '" height="50" width="80" border="1" alt="Current weather in ' .
+ $weather->get_location() . '" /> ' .
+ '<img src="' . $icons->get_winddir_image() .
+ '" height="40" width="40" border="1" alt="Current wind in ' .
+ $weather->get_location() . '" /> ' .
+ '<img src="' . $icons->get_temp_image() .
+ '" height="50" width="20" border="1" alt="Current temperature in ' .
+ $weather->get_location() . '" />' .
+ "\n</blockquote>\n" .
+ "<p>The raw METAR is <code>" .
+ $weather->get_metar() . "</code></p>\n";
}
if (empty($text)) {
@@ -105,6 +127,7 @@
$end_time = explode(' ', microtime());
$diff = ($end_time[0] + $end_time[1]) - ($start_time[0] + $start_time[1]);
+
?>
<p>PHP Weather comes with some documentation that you'll probably want
Index: pw_utilities.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/pw_utilities.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- pw_utilities.php 28 Mar 2002 15:49:09 -0000 1.4
+++ pw_utilities.php 28 Aug 2002 10:10:01 -0000 1.5
@@ -15,7 +15,6 @@
}
}
$output .= "\n</select>\n";
- $output .= '<input type="hidden" name="old_cc" value="' . $old_cc . '" />';
return $output;
}
@@ -35,8 +34,6 @@
}
}
$output .= "\n</select>\n";
- $output .= '<input type="hidden" name="old_icao" value="' .
- $old_icao . '" />';
return $output;
}
@@ -55,10 +52,8 @@
}
}
$output .= "\n</select>\n";
- $output .= '<input type="hidden" name="old_language" value="' .
- $old_language . '" />';
return $output;
}
-?>
\ No newline at end of file
+?>
|
|
From: Martin G. <gim...@us...> - 2002-08-28 10:05:58
|
Update of /cvsroot/phpweather/phpweather/db/files In directory usw-pr-cvs1:/tmp/cvs-serv12005/files Modified Files: stations.db Log Message: Applied patches from Ondrej Jombik <ne...@po...> - I've changed them a little from what was sent to the mailing list. The lookup_icao($icao) method now returns an three element array with the name of the station, the name of the country, and the country code. The new functions get_name($icao), get_country($icao), and get_country_code($icao) are convenience functions that return what you think they return :-) The stations.db file has been regenerated to reflect the changes in the pw_db_null class. Index: stations.db =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/files/stations.db,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- stations.db 28 May 2002 13:28:38 -0000 1.3 +++ stations.db 28 Aug 2002 10:05:55 -0000 1.4 @@ -1,5131 +1,5131 @@ -AGGH;Honiara / Henderson, Solomon Islands -AGGL;Santa Cruz, Solomon Islands -AGGM;Munda, Solomon Islands -ANAU;Nauru Airport, Nauru -AYMD;Madang, Papua New Guinea -AYPY;Moresby, Papua New Guinea -AYWK;Wewak, Papua New Guinea -BGAM;Tasiilaq, Greenland -BGAS;Angisoq, Greenland -BGAT;Aputiteeq, Greenland -BGBW;Narsarsuaq, Greenland [...10231 lines suppressed...] +ZSFZ:Fuzhou:China:CN +ZSGZ:Ganzhou:China:CN +ZSHC:Hangzhou:China:CN +ZSNJ:Nanjing:China:CN +ZSOF:Hefei:China:CN +ZSQD:Qingdao:China:CN +ZSSS:Shanghai / Hongqiao:China:CN +ZSTN:Jinan:China:CN +ZUCK:Chongqing:China:CN +ZUGY:Guiyang:China:CN +ZULS:Lhasa:China:CN +ZUUU:Chengdu:China:CN +ZWHM:Hami:China:CN +ZWSH:Kashi:China:CN +ZWTN:Hotan:China:CN +ZWWW:Urum-Qi / Diwopu:China:CN +ZWYN:Yining:China:CN +ZYCC:Changchun:China:CN +ZYQQ:Qiqihar:China:CN +ZYTL:Dalian:China:CN |
|
From: Martin G. <gim...@us...> - 2002-08-28 10:05:58
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv12005
Modified Files:
pw_db_common.php pw_db_dba.php pw_db_mysql.php pw_db_null.php
pw_db_pgsql.php
Log Message:
Applied patches from Ondrej Jombik <ne...@po...> - I've changed
them a little from what was sent to the mailing list.
The lookup_icao($icao) method now returns an three element array with
the name of the station, the name of the country, and the country
code. The new functions get_name($icao), get_country($icao), and
get_country_code($icao) are convenience functions that return what you
think they return :-)
The stations.db file has been regenerated to reflect the changes in
the pw_db_null class.
Index: pw_db_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_common.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- pw_db_common.php 26 Aug 2002 13:16:26 -0000 1.12
+++ pw_db_common.php 28 Aug 2002 10:05:55 -0000 1.13
@@ -3,6 +3,30 @@
require_once(PHPWEATHER_BASE_DIR . '/base_object.php');
/**
+ * The character used to seperate values in combined fields, if the
+ * database uses combined fields. The pw_db_null and pw_db_dba
+ * databases use this.
+ *
+ * @const PW_FIELD_SEPERATOR The field seperator.
+ * @access private
+ * @see PW_FIELD_REPLACEMENT
+ */
+define('PW_FIELD_SEPERATOR', ':');
+
+
+/**
+ * The character used to replace PW_FIELD_SEPERATOR in combined
+ * fields, if the database uses combined fields. The pw_db_null and
+ * pw_db_dba databases use this.
+ *
+ * @const PW_FIELD_REPLACEMENT The field seperator replacement.
+ * @access private
+ * @see PW_FIELD_SEPERATOR
+ */
+define('PW_FIELD_REPLACEMENT', ';');
+
+
+/**
* Common class for all the database-types.
*
* It contains some properties most database-types need, like
@@ -14,7 +38,8 @@
class pw_db_common extends base_object {
/**
- * Maintains the status of the database-connection.
+ * Maintains the status of the database-connection, if needed by the
+ * database backend.
*
* @var boolean
* @access public
@@ -22,7 +47,8 @@
var $is_connected;
/**
- * contains the link_id used when querying.
+ * Contains the link ID used when querying, if the database backend
+ * knows about a link ID.
*
* @var integer
* @access private
@@ -30,7 +56,8 @@
var $link_id;
/**
- * contains the result_id used when fetching rows from a result-set.
+ * Contains the result ID used when fetching rows from a result-set
+ * if the database backend knows about a result ID.
*
* @var integer
* @access private
@@ -131,6 +158,63 @@
fclose($fp);
}
+
+
+ /**
+ * Returns the name of the station associated with an ICAO.
+ *
+ * @param string ICAO of the station.
+ * @return string the name of the station, i.e 'Tirstrup' for
+ * EKAH. If the ICAO doesn't exist in the database
+ * false is returned.
+ * @access public
+ */
+ function get_name($icao) {
+ $data = $this->lookup_icao($icao);
+ if (empty($data)) {
+ return false;
+ } else {
+ return $data[0];
+ }
+ }
+
+
+ /**
+ * Returns the name of the country associated with an ICAO.
+ *
+ * @param string ICAO of the station.
+ * @return string the name of the associated country, if it's
+ * available, otherwise return false.
+ * @access public
+ */
+ function get_country($icao) {
+ $data = $this->lookup_icao($icao);
+ if (empty($data)) {
+ return false;
+ } else {
+ return $data[1];
+ }
+ }
+
+
+ /**
+ * Returns country code associated with an ICAO.
+ *
+ * @param string ICAO of the station.
+ * @return string country code (cc) for passed station (ICAO) if
+ * available, false otherwise
+ * @access public
+ */
+ function get_country_code($icao) {
+ $data = $this->lookup_icao($icao);
+ if (empty($data)) {
+ return false;
+ } else {
+ return $data[2];
+ }
+ }
+
+
}
?>
Index: pw_db_dba.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_dba.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- pw_db_dba.php 26 Aug 2002 13:17:09 -0000 1.8
+++ pw_db_dba.php 28 Aug 2002 10:05:55 -0000 1.9
@@ -141,9 +141,10 @@
/**
* Inserts a METAR into the database.
*
- * Any colons (:) in the METAR is changed into semi-colons (;). The
- * colons has nothing to do in the body of the METAR, so this wont
- * effect the parsing as the remarks isn't parsed anyway.
+ * Any instances of PW_FIELD_SEPERATOR (:) in the METAR is changed
+ * into PW_FIELD_REPLACEMENT (;). The colons has nothing to do in
+ * the body of the METAR, so this wont effect the parsing as the
+ * remarks isn't parsed anyway.
*
* @param string The ICAO of the station.
* @param string The raw METAR.
@@ -152,16 +153,20 @@
* @see update_metar()
*/
function insert_metar($station, $metar, $timestamp) {
- $this->debug("Inserting this row into the DBA database:<br><code>$metar:$timestamp</code>");
- dba_insert($station, strtr($metar, ':', ';') . ':' . $timestamp, $this->link_id);
+ $row = strtr($metar, PW_FIELD_SEPERATOR, PW_FIELD_REPLACEMENT) .
+ PW_FIELD_SEPERATOR . $timestamp;
+ $this->debug("Inserting this row into the DBA database: <br><code>$row</code>");
+ dba_insert($station, $row, $this->link_id);
}
+
/**
* Updates an existing METAR in the database.
*
- * Any colons (:) in the METAR is changed into semi-colons (;). The
- * colons has nothing to do in the body of the METAR, so this wont
- * effect the parsing as the remarks isn't parsed anyway.
+ * Any instances of PW_FIELD_SEPERATOR (:) in the METAR is changed
+ * into PW_FIELD_REPLACEMENT (;). The colons has nothing to do in
+ * the body of the METAR, so this wont effect the parsing as the
+ * remarks isn't parsed anyway.
*
* @param string The ICAO of the station.
* @param string The raw METAR.
@@ -170,10 +175,13 @@
* @see insert_metar()
*/
function update_metar($station, $metar, $timestamp) {
- $this->debug("Updating this row in the DBA database:<br><code>$metar:$timestamp</code>");
- dba_replace($station, strtr($metar, ':', ';') . ':' . $timestamp, $this->link_id);
+ $row = strtr($metar, PW_FIELD_SEPERATOR, PW_FIELD_REPLACEMENT) .
+ PW_FIELD_SEPERATOR . $timestamp;
+ $this->debug("Updating this row in the DBA database:<br><code>$row</code>");
+ dba_replace($station, $row, $this->link_id);
}
+
/**
* Gets a METAR form the database.
*
@@ -186,32 +194,34 @@
if (dba_exists($station, $this->link_id)) {
$row = dba_fetch($station, $this->link_id);
$this->debug("Returning this row from the DBA database:<br><code>$row</code>");
- return explode(':', $row);
+ return explode(PW_FIELD_SEPERATOR, $row);
} else {
return false;
}
}
+
/**
- * Translates an ICAO into a station name
- *
- * The boring ICAO (e.g. EKYT) is translated into something like
- * 'Aalborg, Denmark'.
+ * Fetches information about an ICAO.
*
* @param string The ICAO one want's to translate.
- * @return string The full name of the station, including country.
+ * @return array If the ICAO was found, then the array will
+ * contain three entries: the name of the station,
+ * the name of the country, the country code of the
+ * country. If the ICAO wasn't found, then false is
+ * returned.
* @access public
*/
function lookup_icao($icao) {
if (dba_exists($icao, $this->link_stations_id)) {
- list($name, $country) =
- explode(':', dba_fetch($icao, $this->link_stations_id));
- return "$name, $country";
+ return explode(PW_FIELD_SEPERATOR,
+ dba_fetch($icao, $this->link_stations_id));
} else {
- return $icao;
+ return false;
}
}
+
/**
* Creates the necessary files.
*
@@ -264,30 +274,36 @@
* It is assumed that create_tables() has been called previously
* (and that it returned true).
*
- * @param array This three-dimensional array starts with a list of
- * contry-codes. For each country-code the ICAOs and corresponding
- * locations in that particular country are listed as key => value
- * pairs.
- * @param array An associative array with country-codes as the keys
- * and the names of the countries as the values.
+ * @param array This three-dimensional array starts with a list of
+ * contry-codes. For each country-code the ICAOs and
+ * corresponding locations in that particular country
+ * are listed as key => value pairs.
+ *
+ * @param array An associative array with country-codes as the keys
+ * and the names of the countries as the values.
+ *
* @return bool
* @access private
*/
function insert_stations($data, $countries) {
while(list($cc, $country) = each($countries)) {
while(list($icao, $location) = each($data[$cc])) {
- /* We insert all the stations in a given country into the
- database. */
- dba_insert($icao, "$location:$country", $this->link_stations_id);
+ /* We insert all the stations together with the name of the
+ country and country code into the database. */
+ dba_insert($icao,
+ $location . PW_FIELD_SEPERATOR .
+ $country . PW_FIELD_SEPERATOR . $cc,
+ $this->link_stations_id);
$icaos[] = $icao; /* We collect the ICAOs for later. */
}
/* Now that we've collected all the ICAOs in the country, lets
insert the country with it's data into the database. The name
- of the country is seperated from the list of ICAOs by a
- single semi-colon (;). The ICAOs are seperated by a normal
- colon (:). */
+ of the country is seperated from the list of ICAOs by
+ PW_FIELD_SEPERATOR (:). The ICAOs are also seperated by
+ PW_FIELD_SEPERATOR. */
dba_insert($cc,
- $country . ';' . implode(':', $icaos),
+ $country . PW_FIELD_SEPERATOR .
+ implode(PW_FIELD_SEPERATOR, $icaos),
$this->link_countries_id);
unset($icaos); /* We can now forget about the ICAOs. */
}
@@ -309,9 +325,11 @@
$cc = dba_firstkey($this->link_countries_id); /* We need the first key. */
while ($data = dba_fetch($cc, $this->link_countries_id)) {
- list($country) = explode(';', $data);
- /* The above statement extracts the name of the country. It's
- seperated from the ICAOs by a semi-colon (;) */
+ /* This statement extracts the name of the country. It's
+ seperated from the ICAOs by PW_FIELD_SEPERATOR and after it
+ comes a list of ICAOs also seperated by the
+ PW_FIELD_SEPERATOR character: */
+ list($country) = explode(PW_FIELD_SEPERATOR, $data, 2);
$countries[$cc] = $country;
$cc = dba_nextkey($this->link_countries_id);
}
@@ -341,16 +359,20 @@
}
/* The name of the country is seperated from the list of ICAOs by
- * a single semi-colon (;) */
- list($country, $icaos) =
- explode(';', dba_fetch($cc, $this->link_countries_id));
-
- /* The ICAOs are seperated by a normal colon (:) */
- $icaos = explode(':', $icaos);
- while (list(, $icao) = each($icaos)) {
- list($location) =
- explode(':', dba_fetch($icao, $this->link_stations_id));
- $locations[$icao] = $location;
+ * PW_FIELD_SEPERATOR (:). The name is followed by a list of ICAOs
+ * which are also seperated by PW_FIELD_SEPERATOR. */
+ $data = explode(PW_FIELD_SEPERATOR,
+ dba_fetch($cc, $this->link_countries_id));
+
+ /* The first entry is the country: */
+ $country = array_shift($data);
+
+ /* The remaining entries are the ICAOs: */
+ while (list(, $icao) = each($data)) {
+ list($name) =
+ explode(PW_FIELD_SEPERATOR,
+ dba_fetch($icao, $this->link_stations_id));
+ $locations[$icao] = $name;
}
asort($locations);
Index: pw_db_mysql.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_mysql.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- pw_db_mysql.php 20 May 2002 15:48:48 -0000 1.5
+++ pw_db_mysql.php 28 Aug 2002 10:05:55 -0000 1.6
@@ -3,7 +3,7 @@
require_once(PHPWEATHER_BASE_DIR . '/db/pw_db_common.php');
/**
- * This class is the 'mysql' database-type.
+ * This class is the 'mysql' database backend.
*
* It implements all the methods necessary to insert, update and
* retrive METARs using a MySQL database. You'll need access to a
@@ -184,9 +184,10 @@
* @see update_metar()
*/
function insert_metar($icao, $metar, $timestamp) {
- $this->query("INSERT INTO " . $this->properties['db_metars'] .
- " SET icao = '$icao', metar = '" . addslashes($metar) . "', " .
- "timestamp = FROM_UNIXTIME($timestamp)");
+ $this->query(sprintf('INSERT INTO %s SET icao = "%s", ' .
+ 'metar = "%s", timestamp = FROM_UNIXTIME(%d)',
+ $this->properties['db_metars'], $icao,
+ addslashes($metar), intval($timestamp)));
}
@@ -200,10 +201,11 @@
* @see insert_metar()
*/
function update_metar($icao, $metar, $timestamp) {
- $this->query("UPDATE " . $this->properties['db_metars'] .
- " SET metar = '" . addslashes($metar) . "', " .
- "timestamp = FROM_UNIXTIME($timestamp) " .
- "WHERE icao = '$icao'");
+ $this->query(sprintf('UPDATE %s' .
+ ' SET metar = "%s", timestamp = FROM_UNIXTIME(%d)' .
+ ' WHERE icao = "%s"',
+ $this->properties['db_metars'], addslashes($metar),
+ intval($timestamp), $icao));
}
@@ -215,8 +217,9 @@
* @access public
*/
function get_metar($icao) {
- $this->query("SELECT metar, UNIX_TIMESTAMP(timestamp) FROM " .
- $this->properties['db_metars'] . " WHERE icao = '$icao'");
+ $this->query(sprintf('SELECT metar, UNIX_TIMESTAMP(timestamp)' .
+ ' FROM %s WHERE icao = "%s"',
+ $this->properties['db_metars'], $icao));
return $this->fetch_row();
}
@@ -232,7 +235,7 @@
if (!$this->connect()) {
return false; // Failure!
}
-
+
/* First we make a table for the METARs */
$this->query('DROP TABLE IF EXISTS ' . $this->properties['db_metars']);
$this->query('CREATE TABLE ' . $this->properties['db_metars'] . '(
@@ -253,28 +256,29 @@
UNIQUE icao (icao),
KEY cc (cc))');
- return true; // Succes!
+ return true; // Success!
}
/**
- * Translates an ICAO into a station name
+ * Fetches information about an ICAO.
*
- * The boring ICAO (e.g. EKYT) is translated into something like
- * 'Aalborg, Denmark'.
+ * The array returned contains three entries: the name of the
+ * station, the name of the country, the country code of the
+ * country.
*
* @param string The ICAO one want's to translate.
- * @return string The full name of the station, including country.
+ * @return array Information about the ICAO or false if no
+ * information is available.
* @access public
*/
function lookup_icao($icao) {
- $this->query('SELECT name, country FROM ' .
- $this->properties['db_stations'] . " WHERE icao = '$icao'");
+ $this->query(sprintf('SELECT name, country, cc FROM %s WHERE icao = "%s"',
+ $this->properties['db_stations'], addslashes($icao)));
if ($this->num_rows() == 1) {
- $row = $this->fetch_row();
- return "$row[0], $row[1]";
+ return $this->fetch_row();
} else {
- return $icao;
+ return false;
}
}
@@ -305,8 +309,10 @@
while(list($icao, $location) = each($data[$cc])) {
/* The station name might also be dangerous. */
$location = addslashes($location);
- $this->query('INSERT INTO ' . $this->properties['db_stations'] .
- " VALUES ('$icao', '$location', '$cc', '$country')");
+ $this->query(sprintf('INSERT INTO %s VALUES ("%s", "%s", "%s", "%s")',
+ $this->properties['db_stations'],
+ $icao, addslashes($location),
+ addslashes($cc), addslashes($country)));
}
}
@@ -325,7 +331,7 @@
if (!$this->connect()) {
return false;
}
-
+
$this->query('SELECT DISTINCT cc, country FROM ' .
$this->properties['db_stations'] . ' ORDER BY country');
while($row = $this->fetch_row()) {
@@ -333,27 +339,30 @@
}
return $rows;
}
-
+
/**
* Returns an array of stations.
*
- * @param string The country-code.
- * @param string This parameter is passed by reference. The name of
- * the country that corresponds to the country-code is stored here.
- * @return array An associative array with the ICAO as the key and
- * the name of the station as the values. The name of the country is
- * not added to the name of the station.
+ * @param string The country-code.
+ * @param string This parameter is passed by reference. The name of
+ * the country that corresponds to the country-code
+ * is stored here.
+ * @return array An associative array with the ICAO as the key and
+ * the name of the station as the values. The name
+ * of the country is not added to the name of the
+ * station.
* @access public
*/
function get_icaos($cc, &$country) {
if (!$this->connect()) {
return false;
}
-
- $this->query('SELECT icao, name, country FROM ' .
- $this->properties['db_stations'] .
- " WHERE cc = '$cc' ORDER BY name");
+
+ $this->query(sprintf('SELECT icao, name, country FROM %s'
+ .' WHERE cc = "%s" ORDER BY name',
+ $this->properties['db_stations'],
+ addslashes($cc)));
/* We have to do this manually the first time, so that we can set
$country */
list($icao, $name, $country) = $this->fetch_row();
Index: pw_db_null.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_null.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- pw_db_null.php 28 May 2002 13:26:15 -0000 1.3
+++ pw_db_null.php 28 Aug 2002 10:05:55 -0000 1.4
@@ -3,6 +3,15 @@
require_once(PHPWEATHER_BASE_DIR . '/db/pw_db_common.php');
/**
+ * Each line in the stations database will be padded with spaces to
+ * this length. to facilitate fast binary search.
+ *
+ * @const PW_LINE_LENGTH The length of lines in the stations database.
+ * @access private
+ */
+define('PW_LINE_LENGTH', 128);
+
+/**
* This class is the 'null' database-type
*
* It pretends to be a database, but really it isn't :-) It just
@@ -14,7 +23,7 @@
* @version $Id$
*/
class pw_db_null extends pw_db_common {
-
+
/**
* This constructor does nothing besides calling the parent constructor.
*
@@ -80,8 +89,8 @@
* Pretends to return a METAR form the database.
*
* @param string The ICAO of the station.
- * @return string Since we don't have a database, we just return an
- * empty string.
+ * @return string Since we don't have a database, we just return an
+ * empty string.
* @access public
*/
function get_metar($station) {
@@ -89,34 +98,42 @@
}
/**
- * Translates an ICAO into a station name
+ * Fetches information about an ICAO.
*
- * @param string The ICAO to translate.
- * @return string The translated ICAO.
+ * @param string The ICAO one want's to translate.
+ * @return array If the ICAO was found, then the array will
+ * contain three entries: the name of the station,
+ * the name of the country, the country code of the
+ * country. If the ICAO wasn't found, then false is
+ * returned.
* @access public
*/
function lookup_icao($icao) {
- $linesize = 128;
-
$fp = fopen(PHPWEATHER_BASE_DIR . '/db/files/stations.db', 'r');
-
- $result = '';
+ $size = filesize(PHPWEATHER_BASE_DIR . '/db/files/stations.db');
+
+ $result = false; // Default result.
$left = 0;
- $right = filesize(PHPWEATHER_BASE_DIR . '/db/files/stations.db')/$linesize;
+ $right = $size / PW_LINE_LENGTH;
+ /* We make a binary search for the right ICAO. The search
+ * terminates when $right >= $left: */
while ($left < $right) {
- fseek($fp, $linesize * round(($left+$right)/2));
+ fseek($fp, PW_LINE_LENGTH * round(($left+$right)/2));
- $data = fgetcsv($fp, $linesize, ';');
+ /* Each line contains four fields seperated by
+ * PW_FIELD_SEPERATOR. The fields are: the ICAO, name of
+ * station, name of country, and country code. */
+ $data = fgetcsv($fp, PW_LINE_LENGTH, PW_FIELD_SEPERATOR);
if ($data[0] > $icao) {
$right = floor(($left+$right)/2);
} elseif ($data[0] < $icao) {
$left = ceil(($left+$right)/2);
} else {
$left = $right;
- $result = trim($data[1]);
+ $result = array($data[1], $data[2], $data[3]);
}
}
fclose($fp);
@@ -158,32 +175,39 @@
function insert_stations($data, $countries) {
while(list($cc, $country) = each($countries)) {
$fp = fopen(PHPWEATHER_BASE_DIR . "/db/files/$cc.php", 'w');
+ if (!$fp) return false;
+
fputs($fp, "<?php\n/* File with stationnames in $countries[$cc] */\n\n");
fputs($fp, "\$country = '" . addslashes($countries[$cc]) . "';\n\n");
fputs($fp, "\$icaos = array(\n");
/* We do it ourselves the first time */
list($icao, $location) = each($data[$cc]);
fputs($fp, " '$icao' => '" . addslashes($location) . "'");
- $stations[$icao] = "$location, $countries[$cc]";
+ $stations[$icao] = array($location, $countries[$cc], $cc);
while(list($icao, $location) = each($data[$cc])) {
fputs($fp, ",\n '$icao' => '" . addslashes($location) . "'");
- $stations[$icao] = "$location, $countries[$cc]";
+ $stations[$icao] = array($location, $countries[$cc], $cc);
}
fputs($fp, "\n);\n\n?>\n");
fclose($fp);
}
- /* We write a file with all the stations. Each line is 128 bytes
- long so that it's easy to find a given station again. */
+ /* We write a file with all the stations. Each line is
+ PW_LINE_LENGTH bytes long so that it's easy to find a given
+ station again. */
$fp = fopen(PHPWEATHER_BASE_DIR . '/db/files/stations.db', 'w');
if ($fp) {
ksort($stations);
reset($stations);
- while(list($icao, $location) = each($stations)) {
- $str = str_pad("$icao;$location", 127)."\n";
+ while(list($icao, $data) = each($stations)) {
+ $str = str_pad($icao . PW_FIELD_SEPERATOR .
+ implode(PW_FIELD_SEPERATOR, $data),
+ PW_LINE_LENGTH - 1) . "\n";
fputs($fp, $str);
}
fclose($fp);
+ } else {
+ return false;
}
return true;
Index: pw_db_pgsql.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_pgsql.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- pw_db_pgsql.php 20 May 2002 16:04:36 -0000 1.5
+++ pw_db_pgsql.php 28 Aug 2002 10:05:55 -0000 1.6
@@ -175,8 +175,8 @@
/**
* Fetches a row as an associative array from the database.
*
- * @return array The next row from the result-set, as an associative
- * array.
+ * @return array The next row from the result-set, as an
+ * associative array.
* @access public
*/
function fetch_array() {
@@ -279,30 +279,32 @@
$this->query('CREATE INDEX cc_key ON ' .
$this->properties['db_stations'] . '(cc)');
- return true; // Succes!
+ return true; // Success!
}
+
/**
- * Translates an ICAO into a station name
- *
- * The boring ICAO (e.g. EKYT) is translated into something like
- * 'Aalborg, Denmark'.
+ * Fetches information about an ICAO.
*
* @param string The ICAO one want's to translate.
- * @return string The full name of the station, including country.
+ * @return array If the ICAO was found, then the array will
+ * contain three entries: the name of the station,
+ * the name of the country, the country code of the
+ * country. If the ICAO wasn't found, then false is
+ * returned.
* @access public
*/
function lookup_icao($icao) {
- $this->query('SELECT name, country FROM ' .
- $this->properties['db_stations'] . " WHERE icao = '$icao'");
+ $this->query(sprintf("SELECT name, country, cc FROM %s WHERE icao = '%s'",
+ $this->properties['db_stations'], addslashes($icao)));
if ($this->num_rows() == 1) {
- $row = $this->fetch_row();
- return "$row[0], $row[1]";
+ return $this->fetch_row();
} else {
- return $icao;
+ return false;
}
}
+
/**
* Inserts the stations into the database.
*
@@ -358,7 +360,7 @@
}
return $rows;
}
-
+
/**
* Returns an array of stations.
@@ -375,7 +377,7 @@
if (!$this->connect()) {
return false;
}
-
+
$this->query('SELECT icao, name, country FROM ' .
$this->properties['db_stations'] .
" WHERE cc = '$cc' ORDER BY name");
|
|
From: Martin G. <gim...@us...> - 2002-08-28 09:53:05
|
Update of /cvsroot/phpweather/phpweather/db/files In directory usw-pr-cvs1:/tmp/cvs-serv9549 Modified Files: HU.php Log Message: Regenerated with accents. Index: HU.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/files/HU.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- HU.php 28 May 2002 13:28:37 -0000 1.2 +++ HU.php 28 Aug 2002 09:53:01 -0000 1.3 @@ -4,18 +4,18 @@ $country = 'Hungary'; $icaos = array( - 'LHBC' => 'Bekescsaba', - 'LHBS' => 'Budaors', + 'LHBC' => 'Békéscsaba', + 'LHBS' => 'Budaörs', 'LHBP' => 'Budapest / Ferihegy', 'LHBM' => 'Budapest Met Center', 'LHDC' => 'Debrecen', - 'LHKV' => 'Kaposvar', - 'LHKE' => 'Kecskemet', + 'LHKV' => 'Kaposvár', + 'LHKE' => 'Kecskemét', 'LHMC' => 'Miskolc', - 'LHNY' => 'Nyiregyhaza / Napkor', - 'LHPA' => 'Papa', - 'LHPP' => 'Pecs / Pogany', - 'LHSK' => 'Siofok', + 'LHNY' => 'Nyiregyháza / Napkor', + 'LHPA' => 'Pápa', + 'LHPP' => 'Pécs / Pogány', + 'LHSK' => 'Siófok', 'LHUD' => 'Szeged', 'LHSN' => 'Szolnok', 'LHSY' => 'Szombathely' |
|
From: Martin G. <gim...@us...> - 2002-08-27 23:26:29
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv32029
Modified Files:
data_retrieval.php
Log Message:
Patch from Reini Urban <ru...@x-...>. In PHP 4.2 the default for
allow_url_fopen is off - so we now download the METAR reports
ourselves.
Index: data_retrieval.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/data_retrieval.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- data_retrieval.php 15 May 2002 22:23:26 -0000 1.23
+++ data_retrieval.php 27 Aug 2002 23:26:25 -0000 1.24
@@ -53,7 +53,7 @@
* Returns the current ICAO.
*
* @access public
- * @return string The station-ICAO
+ * @return string The ICAO of the current station.
*/
function get_icao() {
return $this->properties['icao'];
@@ -62,9 +62,9 @@
/**
* Sets the station or rather the ICAO.
*
- * It also clears the METAR and decodes METAR if the station is
- * different from the old one. If the new station is the same as
- * the old one, nothing is changed.
+ * It also clears the METAR and the decoded METAR data if the ICAO
+ * is different from the old one. If the new ICAO is the same as the
+ * old one, nothing is changed.
*
* @access public
* @param string The ICAO of the new station.
@@ -87,8 +87,8 @@
/**
* Retrieves a raw METAR, either from the web or from a database.
*
- * If the METAR is already set, then it just returns that.
- * If it's not set, then it tries to get it from the database.
+ * If the METAR is already set, then it just returns that. If it's
+ * not set, then it tries to get it from the database.
*
* @access public
* @return string The raw METAR.
@@ -198,53 +198,57 @@
* @access public
* @return string The raw METAR.
*/
+
function get_metar_from_web($new_station) {
$metar = '';
$icao = $this->get_icao();
-
+ $host = 'weather.noaa.gov';
+ $location = "/pub/data/observations/metar/stations/$icao.TXT";
+ $request = "HTTP/1.1\r\n" .
+ "If-Modified-Since: Sat, 29 Oct 1994 09:00:00 GMT\r\n" .
+ "Pragma: no-cache\r\n".
+ "Cache-Contol: no-cache\r\n";
if ($this->properties['use_proxy']) {
/* We use a proxy */
/* Inspirated by code from Paul Kairis <Pau...@sa...> */
-
$fp = fsockopen($this->properties['proxy_host'],
$this->properties['proxy_port']);
- if ($fp) {
- fputs($fp, 'GET http://weather.noaa.gov/pub/data/' .
- "observations/metar/stations/$icao.TXT HTTP/1.0\r\n" .
- "If-Modified-Since: Sat, 29 Oct 1994 09:00:00 GMT\r\n" .
- "Pragma: no-cache\r\n".
- "Cache-Contol: no-cache\r\n\r\n");
-
- /* We check the status line */
- if (strpos(fgets($fp, 1024), '200 ')) {
- /* Then we seek until we find the empty line between the
- * headers and the contents.
- */
- do {
- $line = fgets($fp, 1024);
- } while ($line != "\r\n");
- /* We know now, that the following lines are the contents. */
- unset($file);
- while ($line = fgets($fp, 1024)) {
- $file[] = $line;
- }
- fclose($fp);
- }
+ $request = "GET http://$host$location " . $request .
+ "Host: $host\r\n" .
+ "Content-Type: text/html\r\n" .
+ "Connection: Close\r\n\r\n";
+ } else {
+ // allow_url_fopen is often off.
+ // se we can use this method or curl or shell_exec wget
+ $fp = fsockopen('weather.noaa.gov', 80);
+ $request = "GET $location " . $request .
+ "Host: $host\r\n" .
+ "Content-Type: text/html\r\n" .
+ "Connection: Close\r\n\r\n";
+ }
+ if ($fp) {
+ fputs($fp, $request);
+ /* We check the status line */
+ if (strpos(fgets($fp, 1024), '200 ')) {
+ /* Then we seek until we find the empty line between the
+ * headers and the contents.
+ */
+ do {
+ $line = fgets($fp, 1024);
+ } while ($line != "\r\n");
+
+ /* We know now, that the following lines are the contents. */
+ $file = array();
+ while ($line = fgets($fp, 1024)) {
+ $file[] = $line;
+ }
+ fclose($fp);
}
- } else {
- /* No proxy - we just fetch the file the normal way. */
- /* We use the @file notation here because it might fail. */
- $file = @file('http://weather.noaa.gov/pub/data/' .
- "observations/metar/stations/$icao.TXT");
-
}
-
/* Here we test to see if we actually got a METAR. */
- if (is_array($file)) {
-
+ if (isset($file) and is_array($file)) {
/* The first line in the file is the date */
$date = trim(array_shift($file));
-
/* The remaining lines are the METAR itself. This will merge the
* remaining lines into one line by removing new-lines:
*/
@@ -257,8 +261,7 @@
*/
$date[1]--;
}
- $timestamp = gmmktime($date[3], $date[4], 0, $date[1],
- $date[2], $date[0]);
+ $timestamp = gmmktime($date[3], $date[4], 0, $date[1], $date[2], $date[0]);
if (!ereg('[0-9]{6}Z', $metar)) {
/* Some reports don't even have a time-part, so we insert the
|
|
From: Mihaly G. <mis...@us...> - 2002-08-27 17:37:43
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv13902 Modified Files: stations.csv Log Message: Adding accents to Hungarian station names, according to iso-8859-1 code. Index: stations.csv =================================================================== RCS file: /cvsroot/phpweather/phpweather/stations.csv,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- stations.csv 28 May 2002 13:11:58 -0000 1.8 +++ stations.csv 27 Aug 2002 17:37:40 -0000 1.9 @@ -1914,18 +1914,18 @@ VHHH;Hong Kong Inter-National Airport ## HU;Hungary ## -LHBC;Bekescsaba -LHBS;Budaors +LHBC;Békéscsaba +LHBS;Budaörs LHBP;Budapest / Ferihegy LHBM;Budapest Met Center LHDC;Debrecen -LHKV;Kaposvar -LHKE;Kecskemet +LHKV;Kaposvár +LHKE;Kecskemét LHMC;Miskolc -LHNY;Nyiregyhaza / Napkor -LHPA;Papa -LHPP;Pecs / Pogany -LHSK;Siofok +LHNY;Nyiregyháza / Napkor +LHPA;Pápa +LHPP;Pécs / Pogány +LHSK;Siófok LHUD;Szeged LHSN;Szolnok LHSY;Szombathely |