[PHPLIB-DEV] cvs commit From: kk (phplib-dev <email protected>)
Date: 04/25/00

From: kk
Date: Tue Apr 25 08:05:32 2000
Modified files:
      php-lib-stable/CHANGES
      php-lib-stable/php/cart.inc
      php-lib-stable/php/db_pgsql.inc
      php-lib-stable/php/template.inc

Log message:
Tracked changes from master rep.

Index: php-lib-stable/CHANGES
diff -u php-lib-stable/CHANGES:1.2 php-lib-stable/CHANGES:1.3
--- php-lib-stable/CHANGES:1.2 Mon Apr 17 18:48:30 2000
+++ php-lib-stable/CHANGES Tue Apr 25 08:04:55 2000
@@ -1,4 +1,8 @@
-$Id: CHANGES,v 1.2 2000/04/17 16:48:30 kk Exp $
+$Id: CHANGES,v 1.3 2000/04/25 06:04:55 kk Exp $
+
+22-Apr-2000 kk
+ - Tracked changes to template.inc and cart.inc from master repository.
+ - Tracked change to db_pgsql.inc.
 
 17-Apr-2000 kk
   - Added allowcache mode "passive".
Index: php-lib-stable/php/cart.inc
diff -u php-lib-stable/php/cart.inc:1.1 php-lib-stable/php/cart.inc:1.2
--- php-lib-stable/php/cart.inc:1.1 Mon Apr 17 18:40:15 2000
+++ php-lib-stable/php/cart.inc Tue Apr 25 08:04:56 2000
@@ -5,7 +5,7 @@
  * Copyright (c) 1998,1999 SH Online Dienst GmbH
  * Boris Erdmann, Kristian Koehntopp
  *
- * $Id: cart.inc,v 1.1 2000/04/17 16:40:15 kk Exp $
+ * $Id: cart.inc,v 1.2 2000/04/25 06:04:56 kk Exp $
  *
  */
 
@@ -148,7 +148,7 @@
   # Iterator to show cart contents.
   #
   function show_all() {
- if (!is_array($this->item) or ($this->item) == 0) {
+ if (!is_array($this->item) or $this->num_items() == 0) {
       $this->show_empty_cart();
       return false;
     }
Index: php-lib-stable/php/db_pgsql.inc
diff -u php-lib-stable/php/db_pgsql.inc:1.1 php-lib-stable/php/db_pgsql.inc:1.2
--- php-lib-stable/php/db_pgsql.inc:1.1 Mon Apr 17 18:40:14 2000
+++ php-lib-stable/php/db_pgsql.inc Tue Apr 25 08:04:57 2000
@@ -5,7 +5,7 @@
  * Copyright (c) 1998,1999 SH Online Dienst GmbH
  * Boris Erdmann, Kristian Koehntopp
  *
- * $Id: db_pgsql.inc,v 1.1 2000/04/17 16:40:14 kk Exp $
+ * $Id: db_pgsql.inc,v 1.2 2000/04/25 06:04:57 kk Exp $
  *
  */
 
@@ -20,6 +20,8 @@
   var $Record = array();
   var $Row = 0;
 
+ var $Seq_Table = "db_sequence";
+
   var $Errno = 0;
   var $Error = "";
 
@@ -91,6 +93,46 @@
   function unlock() {
     return pg_Exec($this->Link_ID, "commit");
   }
+
+
+ /* public: sequence numbers */
+ function nextid($seq_name) {
+ $this->connect();
+
+ if ($this->lock($this->Seq_Table)) {
+ /* get sequence number (locked) and increment */
+ $q = sprintf("select nextid from %s where seq_name = '%s'",
+ $this->Seq_Table,
+ $seq_name);
+ $id =  <email protected>($this->Link_ID, $q);
+ $res =  <email protected>($id, 0);
+
+ /* No current value, make one */
+ if (!is_array($res)) {
+ $currentid = 0;
+ $q = sprintf("insert into %s values('%s', %s)",
+ $this->Seq_Table,
+ $seq_name,
+ $currentid);
+ $id =  <email protected>($this->Link_ID, $q);
+ } else {
+ $currentid = $res["nextid"];
+ }
+ $nextid = $currentid + 1;
+ $q = sprintf("update %s set nextid = '%s' where seq_name = '%s'",
+ $this->Seq_Table,
+ $nextid,
+ $seq_name);
+ $id =  <email protected>($this->Link_ID, $q);
+ $this->unlock();
+ } else {
+ $this->halt("cannot lock ".$this->Seq_Table." - has it been created?");
+ return 0;
+ }
+ return $nextid;
+ }
+
+
 
   function metadata($table) {
     $count = 0;
Index: php-lib-stable/php/template.inc
diff -u php-lib-stable/php/template.inc:1.1 php-lib-stable/php/template.inc:1.2
--- php-lib-stable/php/template.inc:1.1 Mon Apr 17 18:40:17 2000
+++ php-lib-stable/php/template.inc Tue Apr 25 08:04:58 2000
@@ -5,7 +5,7 @@
  * (C) Copyright 1999 NetUSE GmbH
  * Kristian Koehntopp
  *
- * $Id: template.inc,v 1.1 2000/04/17 16:40:17 kk Exp $
+ * $Id: template.inc,v 1.2 2000/04/25 06:04:58 kk Exp $
  *
  */
 
@@ -253,11 +253,11 @@
       break;
       
       case "remove":
- $str = preg_replace("/\{[^}]+\}/", "", $str);
+ $str = preg_replace('/{[^ \t\r\n}]+}/', "", $str);
       break;
 
       case "comment":
- $str = preg_replace("/\{([^}]+)\}/", "<!-- Template $handle: Variable \\1 undefined -->", $str);
+ $str = preg_replace('/{([^ \t\r\n}]+)}/', "<!-- Template $handle: Variable \\1 undefined -->", $str);
       break;
     }
     
@@ -301,7 +301,7 @@
    * handle: load file defined by handle, if it is not loaded yet.
    */
   function loadfile($handle) {
- if ($this->varkeys[$handle] and !empty($this->varvals[$handle]))
+ if (isset($this->varkeys[$handle]) and !empty($this->varvals[$handle]))
       return true;
 
     if (!isset($this->file[$handle])) {

-
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.