require "../../Group-Office.php"; $GO_SECURITY->authenticate(); $GO_MODULES->authenticate('addressbook'); require $GO_LANGUAGE->get_language_file('addressbook'); $link_back = isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '' ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI']; $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : ''; $return_to = isset($_REQUEST['return_to']) && $_REQUEST['return_to'] != '' ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER']; //load contact management class require $GO_MODULES->class_path . "addressbook.class.inc"; $ab = new addressbook(); switch ($task) { case 'delete_addressbook': $delete_ab = $ab->get_addressbook($_POST['delete_addressbook_id']); if ($GO_SECURITY->user_id == $delete_ab['user_id']) { $default_id = $ab->get_default_addressbook($GO_SECURITY->user_id); if ($ab->delete_addressbook($_POST['delete_addressbook_id'])) { $GO_SECURITY->delete_acl($delete_ab['acl_write']); $GO_SECURITY->delete_acl($delete_ab['acl_read']); } $ab->get_subscribed_addressbooks($GO_SECURITY->user_id); if ($ab->next_record()) { $next_id = $ab->f('id'); if ($_POST['delete_addressbook_id'] == $default_id) { $ab->set_default_addressbook($GO_SECURITY->user_id, $next_id); } if ($_POST['addressbook_id'] = $_POST['delete_addressbook_id']) { $_POST['addressbook_id'] = $next_id; } } else { unset($addressbook_id); }