From 1085534c94ef094539cdc05c3e06afb1eadb9caa Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Tue, 20 Sep 2005 10:11:38 +0000 Subject: [PATCH] modified the delete hooks to use $GLOBALS['hook_values'] --- addressbook/inc/hook_deleteaccount.inc.php | 19 +++++++++------- admin/inc/hook_deleteaccount.inc.php | 8 +++---- calendar/inc/hook_deleteaccount.inc.php | 25 ++++++++++++---------- infolog/inc/hook_deleteaccount.inc.php | 9 +++++--- preferences/inc/hook_deleteaccount.inc.php | 13 ++++++----- 5 files changed, 43 insertions(+), 31 deletions(-) diff --git a/addressbook/inc/hook_deleteaccount.inc.php b/addressbook/inc/hook_deleteaccount.inc.php index 2f2deaf643..1ffbf90812 100644 --- a/addressbook/inc/hook_deleteaccount.inc.php +++ b/addressbook/inc/hook_deleteaccount.inc.php @@ -12,14 +12,17 @@ /* $Id$ */ - $contacts = CreateObject('phpgwapi.contacts'); + if((int)$GLOBALS['hook_values']['account_id'] > 0) + { + $contacts = CreateObject('phpgwapi.contacts'); - if((int)$_POST['new_owner'] == 0) - { - $contacts->delete_all((int)$_POST['account_id']); - } - else - { - $contacts->change_owner((int)$_POST['account_id'],(int)$_POST['new_owner']); + if((int)$_POST['new_owner'] == 0) + { + $contacts->delete_all((int)$GLOBALS['hook_values']['account_id']); + } + else + { + $contacts->change_owner((int)$GLOBALS['hook_values']['account_id'],(int)$_POST['new_owner']); + } } ?> diff --git a/admin/inc/hook_deleteaccount.inc.php b/admin/inc/hook_deleteaccount.inc.php index 463d08cf5a..f3e5e9eeb6 100755 --- a/admin/inc/hook_deleteaccount.inc.php +++ b/admin/inc/hook_deleteaccount.inc.php @@ -12,12 +12,12 @@ /* $Id$ */ - if($_POST['account_id']) + if((int)$GLOBALS['hook_values']['account_id'] > 0) { - $GLOBALS['phpgw']->accounts->delete($_POST['account_id']); + $GLOBALS['phpgw']->accounts->delete((int)$GLOBALS['hook_values']['account_id']); $GLOBALS['phpgw']->db->lock(Array('phpgw_acl')); - $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_acl WHERE acl_location='" . $_POST['account_id'] - . "' OR acl_account=".$_POST['account_id'],__LINE__,__FILE__); + $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_acl WHERE acl_location='" . (int)$GLOBALS['hook_values']['account_id'] + . "' OR acl_account=".(int)$GLOBALS['hook_values']['account_id'],__LINE__,__FILE__); $GLOBALS['phpgw']->db->unlock(); } ?> diff --git a/calendar/inc/hook_deleteaccount.inc.php b/calendar/inc/hook_deleteaccount.inc.php index 2d6ab5d56c..b656f81af8 100755 --- a/calendar/inc/hook_deleteaccount.inc.php +++ b/calendar/inc/hook_deleteaccount.inc.php @@ -12,17 +12,20 @@ /* $Id$ */ // Delete all records for a user - if((int)$_POST['new_owner'] == 0) + if((int)$GLOBALS['hook_values']['account_id'] > 0) { - ExecMethod('calendar.bocalendar.delete_calendar',(int)$_POST['account_id']); - } - else - { - ExecMethod('calendar.bocalendar.change_owner', - Array( - 'old_owner' => (int)$_POST['account_id'], - 'new_owner' => (int)$_POST['new_owner'] - ) - ); + if((int)$_POST['new_owner'] == 0) + { + ExecMethod('calendar.bocalendar.delete_calendar',(int)$GLOBALS['hook_values']['account_id']); + } + else + { + ExecMethod('calendar.bocalendar.change_owner', + Array( + 'old_owner' => (int)$GLOBALS['hook_values']['account_id'], + 'new_owner' => (int)$_POST['new_owner'] + ) + ); + } } ?> diff --git a/infolog/inc/hook_deleteaccount.inc.php b/infolog/inc/hook_deleteaccount.inc.php index 61c9d386fb..5901ac32d1 100644 --- a/infolog/inc/hook_deleteaccount.inc.php +++ b/infolog/inc/hook_deleteaccount.inc.php @@ -11,10 +11,13 @@ /* $Id$ */ // Delete all records for a user - $info =& CreateObject('infolog.soinfolog'); + if((int)$GLOBALS['hook_values']['account_id'] > 0) + { + $info =& CreateObject('infolog.soinfolog'); - $info->change_delete_owner(intval($_POST['account_id']), + $info->change_delete_owner((int)$GLOBALS['hook_values']['account_id']), intval($_POST['new_owner'])); - unset($info); + unset($info); + } ?> diff --git a/preferences/inc/hook_deleteaccount.inc.php b/preferences/inc/hook_deleteaccount.inc.php index 74dff14d16..c00d413245 100755 --- a/preferences/inc/hook_deleteaccount.inc.php +++ b/preferences/inc/hook_deleteaccount.inc.php @@ -13,9 +13,12 @@ /* $Id$ */ // Delete all records for a user - $table_locks = Array('phpgw_preferences'); - - $GLOBALS['egw']->db->lock($table_locks); - $GLOBALS['egw']->db->query('DELETE FROM phpgw_preferences WHERE preference_owner='.(int)$_POST['account_id'],__LINE__,__FILE__); - $GLOBALS['egw']->db->unlock(); + 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(); + } ?>