changing from

1) $GLOBALS['phpgw_info'] to $GLOBALS['egw_info'],
2) $GLOBALS['phpgw'] to $GLOBALS['egw'],
3) PHPGW_ to EGW_ constants
The phpgw ones ars now a reference to the new egw ones, to allow a soft migration
This commit is contained in:
Ralf Becker 2005-03-03 10:47:28 +00:00
parent d7f1458d1a
commit e82027d0cb
3 changed files with 451 additions and 424 deletions

File diff suppressed because it is too large Load Diff

View File

@ -26,15 +26,15 @@
/* $Id$ */ /* $Id$ */
/** /**
* Parent class for the phpgwAPI * Parent class for the egwAPI
* Parent class. Has a few functions but is more importantly used as a parent class for everything else. * Parent class. Has a few functions but is more importantly used as a parent class for everything else.
* @author Dan Kuykendall <dan@kuykendall.org> * @author Dan Kuykendall <dan@kuykendall.org>
* @copyright LGPL * @copyright LGPL
* @package phpgwapi * @package api
* @access public * @access public
*/ */
class phpgw class egw
{ {
var $accounts; var $accounts;
var $applications; var $applications;

View File

@ -53,22 +53,22 @@
{ {
$vars = array($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10); $vars = array($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10);
} }
$value = $GLOBALS['phpgw']->translation->translate("$key",$vars); $value = $GLOBALS['egw']->translation->translate("$key",$vars);
return $value; return $value;
} }
/* Make sure the header.inc.php is current. */ /* Make sure the header.inc.php is current. */
if ($GLOBALS['phpgw_info']['server']['versions']['header'] < $GLOBALS['phpgw_info']['server']['versions']['current_header']) if ($GLOBALS['egw_info']['server']['versions']['header'] < $GLOBALS['egw_info']['server']['versions']['current_header'])
{ {
echo '<center><b>You need to port your settings to the new header.inc.php version by running <a href="setup/manageheader.php">setup/headeradmin</a>.</b></center>'; echo '<center><b>You need to port your settings to the new header.inc.php version by running <a href="setup/manageheader.php">setup/headeradmin</a>.</b></center>';
exit; exit;
} }
/* Make sure the developer is following the rules. */ /* Make sure the developer is following the rules. */
if (!isset($GLOBALS['phpgw_info']['flags']['currentapp'])) if (!isset($GLOBALS['egw_info']['flags']['currentapp']))
{ {
/* This object does not exist yet. */ /* This object does not exist yet. */
/* $GLOBALS['phpgw']->log->write(array('text'=>'W-MissingFlags, currentapp flag not set'));*/ /* $GLOBALS['egw']->log->write(array('text'=>'W-MissingFlags, currentapp flag not set'));*/
echo '<b>!!! YOU DO NOT HAVE YOUR $GLOBALS[\'phpgw_info\'][\'flags\'][\'currentapp\'] SET !!!'; echo '<b>!!! YOU DO NOT HAVE YOUR $GLOBALS[\'phpgw_info\'][\'flags\'][\'currentapp\'] SET !!!';
echo '<br>!!! PLEASE CORRECT THIS SITUATION !!!</b>'; echo '<br>!!! PLEASE CORRECT THIS SITUATION !!!</b>';
@ -82,142 +82,144 @@
\****************************************************************************/ \****************************************************************************/
/* make them fix their header */ /* make them fix their header */
if (!isset($GLOBALS['phpgw_domain'])) if (!isset($GLOBALS['egw_domain']))
{ {
echo '<center><b>The administrator must upgrade the header.inc.php file before you can continue.</b></center>'; echo '<center><b>The administrator must upgrade the header.inc.php file before you can continue.</b></center>';
exit; exit;
} }
if (!isset($GLOBALS['phpgw_info']['server']['default_domain']) || // allow to overwrite the default domain if (!isset($GLOBALS['egw_info']['server']['default_domain']) || // allow to overwrite the default domain
!isset($GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']])) !isset($GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]))
{ {
reset($GLOBALS['phpgw_domain']); reset($GLOBALS['egw_domain']);
list($GLOBALS['phpgw_info']['server']['default_domain']) = each($GLOBALS['phpgw_domain']); list($GLOBALS['egw_info']['server']['default_domain']) = each($GLOBALS['egw_domain']);
} }
if (isset($_POST['login'])) // on login if (isset($_POST['login'])) // on login
{ {
$GLOBALS['login'] = $_POST['login']; $GLOBALS['login'] = $_POST['login'];
if (strstr($GLOBALS['login'],'@') === False || count($GLOBALS['phpgw_domain']) == 1) if (strstr($GLOBALS['login'],'@') === False || count($GLOBALS['egw_domain']) == 1)
{ {
$GLOBALS['login'] .= '@' . get_var('logindomain',array('POST'),$GLOBALS['phpgw_info']['server']['default_domain']); $GLOBALS['login'] .= '@' . get_var('logindomain',array('POST'),$GLOBALS['egw_info']['server']['default_domain']);
} }
$parts = explode('@',$GLOBALS['login']); $parts = explode('@',$GLOBALS['login']);
$GLOBALS['phpgw_info']['user']['domain'] = array_pop($parts); $GLOBALS['egw_info']['user']['domain'] = array_pop($parts);
} }
else // on "normal" pageview else // on "normal" pageview
{ {
$GLOBALS['phpgw_info']['user']['domain'] = get_var('domain', array('GET', 'COOKIE'), FALSE); $GLOBALS['egw_info']['user']['domain'] = get_var('domain', array('GET', 'COOKIE'), FALSE);
} }
if (@isset($GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']])) if (@isset($GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]))
{ {
$GLOBALS['phpgw_info']['server']['db_host'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_host']; $GLOBALS['egw_info']['server']['db_host'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_host'];
$GLOBALS['phpgw_info']['server']['db_port'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_port']; $GLOBALS['egw_info']['server']['db_port'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_port'];
$GLOBALS['phpgw_info']['server']['db_name'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_name']; $GLOBALS['egw_info']['server']['db_name'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_name'];
$GLOBALS['phpgw_info']['server']['db_user'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_user']; $GLOBALS['egw_info']['server']['db_user'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_user'];
$GLOBALS['phpgw_info']['server']['db_pass'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_pass']; $GLOBALS['egw_info']['server']['db_pass'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_pass'];
$GLOBALS['phpgw_info']['server']['db_type'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]['db_type']; $GLOBALS['egw_info']['server']['db_type'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_type'];
} }
else else
{ {
$GLOBALS['phpgw_info']['server']['db_host'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_host']; $GLOBALS['egw_info']['server']['db_host'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['db_host'];
$GLOBALS['phpgw_info']['server']['db_port'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_port']; $GLOBALS['egw_info']['server']['db_port'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['db_port'];
$GLOBALS['phpgw_info']['server']['db_name'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_name']; $GLOBALS['egw_info']['server']['db_name'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['db_name'];
$GLOBALS['phpgw_info']['server']['db_user'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_user']; $GLOBALS['egw_info']['server']['db_user'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['db_user'];
$GLOBALS['phpgw_info']['server']['db_pass'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_pass']; $GLOBALS['egw_info']['server']['db_pass'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['db_pass'];
$GLOBALS['phpgw_info']['server']['db_type'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['db_type']; $GLOBALS['egw_info']['server']['db_type'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['db_type'];
} }
$domain_names = array_keys($GLOBALS['phpgw_domain']); $domain_names = array_keys($GLOBALS['egw_domain']);
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'login' && ! $GLOBALS['phpgw_info']['server']['show_domain_selectbox']) if ($GLOBALS['egw_info']['flags']['currentapp'] != 'login' && ! $GLOBALS['egw_info']['server']['show_domain_selectbox'])
{ {
unset ($GLOBALS['phpgw_domain']); // we kill this for security reasons unset ($GLOBALS['egw_domain']); // we kill this for security reasons
} }
print_debug('domain',@$GLOBALS['phpgw_info']['user']['domain'],'api'); print_debug('domain',@$GLOBALS['egw_info']['user']['domain'],'api');
/****************************************************************************\ /****************************************************************************\
* These lines load up the API, fill up the $phpgw_info array, etc * * These lines load up the API, fill up the $phpgw_info array, etc *
\****************************************************************************/ \****************************************************************************/
/* Load main class */ /* Load main class */
$GLOBALS['phpgw'] = CreateObject('phpgwapi.phpgw'); $GLOBALS['egw'] = CreateObject('phpgwapi.egw');
// for the migration
$GLOBALS['phpgw'] =& $GLOBALS['egw'];
/************************************************************************\ /************************************************************************\
* Load up the main instance of the db class. * * Load up the main instance of the db class. *
\************************************************************************/ \************************************************************************/
$GLOBALS['phpgw']->db = CreateObject('phpgwapi.db'); $GLOBALS['egw']->db = CreateObject('phpgwapi.db');
if ($GLOBALS['phpgw']->debug) if ($GLOBALS['egw']->debug)
{ {
$GLOBALS['phpgw']->db->Debug = 1; $GLOBALS['egw']->db->Debug = 1;
} }
$GLOBALS['phpgw']->db->Halt_On_Error = 'no'; $GLOBALS['egw']->db->Halt_On_Error = 'no';
$GLOBALS['phpgw']->db->connect( $GLOBALS['egw']->db->connect(
$GLOBALS['phpgw_info']['server']['db_name'], $GLOBALS['egw_info']['server']['db_name'],
$GLOBALS['phpgw_info']['server']['db_host'], $GLOBALS['egw_info']['server']['db_host'],
$GLOBALS['phpgw_info']['server']['db_port'], $GLOBALS['egw_info']['server']['db_port'],
$GLOBALS['phpgw_info']['server']['db_user'], $GLOBALS['egw_info']['server']['db_user'],
$GLOBALS['phpgw_info']['server']['db_pass'], $GLOBALS['egw_info']['server']['db_pass'],
$GLOBALS['phpgw_info']['server']['db_type'] $GLOBALS['egw_info']['server']['db_type']
); );
@$GLOBALS['phpgw']->db->query("SELECT COUNT(config_name) FROM phpgw_config"); @$GLOBALS['egw']->db->query("SELECT COUNT(config_name) FROM phpgw_config");
if(!@$GLOBALS['phpgw']->db->next_record()) if(!@$GLOBALS['egw']->db->next_record())
{ {
$setup_dir = str_replace($_SERVER['PHP_SELF'],'index.php','setup/'); $setup_dir = str_replace($_SERVER['PHP_SELF'],'index.php','setup/');
echo '<center><b>Fatal Error:</b> It appears that you have not created the database tables for ' echo '<center><b>Fatal Error:</b> It appears that you have not created the database tables for '
.'eGroupWare. Click <a href="' . $setup_dir . '">here</a> to run setup.</center>'; .'eGroupWare. Click <a href="' . $setup_dir . '">here</a> to run setup.</center>';
exit; exit;
} }
$GLOBALS['phpgw']->db->Halt_On_Error = 'yes'; $GLOBALS['egw']->db->Halt_On_Error = 'yes';
// Set the DB's client charset if a system-charset is set // Set the DB's client charset if a system-charset is set
$GLOBALS['phpgw']->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='system_charset'",__LINE__,__FILE__); $GLOBALS['egw']->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='system_charset'",__LINE__,__FILE__);
if ($GLOBALS['phpgw']->db->next_record() && $GLOBALS['phpgw']->db->f(0)) if ($GLOBALS['egw']->db->next_record() && $GLOBALS['egw']->db->f(0))
{ {
$GLOBALS['phpgw']->db->Link_ID->SetCharSet($GLOBALS['phpgw']->db->f(0)); $GLOBALS['egw']->db->Link_ID->SetCharSet($GLOBALS['egw']->db->f(0));
} }
/* Fill phpgw_info["server"] array */ /* Fill phpgw_info["server"] array */
// An Attempt to speed things up using cache premise // An Attempt to speed things up using cache premise
$GLOBALS['phpgw']->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='cache_phpgw_info'",__LINE__,__FILE__); $GLOBALS['egw']->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='cache_phpgw_info'",__LINE__,__FILE__);
if ($GLOBALS['phpgw']->db->num_rows()) if ($GLOBALS['egw']->db->num_rows())
{ {
$GLOBALS['phpgw']->db->next_record(); $GLOBALS['egw']->db->next_record();
$GLOBALS['phpgw_info']['server']['cache_phpgw_info'] = stripslashes($GLOBALS['phpgw']->db->f('config_value')); $GLOBALS['egw_info']['server']['cache_phpgw_info'] = stripslashes($GLOBALS['egw']->db->f('config_value'));
} }
$cache_query = "select content from phpgw_app_sessions where" $cache_query = "select content from phpgw_app_sessions where"
." sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'"; ." sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'";
$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__); $GLOBALS['egw']->db->query($cache_query,__LINE__,__FILE__);
$server_info_cache = $GLOBALS['phpgw']->db->num_rows(); $server_info_cache = $GLOBALS['egw']->db->num_rows();
if(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $server_info_cache) if(@$GLOBALS['egw_info']['server']['cache_phpgw_info'] && $server_info_cache)
{ {
$GLOBALS['phpgw']->db->next_record(); $GLOBALS['egw']->db->next_record();
$GLOBALS['phpgw_info']['server'] = unserialize(stripslashes($GLOBALS['phpgw']->db->f('content'))); $GLOBALS['egw_info']['server'] = unserialize(stripslashes($GLOBALS['egw']->db->f('content')));
} }
else else
{ {
$GLOBALS['phpgw']->db->query("select * from phpgw_config WHERE config_app='phpgwapi'",__LINE__,__FILE__); $GLOBALS['egw']->db->query("select * from phpgw_config WHERE config_app='phpgwapi'",__LINE__,__FILE__);
while ($GLOBALS['phpgw']->db->next_record()) while ($GLOBALS['egw']->db->next_record())
{ {
$GLOBALS['phpgw_info']['server'][$GLOBALS['phpgw']->db->f('config_name')] = stripslashes($GLOBALS['phpgw']->db->f('config_value')); $GLOBALS['egw_info']['server'][$GLOBALS['egw']->db->f('config_name')] = stripslashes($GLOBALS['egw']->db->f('config_value'));
} }
if(@isset($GLOBALS['phpgw_info']['server']['cache_phpgw_info'])) if(@isset($GLOBALS['egw_info']['server']['cache_phpgw_info']))
{ {
if($server_info_cache) if($server_info_cache)
{ {
$cache_query = "DELETE FROM phpgw_app_sessions WHERE sessionid='0' and loginid='0' and app='phpgwapi' and location='config'"; $cache_query = "DELETE FROM phpgw_app_sessions WHERE sessionid='0' and loginid='0' and app='phpgwapi' and location='config'";
$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__); $GLOBALS['egw']->db->query($cache_query,__LINE__,__FILE__);
} }
$cache_query = 'INSERT INTO phpgw_app_sessions(sessionid,loginid,app,location,content) VALUES(' $cache_query = 'INSERT INTO phpgw_app_sessions(sessionid,loginid,app,location,content) VALUES('
. "'0','0','phpgwapi','config','".addslashes(serialize($GLOBALS['phpgw_info']['server']))."')"; . "'0','0','phpgwapi','config','".addslashes(serialize($GLOBALS['egw_info']['server']))."')";
$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__); $GLOBALS['egw']->db->query($cache_query,__LINE__,__FILE__);
} }
} }
unset($cache_query); unset($cache_query);
unset($server_info_cache); unset($server_info_cache);
if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) && !$_SERVER['HTTPS']) if(@isset($GLOBALS['egw_info']['server']['enforce_ssl']) && !$_SERVER['HTTPS'])
{ {
Header('Location: https://' . $GLOBALS['phpgw_info']['server']['hostname'] . $GLOBALS['phpgw_info']['server']['webserver_url'] . $_SERVER['REQUEST_URI']); Header('Location: https://' . $GLOBALS['egw_info']['server']['hostname'] . $GLOBALS['egw_info']['server']['webserver_url'] . $_SERVER['REQUEST_URI']);
exit; exit;
} }
@ -230,28 +232,38 @@
/************************************************************************\ /************************************************************************\
* Required classes * * Required classes *
\************************************************************************/ \************************************************************************/
$GLOBALS['phpgw']->log = CreateObject('phpgwapi.errorlog'); $GLOBALS['egw']->log = CreateObject('phpgwapi.errorlog');
$GLOBALS['phpgw']->translation = CreateObject('phpgwapi.translation'); $GLOBALS['egw']->translation = CreateObject('phpgwapi.translation');
$GLOBALS['phpgw']->common = CreateObject('phpgwapi.common'); $GLOBALS['egw']->common = CreateObject('phpgwapi.common');
$GLOBALS['phpgw']->hooks = CreateObject('phpgwapi.hooks'); $GLOBALS['egw']->hooks = CreateObject('phpgwapi.hooks');
$GLOBALS['phpgw']->auth = CreateObject('phpgwapi.auth'); $GLOBALS['egw']->auth = CreateObject('phpgwapi.auth');
$GLOBALS['phpgw']->accounts = CreateObject('phpgwapi.accounts'); $GLOBALS['egw']->accounts = CreateObject('phpgwapi.accounts');
$GLOBALS['phpgw']->acl = CreateObject('phpgwapi.acl'); $GLOBALS['egw']->acl = CreateObject('phpgwapi.acl');
$GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions',$domain_names); $GLOBALS['egw']->session = CreateObject('phpgwapi.sessions',$domain_names);
$GLOBALS['phpgw']->preferences = CreateObject('phpgwapi.preferences'); $GLOBALS['egw']->preferences = CreateObject('phpgwapi.preferences');
$GLOBALS['phpgw']->applications = CreateObject('phpgwapi.applications'); $GLOBALS['egw']->applications = CreateObject('phpgwapi.applications');
$GLOBALS['phpgw']->contenthistory = CreateObject('phpgwapi.contenthistory'); $GLOBALS['egw']->contenthistory = CreateObject('phpgwapi.contenthistory');
print_debug('main class loaded', 'messageonly','api'); print_debug('main class loaded', 'messageonly','api');
if (! isset($GLOBALS['phpgw_info']['flags']['included_classes']['error']) || if (! isset($GLOBALS['egw_info']['flags']['included_classes']['error']) ||
! $GLOBALS['phpgw_info']['flags']['included_classes']['error']) ! $GLOBALS['egw_info']['flags']['included_classes']['error'])
{ {
include(PHPGW_INCLUDE_ROOT.'/phpgwapi/inc/class.error.inc.php'); include(EGW_INCLUDE_ROOT.'/phpgwapi/inc/class.error.inc.php');
$GLOBALS['phpgw_info']['flags']['included_classes']['error'] = True; $GLOBALS['egw_info']['flags']['included_classes']['error'] = True;
} }
/*****************************************************************************\ /*****************************************************************************\
* ACL defines - moved here to work for xml-rpc/soap, also * * ACL defines - moved here to work for xml-rpc/soap, also *
\*****************************************************************************/ \*****************************************************************************/
define('EGW_ACL_READ',1);
define('EGW_ACL_ADD',2);
define('EGW_ACL_EDIT',4);
define('EGW_ACL_DELETE',8);
define('EGW_ACL_PRIVATE',16);
define('EGW_ACL_GROUP_MANAGERS',32);
define('EGW_ACL_CUSTOM_1',64);
define('EGW_ACL_CUSTOM_2',128);
define('EGW_ACL_CUSTOM_3',256);
// and the old ones
define('PHPGW_ACL_READ',1); define('PHPGW_ACL_READ',1);
define('PHPGW_ACL_ADD',2); define('PHPGW_ACL_ADD',2);
define('PHPGW_ACL_EDIT',4); define('PHPGW_ACL_EDIT',4);
@ -265,18 +277,18 @@
/****************************************************************************\ /****************************************************************************\
* Forcing the footer to run when the rest of the script is done. * * Forcing the footer to run when the rest of the script is done. *
\****************************************************************************/ \****************************************************************************/
register_shutdown_function(array($GLOBALS['phpgw']->common, 'phpgw_final')); register_shutdown_function(array($GLOBALS['egw']->common, 'egw_final'));
/****************************************************************************\ /****************************************************************************\
* Stuff to use if logging in or logging out * * Stuff to use if logging in or logging out *
\****************************************************************************/ \****************************************************************************/
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'login' || $GLOBALS['phpgw_info']['flags']['currentapp'] == 'logout') if ($GLOBALS['egw_info']['flags']['currentapp'] == 'login' || $GLOBALS['egw_info']['flags']['currentapp'] == 'logout')
{ {
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'login') if ($GLOBALS['egw_info']['flags']['currentapp'] == 'login')
{ {
if (@$_POST['login'] != '') if (@$_POST['login'] != '')
{ {
if (count($GLOBALS['phpgw_domain']) > 1) if (count($GLOBALS['egw_domain']) > 1)
{ {
list($login) = explode('@',$_POST['login']); list($login) = explode('@',$_POST['login']);
} }
@ -285,11 +297,11 @@
$login = $_POST['login']; $login = $_POST['login'];
} }
print_debug('LID',$login,'app'); print_debug('LID',$login,'app');
$login_id = $GLOBALS['phpgw']->accounts->name2id($login); $login_id = $GLOBALS['egw']->accounts->name2id($login);
print_debug('User ID',$login_id,'app'); print_debug('User ID',$login_id,'app');
$GLOBALS['phpgw']->accounts->accounts($login_id); $GLOBALS['egw']->accounts->accounts($login_id);
$GLOBALS['phpgw']->preferences->preferences($login_id); $GLOBALS['egw']->preferences->preferences($login_id);
$GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.datetime'); $GLOBALS['egw']->datetime = CreateObject('phpgwapi.datetime');
} }
} }
/**************************************************************************\ /**************************************************************************\
@ -299,12 +311,12 @@
} }
else else
{ {
if (! $GLOBALS['phpgw']->session->verify()) if (! $GLOBALS['egw']->session->verify())
{ {
// we forward to the same place after the re-login // we forward to the same place after the re-login
if ($GLOBALS['phpgw_info']['server']['webserver_url'] && $GLOBALS['phpgw_info']['server']['webserver_url'] != '/') if ($GLOBALS['egw_info']['server']['webserver_url'] && $GLOBALS['egw_info']['server']['webserver_url'] != '/')
{ {
list(,$relpath) = explode($GLOBALS['phpgw_info']['server']['webserver_url'],$_SERVER['PHP_SELF'],2); list(,$relpath) = explode($GLOBALS['egw_info']['server']['webserver_url'],$_SERVER['PHP_SELF'],2);
} }
else // the webserver-url is empty or just a slash '/' (eGW is installed in the docroot and no domain given) else // the webserver-url is empty or just a slash '/' (eGW is installed in the docroot and no domain given)
{ {
@ -315,41 +327,40 @@
} }
// this removes the sessiondata if its saved in the URL // this removes the sessiondata if its saved in the URL
$query = preg_replace('/[&]?sessionid(=|%3D)[^&]+&kp3(=|%3D)[^&]+&domain=.*$/','',$_SERVER['QUERY_STRING']); $query = preg_replace('/[&]?sessionid(=|%3D)[^&]+&kp3(=|%3D)[^&]+&domain=.*$/','',$_SERVER['QUERY_STRING']);
Header('Location: '.$GLOBALS['phpgw_info']['server']['webserver_url'].'/login.php?cd=10&phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : ''))); Header('Location: '.$GLOBALS['egw_info']['server']['webserver_url'].'/login.php?cd=10&phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : '')));
exit; exit;
} }
$GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.datetime'); $GLOBALS['egw']->datetime = CreateObject('phpgwapi.datetime');
/* A few hacker resistant constants that will be used throught the program */ /* A few hacker resistant constants that will be used throught the program */
define('PHPGW_TEMPLATE_DIR', ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi')); define('EGW_TEMPLATE_DIR', $GLOBALS['egw']->common->get_tpl_dir('phpgwapi'));
define('PHPGW_IMAGES_DIR', ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi')); define('EGW_IMAGES_DIR', $GLOBALS['egw']->common->get_image_path('phpgwapi'));
define('PHPGW_IMAGES_FILEDIR', ExecMethod('phpgwapi.phpgw.common.get_image_dir', 'phpgwapi')); define('EGW_IMAGES_FILEDIR', $GLOBALS['egw']->common->get_image_dir('phpgwapi'));
define('PHPGW_APP_ROOT', ExecMethod('phpgwapi.phpgw.common.get_app_dir')); define('EGW_APP_ROOT', $GLOBALS['egw']->common->get_app_dir());
define('PHPGW_APP_INC', ExecMethod('phpgwapi.phpgw.common.get_inc_dir')); define('EGW_APP_INC', $GLOBALS['egw']->common->get_inc_dir());
define('PHPGW_APP_TPL', ExecMethod('phpgwapi.phpgw.common.get_tpl_dir')); define('EGW_APP_TPL', $GLOBALS['egw']->common->get_tpl_dir());
define('PHPGW_IMAGES', ExecMethod('phpgwapi.phpgw.common.get_image_path')); define('EGW_IMAGES', $GLOBALS['egw']->common->get_image_path());
define('PHPGW_APP_IMAGES_DIR', ExecMethod('phpgwapi.phpgw.common.get_image_dir')); define('EGW_APP_IMAGES_DIR', $GLOBALS['egw']->common->get_image_dir());
// and the old ones
/* define('PHPGW_APP_IMAGES_DIR', $GLOBALS['phpgw']->common->get_image_dir()); */ define('PHPGW_TEMPLATE_DIR', $GLOBALS['egw']->common->get_tpl_dir('phpgwapi'));
define('PHPGW_IMAGES_DIR', $GLOBALS['egw']->common->get_image_path('phpgwapi'));
/* Moved outside of this logic define('PHPGW_IMAGES_FILEDIR', $GLOBALS['egw']->common->get_image_dir('phpgwapi'));
define('PHPGW_ACL_READ',1); define('PHPGW_APP_ROOT', $GLOBALS['egw']->common->get_app_dir());
define('PHPGW_ACL_ADD',2); define('PHPGW_APP_INC', $GLOBALS['egw']->common->get_inc_dir());
define('PHPGW_ACL_EDIT',4); define('PHPGW_APP_TPL', $GLOBALS['egw']->common->get_tpl_dir());
define('PHPGW_ACL_DELETE',8); define('PHPGW_IMAGES', $GLOBALS['egw']->common->get_image_path());
define('PHPGW_ACL_PRIVATE',16); define('PHPGW_APP_IMAGES_DIR', $GLOBALS['egw']->common->get_image_dir());
*/
/********* This sets the user variables *********/ /********* This sets the user variables *********/
$GLOBALS['phpgw_info']['user']['private_dir'] = $GLOBALS['phpgw_info']['server']['files_dir'] $GLOBALS['egw_info']['user']['private_dir'] = $GLOBALS['egw_info']['server']['files_dir']
. '/users/'.$GLOBALS['phpgw_info']['user']['userid']; . '/users/'.$GLOBALS['egw_info']['user']['userid'];
/* This will make sure that a user has the basic default prefs. If not it will add them */ /* This will make sure that a user has the basic default prefs. If not it will add them */
$GLOBALS['phpgw']->preferences->verify_basic_settings(); $GLOBALS['egw']->preferences->verify_basic_settings();
/********* Optional classes, which can be disabled for performance increases *********/ /********* Optional classes, which can be disabled for performance increases *********/
while ($phpgw_class_name = each($GLOBALS['phpgw_info']['flags'])) while ($phpgw_class_name = each($GLOBALS['egw_info']['flags']))
{ {
if (ereg('enable_',$phpgw_class_name[0])) if (ereg('enable_',$phpgw_class_name[0]))
{ {
@ -359,59 +370,59 @@
} }
} }
unset($enable_class); unset($enable_class);
reset($GLOBALS['phpgw_info']['flags']); reset($GLOBALS['egw_info']['flags']);
/*************************************************************************\ /*************************************************************************\
* These lines load up the templates class * * These lines load up the templates class *
\*************************************************************************/ \*************************************************************************/
if(!@$GLOBALS['phpgw_info']['flags']['disable_Template_class']) if(!@$GLOBALS['egw_info']['flags']['disable_Template_class'])
{ {
$GLOBALS['phpgw']->template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); $GLOBALS['egw']->template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
} }
/*************************************************************************\ /*************************************************************************\
* These lines load up the themes * * These lines load up the themes *
\*************************************************************************/ \*************************************************************************/
if (! $GLOBALS['phpgw_info']['user']['preferences']['common']['theme']) if (! $GLOBALS['egw_info']['user']['preferences']['common']['theme'])
{ {
if (@$GLOBALS['phpgw_info']['server']['template_set'] == 'user_choice') if (@$GLOBALS['egw_info']['server']['template_set'] == 'user_choice')
{ {
$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = 'default'; $GLOBALS['egw_info']['user']['preferences']['common']['theme'] = 'default';
} }
else else
{ {
$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = $GLOBALS['phpgw_info']['server']['template_set']; $GLOBALS['egw_info']['user']['preferences']['common']['theme'] = $GLOBALS['egw_info']['server']['template_set'];
} }
} }
if (@$GLOBALS['phpgw_info']['server']['force_theme'] == 'user_choice') if (@$GLOBALS['egw_info']['server']['force_theme'] == 'user_choice')
{ {
if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme'])) if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['theme']))
{ {
$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = 'default'; $GLOBALS['egw_info']['user']['preferences']['common']['theme'] = 'default';
} }
} }
else else
{ {
if (isset($GLOBALS['phpgw_info']['server']['force_theme'])) if (isset($GLOBALS['egw_info']['server']['force_theme']))
{ {
$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = $GLOBALS['phpgw_info']['server']['force_theme']; $GLOBALS['egw_info']['user']['preferences']['common']['theme'] = $GLOBALS['egw_info']['server']['force_theme'];
} }
} }
if(@file_exists(PHPGW_SERVER_ROOT . '/phpgwapi/themes/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . '.theme')) if(@file_exists(EGW_SERVER_ROOT . '/phpgwapi/themes/' . $GLOBALS['egw_info']['user']['preferences']['common']['theme'] . '.theme'))
{ {
include(PHPGW_SERVER_ROOT . '/phpgwapi/themes/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . '.theme'); include(EGW_SERVER_ROOT . '/phpgwapi/themes/' . $GLOBALS['egw_info']['user']['preferences']['common']['theme'] . '.theme');
} }
elseif(@file_exists(PHPGW_SERVER_ROOT . '/phpgwapi/themes/default.theme')) elseif(@file_exists(EGW_SERVER_ROOT . '/phpgwapi/themes/default.theme'))
{ {
include(PHPGW_SERVER_ROOT . '/phpgwapi/themes/default.theme'); include(EGW_SERVER_ROOT . '/phpgwapi/themes/default.theme');
} }
else else
{ {
/* Hope we don't get to this point. Better then the user seeing a */ /* Hope we don't get to this point. Better then the user seeing a */
/* complety back screen and not know whats going on */ /* complety back screen and not know whats going on */
echo '<body bgcolor="FFFFFF">'; echo '<body bgcolor="FFFFFF">';
$GLOBALS['phpgw']->log->write(array('text'=>'F-Abort, No themes found')); $GLOBALS['egw']->log->write(array('text'=>'F-Abort, No themes found'));
exit; exit;
} }
@ -420,50 +431,50 @@
/*************************************************************************\ /*************************************************************************\
* If they are using frames, we need to set some variables * * If they are using frames, we need to set some variables *
\*************************************************************************/ \*************************************************************************/
if (((isset($GLOBALS['phpgw_info']['user']['preferences']['common']['useframes']) && if (((isset($GLOBALS['egw_info']['user']['preferences']['common']['useframes']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['useframes']) && $GLOBALS['egw_info']['user']['preferences']['common']['useframes']) &&
$GLOBALS['phpgw_info']['server']['useframes'] == 'allowed') || $GLOBALS['egw_info']['server']['useframes'] == 'allowed') ||
($GLOBALS['phpgw_info']['server']['useframes'] == 'always')) ($GLOBALS['egw_info']['server']['useframes'] == 'always'))
{ {
$GLOBALS['phpgw_info']['flags']['navbar_target'] = 'phpgw_body'; $GLOBALS['egw_info']['flags']['navbar_target'] = 'phpgw_body';
} }
/*************************************************************************\ /*************************************************************************\
* Verify that the users session is still active otherwise kick them out * * Verify that the users session is still active otherwise kick them out *
\*************************************************************************/ \*************************************************************************/
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' && if ($GLOBALS['egw_info']['flags']['currentapp'] != 'home' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about') $GLOBALS['egw_info']['flags']['currentapp'] != 'about')
{ {
// This will need to use ACL in the future // This will need to use ACL in the future
if (! $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']] || if (! $GLOBALS['egw_info']['user']['apps'][$GLOBALS['egw_info']['flags']['currentapp']] ||
(@$GLOBALS['phpgw_info']['flags']['admin_only'] && (@$GLOBALS['egw_info']['flags']['admin_only'] &&
! $GLOBALS['phpgw_info']['user']['apps']['admin'])) ! $GLOBALS['egw_info']['user']['apps']['admin']))
{ {
$GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['egw']->common->phpgw_header();
if ($GLOBALS['phpgw_info']['flags']['noheader']) if ($GLOBALS['egw_info']['flags']['noheader'])
{ {
echo parse_navbar(); echo parse_navbar();
} }
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access %1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp'])); $GLOBALS['egw']->log->write(array('text'=>'W-Permissions, Attempted to access %1','p1'=>$GLOBALS['egw_info']['flags']['currentapp']));
echo '<p><center><b>'.lang('Access not permitted').'</b></center>'; echo '<p><center><b>'.lang('Access not permitted').'</b></center>';
$GLOBALS['phpgw']->common->phpgw_exit(True); $GLOBALS['egw']->common->phpgw_exit(True);
} }
} }
if(!is_object($GLOBALS['phpgw']->datetime)) if(!is_object($GLOBALS['egw']->datetime))
{ {
$GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.datetime'); $GLOBALS['egw']->datetime = CreateObject('phpgwapi.datetime');
} }
$GLOBALS['phpgw']->applications->read_installed_apps(); // to get translated app-titles $GLOBALS['egw']->applications->read_installed_apps(); // to get translated app-titles
/*************************************************************************\ /*************************************************************************\
* Load the header unless the developer turns it off * * Load the header unless the developer turns it off *
\*************************************************************************/ \*************************************************************************/
if (!@$GLOBALS['phpgw_info']['flags']['noheader']) if (!@$GLOBALS['egw_info']['flags']['noheader'])
{ {
$GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['egw']->common->phpgw_header();
} }
/*************************************************************************\ /*************************************************************************\
@ -477,8 +488,8 @@
{ {
include(PHPGW_APP_INC . '/functions.inc.php'); include(PHPGW_APP_INC . '/functions.inc.php');
} }
if (!@$GLOBALS['phpgw_info']['flags']['noheader'] && if (!@$GLOBALS['egw_info']['flags']['noheader'] &&
!@$GLOBALS['phpgw_info']['flags']['noappheader'] && !@$GLOBALS['egw_info']['flags']['noappheader'] &&
file_exists(PHPGW_APP_INC . '/header.inc.php') && !isset($_GET['menuaction'])) file_exists(PHPGW_APP_INC . '/header.inc.php') && !isset($_GET['menuaction']))
{ {
include(PHPGW_APP_INC . '/header.inc.php'); include(PHPGW_APP_INC . '/header.inc.php');