Date: 03/23/00
- Next message: Alexander Aulbach: "Re: [PHPLIB-DEV] efficiency of table class"
- Previous message: Kristian Köhntopp: "[PHPLIB-DEV] Mailing list and server outage"
- Next in thread: ssilk: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: kk
Date: Thu Mar 23 12:24:01 2000
Modified files:
php-lib/CHANGES
php-lib/VERSION
php-lib/php/prepend.php3
php-lib/php/session.inc
php-lib/php/template.inc
Log message:
- VERSION is 7.2b
- escape characters fixed in session.inc
- added pre-check and post-check headers in session.inc to
better support MSIE 5.x
- fixed broken comments in template.inc.
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/VERSION
diff -u php-lib/VERSION:1.11 php-lib/VERSION:1.12
--- php-lib/VERSION:1.11 Tue Oct 26 10:31:11 1999
+++ php-lib/VERSION Sat Nov 6 21:43:02 1999
@@ -1 +1 @@
-7.2
+7.3-dev
Index: php-lib/php/prepend.php3
diff -u php-lib/php/prepend.php3:1.11 php-lib/php/prepend.php3:1.12
--- php-lib/php/prepend.php3:1.11 Thu Oct 28 22:12:32 1999
+++ php-lib/php/prepend.php3 Wed Feb 2 00:55:54 2000
@@ -5,7 +5,7 @@
* Copyright (c) 1998,1999 SH Online Dienst GmbH
* Boris Erdmann, Kristian Koehntopp
*
- * $Id: prepend.php3,v 1.11 1999/10/28 20:12:32 kk Exp $
+ * $Id: prepend.php3,v 1.12 2000/02/01 23:55:54 ssilk Exp $
*
*/
@@ -16,20 +16,29 @@
$_PHPLIB["libdir"] = "";
}
-require($_PHPLIB["libdir"] . "db_mysql.inc"); /* Change this to match your database. */
-require($_PHPLIB["libdir"] . "ct_sql.inc"); /* Change this to match your data storage container */
-require($_PHPLIB["libdir"] . "session.inc"); /* Required for everything below. */
-require($_PHPLIB["libdir"] . "auth.inc"); /* Disable this, if you are not using authentication. */
-require($_PHPLIB["libdir"] . "perm.inc"); /* Disable this, if you are not using permission checks. */
-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"] . "menu.inc"); /* Enable this, if you want to use class Menu. */
-## require($_PHPLIB["libdir"] . "menu_button.inc"); /* Enable menu.inc and this, if you want class Menu_Button. */
-/* Additional require statements go before this line */
+require($_PHPLIB["libdir"] . "db_mysql.inc"); // Change this to match your database
+require($_PHPLIB["libdir"] . "ct_sql.inc"); // Change this to match your data storage container
+require($_PHPLIB["libdir"] . "session.inc"); // Required for everything below
-require($_PHPLIB["libdir"] . "local.inc"); /* Required, contains your local configuration. */
+// Disable the following includes, if you are not using them
+require($_PHPLIB["libdir"] . "auth.inc"); // authentication
+require($_PHPLIB["libdir"] . "auth_sql.inc"); // SQL-Db for storing authentication
-require($_PHPLIB["libdir"] . "page.inc"); /* Required, contains the page management functions. */
+require($_PHPLIB["libdir"] . "perm.inc"); // permission-checks
+require($_PHPLIB["libdir"] . "user.inc"); // per-user variables
+
+// vvv Additional require statements go below this line
+// uncomment this if you want to use
+# require($_PHPLIB["libdir"] . "menu.inc"); // class Menu
+# require($_PHPLIB["libdir"] . "menu_button.inc"); // class Menu_Button
+# require($_PHPLIB["libdir"] . "query_sql.inc"); // query creating and checking
+
+// ^^^ Additional require statements go before this line
+
+// Required, contains your local configuration
+require($_PHPLIB["libdir"] . "local.inc");
+
+// Required, contains the page management functions
+require($_PHPLIB["libdir"] . "page.inc");
?>
Index: php-lib/php/session.inc
diff -u php-lib/php/session.inc:1.61 php-lib/php/session.inc:1.62
--- php-lib/php/session.inc:1.61 Wed Feb 16 08:38:09 2000
+++ php-lib/php/session.inc Mon Feb 28 10:27:25 2000
@@ -5,11 +5,12 @@
* Copyright (c) 1998,1999 NetUSE GmbH
* Boris Erdmann, Kristian Koehntopp
*
- * $Id: session.inc,v 1.61 2000/02/16 07:38:09 kk Exp $
+ * $Id: session.inc,v 1.62 2000/02/28 09:27:25 kir Exp $
*
*/
class Session {
+
var $classname = "Session"; ## Needed for object serialization.
## Define the parameters of your session by either overwriting
@@ -24,7 +25,7 @@
## session cookie is set.
var $gc_time = 1440; ## Purge all session data older than 1440 minutes.
- var $gc_probability = 1; ## Garbage collect probability in percent
+ var $gc_probability = 5; ## Garbage collect probability in percent
var $auto_init = ""; ## Name of the autoinit-File, if any.
var $secure_auto_init = 1; ## Set to 0 only, if all pages call
@@ -81,6 +82,7 @@
}
}
+
## get_id():
##
## Propagate the session id according to mode and lifetime.
@@ -97,11 +99,15 @@
$newid=false;
switch ($this->mode) {
case "get":
- if ("" == ($id = isset($HTTP_GET_VARS[$this->name]) ? $HTTP_GET_VARS[$this->name] : ""))
- $id = isset($HTTP_POST_VARS[$this->name]) ? $HTTP_POST_VARS[$this->name] : "";
+ $id = isset($HTTP_GET_VARS[$this->name]) ?
+ $HTTP_GET_VARS[$this->name] :
+ ( isset($HTTP_POST_VARS[$this->name]) ?
+ $HTTP_POST_VARS[$this->name] :
+ "") ;
break;
case "cookie":
- $id = isset($HTTP_COOKIE_VARS[$this->name]) ? $HTTP_COOKIE_VARS[$this->name] : "";
+ $id = isset($HTTP_COOKIE_VARS[$this->name]) ?
+ $HTTP_COOKIE_VARS[$this->name] : "";
break;
default:
die("This has not been coded yet.");
@@ -114,6 +120,8 @@
$id = $this->that->ac_newid(md5(uniqid($this->magic)), $this->name);
}
+
+
switch ($this->mode) {
case "cookie":
if ( $newid && ( 0 == $this->lifetime ) ) {
@@ -122,9 +130,18 @@
if ( 0 < $this->lifetime ) {
SetCookie($this->name, $id, time()+$this->lifetime*60, "/", $this->$cookie_domain);
}
+
+ // Remove session ID info from QUERY String - it is in cookie
+ if ( !empty($QUERY_STRING) )
+ {
+ $QUERY_STRING = ereg_replace(
+ "(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
+ "", $QUERY_STRING);
+ }
+
break;
case "get":
- if ( isset($QUERY_STRING) ) {
+ if ( !empty($QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
"\\1", $QUERY_STRING);
@@ -133,8 +150,7 @@
default:
;
break;
- }
-
+ }
$this->id = $id;
}
@@ -172,17 +188,20 @@
## session $id.
function url($url){
+ // Remove existing session info from url:
+ if (strstr($url, $this->name) != false)
+ {
+ $url = ereg_replace("&*".$this->name."=[[:alnum:]]+", "", $url);
+ }
+
+ // Remove trailing ?/& if needed
$url=ereg_replace("[&?]+$", "", $url);
+
switch ($this->mode) {
case "get":
-
$url .= ( strpos($url, "?") != false ? "&" : "?" ).
urlencode($this->name)."=".$this->id;
-
- break;
- default:
- ;
break;
}
return $url;
@@ -194,9 +213,8 @@
function self_url() {
global $PHP_SELF, $QUERY_STRING;
-
return $this->url($PHP_SELF.
- ((isset($QUERY_STRING) && ("" != $QUERY_STRING)) ? "?".$QUERY_STRING : ""));
+ ((!empty($QUERY_STRING)) ? "?".$QUERY_STRING : ""));
}
function pself_url() {
@@ -229,7 +247,7 @@
global $PHP_SELF;
global $QUERY_STRING;
- if ((isset($QUERY_STRING) && ("" != $QUERY_STRING))
+ if ( !empty($QUERY_STRING)
|| ($this->mode == "get")) {
$sep_char = "&";
} else {
@@ -403,28 +421,50 @@
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
}
- function release_token( $sid = "" ){
- global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_HOST, $HTTPS;
+ function release_token( $sid = "" )
+ {
+ global $HTTP_COOKIE_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS,
+ $HTTP_HOST, $HTTPS;
+
if ( isset($this->fallback_mode)
- && ( "get" == $this->fallback_mode )
- && ( "cookie" == $this->mode )
- && ( ! isset($HTTP_COOKIE_VARS[$this->name]) ) ) {
- if ( isset($HTTP_GET_VARS[$this->name]) ) {
- $this->mode = $this->fallback_mode;
- } else {
- header("Status: 302 Moved Temporarily");
- $this->get_id($sid);
- $this->mode = $this->fallback_mode;
- if( isset($HTTPS) && $HTTPS == 'on' ){
- ## You will need to fix suexec as well, if you use Apache and CGI PHP
- $PROTOCOL='https';
- } else {
- $PROTOCOL='http';
+ && ( "get" == $this->fallback_mode )
+ && ( "cookie" == $this->mode )
+ && ( ! isset($HTTP_COOKIE_VARS[$this->name]) )
+ )
+ {
+
+ // Looks like no cookie here - check GET/POST params
+ if ( isset($HTTP_GET_VARS[$this->name]) ||
+ isset($HTTP_POST_VARS[$this->name]) )
+ {
+ // Session info passed via GET/POST - go to fallback_mode
+ $this->mode = $this->fallback_mode;
+ }
+ else
+ {
+ // It seems to be the first load of this page -
+ // no cookie and no GET/POST params
+
+ header("Status: 302 Moved Temporarily");
+
+ // Generate session ID and setup cookie.
+ $this->get_id($sid);
+
+ // Next line is to generate correct self_url() later
+ $this->mode = $this->fallback_mode;
+
+ if( isset($HTTPS) && $HTTPS == 'on' ) {
+ ## You will need to fix suexec as well,
+ ## if you use Apache and CGI PHP
+ $PROTOCOL='https';
+ } else {
+ $PROTOCOL='http';
+ }
+
+ header("Location: ". $PROTOCOL. "://".$HTTP_HOST.$this->self_url());
+ exit;
}
- header("Location: ". $PROTOCOL. "://".$HTTP_HOST.$this->self_url());
- exit;
}
- }
}
function put_headers() {
@@ -481,8 +521,8 @@
function start($sid = "") {
$this->set_container();
$this->set_tokenname();
- $this->release_token($sid);
$this->put_headers();
+ $this->release_token($sid);
$this->get_id($sid);
$this->thaw();
$this->gc();
Index: php-lib/php/template.inc
diff -u php-lib/php/template.inc:1.12 php-lib/php/template.inc:1.13
--- php-lib/php/template.inc:1.12 Sat Jan 15 09:14:27 2000
+++ php-lib/php/template.inc Sat Jan 15 15:11:24 2000
@@ -5,7 +5,7 @@
* (C) Copyright 1999 NetUSE GmbH
* Kristian Koehntopp
*
- * $Id: template.inc,v 1.12 2000/01/15 08:14:27 carmelo Exp $
+ * $Id: template.inc,v 1.13 2000/01/15 14:11:24 carmelo Exp $
*
*/
@@ -391,11 +391,22 @@
preg_match_all($reg, $str, $m);
/* implode the subblock to the requested alias */
- $str = preg_replace($reg, "{$alias}", $str);
-
- if ($this->debug & 4)
- printf("<b>implode_block:</b> extract <b>$varname</b> from <b>$parent</b>, leaving {$alias}<br>\n");
-
+ //check the version of php
+ //carmelo
+ $checkversion=1;
+ if ("{$checkversion}"==1) $str = preg_replace($reg, "\{$alias}", $str);
+ else $str = preg_replace($reg, "{$alias}", $str);
+
+ if ($this->debug & 4) {
+ $checkversion=1;
+ if ("{$checkversion}"==1) {
+ printf("<b>implode_block:</b> extract <b>$varname</b> from <b>$parent</b>, leaving \{$alias}<br>\n");
+ } else {
+ printf("<b>implode_block:</b> extract <b>$varname</b> from <b>$parent</b>, leaving {$alias}<br>\n");
+ }
+ }
+ //end change
+
/* update variables */
$this->set_var($varname, $m[1][0]);
$this->set_var($parent, $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.
- Next message: Alexander Aulbach: "Re: [PHPLIB-DEV] efficiency of table class"
- Previous message: Kristian Köhntopp: "[PHPLIB-DEV] Mailing list and server outage"
- Next in thread: ssilk: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

