modernized code and fixed problem reported on the list: new installs cant create admin-account due to not longer existing phpgw class in the api

This commit is contained in:
Ralf Becker 2005-03-24 13:15:12 +00:00
parent ad291e1fa5
commit 4e2bce12e6
12 changed files with 376 additions and 368 deletions

View File

@ -24,18 +24,18 @@
\**************************************************************************/
/* $Id$ */
if (empty($GLOBALS['phpgw_info']['server']['account_repository']))
if (empty($GLOBALS['egw_info']['server']['account_repository']))
{
if (!empty($GLOBALS['phpgw_info']['server']['auth_type']))
if (!empty($GLOBALS['egw_info']['server']['auth_type']))
{
$GLOBALS['phpgw_info']['server']['account_repository'] = $GLOBALS['phpgw_info']['server']['auth_type'];
$GLOBALS['egw_info']['server']['account_repository'] = $GLOBALS['egw_info']['server']['auth_type'];
}
else
{
$GLOBALS['phpgw_info']['server']['account_repository'] = 'sql';
$GLOBALS['egw_info']['server']['account_repository'] = 'sql';
}
}
include_once(PHPGW_API_INC . '/class.accounts_' . $GLOBALS['phpgw_info']['server']['account_repository'] . '.inc.php');
include_once(EGW_API_INC . '/class.accounts_' . $GLOBALS['egw_info']['server']['account_repository'] . '.inc.php');
/*
Dont know where to put this (seek3r)
@ -43,7 +43,7 @@
This is where it ended up (milosch)
Moved again at least temporarily since sql and ldap use it.
*/
$GLOBALS['phpgw_info']['server']['global_denied_users'] = array(
$GLOBALS['egw_info']['server']['global_denied_users'] = array(
'root' => True, 'bin' => True, 'daemon' => True,
'adm' => True, 'lp' => True, 'sync' => True,
'shutdown' => True, 'halt' => True, 'ldap' => True,
@ -62,7 +62,7 @@
'backup' => True
);
$GLOBALS['phpgw_info']['server']['global_denied_groups'] = array(
$GLOBALS['egw_info']['server']['global_denied_groups'] = array(
'root' => True, 'bin' => True, 'daemon' => True,
'sys' => True, 'adm' => True, 'tty' => True,
'disk' => True, 'lp' => True, 'mem' => True,
@ -79,10 +79,11 @@
'ldap' => True, 'backup' => True
);
/*!
@class_start accounts
@abstract Class for handling user and group accounts
*/
/**
* @class_start accounts
* Class for handling user and group accounts
*
*/
class accounts extends accounts_
{
@ -100,9 +101,9 @@
function accounts($account_id = '', $account_type='')
{
// enable the caching in the session onyl for ldap
$this->use_session_cache = $GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap';
$this->use_session_cache = $GLOBALS['egw_info']['server']['account_repository'] == 'ldap';
$this->db = $GLOBALS['phpgw']->db;
$this->db = $GLOBALS['egw']->db;
if($account_id != '')
{
@ -148,18 +149,18 @@
function setup_cache()
{
if ($this->use_session_cache && // are we supposed to use a session-cache
!@$GLOBALS['phpgw_info']['accounts']['session_cache_setup'] && // is it already setup
!@$GLOBALS['egw_info']['accounts']['session_cache_setup'] && // is it already setup
// is the account-class ready (startup !)
is_object($GLOBALS['phpgw']->session) && $GLOBALS['phpgw']->session->account_id)
is_object($GLOBALS['egw']->session) && $GLOBALS['egw']->session->account_id)
{
// setting up the session-cache
$GLOBALS['phpgw_info']['accounts']['cache'] = $GLOBALS['phpgw']->session->appsession('accounts_cache','phpgwapi');
$GLOBALS['phpgw_info']['accounts']['session_cache_setup'] = True;
//echo "accounts::setup_cache() cache=<pre>".print_r($GLOBALS['phpgw_info']['accounts']['cache'],True)."</pre>\n";
$GLOBALS['egw_info']['accounts']['cache'] = $GLOBALS['egw']->session->appsession('accounts_cache','phpgwapi');
$GLOBALS['egw_info']['accounts']['session_cache_setup'] = True;
//echo "accounts::setup_cache() cache=<pre>".print_r($GLOBALS['egw_info']['accounts']['cache'],True)."</pre>\n";
}
if (!isset($this->cache))
{
$this->cache = &$GLOBALS['phpgw_info']['accounts']['cache'];
$this->cache = &$GLOBALS['egw_info']['accounts']['cache'];
}
}
@ -171,11 +172,11 @@
function save_session_cache()
{
if ($this->use_session_cache && // are we supposed to use a session-cache
$GLOBALS['phpgw_info']['accounts']['session_cache_setup'] && // is it already setup
$GLOBALS['egw_info']['accounts']['session_cache_setup'] && // is it already setup
// is the account-class ready (startup !)
is_object($GLOBALS['phpgw']->session))
is_object($GLOBALS['egw']->session))
{
$GLOBALS['phpgw']->session->appsession('accounts_cache','phpgwapi',$GLOBALS['phpgw_info']['accounts']['cache']);
$GLOBALS['egw']->session->appsession('accounts_cache','phpgwapi',$GLOBALS['egw_info']['accounts']['cache']);
}
}
@ -261,13 +262,13 @@
}
if ($group)
{
$members = $group > 0 ? $GLOBALS['phpgw']->acl->get_ids_for_location($group, 1, 'phpgw_group') :
$GLOBALS['phpgw']->acl->get_location_list_for_id('phpgw_group', 1,$GLOBALS['phpgw_info']['user']['account_id']);
$members = $group > 0 ? $GLOBALS['egw']->acl->get_ids_for_location($group, 1, 'phpgw_group') :
$GLOBALS['egw']->acl->get_location_list_for_id('phpgw_group', 1,$GLOBALS['egw_info']['user']['account_id']);
if (!$members) $members = array();
$valid = !$app ? $members : array_intersect($valid,$members); // use the intersection
}
//echo "<p>limiting result to app='app' and/or group=$group valid-ids=".print_r($valid,true)."</p>\n";
$offset = $param['offset'] ? $param['offset'] : $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
$offset = $param['offset'] ? $param['offset'] : $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
$stop = $start + $offset;
$n = 0;
$account_search[$serial]['data'] = array();
@ -355,7 +356,7 @@
function cache_invalidate($account_id)
{
//echo "<p>accounts::cache_invalidate($account_id)</p>\n";
$GLOBALS['phpgw_info']['accounts']['cache'] = array();
$GLOBALS['egw_info']['accounts']['cache'] = array();
}
function save_repository()
@ -370,7 +371,7 @@
accounts_::delete($accountid);
// delete all acl_entries belonging to that user or group
$GLOBALS['phpgw']->acl->delete_account($accountid);
$GLOBALS['egw']->acl->delete_account($accountid);
}
function create($account_info,$default_prefs=True)
@ -427,7 +428,7 @@
}
$security_equals = Array();
$security_equals = $GLOBALS['phpgw']->acl->get_location_list_for_id('phpgw_group', 1, $account_id);
$security_equals = $GLOBALS['egw']->acl->get_location_list_for_id('phpgw_group', 1, $account_id);
if ($security_equals == False)
{
@ -450,7 +451,7 @@
$account_id = get_account_id($accountid);
$security_equals = Array();
$acl = CreateObject('phpgwapi.acl');
$acl =& CreateObject('phpgwapi.acl');
$security_equals = $acl->get_ids_for_location($account_id, 1, 'phpgw_group');
unset($acl);
@ -468,16 +469,16 @@
return $this->members;
}
/*!
@function get_nextid
@abstract Using the common functions next_id and last_id, find the next available account_id
@param $account_type (optional, default to 'u')
*/
/**
* Using the common functions next_id and last_id, find the next available account_id
*
* @param $account_type (optional, default to 'u')
*/
// NOTE: to my knowledge this is not used any more RalfBecker 2004/06/15
function get_nextid($account_type='u')
{
$min = $GLOBALS['phpgw_info']['server']['account_min_id'] ? $GLOBALS['phpgw_info']['server']['account_min_id'] : 0;
$max = $GLOBALS['phpgw_info']['server']['account_max_id'] ? $GLOBALS['phpgw_info']['server']['account_max_id'] : 0;
$min = $GLOBALS['egw_info']['server']['account_min_id'] ? $GLOBALS['egw_info']['server']['account_min_id'] : 0;
$max = $GLOBALS['egw_info']['server']['account_max_id'] ? $GLOBALS['egw_info']['server']['account_max_id'] : 0;
if ($account_type == 'g')
{
@ -487,7 +488,7 @@
{
$type = 'accounts';
}
$nextid = (int)$GLOBALS['phpgw']->common->last_id($type,$min,$max);
$nextid = (int)$GLOBALS['egw']->common->last_id($type,$min,$max);
/* Loop until we find a free id */
$free = 0;
@ -497,7 +498,7 @@
//echo '<br>calling search for id: '.$nextid;
if ($this->exists($nextid))
{
$nextid = (int)$GLOBALS['phpgw']->common->next_id($type,$min,$max);
$nextid = (int)$GLOBALS['egw']->common->next_id($type,$min,$max);
}
else
{
@ -505,7 +506,7 @@
/* echo '<br>calling search for lid: '.$account_lid . '(from account_id=' . $nextid . ')'; */
if ($this->exists($account_lid))
{
$nextid = (int)$GLOBALS['phpgw']->common->next_id($type,$min,$max);
$nextid = (int)$GLOBALS['egw']->common->next_id($type,$min,$max);
}
else
{
@ -513,8 +514,8 @@
}
}
}
if ($GLOBALS['phpgw_info']['server']['account_max_id'] &&
($nextid > $GLOBALS['phpgw_info']['server']['account_max_id']))
if ($GLOBALS['egw_info']['server']['account_max_id'] &&
($nextid > $GLOBALS['egw_info']['server']['account_max_id']))
{
return False;
}
@ -543,7 +544,7 @@
{
return $cache;
}
$app_users = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,$app_users);
$app_users = $GLOBALS['egw']->acl->get_ids_for_location('run',1,$app_users);
}
$accounts = array(
'accounts' => array(),
@ -551,11 +552,11 @@
);
foreach($app_users as $id)
{
$type = $GLOBALS['phpgw']->accounts->get_type($id);
$type = $GLOBALS['egw']->accounts->get_type($id);
if($type == 'g')
{
$accounts['groups'][$id] = $id;
foreach((array)$GLOBALS['phpgw']->acl->get_ids_for_location($id,1,'phpgw_group') as $id)
foreach((array)$GLOBALS['egw']->acl->get_ids_for_location($id,1,'phpgw_group') as $id)
{
$accounts['accounts'][$id] = $id;
}

View File

@ -28,7 +28,7 @@
THIS NEEDS WORK!!!!!!!!! - Milosch
But it is a lot closer now...
*/
$GLOBALS['phpgw_info']['server']['global_denied_users'] = array(
$GLOBALS['egw_info']['server']['global_denied_users'] = array(
'root' => True, 'bin' => True, 'daemon' => True,
'adm' => True, 'lp' => True, 'sync' => True,
'shutdown' => True, 'halt' => True, 'ldap' => True,
@ -47,7 +47,7 @@
'backup' => True
);
$GLOBALS['phpgw_info']['server']['global_denied_groups'] = array(
$GLOBALS['egw_info']['server']['global_denied_groups'] = array(
'root' => True, 'bin' => True, 'daemon' => True,
'sys' => True, 'adm' => True, 'tty' => True,
'disk' => True, 'lp' => True, 'mem' => True,
@ -84,15 +84,15 @@
function accounts_()
{
$this->db = $GLOBALS['phpgw']->db;
$this->contacts = CreateObject('phpgwapi.contacts',0);
$this->db = $GLOBALS['egw']->db;
$this->contacts =& CreateObject('phpgwapi.contacts',0);
}
function makeobj()
{
if(!$this->contacts)
{
$this->contacts = CreateObject('phpgwapi.contacts','0');
$this->contacts =& CreateObject('phpgwapi.contacts','0');
}
}
@ -268,7 +268,7 @@
{
$account_info['account_id'] = $this->get_nextid();
}
$owner = $GLOBALS['phpgw_info']['user']['account_id'];
$owner = $GLOBALS['egw_info']['user']['account_id'];
$entry['id'] = $account_info['account_id'];
$entry['lid'] = $account_info['account_lid'];
$entry['n_given'] = $account_info['account_firstname'];

View File

@ -38,13 +38,13 @@
function accounts_()
{
$this->ds = $GLOBALS['phpgw']->common->ldapConnect();
if(!@is_object($GLOBALS['phpgw']->translation))
$this->ds = $GLOBALS['egw']->common->ldapConnect();
if(!@is_object($GLOBALS['egw']->translation))
{
$GLOBALS['phpgw']->translation = CreateObject('phpgwapi.translation');
$GLOBALS['egw']->translation =& CreateObject('phpgwapi.translation');
}
$this->user_context = $GLOBALS['phpgw_info']['server']['ldap_context'];
$this->group_context = $GLOBALS['phpgw_info']['server']['ldap_group_context'];
$this->user_context = $GLOBALS['egw_info']['server']['ldap_context'];
$this->group_context = $GLOBALS['egw_info']['server']['ldap_group_context'];
}
function read_repository()
@ -67,7 +67,7 @@
{
$this->data['account_id'] = $allValues[0]['gidnumber'][0];
$this->data['account_lid'] = $allValues[0]['cn'][0];
$this->data['firstname'] = $GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
$this->data['firstname'] = $GLOBALS['egw']->translation->convert($allValues[0]['cn'][0],'utf-8');
$this->data['lastname'] = lang('Group');
}
else
@ -75,8 +75,8 @@
$this->data['account_id'] = $allValues[0]['uidnumber'][0];
$this->data['account_primary_group'] = $allValues[0]['gidnumber'][0];
$this->data['account_lid'] = $allValues[0]['uid'][0];
$this->data['firstname'] = $GLOBALS['phpgw']->translation->convert($allValues[0]['givenname'][0],'utf-8');
$this->data['lastname'] = $GLOBALS['phpgw']->translation->convert($allValues[0]['sn'][0],'utf-8');
$this->data['firstname'] = $GLOBALS['egw']->translation->convert($allValues[0]['givenname'][0],'utf-8');
$this->data['lastname'] = $GLOBALS['egw']->translation->convert($allValues[0]['sn'][0],'utf-8');
if(isset($allValues[0]['mail'][0]))
{
$this->data['email'] = $allValues[0]['mail'][0];
@ -85,7 +85,7 @@
$this->data['account_dn'] = $allValues[0]['dn'];
$this->data['fullname'] = $allValues[0]['cn'][0];
if ($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
if ($GLOBALS['egw_info']['server']['ldap_extra_attributes'])
{
$this->data['homedirectory'] = $allValues[0]['homedirectory'][0];
$this->data['loginshell'] = $allValues[0]['loginshell'][0];
@ -122,30 +122,30 @@
if($acct_type == 'u')
{
// data for posixaccount
$newData['cn'] = $GLOBALS['phpgw']->translation->convert(sprintf("%s %s",
$newData['cn'] = $GLOBALS['egw']->translation->convert(sprintf("%s %s",
$this->data['firstname'],
$this->data['lastname']),$GLOBALS['phpgw']->translation->charset(),'utf-8'
$this->data['lastname']),$GLOBALS['egw']->translation->charset(),'utf-8'
);
$newData['uid'] = $GLOBALS['phpgw']->translation->convert(
$newData['uid'] = $GLOBALS['egw']->translation->convert(
$this->data['account_lid'],
$GLOBALS['phpgw']->translation->charset(),'utf-8'
$GLOBALS['egw']->translation->charset(),'utf-8'
);
if($this->data['lastname'])
{
$newData['sn'] = $GLOBALS['phpgw']->translation->convert(
$newData['sn'] = $GLOBALS['egw']->translation->convert(
$this->data['lastname'],
$GLOBALS['phpgw']->translation->charset(),'utf-8'
$GLOBALS['egw']->translation->charset(),'utf-8'
);
}
if($this->data['firstname'])
{
$newData['givenname'] = $GLOBALS['phpgw']->translation->convert(
$newData['givenname'] = $GLOBALS['egw']->translation->convert(
$this->data['firstname'],
$GLOBALS['phpgw']->translation->charset(),'utf-8'
$GLOBALS['egw']->translation->charset(),'utf-8'
);
}
if ($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
if ($GLOBALS['egw_info']['server']['ldap_extra_attributes'])
{
$newData['homedirectory'] = $this->data['homedirectory'];
$newData['loginshell'] = $this->data['loginshell'];
@ -195,9 +195,9 @@
else
{
// data for posixgroup
$newData['cn'] = $GLOBALS['phpgw']->translation->convert(
$newData['cn'] = $GLOBALS['egw']->translation->convert(
$this->data['account_lid'],
$GLOBALS['phpgw']->translation->charset(), 'utf-8'
$GLOBALS['egw']->translation->charset(), 'utf-8'
);
$newData['gidnumber'] = $this->account_id;
$newGroupID = $newData['cn'];
@ -220,7 +220,7 @@
{
$test = $allValues[0]['uid'][0];
}
if($GLOBALS['phpgw']->translation->convert($test,'utf-8') != $this->data['account_lid'])
if($GLOBALS['egw']->translation->convert($test,'utf-8') != $this->data['account_lid'])
{
$oldData = $allValues[0];
$oldDN = $oldData['dn'];
@ -497,14 +497,14 @@
{
settype($allVals,'array');
$test = @$allVals['uid'][0];
if (!$GLOBALS['phpgw_info']['server']['global_denied_users'][$test] && $allVals['uid'][0])
if (!$GLOBALS['egw_info']['server']['global_denied_users'][$test] && $allVals['uid'][0])
{
$accounts[] = Array(
'account_id' => $allVals['uidnumber'][0],
'account_lid' => $allVals['uid'][0],
'account_type' => $allVals['phpgwaccounttype'][0],
'account_firstname' => $GLOBALS['phpgw']->translation->convert($allVals['givenname'][0],'utf-8'),
'account_lastname' => $GLOBALS['phpgw']->translation->convert($allVals['sn'][0],'utf-8'),
'account_firstname' => $GLOBALS['egw']->translation->convert($allVals['givenname'][0],'utf-8'),
'account_lastname' => $GLOBALS['egw']->translation->convert($allVals['sn'][0],'utf-8'),
'account_status' => $allVals['phpgwaccountstatus'][0],
'account_email' => $allVals['mail'][0],
);
@ -527,14 +527,14 @@
{
settype($allVals,'array');
$test = $allVals['cn'][0];
if (!$GLOBALS['phpgw_info']['server']['global_denied_groups'][$test] && $allVals['cn'][0])
if (!$GLOBALS['egw_info']['server']['global_denied_groups'][$test] && $allVals['cn'][0])
{
$accounts[] = Array(
'account_id' => $allVals['gidnumber'][0],
'account_lid' => $allVals['cn'][0],
'account_type' => $allVals['phpgwaccounttype'][0],
'account_firstname' => $GLOBALS['phpgw']->translation->convert($allVals['givenname'][0],'utf-8'),
'account_lastname' => $GLOBALS['phpgw']->translation->convert($allVals['sn'][0],'utf-8'),
'account_firstname' => $GLOBALS['egw']->translation->convert($allVals['givenname'][0],'utf-8'),
'account_lastname' => $GLOBALS['egw']->translation->convert($allVals['sn'][0],'utf-8'),
'account_status' => $allVals['phpgwaccountstatus'][0],
'account_email' => $allVals['mail'][0],
);
@ -542,7 +542,7 @@
}
}
// sort the array
$arrayFunctions = CreateObject('phpgwapi.arrayfunctions');
$arrayFunctions =& CreateObject('phpgwapi.arrayfunctions');
if(empty($order))
{
$order = 'account_lid';
@ -561,7 +561,7 @@
}
elseif(is_int($start))
{
return array_slice($sortedAccounts, $start, $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']);
return array_slice($sortedAccounts, $start, $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']);
}
else
{
@ -749,10 +749,10 @@
}
$allValues = ldap_get_entries($this->ds, $sri);
if ($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'] && $account_info['account_type'] != 'g')
if ($GLOBALS['egw_info']['server']['ldap_extra_attributes'] && $account_info['account_type'] != 'g')
{
$entry['homedirectory'] = $account_info['homedirectory'] && $account_info['homedirectory'] != $GLOBALS['phpgw_info']['server']['ldap_account_home'] ? $account_info['homedirectory'] : $GLOBALS['phpgw_info']['server']['ldap_account_home'].SEP.$account_info['account_lid'];
$entry['loginshell'] = $account_info['loginshell'] ? $account_info['loginshell'] : $GLOBALS['phpgw_info']['server']['ldap_account_shell'];
$entry['homedirectory'] = $account_info['homedirectory'] && $account_info['homedirectory'] != $GLOBALS['egw_info']['server']['ldap_account_home'] ? $account_info['homedirectory'] : $GLOBALS['egw_info']['server']['ldap_account_home'].SEP.$account_info['account_lid'];
$entry['loginshell'] = $account_info['loginshell'] ? $account_info['loginshell'] : $GLOBALS['egw_info']['server']['ldap_account_shell'];
}
elseif($account_info['account_type'] != 'g')
{
@ -799,7 +799,7 @@
$tmpentry['objectclass'][1] = 'person';
$tmpentry['objectclass'][2] = 'organizationalPerson';
$tmpentry['objectclass'][3] = 'inetOrgPerson';
$tmpentry['userpassword'] = $GLOBALS['phpgw']->common->encrypt_password($account_info['account_passwd'],False);
$tmpentry['userpassword'] = $GLOBALS['egw']->common->encrypt_password($account_info['account_passwd'],False);
/* $tmpentry['objectclass'][4] = 'account'; Causes problems with some LDAP servers */
$tmpentry['objectclass'][4] = 'posixAccount';
$tmpentry['objectclass'][5] = 'shadowAccount';
@ -821,51 +821,51 @@
$entry['objectclass'][0] = 'top';
$entry['objectclass'][1] = 'posixGroup';
$entry['objectclass'][2] = 'phpgwAccount';
$entry['cn'] = $GLOBALS['phpgw']->translation->convert($account_info['account_lid'],$GLOBALS['phpgw']->translation->charset(),'utf-8');
$entry['cn'] = $GLOBALS['egw']->translation->convert($account_info['account_lid'],$GLOBALS['egw']->translation->charset(),'utf-8');
$entry['gidnumber'] = $account_id;
#$entry['userpassword'] = $GLOBALS['phpgw']->common->encrypt_password($account_info['account_passwd']);
#$entry['userpassword'] = $GLOBALS['egw']->common->encrypt_password($account_info['account_passwd']);
$entry['description'] = 'phpgw-created group';
}
else
{
$dn = 'uid=' . $account_info['account_lid'] . ',' . $this->user_context;
$entry['cn'] = $GLOBALS['phpgw']->translation->convert(
$entry['cn'] = $GLOBALS['egw']->translation->convert(
sprintf(
"%s %s",
$account_info['account_firstname'],
$account_info['account_lastname']
),
$GLOBALS['phpgw']->translation->charset(),
$GLOBALS['egw']->translation->charset(),
'utf-8'
);
$entry['sn'] = $GLOBALS['phpgw']->translation->convert(
$entry['sn'] = $GLOBALS['egw']->translation->convert(
$account_info['account_lastname'],
$GLOBALS['phpgw']->translation->charset(),
$GLOBALS['egw']->translation->charset(),
'utf-8'
);
if($account_info['account_firstname'])
{
$entry['givenname'] = $GLOBALS['phpgw']->translation->convert(
$entry['givenname'] = $GLOBALS['egw']->translation->convert(
$account_info['account_firstname'],
$GLOBALS['phpgw']->translation->charset(),
$GLOBALS['egw']->translation->charset(),
'utf-8'
);
}
if($account_info['account_email'])
{
$entry['mail'] = $GLOBALS['phpgw']->translation->convert(
$entry['mail'] = $GLOBALS['egw']->translation->convert(
$account_info['account_email'],
$GLOBALS['phpgw']->translation->charset(),
$GLOBALS['egw']->translation->charset(),
'utf-8'
);
}
$entry['uid'] = $account_info['account_lid'];
$entry['uidnumber'] = $account_id;
$entry['gidnumber'] = $account_info['account_primary_group'];
$entry['userpassword'] = $GLOBALS['phpgw']->common->encrypt_password($account_info['account_passwd']);
$entry['userpassword'] = $GLOBALS['egw']->common->encrypt_password($account_info['account_passwd']);
$entry['objectclass'][0] = 'top';
$entry['objectclass'][1] = 'person';
$entry['objectclass'][2] = 'organizationalPerson';
@ -932,9 +932,9 @@
}
}
if($account_id && is_object($GLOBALS['phpgw']->preferences) && $default_prefs)
if($account_id && is_object($GLOBALS['egw']->preferences) && $default_prefs)
{
$GLOBALS['phpgw']->preferences->create_defaults($account_id);
$GLOBALS['egw']->preferences->create_defaults($account_id);
}
return $account_id;
@ -944,15 +944,15 @@
{
if ($expiredate == 0)
{
if(isset($GLOBALS['phpgw_info']['server']['auto_create_expire']) == True)
if(isset($GLOBALS['egw_info']['server']['auto_create_expire']) == True)
{
if($GLOBALS['phpgw_info']['server']['auto_create_expire'] == 'never')
if($GLOBALS['egw_info']['server']['auto_create_expire'] == 'never')
{
$expires = -1;
}
else
{
$expiredate = time() + $GLOBALS['phpgw_info']['server']['auto_create_expire'];
$expiredate = time() + $GLOBALS['egw_info']['server']['auto_create_expire'];
}
}
}
@ -967,7 +967,7 @@
$expires = mktime(2,0,0,date('n',$expiredate), (int)date('d',$expiredate), date('Y',$expiredate));
}
$default_group_id = $this->name2id($GLOBALS['phpgw_info']['server']['default_group_lid']);
$default_group_id = $this->name2id($GLOBALS['egw_info']['server']['default_group_lid']);
if (!$default_group_id)
{
$default_group_id = (int) $this->name2id('Default');
@ -992,9 +992,9 @@
{
$acct_info['account_email'] = $GLOBALS['auto_create_acct']['email'];
}
elseif(isset($GLOBALS['phpgw_info']['server']['mail_suffix']) == True && $GLOBALS['phpgw_info']['server']['mail_suffix'] != '')
elseif(isset($GLOBALS['egw_info']['server']['mail_suffix']) == True && $GLOBALS['egw_info']['server']['mail_suffix'] != '')
{
$acct_info['account_email'] = $accountname . '@' . $GLOBALS['phpgw_info']['server']['mail_suffix'];
$acct_info['account_email'] = $accountname . '@' . $GLOBALS['egw_info']['server']['mail_suffix'];
}
$this->db->transaction_begin();
@ -1018,20 +1018,20 @@
/* if we have an mail address set it in the uesrs' email preference */
if (isset($GLOBALS['auto_create_acct']['email']) && $GLOBALS['auto_create_acct']['email'] != '')
{
$GLOBALS['phpgw']->acl->acl($accountid); /* needed als preferences::save_repository calls acl */
$GLOBALS['phpgw']->preferences->preferences($accountid);
$GLOBALS['phpgw']->preferences->read_repository();
$GLOBALS['phpgw']->preferences->add('email','address',$GLOBALS['auto_create_acct']['email']);
$GLOBALS['phpgw']->preferences->save_repository();
$GLOBALS['egw']->acl->acl($accountid); /* needed als preferences::save_repository calls acl */
$GLOBALS['egw']->preferences->preferences($accountid);
$GLOBALS['egw']->preferences->read_repository();
$GLOBALS['egw']->preferences->add('email','address',$GLOBALS['auto_create_acct']['email']);
$GLOBALS['egw']->preferences->save_repository();
}
/* use the default mail domain to set the uesrs' email preference */
elseif(isset($GLOBALS['phpgw_info']['server']['mail_suffix']) && $GLOBALS['phpgw_info']['server']['mail_suffix'] != '')
elseif(isset($GLOBALS['egw_info']['server']['mail_suffix']) && $GLOBALS['egw_info']['server']['mail_suffix'] != '')
{
$GLOBALS['phpgw']->acl->acl($accountid); /* needed als preferences::save_repository calls acl */
$GLOBALS['phpgw']->preferences->preferences($accountid);
$GLOBALS['phpgw']->preferences->read_repository();
$GLOBALS['phpgw']->preferences->add('email','address', $accountname . '@' . $GLOBALS['phpgw_info']['server']['mail_suffix']);
$GLOBALS['phpgw']->preferences->save_repository();
$GLOBALS['egw']->acl->acl($accountid); /* needed als preferences::save_repository calls acl */
$GLOBALS['egw']->preferences->preferences($accountid);
$GLOBALS['egw']->preferences->read_repository();
$GLOBALS['egw']->preferences->add('email','address', $accountname . '@' . $GLOBALS['egw_info']['server']['mail_suffix']);
$GLOBALS['egw']->preferences->save_repository();
}
/* commit the new account transaction */
@ -1044,7 +1044,7 @@
$GLOBALS['hook_values']['account_status'] = $acct_info['account_status'];
$GLOBALS['hook_values']['account_firstname'] = $acct_info['account_firstname'];
$GLOBALS['hook_values']['account_lastname'] = $acct_info['account_lastname'];
$GLOBALS['phpgw']->hooks->process($GLOBALS['hook_values']+array(
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
'location' => 'addaccount'
),False,True); // called for every app now, not only enabled ones
@ -1078,15 +1078,15 @@
if($acct_type =='g')
{
$lid = $GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
$fname = $GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
$lid = $GLOBALS['egw']->translation->convert($allValues[0]['cn'][0],'utf-8');
$fname = $GLOBALS['egw']->translation->convert($allValues[0]['cn'][0],'utf-8');
$lname = lang('Group');
}
else
{
$lid = $GLOBALS['phpgw']->translation->convert($allValues[0]['uid'][0],'utf-8');
$fname = $GLOBALS['phpgw']->translation->convert($allValues[0]['givenname'][0],'utf-8');
$lname = $GLOBALS['phpgw']->translation->convert($allValues[0]['sn'][0],'utf-8');
$lid = $GLOBALS['egw']->translation->convert($allValues[0]['uid'][0],'utf-8');
$fname = $GLOBALS['egw']->translation->convert($allValues[0]['givenname'][0],'utf-8');
$lname = $GLOBALS['egw']->translation->convert($allValues[0]['sn'][0],'utf-8');
}
return !empty($lid);
}

View File

@ -25,10 +25,11 @@
\**************************************************************************/
/* $Id$ */
/*!
@class_start accounts
@abstract Class for handling user and group accounts
*/
/**
* @class_start accounts
* Class for handling user and group accounts
*
*/
class accounts_
{
var $db;
@ -38,9 +39,7 @@
function accounts_()
{
//copyobj($GLOBALS['phpgw']->db,$this->db);
$this->db = is_object($GLOBALS['phpgw']->db) ? $GLOBALS['phpgw']->db : $GLOBALS['phpgw_setup']->db;
$this->db = clone($GLOBALS['egw']->db);
$this->table = 'phpgw_accounts';
$this->db->set_app('phpgwapi'); // to load the right table-definitions for insert, select, update, ...
}
@ -78,10 +77,10 @@
}
}
/*!
@function read_repository
@abstract grabs the records from the data store
*/
/**
* grabs the records from the data store
*
*/
function read_repository()
{
$this->db->select($this->table,'*',array('account_id'=>$this->account_id),__LINE__,__FILE__);
@ -105,10 +104,10 @@
return $this->data;
}
/*!
@function save_repository
@abstract saves the records to the data store
*/
/**
* saves the records to the data store
*
*/
function save_repository()
{
$this->db->update($this->table,array(
@ -304,7 +303,7 @@
{
$account_data = array(
'account_lid' => $account_info['account_lid'],
'account_pwd' => $GLOBALS['phpgw']->common->encrypt_password($account_info['account_passwd'],True),
'account_pwd' => $GLOBALS['egw']->common->encrypt_password($account_info['account_passwd'],True),
'account_firstname' => $account_info['account_firstname'],
'account_lastname' => $account_info['account_lastname'],
'account_status' => $account_info['account_status'],
@ -328,15 +327,15 @@
{
if ($expiredate == 0)
{
if(isset($GLOBALS['phpgw_info']['server']['auto_create_expire']) == True)
if(isset($GLOBALS['egw_info']['server']['auto_create_expire']) == True)
{
if($GLOBALS['phpgw_info']['server']['auto_create_expire'] == 'never')
if($GLOBALS['egw_info']['server']['auto_create_expire'] == 'never')
{
$expires = -1;
}
else
{
$expiredate = time() + $GLOBALS['phpgw_info']['server']['auto_create_expire'];
$expiredate = time() + $GLOBALS['egw_info']['server']['auto_create_expire'];
}
}
}
@ -351,7 +350,7 @@
$expires = mktime(2,0,0,date('n',$expiredate), (int)date('d',$expiredate), date('Y',$expiredate));
}
$default_group_id = $this->name2id($GLOBALS['phpgw_info']['server']['default_group_lid']);
$default_group_id = $this->name2id($GLOBALS['egw_info']['server']['default_group_lid']);
if (!$default_group_id)
{
$default_group_id = (int) $this->name2id('Default');
@ -377,9 +376,9 @@
{
$acct_info['account_email'] = $GLOBALS['auto_create_acct']['email'];
}
elseif(isset($GLOBALS['phpgw_info']['server']['mail_suffix']) == True && $GLOBALS['phpgw_info']['server']['mail_suffix'] != '')
elseif(isset($GLOBALS['egw_info']['server']['mail_suffix']) == True && $GLOBALS['egw_info']['server']['mail_suffix'] != '')
{
$acct_info['account_email'] = $accountname . '@' . $GLOBALS['phpgw_info']['server']['mail_suffix'];
$acct_info['account_email'] = $accountname . '@' . $GLOBALS['egw_info']['server']['mail_suffix'];
}
$this->db->transaction_begin();
@ -400,20 +399,20 @@
/* if we have an mail address set it in the uesrs' email preference */
if (isset($GLOBALS['auto_create_acct']['email']) && $GLOBALS['auto_create_acct']['email'] != '')
{
$GLOBALS['phpgw']->acl->acl($accountid); /* needed als preferences::save_repository calls acl */
$GLOBALS['phpgw']->preferences->preferences($accountid);
$GLOBALS['phpgw']->preferences->read_repository();
$GLOBALS['phpgw']->preferences->add('email','address',$GLOBALS['auto_create_acct']['email']);
$GLOBALS['phpgw']->preferences->save_repository();
$GLOBALS['egw']->acl->acl($accountid); /* needed als preferences::save_repository calls acl */
$GLOBALS['egw']->preferences->preferences($accountid);
$GLOBALS['egw']->preferences->read_repository();
$GLOBALS['egw']->preferences->add('email','address',$GLOBALS['auto_create_acct']['email']);
$GLOBALS['egw']->preferences->save_repository();
}
/* use the default mail domain to set the uesrs' email preference */
elseif(isset($GLOBALS['phpgw_info']['server']['mail_suffix']) && $GLOBALS['phpgw_info']['server']['mail_suffix'] != '')
elseif(isset($GLOBALS['egw_info']['server']['mail_suffix']) && $GLOBALS['egw_info']['server']['mail_suffix'] != '')
{
$GLOBALS['phpgw']->acl->acl($accountid); /* needed als preferences::save_repository calls acl */
$GLOBALS['phpgw']->preferences->preferences($accountid);
$GLOBALS['phpgw']->preferences->read_repository();
$GLOBALS['phpgw']->preferences->add('email','address', $accountname . '@' . $GLOBALS['phpgw_info']['server']['mail_suffix']);
$GLOBALS['phpgw']->preferences->save_repository();
$GLOBALS['egw']->acl->acl($accountid); /* needed als preferences::save_repository calls acl */
$GLOBALS['egw']->preferences->preferences($accountid);
$GLOBALS['egw']->preferences->read_repository();
$GLOBALS['egw']->preferences->add('email','address', $accountname . '@' . $GLOBALS['egw_info']['server']['mail_suffix']);
$GLOBALS['egw']->preferences->save_repository();
}
/* commit the new account transaction */
@ -426,7 +425,7 @@
$GLOBALS['hook_values']['account_status'] = $acct_info['account_status'];
$GLOBALS['hook_values']['account_firstname'] = $acct_info['account_firstname'];
$GLOBALS['hook_values']['account_lastname'] = $acct_info['account_lastname'];
$GLOBALS['phpgw']->hooks->process($GLOBALS['hook_values']+array(
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
'location' => 'addaccount'
),False,True); /* called for every app now, not only enabled ones */
@ -458,6 +457,6 @@
return True;
}
}
/*!
@class_end accounts
*/
/**
* @class_end accounts
*/

View File

@ -376,7 +376,7 @@
}
else
{
$new_root = str_replace($GLOBALS['phpgw_info']['server']['template_set'],'default',$root);
$new_root = str_replace($GLOBALS['egw_info']['server']['template_set'],'default',$root);
$new_filename = $this->filename(str_replace($root.'/','',$new_filename),$new_root,2);
}
}

View File

@ -35,8 +35,8 @@
function setup($html=False, $translation=False)
{
$this->detection = CreateObject('setup.setup_detection');
$this->process = CreateObject('setup.setup_process');
$this->detection =& CreateObject('setup.setup_detection');
$this->process =& CreateObject('setup.setup_process');
/* The setup application needs these */
$this->html = $html ? CreateObject('setup.setup_html') : '';
@ -47,10 +47,9 @@
$this->tbl_hooks = $this->get_hooks_table_name();
}
/*!
@function loaddb
@abstract include api db class for the ConfigDomain and connect to the db
*/
/**
* include api db class for the ConfigDomain and connect to the db
*/
function loaddb($connect_and_setcharset=true)
{
if(!isset($this->ConfigDomain) || empty($this->ConfigDomain))
@ -64,7 +63,7 @@
{
$GLOBALS['egw_info']['server']['db_persistent'] = False;
}
$this->db = CreateObject('phpgwapi.db');
$this->db =& CreateObject('phpgwapi.db');
$this->db->Host = $GLOBALS['egw_domain'][$this->ConfigDomain]['db_host'];
$this->db->Port = $GLOBALS['egw_domain'][$this->ConfigDomain]['db_port'];
$this->db->Type = $GLOBALS['egw_domain'][$this->ConfigDomain]['db_type'];
@ -125,11 +124,11 @@
setcookie($cookiename,$cookievalue,$cookietime,'/',$this->cookie_domain);
}
/*!
@function auth
@abstract authenticate the setup user
@param $auth_type ???
*/
/**
* authenticate the setup user
*
* @param $auth_type ???
*/
function auth($auth_type='Config')
{
#phpinfo();
@ -335,11 +334,11 @@
return False;
}
/*!
@function get_major
@abstract Return X.X.X major version from X.X.X.X versionstring
@param $
*/
/**
* Return X.X.X major version from X.X.X.X versionstring
*
* @param $
*/
function get_major($versionstring)
{
if(!$versionstring)
@ -354,11 +353,9 @@
return $major;
}
/*!
@function clear_session_cache
@abstract Clear system/user level cache so as to have it rebuilt with the next access
@param None
*/
/**
* Clear system/user level cache so as to have it rebuilt with the next access
*/
function clear_session_cache()
{
$tables = Array();
@ -376,12 +373,12 @@
}
}
/*!
@function register_app
@abstract Add an application to the phpgw_applications table
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
@param $enable optional, set to True/False to override setup.inc.php setting
*/
/**
* Add an application to the phpgw_applications table
*
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
* @param $enable * optional, set to True/False to override setup.inc.php setting
*/
function register_app($appname,$enable=99)
{
$setup_info = $GLOBALS['setup_info'];
@ -442,12 +439,12 @@
}
}
/*!
@function app_registered
@abstract Check if an application has info in the db
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
@param $enabled optional, set to False to not enable this app
*/
/**
* Check if an application has info in the db
*
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
* @param $enabled optional, set to False to not enable this app
*/
function app_registered($appname)
{
$setup_info = $GLOBALS['setup_info'];
@ -485,12 +482,12 @@
return False;
}
/*!
@function update_app
@abstract Update application info in the db
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
@param $enabled optional, set to False to not enable this app
*/
/**
* Update application info in the db
*
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
* @param $enabled optional, set to False to not enable this app
*/
function update_app($appname)
{
$setup_info = $GLOBALS['setup_info'];
@ -532,13 +529,13 @@
}
}
/*!
@function update_app_version
@abstract Update application version in applications table, post upgrade
@param $setup_info Array of application information (multiple apps or single)
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
@param $tableschanged ???
*/
/**
* Update application version in applications table, post upgrade
*
* @param $setup_info * Array of application information (multiple apps or single)
* @param $appname * Application 'name' with a matching $setup_info[$appname] array slice
* @param $tableschanged ???
*/
function update_app_version($setup_info, $appname, $tableschanged = True)
{
if(!$appname)
@ -564,11 +561,11 @@
return $setup_info;
}
/*!
@function deregister_app
@abstract de-Register an application
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
/**
* de-Register an application
*
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
function deregister_app($appname)
{
if(!$appname)
@ -587,11 +584,11 @@
$this->clear_session_cache();
}
/*!
@function register_hooks
@abstract Register an application's hooks
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
/**
* Register an application's hooks
*
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
function register_hooks($appname)
{
$setup_info = $GLOBALS['setup_info'];
@ -609,26 +606,26 @@
if (!is_object($this->hooks))
{
$this->hooks = CreateObject('phpgwapi.hooks',$this->db);
$this->hooks =& CreateObject('phpgwapi.hooks',$this->db);
}
$this->hooks->register_hooks($appname,$setup_info[$appname]['hooks']);
}
/*!
@function update_hooks
@abstract Update an application's hooks
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
/**
* Update an application's hooks
*
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
function update_hooks($appname)
{
$this->register_hooks($appname);
}
/*!
@function deregister_hooks
@abstract de-Register an application's hooks
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
/**
* de-Register an application's hooks
*
* @param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
function deregister_hooks($appname)
{
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5'))
@ -645,33 +642,32 @@
//echo "DELETING hooks for: " . $setup_info[$appname]['name'];
if (!is_object($this->hooks))
{
$this->hooks = CreateObject('phpgwapi.hooks',$this->db);
$this->hooks =& CreateObject('phpgwapi.hooks',$this->db);
}
$this->hooks->register_hooks($appname);
}
/*!
@function hook
@abstract call the hooks for a single application
@param $location hook location - required
@param $appname application name - optional
*/
/**
* call the hooks for a single application
*
* @param $location hook location - required
* @param $appname application name - optional
*/
function hook($location, $appname='')
{
if (!is_object($this->hooks))
{
$this->hooks = CreateObject('phpgwapi.hooks',$this->db);
$this->hooks =& CreateObject('phpgwapi.hooks',$this->db);
}
return $this->hooks->single($location,$appname,True,True);
}
/*
@function alessthanb
@abstract phpgw version checking, is param 1 < param 2 in phpgw versionspeak?
@param $a phpgw version number to check if less than $b
@param $b phpgw version number to check $a against
#return True if $a < $b
*/
/**
* egw version checking, is param 1 < param 2 in phpgw versionspeak?
* @param $a phpgw version number to check if less than $b
* @param $b phpgw version number to check $a against
* @return True if $a < $b
*/
function alessthanb($a,$b,$DEBUG=False)
{
$num = array('1st','2nd','3rd','4th');
@ -752,13 +748,13 @@
}
}
/*!
@function amorethanb
@abstract phpgw version checking, is param 1 > param 2 in phpgw versionspeak?
@param $a phpgw version number to check if more than $b
@param $b phpgw version number to check $a against
#return True if $a < $b
*/
/**
* egw version checking, is param 1 > param 2 in phpgw versionspeak?
*
* @param $a phpgw version number to check if more than $b
* @param $b phpgw version number to check $a against
* @return True if $a < $b
*/
function amorethanb($a,$b,$DEBUG=False)
{
$num = array('1st','2nd','3rd','4th');
@ -861,11 +857,12 @@
}
if (!is_object($GLOBALS['egw']))
{
$GLOBALS['egw'] = CreateObject('phpgwapi.phpgw');
$GLOBALS['egw'] =& CreateObject('phpgwapi.egw');
$GLOBALS['phpgw'] =& $GLOBALS['egw'];
}
copyobj($this->db,$GLOBALS['egw']->db);
$GLOBALS['egw']->common = CreateObject('phpgwapi.common');
$GLOBALS['egw']->accounts = CreateObject('phpgwapi.accounts');
$GLOBALS['egw']->db = clone($this->db);
$GLOBALS['egw']->common =& CreateObject('phpgwapi.common');
$GLOBALS['egw']->accounts =& CreateObject('phpgwapi.accounts');
if(($GLOBALS['egw_info']['server']['account_repository'] == 'ldap') &&
!$GLOBALS['egw']->accounts->ds)
@ -876,17 +873,18 @@
}
}
/*!
@function add_account
@abstract add an user account or a user group
@param username string alphanumerical username or groupname (account_lid)
@param first, last string first / last name
@param $passwd string cleartext pw
@param $group string/boolean Groupname for users primary group or False for a group, default 'Default'
@param $changepw boolean user has right to change pw, default False
@returns the numerical user-id
@note if the $username already exists, only the id is returned, no new user / group gets created
*/
/**
* add an user account or a user group
*
* if the $username already exists, only the id is returned, no new user / group gets created
*
* @param username string alphanumerical username or groupname (account_lid)
* @param first, last string first / last name
* @param $passwd string cleartext pw
* @param $group string/boolean Groupname for users primary group or False for a group, default 'Default'
* @param $changepw boolean user has right to change pw, default False
* @return the numerical user-id
*/
function add_account($username,$first,$last,$passwd,$group='default',$changepw=False)
{
$this->setup_account_object();
@ -916,14 +914,14 @@
return $accountid;
}
/*!
@function add_acl
@abstract Add ACL rights
@param $app string/array with app-names
@param $locations string eg. run
@param $account int/string accountid or account_lid
@param $rights int rights to set, default 1
*/
/**
* Add ACL rights
*
* @param $app string/array with app-names
* @param $locations string eg. run
* @param $account int/string accountid or account_lid
* @param $rights int rights to set, default 1
*/
function add_acl($apps,$location,$account,$rights=1)
{
if (!is_int($account))

View File

@ -16,10 +16,10 @@
class setup_html
{
/*!
@function generate_header
@abstract generate header.inc.php file output - NOT a generic html header function
*/
/**
* generate header.inc.php file output - NOT a generic html header function
*
*/
function generate_header()
{
// PHP will automatically replace any dots in incoming

View File

@ -35,27 +35,27 @@
function setup_process()
{
$this->translation = CreateObject('setup.setup_translation');
$this->translation =& CreateObject('setup.setup_translation');
}
/*!
@function init_process
@abstract create schema_proc object
@param none
*/
/**
* create schema_proc object
*
* @param none
*/
function init_process()
{
$GLOBALS['egw_setup']->oProc = CreateObject('phpgwapi.schema_proc');
$GLOBALS['egw_setup']->oProc =& CreateObject('phpgwapi.schema_proc');
}
/*!
@function pass
@abstract the mother of all multipass upgrade parental loop functions
@param $setup_info array of application info from setup.inc.php files
@param $type optional, defaults to new(install), could also be 'upgrade'
@param $DEBUG optional, print debugging info
@param $force_en optional, install english language files
*/
/**
* the mother of all multipass upgrade parental loop functions
*
* @param $setup_info array of application info from setup.inc.php files
* @param $type optional, defaults to new(install), could also be 'upgrade'
* @param $DEBUG optional, print debugging info
* @param $force_en optional, install english language files
*/
function pass($setup_info,$method='new',$DEBUG=False,$force_en=False,$system_charset=false)
{
if(!$method)
@ -186,10 +186,10 @@
return $setup_info = array_merge($setup_info,$passed);
}
/*!
@function save_minimal_config
@abstract saves a minimal default config, so you get a running install without entering and saveing Step #2 config
*/
/**
* saves a minimal default config, so you get a running install without entering and saveing Step #2 config
*
*/
function save_minimal_config($system_charset)
{
$GLOBALS['current_config']['site_title'] = 'eGroupWare';
@ -215,7 +215,7 @@
array_pop($parts); // remove setup
$GLOBALS['current_config']['webserver_url'] = implode('/',$parts);
$datetime = CreateObject('phpgwapi.datetime');
$datetime =& CreateObject('phpgwapi.datetime');
$GLOBALS['current_config']['tz_offset'] = $datetime->getbestguess();
unset($datetime);
@ -240,11 +240,11 @@
}
}
/*!
@function droptables
@abstract drop tables per application, check that they are in the db first
@param $setup_info array of application info from setup.inc.php files, etc.
*/
/**
* drop tables per application, check that they are in the db first
*
* @param $setup_info array of application info from setup.inc.php files, etc.
*/
function droptables($setup_info,$DEBUG=False)
{
if(!@$GLOBALS['egw_setup']->oProc)
@ -289,12 +289,12 @@
return $setup_info;
}
/*!
@function current
@abstract process current table setup in each application/setup dir
@param $appinfo array of application info from setup.inc.php files, etc.
@discussion This duplicates the old newtables behavior, using schema_proc
*/
/**
* process current table setup in each application/setup dir
*
* @param $appinfo array of application info from setup.inc.php files, etc.
* This duplicates the old newtables behavior, using schema_proc
*/
function current($setup_info,$DEBUG=False)
{
if(!@$GLOBALS['egw_setup']->oProc)
@ -310,7 +310,7 @@
if($DEBUG) { echo '<br>process->current(): Incoming status: ' . $appname . ',status: '. $setup_info[$key]['status']; }
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
$appdir = EGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if($setup_info[$key]['tables'] && file_exists($appdir.'tables_current.inc.php'))
{
@ -370,11 +370,11 @@
return ($setup_info);
}
/*!
@function default_records
@abstract process default_records.inc.php in each application/setup dir
@param $setup_info array of application info from setup.inc.php files, etc.
*/
/**
* process default_records.inc.php in each application/setup dir
*
* @param $setup_info array of application info from setup.inc.php files, etc.
*/
function default_records($setup_info,$DEBUG=False)
{
if(!@$GLOBALS['egw_setup']->oProc)
@ -385,7 +385,7 @@
while(list($key,$null) = @each($setup_info))
{
$appname = $setup_info[$key]['name'];
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
$appdir = EGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if($setup_info[$key]['tables'] && file_exists($appdir.'default_records.inc.php'))
{
@ -405,12 +405,12 @@
return ($setup_info);
}
/*!
@function test_data
@abstract process test_data.inc.php in each application/setup dir for developer tests
This data should work with the baseline tables
@param $setup_info array of application info from setup.inc.php files, etc.
*/
/**
* process test_data.inc.php in each application/setup dir for developer tests
*
* This data should work with the baseline tables
* @param $setup_info array of application info from setup.inc.php files, etc.
*/
function test_data($setup_info,$DEBUG=False)
{
if(!@$GLOBALS['egw_setup']->oProc)
@ -421,7 +421,7 @@
while(list($key,$null) = @each($setup_info))
{
$appname = $setup_info[$key]['name'];
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
$appdir = EGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if(file_exists($appdir.'test_data.inc.php'))
{
@ -439,11 +439,11 @@
return ($setup_info);
}
/*!
@function baseline
@abstract process baseline table setup in each application/setup dir
@param $appinfo array of application info from setup.inc.php files, etc.
*/
/**
* process baseline table setup in each application/setup dir
*
* @param $appinfo array of application info from setup.inc.php files, etc.
*/
function baseline($setup_info,$DEBUG=False)
{
if(!@$GLOBALS['egw_setup']->oProc)
@ -455,7 +455,7 @@
while(list($key,$null) = @each($setup_info))
{
$appname = $setup_info[$key]['name'];
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
$appdir = EGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if(file_exists($appdir.'tables_baseline.inc.php'))
{
@ -484,11 +484,11 @@
return ($setup_info);
}
/*!
@function upgrade
@abstract process available upgrades in each application/setup dir
@param $appinfo array of application info from setup.inc.php files, etc.
*/
/**
* process available upgrades in each application/setup dir
*
* @param $appinfo array of application info from setup.inc.php files, etc.
*/
function upgrade($setup_info,$DEBUG=False)
{
if(!@$GLOBALS['egw_setup']->oProc)
@ -520,7 +520,7 @@
{
$currentver = $appdata['currentver'];
$targetver = $appdata['version']; // The version we need to match when done
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
$appdir = EGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if(file_exists($appdir . 'tables_update.inc.php') && !@$this->updateincluded[$appname])
{
@ -613,10 +613,10 @@
return ($setup_info);
}
/*!
@function post_process
@abstract commit above processing to the db
*/
/**
* commit above processing to the db
*
*/
function post_process($tables,$DEBUG=False)
{
if(!$tables)
@ -643,11 +643,11 @@
}
}
/*!
@function sql_to_array
@abstract send this a table name, returns printable column spec and keys for the table from schema_proc
@param $tablename table whose array you want to see
*/
/**
* send this a table name, returns printable column spec and keys for the table from schema_proc
*
* @param $tablename table whose array you want to see
*/
function sql_to_array($tablename='')
{
if(!$tablename)

View File

@ -32,11 +32,11 @@
{
var $langarray = array();
/*!
@function setup_lang
@abstract constructor for the class, loads all phrases into langarray
@param $lang user lang variable (defaults to en)
*/
/**
* constructor for the class, loads all phrases into langarray
*
* @param $lang user lang variable (defaults to en)
*/
function setup_translation()
{
$ConfigLang = get_var('ConfigLang',Array('POST','COOKIE'));
@ -68,12 +68,12 @@
}
}
/*!
@function translate
@abstract Translate phrase to user selected lang
@param $key phrase to translate
@param $vars vars sent to lang function, passed to us
*/
/**
* Translate phrase to user selected lang
*
* @param $key phrase to translate
* @param $vars vars sent to lang function, passed to us
*/
function translate($key, $vars=False)
{
$ret = $key.'*';
@ -99,7 +99,7 @@
if (!is_object($this->sql))
{
include_once(EGW_API_INC.'/class.translation_sql.inc.php');
$this->sql = new translation;
$this->sql =& new translation;
}
}
@ -173,7 +173,7 @@
{
return $charsets;
}
$html = CreateObject('phpgwapi.html');
$html =& CreateObject('phpgwapi.html');
return $html->select($name,trim(strtolower($selected)),$charsets,true);
}

View File

@ -19,7 +19,7 @@
error_reporting(error_reporting() & ~E_NOTICE);
// for an old header, we need to setup the reference before including it
if (!is_array($GLOBALS['phpgw_info'])) $GLOBALS['phpgw_info'] =& $GLOBALS['egw_info'];
if (!is_array($GLOBALS['egw_info'])) $GLOBALS['egw_info'] =& $GLOBALS['egw_info'];
if(file_exists('../header.inc.php'))
{
@ -48,10 +48,10 @@
define('SEP',filesystem_separator());
/*!
@function lang
@abstract function to handle multilanguage support
*/
/**
* function to handle multilanguage support
*
*/
function lang($key,$m1='',$m2='',$m3='',$m4='',$m5='',$m6='',$m7='',$m8='',$m9='',$m10='')
{
if(is_array($m1))
@ -66,11 +66,9 @@
return $value;
}
/*!
@function get_langs
@abstract returns array of languages we support, with enabled set
to True if the lang file exists
*/
/**
* returns array of languages we support, with enabled set to True if the lang file exists
*/
function get_langs()
{
$f = fopen('./lang/languages','rb');
@ -137,5 +135,5 @@
$GLOBALS['egw_info']['server']['app_images'] = 'templates/default/images';
$GLOBALS['egw_setup'] = CreateObject('setup.setup',True,True);
$GLOBALS['egw_setup'] =& CreateObject('setup.setup',True,True);
$GLOBALS['phpgw_setup'] =& $GLOBALS['egw_setup'];

View File

@ -16,11 +16,11 @@
Set a global flag to indicate this file was found by setup/config.php.
config.php will unset it after parsing the form values.
*/
$GLOBALS['phpgw_info']['server']['found_validation_hook'] = True;
$GLOBALS['egw_info']['server']['found_validation_hook'] = True;
function in_docroot($path='')
{
$docroots = array(PHPGW_SERVER_ROOT,$_SERVER['DOCUMENT_ROOT']);
$docroots = array(EGW_SERVER_ROOT,$_SERVER['DOCUMENT_ROOT']);
foreach($docroots as $docroot)
{

View File

@ -147,8 +147,20 @@
foreach ($defaultprefs as $app => $prefs)
{
$prefs = $GLOBALS['egw_setup']->db->db_addslashes(serialize($prefs));
$GLOBALS['egw_setup']->db->query("INSERT INTO phpgw_preferences(preference_owner,preference_app,preference_value) VALUES($accountid,'$app','$prefs')",__FILE__,__LINE__);
// only insert them, if they not already exist
$GLOBALS['egw_setup']->db->select('phpgw_preferences','*',array(
'preference_owner' => $accountid,
'preference_app' => $app,
),__LINE__,__FILE__);
if (!$GLOBALS['egw_setup']->db->next_record())
{
$GLOBALS['egw_setup']->db->insert('phpgw_preferences',array(
'preference_value' => serialize($prefs)
),array(
'preference_owner' => $accountid,
'preference_app' => $app,
),__LINE__,__FILE__);
}
}
}
insert_default_prefs(-2); // set some default prefs