source: subversion/branches/devel-vnext/program/steps/addressbook/delete.inc @ 631

Last change on this file since 631 was 631, checked in by till, 6 years ago

+ addressbook plugin

File size: 1.9 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/addressbook/delete.inc                                  |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
11 | PURPOSE:                                                              |
12 |   Delete the submitted contacts (CIDs) from the users address book    |
13 |                                                                       |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16 +-----------------------------------------------------------------------+
17
18 $Id: delete.inc 573 2007-05-18 11:29:25Z thomasb $
19
20*/
21$registry = rc_registry::getInstance();
22$CONTACTS = $registry->get('CONTACTS', 'core');
23$OUTPUT   = $registry->get('OUTPUT', 'core');
24
25if (($cid = get_input_value('_cid', RCUBE_INPUT_POST)) && preg_match('/^[0-9]+(,[0-9]+)*$/', $cid)) {
26    $deleted = $CONTACTS->delete($cid);
27    if (!$deleted) {
28        // send error message
29        exit;
30    }
31
32    // count contacts for this user
33    $result = $CONTACTS->count();
34
35    // update message count display
36    $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size));
37    $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count));
38
39    // add new rows from next page (if any)
40    $pages = ceil(($result->count + $deleted) / $CONTACTS->page_size);
41    if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages) {
42        rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted));
43    }
44    // send response
45    $OUTPUT->send();
46}
47exit;
48?>
Note: See TracBrowser for help on using the repository browser.