phplib-commit Mailing List for PHPLIB (Page 7)
Brought to you by:
nhruby,
richardarcher
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(76) |
Sep
(7) |
Oct
(2) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(7) |
Feb
(7) |
Mar
(14) |
Apr
(27) |
May
(2) |
Jun
(2) |
Jul
(5) |
Aug
(6) |
Sep
(1) |
Oct
(9) |
Nov
(4) |
Dec
|
| 2003 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2005 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(3) |
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
(6) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Richard A. <ric...@us...> - 2001-08-21 12:57:18
|
Update of /cvsroot/phplib/php-lib-stable/pages/menu
In directory usw-pr-cvs1:/tmp/cvs-serv7202
Added Files:
index.php3 item1.php3 item11.php3 item12.php3 item13.php3
item2.php3 item21.php3 item22.php3 item221.php3 item222.php3
item23.php3 item24.php3
Log Message:
add the menu.inc demo pages
--- NEW FILE: index.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: index.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item1.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item1.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item11.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item11.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item12.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item12.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item13.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item13.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item2.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item2.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item21.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item21.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item22.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item22.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item221.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item221.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item222.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item222.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item23.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item23.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
--- NEW FILE: item24.php3 ---
<?php
// include("prepend.php3");
$m = new Example_Menu;
?><html>
<!-- $Id: item24.php3,v 1.1 2001/08/21 12:57:15 richardarcher Exp $ -->
<head>
<title><?php print $m->get_title() ?></title>
</head>
<body bgcolor="#ffffff">
<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1><?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
<p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
table. Only later I will see how this looks.</p>
<p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
without content.</p>
</td>
</tr>
</table>
</body>
</html>
|
|
From: Richard A. <ric...@us...> - 2001-08-21 12:56:52
|
Update of /cvsroot/phplib/php-lib-stable/pages/menu In directory usw-pr-cvs1:/tmp/cvs-serv6896/menu Log Message: Directory /cvsroot/phplib/php-lib-stable/pages/menu added to the repository |
|
From: Richard A. <ric...@us...> - 2001-08-21 12:56:25
|
Update of /cvsroot/phplib/php-lib/php
In directory usw-pr-cvs1:/tmp/cvs-serv6744
Modified Files:
prepend.php3
Log Message:
load the PHP4 files when appropriate
Index: prepend.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/prepend.php3,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** prepend.php3 2001/07/14 20:24:15 1.20
--- prepend.php3 2001/08/21 12:56:22 1.21
***************
*** 12,17 ****
$_PHPLIB = array();
! # Can't control your include path?
! # Point this to your PHPLIB base directory. Use trailing "/"!
$_PHPLIB["libdir"] = "";
--- 12,17 ----
$_PHPLIB = array();
! # Can't control your include path?
! # Point this to your PHPLIB base directory. Use a trailing "/"!
$_PHPLIB["libdir"] = "";
***************
*** 32,36 ****
# Load database connector classes
- require($_PHPLIB["libdir"] . "db/db_sql.inc");
require($_PHPLIB["libdir"] . "db/" . $_PHPLIB["db"] . "/db_sql.inc");
require($_PHPLIB["libdir"] . "db/" . $_PHPLIB["db"] . "/ct_sql.inc");
--- 32,35 ----
***************
*** 42,46 ****
# Load authentication management classes
! require($_PHPLIB["libdir"] . "auth/auth.inc");
require($_PHPLIB["libdir"] . "auth/" . $_PHPLIB["auth"] . "/auth.inc");
--- 41,47 ----
# Load authentication management classes
! require($_PHPLIB["libdir"] . "auth/auth"
! . (($_PHPLIB["version"] == "4") ? "4" : "") // use auth4.inc if PHP4
! . ".inc");
require($_PHPLIB["libdir"] . "auth/" . $_PHPLIB["auth"] . "/auth.inc");
***************
*** 59,63 ****
# Load local subclass definitions
! require($_PHPLIB["libdir"] . "local.inc");
# Load page management functions
--- 60,66 ----
# Load local subclass definitions
! require($_PHPLIB["libdir"] . "local"
! . (($_PHPLIB["version"] == "4") ? "4" : "") // use local4.inc if PHP4
! . ".inc");
# Load page management functions
|
|
From: Richard A. <ric...@us...> - 2001-08-21 12:56:05
|
Update of /cvsroot/phplib/php-lib/php
In directory usw-pr-cvs1:/tmp/cvs-serv6050
Modified Files:
local.inc local4.inc
Log Message:
Sync the various local.inc files, and a few bug fixes
Index: local.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/local.inc,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** local.inc 2000/04/03 10:39:57 1.33
--- local.inc 2001/08/21 12:56:02 1.34
***************
*** 90,93 ****
--- 90,94 ----
class Example_Auth extends Auth_Sql {
var $classname = "Example_Auth";
+
var $lifetime = 15;
var $mode = "reg"; ## can do "log" as well.
***************
*** 99,102 ****
--- 100,109 ----
}
+ class Example_Default_Auth extends Example_Auth {
+ var $classname = "Example_Default_Auth";
+
+ var $nobody = true;
+ }
+
# A variation of Example_Auth which uses a Challenge-Response
# Authentication. The password never crosses the net in clear,
***************
*** 108,112 ****
var $classname = "Example_Challenge_Auth";
! var $lifetime = 15;
var $magic = "Simsalabim"; ## Challenge seed
--- 115,119 ----
var $classname = "Example_Challenge_Auth";
! var $lifetime = 15;
var $magic = "Simsalabim"; ## Challenge seed
***************
*** 178,182 ****
## doChallengeResponse()
! class Example_Challenge_Crypt_Auth extends Auth {
var $classname = "Example_Challenge_Crypt_Auth";
--- 185,189 ----
## doChallengeResponse()
! class Example_Challenge_Crypt_Auth extends Auth_Sql {
var $classname = "Example_Challenge_Crypt_Auth";
***************
*** 203,207 ****
}
-
function auth_validatelogin() {
global $username, $password, $mode;
--- 210,213 ----
***************
*** 229,233 ****
while($this->db->next_record()) {
$pwenc = $this->db->f("p_pwenc");
! $p = $this->db->f("p_password");
$salt = ($pwenc == "crypt")?substr($p, 0, 2):"";
--- 235,239 ----
while($this->db->next_record()) {
$pwenc = $this->db->f("p_pwenc");
! $p = $this->db->f("p_password");
$salt = ($pwenc == "crypt")?substr($p, 0, 2):"";
***************
*** 248,252 ****
return $uid;
}
-
}
--- 254,257 ----
***************
*** 276,282 ****
##
## Example_Menu may extend Menu or Menu_Button
! ## If you name this class differently, you must also
! ## rename its constructor function - this is a PHP3 language
! ## design stupidity.
##
## To use this, you must enable the require statement for
--- 281,289 ----
##
## Example_Menu may extend Menu or Menu_Button
! ## Remember that in PHP 3 a class's constructor function must have the
! ## same name as the class. To make it easier to extend this class we
! ## have a real constructor function called setup(). When you create an
! ## extension of this class, create your constructor function which only
! ## needs to call setup().
##
## To use this, you must enable the require statement for
***************
*** 314,318 ****
# "/2" => array("title" => "Text 2"),
# "/2/1" => array("title" => "Text 2.1"),
! # "/2/2" => array("title" => "Text 2.2"),
# "/2/2/1"=> array("title" => "Text 2.2.1"),
# "/2/2/2"=> array("title" => "Text 2.2.2"),
--- 321,325 ----
# "/2" => array("title" => "Text 2"),
# "/2/1" => array("title" => "Text 2.1"),
! # "/2/2" => array("title" => "Text 2.2", "pseudo" => true),
# "/2/2/1"=> array("title" => "Text 2.2.1"),
# "/2/2/2"=> array("title" => "Text 2.2.2"),
***************
*** 320,324 ****
# "/2/4" => array("title" => "Text 2.4")
# );
! #
# function Example_Menu() {
# $this->setup();
--- 327,331 ----
# "/2/4" => array("title" => "Text 2.4")
# );
! #
# function Example_Menu() {
# $this->setup();
Index: local4.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/local4.inc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** local4.inc 2001/05/30 13:16:49 1.1
--- local4.inc 2001/08/21 12:56:02 1.2
***************
*** 68,75 ****
#}
class Example_Session_Custom extends Session_Custom {
var $classname = "Example_Session_Custom";
! var $mode = "user"
var $cookiename = ""; ## defaults to classname
var $lifetime = 0; ## 0 = do session cookies, else minutes
--- 68,82 ----
#}
+ class Example_Session extends Session {
+ var $classname = "Example_Session";
+
+ var $cookiename = ""; ## defaults to classname
+ var $allowcache = "nocache"; ## "public", "private", or "nocache"
+ }
+
class Example_Session_Custom extends Session_Custom {
var $classname = "Example_Session_Custom";
! var $mode = "user";
var $cookiename = ""; ## defaults to classname
var $lifetime = 0; ## 0 = do session cookies, else minutes
***************
*** 79,89 ****
}
- class Example_Session extends Session {
- var $classname = "Example_Session";
-
- var $cookiename = ""; ## defaults to classname
- var $allowcache = "nocache";
- }
-
class Example_User extends User {
var $classname = "Example_User";
--- 86,89 ----
***************
*** 94,97 ****
--- 94,98 ----
class Example_Auth extends Auth_Sql {
var $classname = "Example_Auth";
+
var $lifetime = 15;
var $mode = "reg"; ## can do "log" as well.
***************
*** 103,106 ****
--- 104,113 ----
}
+ class Example_Default_Auth extends Example_Auth {
+ var $classname = "Example_Default_Auth";
+
+ var $nobody = true;
+ }
+
# A variation of Example_Auth which uses a Challenge-Response
# Authentication. The password never crosses the net in clear,
***************
*** 182,186 ****
## doChallengeResponse()
! class Example_Challenge_Crypt_Auth extends Auth {
var $classname = "Example_Challenge_Crypt_Auth";
--- 189,193 ----
## doChallengeResponse()
! class Example_Challenge_Crypt_Auth extends Auth_Sql {
var $classname = "Example_Challenge_Crypt_Auth";
***************
*** 207,211 ****
}
-
function auth_validatelogin() {
global $username, $password, $mode;
--- 214,217 ----
***************
*** 233,237 ****
while($this->db->next_record()) {
$pwenc = $this->db->f("p_pwenc");
! $p = $this->db->f("p_password");
$salt = ($pwenc == "crypt")?substr($p, 0, 2):"";
--- 239,243 ----
while($this->db->next_record()) {
$pwenc = $this->db->f("p_pwenc");
! $p = $this->db->f("p_password");
$salt = ($pwenc == "crypt")?substr($p, 0, 2):"";
***************
*** 252,256 ****
return $uid;
}
-
}
--- 258,261 ----
***************
*** 280,286 ****
##
## Example_Menu may extend Menu or Menu_Button
! ## If you name this class differently, you must also
! ## rename its constructor function - this is a PHP3 language
! ## design stupidity.
##
## To use this, you must enable the require statement for
--- 285,293 ----
##
## Example_Menu may extend Menu or Menu_Button
! ## Remember that in PHP 3 a class's constructor function must have the
! ## same name as the class. To make it easier to extend this class we
! ## have a real constructor function called setup(). When you create an
! ## extension of this class, create your constructor function which only
! ## needs to call setup().
##
## To use this, you must enable the require statement for
***************
*** 318,322 ****
# "/2" => array("title" => "Text 2"),
# "/2/1" => array("title" => "Text 2.1"),
! # "/2/2" => array("title" => "Text 2.2"),
# "/2/2/1"=> array("title" => "Text 2.2.1"),
# "/2/2/2"=> array("title" => "Text 2.2.2"),
--- 325,329 ----
# "/2" => array("title" => "Text 2"),
# "/2/1" => array("title" => "Text 2.1"),
! # "/2/2" => array("title" => "Text 2.2", "pseudo" => true),
# "/2/2/1"=> array("title" => "Text 2.2.1"),
# "/2/2/2"=> array("title" => "Text 2.2.2"),
***************
*** 324,328 ****
# "/2/4" => array("title" => "Text 2.4")
# );
! #
# function Example_Menu() {
# $this->setup();
--- 331,335 ----
# "/2/4" => array("title" => "Text 2.4")
# );
! #
# function Example_Menu() {
# $this->setup();
|
|
From: Richard A. <ric...@us...> - 2001-08-21 12:54:14
|
Update of /cvsroot/phplib/php-lib/pages/menu
In directory usw-pr-cvs1:/tmp/cvs-serv5296
Modified Files:
index.php3 item1.php3 item11.php3 item12.php3 item13.php3
item2.php3 item21.php3 item22.php3 item221.php3 item222.php3
item23.php3 item24.php3
Log Message:
Minor changes to the menu demo
Index: index.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/index.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** index.php3 1999/10/28 20:15:55 1.2
--- index.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item1.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item1.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item1.php3 1999/10/28 20:15:55 1.2
--- item1.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item11.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item11.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item11.php3 1999/10/28 20:15:55 1.2
--- item11.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item12.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item12.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item12.php3 1999/10/28 20:15:55 1.2
--- item12.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item13.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item13.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item13.php3 1999/10/28 20:15:55 1.2
--- item13.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item2.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item2.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item2.php3 1999/10/28 20:15:55 1.2
--- item2.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item21.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item21.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item21.php3 1999/10/28 20:15:55 1.2
--- item21.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item22.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item22.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item22.php3 1999/10/28 20:15:55 1.2
--- item22.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item221.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item221.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item221.php3 1999/10/28 20:15:55 1.2
--- item221.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item222.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item222.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item222.php3 1999/10/28 20:15:55 1.2
--- item222.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item23.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item23.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item23.php3 1999/10/28 20:15:56 1.2
--- item23.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
Index: item24.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/menu/item24.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** item24.php3 1999/10/28 20:15:56 1.2
--- item24.php3 2001/08/21 12:54:11 1.3
***************
*** 1,8 ****
<?php
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title>Page with a menu</title>
</head>
--- 1,9 ----
<?php
+ // include("prepend.php3");
$m = new Example_Menu;
! ?><html>
<!-- $Id$ -->
<head>
! <title><?php print $m->get_title() ?></title>
</head>
***************
*** 11,15 ****
<tr>
<td colspan=2 valign=top align=center>
! <h1>Page with a menu</h1>
</td>
</tr>
--- 12,16 ----
<tr>
<td colspan=2 valign=top align=center>
! <h1><?php print $m->title ?></h1>
</td>
</tr>
***************
*** 17,32 ****
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.<p>
! Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.
</td>
</tr>
--- 18,33 ----
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>
! <p>This page has some useless content which is just here to
fill the gap and create some grey on the page for everybody to
see and to read. I am babbling on and typing useless stuff just
so that I can see some letters on the page and to widen the
! table. Only later I will see how this looks.</p>
! <p>Imagine what will happen if somebody in 2000 years tries to read
and decipher this text. They will spend countless hours
reconstructing the antique media, find a language expert for
ancient english and translate it into whatever they speak at the
time only to discover this is meaningless. A voice from the past
! without content.</p>
</td>
</tr>
|
|
From: Richard A. <ric...@us...> - 2001-08-21 02:20:56
|
Update of /cvsroot/phplib/php-lib/php/db/mysql
In directory usw-pr-cvs1:/tmp/cvs-serv20417
Modified Files:
db_sql.inc
Log Message:
Fix a bug I just made!
Index: db_sql.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/db/mysql/db_sql.inc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** db_sql.inc 2001/08/21 02:02:43 1.7
--- db_sql.inc 2001/08/21 02:20:52 1.8
***************
*** 393,397 ****
$h = @mysql_query("show tables", $this->Link_ID);
$i = 0;
! while ($info = @mysql_fetch_row($this->Query_ID)) {
$return[$i]["table_name"] = $info[0];
$return[$i]["tablespace_name"] = $this->Database;
--- 393,397 ----
$h = @mysql_query("show tables", $this->Link_ID);
$i = 0;
! while ($info = @mysql_fetch_row($h)) {
$return[$i]["table_name"] = $info[0];
$return[$i]["tablespace_name"] = $this->Database;
|
|
From: Richard A. <ric...@us...> - 2001-08-21 02:20:08
|
Update of /cvsroot/phplib/php-lib-stable/php
In directory usw-pr-cvs1:/tmp/cvs-serv18195
Modified Files:
db_mysql.inc
Log Message:
Sync with -devel tree:
clean up whitespace and comments
move the table_names() function
use -devel version of table_names() function which does not use $this->query()
Index: db_mysql.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/php/db_mysql.inc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** db_mysql.inc 2001/08/13 23:12:01 1.6
--- db_mysql.inc 2001/08/21 02:20:04 1.7
***************
*** 151,155 ****
$this->Row = $pos;
else {
! $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows");
/* half assed attempt to save the day,
--- 151,155 ----
$this->Row = $pos;
else {
! $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows.");
/* half assed attempt to save the day,
***************
*** 201,205 ****
}
-
/* public: evaluate the result (size, width) */
function affected_rows() {
--- 201,204 ----
***************
*** 274,278 ****
/* public: return table metadata */
! function metadata($table='',$full=false) {
$count = 0;
$id = 0;
--- 273,277 ----
/* public: return table metadata */
! function metadata($table = "", $full = false) {
$count = 0;
$id = 0;
***************
*** 301,305 ****
* [0]["flags"] field flags
* ["meta"][field name] index of field named "field name"
! * The last one is used, if you have a field name, but no index.
* Test: if (isset($result['meta']['myfield'])) { ...
*/
--- 300,304 ----
* [0]["flags"] field flags
* ["meta"][field name] index of field named "field name"
! * This last one could be used if you have a field name, but no index.
* Test: if (isset($result['meta']['myfield'])) { ...
*/
***************
*** 347,354 ****
// free the result only if we were called on a table
! if ($table) @mysql_free_result($id);
return $res;
}
/* private: error handling */
function halt($msg) {
--- 346,371 ----
// free the result only if we were called on a table
! if ($table) {
! @mysql_free_result($id);
! }
return $res;
}
+ /* public: find available table names */
+ function table_names() {
+ $this->connect();
+ $h = @mysql_query("show tables", $this->Link_ID);
+ $i = 0;
+ while ($info = @mysql_fetch_row($h)) {
+ $return[$i]["table_name"] = $info[0];
+ $return[$i]["tablespace_name"] = $this->Database;
+ $return[$i]["database"] = $this->Database;
+ $i++;
+ }
+
+ @mysql_free_result($h);
+ return $return;
+ }
+
/* private: error handling */
function halt($msg) {
***************
*** 371,386 ****
}
- function table_names() {
- $this->query("SHOW TABLES");
- $i=0;
- while ($info=mysql_fetch_row($this->Query_ID))
- {
- $return[$i]["table_name"]= $info[0];
- $return[$i]["tablespace_name"]=$this->Database;
- $return[$i]["database"]=$this->Database;
- $i++;
- }
- return $return;
- }
}
?>
--- 388,391 ----
|
|
From: Richard A. <ric...@us...> - 2001-08-21 02:02:46
|
Update of /cvsroot/phplib/php-lib/php/db/mysql
In directory usw-pr-cvs1:/tmp/cvs-serv17501/mysql
Modified Files:
db_sql.inc
Log Message:
Sync mysql/db_sql.inc with -stable tree:
fix some uninitialized variable access warnings
clean up some tabs, whitespace and comments
delete extraneous db/db_sql.inc
Index: db_sql.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/db/mysql/db_sql.inc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** db_sql.inc 2001/08/21 01:36:54 1.6
--- db_sql.inc 2001/08/21 02:02:43 1.7
***************
*** 224,232 ****
function f($Name) {
! return $this->Record[$Name];
}
function p($Name) {
! print $this->Record[$Name];
}
--- 224,236 ----
function f($Name) {
! if (isset($this->Record[$Name])) {
! return $this->Record[$Name];
! }
}
function p($Name) {
! if (isset($this->Record[$Name])) {
! print $this->Record[$Name];
! }
}
***************
*** 287,291 ****
* [0]["flags"] field flags
*
! * - full is true (was mainly introduced for the Query-class)
* $result[]:
* ["num_fields"] number of metadata records
--- 291,295 ----
* [0]["flags"] field flags
*
! * - full is true
* $result[]:
* ["num_fields"] number of metadata records
***************
*** 297,302 ****
* [0]["php_type"] the correspondig PHP-type
* [0]["php_subtype"] the subtype of PHP-type
! * ["meta"][field name] index-num of field named "field name"
! * This could used, if you have the name, but no index-num - very fast
* [unique] = field names which have an unique key, separated by space
*/
--- 301,307 ----
* [0]["php_type"] the correspondig PHP-type
* [0]["php_subtype"] the subtype of PHP-type
! * ["meta"][field name] index of field named "field name"
! * This last one could be used if you have a field name, but no index.
! * Test: if (isset($result['meta']['myfield'])) { ...
* [unique] = field names which have an unique key, separated by space
*/
***************
*** 331,335 ****
}
} else { // full
! $uniq=ARRAY();
$res["num_fields"]= $count;
--- 336,340 ----
}
} else { // full
! $uniq=array();
$res["num_fields"]= $count;
***************
*** 368,375 ****
$res[$i]["php_subtype"]="";
break;
! }
! if ( ereg("(unique_key|primary_key)",$res[$i]["flags"]) ) {
$uniq[]=$res[$i]["name"];
! }
}
$res["unique"]=join(" ",$uniq);
--- 373,380 ----
$res[$i]["php_subtype"]="";
break;
! }
! if ( ereg("(unique_key|primary_key)",$res[$i]["flags"]) ) {
$uniq[]=$res[$i]["name"];
! }
}
$res["unique"]=join(" ",$uniq);
***************
*** 377,382 ****
// free the result only if we were called on a table
! if ($table)
@mysql_free_result($id);
return $res;
}
--- 382,388 ----
// free the result only if we were called on a table
! if ($table) {
@mysql_free_result($id);
+ }
return $res;
}
***************
*** 388,394 ****
$i = 0;
while ($info = @mysql_fetch_row($this->Query_ID)) {
! $return[$i]["table_name"]= $info[0];
! $return[$i]["tablespace_name"]=$this->Database;
! $return[$i]["database"]=$this->Database;
$i++;
}
--- 394,400 ----
$i = 0;
while ($info = @mysql_fetch_row($this->Query_ID)) {
! $return[$i]["table_name"] = $info[0];
! $return[$i]["tablespace_name"] = $this->Database;
! $return[$i]["database"] = $this->Database;
$i++;
}
***************
*** 420,422 ****
}
?>
-
--- 426,427 ----
|
|
From: Richard A. <ric...@us...> - 2001-08-21 02:02:46
|
Update of /cvsroot/phplib/php-lib/php/db In directory usw-pr-cvs1:/tmp/cvs-serv17501 Removed Files: db_sql.inc Log Message: Sync mysql/db_sql.inc with -stable tree: fix some uninitialized variable access warnings clean up some tabs, whitespace and comments delete extraneous db/db_sql.inc --- db_sql.inc DELETED --- |
|
From: Richard A. <ric...@us...> - 2001-08-21 01:36:56
|
Update of /cvsroot/phplib/php-lib/php/db/mysql
In directory usw-pr-cvs1:/tmp/cvs-serv13566
Modified Files:
db_sql.inc
Log Message:
Reverting to version 1.1 of db_sql and re-applying the recent patches.
The DB_Generic_Sql class concept is a good one. It moves a lot of
the common code into a parent class so the DB-specific code is easier
to maintain. But the code is incomplete, and reverting is the fastest
way to get things working again.
Index: db_sql.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/db/mysql/db_sql.inc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** db_sql.inc 2001/08/13 23:07:42 1.5
--- db_sql.inc 2001/08/21 01:36:54 1.6
***************
*** 3,8 ****
* Session Management for PHP3
*
! * Copyright (c) 1998-2000 NetUSE GmbH
! * Boris Erdmann, Kristian Koehntopp
*
* $Id$
--- 3,8 ----
* Session Management for PHP3
*
! * Copyright (c) 1998,1999 NetUSE GmbH
! * Boris Erdmann, Kristian Koehntopp
*
* $Id$
***************
*** 10,39 ****
*/
! class DB_MySQL_Sql extends DB_Generic_Sql {
/* public: connection parameters */
! var $Host = '';
! var $Database = '';
! var $User = '';
! var $Password = '';
/* public: this is an api revision, not a CVS revision. */
! var $type = 'mysql';
! var $revision = '1.3';
/* public: constructor */
! function DB_MySQL_Sql($query = '') {
$this->query($query);
}
/* public: connection management */
! function connect($Database = '', $Host = '', $User = '', $Password = '') {
/* Handle defaults */
! if ('' == $Database)
$Database = $this->Database;
! if ('' == $Host)
$Host = $this->Host;
! if ('' == $User)
$User = $this->User;
! if ('' == $Password)
$Password = $this->Password;
--- 10,69 ----
*/
! class DB_Sql {
!
/* public: connection parameters */
! var $Host = "";
! var $Database = "";
! var $User = "";
! var $Password = "";
+ /* public: configuration parameters */
+ var $Auto_Free = 0; ## Set to 1 for automatic mysql_free_result()
+ var $Debug = 0; ## Set to 1 for debugging messages.
+ var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)
+ var $Seq_Table = "db_sequence";
+
+ /* public: result array and current row number */
+ var $Record = array();
+ var $Row;
+
+ /* public: current error number and error text */
+ var $Errno = 0;
+ var $Error = "";
+
/* public: this is an api revision, not a CVS revision. */
! var $type = "mysql";
! var $revision = "1.2";
+ /* private: link and query handles */
+ var $Link_ID = 0;
+ var $Query_ID = 0;
+
+
+
/* public: constructor */
! function DB_Sql($query = "") {
$this->query($query);
}
+ /* public: some trivial reporting */
+ function link_id() {
+ return $this->Link_ID;
+ }
+
+ function query_id() {
+ return $this->Query_ID;
+ }
+
/* public: connection management */
! function connect($Database = "", $Host = "", $User = "", $Password = "") {
/* Handle defaults */
! if ("" == $Database)
$Database = $this->Database;
! if ("" == $Host)
$Host = $this->Host;
! if ("" == $User)
$User = $this->User;
! if ("" == $Password)
$Password = $this->Password;
***************
*** 48,52 ****
if (!@mysql_select_db($Database,$this->Link_ID)) {
! $this->halt('cannot use database '.$Database);
return 0;
}
--- 78,82 ----
if (!@mysql_select_db($Database,$this->Link_ID)) {
! $this->halt("cannot use database ".$Database);
return 0;
}
***************
*** 64,73 ****
/* public: perform a query */
function query($Query_String) {
! if ($Query_String == '')
return 0;
- $this->Query_Str = $Query_String;
if (!$this->connect()) {
! return false; /* we already complained in connect() about that. */
};
--- 94,107 ----
/* public: perform a query */
function query($Query_String) {
! /* No empty queries, please, since PHP4 chokes on them. */
! if ($Query_String == "")
! /* The empty query string is passed on from the constructor,
! * when calling the class without a query, e.g. in situations
! * like these: '$db = new DB_Sql_Subclass;'
! */
return 0;
if (!$this->connect()) {
! return 0; /* we already complained in connect() about that. */
};
***************
*** 78,88 ****
if ($this->Debug)
! printf('Debug: query = %s<br>\n', $Query_String);
$this->Query_ID = @mysql_query($Query_String,$this->Link_ID);
$this->Row = 0;
! $this->check_error();
if (!$this->Query_ID) {
! $this->halt('Query failed.');
}
--- 112,123 ----
if ($this->Debug)
! printf("Debug: query = %s<br>\n", $Query_String);
$this->Query_ID = @mysql_query($Query_String,$this->Link_ID);
$this->Row = 0;
! $this->Errno = mysql_errno();
! $this->Error = mysql_error();
if (!$this->Query_ID) {
! $this->halt("Invalid SQL: ".$Query_String);
}
***************
*** 94,98 ****
function next_record() {
if (!$this->Query_ID) {
! $this->halt('next_record called with no query pending.');
return 0;
}
--- 129,133 ----
function next_record() {
if (!$this->Query_ID) {
! $this->halt("next_record called with no query pending.");
return 0;
}
***************
*** 100,104 ****
$this->Record = @mysql_fetch_array($this->Query_ID);
$this->Row += 1;
! $this->check_error();
$stat = is_array($this->Record);
--- 135,140 ----
$this->Record = @mysql_fetch_array($this->Query_ID);
$this->Row += 1;
! $this->Errno = mysql_errno();
! $this->Error = mysql_error();
$stat = is_array($this->Record);
***************
*** 115,119 ****
$this->Row = $pos;
else {
! $this->halt('seek($pos) failed: result has '.$this->num_rows().' rows.');
/* half assed attempt to save the day,
--- 151,155 ----
$this->Row = $pos;
else {
! $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows.");
/* half assed attempt to save the day,
***************
*** 130,140 ****
/* public: table locking */
! function lock($table, $mode='write') {
$this->connect();
! $query='lock tables ';
if (is_array($table)) {
while (list($key,$value)=each($table)) {
! if ($key=='read' && $key!=0) {
$query.="$value read, ";
} else {
--- 166,176 ----
/* public: table locking */
! function lock($table, $mode="write") {
$this->connect();
! $query="lock tables ";
if (is_array($table)) {
while (list($key,$value)=each($table)) {
! if ($key=="read" && $key!=0) {
$query.="$value read, ";
} else {
***************
*** 157,163 ****
$this->connect();
! $res = @mysql_query('unlock tables', $this->Link_ID);
if (!$res) {
! $this->halt('unlock() failed.');
return 0;
}
--- 193,199 ----
$this->connect();
! $res = @mysql_query("unlock tables", $this->Link_ID);
if (!$res) {
! $this->halt("unlock() failed.");
return 0;
}
***************
*** 178,181 ****
--- 214,234 ----
}
+ /* public: shorthand notation */
+ function nf() {
+ return $this->num_rows();
+ }
+
+ function np() {
+ print $this->num_rows();
+ }
+
+ function f($Name) {
+ return $this->Record[$Name];
+ }
+
+ function p($Name) {
+ print $this->Record[$Name];
+ }
+
/* public: sequence numbers */
function nextid($seq_name) {
***************
*** 184,188 ****
if ($this->lock($this->Seq_Table)) {
/* get sequence number (locked) and increment */
! $q = sprintf('select p_nextid from %s where p_seq_name = '%s'',
$this->Seq_Table,
$seq_name);
--- 237,241 ----
if ($this->lock($this->Seq_Table)) {
/* get sequence number (locked) and increment */
! $q = sprintf("select p_nextid from %s where p_seq_name = '%s'",
$this->Seq_Table,
$seq_name);
***************
*** 193,197 ****
if (!is_array($res)) {
$currentid = 0;
! $q = sprintf('insert into %s ( p_seq_name, p_nextid ) values('%s', %s)',
$this->Seq_Table,
$seq_name,
--- 246,250 ----
if (!is_array($res)) {
$currentid = 0;
! $q = sprintf("insert into %s ( p_seq_name, p_nextid ) values('%s', %s)",
$this->Seq_Table,
$seq_name,
***************
*** 199,206 ****
$id = @mysql_query($q, $this->Link_ID);
} else {
! $currentid = $res['p_nextid'];
}
$nextid = $currentid + 1;
! $q = sprintf('update %s set p_nextid = '%s' where p_seq_name = '%s'',
$this->Seq_Table,
$nextid,
--- 252,259 ----
$id = @mysql_query($q, $this->Link_ID);
} else {
! $currentid = $res["p_nextid"];
}
$nextid = $currentid + 1;
! $q = sprintf("update %s set p_nextid = '%s' where p_seq_name = '%s'",
$this->Seq_Table,
$nextid,
***************
*** 209,213 ****
$this->unlock();
} else {
! $this->halt('cannot lock '.$this->Seq_Table.' - has it been created?');
return 0;
}
--- 262,266 ----
$this->unlock();
} else {
! $this->halt("cannot lock ".$this->Seq_Table." - has it been created?");
return 0;
}
***************
*** 216,220 ****
/* public: return table metadata */
! function metadata($table = '', $full = false) {
$count = 0;
$id = 0;
--- 269,273 ----
/* public: return table metadata */
! function metadata($table = "", $full = false) {
$count = 0;
$id = 0;
***************
*** 228,248 ****
* - full is false (default):
* $result[]:
! * [0]['table'] table name
! * [0]['name'] field name
! * [0]['type'] field type
! * [0]['len'] field length
! * [0]['flags'] field flags
*
* - full is true (was mainly introduced for the Query-class)
* $result[]:
! * ['num_fields'] number of metadata records
! * [0]['table'] table name
! * [0]['name'] field name
! * [0]['type'] field type
! * [0]['len'] field length
! * [0]['flags'] field flags
! * [0]['php_type'] the correspondig PHP-type
! * [0]['php_subtype'] the subtype of PHP-type
! * ['meta'][field name] index-num of field named 'field name'
* This could used, if you have the name, but no index-num - very fast
* [unique] = field names which have an unique key, separated by space
--- 281,301 ----
* - full is false (default):
* $result[]:
! * [0]["table"] table name
! * [0]["name"] field name
! * [0]["type"] field type
! * [0]["len"] field length
! * [0]["flags"] field flags
*
* - full is true (was mainly introduced for the Query-class)
* $result[]:
! * ["num_fields"] number of metadata records
! * [0]["table"] table name
! * [0]["name"] field name
! * [0]["type"] field type
! * [0]["len"] field length
! * [0]["flags"] field flags
! * [0]["php_type"] the correspondig PHP-type
! * [0]["php_subtype"] the subtype of PHP-type
! * ["meta"][field name] index-num of field named "field name"
* This could used, if you have the name, but no index-num - very fast
* [unique] = field names which have an unique key, separated by space
***************
*** 255,259 ****
$id = @mysql_list_fields($this->Database, $table);
if (!$id) {
! $this->halt('Metadata query failed.');
return false;
}
--- 308,312 ----
$id = @mysql_list_fields($this->Database, $table);
if (!$id) {
! $this->halt("Metadata query failed.");
return false;
}
***************
*** 261,265 ****
$id = $this->Query_ID;
if (!$id) {
! $this->halt('No query specified.');
return false;
}
--- 314,318 ----
$id = $this->Query_ID;
if (!$id) {
! $this->halt("No query specified.");
return false;
}
***************
*** 271,324 ****
if (!$full) {
for ($i=0; $i<$count; $i++) {
! $res[$i]['table'] = @mysql_field_table ($id, $i);
! $res[$i]['name'] = @mysql_field_name ($id, $i);
! $res[$i]['type'] = @mysql_field_type ($id, $i);
! $res[$i]['len'] = @mysql_field_len ($id, $i);
! $res[$i]['flags'] = @mysql_field_flags ($id, $i);
}
} else { // full
$uniq=ARRAY();
! $res['num_fields']= $count;
for ($i=0; $i<$count; $i++) {
! $res[$i]['table'] = @mysql_field_table ($id, $i);
! $res[$i]['name'] = @mysql_field_name ($id, $i);
! $res[$i]['type'] = @mysql_field_type ($id, $i);
! $res[$i]['len'] = @mysql_field_len ($id, $i);
! $res[$i]['flags'] = @mysql_field_flags ($id, $i);
! $res['meta'][$res[$i]['name']] = $i;
! switch ($res[$i]['type']) {
! case 'var string':
! case 'string' :
! case 'char' :
! $res[$i]['php_type']='string';
! $res[$i]['php_subtype']='';
break;
! case 'timestamp' :
! case 'datetime' :
! case 'date' :
! case 'time' :
! $res[$i]['php_type']='string';
! $res[$i]['php_subtype']='date';
break;
! case 'blob' :
! $res[$i]['php_type']='string';
! $res[$i]['php_subtype']='blob';
break;
! case 'real' :
! $res[$i]['php_type']='double';
! $res[$i]['php_subtype']='';
break;
! case 'long' :
default :
! $res[$i]['php_type']='int';
! $res[$i]['php_subtype']='';
break;
}
! if ( ereg('(unique_key|primary_key)',$res[$i]['flags']) ) {
! $uniq[]=$res[$i]['name'];
}
}
! $res['unique']=join(' ',$uniq);
}
--- 324,377 ----
if (!$full) {
for ($i=0; $i<$count; $i++) {
! $res[$i]["table"] = @mysql_field_table ($id, $i);
! $res[$i]["name"] = @mysql_field_name ($id, $i);
! $res[$i]["type"] = @mysql_field_type ($id, $i);
! $res[$i]["len"] = @mysql_field_len ($id, $i);
! $res[$i]["flags"] = @mysql_field_flags ($id, $i);
}
} else { // full
$uniq=ARRAY();
! $res["num_fields"]= $count;
for ($i=0; $i<$count; $i++) {
! $res[$i]["table"] = @mysql_field_table ($id, $i);
! $res[$i]["name"] = @mysql_field_name ($id, $i);
! $res[$i]["type"] = @mysql_field_type ($id, $i);
! $res[$i]["len"] = @mysql_field_len ($id, $i);
! $res[$i]["flags"] = @mysql_field_flags ($id, $i);
! $res["meta"][$res[$i]["name"]] = $i;
! switch ($res[$i]["type"]) {
! case "var string":
! case "string" :
! case "char" :
! $res[$i]["php_type"]="string";
! $res[$i]["php_subtype"]="";
break;
! case "timestamp" :
! case "datetime" :
! case "date" :
! case "time" :
! $res[$i]["php_type"]="string";
! $res[$i]["php_subtype"]="date";
break;
! case "blob" :
! $res[$i]["php_type"]="string";
! $res[$i]["php_subtype"]="blob";
break;
! case "real" :
! $res[$i]["php_type"]="double";
! $res[$i]["php_subtype"]="";
break;
! case "long" :
default :
! $res[$i]["php_type"]="int";
! $res[$i]["php_subtype"]="";
break;
}
! if ( ereg("(unique_key|primary_key)",$res[$i]["flags"]) ) {
! $uniq[]=$res[$i]["name"];
}
}
! $res["unique"]=join(" ",$uniq);
}
***************
*** 332,341 ****
function table_names() {
$this->connect();
! $h = @mysql_query('show tables', $this->Link_ID);
$i = 0;
while ($info = @mysql_fetch_row($this->Query_ID)) {
! $return[$i]['table_name']= $info[0];
! $return[$i]['tablespace_name']=$this->Database;
! $return[$i]['database']=$this->Database;
$i++;
}
--- 385,394 ----
function table_names() {
$this->connect();
! $h = @mysql_query("show tables", $this->Link_ID);
$i = 0;
while ($info = @mysql_fetch_row($this->Query_ID)) {
! $return[$i]["table_name"]= $info[0];
! $return[$i]["tablespace_name"]=$this->Database;
! $return[$i]["database"]=$this->Database;
$i++;
}
***************
*** 346,353 ****
/* private: error handling */
! function check_error() {
! $this->Error = @mysql_error();
! $this->Errno = @mysql_errno();
}
}
?>
--- 399,422 ----
/* private: error handling */
! function halt($msg) {
! $this->Error = @mysql_error($this->Link_ID);
! $this->Errno = @mysql_errno($this->Link_ID);
! if ($this->Halt_On_Error == "no")
! return;
!
! $this->haltmsg($msg);
!
! if ($this->Halt_On_Error != "report")
! die("Session halted.");
! }
!
! function haltmsg($msg) {
! printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
! printf("<b>MySQL Error</b>: %s (%s)<br>\n",
! $this->Errno,
! $this->Error);
}
+
}
?>
+
|
|
From: Richard A. <ric...@us...> - 2001-08-20 06:38:13
|
Update of /cvsroot/phplib/php-lib/php/html
In directory usw-pr-cvs1:/tmp/cvs-serv5619
Modified Files:
menu.inc
Log Message:
Major overhaul of menu.inc: sync with -stable tree
fix unset variable access warnings
fix unquoted array subscript warnings
add { and } around all one-line conditionals
allow for new behaviour of dirname() in PHP4
normalise whitespace and comments
change "pseudo" operation slightly and add documentation
fix the example in the docs.
Index: menu.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/html/menu.inc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** menu.inc 2000/07/12 11:05:15 1.2
--- menu.inc 2001/08/20 06:38:10 1.3
***************
*** 36,41 ****
var $title_delim = " : ";
! /***************************************************************************/
! /* public: constructor
*/
function Menu() {
--- 36,41 ----
var $title_delim = " : ";
! /***************************************************************************
! * public: constructor
*/
function Menu() {
***************
*** 43,53 ****
}
! /* public: show current menu
*/
-
function show() {
print $this->get();
}
function get() {
global $PHP_SELF;
--- 43,56 ----
}
! /*
! * public: show menu of items visible from the current page
*/
function show() {
print $this->get();
}
+ /*
+ * public: build menu of items visible from the current page
+ */
function get() {
global $PHP_SELF;
***************
*** 72,79 ****
$level = count(explode("/", $this->visible[$i]));
! if ($level > $oldlevel)
$str .= $this->shift_in($oldlevel, $level);
! if ($level < $oldlevel)
$str .= $this->shift_out($oldlevel, $level);
$oldlevel = $level;
--- 75,84 ----
$level = count(explode("/", $this->visible[$i]));
! if ($level > $oldlevel) {
$str .= $this->shift_in($oldlevel, $level);
! }
! if ($level < $oldlevel) {
$str .= $this->shift_out($oldlevel, $level);
+ }
$oldlevel = $level;
***************
*** 86,96 ****
/*
! * public: show a sitemap
*/
-
function show_sitemap() {
print $this->get_sitemap();
}
function get_sitemap() {
$this->visible = array();
--- 91,103 ----
/*
! * public: show a menu of all items (sitemap)
*/
function show_sitemap() {
print $this->get_sitemap();
}
+ /*
+ * public: build a menu of all items (sitemap)
+ */
function get_sitemap() {
$this->visible = array();
***************
*** 113,120 ****
$level = count(explode("/", $this->visible[$i]));
! if ($level > $oldlevel)
$str .= $this->shift_in($oldlevel, $level);
! if ($level < $oldlevel)
$str .= $this->shift_out($oldlevel, $level);
$oldlevel = $level;
--- 120,129 ----
$level = count(explode("/", $this->visible[$i]));
! if ($level > $oldlevel) {
$str .= $this->shift_in($oldlevel, $level);
! }
! if ($level < $oldlevel) {
$str .= $this->shift_out($oldlevel, $level);
+ }
$oldlevel = $level;
***************
*** 127,138 ****
! /* public: show a single menu cell
*/
function get_cell($n, $level, $class = "") {
$bold = ($this->visible[$n] == $this->map);
! for ($i=1; $i<$level; $i++)
$dent .= " ";
! if ($this->item[$this->visible[$n]]["pseudo"]) {
$str=sprintf("%s%s<br>\n",
$dent,
--- 136,150 ----
! /*
! * public: show a single menu cell
*/
function get_cell($n, $level, $class = "") {
+ $dent = "";
$bold = ($this->visible[$n] == $this->map);
! for ($i=1; $i<$level; $i++) {
$dent .= " ";
+ }
! if (isset($this->item[$this->visible[$n]]["pseudo"])) {
$str=sprintf("%s%s<br>\n",
$dent,
***************
*** 152,160 ****
}
! /* public: build the title of the page based on
! its location in the menu hierarchy. */
function get_title() {
global $PHP_SELF;
! unset($this->title);
# Determine normalized current position in tree
--- 164,174 ----
}
! /*
! * public: build the title of the current page based on its location
! * in the menu hierarchy.
! */
function get_title() {
global $PHP_SELF;
! $this->title = "";
# Determine normalized current position in tree
***************
*** 165,170 ****
while(list($a, $b) = each($r)) {
! if ($this->title)
$this->title .= $this->title_delim;
$this->title .= $this->item[$b]["title"];
}
--- 179,185 ----
while(list($a, $b) = each($r)) {
! if (isset($this->title) && $this->title != "") {
$this->title .= $this->title_delim;
+ }
$this->title .= $this->item[$b]["title"];
}
***************
*** 173,176 ****
--- 188,196 ----
}
+ /*
+ * public: These four functions can be used to customise layout.
+ * They are called when certain events happen during menu display.
+ * They should be overridden in your subclass.
+ */
function shift_in($oldlevel, $level) { ; }
***************
*** 181,209 ****
function end_menu() { ; }
! /***************************************************************************/
! /* private: normalize current menu position
*/
function normalize_pos($pos) {
! if ( $m = $this->urlmap[basename($pos)] )
! return($m);
$m = $pos;
! while(substr($m, 0, 1)) {
! if ($this->urlmap[$m])
break;
$m = dirname($m);
}
! return $this->urlmap[$m];
}
! /* private: split a path /2/2 into components "", /2, /2/2
*/
function split_path($p) {
$path = "";
! $r = explode("/", $p);
reset($r);
while(list($k, $v) = each($r)) {
! if ($v)
$path .= "/$v";
$res[] = $path;
}
--- 201,236 ----
function end_menu() { ; }
! /*
! * private: normalize current menu position
*/
function normalize_pos($pos) {
! if ( isset($this->urlmap[basename($pos)]) ) {
! return $this->urlmap[basename($pos)];
! }
$m = $pos;
! while(strlen($m)) {
! if (isset($this->urlmap[$m])) {
break;
+ }
$m = dirname($m);
+ if ($m == "/") {
+ $m = "";
+ }
}
! return $this->urlmap[$m];
}
! /*
! * private: split a path /2/2 into components "", /2, /2/2
*/
function split_path($p) {
$path = "";
! $r = explode("/", $p);
reset($r);
while(list($k, $v) = each($r)) {
! if ($v) {
$path .= "/$v";
+ }
$res[] = $path;
}
***************
*** 212,234 ****
}
! /* private: set up the visible array.
*/
function find_visible($r) {
# at each level, add current children to visible
! $len = count($r);
! $this->visible= array();
!
for ($i=0; $i<$len; $i++) {
# if current level has children, add them...
! if (is_array($this->children[$r[$i]]) ) {
reset($this->children[$r[$i]]);
while(list($k, $v) = each($this->children[$r[$i]])) {
$this->visible[] = $v;
! if (isset($this->item[$v][pseudo]) &&
! !ereg("^$v",$this->map))
! while (list(,$w) = each($this->item[$v][pseudo])) {
! $this->visible[]=$w;
}
}
}
--- 239,283 ----
}
! /*
! * private: set up the visible array.
*/
function find_visible($r) {
# at each level, add current children to visible
! $len = count($r);
! $this->visible = array();
for ($i=0; $i<$len; $i++) {
# if current level has children, add them...
! if (isset($this->children[$r[$i]])) {
reset($this->children[$r[$i]]);
while(list($k, $v) = each($this->children[$r[$i]])) {
$this->visible[] = $v;
!
! # The "pseudo" feature has not been documented in previous
! # releases. As such, it should not matter greatly that the
! # behaviour may have changed somewhat in this release.
! # Nevertheless, the changes and current behaviour are documented
! # here.
! #
! # Previously the array item $this->item[$v]["pseudo"] should have
! # contained an array of $this->item keys. The items referenced in
! # the "pseudo" array were made visible if the "pseudo" item was
! # visible.
! #
! # This has been changed somewhat. Now, if a "pseudo" array element
! # exists, the $this->children array is scanned and all children of
! # $this->item[$v] are made visible. The menu item $this->item[$v]
! # is displayed as text only, not as a hyperlink. The item acts as a
! # heading.
!
! # show children if this is a "pseudo" item
! if (isset($this->item[$v]["pseudo"]) && !ereg("^$v",$this->map)) {
! if (isset($this->children[$v]) && is_array($this->children[$v]) ) {
! reset($this->children[$v]);
! while (list($w, $ww) = each($this->children[$v])) {
! $this->visible[] = $ww;
! }
}
+ }
}
}
***************
*** 239,243 ****
}
! /* private: find children of each menu item
*/
function setup() {
--- 288,293 ----
}
! /*
! * private: find children of each menu item
*/
function setup() {
***************
*** 245,248 ****
--- 295,301 ----
while(list($k, $v) = each($this->urlmap)) {
$base = dirname($v);
+ if ($base == "/") {
+ $base = "";
+ }
$this->children[$base][] = $v;
$this->item[$v]["url"] = $k;
|
|
From: Richard A. <ric...@us...> - 2001-08-20 06:36:55
|
Update of /cvsroot/phplib/php-lib/doc/sgml
In directory usw-pr-cvs1:/tmp/cvs-serv5541
Modified Files:
05-menu.sgml
Log Message:
update menu.inc documentation
Index: 05-menu.sgml
===================================================================
RCS file: /cvsroot/phplib/php-lib/doc/sgml/05-menu.sgml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** 05-menu.sgml 1999/12/12 16:29:52 1.2
--- 05-menu.sgml 2001/08/20 06:36:52 1.3
***************
*** 49,55 ****
extra level of indentation.<rowsep>
! $title<colsep>String. After calling <tt/get_title()/, this variable contains the title of the page based on it's location in the menu hierarchy.<rowsep>
! $title_delim<colsep>String. Used to delimit (i.e., separate) components in the page title built by <tt/get_title()/. Default is <tt>" : "</tt><rowsep>
</tabular>
--- 49,59 ----
extra level of indentation.<rowsep>
! $title<colsep>String. After calling <tt/get_title()/, this
! variable contains the title of the page based on it's location in
! the menu hierarchy.<rowsep>
! $title_delim<colsep>String. Used to delimit (i.e., separate)
! components in the page title built by <tt/get_title()/.
! Default is <tt>" : "</tt><rowsep>
</tabular>
***************
*** 126,129 ****
--- 130,143 ----
title and returns the title as a string.
+ <tag>get_sitemap()</tag>
+ <p>
+
+ This function is identical to <tt/print $this->get()/ except that
+ all menu items are shown, not just the ones visible from the current page.
+
+ <tag>show_sitemap()</tag>
+ <p>
+ A shorthand notation for <tt/print $this->get_sitemap()/.
+
<tag>setup()</tag>
<p>
***************
*** 175,179 ****
<tt/menu.inc/ in <tt/prepend.php3/. To use
<tt/Menu_Button/, you must enable the require statement
! for <tt/menu.inc/ and <tt/menu_button.inc/ in <tt/prepend.php3/.
Use a subclass of either <tt/Menu/ or <tt/Menu_Button/ to
--- 189,193 ----
<tt/menu.inc/ in <tt/prepend.php3/. To use
<tt/Menu_Button/, you must enable the require statement
! for <tt/menu.inc/ and <tt/menu_button.inc/ in <tt/prepend.php3/.
Use a subclass of either <tt/Menu/ or <tt/Menu_Button/ to
***************
*** 183,188 ****
<tscreen><code>
! class Example_Menu extends Menu {
! # Map of PHP_SELF URL strings to menu positions
var $urlmap = array(
"/menu/index.php3" => "",
--- 197,202 ----
<tscreen><code>
! class Example_Menu extends Menu {
! # Map of PHP_SELF URL strings to menu positions
var $urlmap = array(
"/menu/index.php3" => "",
***************
*** 216,220 ****
);
! function Example_Menu() {
$this->setup();
}
--- 230,234 ----
);
! function Example_Menu() {
$this->setup();
}
***************
*** 228,232 ****
<tscreen><code>
<?php
! $m = new Example_Menu;
?><html>
<head>
--- 242,246 ----
<tscreen><code>
<?php
! $m = new Example_Menu;
?><html>
<head>
|
|
From: Richard A. <ric...@us...> - 2001-08-20 06:36:17
|
Update of /cvsroot/phplib/php-lib-stable/doc/sgml
In directory usw-pr-cvs1:/tmp/cvs-serv5397
Modified Files:
05-menu.sgml
Log Message:
update menu.inc documentation
Index: 05-menu.sgml
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/doc/sgml/05-menu.sgml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** 05-menu.sgml 2000/07/12 18:30:35 1.1
--- 05-menu.sgml 2001/08/20 06:36:14 1.2
***************
*** 49,55 ****
extra level of indentation.<rowsep>
! $title<colsep>String. After calling <tt/get_title()/, this variable contains the title of the page based on it's location in the menu hierarchy.<rowsep>
! $title_delim<colsep>String. Used to delimit (i.e., separate) components in the page title built by <tt/get_title()/. Default is <tt>" : "</tt><rowsep>
</tabular>
--- 49,59 ----
extra level of indentation.<rowsep>
! $title<colsep>String. After calling <tt/get_title()/, this
! variable contains the title of the page based on it's location in
! the menu hierarchy.<rowsep>
! $title_delim<colsep>String. Used to delimit (i.e., separate)
! components in the page title built by <tt/get_title()/.
! Default is <tt>" : "</tt><rowsep>
</tabular>
***************
*** 126,129 ****
--- 130,143 ----
title and returns the title as a string.
+ <tag>get_sitemap()</tag>
+ <p>
+
+ This function is identical to <tt/print $this->get()/ except that
+ all menu items are shown, not just the ones visible from the current page.
+
+ <tag>show_sitemap()</tag>
+ <p>
+ A shorthand notation for <tt/print $this->get_sitemap()/.
+
<tag>setup()</tag>
<p>
***************
*** 175,179 ****
<tt/menu.inc/ in <tt/prepend.php3/. To use
<tt/Menu_Button/, you must enable the require statement
! for <tt/menu.inc/ and <tt/menu_button.inc/ in <tt/prepend.php3/.
Use a subclass of either <tt/Menu/ or <tt/Menu_Button/ to
--- 189,193 ----
<tt/menu.inc/ in <tt/prepend.php3/. To use
<tt/Menu_Button/, you must enable the require statement
! for <tt/menu.inc/ and <tt/menu_button.inc/ in <tt/prepend.php3/.
Use a subclass of either <tt/Menu/ or <tt/Menu_Button/ to
***************
*** 183,188 ****
<tscreen><code>
! class Example_Menu extends Menu {
! # Map of PHP_SELF URL strings to menu positions
var $urlmap = array(
"/menu/index.php3" => "",
--- 197,202 ----
<tscreen><code>
! class Example_Menu extends Menu {
! # Map of PHP_SELF URL strings to menu positions
var $urlmap = array(
"/menu/index.php3" => "",
***************
*** 216,220 ****
);
! function Example_Menu() {
$this->setup();
}
--- 230,234 ----
);
! function Example_Menu() {
$this->setup();
}
***************
*** 228,232 ****
<tscreen><code>
<?php
! $m = new Example_Menu;
?><html>
<head>
--- 242,246 ----
<tscreen><code>
<?php
! $m = new Example_Menu;
?><html>
<head>
|
|
From: Richard A. <ric...@us...> - 2001-08-20 06:35:03
|
Update of /cvsroot/phplib/php-lib-stable/php
In directory usw-pr-cvs1:/tmp/cvs-serv17800
Modified Files:
menu.inc
Log Message:
Major overhaul of menu.inc:
include sitemap() from -devel tree
fix unset variable access warnings
fix unquoted array subscript warnings
add { and } around all one-line conditionals
allow for new behaviour of dirname() in PHP4
normalise whitespace and comments
change "pseudo" operation slightly and add documentation
Index: menu.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/php/menu.inc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** menu.inc 2000/07/12 18:25:43 1.1
--- menu.inc 2001/08/20 06:35:00 1.2
***************
*** 36,41 ****
var $title_delim = " : ";
! /***************************************************************************/
! /* public: constructor
*/
function Menu() {
--- 36,41 ----
var $title_delim = " : ";
! /***************************************************************************
! * public: constructor
*/
function Menu() {
***************
*** 43,53 ****
}
! /* public: show current menu
*/
-
function show() {
print $this->get();
}
function get() {
global $PHP_SELF;
--- 43,56 ----
}
! /*
! * public: show menu of items visible from the current page
*/
function show() {
print $this->get();
}
+ /*
+ * public: build menu of items visible from the current page
+ */
function get() {
global $PHP_SELF;
***************
*** 72,79 ****
$level = count(explode("/", $this->visible[$i]));
! if ($level > $oldlevel)
$str .= $this->shift_in($oldlevel, $level);
! if ($level < $oldlevel)
$str .= $this->shift_out($oldlevel, $level);
$oldlevel = $level;
--- 75,84 ----
$level = count(explode("/", $this->visible[$i]));
! if ($level > $oldlevel) {
$str .= $this->shift_in($oldlevel, $level);
! }
! if ($level < $oldlevel) {
$str .= $this->shift_out($oldlevel, $level);
+ }
$oldlevel = $level;
***************
*** 84,96 ****
return $str;
}
! /* public: show a single menu cell
*/
function get_cell($n, $level, $class = "") {
$bold = ($this->visible[$n] == $this->map);
! for ($i=1; $i<$level; $i++)
$dent .= " ";
! if ($this->item[$this->visible[$n]]["pseudo"]) {
$str=sprintf("%s%s<br>\n",
$dent,
--- 89,150 ----
return $str;
}
+
+ /*
+ * public: show a menu of all items (sitemap)
+ */
+ function show_sitemap() {
+ print $this->get_sitemap();
+ }
+
+ /*
+ * public: build a menu of all items (sitemap)
+ */
+ function get_sitemap() {
+ $this->visible = array();
+
+ # Using PHP4, this could be faster, but we want to be portable.
+ reset($this->item);
+ while(list($k, $v) = each($this->item)) {
+ $this->visible[] = $k;
+ }
+ sort($this->visible);
+
+ # create them
+ $str = "";
+
+ $start = $this->nomain?1:0;
+ $len = count($this->visible);
+ $oldlevel = 0;
+ $str .= $this->start_menu();
+ for($i=$start; $i<$len; $i++) {
+ $level = count(explode("/", $this->visible[$i]));
+
+ if ($level > $oldlevel) {
+ $str .= $this->shift_in($oldlevel, $level);
+ }
+ if ($level < $oldlevel) {
+ $str .= $this->shift_out($oldlevel, $level);
+ }
+ $oldlevel = $level;
+
+ $str .= $this->get_cell($i, $level, $this->class);
+ }
+ $str .= $this->end_menu();
+
+ return $str;
+ }
+
! /*
! * public: show a single menu cell
*/
function get_cell($n, $level, $class = "") {
+ $dent = "";
$bold = ($this->visible[$n] == $this->map);
! for ($i=1; $i<$level; $i++) {
$dent .= " ";
+ }
! if (isset($this->item[$this->visible[$n]]["pseudo"])) {
$str=sprintf("%s%s<br>\n",
$dent,
***************
*** 110,118 ****
}
! /* public: build the title of the page based on
! its location in the menu hierarchy. */
function get_title() {
global $PHP_SELF;
! unset($this->title);
# Determine normalized current position in tree
--- 164,174 ----
}
! /*
! * public: build the title of the current page based on its location
! * in the menu hierarchy.
! */
function get_title() {
global $PHP_SELF;
! $this->title = "";
# Determine normalized current position in tree
***************
*** 123,128 ****
while(list($a, $b) = each($r)) {
! if ($this->title)
$this->title .= $this->title_delim;
$this->title .= $this->item[$b]["title"];
}
--- 179,185 ----
while(list($a, $b) = each($r)) {
! if (isset($this->title) && $this->title != "") {
$this->title .= $this->title_delim;
+ }
$this->title .= $this->item[$b]["title"];
}
***************
*** 131,134 ****
--- 188,196 ----
}
+ /*
+ * public: These four functions can be used to customise layout.
+ * They are called when certain events happen during menu display.
+ * They should be overridden in your subclass.
+ */
function shift_in($oldlevel, $level) { ; }
***************
*** 139,167 ****
function end_menu() { ; }
! /***************************************************************************/
! /* private: normalize current menu position
*/
function normalize_pos($pos) {
! if ( $m = $this->urlmap[basename($pos)] )
! return($m);
$m = $pos;
! while(substr($m, 0, 1)) {
! if ($this->urlmap[$m])
break;
$m = dirname($m);
}
! return $this->urlmap[$m];
}
! /* private: split a path /2/2 into components "", /2, /2/2
*/
function split_path($p) {
$path = "";
! $r = explode("/", $p);
reset($r);
while(list($k, $v) = each($r)) {
! if ($v)
$path .= "/$v";
$res[] = $path;
}
--- 201,236 ----
function end_menu() { ; }
! /*
! * private: normalize current menu position
*/
function normalize_pos($pos) {
! if ( isset($this->urlmap[basename($pos)]) ) {
! return $this->urlmap[basename($pos)];
! }
$m = $pos;
! while(strlen($m)) {
! if (isset($this->urlmap[$m])) {
break;
+ }
$m = dirname($m);
+ if ($m == "/") {
+ $m = "";
+ }
}
! return $this->urlmap[$m];
}
! /*
! * private: split a path /2/2 into components "", /2, /2/2
*/
function split_path($p) {
$path = "";
! $r = explode("/", $p);
reset($r);
while(list($k, $v) = each($r)) {
! if ($v) {
$path .= "/$v";
+ }
$res[] = $path;
}
***************
*** 170,192 ****
}
! /* private: set up the visible array.
*/
function find_visible($r) {
# at each level, add current children to visible
! $len = count($r);
! $this->visible= array();
!
for ($i=0; $i<$len; $i++) {
# if current level has children, add them...
! if (is_array($this->children[$r[$i]]) ) {
reset($this->children[$r[$i]]);
while(list($k, $v) = each($this->children[$r[$i]])) {
$this->visible[] = $v;
! if (isset($this->item[$v][pseudo]) &&
! !ereg("^$v",$this->map))
! while (list(,$w) = each($this->item[$v][pseudo])) {
! $this->visible[]=$w;
}
}
}
--- 239,283 ----
}
! /*
! * private: set up the visible array.
*/
function find_visible($r) {
# at each level, add current children to visible
! $len = count($r);
! $this->visible = array();
for ($i=0; $i<$len; $i++) {
# if current level has children, add them...
! if (isset($this->children[$r[$i]])) {
reset($this->children[$r[$i]]);
while(list($k, $v) = each($this->children[$r[$i]])) {
$this->visible[] = $v;
!
! # The "pseudo" feature has not been documented in previous
! # releases. As such, it should not matter greatly that the
! # behaviour may have changed somewhat in this release.
! # Nevertheless, the changes and current behaviour are documented
! # here.
! #
! # Previously the array item $this->item[$v]["pseudo"] should have
! # contained an array of $this->item keys. The items referenced in
! # the "pseudo" array were made visible if the "pseudo" item was
! # visible.
! #
! # This has been changed somewhat. Now, if a "pseudo" array element
! # exists, the $this->children array is scanned and all children of
! # $this->item[$v] are made visible. The menu item $this->item[$v]
! # is displayed as text only, not as a hyperlink. The item acts as a
! # heading.
!
! # show children if this is a "pseudo" item
! if (isset($this->item[$v]["pseudo"]) && !ereg("^$v",$this->map)) {
! if (isset($this->children[$v]) && is_array($this->children[$v]) ) {
! reset($this->children[$v]);
! while (list($w, $ww) = each($this->children[$v])) {
! $this->visible[] = $ww;
! }
}
+ }
}
}
***************
*** 197,201 ****
}
! /* private: find children of each menu item
*/
function setup() {
--- 288,293 ----
}
! /*
! * private: find children of each menu item
*/
function setup() {
***************
*** 203,206 ****
--- 295,301 ----
while(list($k, $v) = each($this->urlmap)) {
$base = dirname($v);
+ if ($base == "/") {
+ $base = "";
+ }
$this->children[$base][] = $v;
$this->item[$v]["url"] = $k;
|
|
From: Jason B. <mac...@us...> - 2001-08-19 01:07:37
|
Update of /cvsroot/phplib/php-lib/php/auth
In directory usw-pr-cvs1:/tmp/cvs-serv17827
Added Files:
acl_ct_sql.inc acl_perm.inc
Log Message:
macmaster: This is an ACL style auth/perms system with an SQL based ACL container
--- NEW FILE: acl_ct_sql.inc ---
<?php
class ACL_CT_Sql {
var $database_class = "DB_Sql";
var $acl_table = "auth_access";
var $defs_table = "access_defs";
var $db;
function ACL_CT_Sql(){
$this->db = new $this->database_class;
}
function userperms($uid){
$this->db->query("Select resource, perm from ".$this->acl_table." where userid = '$uid'");
while ($this->db->next_record()){
$out[$this->db->f("resource")] = $this->db->f("perm");
}
return $out;
}
function permslist($resource){
$this->db->query("Select perm, mask from ".$this->defs_table." where resource = '$resource'");
while ($this->db->next_record()){
$out[$this->db->f("perm")] = $this->db->f("mask");
}
return $out;
}
function verifyperm($uid,$resource){
$this->db->query("Select perm from ".$this->acl_table." where userid = '$uid' and resource = '$resource'");
$this->db->next_record();
return $this->db->f("perm");
}
}
--- NEW FILE: acl_perm.inc ---
<?php
class ACL_Perm {
var $classname = "ACL_Perm";
## Hash ("Name" => Permission-Bitmask)
var $permissions = array ();
## Optional-Hash ("Resource" => "Container-Class-Name")
var $containerlist = array();
## Choose a default container
var $defaultcontainer = "ACL_CT_Sql";
##
## Permission code
##
function check($p,$resource = '_default'){
global $auth;
if (! $this->have_perm($p,$resource)) {
if (! isset($auth->auth["perm"][$resource]) ) {
$auth->auth["perm"][$resource] = "";
}
$this->perm_invalid($auth->auth["perm"][$resource], $p);
exit();
}
}
function have_perm($p,$resource = '_default'){
global $auth;
if (! isset($auth->auth["perm"][$resource]) ) {
$auth->auth["perm"][$resource] = "";
}
$pageperm = split(",", $p);
$userperm = split(",", $auth->auth["perm"][$resource]);
list ($ok0, $pagebits) = $this->permsum($pageperm,$resource);
list ($ok1, $userbits) = $this->permsum($userperm,$resource);
$has_all = (($userbits & $pagebits) == $pagebits);
if (!($has_all && $ok0 && $ok1) ) {
return false;
} else {
return true;
}
}
##
## Permission helpers.
##
function permsum($p,$resource = '_default'){
global $auth;
if (!is_array($p)) {
return array(false, 0);
}
$perms = $this->getpermslist($resource);
$r = 0;
reset($p);
while(list($key, $val) = each($p)) {
if (!isset($perms[$val])) {
return array(false, 0);
}
$r |= $perms[$val];
}
return array(true, $r);
}
function getpermslist($resource){
if ($resource == "_default"){
return $this->permissions;
}
if ($this->containerlist[$resource]){
$that = new $this->containerlist[$resource];
} else {
$that = new $this->defaultcontainer;
}
return $that->permslist($resource);
}
##
## Dummy Method. Must be overridden by user.
##
function perm_invalid($does_have, $must_have) {
printf("Access denied.\n");
}
}
class ACL_Auth extends Auth {
var $aclperm_class = "ACL_Perm";
function getuserperms($uid){
$tperm = new $aclperm_class;
if (is_array($tperm->containerlist) && count($tperm->containerlist) > 0){
while(list($resource,$container) = each($tperm->containerlist)){
$that = new $container;
$this->auth['perm'] = $that->userperms($uid);
unset($that);
}
}
$that = new $tperm->defaultcontainer;
$this->auth['perm'] = $that->userperms($uid);
}
}
|
|
From: Richard A. <ric...@us...> - 2001-08-18 09:48:33
|
Update of /cvsroot/phplib/php-lib/php
In directory usw-pr-cvs1:/tmp/cvs-serv25373
Modified Files:
page.inc
Log Message:
sync with -stable
test $sess->in as a boolean rather than testing against a string.
Index: page.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/page.inc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** page.inc 2000/12/05 11:15:32 1.10
--- page.inc 2001/08/18 09:48:30 1.11
***************
*** 55,59 ****
## Load the auto_init-File, if one is specified.
! if (($sess->auto_init != "") && ($sess->in == "")) {
$sess->in = 1;
include($_PHPLIB["libdir"] . $sess->auto_init);
--- 55,59 ----
## Load the auto_init-File, if one is specified.
! if (($sess->auto_init != "") && !$sess->in) {
$sess->in = 1;
include($_PHPLIB["libdir"] . $sess->auto_init);
|
|
From: Richard A. <ric...@us...> - 2001-08-18 09:48:13
|
Update of /cvsroot/phplib/php-lib-stable/php
In directory usw-pr-cvs1:/tmp/cvs-serv25255
Modified Files:
page.inc
Log Message:
test $sess->in as a boolean rather than testing against a string.
Index: page.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/php/page.inc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** page.inc 2000/07/12 18:22:35 1.2
--- page.inc 2001/08/18 09:48:10 1.3
***************
*** 50,54 ****
## Load the auto_init-File, if one is specified.
! if (($sess->auto_init != "") && ($sess->in == "")) {
$sess->in = 1;
include($_PHPLIB["libdir"] . $sess->auto_init);
--- 50,54 ----
## Load the auto_init-File, if one is specified.
! if (($sess->auto_init != "") && !$sess->in) {
$sess->in = 1;
include($_PHPLIB["libdir"] . $sess->auto_init);
|
|
From: Richard A. <ric...@us...> - 2001-08-18 09:47:22
|
Update of /cvsroot/phplib/php-lib/php/session
In directory usw-pr-cvs1:/tmp/cvs-serv24905
Modified Files:
session3.inc
Log Message:
Sync with -stable:
url() removes session ID from GET string before adding another (new method)
$str in serialize() changed to call by reference
change $this->in to be 0 or 1 rather than false or 1
remove empty() calls
revert ' to " to be in sync with stable - no performance penalty in PHP4
Index: session3.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/session/session3.inc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** session3.inc 2001/08/18 02:45:05 1.5
--- session3.inc 2001/08/18 09:47:19 1.6
***************
*** 45,49 ****
var $pt = array(); ## This Array contains the registered things
! var $in = false; ## Marker: Did we already include the autoinit file?
## register($things):
--- 45,49 ----
var $pt = array(); ## This Array contains the registered things
! var $in = 0; ## Marker: Did we already include the autoinit file?
## register($things):
***************
*** 91,95 ****
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
! if (empty($id)) {
$newid=false;
switch ($this->mode) {
--- 91,95 ----
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
! if ( "" == $id ) {
$newid=false;
switch ($this->mode) {
***************
*** 126,138 ****
// 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 ( !empty($QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
--- 126,137 ----
// Remove session ID info from QUERY String - it is in cookie
! if ( isset($QUERY_STRING) && ("" != $QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
! "\\1", $QUERY_STRING);
}
break;
case "get":
! if ( isset($QUERY_STRING) && ("" != $QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
***************
*** 152,161 ****
## abandon a session.
function put_id() {
switch ($this->mode) {
case "cookie":
! global $HTTP_COOKIE_VARS;
! $this->name = $this->cookiename == '' ? $this->classname : $this->cookiename;
! SetCookie($this->name, '', 0, '/', $this->cookie_domain);
! $HTTP_COOKIE_VARS[$this->name] = '';
break;
--- 151,161 ----
## abandon a session.
function put_id() {
+ global $HTTP_COOKIE_VARS;
+
switch ($this->mode) {
case "cookie":
! $this->name = $this->cookiename == "" ? $this->classname : $this->cookiename;
! SetCookie($this->name, "", 0, "/", $this->cookie_domain);
! $HTTP_COOKIE_VARS[$this->name] = "";
break;
***************
*** 181,191 ****
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);
--- 181,190 ----
function url($url) {
! // Remove existing session info from url
! $url = ereg_replace(
! "([&?])".quotemeta(urlencode($this->name))."=".$this->id."(&|$)",
! "\\1", $url);
! // Remove trailing ?/& if needed
$url=ereg_replace("[&?]+$", "", $url);
***************
*** 210,214 ****
return $this->url($PHP_SELF.
! ((!empty($QUERY_STRING)) ? "?".$QUERY_STRING : ""));
}
--- 209,213 ----
return $this->url($PHP_SELF.
! ((isset($QUERY_STRING) && ("" != $QUERY_STRING)) ? "?".$QUERY_STRING : ""));
}
***************
*** 243,247 ****
global $QUERY_STRING;
! if ( !empty($QUERY_STRING)
|| ($this->mode == "get")) {
$sep_char = "&";
--- 242,246 ----
global $QUERY_STRING;
! if ((isset($QUERY_STRING) && ("" != $QUERY_STRING))
|| ($this->mode == "get")) {
$sep_char = "&";
***************
*** 286,290 ****
while ( "array" == $l ) {
## Structural recursion
! $this->serialize($var."['".ereg_replace("([\\'])", "\\\\1", $k)."']", $str);
eval("\$l = gettype(list(\$k)=each(\$$var));");
}
--- 285,289 ----
while ( "array" == $l ) {
## Structural recursion
! $this->serialize($var."['".ereg_replace("([\\'])", "\\\\1", $k)."']", &$str);
eval("\$l = gettype(list(\$k)=each(\$$var));");
}
***************
*** 302,306 ****
reset($'.$var.');
while ( list($k) = each($'.$var.') ) {
! $this->serialize( "${var}->".$k, $str );
}
}
--- 301,305 ----
reset($'.$var.');
while ( list($k) = each($'.$var.') ) {
! $this->serialize( "${var}->".$k, &$str );
}
}
***************
*** 429,434 ****
// no cookie and no GET/POST params
- header("Status: 302 Moved Temporarily");
-
// Generate session ID and setup cookie.
$this->get_id($sid);
--- 428,431 ----
***************
*** 444,447 ****
--- 441,445 ----
$PROTOCOL='http';
}
+ header("Status: 302 Moved Temporarily");
header("Location: ". $PROTOCOL. "://".$HTTP_HOST.$this->self_url());
exit;
|
|
From: Richard A. <ric...@us...> - 2001-08-18 09:43:01
|
Update of /cvsroot/phplib/php-lib-stable/php
In directory usw-pr-cvs1:/tmp/cvs-serv24380
Modified Files:
session.inc
Log Message:
Merge in changes from -devel tree as well as some bug fixes:
Set garbage collection probability to 5
Remove session ID from QUERY_STRING in get_id() if in cookie mode
New structure put_id() from -devel. Should behave the same
url() removes session ID from GET string before adding another
$str in serialize() changed to call by reference
Remove extraneous gc() function
Add $sid to parameters for release_token (was passed a sid!)
Check POST vars for session ID as well as GET vars in release_token()
-- were checking both in get_id()
Call release_token() before put_headers() in start (from -devel).
change $this->in to be 0 or 1 rather than false or 1
Index: session.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/php/session.inc,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** session.inc 2001/08/18 02:45:47 1.9
--- session.inc 2001/08/18 09:42:59 1.10
***************
*** 25,29 ****
var $gc_time = 1440; ## Purge all session data older than 1440 minutes.
! var $gc_probability = 1; ## Garbage collect probability in percent
var $auto_init = ""; ## Name of the autoinit-File, if any.
--- 25,29 ----
var $gc_time = 1440; ## Purge all session data older than 1440 minutes.
! var $gc_probability = 5; ## Garbage collect probability in percent
var $auto_init = ""; ## Name of the autoinit-File, if any.
***************
*** 45,49 ****
var $pt = array(); ## This Array contains the registered things
! var $in = false; ## Marker: Did we already include the autoinit file?
## register($things):
--- 45,49 ----
var $pt = array(); ## This Array contains the registered things
! var $in = 0; ## Marker: Did we already include the autoinit file?
## register($things):
***************
*** 95,100 ****
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] : "";
break;
case "cookie":
--- 95,103 ----
switch ($this->mode) {
case "get":
! $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":
***************
*** 121,127 ****
SetCookie($this->name, $id, time()+$this->lifetime*60, "/", $this->cookie_domain);
}
break;
case "get":
! if ( isset($QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
--- 124,137 ----
SetCookie($this->name, $id, time()+$this->lifetime*60, "/", $this->cookie_domain);
}
+
+ // Remove session ID info from QUERY String - it is in cookie
+ if ( isset($QUERY_STRING) && ("" != $QUERY_STRING) ) {
+ $QUERY_STRING = ereg_replace(
+ "(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
+ "\\1", $QUERY_STRING);
+ }
break;
case "get":
! if ( isset($QUERY_STRING) && ("" != $QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
***************
*** 143,160 ****
global $HTTP_COOKIE_VARS;
- $this->name = $this->cookiename==""?$this->classname:$this->cookiename;
-
switch ($this->mode) {
! case "inline":
! die("This has not been coded yet.");
! break;
!
! case "get":
! die("This has not been coded yet.");
break;
default:
! SetCookie($this->name, "", 0, "/", $this->cookie_domain);
! $HTTP_COOKIE_VARS[$this->name] = "";
break;
}
--- 153,165 ----
global $HTTP_COOKIE_VARS;
switch ($this->mode) {
! case "cookie":
! $this->name = $this->cookiename == "" ? $this->classname : $this->cookiename;
! SetCookie($this->name, "", 0, "/", $this->cookie_domain);
! $HTTP_COOKIE_VARS[$this->name] = "";
break;
default:
! // do nothing. We don't need to die for modes other than cookie here.
break;
}
***************
*** 176,179 ****
--- 181,190 ----
function url($url) {
+ // Remove existing session info from url
+ $url = ereg_replace(
+ "([&?])".quotemeta(urlencode($this->name))."=".$this->id."(&|$)",
+ "\\1", $url);
+
+ // Remove trailing ?/& if needed
$url=ereg_replace("[&?]+$", "", $url);
***************
*** 244,248 ****
## to be saved as an array of strings).
! function serialize($var, $str) {
static $t,$l,$k;
--- 255,259 ----
## to be saved as an array of strings).
! function serialize($var, &$str) {
static $t,$l,$k;
***************
*** 326,338 ****
##
- ## Garbage collection
- ##
- ## Destroy all session data older than this
- ##
- function gc() {
- $this->that->ac_gc($this->gc_time, $this->name);
- }
-
- ##
## Variable precedence functions
##
--- 337,340 ----
***************
*** 376,381 ****
}
! function release_token() {
! global $HTTP_COOKIE_VARS, $HTTP_GET_VARS,
$HTTP_HOST, $HTTPS;
--- 378,383 ----
}
! function release_token($sid = "") {
! global $HTTP_COOKIE_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS,
$HTTP_HOST, $HTTPS;
***************
*** 385,401 ****
&& (! isset($HTTP_COOKIE_VARS[$this->name])) ) {
! // Looks like no cookie here - check GET params
! if (isset($HTTP_GET_VARS[$this->name])) {
! // Session info passed via GET - 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 params
!
! header("Status: 302 Moved Temporarily");
!
! if (!isset($sid)) {
! $sid='';
! }
// Generate session ID and setup cookie.
--- 387,398 ----
&& (! 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
// Generate session ID and setup cookie.
***************
*** 412,415 ****
--- 409,413 ----
$PROTOCOL='http';
}
+ header("Status: 302 Moved Temporarily");
header("Location: ". $PROTOCOL. "://".$HTTP_HOST.$this->self_url());
exit;
***************
*** 486,491 ****
$this->set_container();
$this->set_tokenname();
- $this->release_token($sid);
$this->put_headers();
$this->get_id($sid);
$this->thaw();
--- 484,489 ----
$this->set_container();
$this->set_tokenname();
$this->put_headers();
+ $this->release_token($sid);
$this->get_id($sid);
$this->thaw();
|
|
From: Richard A. <ric...@us...> - 2001-08-18 09:41:33
|
Update of /cvsroot/phplib/php-lib/pages
In directory usw-pr-cvs1:/tmp/cvs-serv24350
Modified Files:
defauth.php3
Log Message:
fix a long-standing problem that prevented the demo "relogin" from working as expected.
Index: defauth.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/defauth.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** defauth.php3 1999/04/30 19:51:29 1.2
--- defauth.php3 2001/08/18 09:41:31 1.3
***************
*** 18,21 ****
--- 18,32 ----
// NOTE: We are using Example_Default_Auth here...
page_open(array("sess" => "Example_Session", "auth" => "Example_Default_Auth", "perm" => "Example_Perm", "user" => "Example_User"));
+
+ // Remove the "again=yes" from QUERY_STRING. This is required
+ // because the login form will be submitted to the URL of this
+ // page. This URL is constructed from $PHP_SELF and $QUERY_STRING.
+ // So, we need to remove this parameter from QUERY_STRING or else
+ // after the user submits a username and password, we will unauth
+ // them before they even get logged in!
+ $QUERY_STRING = ereg_replace(
+ "(^|&)again=yes(&|$)",
+ "\\1", $QUERY_STRING);
+
$auth->login_if($again); // relogin, if this was requested...
$user->register("u"); // register our user variable...
|
|
From: Richard A. <ric...@us...> - 2001-08-18 09:41:22
|
Update of /cvsroot/phplib/php-lib-stable/pages
In directory usw-pr-cvs1:/tmp/cvs-serv24312
Modified Files:
defauth.php3
Log Message:
fix a long-standing problem that prevented the demo "relogin" from working as expected.
Index: defauth.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/pages/defauth.php3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** defauth.php3 2000/04/17 16:40:06 1.1.1.1
--- defauth.php3 2001/08/18 09:41:19 1.2
***************
*** 18,21 ****
--- 18,32 ----
// NOTE: We are using Example_Default_Auth here...
page_open(array("sess" => "Example_Session", "auth" => "Example_Default_Auth", "perm" => "Example_Perm", "user" => "Example_User"));
+
+ // Remove the "again=yes" from QUERY_STRING. This is required
+ // because the login form will be submitted to the URL of this
+ // page. This URL is constructed from $PHP_SELF and $QUERY_STRING.
+ // So, we need to remove this parameter from QUERY_STRING or else
+ // after the user submits a username and password, we will unauth
+ // them before they even get logged in!
+ $QUERY_STRING = ereg_replace(
+ "(^|&)again=yes(&|$)",
+ "\\1", $QUERY_STRING);
+
$auth->login_if($again); // relogin, if this was requested...
$user->register("u"); // register our user variable...
|
|
From: Richard A. <ric...@us...> - 2001-08-18 02:45:49
|
Update of /cvsroot/phplib/php-lib-stable/php
In directory usw-pr-cvs1:/tmp/cvs-serv32753
Modified Files:
session.inc
Log Message:
renamed $prefix in serialize to $var
changes to comments and whitespace
syncing devel and stable trees
Index: session.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/php/session.inc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** session.inc 2001/08/12 05:24:44 1.8
--- session.inc 2001/08/18 02:45:47 1.9
***************
*** 8,12 ****
* $Id$
*
! */
class Session {
--- 8,12 ----
* $Id$
*
! */
class Session {
***************
*** 31,35 ****
## page_close() guaranteed.
! var $allowcache = "no"; ## "passive", "no", "private", "public"
var $allowcache_expire = 1440; ## If you allowcache, data expires in this
## many minutes.
--- 31,35 ----
## page_close() guaranteed.
! var $allowcache = "no"; ## "passive", "no", "private" or "public"
var $allowcache_expire = 1440; ## If you allowcache, data expires in this
## many minutes.
***************
*** 88,94 ****
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS, $QUERY_STRING;
$newid=true;
!
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
!
if ( "" == $id ) {
$newid=false;
--- 88,94 ----
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS, $QUERY_STRING;
$newid=true;
!
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
!
if ( "" == $id ) {
$newid=false;
***************
*** 99,103 ****
break;
case "cookie":
! $id = isset($HTTP_COOKIE_VARS[$this->name]) ? $HTTP_COOKIE_VARS[$this->name] : "";
break;
default:
--- 99,104 ----
break;
case "cookie":
! $id = isset($HTTP_COOKIE_VARS[$this->name]) ?
! $HTTP_COOKIE_VARS[$this->name] : "";
break;
default:
***************
*** 106,115 ****
}
}
!
if ( "" == $id ) {
$newid=true;
$id = $this->that->ac_newid(md5(uniqid($this->magic)), $this->name);
}
!
switch ($this->mode) {
case "cookie":
--- 107,116 ----
}
}
!
if ( "" == $id ) {
$newid=true;
$id = $this->that->ac_newid(md5(uniqid($this->magic)), $this->name);
}
!
switch ($this->mode) {
case "cookie":
***************
*** 132,157 ****
break;
}
-
$this->id = $id;
}
## put_id():
! ##
## Stop using the current session id (unset cookie, ...) and
## abandon a session.
function put_id() {
global $HTTP_COOKIE_VARS;
!
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
!
switch ($this->mode) {
case "inline":
die("This has not been coded yet.");
break;
!
case "get":
die("This has not been coded yet.");
break;
!
default:
SetCookie($this->name, "", 0, "/", $this->cookie_domain);
--- 133,157 ----
break;
}
$this->id = $id;
}
## put_id():
! ##
## Stop using the current session id (unset cookie, ...) and
## abandon a session.
function put_id() {
global $HTTP_COOKIE_VARS;
!
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
!
switch ($this->mode) {
case "inline":
die("This has not been coded yet.");
break;
!
case "get":
die("This has not been coded yet.");
break;
!
default:
SetCookie($this->name, "", 0, "/", $this->cookie_domain);
***************
*** 164,168 ****
##
## Delete the current session record and put the session id.
!
function delete() {
$this->that->ac_delete($this->id, $this->name);
--- 164,168 ----
##
## Delete the current session record and put the session id.
!
function delete() {
$this->that->ac_delete($this->id, $this->name);
***************
*** 172,187 ****
## url($url):
##
! ## Helper function: returns $url concatenated with the current
## session $id.
!
! function url($url){
$url=ereg_replace("[&?]+$", "", $url);
!
switch ($this->mode) {
case "get":
-
$url .= ( strpos($url, "?") != false ? "&" : "?" ).
urlencode($this->name)."=".$this->id;
-
break;
default:
--- 172,185 ----
## url($url):
##
! ## Helper function: returns $url concatenated with the current
## session $id.
!
! function url($url) {
$url=ereg_replace("[&?]+$", "", $url);
!
switch ($this->mode) {
case "get":
$url .= ( strpos($url, "?") != false ? "&" : "?" ).
urlencode($this->name)."=".$this->id;
break;
default:
***************
*** 206,210 ****
print $this->self_url();
}
!
function hidden_session()
{
--- 204,208 ----
print $this->self_url();
}
!
function hidden_session()
{
***************
*** 217,221 ****
if ((isset($QUERY_STRING) && ("" != $QUERY_STRING))
! || ($this->mode == "get")) {
$sep_char = "&";
} else {
--- 215,219 ----
if ((isset($QUERY_STRING) && ("" != $QUERY_STRING))
! || ($this->mode == "get")) {
$sep_char = "&";
} else {
***************
*** 236,242 ****
}
! ## serialize($prefix,&$str):
##
! ## appends a serialized representation of $$prefix
## at the end of $str.
##
--- 234,240 ----
}
! ## serialize($var,&$str):
##
! ## appends a serialized representation of $$var
## at the end of $str.
##
***************
*** 245,285 ****
## and a variable $persistent_slots (containing the names of the slots
## to be saved as an array of strings).
! ##
! ## You don't need to know...
! function serialize($prefix, $str) {
static $t,$l,$k;
! ## Determine the type of $$prefix
! eval("\$t = gettype(\$$prefix);");
switch ( $t ) {
case "array":
! ## $$prefix is an array. Enumerate the elements and serialize them.
! eval("reset(\$$prefix); \$l = gettype(list(\$k)=each(\$$prefix));");
! $str .= "\$$prefix = array(); ";
while ( "array" == $l ) {
## Structural recursion
! $this->serialize($prefix."['".ereg_replace("([\\'])", "\\\\1", $k)."']", &$str);
! eval("\$l = gettype(list(\$k)=each(\$$prefix));");
}
break;
case "object":
! ## $$prefix is an object. Enumerate the slots and serialize them.
! eval("\$k = \$${prefix}->classname; \$l = reset(\$${prefix}->persistent_slots);");
! $str.="\$$prefix = new $k; ";
while ( $l ) {
## Structural recursion.
! $this->serialize($prefix."->".$l,&$str);
! eval("\$l = next(\$${prefix}->persistent_slots);");
}
break;
default:
! ## $$prefix is an atom. Extract it to $l, then generate code.
! eval("\$l = \$$prefix;");
! $str.="\$$prefix = '".ereg_replace("([\\'])", "\\\\1", $l)."'; ";
!
!
break;
}
--- 243,280 ----
## and a variable $persistent_slots (containing the names of the slots
## to be saved as an array of strings).
!
! function serialize($var, $str) {
static $t,$l,$k;
! ## Determine the type of $$var
! eval("\$t = gettype(\$$var);");
switch ( $t ) {
case "array":
! ## $$var is an array. Enumerate the elements and serialize them.
! eval("reset(\$$var); \$l = gettype(list(\$k)=each(\$$var));");
! $str .= "\$$var = array(); ";
while ( "array" == $l ) {
## Structural recursion
! $this->serialize($var."['".ereg_replace("([\\'])", "\\\\1", $k)."']", &$str);
! eval("\$l = gettype(list(\$k)=each(\$$var));");
}
break;
case "object":
! ## $$var is an object. Enumerate the slots and serialize them.
! eval("\$k = \$${var}->classname; \$l = reset(\$${var}->persistent_slots);");
! $str.="\$$var = new $k; ";
while ( $l ) {
## Structural recursion.
! $this->serialize($var."->".$l,&$str);
! eval("\$l = next(\$${var}->persistent_slots);");
}
break;
default:
! ## $$var is an atom. Extract it to $l, then generate code.
! eval("\$l = \$$var;");
! $str.="\$$var = '".ereg_replace("([\\'])", "\\\\1", $l)."'; ";
break;
}
***************
*** 312,319 ****
}
}
!
$r = $this->that->ac_store($this->id, $this->name, $str);
$this->release_lock();
! if(!$r) $this->that->ac_halt("Session: freeze() failed.");
}
--- 307,315 ----
}
}
!
$r = $this->that->ac_store($this->id, $this->name, $str);
$this->release_lock();
!
! if (!$r) $this->that->ac_halt("Session: freeze() failed.");
}
***************
*** 326,330 ****
$vals = $this->that->ac_get_value($this->id, $this->name);
-
eval(sprintf(";%s",$vals));
}
--- 322,325 ----
***************
*** 370,374 ****
##
! function set_container(){
$name = $this->that_class;
$this->that = new $name;
--- 365,369 ----
##
! function set_container() {
$name = $this->that_class;
$this->that = new $name;
***************
*** 377,401 ****
}
! function set_tokenname(){
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
}
! function release_token(){
! global $HTTP_COOKIE_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");
! if(!isset($sid)){
! $sid='';
! }
$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 {
--- 372,411 ----
}
! function set_tokenname() {
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
}
! function release_token() {
! global $HTTP_COOKIE_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])) ) {
!
! // Looks like no cookie here - check GET params
! if (isset($HTTP_GET_VARS[$this->name])) {
! // Session info passed via GET - 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 params
+
header("Status: 302 Moved Temporarily");
!
! if (!isset($sid)) {
! $sid='';
! }
!
! // 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 {
***************
*** 406,410 ****
}
}
! }
function put_headers() {
--- 416,420 ----
}
}
! }
function put_headers() {
***************
*** 414,418 ****
# Note that in HTTP/1.1 the Cache-Control headers override the Expires
# headers and HTTP/1.0 ignores headers it does not recognize (e.g,
! # Cache-Control). Mulitple Cache-Control directives are split into
# mulitple headers to better support MSIE 4.x.
#
--- 424,428 ----
# Note that in HTTP/1.1 the Cache-Control headers override the Expires
# headers and HTTP/1.0 ignores headers it does not recognize (e.g,
! # Cache-Control). Mulitple Cache-Control directives are split into
# mulitple headers to better support MSIE 4.x.
#
***************
*** 423,427 ****
case "passive":
! $mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
header("Last-Modified: " . $mod_gmt);
# possibly ie5 needs the pre-check line. This needs testing.
--- 433,437 ----
case "passive":
! $mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
header("Last-Modified: " . $mod_gmt);
# possibly ie5 needs the pre-check line. This needs testing.
***************
*** 431,435 ****
case "public":
$exp_gmt = gmdate("D, d M Y H:i:s", time() + $this->allowcache_expire * 60) . " GMT";
! $mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
header("Expires: " . $exp_gmt);
header("Last-Modified: " . $mod_gmt);
--- 441,445 ----
case "public":
$exp_gmt = gmdate("D, d M Y H:i:s", time() + $this->allowcache_expire * 60) . " GMT";
! $mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
header("Expires: " . $exp_gmt);
header("Last-Modified: " . $mod_gmt);
***************
*** 437,441 ****
header("Cache-Control: max-age=" . $this->allowcache_expire * 60);
break;
!
case "private":
$mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
--- 447,451 ----
header("Cache-Control: max-age=" . $this->allowcache_expire * 60);
break;
!
case "private":
$mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
***************
*** 469,473 ****
}
-
##
## Initialization
--- 479,482 ----
***************
*** 476,480 ****
function start($sid = "") {
$this->set_container();
! $this->set_tokenname();
$this->release_token($sid);
$this->put_headers();
--- 485,489 ----
function start($sid = "") {
$this->set_container();
! $this->set_tokenname();
$this->release_token($sid);
$this->put_headers();
|
|
From: Richard A. <ric...@us...> - 2001-08-18 02:45:08
|
Update of /cvsroot/phplib/php-lib/php/session
In directory usw-pr-cvs1:/tmp/cvs-serv32229
Modified Files:
session3.inc
Log Message:
changes to comments and whitespace only - syncing devel and stable trees
Index: session3.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/session/session3.inc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** session3.inc 2001/08/12 04:58:36 1.4
--- session3.inc 2001/08/18 02:45:05 1.5
***************
*** 8,15 ****
* $Id$
*
! */
class Session {
-
var $classname = "Session"; ## Needed for object serialization.
--- 8,14 ----
* $Id$
*
! */
class Session {
var $classname = "Session"; ## Needed for object serialization.
***************
*** 80,84 ****
}
-
## get_id():
##
--- 79,82 ----
***************
*** 90,96 ****
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS, $QUERY_STRING;
$newid=true;
!
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
!
if (empty($id)) {
$newid=false;
--- 88,94 ----
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS, $QUERY_STRING;
$newid=true;
!
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
!
if (empty($id)) {
$newid=false;
***************
*** 104,108 ****
break;
case "cookie":
! $id = isset($HTTP_COOKIE_VARS[$this->name]) ?
$HTTP_COOKIE_VARS[$this->name] : "";
break;
--- 102,106 ----
break;
case "cookie":
! $id = isset($HTTP_COOKIE_VARS[$this->name]) ?
$HTTP_COOKIE_VARS[$this->name] : "";
break;
***************
*** 112,123 ****
}
}
!
if ( "" == $id ) {
$newid=true;
$id = $this->that->ac_newid(md5(uniqid($this->magic)), $this->name);
}
!
!
!
switch ($this->mode) {
case "cookie":
--- 110,119 ----
}
}
!
if ( "" == $id ) {
$newid=true;
$id = $this->that->ac_newid(md5(uniqid($this->magic)), $this->name);
}
!
switch ($this->mode) {
case "cookie":
***************
*** 128,134 ****
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(
--- 124,130 ----
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(
***************
*** 147,156 ****
;
break;
! }
$this->id = $id;
}
## put_id():
! ##
## Stop using the current session id (unset cookie, ...) and
## abandon a session.
--- 143,152 ----
;
break;
! }
$this->id = $id;
}
## put_id():
! ##
## Stop using the current session id (unset cookie, ...) and
## abandon a session.
***************
*** 163,167 ****
$HTTP_COOKIE_VARS[$this->name] = '';
break;
!
default:
// do nothing. We don't need to die for modes other than cookie here.
--- 159,163 ----
$HTTP_COOKIE_VARS[$this->name] = '';
break;
!
default:
// do nothing. We don't need to die for modes other than cookie here.
***************
*** 169,177 ****
}
}
!
## delete():
##
## Delete the current session record and put the session id.
!
function delete() {
$this->that->ac_delete($this->id, $this->name);
--- 165,173 ----
}
}
!
## delete():
##
## Delete the current session record and put the session id.
!
function delete() {
$this->that->ac_delete($this->id, $this->name);
***************
*** 181,188 ****
## url($url):
##
! ## Helper function: returns $url concatenated with the current
## session $id.
!
! function url($url){
// Remove existing session info from url:
if (strstr($url, $this->name) != false)
--- 177,184 ----
## url($url):
##
! ## Helper function: returns $url concatenated with the current
## session $id.
!
! function url($url) {
// Remove existing session info from url:
if (strstr($url, $this->name) != false)
***************
*** 190,198 ****
$url = ereg_replace("&*".$this->name."=[[:alnum:]]+", "", $url);
}
!
// Remove trailing ?/& if needed
$url=ereg_replace("[&?]+$", "", $url);
!
!
switch ($this->mode) {
case "get":
--- 186,193 ----
$url = ereg_replace("&*".$this->name."=[[:alnum:]]+", "", $url);
}
!
// Remove trailing ?/& if needed
$url=ereg_replace("[&?]+$", "", $url);
!
switch ($this->mode) {
case "get":
***************
*** 200,203 ****
--- 195,201 ----
urlencode($this->name)."=".$this->id;
break;
+ default:
+ ;
+ break;
}
return $url;
***************
*** 210,213 ****
--- 208,212 ----
function self_url() {
global $PHP_SELF, $QUERY_STRING;
+
return $this->url($PHP_SELF.
((!empty($QUERY_STRING)) ? "?".$QUERY_STRING : ""));
***************
*** 217,224 ****
print $this->self_url();
}
!
function get_hidden_session() {
! return sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\">\n",
! $this->name,
$this->id);
}
--- 216,223 ----
print $this->self_url();
}
!
function get_hidden_session() {
! return sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\">\n",
! $this->name,
$this->id);
}
***************
*** 227,231 ****
print $this->get_hidden_session();
}
!
function get_hidden_id() {
switch($this->mode) {
--- 226,230 ----
print $this->get_hidden_session();
}
!
function get_hidden_id() {
switch($this->mode) {
***************
*** 235,239 ****
}
}
!
function hidden_id() {
print $this->get_hidden_id();
--- 234,238 ----
}
}
!
function hidden_id() {
print $this->get_hidden_id();
***************
*** 244,249 ****
global $QUERY_STRING;
! if ( !empty($QUERY_STRING)
! || ($this->mode == "get")) {
$sep_char = "&";
} else {
--- 243,248 ----
global $QUERY_STRING;
! if ( !empty($QUERY_STRING)
! || ($this->mode == "get")) {
$sep_char = "&";
} else {
***************
*** 306,310 ****
}
}
-
');
--- 305,308 ----
***************
*** 325,330 ****
break;
}
-
- # print "<br>var $var t $t str $str<br>\n";
}
--- 323,326 ----
***************
*** 355,363 ****
}
}
!
$r = $this->that->ac_store($this->id, $this->name, $str);
$this->release_lock();
! if(!$r) $this->that->ac_halt("Session: freeze() failed.");
}
--- 351,359 ----
}
}
!
$r = $this->that->ac_store($this->id, $this->name, $str);
$this->release_lock();
! if (!$r) $this->that->ac_halt("Session: freeze() failed.");
}
***************
*** 404,408 ****
##
! function set_container(){
$name = $this->that_class;
$this->that = new $name;
--- 400,404 ----
##
! function set_container() {
$name = $this->that_class;
$this->that = new $name;
***************
*** 411,470 ****
}
! function set_tokenname(){
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
}
! 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]) )
- )
- {
! // 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;
}
}
! }
function put_headers() {
# Allowing a limited amount of caching, as suggested by
# Padraic Renaghan on ph...@li....
# Note that in HTTP/1.1 the Cache-Control headers override the Expires
# headers and HTTP/1.0 ignores headers it does not recognize (e.g,
! # Cache-Control). Mulitple Cache-Control directives are split into
# mulitple headers to better support MSIE 4.x.
#
--- 407,460 ----
}
! function set_tokenname() {
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
}
! 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])) ) {
!
! // 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;
}
! }
! }
function put_headers() {
# Allowing a limited amount of caching, as suggested by
# Padraic Renaghan on ph...@li....
+ #
# Note that in HTTP/1.1 the Cache-Control headers override the Expires
# headers and HTTP/1.0 ignores headers it does not recognize (e.g,
! # Cache-Control). Mulitple Cache-Control directives are split into
# mulitple headers to better support MSIE 4.x.
#
***************
*** 475,479 ****
case "passive":
! $mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
header("Last-Modified: " . $mod_gmt);
# possibly ie5 needs the pre-check line. This needs testing.
--- 465,469 ----
case "passive":
! $mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
header("Last-Modified: " . $mod_gmt);
# possibly ie5 needs the pre-check line. This needs testing.
***************
*** 483,487 ****
case "public":
$exp_gmt = gmdate("D, d M Y H:i:s", time() + $this->allowcache_expire * 60) . " GMT";
! $mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
header("Expires: " . $exp_gmt);
header("Last-Modified: " . $mod_gmt);
--- 473,477 ----
case "public":
$exp_gmt = gmdate("D, d M Y H:i:s", time() + $this->allowcache_expire * 60) . " GMT";
! $mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
header("Expires: " . $exp_gmt);
header("Last-Modified: " . $mod_gmt);
***************
*** 489,493 ****
header("Cache-Control: max-age=" . $this->allowcache_expire * 60);
break;
!
case "private":
$mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
--- 479,483 ----
header("Cache-Control: max-age=" . $this->allowcache_expire * 60);
break;
!
case "private":
$mod_gmt = gmdate("D, d M Y H:i:s", getlastmod()) . " GMT";
***************
*** 521,525 ****
}
-
##
## Initialization
--- 511,514 ----
***************
*** 528,532 ****
function start($sid = "") {
$this->set_container();
! $this->set_tokenname();
$this->put_headers();
$this->release_token($sid);
--- 517,521 ----
function start($sid = "") {
$this->set_container();
! $this->set_tokenname();
$this->put_headers();
$this->release_token($sid);
|
|
From: Richard A. <ric...@us...> - 2001-08-18 02:41:52
|
Update of /cvsroot/phplib/php-lib-stable/doc/sgml
In directory usw-pr-cvs1:/tmp/cvs-serv13189
Modified Files:
03-session.sgml 03-user.sgml
Log Message:
changed name of $prefix in serialize to $var - syncing with devel tree
Index: 03-session.sgml
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/doc/sgml/03-session.sgml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** 03-session.sgml 2000/04/17 16:48:32 1.2
--- 03-session.sgml 2001/08/18 02:41:49 1.3
***************
*** 242,248 ****
${$this->name} is <em/not/ deleted.
! <tag>serialize($prefix, &$str)</tag>
<p>serialize() is used internally to append to str all PHP
! code needed to reconstruct the variable named in prefix.
<tag>freeze()</tag>
--- 242,248 ----
${$this->name} is <em/not/ deleted.
! <tag>serialize($var, &$str)</tag>
<p>serialize() is used internally to append to str all PHP
! code needed to reconstruct the variable named in var.
<tag>freeze()</tag>
***************
*** 521,525 ****
The heart of the session class is the <tt/serialize()/ internal
! function. This function takes an expression called prefix and
generates PHP code that will assign the value of that expression
to the expression when executed. For example, if the expression
--- 521,525 ----
The heart of the session class is the <tt/serialize()/ internal
! function. This function takes an expression called var and
generates PHP code that will assign the value of that expression
to the expression when executed. For example, if the expression
***************
*** 559,563 ****
enumerate the contents of the objects slot <tt/persistent_slots/
and call <tt/serialize()/ recursively for each of these slots
! with the appropriate prefix.
Since many of the expressions used in <tt/serialize()/ require
--- 559,563 ----
enumerate the contents of the objects slot <tt/persistent_slots/
and call <tt/serialize()/ recursively for each of these slots
! with the appropriate var.
Since many of the expressions used in <tt/serialize()/ require
Index: 03-user.sgml
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/doc/sgml/03-user.sgml,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** 03-user.sgml 2000/04/17 16:40:03 1.1.1.1
--- 03-user.sgml 2001/08/18 02:41:49 1.2
***************
*** 111,115 ****
<p>Empty. Not useful with User.
! <tag>serialize($prefix, &$str)</tag>
<p>Works as expected.
--- 111,115 ----
<p>Empty. Not useful with User.
! <tag>serialize($var, &$str)</tag>
<p>Works as expected.
|
|
From: Richard A. <ric...@us...> - 2001-08-16 05:42:10
|
Update of /cvsroot/phplib/php-lib/php
In directory usw-pr-cvs1:/tmp/cvs-serv4996
Modified Files:
tree.inc
Log Message:
Bring tree.inc into sync with -stable:
resolve bug ID #450713 - check that the $k var contains something
Add minimal session-awareness to make the example in the docs work
fix a few undefined variable warnings
fix typos, whitespace, escaping '\' chars
It works fine for me in PHP3 and PHP4, but may still have a few issues.
Index: tree.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/tree.inc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tree.inc 1998/12/25 18:05:00 1.4
--- tree.inc 2001/08/16 05:42:07 1.5
***************
*** 42,50 ****
var $prfx=array();
var $sufx=array();
! var $outp;
var $flags;
function build_tree () {
! ## Dis function must be overriden by user!
## Result should fill $this->tree
## Perhaps it is easier to use this function in a recursive manner
--- 42,50 ----
var $prfx=array();
var $sufx=array();
! var $outp="";
var $flags;
function build_tree () {
! ## This function must be overridden by user!
## Result should fill $this->tree
## Perhaps it is easier to use this function in a recursive manner
***************
*** 74,78 ****
eval($evalnext); ## First element
$i=1;
! while ($k || "0"==$k) {
$eval2= $eval . "[\"". ereg_Replace("\"","\\\"",$k) ."\"]";
eval("\$t=gettype($eval2); \$v=$eval2;");
--- 74,78 ----
eval($evalnext); ## First element
$i=1;
! while (strlen($k)) {
$eval2= $eval . "[\"". ereg_Replace("\"","\\\"",$k) ."\"]";
eval("\$t=gettype($eval2); \$v=$eval2;");
***************
*** 122,125 ****
--- 122,127 ----
$index=implode("\"][\"",explode($this->delimiter,$path));
$index = "[\"${index}\"]";
+ } else {
+ $index="";
}
return($index);
***************
*** 149,153 ****
## Same as path_to_index and path_to_child but only
## working on path
! ##
function path_add ($path,$key) {
--- 151,155 ----
## Same as path_to_index and path_to_child but only
## working on path
! ##
function path_add ($path,$key) {
***************
*** 183,186 ****
--- 185,193 ----
# I have made a little example, of how to make a simple
# explorer like output
+ #
+ # These functions attempt to be session-aware. They
+ # look for a global variable called $sess and if it
+ # is set they generate relative URLs containing the
+ # session ID.
function starttree () {
***************
*** 192,195 ****
--- 199,203 ----
function growtree ($key,$value,$path,$depth,$count,$pcount) {
+ global $sess;
#DEB echo ">>> GROWTREE<BR>";
$this->outp.= "<TT>" . join($this->prfx,"");
***************
*** 197,207 ****
$this->outp.="^----";
} elseif ($count==$pcount) {
! $this->outp.=" \---";
} else {
$this->outp.="O----";
}
! $this->outp.= sprintf("</TT> %s->'<A HREF=\"?val=%s\">%s</A>'".
" : '%s' (%s) [%s/%s]<BR>\n",
! $key,URLEncode($value),$value,$path,$depth,$pcount,$count);
if ($count > $pcount) {
$this->prfx[$depth]="|    ";
--- 205,222 ----
$this->outp.="^----";
} elseif ($count==$pcount) {
! $this->outp.=" \\---";
} else {
$this->outp.="O----";
}
! if (isset($sess)) {
! $query_string = $sess->url($GLOBALS["PHP_SELF"]);
! $query_string .= $sess->mode == "get" ? "&" : "?";
! $query_string .= "val=" . urlencode($value);
! } else {
! $query_string = $GLOBALS["PHP_SELF"] . "?val=" . urlencode($value);
! }
! $this->outp.= sprintf("</TT> %s->'<A HREF=\"%s\">%s</A>'".
" : '%s' (%s) [%s/%s]<BR>\n",
! $key,$query_string,$value,$path,$depth,$pcount,$count);
if ($count > $pcount) {
$this->prfx[$depth]="|    ";
***************
*** 213,216 ****
--- 228,232 ----
function leaftree ($key,$value,$path,$depth,$count,$pcount) {
+ global $sess;
#DEB echo "--- LEAFTREE<BR>";
$this->outp.= "<TT>" . join($this->prfx,"");
***************
*** 218,228 ****
$this->outp.="*----";
} elseif ($count==$pcount) {
! $this->outp.=" \---";
} else {
$this->outp.="+----";
}
! $this->outp.= sprintf("</TT> %s->'<A HREF=\"?val=%s\">%s</A>'".
" : '%s' (%s) [%s/%s]<BR>\n",
! $key,URLEncode($value),$value,$path,$depth,$pcount,$count);
$this->flag=false;
}
--- 234,251 ----
$this->outp.="*----";
} elseif ($count==$pcount) {
! $this->outp.=" \\---";
} else {
$this->outp.="+----";
}
! if (isset($sess)) {
! $query_string = $sess->url($GLOBALS["PHP_SELF"]);
! $query_string .= $sess->mode == "get" ? "&" : "?";
! $query_string .= "val=" . urlencode($value);
! } else {
! $query_string = $GLOBALS["PHP_SELF"] . "?val=" . urlencode($value);
! }
! $this->outp.= sprintf("</TT> %s->'<A HREF=\"%s\">%s</A>'".
" : '%s' (%s) [%s/%s]<BR>\n",
! $key,$query_string,$value,$path,$depth,$pcount,$count);
$this->flag=false;
}
|