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
|