Ignore:
Timestamp:
06/29/07 15:17:46 (17 years ago)
Author:
niltonneto
Message:

Versão nova do ADODB (4.5 para 4.95)

Location:
trunk/phpgwapi/inc/adodb/session/old
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php

    r2 r34  
    11<?php 
    22/* 
    3 V4.51 29 July 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved. 
     3V4.94 23 Jan 2007  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 
    44  Released under both BSD license and Lesser GPL library license.  
    55  Whenever there is any discrepancy between the two licenses,  
     
    1919 ======= 
    2020  
    21         GLOBAL $HTTP_SESSION_VARS; 
    2221        include('adodb.inc.php'); 
    2322        #---------------------------------# 
     
    2625        session_start(); 
    2726        session_register('AVAR'); 
    28         $HTTP_SESSION_VARS['AVAR'] += 1; 
    29         print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 
     27        $_SESSION['AVAR'] += 1; 
     28        print " 
     29-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 
    3030 
    3131  
     
    193193 
    194194        if (!$rs) { 
    195                 ADOConnection::outp( '<p>Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false); 
     195                ADOConnection::outp( ' 
     196-- Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false); 
    196197        } else { 
    197198                // bug in access driver (could be odbc?) means that info is not commited 
     
    264265        if (defined('ADODB_SESSION_OPTIMIZE')) 
    265266        { 
     267        global $ADODB_SESSION_DRIVER; 
     268         
    266269                switch( $ADODB_SESSION_DRIVER ) { 
    267270                        case 'mysql': 
     
    287290                $t = time(); 
    288291                if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) { 
    289                 global $HTTP_SERVER_VARS; 
    290292                        $msg =  
    291                         __FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 
     293                        __FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 
    292294                        error_log($msg); 
    293                         if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>"); 
     295                        if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 
     296-- $msg</p>"); 
    294297                } 
    295298        } 
     
    311314/* 
    312315if (0) { 
    313 GLOBAL $HTTP_SESSION_VARS; 
    314316 
    315317        session_start(); 
    316318        session_register('AVAR'); 
    317         $HTTP_SESSION_VARS['AVAR'] += 1; 
    318         print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 
     319        $_SESSION['AVAR'] += 1; 
     320        print " 
     321-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 
    319322} 
    320323*/ 
  • trunk/phpgwapi/inc/adodb/session/old/adodb-session-clob.php

    r2 r34  
    11<?php 
    22/* 
    3   V4.51 29 July 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved. 
     3  V4.93 10 Oct 2006  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 
    44  Released under both BSD license and Lesser GPL library license.  
    55  Whenever there is any discrepancy between the two licenses,  
     
    1616 ======= 
    1717  
    18         GLOBAL $HTTP_SESSION_VARS; 
    1918        include('adodb.inc.php'); 
    2019        include('adodb-session.php'); 
    2120        session_start(); 
    2221        session_register('AVAR'); 
    23         $HTTP_SESSION_VARS['AVAR'] += 1; 
    24         print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 
     22        $_SESSION['AVAR'] += 1; 
     23        print " 
     24-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 
    2525         
    2626To force non-persistent connections, call adodb_session_open first before session_start(): 
    2727 
    28         GLOBAL $HTTP_SESSION_VARS; 
    2928        include('adodb.inc.php'); 
    3029        include('adodb-session.php'); 
     
    3231        session_start(); 
    3332        session_register('AVAR'); 
    34         $HTTP_SESSION_VARS['AVAR'] += 1; 
    35         print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 
     33        $_SESSION['AVAR'] += 1; 
     34        print " 
     35-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 
    3636 
    3737  
     
    5858        $ADODB_SESSION_USE_LOBS = false; (or, if you wanna use CLOBS (= 'CLOB') or ( = 'BLOB') 
    5959         
    60   3. Recommended is PHP 4.0.6 or later. There are documented 
     60  3. Recommended is PHP 4.1.0 or later. There are documented 
    6161         session bugs in earlier versions of PHP. 
    6262 
     
    192192                        $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB); 
    193193         
    194         if (!$ok) ADOConnection::outp( "<p>Session: connection failed</p>",false); 
     194        if (!$ok) ADOConnection::outp( " 
     195-- Session: connection failed</p>",false); 
    195196} 
    196197 
     
    253254        // now we only update expiry date, thx to sebastian thom in adodb 2.32 
    254255        if ($ADODB_SESSION_CRC !== false && $ADODB_SESSION_CRC == strlen($val).crc32($val)) { 
    255                 if ($ADODB_SESS_DEBUG) echo "<p>Session: Only updating date - crc32 not changed</p>"; 
     256                if ($ADODB_SESS_DEBUG) echo " 
     257-- Session: Only updating date - crc32 not changed</p>"; 
    256258                $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time(); 
    257259                $rs = $ADODB_SESS_CONN->Execute($qry);   
     
    312314 
    313315        if (!$rs) { 
    314                 ADOConnection::outp( '<p>Session Replace: '.nl2br($err).'</p>',false); 
     316                ADOConnection::outp( ' 
     317-- Session Replace: '.nl2br($err).'</p>',false); 
    315318        }  else { 
    316319                // bug in access driver (could be odbc?) means that info is not commited 
     
    379382                $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time()); 
    380383         
    381                 if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p><b>Garbage Collection</b>: $qry</p>"); 
     384                if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 
     385-- <b>Garbage Collection</b>: $qry</p>"); 
    382386        } 
    383387        // suggested by Cameron, "GaM3R" <gamr@outworld.cx> 
     
    410414                $t = time(); 
    411415                if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) { 
    412                 global $HTTP_SERVER_VARS; 
    413416                        $msg =  
    414                         __FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 
     417                        __FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 
    415418                        error_log($msg); 
    416                         if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>"); 
     419                        if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 
     420-- $msg</p>"); 
    417421                } 
    418422        } 
     
    434438 
    435439if (0) { 
    436 GLOBAL $HTTP_SESSION_VARS; 
    437440 
    438441        session_start(); 
    439442        session_register('AVAR'); 
    440         $HTTP_SESSION_VARS['AVAR'] += 1; 
    441         ADOConnection::outp( "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>",false); 
     443        $_SESSION['AVAR'] += 1; 
     444        ADOConnection::outp( " 
     445-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false); 
    442446} 
    443447 
  • trunk/phpgwapi/inc/adodb/session/old/adodb-session.php

    r2 r34  
    11<?php 
    22/* 
    3 V4.51 29 July 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved. 
     3V4.93 10 Oct 2006  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 
    44  Released under both BSD license and Lesser GPL library license.  
    55  Whenever there is any discrepancy between the two licenses,  
     
    1616 ======= 
    1717  
    18         GLOBAL $HTTP_SESSION_VARS; 
    1918        include('adodb.inc.php'); 
    2019        include('adodb-session.php'); 
    2120        session_start(); 
    2221        session_register('AVAR'); 
    23         $HTTP_SESSION_VARS['AVAR'] += 1; 
    24         print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 
     22        $_SESSION['AVAR'] += 1; 
     23        print " 
     24-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 
    2525         
    2626To force non-persistent connections, call adodb_session_open first before session_start(): 
    2727 
    28         GLOBAL $HTTP_SESSION_VARS; 
    2928        include('adodb.inc.php'); 
    3029        include('adodb-session.php'); 
     
    3231        session_start(); 
    3332        session_register('AVAR'); 
    34         $HTTP_SESSION_VARS['AVAR'] += 1; 
    35         print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 
     33        $_SESSION['AVAR'] += 1; 
     34        print " 
     35-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 
    3636 
    3737  
     
    6868        $ADODB_SESSION_TBL = 'sessions' 
    6969         
    70   3. Recommended is PHP 4.0.6 or later. There are documented 
     70  3. Recommended is PHP 4.1.0 or later. There are documented 
    7171         session bugs in earlier versions of PHP. 
    7272 
     
    107107 /* if database time and system time is difference is greater than this, then give warning */ 
    108108 define('ADODB_SESSION_SYNCH_SECS',60);  
     109 
     110 /* 
     111        Thanks Joe Li. See http://phplens.com/lens/lensforum/msgs.php?id=11487&x=1 
     112*/ 
     113function adodb_session_regenerate_id()  
     114{ 
     115        $conn =& ADODB_Session::_conn(); 
     116        if (!$conn) return false; 
     117 
     118        $old_id = session_id(); 
     119        if (function_exists('session_regenerate_id')) { 
     120                session_regenerate_id(); 
     121        } else { 
     122                session_id(md5(uniqid(rand(), true))); 
     123                $ck = session_get_cookie_params(); 
     124                setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']); 
     125                //@session_start(); 
     126        } 
     127        $new_id = session_id(); 
     128        $ok =& $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id)); 
     129         
     130        /* it is possible that the update statement fails due to a collision */ 
     131        if (!$ok) { 
     132                session_id($old_id); 
     133                if (empty($ck)) $ck = session_get_cookie_params(); 
     134                setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']); 
     135                return false; 
     136        } 
     137         
     138        return true; 
     139} 
    109140 
    110141/****************************************************************************************\ 
     
    194225                        $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB); 
    195226         
    196         if (!$ok) ADOConnection::outp( "<p>Session: connection failed</p>",false); 
     227        if (!$ok) ADOConnection::outp( " 
     228-- Session: connection failed</p>",false); 
    197229} 
    198230 
     
    253285        // now we only update expiry date, thx to sebastian thom in adodb 2.32 
    254286        if ($ADODB_SESSION_CRC !== false && $ADODB_SESSION_CRC == strlen($val).crc32($val)) { 
    255                 if ($ADODB_SESS_DEBUG) echo "<p>Session: Only updating date - crc32 not changed</p>"; 
     287                if ($ADODB_SESS_DEBUG) echo " 
     288-- Session: Only updating date - crc32 not changed</p>"; 
    256289                $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time(); 
    257290                $rs = $ADODB_SESS_CONN->Execute($qry);   
     
    270303         
    271304        if (!$rs) { 
    272                 ADOConnection::outp( '<p>Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false); 
     305                ADOConnection::outp( ' 
     306-- Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false); 
    273307        }  else { 
    274308                // bug in access driver (could be odbc?) means that info is not commited 
     
    337371                $ADODB_SESS_CONN->Execute($qry); 
    338372         
    339                 if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p><b>Garbage Collection</b>: $qry</p>"); 
     373                if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 
     374-- <b>Garbage Collection</b>: $qry</p>"); 
    340375        } 
    341376        // suggested by Cameron, "GaM3R" <gamr@outworld.cx> 
     
    369404         
    370405                if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) { 
    371                 global $HTTP_SERVER_VARS; 
     406                 
    372407                        $msg =  
    373                         __FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 
     408                        __FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 
    374409                        error_log($msg); 
    375                         if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>"); 
     410                        if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 
     411-- $msg</p>"); 
    376412                } 
    377413        } 
     
    393429 
    394430if (0) { 
    395 GLOBAL $HTTP_SESSION_VARS; 
    396431 
    397432        session_start(); 
    398433        session_register('AVAR'); 
    399         $HTTP_SESSION_VARS['AVAR'] += 1; 
    400         ADOConnection::outp( "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>",false); 
     434        $_SESSION['AVAR'] += 1; 
     435        ADOConnection::outp( " 
     436-- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false); 
    401437} 
    402438 
Note: See TracChangeset for help on using the changeset viewer.