[PHPLIB-DEV] cvs commit From: kk (phplib-dev <email protected>)
Date: 10/24/99

From: kk
Date: Sun Oct 24 12:21:56 1999
Removed files:
      php-lib/php/util.inc

Modified files:
      php-lib/doc/sgml/01-insttest.sgml
      php-lib/doc/sgml/01-prereq.sgml
      php-lib/doc/sgml/01-qinstgui.sgml
      php-lib/doc/sgml/02-files.sgml
      php-lib/doc/sgml/02-installation.sgml
      php-lib/doc/sgml/02-requirements.sgml
      php-lib/doc/sgml/03-db_sql.sgml
      php-lib/php/prepend.php3
      php-lib/php/table.inc
      php-lib/php/template.inc

Log message:
- Documentation
- Some changes to template.inc
- Got rid of util.inc, it only created confusion on installation

Index: php-lib/doc/sgml/01-insttest.sgml
diff -u php-lib/doc/sgml/01-insttest.sgml:1.2 php-lib/doc/sgml/01-insttest.sgml:1.3
--- php-lib/doc/sgml/01-insttest.sgml:1.2 Sun Sep 19 12:30:55 1999
+++ php-lib/doc/sgml/01-insttest.sgml Sun Oct 24 12:21:23 1999
@@ -1,4 +1,4 @@
-<!-- $Id: 01-insttest.sgml,v 1.2 1999/09/19 10:30:55 kk Exp $ -->
+<!-- $Id: 01-insttest.sgml,v 1.3 1999/10/24 10:21:23 kk Exp $ -->
 
 <sect1>Testing
 <p>
@@ -8,6 +8,10 @@
 offers an incremental approach to find installation problems,
 should the above installation process fail.
 
+We do have a support mailing list available under the address
+<tt/phplib <email protected>/. To subscribe to the list, send the command
+<tt/subscribe/ to the address <tt/phplib-request <email protected>/.
+
 <descrip>
 <tag>Checking that the web server is up and running</tag>
 
@@ -83,7 +87,7 @@
 
 Check the output of <tt/phpinfo()/ carefully! Is your PHP
 version current (We have tested and developed this release with
-PHP 3.0.5)? Are your database interfaces present in the output
+PHP 3.0.12)? Are your database interfaces present in the output
 of <tt/phpinfo()/? If not, recompile again.
 
 Can you access <tt>/test2.php3</tt> under the URL
@@ -112,8 +116,8 @@
 <tt/php3.ini/ file. It must include the following settings:
 
 <tscreen><code>
-include&lowbar;path = <em/pathname to directory with all the .inc files/
-auto&lowbar;prepend&lowbar;file = <em/path to prepend.php3/
+include&lowbar;path = pathname to directory with all the .inc files
+auto&lowbar;prepend&lowbar;file = path to prepend.php3
 track&lowbar;vars = On
 </code></tscreen>
 
@@ -144,7 +148,7 @@
   include("table.inc"); // requires include&lowbar;path to be functioning
 
   $db = new DB&lowbar;Example;
- $db->query("select * from active&lowbar;sessions");
+ $db->query("select * from auth&lowbar;user");
 
   $t = new Table;
   $t->heading = "on";
Index: php-lib/doc/sgml/01-prereq.sgml
diff -u php-lib/doc/sgml/01-prereq.sgml:1.1 php-lib/doc/sgml/01-prereq.sgml:1.2
--- php-lib/doc/sgml/01-prereq.sgml:1.1 Fri Jul 16 23:45:24 1999
+++ php-lib/doc/sgml/01-prereq.sgml Sun Oct 24 12:21:23 1999
@@ -1,4 +1,4 @@
-<!-- $Id: 01-prereq.sgml,v 1.1 1999/07/16 21:45:24 kk Exp $ -->
+<!-- $Id: 01-prereq.sgml,v 1.2 1999/10/24 10:21:23 kk Exp $ -->
 
 <sect1>Target Group and Prerequisites
 <p>
@@ -20,10 +20,10 @@
 
 To make use of the library you obviously need access to a web
 server with a working installation of a current PHP interpreter
-(we recommend 3.0.5 or newer for this release of the library)
-and access
-to a supported SQL database (currently, PHPLIB supports MySQL,
-PostgreSQL, mSQL, Oracle and ODBC databases). You need to be able to
+(we recommend 3.0.12 or newer for this release of the library)
+and access to a supported SQL database (currently, PHPLIB
+supports MySQL, PostgreSQL, mSQL, Oracle 7 and Oracle 8, Sybase,
+Microsoft SQL Server and ODBC databases). You need to be able to
 create and drop database tables in that database and your web
 server must be able to execute <tt/SELECT/, <tt/INSERT/,
 <tt/UPDATE/ and <tt/DELETE/ statements on these tables.
@@ -39,3 +39,6 @@
 the Apache module over the CGI version, although we personally
 use the CGI version for various reasons (easier to update and
 can be run with Apache <tt/suexec/).
+
+PHP 4 is still in beta. We do not support deployment of this
+library with beta software.
Index: php-lib/doc/sgml/01-qinstgui.sgml
diff -u php-lib/doc/sgml/01-qinstgui.sgml:1.1 php-lib/doc/sgml/01-qinstgui.sgml:1.2
--- php-lib/doc/sgml/01-qinstgui.sgml:1.1 Fri Jul 16 23:45:24 1999
+++ php-lib/doc/sgml/01-qinstgui.sgml Sun Oct 24 12:21:23 1999
@@ -1,10 +1,17 @@
-<!-- $Id: 01-qinstgui.sgml,v 1.1 1999/07/16 21:45:24 kk Exp $ -->
+<!-- $Id: 01-qinstgui.sgml,v 1.2 1999/10/24 10:21:23 kk Exp $ -->
 
 <sect1>Quick Guide to Installation
 <p>
 
-These instructions apply to PHPLIB running with CGI PHP. Most of them
-is valid for mod&lowbar;php as well, though.
+These instructions apply to PHPLIB running with CGI PHP. Most of
+them are valid for mod&lowbar;php as well, though. <b>VERY
+IMPORTANT NOTE:</b> This is a quick installation guide to get
+you started if you have an installation where you control the
+web server, PHP interpreter and database server completely. They
+are not suitable for a web hosting setup where you have only
+limited to no control over the installation. Refer to Chapter 2
+of this documentation for the complete installation instructions
+and troubleshooting information.
 
 Before installing PHPLIB, get your web server up and running and
 have it executing files with the extension .php3. Check that
@@ -22,7 +29,8 @@
 <descrip>
 <tag>Step 1</tag>
 <p>Create an include directory named <tt/php/ parallel to your
- web servers document root directory.
+ web servers document root directory. Do not put the include
+ directory below your web servers document root.
 
 <tag>Step 2</tag>
 <p>Unpack your PHPLIB distribution. Move the contents of the
@@ -36,12 +44,18 @@
    <tt/auto&lowbar;prepend&lowbar;file/ statement so that it points to the
    <tt/prepend.php3/ file in that include directory.
 
+ If you do not have control over your php3.ini file, you did not
+ read the <b>VERY IMPORTANT NOTE</b> above.
+
 <tag>Step 4</tag>
 <p>Also check that <tt/track&lowbar;vars/ are enabled and that you have
    enabled <tt/magic&lowbar;quotes&lowbar;gpc/. While you are at it, you might
    want to check <tt/sendmail&lowbar;path/, if you plan to send mail from
    your application. It has to be set to <tt>/usr/lib/sendmail -t</tt>
    on most UNIX systems to work.
+
+ If you do not have control over your php3.ini file, you did
+ not read the <b>VERY IMPORTANT NOTE</b> above.
 
 <tag>Step 5</tag>
 <p>cd into the <tt/php/ include directory. Edit <tt/local.inc/.
Index: php-lib/doc/sgml/02-files.sgml
diff -u php-lib/doc/sgml/02-files.sgml:1.1 php-lib/doc/sgml/02-files.sgml:1.2
--- php-lib/doc/sgml/02-files.sgml:1.1 Fri Jul 16 23:45:26 1999
+++ php-lib/doc/sgml/02-files.sgml Sun Oct 24 12:21:23 1999
@@ -1,4 +1,4 @@
-<!-- $Id: 02-files.sgml,v 1.1 1999/07/16 21:45:26 kk Exp $ -->
+<!-- $Id: 02-files.sgml,v 1.2 1999/10/24 10:21:23 kk Exp $ -->
 
 <sect1>Files, classes and functions
 <p>
@@ -14,7 +14,8 @@
 change any of these files. Your customization of PHPLIB can be
 contained in two or three files, depending on the setup:
 <tt/local.inc/, <tt/setup.inc/ and, in some cases,
-<tt/prepend.php3/. Details are outlined below.
+<tt/prepend.php3/. You <b/NEVER/ need to change any other file
+with PHPLIB. Details are outlined below.
 
 <sect2>Customization
 <p>
@@ -86,7 +87,8 @@
 <descrip>
 <tag>Class <tt/DB&lowbar;Sql/ defined in exactly one of
 <tt/db&lowbar;mysql.inc/, <tt/db&lowbar;msql.inc/, <tt/db&lowbar;pgsql.inc/,
-<tt/db&lowbar;odbc.inc/,<tt/db&lowbar;oracle.inc/ or <tt/db&lowbar;oci8.inc/:</tag>
+<tt/db&lowbar;odbc.inc/, <tt/db&lowbar;sybase.inc/, <tt/db&lowbar;mssql.inc/,
+<tt/db&lowbar;oracle.inc/ or <tt/db&lowbar;oci8.inc/:</tag>
 
 <p>A database access class for your database server. PHPLIB
    depends on the presence of a SQL database server. Depending
Index: php-lib/doc/sgml/02-installation.sgml
diff -u php-lib/doc/sgml/02-installation.sgml:1.1 php-lib/doc/sgml/02-installation.sgml:1.2
--- php-lib/doc/sgml/02-installation.sgml:1.1 Fri Jul 16 23:45:27 1999
+++ php-lib/doc/sgml/02-installation.sgml Sun Oct 24 12:21:23 1999
@@ -1,9 +1,10 @@
-<!-- $Id: 02-installation.sgml,v 1.1 1999/07/16 21:45:27 kk Exp $ -->
+<!-- $Id: 02-installation.sgml,v 1.2 1999/10/24 10:21:23 kk Exp $ -->
 
 <sect>Overview and Installation
 <p>
 
-The following sections discuss the layout of PHPLIB: Which functionality and
-class definitions are contained in which files? How do you layout a
-web server with PHPLIB installed? Which installation options are available
-and how do these affect performance?
+The following sections discuss the installation, verification
+and layout of PHPLIB: How to install PHPLIB? Which functionality
+and class definitions are contained in which files? How do you
+layout a web server with PHPLIB installed? Which installation
+options are available and how do these affect performance?
Index: php-lib/doc/sgml/02-requirements.sgml
diff -u php-lib/doc/sgml/02-requirements.sgml:1.1 php-lib/doc/sgml/02-requirements.sgml:1.2
--- php-lib/doc/sgml/02-requirements.sgml:1.1 Fri Jul 16 23:45:29 1999
+++ php-lib/doc/sgml/02-requirements.sgml Sun Oct 24 12:21:23 1999
@@ -1,4 +1,4 @@
-<!-- $Id: 02-requirements.sgml,v 1.1 1999/07/16 21:45:29 kk Exp $ -->
+<!-- $Id: 02-requirements.sgml,v 1.2 1999/10/24 10:21:23 kk Exp $ -->
 
 <sect1>Requirements and things to check for
 
@@ -6,15 +6,15 @@
 <p>
 
 The PHP base library requires a working web server with CGI
-capability and the CGI version of PHP 3.0.5 or higher installed.
+capability and the CGI version of PHP 3.0.12 or higher installed.
 Alternatively mod&lowbar;php can be used. Lower versions of PHP
 do not work at all: The session class uses the
 <tt/base64&lowbar;encode()/ and <tt/base64&lowbar;decode()/
 functions which are known to be buggy in lower versions of the
 library. Also, the OOH Forms classes are using constructor
-syntax, which has been introduced into the PHP language in 3.0.5
+syntax, which has been introduced into the PHP language in 3.0.12
 and later versions. An issue with the $PHP&lowbar;SELF variable
-and CGI PHP has been resolved with version 3.0.5 and later.
+and CGI PHP has been resolved with version 3.0.12 and later.
 
 <em/Note:/ If you are using CGI PHP, it <em/must/ have been
 compiled with the <tt/--enable-force-cgi-redirect/ switch for
Index: php-lib/doc/sgml/03-db_sql.sgml
diff -u php-lib/doc/sgml/03-db_sql.sgml:1.2 php-lib/doc/sgml/03-db_sql.sgml:1.3
--- php-lib/doc/sgml/03-db_sql.sgml:1.2 Mon Sep 27 02:58:40 1999
+++ php-lib/doc/sgml/03-db_sql.sgml Sun Oct 24 12:21:23 1999
@@ -1,4 +1,4 @@
-<!-- $Id: 03-db_sql.sgml,v 1.2 1999/09/27 00:58:40 sasha Exp $ -->
+<!-- $Id: 03-db_sql.sgml,v 1.3 1999/10/24 10:21:23 kk Exp $ -->
 
 <sect1>DB&lowbar;Sql
 
@@ -88,7 +88,7 @@
 with one row per table column. Each row describes a column in
 your table.
 
-If <tt/$table> is omitted, the function returns metadata on the result
+If <tt/$table/ is omitted, the function returns metadata on the result
 of the last executed query. NOTE: This is currently implemented only
 for the MySQL interface. You are encouraged to implement this feature
 for other interfaces.
Index: php-lib/php/prepend.php3
diff -u php-lib/php/prepend.php3:1.8 php-lib/php/prepend.php3:1.9
--- php-lib/php/prepend.php3:1.8 Thu Jul 22 17:06:57 1999
+++ php-lib/php/prepend.php3 Sun Oct 24 12:21:24 1999
@@ -5,7 +5,7 @@
  * Copyright (c) 1998,1999 SH Online Dienst GmbH
  * Boris Erdmann, Kristian Koehntopp
  *
- * $Id: prepend.php3,v 1.8 1999/07/22 15:06:57 jeffrey Exp $
+ * $Id: prepend.php3,v 1.9 1999/10/24 10:21:24 kk Exp $
  *
  */
 
@@ -24,8 +24,6 @@
 require($_PHPLIB["libdir"] . "user.inc"); /* Disable this, if you are not using per-user variables. */
 
 /* Additional require statements go below this line */
-
-require($_PHPLIB["libdir"] . "util.inc"); /* General utility functions required by library. */
 
 /* Additional require statements go before this line */
 
Index: php-lib/php/table.inc
diff -u php-lib/php/table.inc:1.16 php-lib/php/table.inc:1.17
--- php-lib/php/table.inc:1.16 Thu Jul 22 17:06:58 1999
+++ php-lib/php/table.inc Sun Oct 24 12:21:24 1999
@@ -6,7 +6,7 @@
  * Boris Erdmann, Kristian Koehntopp,
  * Jeffrey Galbraith
  *
- * $Id: table.inc,v 1.16 1999/07/22 15:06:58 jeffrey Exp $
+ * $Id: table.inc,v 1.17 1999/10/24 10:21:24 kk Exp $
  *
  * History: 990617: Modularized entire table class. Modularity breaks larger
  * objects into smaller, autonomous objects in order to
@@ -35,8 +35,6 @@
   #--------------------------------------------------------------------------
   # Creates an HTML table based on either a PHP array or a
   # database result.
- #--------------------------------------------------------------------------
- # Relies on verification functions found in "util.inc"
   #==========================================================================
   
 class Table
@@ -727,6 +725,86 @@
         $this->check,
         $row,
         empty($data[$this->check])?$row_key:$data[$this->check]);
+ }
+ }
+
+ #==========================================================================
+ ## Utility functions (used to be in util.inc, but were used only here and
+ ## did create a lot of confusion on installation) -- KK
+ #==========================================================================
+
+ #==========================================================================
+ # Function : verify_array
+ #--------------------------------------------------------------------------
+ # Purpose : Verifies an array
+ # Arguments: $ary - The array to verify.
+ # Returns : 1 on success, 0 on error.
+ # Comments :
+ # History :
+ #==========================================================================
+ function verify_array($ary)
+ {
+ if (!is_array($ary))
+ return 0;
+
+ return 1;
+ }
+
+ #==========================================================================
+ # Function : verify_2d_array
+ #--------------------------------------------------------------------------
+ # Purpose : Verifies a 2D array
+ # Arguments: $ary - The array to verify.
+ # Returns : 1 on success, 0 on error.
+ # Comments :
+ # History : 990616 - Removed "$this->" from "verify_array". (JSG)
+ #==========================================================================
+ function verify_2d_array($ary)
+ {
+ if (!verify_array($ary))
+ return 0;
+
+ reset($ary);
+ if (!is_array(current($ary)))
+ return 0;
+
+ reset($ary);
+
+ return 1;
+ }
+
+ #==========================================================================
+ # Function : verify_db
+ #--------------------------------------------------------------------------
+ # Purpose : Verifies a database object for results.
+ # Arguments: $db - The database object to verify.
+ # Returns : 1 on success, 0 on error.
+ # Comments :
+ # History :
+ #==========================================================================
+ function verify_db($db)
+ {
+ if (!isset($db) && !$db)
+ return 0;
+
+ if ($db->num_rows() > 0)
+ return 1;
+
+ return 0;
+ }
+
+ ## Debugging function that prints an array
+ ## Recursive is_array found within array
+ function print_array($ary)
+ {
+ if (is_array($ary))
+ {
+ while(list($key, $val) = each($ary))
+ {
+ echo "&nbsp;&nbsp;$key = $val<br>\n";
+ if (is_array($val))
+ print_array($val);
+ }
     }
   }
 
Index: php-lib/php/template.inc
diff -u php-lib/php/template.inc:1.2 php-lib/php/template.inc:1.3
--- php-lib/php/template.inc:1.2 Thu Oct 21 21:31:32 1999
+++ php-lib/php/template.inc Sun Oct 24 12:21:24 1999
@@ -2,16 +2,19 @@
 /*
  * Session Management for PHP3
  *
- * (C) Copyright 1999 SH Online Dienst GmbH
+ * (C) Copyright 1999 NetUSE GmbH
  * Kristian Koehntopp
  *
- * $Id: template.inc,v 1.2 1999/10/21 19:31:32 kk Exp $
+ * $Id: template.inc,v 1.3 1999/10/24 10:21:24 kk Exp $
  *
  */
 
 class Template {
   var $classname = "Template";
 
+ /* if set, echo assignments */
+ var $debug = false;
+
   /* $file[handle] = "filename"; */
   var $file = array();
 
@@ -85,6 +88,24 @@
       }
     }
   }
+
+ /* public: set_dynamic(string $handle, string $name, string $parent)
+ * extract the template $handle from $parent,
+ * place variable {$name} instead.
+ */
+ function set_dynamic($handle, $name, $parent) {
+ if (!$this->loadfile($parent)) {
+ $this->halt("subst: unable to load $parent.");
+ return false;
+ }
+
+ $str = $this->get_var($parent);
+ $reg = "/<!--\s+BEGIN $handle\s+-->(.*)<!--\s+END $handle\s+-->/sm";
+ preg_match_all($reg, $str, $m);
+ $str = preg_replace($reg, "{$name}", $str);
+ $this->set_var($handle, $m[1][0]);
+ $this->set_var($parent, $str);
+ }
   
   /* public: set_var(array $values)
    * values: array of variable name, value pairs.
@@ -96,12 +117,14 @@
   function set_var($varname, $value = "") {
     if (!is_array($varname)) {
       if (!empty($varname))
+ if ($this->debug) print "scalar: set *$varname* to *$value*<br>\n";
         $this->varkeys[$varname] = "/".$this->varname($varname)."/";
         $this->varvals[$varname] = $value;
     } else {
       reset($varname);
       while(list($k, $v) = each($varname)) {
         if (!empty($k))
+ if ($this->debug) print "array: set *$k* to *$v*<br>\n";
           $this->varkeys[$k] = "/".$this->varname($k)."/";
           $this->varvals[$k] = $v;
       }
@@ -149,11 +172,10 @@
       reset($handle);
       while(list($i, $h) = each($handle)) {
         $str = $this->subst($h);
- $this->set_var($h, $str);
+ $this->set_var($target, $str);
       }
     }
     
- $this->set_var($target, $str);
     return $str;
   }
   

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.