4 +-----------------------------------------------------------------------+
5 | program/steps/addressbook/delete.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Delete the submitted contacts (CIDs) from the users address book |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: delete.inc 2758 2009-07-16 15:01:05Z thomasb $
22 if ($OUTPUT->ajax_call &&
23 ($cid = get_input_value('_cid', RCUBE_INPUT_POST)) &&
24 (preg_match('/^[0-9]+(,[0-9]+)*$/', $cid) ||
25 preg_match('/^[a-zA-Z0-9=]+(,[a-zA-Z0-9=]+)*$/', $cid))
28 $plugin = $RCMAIL->plugins->exec_hook('delete_contact', array('id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
30 $deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : false;
37 // count contacts for this user
38 $result = $CONTACTS->count();
40 // update message count display
41 $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size));
42 $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count));
44 // add new rows from next page (if any)
45 $pages = ceil(($result->count + $deleted) / $CONTACTS->page_size);
46 if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages)
47 rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted));