]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/settings/delete_identity.inc
Imported Upstream version 0.5
[roundcube.git] / program / steps / settings / delete_identity.inc
1 <?php
2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/settings/delete_identity.inc                            |
6  |                                                                       |
7  | This file is part of the Roundcube Webmail client                     |
8  | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland                 |
9  | Licensed under the GNU GPL                                            |
10  |                                                                       |
11  | PURPOSE:                                                              |
12  |   Delete the submitted identities (IIDs) from the database            |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16  +-----------------------------------------------------------------------+
17
18  $Id: delete_identity.inc 4025 2010-09-30 13:24:33Z alec $
19
20 */
21
22 $iid = get_input_value('_iid', RCUBE_INPUT_GPC);
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))
32 {
33   $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid));
34   
35   $deleted = !$plugin['abort'] ? $USER->delete_identity($iid) : $plugin['result'];
36
37   if ($deleted)
38     $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
39   else
40     $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'nodeletelastidentity', 'error', null, false);
41
42   // send response
43   if ($OUTPUT->ajax_call)
44     $OUTPUT->send();
45 }
46
47 if ($OUTPUT->ajax_call)
48   exit;
49
50 // go to identities page
51 rcmail_overwrite_action('identities');