Date: 02/28/00
- Next message: Kristian Köhntopp: "Re: [PHPLIB-DEV] anonymous cvs access?"
- Previous message: Alexander Aulbach: "Re: [PHPLIB-DEV] cvs commit"
- Next in thread: sasha: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: negro
Date: Mon Feb 28 16:58:04 2000
Modified files:
php-lib/CHANGES
php-lib/php/ct_dbm.inc
php-lib/php/tpl_form.inc
Log message:
- Added a little workaround for resource contemption on dbm opening.
- Corrected a bug in validation handling in tpl_form.inc when
process_default() method was used.
Index: php-lib/CHANGES
diff -u php-lib/CHANGES:1.162 php-lib/CHANGES:1.163
--- php-lib/CHANGES:1.162 Mon Feb 28 10:27:24 2000
+++ php-lib/CHANGES Mon Feb 28 16:57:32 2000
@@ -1,4 +1,9 @@
-$Id: CHANGES,v 1.162 2000/02/28 09:27:24 kir Exp $
+$Id: CHANGES,v 1.163 2000/02/28 15:57:32 negro Exp $
+
+28-Jan-2000 negro
+ - Added a little workaround for resource contemption on dbm opening.
+ - Corrected a bug in validation handling in tpl_form.inc when
+ process_default() method was used.
28-Feb-2000 kir
- session.inc changes:
Index: php-lib/php/ct_dbm.inc
diff -u php-lib/php/ct_dbm.inc:1.3 php-lib/php/ct_dbm.inc:1.4
--- php-lib/php/ct_dbm.inc:1.3 Fri Nov 12 08:11:24 1999
+++ php-lib/php/ct_dbm.inc Mon Feb 28 16:57:33 2000
@@ -3,72 +3,76 @@
##
## Copyright (c) 1999 Daniel Lashua <daniel.lashua <email protected>>
##
-## $Id: ct_dbm.inc,v 1.3 1999/11/12 07:11:24 kk Exp $
+## $Id: ct_dbm.inc,v 1.4 2000/02/28 15:57:33 negro Exp $
##
## PHPLIB Data Storage Container using DBM Files
##
## Code inspired by ct_shm.inc v 1.1
class CT_DBM {
- ##
- ## Define these parameters by overwriting or by
- ## deriving your own class from it (recommened)
- ##
-
- var $dbm_file = ""; ## PREEXISTING DBM File
- ## writable by the web server UID
-
- ## end of configuration
-
- var $dbmid; ## our dbm resource handle
-
- function ac_start() {
- # Open DBM file for write access
- $this->dbmid = dbmopen($this->dbm_file, "w");
- }
-
- function ac_get_lock($name, $sid) {
- # Not needed in this instance
- }
-
- function ac_release_lock($name, $sid) {
- # Not needed in this instance
- }
-
- function ac_newid($str, $name) {
- return $str;
- }
-
- function ac_store($id, $name, $str) {
- dbmreplace($this->dbmid, "$id$name", urlencode($str).";".time());
- return true;
- }
-
- function ac_delete($id, $name) {
- dbmdelete($this->dbmid, "$id$name");
- }
-
- function ac_gc($gc_time, $name) {
- $cmp = time() - $gc_time * 60;
- $i = dbmfirstkey($this->dbmid);
- while ($i) {
- $val = <email protected>($this->dbmid, $i);
- $dat = explode(";", $val);
- if(strcmp($dat[1], $cmp) < 0) {
- dbmdelete($this->dbmid, $i);
- }
- $i = dbmnextkey($this->dbmid,$i);
- }
- }
-
- function ac_halt($s) {
- echo "<b>$s</b>";
- exit;
- }
-
- function ac_get_value($id, $name) {
- $dat = explode(";", dbmfetch($this->dbmid, "$id$name"));
- return urldecode($dat[0]);
- }
+ ##
+ ## Define these parameters by overwriting or by
+ ## deriving your own class from it (recommened)
+ ##
+
+ var $dbm_file = ""; ## PREEXISTING DBM File
+ ## writable by the web server UID
+
+ ## end of configuration
+
+ var $dbmid; ## our dbm resource handle
+
+ function ac_start() {
+ # Open DBM file for write access
+ $count = 0;
+ while (! $this->dbmid && $count < 10) {
+ $this->dbmid = dbmopen($this->dbm_file, "w");
+ sleep($count++);
+ }
+ }
+
+ function ac_get_lock($name, $sid) {
+ # Not needed in this instance
+ }
+
+ function ac_release_lock($name, $sid) {
+ # Not needed in this instance
+ }
+
+ function ac_newid($str, $name) {
+ return $str;
+ }
+
+ function ac_store($id, $name, $str) {
+ dbmreplace($this->dbmid, "$id$name", urlencode($str).";".time());
+ return true;
+ }
+
+ function ac_delete($id, $name) {
+ dbmdelete($this->dbmid, "$id$name");
+ }
+
+ function ac_gc($gc_time, $name) {
+ $cmp = time() - $gc_time * 60;
+ $i = dbmfirstkey($this->dbmid);
+ while ($i) {
+ $val = <email protected>($this->dbmid, $i);
+ $dat = explode(";", $val);
+ if(strcmp($dat[1], $cmp) < 0) {
+ dbmdelete($this->dbmid, $i);
+ }
+ $i = dbmnextkey($this->dbmid,$i);
+ }
+ }
+
+ function ac_halt($s) {
+ echo "<b>$s</b>";
+ exit;
+ }
+
+ function ac_get_value($id, $name) {
+ $dat = explode(";", dbmfetch($this->dbmid, "$id$name"));
+ return urldecode($dat[0]);
+ }
}
?>
Index: php-lib/php/tpl_form.inc
diff -u php-lib/php/tpl_form.inc:1.1 php-lib/php/tpl_form.inc:1.2
--- php-lib/php/tpl_form.inc:1.1 Sat Jul 31 17:57:26 1999
+++ php-lib/php/tpl_form.inc Mon Feb 28 16:57:33 2000
@@ -5,7 +5,7 @@
##
## Depends on ooh_forms
##
-## $Id: tpl_form.inc,v 1.1 1999/07/31 15:57:26 negro Exp $
+## $Id: tpl_form.inc,v 1.2 2000/02/28 15:57:33 negro Exp $
##
class tpl_form {
@@ -151,10 +151,13 @@
# See process_input() and process_default() instead. Returns true on
# success.
function process() {
+ global $form_name;
if ($this->validate()) {
return $this->process_input();
- } else {
+ } elseif ($form_name != $this->classname) {
return $this->process_default();
+ } else {
+ return false;
}
}
-
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.
- Next message: Kristian Köhntopp: "Re: [PHPLIB-DEV] anonymous cvs access?"
- Previous message: Alexander Aulbach: "Re: [PHPLIB-DEV] cvs commit"
- Next in thread: sasha: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

