All pastes #178480 Raw Edit

vudq

public php v1 · immutable
#178480 ·published 2006-09-21 09:58 UTC
rendered paste body
--- phpgwapi/inc/class.sessions.inc.php 2006-09-20 16:50:28.000000000 +0200+++ phpgwapi/inc/sessions/class.sessions.inc.php        2006-09-19 18:06:58.000000000 +0200@@ -10,25 +10,9 @@        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General Public License        * @package phpgwapi        * @subpackage accounts-       * @version $Id: class.sessions.inc.php,v 1.116 2006/09/03 10:31:58 Caeies Exp $+       * @version $Id: class.sessions.inc.php,v 1.2 2006/09/19 16:06:58 skwashd Exp $        * @link http://www.sanisoft.com/phplib/manual/session.php        */--       if (empty($GLOBALS['phpgw_info']['server']['sessions_type']))-       {-               $GLOBALS['phpgw_info']['server']['sessions_type'] = 'php4';-       }--       /**-       * The phpGroupWare session identifier-       */-       define('PHPGW_PHPSESSID', ini_get('session.name'));--       /**-       * Include concrete subclass-       */-       include_once(PHPGW_API_INC.'/class.sessions_'.$GLOBALS['phpgw_info']['server']['sessions_type'].'.inc.php');-        /**        * Session Management@@ -39,7 +23,7 @@        * @subpackage accounts        * @abstract        */-       class sessions_+       class sessions        {                /**                * @var string current user login@@ -109,12 +93,13 @@                /**                * @var array publicly available methods                */-               var $public_functions = array(-                                               'list_methods' => True,-                                               'update_dla'   => True,-                                               'list'         => True,-                                               'total'        => True-                                       );+               var $public_functions = array+               (+                       'list_methods' => true,+                       'update_dla'   => true,+                       'list'         => true,+                       'total'        => true+               );                /**                * @var string domain for cookies@@ -127,14 +112,9 @@                var $xmlrpc_method_called;                /**-               * @var contains the error code when checking sessions-               */-               var $cd_reason;--               /**                * Constructor just loads up some defaults from cookies                */-               function sessions_()+               function sessions()                {                        $this->db =& $GLOBALS['phpgw']->db;                        $this->sessionid = get_var('sessionid',array('GET','COOKIE'));@@ -269,12 +249,9 @@                        $session = $this->read_session($sessionid);                        //echo "<pre>session::verify(id='$sessionid'): \n" . print_r($session, true) . "</pre>\n";-                       if ( !isset($session['session_dla']) || $session['session_dla'] <= (time() - $GLOBALS['phpgw_info']['server']['sessions_timeout']))+                       if ( !isset($session['session_dla'])+                               || $session['session_dla'] <= (time() - $GLOBALS['phpgw_info']['server']['sessions_timeout']))                        {-                               if(isset($session['session_dla']))-                               {-                                       $this->cd_reason = 10;-                               }                                $this->clean_sessions();                                return False;                        }@@ -300,7 +277,6 @@                        $this->account_id = $GLOBALS['phpgw']->accounts->name2id($this->account_lid);                        if (!$this->account_id)                        {-                               $this->cd_reason = 5;                                return false;                        }@@ -330,7 +306,6 @@                                        $GLOBALS['phpgw']->crypto->cleanup();                                        unset($GLOBALS['phpgw']->crypto);                                }-                               $this->cd_reason = 2;                                return False;                        }@@ -358,7 +333,6 @@                                        $GLOBALS['phpgw']->crypto->cleanup();                                        unset($GLOBALS['phpgw']->crypto);                                }-                               $this->cd_reason = 5;                                return False;                        }@@ -383,7 +357,6 @@                                                $GLOBALS['phpgw']->crypto->cleanup();                                                unset($GLOBALS['phpgw']->crypto);                                        }-                                       $this->cd_reason = 2;                                        return False;                                }                        }@@ -585,7 +558,7 @@                                        ));                                        $GLOBALS['phpgw']->log->commit();                                }-                               $this->cd_reason=2;+                                return False;                        }@@ -1175,19 +1148,20 @@                                }                        }-                       /* Now we process the extravars into a proper url format */-                       /* if its not an array, then we turn it into one */-                       /* We do this to help prevent any duplicates from being sent. */+                       /*+                               If an app sends the extrvars as a string we covert the extrvars into an array for proper processing+                               This also helps prevent any duplicate values in the query string.+                       */                        if (!is_array($extravars) && $extravars != '')                        {-                               $a = explode('&', $extravars);-                               $i = 0;-                               while ($i < count($a))+                               trigger_error( lang('String used for extravar in sessions::link(url, extravar) call, use an array'), E_USER_WARNING);+                               $vars = explode('&', $extravars);+                               foreach( $vars as $v )                                {-                                       $b = split('=', $a[$i]);+                                       $b = split('=', $v);                                        $new_extravars[$b[0]] = $b[1];-                                       $i++;                                }+                               unset($extravars);                                $extravars = $new_extravars;                                unset($new_extravars);                        }@@ -1205,10 +1179,7 @@                        if ( !isset($GLOBALS['phpgw_info']['server']['usecookies'])                                || !$GLOBALS['phpgw_info']['server']['usecookies'])                        {-                               $extravars['sessionid'] = $this->sessionid;-                               $extravars['kp3'] = $this->kp3;-                               $extravars['domain'] = $this->account_domain;-                               $extravars[PHPGW_PHPSESSID] = session_id();+                               $extravars = array_merge($extravars, $this->_get_session_vars());                        }                        //used for repost prevention@@ -1323,5 +1294,18 @@                * @return int number of sessions                */                function total()-               {}+               {+                       return 0;+               }++               /**+               * Get the list of session variables used for non cookie based sessions+               *+               * @access private+               * @return array the variables which are specific to this session type+               */+               function _get_session_vars()+               {+                       return array();+               }        }