alecpl
2010-09-30 ce92ba767a9557daf7f18be94882dd7e6f4591fb
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                     |
A 8  | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland                 |
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
37   if ($deleted)
461253 38     $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
ce92ba 39   else
A 40     $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'nodeletelastidentity', 'error', null, false);
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');