thomascube
2011-08-18 fbe54043cf598b19a753dc2b21a7ed558d23fd15
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                       |
30233b 9  | Licensed under the GNU GPL                                            |
4e17e6 10  |                                                                       |
T 11  | PURPOSE:                                                              |
12  |   Delete the submitted identities (IIDs) from the database            |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16  +-----------------------------------------------------------------------+
17
18  $Id$
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   
ce92ba 35   $deleted = !$plugin['abort'] ? $USER->delete_identity($iid) : $plugin['result'];
A 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');