You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
roundcubemail/program/steps/addressbook/delete.inc

53 lines
2.0 KiB
PHTML

19 years ago
<?php
/*
+-----------------------------------------------------------------------+
| program/steps/addressbook/delete.inc |
| |
| This file is part of the RoundCube Webmail client |
| Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
19 years ago
| |
| PURPOSE: |
| Delete the submitted contacts (CIDs) from the users address book |
| |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
$Id$
*/
if ($OUTPUT->ajax_call &&
($cid = get_input_value('_cid', RCUBE_INPUT_POST)) &&
preg_match('/^[a-zA-Z0-9\+\/=_-]+(,[a-zA-Z0-9\+\/=_-]+)*$/', $cid)
) {
$plugin = $RCMAIL->plugins->exec_hook('delete_contact', array('id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
$deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : false;
if (!$deleted)
19 years ago
{
// send error message
exit;
}
// count contacts for this user
$result = $CONTACTS->count();
19 years ago
// update message count display
$OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size));
$OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count));
19 years ago
// add new rows from next page (if any)
$pages = ceil(($result->count + $deleted) / $CONTACTS->page_size);
if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages)
rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted));
19 years ago
// send response
$OUTPUT->send();
19 years ago
}
exit;
?>