CVS: phpweather-1.x phpweather.inc,1.7,1.8
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2002-06-28 15:50:07
|
Update of /cvsroot/phpweather/phpweather-1.x In directory usw-pr-cvs1:/tmp/cvs-serv16092 Modified Files: phpweather.inc Log Message: Code and comment cleanup. Index: phpweather.inc =================================================================== RCS file: /cvsroot/phpweather/phpweather-1.x/phpweather.inc,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- phpweather.inc 26 Jun 2002 12:14:13 -0000 1.7 +++ phpweather.inc 28 Jun 2002 15:50:03 -0000 1.8 @@ -1,20 +1,23 @@ <?php /* Copyright (c) 2000-2002 Martin Geisler <gim...@gi...>. -Licensed under the GPL, see the file COPYING. - -See - - http://www.phpweather.net/ and - http://www.sourceforge.net/projects/phpweather - -for updates and further instructions on how to use PHP Weather. -*/ + * Licensed under the GPL, see the file COPYING. + * + * Take a look at these websites for updates and further instructions + * on how to use PHP Weather: + * + * http://www.phpweather.net/ and + * http://www.sourceforge.net/projects/phpweather + */ /* This stores the version number in the variable $version. */ -$version = '1.60-CVS'; +$version = '1.61'; +/* We start by loading the default configuration: */ require('config-dist.inc'); +/* Now, if the user has customized the configuration by making a file + * called 'defaults.inc', then we include that now so that it can + * override the defaults: */ if (file_exists('config.inc')) include('config.inc'); if ($useMySQL) { @@ -384,10 +387,7 @@ */ global $useOCI, $useMySQL, $useDBM, $usePSQL, $conn, $dbMetar, - $dbmTimestamp; - - // XML Globals I did this seperate so you could see it. - global $useXML, $XMLMetar, $XMLParser, $XMLFile; + $dbmTimestamp, $useXML, $XMLMetar, $XMLParser, $XMLFile; if ($useMySQL) { $query = "SELECT metar, UNIX_TIMESTAMP(timestamp) FROM metars WHERE station = '$station'"; @@ -501,8 +501,6 @@ $date_unixtime = gmmktime($date_parts[3], $date_parts[4], 0, $date_parts[1], $date_parts[2], $date_parts[0]); - - if (!ereg('[0-9]{6}Z', $metar)) { /* Some reports dont even have a time-part, so we insert the @@ -590,10 +588,13 @@ } function process_metar($metar) { - /* initialization */ + /* This function decodes a raw METAR. The result is an associative + * array with entries like 'temp_c', 'visibility_miles' etc. */ + global $strings, $wind_dir_text_short_array, $wind_dir_text_array, $cloud_condition_array, $weather_array; - $decoded_metar['temp_visibility_miles'] = ''; + + $temp_visibility_miles = ''; $cloud_layers = 0; $decoded_metar['remarks'] = ''; $decoded_metar['weather'] = ''; @@ -702,9 +703,9 @@ /* * Temp Visibility Group, single digit followed by space */ - $decoded_metar['temp_visibility_miles'] = $part; + $temp_visibility_miles = $part; } elseif (ereg('^M?(([0-9]?)[ ]?([0-9])(/?)([0-9]*))SM$', - $decoded_metar['temp_visibility_miles'] . ' ' . + $temp_visibility_miles . ' ' . $parts[$i], $regs)) { /* * Visibility Group |