Aleksander Machniak
2015-02-25 216b31dd99b54e7be3df8feebeafae72e423bb1c
commit | author | age
4e17e6 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/settings/identities.inc                                 |
6  |                                                                       |
e019f2 7  | This file is part of the Roundcube Webmail client                     |
d575e4 8  | Copyright (C) 2005-2013, 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  |   Manage identities of a user account                                 |
16  |                                                                       |
17  +-----------------------------------------------------------------------+
18  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
19  +-----------------------------------------------------------------------+
20 */
21
ca01e2 22 if ($RCMAIL->action == 'delete-identity' && $OUTPUT->ajax_call) {
AM 23     $iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_POST);
24
25     if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid)) {
26         $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid));
27
28         $deleted = !$plugin['abort'] ? $RCMAIL->user->delete_identity($iid) : $plugin['result'];
29
30         if ($deleted > 0 && $deleted !== false) {
31             $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
32             $OUTPUT->command('remove_identity', $iid);
33         }
34         else {
35             $msg = $plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving');
36             $OUTPUT->show_message($msg, 'error', null, false);
37         }
38     }
39
40     $OUTPUT->send();
41 }
42
43
ec0171 44 define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
A 45
6b2b2e 46 $OUTPUT->set_pagetitle($RCMAIL->gettext('identities'));
6b47de 47 $OUTPUT->include_script('list.js');
4e17e6 48
f11541 49 $OUTPUT->add_handler('identityframe', 'rcmail_identity_frame');
ec0171 50 $OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
7c2a93 51 $OUTPUT->add_label('deleteidentityconfirm');
4e17e6 52
47124c 53 $OUTPUT->send('identities');
d575e4 54
AM 55
56 // similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
57 function rcmail_identity_frame($attrib)
58 {
59     global $OUTPUT;
60
61     if (!$attrib['id']) {
62         $attrib['id'] = 'rcmIdentityFrame';
63     }
64
65     return $OUTPUT->frame($attrib, true);
66 }