Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv3789

Modified Files:
        base_object.php data_retrieval.php db_common.php db_dba.php 
        db_layer.php db_mysql.php db_null.php db_pgsql.php index.php 
        locale_en.php metar_parser.php phpweather.php 
Log Message:
It should now be possible to run PHP Weather from another directory
than the directory with 'defaults-dist.php'. To do this, you'll have
to set the constant PHPWEATHER_BASE_DIR to the full path to the base
directory.

The best way to do this is something like this:

define('PHPWEATHER_BASE_DIR', gcwd() . '/phpweather');

Note: PHPWEATHER_BASE_DIR should not end with a slash. I haven't
tested this under Windows, but we'll have to find a way to convert the
slashed to back-slashes.


Index: base_object.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/base_object.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- base_object.php     2001/04/16 15:13:03     1.4
+++ base_object.php     2001/04/26 13:11:00     1.5
@@ -28,10 +28,10 @@
    */
   function base_object($input) {
 
-    include('defaults-dist.php');
+    include(PHPWEATHER_BASE_DIR . '/defaults-dist.php');
 
-    if(file_exists('defaults.php')) {
-      include('defaults.php');
+    if(file_exists(PHPWEATHER_BASE_DIR . '/defaults.php')) {
+      include(PHPWEATHER_BASE_DIR . '/defaults.php');
     }
 
     /* Then we override the defaults with the actual properties */

Index: data_retrieval.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/data_retrieval.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- data_retrieval.php  2001/04/16 15:13:03     1.4
+++ data_retrieval.php  2001/04/26 13:11:00     1.5
@@ -1,4 +1,6 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/db_layer.php');
+
 /**
  * This class contains all the logic needed to get and store METARs.
  *
@@ -149,7 +151,7 @@
     
     /* We use the @file notation here because it might fail. */
     $file  = 
@file("http://weather.noaa.gov/pub/data/observations/metar/stations/$station.TXT";);
-    /* Here we test to see if we actually got a meter. */
+    /* Here we test to see if we actually got a METAR. */
     if (is_array($file)) {
       /* The first line in the file is the date */
       list(, $date) = each($file);

Index: db_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_common.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- db_common.php       2001/04/16 15:13:03     1.4
+++ db_common.php       2001/04/26 13:11:00     1.5
@@ -1,4 +1,6 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/base_object.php');
+
 /**
  * Common class for all the database-types.
  *

Index: db_dba.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_dba.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- db_dba.php  2001/04/16 15:13:03     1.3
+++ db_dba.php  2001/04/26 13:11:00     1.4
@@ -1,4 +1,6 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/db_common.php');
+
 /**
  * This class is the 'dba' database-type. This type of database is a wrapper itself, 
so you have to pass a handler to it as the index 'db_handler', when you create it.
  *

Index: db_layer.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_layer.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- db_layer.php        2001/04/16 15:13:03     1.5
+++ db_layer.php        2001/04/26 13:11:00     1.6
@@ -1,4 +1,10 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/base_object.php');
+require_once(PHPWEATHER_BASE_DIR . '/db_null.php');
+require_once(PHPWEATHER_BASE_DIR . '/db_dba.php');
+require_once(PHPWEATHER_BASE_DIR . '/db_mysql.php');
+require_once(PHPWEATHER_BASE_DIR . '/db_pgsql.php');
+
 /**
  * This class is used to maintain the database-object.
  *

Index: db_mysql.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_mysql.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- db_mysql.php        2001/04/02 19:34:20     1.3
+++ db_mysql.php        2001/04/26 13:11:00     1.4
@@ -1,4 +1,6 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/db_common.php');
+
 /**
  * This class is the 'mysql' database-type.
  *

Index: db_null.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_null.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- db_null.php 2001/04/05 19:17:28     1.1
+++ db_null.php 2001/04/26 13:11:00     1.2
@@ -1,4 +1,6 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/db_common.php');
+
 /**
  * This class is the 'null' database-type
  *

Index: db_pgsql.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_pgsql.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- db_pgsql.php        2001/04/05 15:30:42     1.3
+++ db_pgsql.php        2001/04/26 13:11:00     1.4
@@ -1,4 +1,6 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/db_common.php');
+
 /**
  * This class is the 'pgsql' database-type
  *

Index: index.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/index.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- index.php   2001/04/16 15:13:03     1.6
+++ index.php   2001/04/26 13:11:00     1.7
@@ -9,19 +9,13 @@
 <?php
 error_reporting(E_ALL);
 
+
 /* Checkpoint, we store the time */
 $time[] = array(microtime(), 'start');
 
-require('base_object.php');
-require('db_common.php');
-require('db_mysql.php');
-require('db_null.php');
-require('db_dba.php');
-require('db_layer.php');
-require('data_retrieval.php');
-require('metar_parser.php');
-require('locale_common.php');
-require('locale_en.php');
+/* This constant points to the base-directory. It should not end in a
+   slash. */
+define('PHPWEATHER_BASE_DIR', getcwd());
 require('phpweather.php');
 
 //define('DEBUG', true);

Index: locale_en.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/locale_en.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- locale_en.php       2001/04/16 15:13:03     1.5
+++ locale_en.php       2001/04/26 13:11:00     1.6
@@ -1,4 +1,6 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/locale_common.php');
+
 /**
  * Provides all the strings needed by locale_common to produce English output.
  *

Index: metar_parser.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/metar_parser.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- metar_parser.php    2001/04/16 15:13:03     1.4
+++ metar_parser.php    2001/04/26 13:11:00     1.5
@@ -1,4 +1,6 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/data_retrieval.php');
+
 /**
  * This class understands how to parse a raw METAR.
  *

Index: phpweather.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/phpweather.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- phpweather.php      2001/04/22 19:53:57     1.5
+++ phpweather.php      2001/04/26 13:11:00     1.6
@@ -1,4 +1,7 @@
 <?php
+require_once(PHPWEATHER_BASE_DIR . '/metar_parser.php');
+require_once(PHPWEATHER_BASE_DIR . '/locale_en.php');
+
 /**
  * A container-class for the localized object.
  *


_______________________________________________
PHPWeather-checkins mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/phpweather-checkins

Reply via email to