0
|
1 <?php
|
|
2
|
|
3 /**
|
|
4 +-----------------------------------------------------------------------+
|
|
5 | program/steps/settings/identities.inc |
|
|
6 | |
|
|
7 | This file is part of the Roundcube Webmail client |
|
|
8 | Copyright (C) 2005-2013, The Roundcube Dev Team |
|
|
9 | |
|
|
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. |
|
|
13 | |
|
|
14 | PURPOSE: |
|
|
15 | Manage identities of a user account |
|
|
16 | |
|
|
17 +-----------------------------------------------------------------------+
|
|
18 | Author: Thomas Bruederli <roundcube@gmail.com> |
|
|
19 +-----------------------------------------------------------------------+
|
|
20 */
|
|
21
|
|
22 if ($RCMAIL->action == 'delete-identity' && $OUTPUT->ajax_call) {
|
|
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'] ?: ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving');
|
|
36 $OUTPUT->show_message($msg, 'error', null, false);
|
|
37 }
|
|
38 }
|
|
39
|
|
40 $OUTPUT->send();
|
|
41 }
|
|
42
|
|
43
|
|
44 define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
|
|
45
|
|
46 $OUTPUT->set_pagetitle($RCMAIL->gettext('identities'));
|
|
47 $OUTPUT->include_script('list.js');
|
|
48
|
|
49 $OUTPUT->add_handler('identityframe', 'rcmail_identity_frame');
|
|
50 $OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
|
|
51 $OUTPUT->add_label('deleteidentityconfirm');
|
|
52
|
|
53 $OUTPUT->send('identities');
|
|
54
|
|
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 }
|