David Carter
2013-05-29 52deb18d9646116114f9649c87ffc4f0bc378db1
commit | author | age
4e17e6 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/settings/delete_identity.inc                            |
6  |                                                                       |
e019f2 7  | This file is part of the Roundcube Webmail client                     |
f5e7b3 8  | Copyright (C) 2005-2009, The Roundcube Dev Team                       |
7fe381 9  |                                                                       |
T 10  | Licensed under the GNU General Public License version 3 or            |
11  | any later version with exceptions for skins & plugins.                |
12  | See the README file for a full license statement.                     |
4e17e6 13  |                                                                       |
T 14  | PURPOSE:                                                              |
15  |   Delete the submitted identities (IIDs) from the database            |
16  |                                                                       |
17  +-----------------------------------------------------------------------+
18  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
19  +-----------------------------------------------------------------------+
20 */
21
2a5d02 22 $iid = get_input_value('_iid', RCUBE_INPUT_GPC);
T 23
24 // check request token
25 if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(RCUBE_INPUT_GPC)) {
26   $OUTPUT->show_message('invalidrequest', 'error');
27   rcmail_overwrite_action('identities');
28   return;
29 }
30
31 if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid))
f11541 32 {
119ad1 33   $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid));
461253 34   
a90ad2 35   $deleted = !$plugin['abort'] ? $RCMAIL->user->delete_identity($iid) : $plugin['result'];
ce92ba 36
bbb142 37   if ($deleted > 0 && $deleted !== false)
461253 38     $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
ce92ba 39   else
bbb142 40     $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving'), 'error', null, false);
ce92ba 41
4e17e6 42   // send response
f11541 43   if ($OUTPUT->ajax_call)
T 44     $OUTPUT->send();
45 }
4e17e6 46
1971dd 47 if ($OUTPUT->ajax_call)
A 48   exit;
49
4e17e6 50 // go to identities page
f11541 51 rcmail_overwrite_action('identities');