fix for bug [ 1361782 ] missing sql tables: hook code accessing the prefs-table is moved to the prefs class

This commit is contained in:
Ralf Becker 2005-11-20 07:32:51 +00:00
parent fb3c622ddf
commit 1549913fd7
2 changed files with 14 additions and 12 deletions

View File

@ -423,7 +423,7 @@
}
$pref = &$this->$type;
if ($all = (is_string($var) && $var == ''))
if (($all = (is_string($var) && $var == '')))
{
unset($pref[$app_name]);
unset($this->data[$app_name]);
@ -459,6 +459,16 @@
reset ($this->data);
return $this->data;
}
/**
* delete all prefs of a given user
*
* @param int $accountid
*/
function delete_user($accountid)
{
$this->delete($this->table,array('preference_owner' => $accountid),__LINE__,__FILE__);
}
/**
* add complex array data preference to $app_name a particular app
@ -804,7 +814,7 @@
return $this->data['email']['address'];
}
// if email-address is set in the account, return it
if ($email = $GLOBALS['egw']->accounts->id2name($account_id,'account_email'))
if (($email = $GLOBALS['egw']->accounts->id2name($account_id,'account_email')))
{
return $email;
}
@ -873,9 +883,6 @@
// at location [email][ex_accounts][X][...pref names] => pref values
// make this look like "prefs[email] so the code below code below will do its job transparently
// store original prefs
$orig_prefs = array();
$orig_prefs = $prefs;
// obtain the desired sub-array of extra account prefs
$sub_prefs = array();
$sub_prefs['email'] = $prefs['email']['ex_accounts'][$acctnum];

View File

@ -12,13 +12,8 @@
/* $Id$ */
// Delete all records for a user
// Delete all prefs of a user
if((int)$GLOBALS['hook_values']['account_id'] > 0)
{
$table_locks = Array('phpgw_preferences');
$GLOBALS['egw']->db->lock($table_locks);
$GLOBALS['egw']->db->query('DELETE FROM phpgw_preferences WHERE preference_owner='.(int)$GLOBALS['hook_values']['account_id'],__LINE__,__FILE__);
$GLOBALS['egw']->db->unlock();
$GLOBALS['egw']->preferences->delete_user($GLOBALS['hook_values']['account_id']);
}
?>