mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 17:18:54 +01:00
1) fixed lost egw object if register_globals=On: was caused by the identicaly named session-variable used for php4-sessions (now renamed to egw_session)
2) $GLOBALS['phpgw{_info}'] ==> $GLOB ALS['egw{_info}']
This commit is contained in:
parent
6b2eb04274
commit
887e71e57e
@ -12,7 +12,7 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
include_once(PHPGW_INCLUDE_ROOT . '/etemplate/inc/class.soetemplate.inc.php');
|
||||
include_once(EGW_INCLUDE_ROOT . '/etemplate/inc/class.soetemplate.inc.php');
|
||||
|
||||
/**
|
||||
* Business Object for eTemplates, extending the Storage Object
|
||||
@ -79,7 +79,7 @@
|
||||
{
|
||||
$this->init($name);
|
||||
}
|
||||
$this->garbage_collection_done =& $GLOBALS['phpgw_info']['etemplate']['garbage_collection_done'];
|
||||
$this->garbage_collection_done =& $GLOBALS['egw_info']['etemplate']['garbage_collection_done'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -238,7 +238,7 @@
|
||||
{
|
||||
list($msec,$sec) = explode(' ',microtime());
|
||||
$time = 100 * $sec + (int)(100 * $msec); // gives precision of 1/100 sec
|
||||
$id = $GLOBALS['phpgw_info']['flags']['currentapp'] .':'. $time;
|
||||
$id = $GLOBALS['egw_info']['flags']['currentapp'] .':'. $time;
|
||||
//echo "<p>microtime()=".microtime().", sec=$sec, msec=$msec, id=$id</p>\n";
|
||||
return $id;
|
||||
}
|
||||
@ -261,9 +261,9 @@
|
||||
{
|
||||
$id = $this->appsession_id;
|
||||
}
|
||||
$GLOBALS['phpgw']->session->appsession($id,'etemplate',$data);
|
||||
$GLOBALS['egw']->session->appsession($id,'etemplate',$data);
|
||||
|
||||
if ($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4' && !$this->garbage_collection_done)
|
||||
if ($GLOBALS['egw_info']['server']['sessions_type'] == 'php4' && !$this->garbage_collection_done)
|
||||
{
|
||||
return $this->php4_session_garbage_collection();
|
||||
}
|
||||
@ -278,10 +278,10 @@
|
||||
*/
|
||||
function get_appsession($id)
|
||||
{
|
||||
$data = $GLOBALS['phpgw']->session->appsession($id,'etemplate');
|
||||
$data = $GLOBALS['egw']->session->appsession($id,'etemplate');
|
||||
//echo "boetemplate::get_appsession('$id')"; _debug_array($data);
|
||||
|
||||
if ($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4')
|
||||
if ($GLOBALS['egw_info']['server']['sessions_type'] == 'php4')
|
||||
{
|
||||
$this->php4_session_garbage_collection($id);
|
||||
}
|
||||
@ -300,7 +300,7 @@
|
||||
function php4_session_garbage_collection($id_used='')
|
||||
{
|
||||
// now we are on php4 sessions and do a bit of garbage collection
|
||||
$app_sessions =& $_SESSION['egw']['app_sessions']['etemplate'];
|
||||
$app_sessions =& $_SESSION[EGW_SESSION_VAR]['app_sessions']['etemplate'];
|
||||
$session_used =& $app_sessions['session_used'];
|
||||
|
||||
if ($id_used)
|
||||
@ -460,7 +460,7 @@
|
||||
|
||||
if ($app == '')
|
||||
{
|
||||
$app = $GLOBALS['phpgw_info']['flags']['current_app'];
|
||||
$app = $GLOBALS['egw_info']['flags']['current_app'];
|
||||
}
|
||||
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
|
||||
{
|
||||
@ -472,11 +472,11 @@
|
||||
}
|
||||
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
|
||||
{
|
||||
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type] = False;
|
||||
return $GLOBALS['egw_info']['etemplate']['extension'][$type] = False;
|
||||
}
|
||||
$GLOBALS['phpgw_info']['etemplate']['extension'][$type] = CreateObject($app.'.'.$class,$ui='html');
|
||||
$GLOBALS['egw_info']['etemplate']['extension'][$type] = CreateObject($app.'.'.$class,$ui='html');
|
||||
|
||||
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->human_name;
|
||||
return $GLOBALS['egw_info']['etemplate']['extension'][$type]->human_name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -489,8 +489,8 @@
|
||||
*/
|
||||
function haveExtension($type,$function='')
|
||||
{
|
||||
return ($GLOBALS['phpgw_info']['etemplate']['extension'][$type] || $this->loadExtension($type,$ui)) &&
|
||||
($function == '' || $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->public_functions[$function]);
|
||||
return ($GLOBALS['egw_info']['etemplate']['extension'][$type] || $this->loadExtension($type,$ui)) &&
|
||||
($function == '' || $GLOBALS['egw_info']['etemplate']['extension'][$type]->public_functions[$function]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -509,8 +509,8 @@
|
||||
{
|
||||
return False;
|
||||
}
|
||||
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->pre_process($name,$value,$cell,$readonlys,
|
||||
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$name],$this);
|
||||
return $GLOBALS['egw_info']['etemplate']['extension'][$type]->pre_process($name,$value,$cell,$readonlys,
|
||||
$GLOBALS['egw_info']['etemplate']['extension_data'][$name],$this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -528,9 +528,9 @@
|
||||
{
|
||||
return True;
|
||||
}
|
||||
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->post_process($name,$value,
|
||||
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$name],
|
||||
$GLOBALS['phpgw_info']['etemplate']['loop'],$this,$value_in);
|
||||
return $GLOBALS['egw_info']['etemplate']['extension'][$type]->post_process($name,$value,
|
||||
$GLOBALS['egw_info']['etemplate']['extension_data'][$name],
|
||||
$GLOBALS['egw_info']['etemplate']['loop'],$this,$value_in);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -549,8 +549,8 @@
|
||||
{
|
||||
return False;
|
||||
}
|
||||
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->render($cell,$name,$value,$readonly,
|
||||
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$name],$this);
|
||||
return $GLOBALS['egw_info']['etemplate']['extension'][$type]->render($cell,$name,$value,$readonly,
|
||||
$GLOBALS['egw_info']['etemplate']['extension_data'][$name],$this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -754,7 +754,7 @@
|
||||
function store_in_cache()
|
||||
{
|
||||
//echo "<p>store_in_cache('$this->name','$this->template','$this->lang','$this->version')</p>\n";
|
||||
$GLOBALS['phpgw_info']['etemplate']['cache'][$this->cache_name()] = $this->as_array(1);
|
||||
$GLOBALS['egw_info']['etemplate']['cache'][$this->cache_name()] = $this->as_array(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -763,7 +763,7 @@
|
||||
function delete_in_cache()
|
||||
{
|
||||
//echo "<p>delete_in_cache('$this->name','$this->template','$this->lang','$this->version')</p>\n";
|
||||
unset($GLOBALS['phpgw_info']['etemplate']['cache'][$this->cache_name()]);
|
||||
unset($GLOBALS['egw_info']['etemplate']['cache'][$this->cache_name()]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -784,8 +784,8 @@
|
||||
$version = $name['version'];
|
||||
$name = $name['name'];
|
||||
}
|
||||
if (!isset($GLOBALS['phpgw_info']['etemplate']['cache'][$cname]) ||
|
||||
!empty($version) && $GLOBALS['phpgw_info']['etemplate']['cache'][$cname]['version'] != $version)
|
||||
if (!isset($GLOBALS['egw_info']['etemplate']['cache'][$cname]) ||
|
||||
!empty($version) && $GLOBALS['egw_info']['etemplate']['cache'][$cname]['version'] != $version)
|
||||
{
|
||||
//echo " NOT found in cache</p>\n";
|
||||
return False;
|
||||
@ -811,7 +811,7 @@
|
||||
//if (is_array($name)) $version = $name['version']; echo "<p>read_from_cache(,,,version='$version'): ";
|
||||
if ($cname = $this->in_cache($name,$template,$lang,$group))
|
||||
{
|
||||
$this->init($GLOBALS['phpgw_info']['etemplate']['cache'][$cname]);
|
||||
$this->init($GLOBALS['egw_info']['etemplate']['cache'][$cname]);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
@ -24,13 +24,22 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
define('EGW_SESSION_VAR','egw_session'); // where to store our session-data $_SESSION[EGW_SESSION_VAR]
|
||||
|
||||
/**
|
||||
* Session Management via php4 sessions
|
||||
*
|
||||
* @package api
|
||||
* @subpackage sessions
|
||||
*/
|
||||
class sessions extends sessions_
|
||||
{
|
||||
|
||||
function sessions($domain_names=null)
|
||||
{
|
||||
$this->sessions_($domain_names);
|
||||
//controls the time out for php4 sessions - skwashd 18-May-2003
|
||||
ini_set('session.gc_maxlifetime', $GLOBALS['phpgw_info']['server']['sessions_timeout']);
|
||||
ini_set('session.gc_maxlifetime', $GLOBALS['egw_info']['server']['sessions_timeout']);
|
||||
session_name('sessionid');
|
||||
}
|
||||
|
||||
@ -42,7 +51,7 @@
|
||||
}
|
||||
session_id($this->sessionid);
|
||||
session_start();
|
||||
return $_SESSION['egw'];
|
||||
return $_SESSION[EGW_SESSION_VAR];
|
||||
}
|
||||
|
||||
function set_cookie_params($domain)
|
||||
@ -60,15 +69,15 @@
|
||||
function register_session($login,$user_ip,$now,$session_flags)
|
||||
{
|
||||
// session_start() is now called in new_session_id() !!!
|
||||
$_SESSION['egw']['session_id'] = $this->sessionid;
|
||||
$_SESSION['egw']['session_lid'] = $login;
|
||||
$_SESSION['egw']['session_ip'] = $user_ip;
|
||||
$_SESSION['egw']['session_logintime'] = $now;
|
||||
$_SESSION['egw']['session_dla'] = $now;
|
||||
$_SESSION['egw']['session_action'] = $_SERVER['PHP_SELF'];
|
||||
$_SESSION['egw']['session_flags'] = $session_flags;
|
||||
$_SESSION[EGW_SESSION_VAR]['session_id'] = $this->sessionid;
|
||||
$_SESSION[EGW_SESSION_VAR]['session_lid'] = $login;
|
||||
$_SESSION[EGW_SESSION_VAR]['session_ip'] = $user_ip;
|
||||
$_SESSION[EGW_SESSION_VAR]['session_logintime'] = $now;
|
||||
$_SESSION[EGW_SESSION_VAR]['session_dla'] = $now;
|
||||
$_SESSION[EGW_SESSION_VAR]['session_action'] = $_SERVER['PHP_SELF'];
|
||||
$_SESSION[EGW_SESSION_VAR]['session_flags'] = $session_flags;
|
||||
// we need the install-id to differ between serveral installs shareing one tmp-dir
|
||||
$_SESSION['egw']['session_install_id'] = $GLOBALS['phpgw_info']['server']['install_id'];
|
||||
$_SESSION[EGW_SESSION_VAR]['session_install_id'] = $GLOBALS['egw_info']['server']['install_id'];
|
||||
}
|
||||
|
||||
// This will update the DateLastActive column, so the login does not expire
|
||||
@ -90,8 +99,8 @@
|
||||
$action = $this->xmlrpc_method_called;
|
||||
}
|
||||
|
||||
$_SESSION['egw']['session_dla'] = time();
|
||||
$_SESSION['egw']['session_action'] = $action;
|
||||
$_SESSION[EGW_SESSION_VAR]['session_dla'] = time();
|
||||
$_SESSION[EGW_SESSION_VAR]['session_action'] = $action;
|
||||
|
||||
return True;
|
||||
}
|
||||
@ -106,12 +115,12 @@
|
||||
$this->log_access($this->sessionid); // log logout-time
|
||||
|
||||
// Only do the following, if where working with the current user
|
||||
if ($sessionid == $GLOBALS['phpgw_info']['user']['sessionid'])
|
||||
if ($sessionid == $GLOBALS['egw_info']['user']['sessionid'])
|
||||
{
|
||||
session_unset();
|
||||
//echo "<p>sessions_php4::destroy: session_destroy() returned ".(session_destroy() ? 'True' : 'False')."</p>\n";
|
||||
@session_destroy();
|
||||
if ($GLOBALS['phpgw_info']['server']['usecookies'])
|
||||
if ($GLOBALS['egw_info']['server']['usecookies'])
|
||||
{
|
||||
$this->phpgw_setcookie(session_name());
|
||||
}
|
||||
@ -137,38 +146,38 @@
|
||||
{
|
||||
$account_id = get_account_id($accountid,$this->account_id);
|
||||
|
||||
$_SESSION['egw']['app_sessions']['phpgwapi']['phpgw_info_cache'] = '';
|
||||
$_SESSION[EGW_SESSION_VAR]['app_sessions']['phpgwapi']['phpgw_info_cache'] = '';
|
||||
}
|
||||
|
||||
function appsession($location = 'default', $appname = '', $data = '##NOTHING##')
|
||||
{
|
||||
if (! $appname)
|
||||
{
|
||||
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
||||
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
}
|
||||
|
||||
/* This allows the user to put '' as the value. */
|
||||
if ($data == '##NOTHING##')
|
||||
{
|
||||
/* do not decrypt and return if no data (decrypt returning garbage) */
|
||||
if($_SESSION['egw']['app_sessions'][$appname][$location])
|
||||
if($_SESSION[EGW_SESSION_VAR]['app_sessions'][$appname][$location])
|
||||
{
|
||||
return $GLOBALS['phpgw']->crypto->decrypt($_SESSION['egw']['app_sessions'][$appname][$location]);
|
||||
return $GLOBALS['egw']->crypto->decrypt($_SESSION[EGW_SESSION_VAR]['app_sessions'][$appname][$location]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$_SESSION['egw']['app_sessions'][$appname][$location] = $GLOBALS['phpgw']->crypto->encrypt($data);
|
||||
$_SESSION[EGW_SESSION_VAR]['app_sessions'][$appname][$location] = $GLOBALS['egw']->crypto->encrypt($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function session_sort($a,$b)
|
||||
{
|
||||
$sign = strcasecmp($GLOBALS['phpgw']->session->sort_order,'ASC') ? 1 : -1;
|
||||
$sign = strcasecmp($GLOBALS['egw']->session->sort_order,'ASC') ? 1 : -1;
|
||||
|
||||
return strcasecmp(
|
||||
$a[$GLOBALS['phpgw']->session->sort_by],
|
||||
$b[$GLOBALS['phpgw']->session->sort_by]
|
||||
$a[$GLOBALS['egw']->session->sort_by],
|
||||
$b[$GLOBALS['egw']->session->sort_by]
|
||||
) * $sign;
|
||||
}
|
||||
|
||||
@ -181,10 +190,10 @@
|
||||
function list_sessions($start,$order,$sort,$all_no_sort = False)
|
||||
{
|
||||
//echo "<p>session_php4::list_sessions($start,'$order','$sort',$all)</p>\n";
|
||||
$session_cache = $this->appsession('php4_session_cache','phpgwapi');
|
||||
//$session_cache = $this->appsession('php4_session_cache','phpgwapi');
|
||||
|
||||
$values = array();
|
||||
$maxmatchs = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$maxmatchs = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$dir = @opendir($path = ini_get('session.save_path'));
|
||||
if (!$dir) // eg. openbasedir restrictions
|
||||
{
|
||||
@ -217,17 +226,17 @@
|
||||
$session = ($size = filesize ($path . '/' . $file)) ? fread ($fd, $size) : 0;
|
||||
fclose ($fd);
|
||||
}
|
||||
if (substr($session,0,4) != 'egw|')
|
||||
if (substr($session,0,1+strlen(EGW_SESSION_VAR)) != EGW_SESSION_VAR.'|')
|
||||
{
|
||||
$session_cache[$file] = false; // dont try reading it again
|
||||
continue;
|
||||
}
|
||||
$session = unserialize(substr($session,4));
|
||||
$session = unserialize(substr($session,1+strlen(EGW_SESSION_VAR)));
|
||||
unset($session['app_sessions']); // not needed, saves memory
|
||||
$session_cache[$file] = $session;
|
||||
}
|
||||
if($session['session_flags'] == 'A' || !$session['session_id'] ||
|
||||
$session['session_install_id'] != $GLOBALS['phpgw_info']['server']['install_id'])
|
||||
$session['session_install_id'] != $GLOBALS['egw_info']['server']['install_id'])
|
||||
{
|
||||
$session_cache[$file] = false; // dont try reading it again
|
||||
continue; // no anonymous sessions or other domains or installations
|
||||
@ -241,8 +250,8 @@
|
||||
|
||||
if(!$all_no_sort)
|
||||
{
|
||||
$GLOBALS['phpgw']->session->sort_by = $sort;
|
||||
$GLOBALS['phpgw']->session->sort_order = $order;
|
||||
$GLOBALS['egw']->session->sort_by = $sort;
|
||||
$GLOBALS['egw']->session->sort_order = $order;
|
||||
|
||||
uasort($values,array('sessions','session_sort'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user