phpweather-checkins Mailing List for PHP Weather (Page 10)
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-06-20 11:19:58
|
Update of /cvsroot/phpweather/phpweather-1.x In directory usw-pr-cvs1:/tmp/cvs-serv1229 Modified Files: locale_es.inc Log Message: Update from Diego Torres <dt...@co...>. Index: locale_es.inc =================================================================== RCS file: /cvsroot/phpweather/phpweather-1.x/locale_es.inc,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- locale_es.inc 4 Apr 2002 16:38:11 -0000 1.4 +++ locale_es.inc 20 Jun 2002 11:19:55 -0000 1.5 @@ -130,7 +130,7 @@ 'SKC' => 'despejado', 'CLR' => 'despejado', 'VV' => 'visibilidad vertical', - 'FEW' => 'un poco', + 'FEW' => 'unas pocas nubes', 'SCT' => 'dispersas', 'BKN' => 'discontinuo', 'OVC' => 'nublado'); |
From: Martin G. <gim...@us...> - 2002-06-20 11:17:39
|
Update of /cvsroot/phpweather/phpweather/output In directory usw-pr-cvs1:/tmp/cvs-serv1009 Modified Files: pw_text_es.php Log Message: Ups - no default value for the $input variable. Index: pw_text_es.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/output/pw_text_es.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- pw_text_es.php 31 May 2002 14:11:20 -0000 1.2 +++ pw_text_es.php 20 Jun 2002 11:17:35 -0000 1.3 @@ -17,7 +17,7 @@ * * @param array This is just passed on to locale_common() */ - function pw_text_es($weather, $input) { + function pw_text_es($weather, $input = array()) { $this->strings['charset'] = 'ISO-8859-1'; $this->strings['no_data'] = 'Datos no disponibles para %s%s%s.'; $this->strings['list_sentences_and'] = ' y '; |
From: Martin G. <gim...@us...> - 2002-06-13 21:59:15
|
Update of /cvsroot/phpweather/phpweather-1.x In directory usw-pr-cvs1:/tmp/cvs-serv18322 Modified Files: phpweather.inc Log Message: The arguments passed to pow() are now explicitly casted to float. Index: phpweather.inc =================================================================== RCS file: /cvsroot/phpweather/phpweather-1.x/phpweather.inc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- phpweather.inc 17 May 2002 22:12:13 -0000 1.5 +++ phpweather.inc 13 Jun 2002 21:59:07 -0000 1.6 @@ -961,9 +961,9 @@ $decoded_metar['wind_miles_per_hour'] > '3'){ $decoded_metar['windchill_f'] = number_format(35.74 + 0.6215 * $decoded_metar['temp_f'] - - 35.75 * pow($decoded_metar['wind_miles_per_hour'], 0.16) + + 35.75 * pow((float)$decoded_metar['wind_miles_per_hour'], 0.16) + 0.4275 * $decoded_metar['temp_f'] * - pow($decoded_metar['wind_miles_per_hour'],0.16)); + pow((float)$decoded_metar['wind_miles_per_hour'],0.16)); $decoded_metar['windchill_c'] = number_format(13.112 + 0.6215 * $decoded_metar['temp_c'] - 13.37 * pow(($decoded_metar['wind_miles_per_hour']/1.609), 0.16) + |
From: Max H. <ir...@us...> - 2002-06-04 12:11:31
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv22949 Added Files: currentimage.php Log Message: New file to return the current sky image as an image directly. See file for usage notes. --- NEW FILE --- <?php /* * currentimage.php * Return the current weather icon directly. - Can be used from * HTML rather than PHP files. * * Use: <img src="currentimage.php?icao=abcd" /> in your html * */ error_reporting(E_NONE); require('phpweather.php'); $weather = new phpweather(array()); $weather->set_icao($icao); include(PHPWEATHER_BASE_DIR . "/output/pw_images.php"); $icons = new pw_images($weather, array()); header('Content-Type: image/gif'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 readfile($icons->get_sky_image()); ?> |
From: Max H. <ir...@us...> - 2002-05-31 14:11:23
|
Update of /cvsroot/phpweather/phpweather/output In directory usw-pr-cvs1:/tmp/cvs-serv4957 Modified Files: pw_text_es.php Log Message: Fixed for feelslike Index: pw_text_es.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/output/pw_text_es.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- pw_text_es.php 29 May 2002 15:32:44 -0000 1.1 +++ pw_text_es.php 31 May 2002 14:11:20 -0000 1.2 @@ -98,8 +98,7 @@ $this->strings['hPa'] = ' hPa'; $this->strings['inHg'] = ' inHg'; $this->strings['rel_humidity'] = ' Había una humedad relativa del '; - $this->strings['windchill'] = ' La sensación térmica por efecto del viento era de '; - $this->strings['heatindex'] = ' La sensación térmica por efecto de la humedad era de '; + $this->strings['feelslike'] = ' La sensación térmica era de '; $this->strings['cloud_group_beg'] = ' En cuanto a la nubosidad, '; $this->strings['cloud_group_end'] = '.'; $this->strings['cloud_clear'] = ' El cielo estaba %sdespejado%s.'; |
From: Martin G. <gim...@us...> - 2002-05-29 20:43:01
|
Update of /cvsroot/phpweather/phpweather/config In directory usw-pr-cvs1:/tmp/cvs-serv13795 Modified Files: make_config.php make_db.php make_stations.php pw_option_text.php pw_optiongroup.php Log Message: Hmm, the validator is quite picky... Index: make_config.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/make_config.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- make_config.php 29 May 2002 20:12:35 -0000 1.2 +++ make_config.php 29 May 2002 20:42:56 -0000 1.3 @@ -346,7 +346,7 @@ </head> <body> -<script language="JavaScript1.2"> +<script type="text/javascript"> function update(accepted, error, value, output) { if (accepted) { document.getElementById(output).innerHTML = "<font color=\"green\">Input accepted.</font>"; @@ -401,11 +401,11 @@ options might appear. Continue to change the options until they all say <span style="color: green">Input accepted.</span></p> -<form action="<? echo $PHP_SELF . '?' . SID ?>" method="POST"> +<form action="<? echo $PHP_SELF . '?' . SID ?>" method="post"> <p>You can <input type="submit" name="download" value="Download the -Configuration"> or <input type="reset" value="Reset Everything" -onclick="document.location='reset_session.php'"></p> +Configuration" /> or <input type="reset" value="Reset Everything" +onclick="document.location='reset_session.php'" /></p> <dl> <?php Index: make_db.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/make_db.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- make_db.php 29 May 2002 20:12:35 -0000 1.2 +++ make_db.php 29 May 2002 20:42:56 -0000 1.3 @@ -37,7 +37,7 @@ remove any cached METARs from the database, but they would have been removed sooner or later anyway, so this isn't a problem.</p> -<form action="make_db.php" method="POST"> +<form action="make_db.php" method="post"> <input type="submit" name="do_sql" value="Create or Recreate Tables" /> </form> Index: make_stations.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/make_stations.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- make_stations.php 29 May 2002 20:12:35 -0000 1.2 +++ make_stations.php 29 May 2002 20:42:56 -0000 1.3 @@ -66,7 +66,7 @@ <p>Click the button below to download the updated <code>stations.csv</code>:</p> -<form action="make_stations.php" method="POST"> +<form action="make_stations.php" method="post"> <input type="submit" name="make_stations" value="Download stations.cvs" /> </form> Index: pw_option_text.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/pw_option_text.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- pw_option_text.php 9 Apr 2002 23:21:37 -0000 1.2 +++ pw_option_text.php 29 May 2002 20:42:56 -0000 1.3 @@ -12,7 +12,7 @@ echo '<input type="text" name="' . $this->name . '_value" value="' . htmlentities($this->value) . '" onkeyup="' . $this->validator->get_javascript($this->name) . - "\"></dt>\n"; + "\" /></dt>\n"; echo '<dd><p>' . $this->description . "</p>\n"; if ($this->is_valid()) { echo '<p id="' . $this->name . '"><font color="green">Input accepted.</font></p>'; Index: pw_optiongroup.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/pw_optiongroup.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- pw_optiongroup.php 14 Apr 2002 18:27:40 -0000 1.3 +++ pw_optiongroup.php 29 May 2002 20:42:56 -0000 1.4 @@ -79,12 +79,12 @@ $style = 'block'; $text = 'Hide options.'; echo '<input id="' . $this->id . '_input" type="hidden" name="' . - $this->id . '_visible" value="1">' . "\n"; + $this->id . '_visible" value="1" />' . "\n"; } else { $style = 'none'; $text = 'Show options.'; echo '<input id="' . $this->id . '_input" type="hidden" name="' . - $this->id . '_visible" value="0">' . "\n"; + $this->id . '_visible" value="0" />' . "\n"; } echo "<dt>$this->title</dt>\n"; echo "<dd><p>$this->description</p>\n"; |
From: Martin G. <gim...@us...> - 2002-05-29 20:12:37
|
Update of /cvsroot/phpweather/phpweather/config In directory usw-pr-cvs1:/tmp/cvs-serv3525 Modified Files: index.php make_config.php make_db.php make_stations.php speed_test.php Log Message: More cleanups. The new stylesheet is used, and I hope that the files can be validated as XHTML documents. Index: index.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/index.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- index.php 28 May 2002 13:40:13 -0000 1.8 +++ index.php 29 May 2002 20:12:35 -0000 1.9 @@ -1,77 +1,69 @@ +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "DTD/xhtml1-transitional.dtd"> <html> - <head> - <title>Configuration of PHP Weather</title> - <style type="text/css"> -<!-- -BODY { - font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; - font-size: small; -} - -DT { - font-weight: bold -} - -P { - margin-top: 0.5em; - margin-bottom: 0.5em; -} - - --> - </style> - </head> - <body> - - <img src="../icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> - - <h1>Configuration of PHP Weather</h1> - - <p>This is the place where you configurate PHP Weather. You'll need - to complete two steps to fully utilise PHP Weather: make a local - configuration file with information about which database to use, - and then create the database.</p> - - <p>It's save to leave these pages unprotected as they wont do - anything destructive. You cannot actually change the configuration - of PHP Weather using these pages, instead you download a new - configuration-file which you'll have to upload to the webserver - before it becomes effective. The <a href="make_db.php">Database - Builder</a> will also just recreate the existing tables - nothing - permanent will be deleted.</p> - - <dl> - <dt><a href="make_config.php">Configuration Builder</a></dt> - - <dd><p>Use this page to build a custom configuration-file for PHP - Weather.</p></dd> - - <dt><a href="make_db.php">Database Builder</a></dt> - - <dd><p>After you've made a custom configuration using the link - above, you'll need to use this page to create the database and fill - it with data.</p></dd> - - <dt><a href="make_stations.php">Regenerate Stations Database</a></dt> - - <dd><p>Use this page to update the file <code>stations.csv</code> - with the data from your database. This file contains a list of - stations in a human-readable format and it it used by the <a - href="make_db.php">Database Builder</a> to populate the database - with data.</p></dd> - - <dt><a href="speed_test.php">Speed Test</a></dt> - - <dd><p>If you've configured PHP Weather to use a database, then you - might be interested in knowing how long it takes to access the - data in the database. This is what this page is for, it will - meassure the time it takes for PHP Weather to retrieve and - display a large number of METARs.</p> - - <p>If you have several different databases available to you, then - you can compare them using this page.</p> - </dd> +<head> + <link rel="stylesheet" type="text/css" href="../pw_style.css" /> + <title>Configuration of PHP Weather</title> +</head> +<body> + +<img src="../icons/phpweather-long-white.gif" width="187" height="50" +alt="PHP Weather" align="right" /> + +<h1>Configuration of PHP Weather</h1> + +<p>This is the place where you configurate PHP Weather. You'll need to +complete two steps to fully utilise PHP Weather: make a local +configuration file with information about which database to use, and +then create the database.</p> + +<p>It's save to leave these pages unprotected as they wont do anything +destructive. You cannot actually change the configuration of PHP +Weather using these pages, instead you download a new +configuration-file which you'll have to upload to the webserver before +it becomes effective. The <a href="make_db.php">Database Builder</a> +will also just recreate the existing tables - nothing permanent will +be deleted.</p> - </dl> +<dl> + <dt><a href="make_config.php">Configuration Builder</a></dt> - </body> + <dd> + <p>Use this page to build a custom configuration-file for PHP + Weather.</p> + </dd> + + <dt><a href="make_db.php">Database Builder</a></dt> + + <dd> + <p>After you've made a custom configuration using the link + above, you'll need to use this page to create the database and fill + it with data.</p> + </dd> + + <dt><a href="make_stations.php">Regenerate Stations Database</a></dt> + + <dd> + <p>Use this page to update the file <code>stations.csv</code> + with the data from your database. This file contains a list of + stations in a human-readable format and it it used by the <a + href="make_db.php">Database Builder</a> to populate the database + with data.</p> + </dd> + + <dt><a href="speed_test.php">Speed Test</a></dt> + + <dd><p>If you've configured PHP Weather to use a database, then you + might be interested in knowing how long it takes to access the + data in the database. This is what this page is for, it will + meassure the time it takes for PHP Weather to retrieve and + display a large number of METARs.</p> + + <p>If you have several different databases available to you, then + you can compare them using this page.</p> + </dd> +</dl> + +</body> </html> Index: make_config.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/make_config.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- make_config.php 15 May 2002 22:26:50 -0000 1.1 +++ make_config.php 29 May 2002 20:12:35 -0000 1.2 @@ -109,7 +109,8 @@ array('en' => 'English', 'da' => 'Danish', 'hu' => 'Hungarian', - 'no' => 'Norwegian')); + 'no' => 'Norwegian', + 'es' => 'Spanish')); $options['offset'] = new pw_option_integer('offset', @@ -335,26 +336,13 @@ ?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "DTD/xhtml1-transitional.dtd"> <html> <head> + <link rel="stylesheet" type="text/css" href="../pw_style.css" /> <title>Configuration Builder for PHP Weather</title> - <style type="text/css"> -<!-- -BODY { - font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; - font-size: small; -} - -DT { - font-weight: bold -} - -P { - margin-top: 0.5em; - margin-bottom: 0.5em; -} ---> - </style> </head> <body> @@ -401,45 +389,51 @@ } </script> -<img src="../icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> +<img src="../icons/phpweather-long-white.gif" width="187" height="50" +alt="PHP Weather" align="right" /> + <h1>Configuration Builder for PHP Weather</h1> <p>This is the Configuretor shipped with PHP Weather.</p> <p>Change the options below - when you're done, then press one of the -'Update Configuration' buttons. Depending on your choices, more options -might appear. Continue to change the options until they all say <span style="color: green">Input accepted.</span></p> +'Update Configuration' buttons. Depending on your choices, more +options might appear. Continue to change the options until they all +say <span style="color: green">Input accepted.</span></p> - <form action="<? echo $PHP_SELF . '?' . SID ?>" method="POST"> +<form action="<? echo $PHP_SELF . '?' . SID ?>" method="POST"> -<p>You can <input type="submit" name="download" value="Download the Configuration"> or <input type="reset" value="Reset Everything" onclick="document.location='reset_session.php'"></p> +<p>You can <input type="submit" name="download" value="Download the +Configuration"> or <input type="reset" value="Reset Everything" +onclick="document.location='reset_session.php'"></p> - <dl> - <?php +<dl> + <?php + $general_group->show(); + $db_group->show(); + $rendering_group->show(); + ?> +</dl> - $general_group->show(); - $db_group->show(); - $rendering_group->show(); +<p><input type="submit" value="Update options"></p> - ?> - </dl> +<p>This is a configuration file bases on your answers above:</p> - <p><input type="submit" value="Update options"></p> +<?php highlight_string($config); ?> - <p>This is a configuration file bases on your answers above:</p> +<p>You should copy the above configuration to a file called +<code>defaults.php</code> in the root directory of your PHP Weather +installation. It's very important that the lines with <code><font +color="#0000CC"><?php</font></code> and <code><font +color="#0000CC">?></font></code> are the very first and very last, +respectively. There should be no blank lines outside these two +tags.</p> - <?php highlight_string($config); ?> +<p>You can also <input type="submit" name="download" value="Download +the Configuration"> or <input type="reset" value="Reset Everything" +onclick="document.location='reset_session.php'"></p> - <p>You should copy the above configuration to a file called - <code>defaults.php</code> in the root directory of your PHP Weather - installation. It's very important that the lines with <code><font - color="#0000CC"><?php</font></code> and <code><font - color="#0000CC">?></font></code> are the very first and very last, - respectively. There should be no blank lines outside these two tags.</p> - -<p>You can also <input type="submit" name="download" value="Download the Configuration"> or <input type="reset" value="Reset Everything" onclick="document.location='reset_session.php'"></p> +</form> - </form> - - </body> +</body> </html> Index: make_db.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/make_db.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- make_db.php 15 May 2002 22:26:50 -0000 1.1 +++ make_db.php 29 May 2002 20:12:35 -0000 1.2 @@ -1,27 +1,16 @@ +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "DTD/xhtml1-transitional.dtd"> <html> <head> + <link rel="stylesheet" type="text/css" href="../pw_style.css" /> <title>Database Builder for PHP Weather</title> - <style type="text/css"> -<!-- -BODY { - font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; - font-size: small; -} - -DT { - font-weight: bold -} - -P { - margin-top: 0.5em; - margin-bottom: 0.5em; -} ---> - </style> </head> <body> -<img src="../icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> +<img src="../icons/phpweather-long-white.gif" width="187" height="50" +alt="PHP Weather" align="right" /> + <h1>Database Builder for PHP Weather</h1> <p>This is the tool you use to create the tables used by PHP Weather. @@ -49,10 +38,9 @@ removed sooner or later anyway, so this isn't a problem.</p> <form action="make_db.php" method="POST"> -<input type="submit" name="do_sql" value="Create or Recreate Tables"> +<input type="submit" name="do_sql" value="Create or Recreate Tables" /> </form> - <?php if (!empty($HTTP_POST_VARS['do_sql'])) { @@ -88,7 +76,7 @@ echo "<p>Data about <b>$num_rows</b> stations from " . "<b>$num_countries</b> countries were inserted.</p>\n"; } else { - echo "<p>The was a problem with the creation of the tables!</p>\n"; + echo "<p>There was a problem with the creation of the tables!</p>\n"; } echo "</blockquote>\n"; } Index: make_stations.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/make_stations.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- make_stations.php 28 May 2002 13:40:13 -0000 1.1 +++ make_stations.php 29 May 2002 20:12:35 -0000 1.2 @@ -36,30 +36,19 @@ } ?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "DTD/xhtml1-transitional.dtd"> <html> <head> + <link rel="stylesheet" type="text/css" href="../pw_style.css" /> <title>Stations Database Rebuilder for PHP Weather</title> - <style type="text/css"> -<!-- -BODY { - font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; - font-size: small; -} - -DT { - font-weight: bold -} - -P { - margin-top: 0.5em; - margin-bottom: 0.5em; -} ---> - </style> </head> <body> -<img src="../icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> +<img src="../icons/phpweather-long-white.gif" width="187" height="50" +alt="PHP Weather" align="right" /> + <h1>Stations Database Rebuilder for PHP Weather</h1> <p>You can use this page to regenerate the <code>stations.csv</code> @@ -72,12 +61,13 @@ stations in your database, but haven't updated the <code>stations.csv</code> file accordingly. You can then add the updated <code>stations.csv</code> file as a <a -href="https://sourceforge.net/tracker/?atid=377954&group_id=23245&func=browse">patch</a>.</p> +href="https://sourceforge.net/tracker/?atid=377954&group_id=23245&func=browse">patch</a>.</p> -<p>Click the button below to download the updated <code>stations.csv</code>:</p> +<p>Click the button below to download the updated +<code>stations.csv</code>:</p> <form action="make_stations.php" method="POST"> -<input type="submit" name="make_stations" value="Download stations.cvs"> +<input type="submit" name="make_stations" value="Download stations.cvs" /> </form> </body> Index: speed_test.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/speed_test.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- speed_test.php 20 May 2002 15:52:59 -0000 1.1 +++ speed_test.php 29 May 2002 20:12:35 -0000 1.2 @@ -2,30 +2,14 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> - <head> - <title>PHP Weather Speed Test</title> - <style type="text/css"> -<!-- -BODY { - font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; - font-size: small; -} - -DT { - font-weight: bold -} - -P { - margin-top: 0.5em; - margin-bottom: 0.5em; -} - - --> - </style> +<head> + <link rel="stylesheet" type="text/css" href="../pw_style.css" /> + <title>PHP Weather Speed Test</title> </head> <body> -<img src="../icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> +<img src="../icons/phpweather-long-white.gif" width="187" height="50" +alt="PHP Weather" align="right" /> <h1>PHP Weather Speed Test</h1> @@ -51,8 +35,8 @@ echo $count ?> different METARs. This will take a long time at first because PHP Weather has to retrieve the METARs from the Internet, but the second time you use this page it should go much faster because the -METARs can be retrieved from the database - that is, if you've configured PHP -Weather to use a database.</p> +METARs can be retrieved from the database - that is, if you've +configured PHP Weather to use a database.</p> <p>Select the number of METARs to use: <a href="<?php echo $PHP_SELF ?>?batches=1">32</a>, @@ -97,6 +81,9 @@ 'KSPF', 'KPHN', 'KSBS', 'KTCM', 'KTPL', 'PATG', 'KTVC', 'KTCL', 'PAVD', 'KVEL', 'PAFB', 'KRYV', 'KWYS', 'PAWR', 'KILL', 'KINK')); +echo "<h2>Processing " . ($batches * 32) . " METARs</h2>\n"; +flush(); + $start_time = explode(' ', microtime()); require_once('../phpweather.php'); @@ -114,14 +101,19 @@ $output = "\n<!-- " . $weather->get_metar() . " -->\n"; $output = "\n<!-- " . $text->print_pretty() . " -->\n"; } + echo "<p>Processed " . (($i+1) * 32) . " METARs...</p>\n"; + flush(); } $end_time = explode(' ', microtime()); $diff = ($end_time[0] + $end_time[1]) - ($start_time[0] + $start_time[1]); -echo "<p>Total time used to process $count METARs: <b>" . number_format($diff * 1000, 0) . " ms</b>.</p>\n"; -echo '<p>Time used per METAR: <b>' . number_format($diff * 1000 / ($batches*32), 1) . " ms</b>.</p>\n"; +echo "<p>Total time used to process $count METARs: <b>" . + number_format($diff * 1000, 0) . " ms</b>.</p>\n"; + +echo '<p>Time used per METAR: <b>' . + number_format($diff * 1000 / ($batches*32), 1) . " ms</b>.</p>\n"; ?> |
From: Martin G. <gim...@us...> - 2002-05-29 20:11:12
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv3223 Modified Files: index.php Added Files: pw_style.css Log Message: Cleanups... I've added a stylesheet since we're starting to have a couple of XHTML pages by now. --- NEW FILE --- /* Stylesheet for PHP Weather. */ BODY { font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; font-size: small; } DT { font-weight: bold } P { margin-top: 0.5em; margin-bottom: 0.5em; } Index: index.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/index.php,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- index.php 20 May 2002 15:51:37 -0000 1.31 +++ index.php 29 May 2002 20:11:09 -0000 1.32 @@ -14,25 +14,21 @@ "DTD/xhtml1-transitional.dtd"> <html> <head> + <link rel="stylesheet" type="text/css" href="pw_style.css" /> <title>PHP Weather - test</title> - <style type="text/css"> -<!-- -BODY { - font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; - font-size: 13px; -} - --> - </style> </head> <body> -<img src="icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> +<img src="icons/phpweather-long-white.gif" width="187" height="50" +alt="PHP Weather" align="right" /> <h1>PHP Weather Test Page</h1> -<p>This is the default test page for PHP Weather. For more information, please visit -<a href="http://www.phpweather.net">http://www.phpweather.net</a>.</p> -<p>Data is taken from the <a href="http://weather.noaa.gov">National Weather Service</a> at NOAA.</p> +<p>This is the default test page for PHP Weather. For more +information, please visit <a +href="http://www.phpweather.net">http://www.phpweather.net</a>.</p> +<p>Data is taken from the <a href="http://weather.noaa.gov">National +Weather Service</a> at NOAA.</p> '; |
From: Martin G. <gim...@us...> - 2002-05-29 19:16:24
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv16594 Modified Files: AUTHORS Log Message: Great! A Spanish translation of PHP Weather. Index: AUTHORS =================================================================== RCS file: /cvsroot/phpweather/phpweather/AUTHORS,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- AUTHORS 24 Mar 2002 20:13:01 -0000 1.3 +++ AUTHORS 29 May 2002 19:16:20 -0000 1.4 @@ -71,3 +71,6 @@ Max Hammond <ma...@fl...> Lots of different things: bugfixes, clever suggestions, and general maintenance. + +Jesús Peñas <jp...@ed...> + Made the Spanish translation. |
From: Max H. <ir...@us...> - 2002-05-29 15:32:49
|
Update of /cvsroot/phpweather/phpweather/output In directory usw-pr-cvs1:/tmp/cvs-serv23543 Added Files: pw_text_es.php Log Message: Added Spanish translation, thanks to Jesús Peñas <jp...@ed...> --- NEW FILE --- <?php require_once(PHPWEATHER_BASE_DIR . '/output/pw_text.php'); /** * Provides all the strings needed by pw_text to produce Spanish * output. * * @author Jesús Peñas <jp...@ed...> * @link http://www.educaplus.org/ My homepage. * @version $Id: pw_text_es.php,v 1.1 2002/05/29 15:32:44 iridium Exp $ */ class pw_text_es extends pw_text { /** * This constructor provides all the strings used. * * @param array This is just passed on to locale_common() */ function pw_text_es($weather, $input) { $this->strings['charset'] = 'ISO-8859-1'; $this->strings['no_data'] = 'Datos no disponibles para %s%s%s.'; $this->strings['list_sentences_and'] = ' y '; $this->strings['list_sentences_comma'] = ', '; $this->strings['list_sentences_final_and'] = ', y '; $this->strings['location'] = 'Informe meteorológico para %s%s%s.'; $this->strings['minutes'] = ' minutos'; $this->strings['time_format'] = ' El informe se hizo hace %s, a las %s%s%s UTC.'; $this->strings['time_minutes'] = 'y %s%s%s minutos'; $this->strings['time_one_hour'] = '%suna%s hora %s'; $this->strings['time_several_hours'] = '%s%s%s horas %s'; $this->strings['time_a_moment'] = 'un momento'; $this->strings['meters_per_second'] = ' m/s'; $this->strings['miles_per_hour'] = ' millas por hora'; $this->strings['meter'] = ' metros'; $this->strings['meters'] = ' metros'; $this->strings['feet'] = ' pies'; $this->strings['kilometers'] = ' kilómetros'; $this->strings['miles'] = ' millas'; $this->strings['and'] = ' y '; $this->strings['plus'] = ' además de '; $this->strings['with'] = ' con '; $this->strings['wind_blowing'] = ' El viento soplaba a una velocidad de '; $this->strings['wind_with_gusts'] = ' con ráfagas de '; $this->strings['wind_from'] = ' del '; $this->strings['wind_variable'] = ' con %sdirección variable%s'; $this->strings['wind_varying'] = ', variando entre %s%s%s (%s%sº%s) y %s%s%s (%s%sº%s)'; $this->strings['wind_calm'] = ' El aire estaba en %scalma%s'; $this->strings['wind_dir'] = array( 'norte', 'norte-noreste', 'noreste', 'este-noreste', 'este', 'este-sureste', 'sureste', 'sur-sureste', 'sur', 'sur-suroeste', 'suroeste', 'oeste-suroeste', 'oeste', 'oeste-noroeste', 'noroeste', 'norte-noroeste', 'norte'); $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' => 'norte', 'NE' => 'noreste', 'E' => 'este', 'SE' => 'sureste', 'S' => 'sur', 'SW' => 'suroeste', 'W' => 'oeste', 'NW' => 'noroeste' ); $this->strings['temperature'] = ' La temperatura era '; $this->strings['dew_point'] = ', con un punto de rocío de '; $this->strings['altimeter'] = ' La presión atmosférica era '; $this->strings['hPa'] = ' hPa'; $this->strings['inHg'] = ' inHg'; $this->strings['rel_humidity'] = ' Había una humedad relativa del '; $this->strings['windchill'] = ' La sensación térmica por efecto del viento era de '; $this->strings['heatindex'] = ' La sensación térmica por efecto de la humedad era de '; $this->strings['cloud_group_beg'] = ' En cuanto a la nubosidad, '; $this->strings['cloud_group_end'] = '.'; $this->strings['cloud_clear'] = ' El cielo estaba %sdespejado%s.'; $this->strings['cloud_height'] = ' a una altitud de '; $this->strings['cloud_overcast'] = 'cielo %snublado%s a partir de los '; $this->strings['cloud_vertical_visibility'] = 'la %svisibilidad vertical%s era '; $this->strings['cloud_condition'] = array( 'SKC' => 'despejado', 'CLR' => 'despejado', 'FEW' => 'algunas nubes', 'SCT' => 'nubes dispersas', 'BKN' => 'nubosidad discontinua', 'OVC' => 'nublado'); $this->strings['cumulonimbus'] = ' tipo cumulonimbos'; //towering_cumulus son nubes de desarrollo vertical (cumulus congestus) $this->strings['towering_cumulus'] = ' tipo cúmulos'; $this->strings['cavok'] = ' sin nubes por debajo de %s y sin presencia de cumulonimbos'; $this->strings['currently'] = ' Actualmente '; $this->strings['weather'] = array( '-' => ' leve', ' ' => ' moderada ', '+' => ' fuerte ', 'VC' => ' en las proximidades', 'PR' => ' parcial', 'BC' => ' bancos de', 'MI' => ' baja', 'DR' => ' de tendencia descendente', 'BL' => ' soplando', 'SH' => ' chubascos,', 'TS' => ' tormenta', 'FZ' => ' helada', 'DZ' => ' llovizna', 'RA' => ' lluvia', 'SN' => ' nieve', 'SG' => ' cinarra', 'IC' => ' cristales de hielo', 'PL' => ' hielo granulado', 'GR' => ' granizo', 'GS' => ' granizo pequeño', 'UP' => ' desconocido', 'BR' => ' neblina', 'FG' => ' niebla', 'FU' => ' humo', 'VA' => ' ceniza volcánica', 'DU' => ' polvareda', 'SA' => ' arena', 'HZ' => ' calima', 'PY' => ' rocío', 'PO' => ' probable aparición de remolinos de polvo o arena', 'SQ' => ' turbonadas', 'FC' => ' trombas/tornados/huracanes', 'SS' => ' tempestad de arena o polvo'); $this->strings['visibility'] = ' En este momento la visibilidad global era '; $this->strings['visibility_greater_than'] = 'mayor de '; $this->strings['visibility_less_than'] = 'menor de '; $this->strings['visibility_to'] = ' de '; $this->strings['runway_upward_tendency'] = ' con tendencia a %subir%s'; $this->strings['runway_downward_tendency'] = ' con tendencia a %sbajar%s'; $this->strings['runway_no_tendency'] = ' %ssin%s tendencia marcada'; $this->strings['runway_between'] = 'entre '; $this->strings['runway_left'] = ' izquierda'; $this->strings['runway_central'] = ' central'; $this->strings['runway_right'] = ' derecha'; $this->strings['runway_visibility'] = ' La visibilidad era '; $this->strings['runway_for_runway'] = ' para la pista '; /* We run the parent constructor */ $this->pw_text($weather, $input); } /** * Function used to parse a weather-group. This one puts adjective after noun. * * @param array The weather-group to be parsed. The keys of the * weather-group tells you which kind of weather * you're dealing with. The value of the array is * the unparsed codes, like 'RA' for 'rain' etc. * * @access private * @return string The string used in the pretty-print. */ function parse_weather_group($weather_group) { if (empty($weather_group)) { return; } $output = ''; if (!empty($weather_group['descriptor'])) { /* The descriptor should be filled in */ if ($weather_group['descriptor'] == 'TS' && !empty($weather_group['precipitation'])) { /* Special case for thunderstorms. They use the extra * word 'with' between the descriptor (which would be * 'thunderstorm' in this case) and the precipitation. * But this is only true if there's also precipitation. */ $output .= $this->strings['weather'][$weather_group['descriptor']] . $this->strings['with']; } else { $output .= $this->strings['weather'][$weather_group['descriptor']]; } } /* There can only be one of the next three items. */ if (!empty($weather_group['precipitation'])) { // precipitation can be more than one kind - need to check for // this. explode precipitation into chunks of length 2 $precip = explode(' ', trim(chunk_split($weather_group['precipitation'], 2, ' '))); foreach($precip AS $ppnow){ $output .= $this->strings['weather'][$ppnow] . ', '; } $output = substr($output,0,-2); // trim off last comma } elseif (!empty($weather_group['obscuration'])) { $output .= $this->strings['weather'][$weather_group['obscuration']]; } elseif (!empty($weather_group['other'])) { $output .= $this->strings['weather'][$weather_group['other']]; } /* If the intensity is non-empty, we just add it. If not, it could * mean that we're dealing with some 'moderate' precipitation. * If so, 'precipitation' can't be empty. */ if (!empty($weather_group['intensity'])) { $output .= $this->strings['weather'][$weather_group['intensity']]; } elseif (!empty($weather_group['precipitation'])) { $output .= $this->strings['weather'][' ']; } /* 'proximity' can only be 'VC'. We test for it here instead of * earlier because it should be put last. */ if (!empty($weather_group['proximity'])) { $output .= $this->strings['weather'][$weather_group['proximity']]; } return $output; } } ?> |
From: Martin G. <gim...@us...> - 2002-05-28 14:34:03
|
Update of /cvsroot/phpweather/phpweather/config In directory usw-pr-cvs1:/tmp/cvs-serv23808 Modified Files: index.php Added Files: make_stations.php Log Message: 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. --- NEW FILE --- <?php if (!empty($HTTP_POST_VARS['make_stations'])) { header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename="stations.csv"'); define('PHPWEATHER_BASE_DIR', dirname(__FILE__) . '/..'); require_once(PHPWEATHER_BASE_DIR . '/db_layer.php'); $db = new db_layer(); $countries = $db->db->get_countries(); echo "# Comments start with *one* hash-mark (#). The countries are\n"; echo "# surrounded by *two* marks. They start with a ISO 3166-1-Alpha-2 code\n"; echo "# taken from\n"; echo "#\n"; echo "# http://www.iso.org/iso/en/prods-services/iso3166ma/index.html\n"; echo "#\n"; echo "# Original list made by Sven-Erik Andersen <sve...@an...>.\n\n"; foreach ($countries as $cc => $country) { $icaos = $db->db->get_icaos($cc, $country); asort($icaos); echo "\n## $cc;$country ##\n"; foreach ($icaos as $icao => $name) { echo "$icao;$name\n"; } } exit(); } ?> <html> <head> <title>Stations Database Rebuilder for PHP Weather</title> <style type="text/css"> <!-- BODY { font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; font-size: small; } DT { font-weight: bold } P { margin-top: 0.5em; margin-bottom: 0.5em; } --> </style> </head> <body> <img src="../icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> <h1>Stations Database Rebuilder for PHP Weather</h1> <p>You can use this page to regenerate the <code>stations.csv</code> file for PHP Weather. This file contains the names for the stations known to PHP Weather in a human-readable format. It's only used when you build the files/tables with the <a href="make_db.php">Database Builder</a>.</p> <p>You'll use this page if you've made massive changes to the list of stations in your database, but haven't updated the <code>stations.csv</code> file accordingly. You can then add the updated <code>stations.csv</code> file as a <a href="https://sourceforge.net/tracker/?atid=377954&group_id=23245&func=browse">patch</a>.</p> <p>Click the button below to download the updated <code>stations.csv</code>:</p> <form action="make_stations.php" method="POST"> <input type="submit" name="make_stations" value="Download stations.cvs"> </form> </body> </html> Index: index.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/index.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- index.php 20 May 2002 15:53:18 -0000 1.7 +++ index.php 28 May 2002 13:40:13 -0000 1.8 @@ -51,6 +51,14 @@ above, you'll need to use this page to create the database and fill it with data.</p></dd> + <dt><a href="make_stations.php">Regenerate Stations Database</a></dt> + + <dd><p>Use this page to update the file <code>stations.csv</code> + with the data from your database. This file contains a list of + stations in a human-readable format and it it used by the <a + href="make_db.php">Database Builder</a> to populate the database + with data.</p></dd> + <dt><a href="speed_test.php">Speed Test</a></dt> <dd><p>If you've configured PHP Weather to use a database, then you |
From: Martin G. <gim...@gi...> - 2002-05-28 14:32:07
|
"Max Hammond" <ma...@fl...> writes: >> 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. >=20 > I think we'd do better to just look at the metars that are available > from the nws... in the end, that's all that matters. It just looks > bad if there's no data from half the stations. I agree - the NWS ought to be able to supply us with a list of working stations. =20 > I've been going through it, there are probably less than 30 new > metar-producing stations that we don't know. That few? I hoped we would see more... =2D-=20 Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather =3D> Shows the current weather on your webpage. PHP Shell =3D> A telnet-connection (almost :-) in a PHP page. |
From: Max H. <ma...@fl...> - 2002-05-28 13:38:28
|
> 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. I think we'd do better to just look at the metars that are available from the nws... in the end, that's all that matters. It just looks bad if there's no data from half the stations. I've been going through it, there are probably less than 30 new metar-producing stations that we don't know. Max |
From: Martin G. <gim...@us...> - 2002-05-28 13:34:03
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv11906 Modified Files: stations.csv Log Message: 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. Index: stations.csv =================================================================== RCS file: /cvsroot/phpweather/phpweather/stations.csv,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- stations.csv 10 May 2002 18:35:03 -0000 1.7 +++ stations.csv 28 May 2002 13:11:58 -0000 1.8 @@ -2,14 +2,22 @@ # surrounded by *two* marks. They start with a ISO 3166-1-Alpha-2 code # taken from # -# http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html -# -# A compilation of airports from -# http://weather.noaa.gov/weather/ccworld.html -# -# Made by Sven-Erik Andersen <sve...@an...> -# Liverpool -> Liverpool / John Lennon - modified by Mihaly Gyulai +# http://www.iso.org/iso/en/prods-services/iso3166ma/index.html [...4611 lines suppressed...] +FLSW;Solwezi +FLZB;Zambezi ## ZW;Zimbabwe ## +FVBB;Beitbridge +FVBI;Binga FVCZ;Buffalo Range FVBU;Bulawayo Airport +FVCH;Chipinge +FVGO;Gokwe FVTL;Gweru -FVHA;Harare Kutsaga +FVHA;Harare Kutsaga +FVWN;Hwange National Park +FVKB;Kariba +FVKA;Karoi FVMV;Masvingo +FVMT;Mutoko +FVRU;Rusape FVFA;Victoria Falls |
From: Martin G. <gim...@us...> - 2002-05-28 13:26:18
|
Update of /cvsroot/phpweather/phpweather/db In directory usw-pr-cvs1:/tmp/cvs-serv9211 Modified Files: pw_db_null.php Log Message: Fix the check for readability and remove the code that generated countries.php because this file now has all the countries in it anyway. Index: pw_db_null.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/pw_db_null.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- pw_db_null.php 20 Mar 2002 19:26:50 -0000 1.2 +++ pw_db_null.php 28 May 2002 13:26:15 -0000 1.3 @@ -134,7 +134,7 @@ * @access private */ function create_tables() { - return is_writable(PHPWEATHER_BASE_DIR . '/db'); + return is_writable(PHPWEATHER_BASE_DIR . '/db/files'); } /** @@ -186,21 +186,6 @@ fclose($fp); } - /* We also write a file with all the countries. */ - $fp = fopen(PHPWEATHER_BASE_DIR . '/db/files/countries.php', 'w'); - if ($fp) { - fputs($fp, "<?php\n/* File with names of all countries. */\n\n\$countries = array(\n"); - reset($countries); - list($cc, $country) = each($countries); - $country = addslashes($country); - fputs($fp, " '$cc' => '$country'"); - while(list($cc, $country) = each($countries)) { - $country = addslashes($country); - fputs($fp, ",\n '$cc' => '$country'"); - } - fputs($fp, "\n);\n\n?>\n"); - fclose($fp); - } return true; } |
From: Martin G. <gim...@us...> - 2002-05-28 13:24:33
|
Update of /cvsroot/phpweather/phpweather/db/files In directory usw-pr-cvs1:/tmp/cvs-serv7624 Modified Files: countries.php Log Message: I've update the file with the names of all countries, not just the ones used in stations.cvs at the moment. Index: countries.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/files/countries.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- countries.php 27 Jun 2001 11:18:21 -0000 1.1 +++ countries.php 28 May 2002 13:24:29 -0000 1.2 @@ -1,11 +1,21 @@ <?php -/* File with names of all countries. */ +/* A list of all the countries in the world taken from + * + * http://www.iso.org/iso/en/prods-services/iso3166ma/index.html + * + * The array map a ISO 3166-1-Alpha-2 code into the English short + * name. + */ $countries = array( + 'AF' => 'Afghanistan', 'AL' => 'Albania', 'DZ' => 'Algeria', + 'AS' => 'American Samoa', + 'AD' => 'Andorra', 'AO' => 'Angola', - 'AQ' => 'Antarctic', + 'AI' => 'Anguilla', + 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', @@ -22,12 +32,16 @@ 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', + 'BT' => 'Bhutan', 'BO' => 'Bolivia', + 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', + 'BV' => 'Bouvet Island', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', + 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', @@ -39,9 +53,11 @@ 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', + 'CC' => 'Cocos (Keeling) Islands', 'CO' => 'Colombia', 'KM' => 'Comoros', 'CG' => 'Congo', + 'CD' => 'Congo, The Democratic Republic of', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'Cote D\'Ivoire', @@ -53,15 +69,22 @@ 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', + 'TL' => 'East Timor', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', + 'GQ' => 'Equatorial Guinea', + 'ER' => 'Eritrea', + 'EE' => 'Estonia', 'ET' => 'Ethiopia', + 'FK' => 'Falkland Islands (Malvinas)', + 'FO' => 'Faroe Islands', 'FJ' => 'Fiji', 'FI' => 'Finland', 'FR' => 'France', 'GF' => 'French Guiana', 'PF' => 'French Polynesia', + 'TF' => 'French Southern Territories', 'GA' => 'Gabon', 'GM' => 'Gambia', 'GE' => 'Georgia', @@ -72,11 +95,14 @@ 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadeloupe', + 'GU' => 'Guam', 'GT' => 'Guatemala', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', + 'HM' => 'Heard Island and McDonald Islands', + 'VA' => 'Holy See (Vatican City State)', 'HN' => 'Honduras', 'HK' => 'Hong Kong', 'HU' => 'Hungary', @@ -84,25 +110,31 @@ 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran, Islamic Republic of', + 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JO' => 'Jordan', - 'KZ' => 'Kazakhstan', + 'KZ' => 'Kazakstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => 'Korea, Democratic People\'s Republic of', 'KR' => 'Korea, Republic of', 'KW' => 'Kuwait', + 'KG' => 'Kyrgyzstan', 'LA' => 'Lao People\'s Democratic Republic', + 'LV' => 'Latvia', 'LB' => 'Lebanon', + 'LS' => 'Lesotho', + 'LR' => 'Liberia', 'LY' => 'Libyan Arab Jamahiriya', + 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macau', - 'MK' => 'Macedonia, the Former Yugoslav Republic of', + 'MK' => 'Macedonia, The Former Yugoslav Republic of', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', @@ -113,11 +145,17 @@ 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', + 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia, Federated States of', + 'MD' => 'Moldova, Republic of', + 'MC' => 'Monaco', + 'MN' => 'Mongolia', + 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar', + 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'NL' => 'Netherlands', @@ -126,14 +164,21 @@ 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', + 'NG' => 'Nigeria', + 'NU' => 'Niue', + 'NF' => 'Norfolk Island', + 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', + 'PS' => 'Palestinian Territory, Occupied', 'PA' => 'Panama', + 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', + 'PN' => 'Pitcairn', 'PL' => 'Poland', 'PT' => 'Portugal', 'PR' => 'Puerto Rico', @@ -145,8 +190,10 @@ 'SH' => 'Saint Helena', 'KN' => 'Saint Kitts and Nevis', 'LC' => 'Saint Lucia', + 'PM' => 'Saint Pierre and Miquelon', 'VC' => 'Saint Vincent and the Grenadines', 'WS' => 'Samoa', + 'SM' => 'San Marino', 'ST' => 'Sao Tome and Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', @@ -158,23 +205,28 @@ 'SB' => 'Solomon Islands', 'SO' => 'Somalia', 'ZA' => 'South Africa', + 'GS' => 'South Georgia and the South Sandwich Islands', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', + 'SJ' => 'Svalbard and Jan Mayen', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland', 'SY' => 'Syrian Arab Republic', - 'TW' => 'Taiwan', + 'TW' => 'Taiwan, Province of China', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania, United Republic of', 'TH' => 'Thailand', 'TG' => 'Togo', + 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', + 'TM' => 'Turkmenistan', + 'TC' => 'Turks and Caicos Islands', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', @@ -189,10 +241,12 @@ 'VN' => 'Viet Nam', 'VG' => 'Virgin Islands, British', 'VI' => 'Virgin Islands, U.S.', + 'WF' => 'Wallis and Futuna', + 'EH' => 'Western Sahara', 'YE' => 'Yemen', 'YU' => 'Yugoslavia', 'ZM' => 'Zambia', - 'ZW' => 'Zimbabwe' + 'ZW' => 'Zimbabwe', ); ?> |
From: Martin G. <gim...@us...> - 2002-05-20 17:41:21
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv31618 Modified Files: INSTALL Log Message: 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. Index: INSTALL =================================================================== RCS file: /cvsroot/phpweather/phpweather/INSTALL,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- INSTALL 27 Mar 2002 10:59:33 -0000 1.6 +++ INSTALL 20 May 2002 17:41:17 -0000 1.7 @@ -20,24 +20,19 @@ language, so have the weather for that city displayed in the chosen language. -For detailed information about using PHP Weather please -see the PHP Weather webpages at this address: - http://www.phpweather.net +Configuration and Database Setup +-------------------------------- +You'll want to configure PHP Weather to use a database as a cache for +the METARs it fetches so that things can go faster. -I've chosen to put the documentation there, because it's easier for me -to update. It also gives you a chance to see all the features of PHP -Weather in action. +To help you with this task you'll find a couple of scripts in the +config/ subdirectory. The make_config.php script helps you build a +configuration-file for PHP Weather and the make_db.php script will try +and make the necessary database tables for you after you've configured +PHP Weather. - -Database Setup --------------- -You should use the script configurator.php to create the database tables -that you need. Two tables are configured, one that holds METARs, and one -that holds a database of station names. - -The configurator currently asks you what you'd like to call a table of -countries - this table is not created. Don't panic. +Just follow the instructions in the relevant scripts. Bugs? |
From: Martin G. <gim...@us...> - 2002-05-20 16:04:39
|
Update of /cvsroot/phpweather/phpweather/db In directory usw-pr-cvs1:/tmp/cvs-serv32682 Modified Files: pw_db_pgsql.php Log Message: 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. Index: pw_db_pgsql.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/pw_db_pgsql.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- pw_db_pgsql.php 20 May 2002 15:47:08 -0000 1.4 +++ pw_db_pgsql.php 20 May 2002 16:04:36 -0000 1.5 @@ -27,18 +27,6 @@ /** - * The number of rows in the current result set. - * - * We store this here because we have to refer to it again and again - * in the fetch_row() and fetch_array() methods. - * - * @var integer - * @access private - */ - //var $num_rows = 0; - - - /** * This constructor makes sure that the PostgreSQL extension is * loaded and then calls the parent constructor. * @@ -162,9 +150,6 @@ $this->result_id = pg_exec($this->link_id, $query) or $this->error("SQL-statement failed: $query<br>PostgreSQL said " . pg_errormessage()); - - /* We can now update $this->num_rows: */ - //$this->num_rows = pg_numrows($this->result_id); /* The next row is the first row: */ $this->next_row = 0; @@ -213,7 +198,6 @@ */ function num_rows() { return pg_numrows($this->result_id); - //return $this->num_rows; } |
From: Martin G. <gim...@us...> - 2002-05-20 15:57:01
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv30484 Modified Files: ChangeLog Log Message: Updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/phpweather/phpweather/ChangeLog,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ChangeLog 18 Mar 2002 13:46:56 -0000 1.6 +++ ChangeLog 20 May 2002 15:56:58 -0000 1.7 @@ -1,3 +1,823 @@ +2002-05-20 15:53 Martin Geisler <gim...@gi...> + + * config/index.php: + + Added a link to speed_test.php. + +2002-05-20 15:52 Martin Geisler <gim...@gi...> + + * config/speed_test.php: + + I made this little file while I was playing with the different + database backends. + +2002-05-20 15:51 Martin Geisler <gim...@gi...> + + * index.php: + + Cosmetics... + +2002-05-20 15:50 Martin Geisler <gim...@gi...> + + * make-release.sh: + + Those .cvsignore files should also be removed from a release. + +2002-05-20 15:48 Martin Geisler <gim...@gi...> + + * db/pw_db_mysql.php: + + Some minor changes I made while I made the PostgreSQL backend. It's + now possible to use a non-standard port - that was ignored before. + +2002-05-20 15:47 Martin Geisler <gim...@gi...> + + * db/pw_db_pgsql.php: + + I've updated the PostgreSQL backend so that it actually works! :-) + I've tested it on my PostgreSQL database version 7.2.1 which is the + one that comes with Debian unstable. + +2002-05-18 09:20 Martin Geisler <gim...@gi...> + + * phpweather.php: + + It seams that pow() cannot handle floats passed to it as strings, + at least not in PHP 4.2.0 at gimpster.com. The strange thing is + that it works in PHP 4.1.2 at my local machine. + +2002-05-18 08:39 Martin Geisler <gim...@gi...> + + * phpweather.php: + + When the windchill and heatindex was calculated, the temperature + and windspeed was compared to strings and not integers. + + I also re-indented some of the code. + +2002-05-17 16:21 Martin Geisler <gim...@gi...> + + * output/pw_text_da.php: + + Updated with translation of 'feelslike'. + +2002-05-16 20:35 Martin Geisler <gim...@gi...> + + * output/pw_text_en.php: + + How did that happen? :-) + +2002-05-16 20:02 Martin Geisler <gim...@gi...> + + * output/: pw_text_da.php, pw_text_en.php, pw_text_hu.php, + pw_text_no.php: + + Made the second argument optional with these constructors as well. + +2002-05-16 19:52 Mihaly Gyulai gyulai.freeyellow.com/ + + * output/pw_text_hu.php: + + Translation of '...feels like'. + +2002-05-16 19:46 Max Hammond <ma...@fl...> + + * output/pw_text.php: + + rats + +2002-05-16 19:44 Max Hammond <ma...@fl...> + + * output/: pw_text.php, pw_text_da.php, pw_text_en.php, + pw_text_hu.php, pw_text_no.php: + + Combined windchill and heatindex into one 'feels like' - sorry + translators. I think this is a better solution + +2002-05-15 22:28 Martin Geisler <gim...@gi...> + + * configurator.php: + + This file is no longer needed now that /config/make_db.php handles + the creation of the necessary tables in the database. + +2002-05-15 22:26 Martin Geisler <gim...@gi...> + + * config/: index.php, make_config.php, make_db.php: + + I've moved the Configuration Builder from index.php to + make_config.php and added make_db.php which can be used to + (re)create the database. + +2002-05-15 22:23 Martin Geisler <gim...@gi...> + + * base_object.php, data_retrieval.php, db_layer.php, + phpweather.php, output/pw_images.php, output/pw_text.php: + + All constructors can now be called without any parameters - they + all use an empty array as the default. This was removed some time + ago because it didn't work in PHP3, but now that we're using PHP4 + it works again. + + I also made an extra check in output/pw_text.php so that missing + clouds no longer trigger a warning. + +2002-05-12 15:09 Max Hammond <ma...@fl...> + + * test.php: + + Made it work again + +2002-05-12 15:08 Max Hammond <ma...@fl...> + + * output/pw_text.php, output/pw_text_da.php, output/pw_text_en.php, + output/pw_text_hu.php, output/pw_text_no.php, phpweather.php: + + Added heat index, thanks to David Kjellquist + +2002-05-10 18:35 Max Hammond <ma...@fl...> + + * stations.csv: + + Added new spanish station + +2002-04-14 18:27 Martin Geisler <gim...@gi...> + + * config/: index.php, pw_optiongroup.php: + + Hehe - that was much easier that I thought... The optiongroups can + now be toggled on and off. The state is remembered when people + click the 'Update Configuration' button. + + I have (as usual) only tested this with Mozilla 0.9.9. + +2002-04-13 13:23 Martin Geisler <gim...@gi...> + + * phpweather.php: + + 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, + pw_dependency_or.php, pw_option.php, pw_optiongroup.php, + pw_validator_ereg.php, pw_validator_range.php: + + Added documentation. + +2002-04-12 22:10 Martin Geisler <gim...@gi...> + + * data_retrieval.php: + + We now use $this->properties['cache_timeout'] instead of the + hardcoded 3600 seconds. + +2002-04-12 22:07 Martin Geisler <gim...@gi...> + + * config/pw_validator.php: + + Added documentation. + +2002-04-12 22:07 Martin Geisler <gim...@gi...> + + * config/: pw_validator_range.php, pw_option.php: + + Documentation plus some minor bugfixes. + +2002-04-12 22:04 Martin Geisler <gim...@gi...> + + * config/index.php: + + Two new options were added: cache_timeout and offset. I've also + reindented the code. + +2002-04-12 22:01 Martin Geisler <gim...@gi...> + + * config/pw_option_integer.php: + + New wrapper-type: integers doesn't need to be quoted in + defaults.php. + +2002-04-12 22:00 Martin Geisler <gim...@gi...> + + * defaults-dist.php: + + Added a new option: cache_timeout. This is used to determine when a + METAR is old. The default value is 3600 seconds which was the value + used in data_retrieval before. + +2002-04-12 21:39 Martin Geisler <gim...@gi...> + + * stations.csv: + + New station discovered by Chris Hankinson <ch...@le...> + +2002-04-12 21:38 Martin Geisler <gim...@gi...> + + * VERSION: + + This is probably less confusing... + +2002-04-09 23:21 Martin Geisler <gim...@gi...> + + * config/: index.php, pw_option_text.php, pw_validator.php, + pw_validator_ereg.php, pw_validator_range.php: + + Hey - it turned out to be quite easy to validate the input using + regular expression in Javascript... + + As far as I understand it, then these regular expressions only work + in Javascript version 1.2 and later. But it's actually not that + important, as this is simply extra functionality - you can still + use a browser like lynx that doesn't do Javascript. + +2002-04-07 18:59 Martin Geisler <gim...@gi...> + + * config/reset_session.php: + + Hmm, $_SERVER didn't work either. + +2002-04-07 18:53 Martin Geisler <gim...@gi...> + + * config/index.php: + + Ups - $_REQUEST was too new for SourceForge. I've also changed some + include() to require_once() since that is what I mean: the script + shouldn't run without these files. + +2002-04-07 18:38 Martin Geisler <gim...@gi...> + + * config/: index.php, pw_dependency.php, pw_dependency_or.php, + pw_option.php, pw_option_boolean.php, pw_option_multi_select.php, + pw_option_select.php, pw_option_text.php, pw_optiongroup.php, + pw_validator.php, pw_validator_ereg.php, pw_validator_range.php, + reset_session.php: + + This is a new and improved configurator - a script that can be used + to generate a defaults.php file for PHP Weather. + + The new thing is, that the options now depend on each other - you + cannot configure the database password if you're using a DBA + database, because that kind of database doesn't use a password. The + options are also validated so that the default ICAO really is a + string of four letters or digits. + + I've dropped the idea about having the script save the + configuration. It only worked when the webserver had + write-permission to the directory (which was rare) and it caused + some security-problems. + + There's also no code for generating the databases. I think it would + be better if we made a separate script for that. Perhaps we should + couple this with the code that updates the METARs from cycle-files. + + 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: + + Cleanups. I'm was looking through the code to document the + $decoded_metar array and found a lot of cruft. + +2002-03-29 00:38 Max Hammond <ma...@fl...> + + * output/pw_text.php: + + new function to help customise it + +2002-03-28 21:47 Max Hammond <ma...@fl...> + + * configurator.php: + + Added norwegian + +2002-03-28 21:44 Max Hammond <ma...@fl...> + + * index.php: + + I think it's easier to follow the flow if we just do this. Also + added icon + +2002-03-28 21:18 Martin Geisler <gim...@gi...> + + * output/pw_text.php: + + Bad - we should never output anything directly from this method. + +2002-03-28 15:50 Martin Geisler <gim...@gi...> + + * output/pw_text_hu.php: + + There was some blank lines at the bottom of this file. It's + important to eliminate such lines now that we send HTTP headers + out. + +2002-03-28 15:49 Martin Geisler <gim...@gi...> + + * index.php, pw_utilities.php, output/pw_text.php: + + Rewrite to accommodate for the charset header. + pw_text::print_pretty() does no longer output anything, instead it + returns a string with the output. Perhaps it should be renamed, + since 'print' implies that it generates output? + +2002-03-28 15:28 Martin Geisler <gim...@gi...> + + * output/pw_text_hu.php: + + Hmm, we will use ISO-8859-2 instead of this UTF-8 thing, so I'm + reverting this to version 1.4. + +2002-03-27 21:55 Martin Geisler <gim...@gi...> + + * index.php: + + Let's try with a real HTTP header instead. + +2002-03-27 21:43 Martin Geisler <gim...@gi...> + + * output/pw_text_hu.php: + + Small updates in the comments, but more important: I've tried to + save the file as UTF-8 on my system, let's see how this goes... + +2002-03-27 21:34 Martin Geisler <gim...@gi...> + + * index.php: + + Fix those alt attributes too. + +2002-03-27 21:30 Martin Geisler <gim...@gi...> + + * index.php: + + Ugh - we're found the XML-with-PHP problem I've heard about, but + never thought that I would see. I don't think that we can require + people to set 'short_open_tag false' in their configuration files + (or .htaccess files for that matter) so we cannot have this line in + our files. + +2002-03-27 21:25 Martin Geisler <gim...@gi...> + + * index.php: + + More updates for XHTML. I'm not sure about that UTF-8 thing. As far + as I understand it, then UTF-8 covers both ISO-8859-1 and + ISO-8859-2. So if we specify that the charset is UTF-8, then we + should be OK? + +2002-03-27 20:16 Martin Geisler <gim...@gi...> + + * phpweather.php: + + This should be wrapped in a call to debug(). + +2002-03-27 20:13 Martin Geisler <gim...@gi...> + + * index.php, pw_utilities.php: + + This should fix most of the problems with XHTML in the pages. + +2002-03-27 15:13 Max Hammond <ma...@fl...> + + * output/pw_text.php: + + Utility function + +2002-03-27 14:47 Max Hammond <ma...@fl...> + + * index.php, pw_utilities.php: + + XHTMLisation + +2002-03-27 14:21 Max Hammond <ma...@fl...> + + * icons/: phpweather-black.gif, phpweather-long-black.gif, + phpweather-long-white.gif, phpweather-white.gif: + + Updated cloud (again) and new larger icons too + +2002-03-27 10:59 Max Hammond <ma...@fl...> + + * INSTALL, README: + + Updated + +2002-03-27 10:28 Max Hammond <ma...@fl...> + + * icons/: phpweather-black.gif, phpweather-white.gif: + + New cloud + +2002-03-26 23:10 Martin Geisler <gim...@gi...> + + * output/pw_text.php: + + The global $charset variable is now updated wheneven a pw_text + object is created. The demo-pages will have to be redone, so that + the output object can be created before header.php is included. + + I don't know if this is overkill - I cannot see any difference in + my browser when I look at the Hungarian translation using + ISO-8859-1 and ISO-8859-2. Perhaps we could just send a header that + tells people that all pages are written in Unicode? I think Unicode + covers both encodings. + +2002-03-26 21:50 Max Hammond <ma...@fl...> + + * icons/: phpweather-black.gif, phpweather-white.gif: + + New icons - What do we think? + +2002-03-26 20:09 Max Hammond <ma...@fl...> + + * index.php: + + Increased font size + +2002-03-26 19:52 Mihaly Gyulai gyulai.freeyellow.com/ + + * output/pw_text_hu.php: + + Adding the Hungarian translation of word 'windchill'. + +2002-03-26 18:52 Martin Geisler <gim...@gi...> + + * db/: pw_db_common.php, pw_db_mysql.php, pw_db_pgsql.php: + + It's now up to the database backend to do it's own quoting on the + data it receives in insert_metar() and update_metar(). This is + because the backends have different needs: the 'real' databases + want quotes quoted whereas the dba backend has to do escape colons. + +2002-03-26 18:50 Martin Geisler <gim...@gi...> + + * db/pw_db_dba.php: + + Aha! Some METARs had colons in them, which is the same character I + use to separate the METAR from the timestamp. When the data was + retrieved later and run through explode, this caused trouble. + +2002-03-26 18:44 Max Hammond <ma...@fl...> + + * output/pw_text_no.php: + + Updated norwegian translation, thanks to Sven-Erik + +2002-03-26 18:39 Max Hammond <ma...@fl...> + + * test.php, icons/tempchilled.gif, output/pw_images.php: + + Added icon for windchilled temperature, updated test.php to include + images + +2002-03-26 17:37 Martin Geisler <gim...@gi...> + + * db/pw_db_common.php: + + The reports might be duplicated in the cycle files, and two reports + might even have the same timestamp. This should make sure, that the + newest report (the one furthest down in the file) overwrites any + previous reports. + +2002-03-26 16:31 Max Hammond <ma...@fl...> + + * index.php: + + Change of heart about the best way to include the style, already :) + +2002-03-26 16:29 Martin Geisler <gim...@gi...> + + * phpweather.php: + + Extra check to ensure consistency in the decoded METAR. The problem + was METARs like this one: + + EGBE 260820Z 0200KT 340V060 CAVOK 06/02 Q1033 + + This METAR has a malformed wind-group: '0200KT 340V060', but the + last part of it would be parsed correctly. So there would be + information about variable wind-direction, but no information about + the speed. + +2002-03-26 16:26 Max Hammond <ma...@fl...> + + * index.php: + + Added inline style to body element, added information about our + homepage and NOAA, changed error_reporting to E_ERROR - it throws + up a lot of junk that will only be interesting to developers + +2002-03-26 00:11 Martin Geisler <gim...@gi...> + + * db/pw_db_common.php: + + This keeps getting better and better... :-) + +2002-03-25 23:50 Martin Geisler <gim...@gi...> + + * db/pw_db_common.php: + + A flush() here should make the output even better :-) + +2002-03-25 23:44 Martin Geisler <gim...@gi...> + + * db_updater.php: + + This should make the browsers understand, that this is text, and + not HTML. It also works from the commandline, at least on my + system. + +2002-03-25 23:33 Martin Geisler <gim...@gi...> + + * db_updater.php, db/pw_db_common.php: + + Nicer output. When we run this from a cronjob, we can just redirect + it to /dev/null, but it's nice to see how it goes when run by hand. + +2002-03-25 23:26 Martin Geisler <gim...@gi...> + + * db/pw_db_dba.php: + + Hmm, typoes in the debug - what's next? + +2002-03-25 21:22 Martin Geisler <gim...@gi...> + + * db/pw_db_dba.php: + + Second try on this + +2002-03-25 21:19 Martin Geisler <gim...@gi...> + + * db/pw_db_dba.php: + + More debug info needed! + +2002-03-25 21:12 Martin Geisler <gim...@gi...> + + * db/pw_db_common.php: + + Stupid error... + +2002-03-25 21:09 Martin Geisler <gim...@gi...> + + * db/pw_db_common.php: + + We need more debug-output... + +2002-03-25 20:58 Martin Geisler <gim...@gi...> + + * db_updater.php: + + It seams that I cannot make the connection to the DBA database. + +2002-03-25 20:38 Martin Geisler <gim...@gi...> + + * db/pw_db_common.php: + + Hmm, it seams that there can be garbage in the METAR reports... + +2002-03-25 20:26 Martin Geisler <gim...@gi...> + + * phpweather.php: + + This was giving errors if there wasn't any data available. + +2002-03-25 20:20 Martin Geisler <gim...@gi...> + + * db_updater.php: + + Let's try just one more time... + +2002-03-25 20:17 Martin Geisler <gim...@gi...> + + * db_updater.php: + + I admit it, that my own fault :-) + +2002-03-25 20:16 Martin Geisler <gim...@gi...> + + * db_updater.php: + + Argh - yet another difference between my system and SourceForge! + +2002-03-25 20:11 Martin Geisler <gim...@gi...> + + * db_updater.php: + + Ugh! This is kinda ugly - when I run this at SourceForge, then the + script isn't included in $argv - when I run this on my machine, the + first entry in $argv is the filename the script was invoked as... + + Let's just call this a temporary fix :-) + +2002-03-25 19:39 Martin Geisler <gim...@gi...> + + * db_updater.php: + + This little script will update the METAR database with new data. + It's meant to be called periodically from a cronjob. + +2002-03-25 19:35 Martin Geisler <gim...@gi...> + + * db/pw_db_common.php: + + Hehe - this is kind of cool :-) We can now update the databases + with fresh data from cycle files. These files contain all the + METARs received in the last 'cycle' at the NWS. + +2002-03-25 19:32 Martin Geisler <gim...@gi...> + + * db/pw_db_mysql.php: + + It seams that the Debian guys have decided to include MySQL support + as a loadable module for Apache. So I needed these lines to make + things work. I've looked at how things are done in phpMyAdmin so I + think it will work on Windows too. + +2002-03-24 20:13 Martin Geisler <gim...@gi...> + + * AUTHORS: + + I removed the entries for people who have translations for the old + version. Hint: make a translation for the new version, and I'll add + you to the list again :-) + +2002-03-24 19:18 Martin Geisler <gim...@gi...> + + * output/pw_text_da.php: + + Updated windchill. + +2002-03-24 17:25 Max Hammond <ma...@fl...> + + * phpweather.php, output/pw_text.php, output/pw_text_da.php, + output/pw_text_en.php, output/pw_text_hu.php, + output/pw_text_no.php: + + Added windchill factor + +2002-03-24 16:44 Max Hammond <ma...@fl...> + + * .cvsignore: + + ignore test.php file + +2002-03-24 16:43 Max Hammond <ma...@fl...> + + * test.php: + + Might as well get it right *sigh* + +2002-03-24 16:40 Max Hammond <ma...@fl...> + + * test.php: + + A file to make testing weather parsing easier and quicker for + developers. + +2002-03-22 17:54 Max Hammond <ma...@fl...> + + * data_retrieval.php: + + Typo? Was broken, now fixed. + +2002-03-20 19:26 Martin Geisler <gim...@gi...> + + * base_object.php, configurator.php, data_retrieval.php, + db_layer.php, images-test.php, phpweather.php, db/pw_db_common.php, + db/pw_db_dba.php, db/pw_db_mysql.php, db/pw_db_null.php, + db/pw_db_pgsql.php, output/pw_images.php, output/pw_text.php, + output/pw_text_hu.php: + + All files now use require_once() instead of just require() - this + means, that there's no need for those 'if defined('...') return + ...' statements at the top of each file any more. + +2002-03-18 18:10 Martin Geisler <gim...@gi...> + + * index.php: + + Cleanups. + +2002-03-18 17:32 Martin Geisler <gim...@gi...> + + * db/files/.cvsignore: + + It's these files that should be ignored... + +2002-03-18 16:57 Martin Geisler <gim...@gi...> + + * db/pw_db_dba.php: + + Added a suffix on the filenames so it doesn't use the same name at + the default null database. + +2002-03-18 16:55 Martin Geisler <gim...@gi...> + + * db/files/.cvsignore: + + These files are created by the dba backend and should be ignored by + CVS. + +2002-03-18 16:19 Martin Geisler <gim...@gi...> + + * defaults-dist.php, output/pw_images.php: + + There has to be a way to specify the path of the icons relative to + the document that uses pw_images to display them. + +2002-03-18 16:14 Martin Geisler <gim...@gi...> + + * output/: pw_text.php, pw_text_en.php: + + Let's just wait a little with this table-thing... + +2002-03-18 16:13 Martin Geisler <gim...@gi...> + + * pw_utilities.php: + + I think people would appreciate these functions. + +2002-03-18 13:46 Martin Geisler <gim...@gi...> + + * ChangeLog, usermap: + + This is a pretty good compromise, I think... + 2002-03-17 21:57 Martin Geisler <gim...@gi...> * AUTHORS: |
From: Martin G. <gim...@us...> - 2002-05-20 15:53:21
|
Update of /cvsroot/phpweather/phpweather/config In directory usw-pr-cvs1:/tmp/cvs-serv29334 Modified Files: index.php Log Message: Added a link to speed_test.php. Index: index.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/config/index.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- index.php 15 May 2002 22:26:50 -0000 1.6 +++ index.php 20 May 2002 15:53:18 -0000 1.7 @@ -22,6 +22,8 @@ </head> <body> + <img src="../icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> + <h1>Configuration of PHP Weather</h1> <p>This is the place where you configurate PHP Weather. You'll need @@ -41,13 +43,25 @@ <dt><a href="make_config.php">Configuration Builder</a></dt> <dd><p>Use this page to build a custom configuration-file for PHP - Weather.</p></dd> + Weather.</p></dd> <dt><a href="make_db.php">Database Builder</a></dt> <dd><p>After you've made a custom configuration using the link - above, you'll need to use this page to create the database and fill - it with data.</p></dd> + above, you'll need to use this page to create the database and fill + it with data.</p></dd> + + <dt><a href="speed_test.php">Speed Test</a></dt> + + <dd><p>If you've configured PHP Weather to use a database, then you + might be interested in knowing how long it takes to access the + data in the database. This is what this page is for, it will + meassure the time it takes for PHP Weather to retrieve and + display a large number of METARs.</p> + + <p>If you have several different databases available to you, then + you can compare them using this page.</p> + </dd> </dl> |
From: Martin G. <gim...@us...> - 2002-05-20 15:53:02
|
Update of /cvsroot/phpweather/phpweather/config In directory usw-pr-cvs1:/tmp/cvs-serv29112 Added Files: speed_test.php Log Message: I made this little file while I was playing with the different database backends. --- NEW FILE --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>PHP Weather Speed Test</title> <style type="text/css"> <!-- BODY { font-family: Verdana, Tahoma, Geneva, Arial, Helvetica, sans-serif; font-size: small; } DT { font-weight: bold } P { margin-top: 0.5em; margin-bottom: 0.5em; } --> </style> </head> <body> <img src="../icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> <h1>PHP Weather Speed Test</h1> <p>If you've configured PHP Weather to use a database, then you might be interested in knowing how long it takes to access the data in the database. This is what this page is for, it will meassure the time it takes for PHP Weather to retrieve and display a large number of METARs.</p> <p>If you have several different databases available to you, then you can compare them using this page.</p> <?php if (empty($HTTP_GET_VARS['batches'])) { $batches = 1; } else { $batches = $HTTP_GET_VARS['batches']; } $count = $batches*32; ?> <p>We will now time PHP Weather while it retrieves and parses <?php echo $count ?> different METARs. This will take a long time at first because PHP Weather has to retrieve the METARs from the Internet, but the second time you use this page it should go much faster because the METARs can be retrieved from the database - that is, if you've configured PHP Weather to use a database.</p> <p>Select the number of METARs to use: <a href="<?php echo $PHP_SELF ?>?batches=1">32</a>, <a href="<?php echo $PHP_SELF ?>?batches=2">64</a>, <a href="<?php echo $PHP_SELF ?>?batches=4">128</a>, or <a href="<?php echo $PHP_SELF ?>?batches=8">256</a>.</p> <?php /* This is 256 more or less randomly picked ICAOs from stations.csv. The ICAOs are grouped in batches of 32: */ $icaos = array( array('DABS', 'SARC', 'SARE', 'UGEE', 'YSDU', 'LOWG', 'VGZR', 'EBCV', 'TXKF', 'SLRY', 'SLVM', 'FBTE', 'SBBR', 'SBFN', 'SBLO', 'SBPP', 'SBSC', 'SBUR', 'VDPP', 'CYZS', 'CYGL', 'CYZT', 'CYYN', 'MWCR', 'SCTE', 'ZGSZ', 'SKCG', 'FZAA', 'LDSP', 'MUMZ', 'LKMT', 'EKSN'), array('HDAM', 'SEQU', 'MSSS', 'EFKK', 'LFSB', 'LFLB', 'LFOH', 'LFSF', 'LFPO', 'LFCG', 'SOCA', 'EDDT', 'EDFH', 'EDLN', 'LXGB', 'LGKR', 'LGZA', 'MGGT', 'MHCA', 'MHYR', 'VECC', 'WRRR', 'OIMM', 'LIEA', 'LIMU', 'LIPK', 'LIBN', 'LIMN', 'LIMH', 'LIPQ', 'LIPI', 'RJCA'), array('RJFF', 'RJDB', 'RJSU', 'RJOM', 'ROAH', 'RJKB', 'RJNY', 'RJOR', 'RJTY', 'HKGA', 'HKMB', 'HKWJ', 'RKPK', 'RKPU', 'HLLT', 'WMKK', 'FIMP', 'MMCS', 'MMHO', 'MMMY', 'MMSD', 'MMPN', 'GMMN', 'EHKD', 'EHVL', 'NZWN', 'ENAN', 'ENFL', 'ENLI', 'ENFB', 'ENZV', 'OOSA'), array('MPMG', 'SPEO', 'SPJA', 'EPGD', 'LPLA', 'OTBD', 'UHMD', 'ULLI', 'FPST', 'OEGN', 'OERY', 'GOTT', 'AGGH', 'FAPB', 'LEGE', 'LEMG', 'LEZL', 'FDMS', 'ESSB', 'LSZH', 'RCFN', 'RCDC', 'HTIR', 'HTSO', 'TTCP', 'DTTX', 'LTBG', 'LTBJ', 'LTBQ', 'UKLL', 'EGAA', 'EGSC'), array('EGLF', 'EGKK', 'EGHD', 'EGBJ', 'KABI', 'KALS', 'KAIA', 'PAKP', 'KAIG', 'KHZY', 'KAUO', 'KBFL', 'KBOW', 'KBPT', 'KVBT', 'KBHM', 'KBNW', 'KBDR', 'KBCE', 'KBRL', 'KP38', 'PACZ', 'KCID', 'KCRW', 'KPWK', 'KLUK', 'KCQC', 'KCOS', 'KCCR', 'KCVO', 'K0V1', 'KDMA'), array('KDFI', 'KDET', 'KDOV', 'KDYR', 'KECG', 'PAEM', 'KEVM', 'KFNB', 'KFIT', 'KFNL', 'KFLV', 'KFSM', 'KFKL', 'KGAG', 'KAKH', 'KGLD', 'KGPZ', 'KGMU', 'PAGS', 'K4HV', 'KHDN', 'KHKY', 'KHDO', 'KHOU', 'KHCD', 'KEYE', 'KJAC', 'KJHW', 'PHOG', 'KEAR', 'KNQX', 'KTYS'), array('KLCH', 'KLNS', 'KLWM', 'KLWS', 'KLIT', 'KLAX', 'KHFF', 'KP75', 'KMWA', 'KMHR', 'KMCB', 'KP28', 'PAMR', 'KMIV', 'KMIB', 'KMLI', 'KMXO', 'KVAY', 'KMIE', 'KAPC', 'KHVN', 'KEWR', 'PAOM', 'PAQT', 'KPWA', 'KORE', 'KOWA', 'KPAO', 'KSFZ', 'PAPG', 'KPIB', 'KPIH'), array('PAAP', 'KPTW', 'KPGD', 'KRWL', 'KRIC', 'KRKS', 'KROX', 'KE74', 'K27U', 'KMYF', 'KSFM', 'PASA', 'KSEG', 'PASY', 'KBFW', 'KU78', 'KSPF', 'KPHN', 'KSBS', 'KTCM', 'KTPL', 'PATG', 'KTVC', 'KTCL', 'PAVD', 'KVEL', 'PAFB', 'KRYV', 'KWYS', 'PAWR', 'KILL', 'KINK')); $start_time = explode(' ', microtime()); require_once('../phpweather.php'); require_once(PHPWEATHER_BASE_DIR . '/output/pw_text_en.php'); for ($i = 0; $i < $batches; $i++) { for ($j = 0; $j < 32; $j++) { /* We create two new objects: */ $weather = new phpweather(array('always_use_db' => true, 'icao' => $icaos[$i][$j], 'db_pconnect' => true)); $text = new pw_text_en($weather); /* We play a little with the objects - the output is just discarded: */ $output = "\n<!-- " . $weather->get_metar() . " -->\n"; $output = "\n<!-- " . $text->print_pretty() . " -->\n"; } } $end_time = explode(' ', microtime()); $diff = ($end_time[0] + $end_time[1]) - ($start_time[0] + $start_time[1]); echo "<p>Total time used to process $count METARs: <b>" . number_format($diff * 1000, 0) . " ms</b>.</p>\n"; echo '<p>Time used per METAR: <b>' . number_format($diff * 1000 / ($batches*32), 1) . " ms</b>.</p>\n"; ?> </body> </html> |
From: Martin G. <gim...@us...> - 2002-05-20 15:51:45
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv28776 Modified Files: index.php Log Message: Cosmetics... Index: index.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/index.php,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- index.php 28 Mar 2002 21:44:56 -0000 1.30 +++ index.php 20 May 2002 15:51:37 -0000 1.31 @@ -26,7 +26,10 @@ </head> <body> -<img src="icons/phpweather-long-white.gif" alt=""> +<img src="icons/phpweather-long-white.gif" alt="PHP Weather" align="right"> + +<h1>PHP Weather Test Page</h1> + <p>This is the default test page for PHP Weather. For more information, please visit <a href="http://www.phpweather.net">http://www.phpweather.net</a>.</p> <p>Data is taken from the <a href="http://weather.noaa.gov">National Weather Service</a> at NOAA.</p> |
From: Martin G. <gim...@us...> - 2002-05-20 15:50:18
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv28195 Modified Files: make-release.sh Log Message: Those .cvsignore files should also be removed from a release. Index: make-release.sh =================================================================== RCS file: /cvsroot/phpweather/phpweather/make-release.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- make-release.sh 27 Jun 2001 11:29:22 -0000 1.4 +++ make-release.sh 20 May 2002 15:50:15 -0000 1.5 @@ -20,7 +20,7 @@ VERSION=$(cat VERSION) DATE=$(date -uI) -rm README-CVS VERSION make-release.sh .cvsignore +rm README-CVS VERSION make-release.sh $(find . -name '.cvsignore') for file in README INSTALL base_object.php; do sed -e "s/#VERSION#/$VERSION/g" -e "s/#DATE#/$DATE/g" $file > tmp |
From: Martin G. <gim...@us...> - 2002-05-20 15:48:51
|
Update of /cvsroot/phpweather/phpweather/db In directory usw-pr-cvs1:/tmp/cvs-serv27357 Modified Files: pw_db_mysql.php Log Message: Some minor changes I made while I made the PostgreSQL backend. It's now possible to use a non-standard port - that was ignored before. Index: pw_db_mysql.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/pw_db_mysql.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- pw_db_mysql.php 26 Mar 2002 18:52:43 -0000 1.4 +++ pw_db_mysql.php 20 May 2002 15:48:48 -0000 1.5 @@ -5,7 +5,9 @@ /** * This class is the 'mysql' database-type. * - * It implements all the methods necessary to insert, update and retrive METARs using a MySQL database. You'll need access to a MySQL database to be able to use this object. + * It implements all the methods necessary to insert, update and + * retrive METARs using a MySQL database. You'll need access to a + * MySQL database to be able to use this object. * * @author Martin Geisler <gim...@gi...> * @version $Id$ @@ -13,8 +15,8 @@ class pw_db_mysql extends pw_db_common { /** - * This constructor does nothing besides calling the parent - * constructor. + * This constructor makes sure that the MySQL extension is loaded + * and then calls the parent constructor. * * @param array the initial properties of the object */ @@ -60,14 +62,24 @@ if ($this->is_connected) { return true; } + + if (empty($this->properties['db_port'])) + /* Default MySQL port: */ + $port = 3306; + else + $port = $this->properties['db_port']; + + if (!$this->properties['db_pconnect']) { - $this->link_id = mysql_connect($this->properties['db_hostname'], - $this->properties['db_username'], - $this->properties['db_password']); + $this->link_id = + mysql_connect($this->properties['db_hostname'] . ':' . $port, + $this->properties['db_username'], + $this->properties['db_password']); } else { - $this->link_id = mysql_pconnect($this->properties['db_hostname'], - $this->properties['db_username'], - $this->properties['db_password']); + $this->link_id = + mysql_pconnect($this->properties['db_hostname'] . ':' . $port, + $this->properties['db_username'], + $this->properties['db_password']); } if ($this->link_id) { $this->is_connected = true; @@ -224,7 +236,7 @@ /* 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'] . '( - icao varchar(4) NOT NULL, + icao char(4) NOT NULL, metar varchar(255) NOT NULL, timestamp timestamp(14), PRIMARY KEY (icao), @@ -233,7 +245,7 @@ /* Then we make a table for the stations. */ $this->query('DROP TABLE IF EXISTS ' . $this->properties['db_stations']); $this->query('CREATE TABLE ' . $this->properties['db_stations'] . '( - icao varchar(4) NOT NULL, + icao char(4) NOT NULL, name varchar(255) NOT NULL, cc char(2) NOT NULL, country varchar(128) NOT NULL, @@ -258,7 +270,7 @@ function lookup_icao($icao) { $this->query('SELECT name, country FROM ' . $this->properties['db_stations'] . " WHERE icao = '$icao'"); - if ($this->num_rows()) { + if ($this->num_rows() == 1) { $row = $this->fetch_row(); return "$row[0], $row[1]"; } else { |
From: Martin G. <gim...@us...> - 2002-05-20 15:47:12
|
Update of /cvsroot/phpweather/phpweather/db In directory usw-pr-cvs1:/tmp/cvs-serv25913 Modified Files: pw_db_pgsql.php Log Message: I've updated the PostgreSQL backend so that it actually works! :-) I've tested it on my PostgreSQL database version 7.2.1 which is the one that comes with Debian unstable. Index: pw_db_pgsql.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/pw_db_pgsql.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- pw_db_pgsql.php 26 Mar 2002 18:52:44 -0000 1.3 +++ pw_db_pgsql.php 20 May 2002 15:47:08 -0000 1.4 @@ -9,19 +9,54 @@ * retrive METARs using a PostgreSQL database. * * @author Kristian Kristensen <co...@zi...> + * @author Martin Geisler <gim...@gi...> * @version $Id$ */ class pw_db_pgsql extends pw_db_common { - + + /** + * The next row that should be fetched in the result set. + * + * This is used by the methods fetch_row() and fetch_array() to keep + * track of how far they have come in the result set. + * + * @var integer + * @access private + */ + var $next_row = 0; + + /** - * This constructor does nothing besides calling the parent constructor. + * The number of rows in the current result set. + * + * We store this here because we have to refer to it again and again + * in the fetch_row() and fetch_array() methods. + * + * @var integer + * @access private + */ + //var $num_rows = 0; + + + /** + * This constructor makes sure that the PostgreSQL extension is + * loaded and then calls the parent constructor. * * @param array the initial properties of the object */ function pw_db_pgsql($input = array()) { + /* We have to load the PgSQL extension on some systems: */ + if (!extension_loaded('pgsql')) { + if (ereg('win', PHP_OS)) { + dl('pgsql.dll'); + } else { + dl('pgsql.so'); + } + } $this->pw_db_common($input); } + /** * Gets the type of the database. * @@ -52,10 +87,22 @@ if ($this->is_connected) { return true; } + + if (empty($this->properties['db_port'])) + /* Default PostgreSQL port: */ + $port = 5432; + else + $port = $this->properties['db_port']; + + $connect_str = sprintf('host=%s port=%s dbname=%s user=%s password=%s', + $this->properties['db_hostname'], $port, + $this->properties['db_database'], + $this->properties['db_username'], + $this->properties['db_password']); if (!$this->properties['db_pconnect']) { - $this->link_id = pgsql_connect($this->properties['db_database']); + $this->link_id = pg_connect($connect_str); } else { - $this->link_id = pgsql_pconnect($this->properties['db_database']); + $this->link_id = pg_pconnect($connect_str); } if ($this->link_id) { $this->is_connected = true; @@ -65,6 +112,7 @@ } return $this->is_connected; } + /** * Disconnects from the database. @@ -88,17 +136,16 @@ /** - * Selects a database. + * Selects a database. This should already have been taken care of + * when the connection was made to the database, so this will just + * run connect() and return whatever it returns. * * @return boolean Returns true on success, false otherwise. * @access public + * @see connect() */ function select_db() { - if ($this->is_connected) { - return true; - } else { - return false; - } + return $this->connect(); } @@ -112,7 +159,16 @@ * @access public */ function query($query) { - return ($this->result_id = pg_exec( $this->link_id, $query)); + $this->result_id = pg_exec($this->link_id, $query) or + $this->error("SQL-statement failed: $query<br>PostgreSQL said " . + pg_errormessage()); + + /* We can now update $this->num_rows: */ + //$this->num_rows = pg_numrows($this->result_id); + /* The next row is the first row: */ + $this->next_row = 0; + + return $this->result_id; } /** @@ -122,7 +178,13 @@ * @access public */ function fetch_row() { - return pg_fetch_row($this->result_id,0); + if ($this->next_row < $this->num_rows()) + /* There are still rows left in the result set. We use the + post-increment operator (++) to increment $this->next_row + immediately after it has been used. */ + return pg_fetch_row($this->result_id, $this->next_row++); + else + return false; } /** @@ -133,9 +195,16 @@ * @access public */ function fetch_array() { - return pg_fetch_array($this->result_id,0); + if ($this->next_row < $this->num_rows()) + /* There are still rows left in the result set. We use the + post-increment operator (++) to increment $this->next_row + immediately after it has been used. */ + return pg_fetch_array($this->result_id, $this->next_row++); + else + return false; } + /** * Returns the number of rows in the result-set. * @@ -144,8 +213,10 @@ */ function num_rows() { return pg_numrows($this->result_id); + //return $this->num_rows; } + /** * Inserts a METAR into the database. * @@ -155,11 +226,11 @@ * @access public * @see update_metar() */ - function insert_metar($station, $metar, $timestamp) { + function insert_metar($icao, $metar, $timestamp) { $this->query('INSERT INTO ' . $this->properties['db_metars'] . - " SET station = '$station', " . - "metar = '" . addslashes($metar) . "', " . - "timestamp = FROM_UNIXTIME($timestamp)"); + '(icao, metar, timestamp) VALUES (' . + "'$icao', '" . addslashes($metar) . "', '" . + date('r', $timestamp) . "')"); } @@ -172,13 +243,14 @@ * @access public * @see insert_metar() */ - function update_metar($station, $metar, $timestamp) { + function update_metar($icao, $metar, $timestamp) { $this->query('UPDATE ' . $this->properties['db_metars'] . " SET metar = '" . addslashes($metar) . - "', timestamp = '$timestamp' " . - "WHERE station = '$station'"); + "', timestamp = '" . date('r', $timestamp) . + "' WHERE icao = '$icao'"); } + /** * Gets a METAR form the database. * @@ -186,11 +258,151 @@ * @return string The raw METAR as an array from the database. * @access public */ - function get_metar($station) { - $this->query('SELECT metar, timestamp FROM ' . + function get_metar($icao) { + $this->query('SELECT metar, EXTRACT(EPOCH FROM timestamp) FROM ' . $this->properties['db_metars'] . - " WHERE station = '$station'"); + " WHERE icao = '$icao'"); return $this->fetch_row(); + } + + + /** + * Creates the necessary tables in the database. + * + * @return bool Returns true if it could connect to the database, + * false otherwise. + * @access private + */ + function create_tables() { + if (!$this->connect()) { + return false; // Failure! + } + + /* First we make a table for the METARs */ + $this->query('DROP TABLE ' . $this->properties['db_metars']); + $this->query('CREATE TABLE ' . $this->properties['db_metars'] . + '(icao char(4) PRIMARY KEY,' . + ' metar varchar(255) NOT NULL,' . + ' timestamp timestamp with time zone)'); + + /* Then we make a table for the stations. */ + $this->query('DROP TABLE ' . $this->properties['db_stations']); + $this->query('CREATE TABLE ' . $this->properties['db_stations'] . + '(icao char(4) PRIMARY KEY,' . + ' name varchar(255) NOT NULL,' . + ' cc char(2) NOT NULL,' . + ' country varchar(128) NOT NULL)'); + $this->query('CREATE INDEX cc_key ON ' . + $this->properties['db_stations'] . '(cc)'); + + return true; // Succes! + } + + /** + * Translates an ICAO into a station name + * + * The boring ICAO (e.g. EKYT) is translated into something like + * 'Aalborg, Denmark'. + * + * @param string The ICAO one want's to translate. + * @return string The full name of the station, including country. + * @access public + */ + function lookup_icao($icao) { + $this->query('SELECT name, country FROM ' . + $this->properties['db_stations'] . " WHERE icao = '$icao'"); + if ($this->num_rows() == 1) { + $row = $this->fetch_row(); + return "$row[0], $row[1]"; + } else { + return $icao; + } + } + + /** + * Inserts the stations into the database. + * + * It is assumed that create_tables() has been called previously + * (and that it returned true), so that the necessary tables are + * already created. + * + * @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) { + if (!$this->connect()) { + return false; + } + + while(list($cc, $country) = each($countries)) { + /* The country names might contain dangerous characters. */ + $country = addslashes($country); + 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'] . + '(icao, name, cc, country) VALUES ' . + "('$icao', '$location', '$cc', '$country')"); + } + } + return true; + } + + + /** + * Returns a list of available countries. + * + * @return array An associative array with the country-codes as the + * keys and the names of the countries as the values. + * @access public + */ + function get_countries() { + if (!$this->connect()) { + return false; + } + + $this->query('SELECT DISTINCT cc, country FROM ' . + $this->properties['db_stations'] . ' ORDER BY country'); + while($row = $this->fetch_row()) { + $rows[$row[0]] = $row[1]; + } + 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. + * @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"); + /* We have to do this manually the first time, so that we can set + $country */ + list($icao, $name, $country) = $this->fetch_row(); + $rows[$icao] = $name; + while(list($icao, $name) = $this->fetch_row()) { + $rows[$icao] = $name; + } + return $rows; } } |