You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

identities.inc 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. +-----------------------------------------------------------------------+
  4. | program/steps/settings/identities.inc |
  5. | |
  6. | This file is part of the Roundcube Webmail client |
  7. | Copyright (C) 2005-2013, The Roundcube Dev Team |
  8. | |
  9. | Licensed under the GNU General Public License version 3 or |
  10. | any later version with exceptions for skins & plugins. |
  11. | See the README file for a full license statement. |
  12. | |
  13. | PURPOSE: |
  14. | Manage identities of a user account |
  15. | |
  16. +-----------------------------------------------------------------------+
  17. | Author: Thomas Bruederli <roundcube@gmail.com> |
  18. +-----------------------------------------------------------------------+
  19. */
  20. if ($RCMAIL->action == 'delete-identity' && $OUTPUT->ajax_call) {
  21. $iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_POST);
  22. if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid)) {
  23. $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid));
  24. $deleted = !$plugin['abort'] ? $RCMAIL->user->delete_identity($iid) : $plugin['result'];
  25. if ($deleted > 0 && $deleted !== false) {
  26. $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
  27. $OUTPUT->command('remove_identity', $iid);
  28. }
  29. else {
  30. $msg = $plugin['message'] ?: ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving');
  31. $OUTPUT->show_message($msg, 'error', null, false);
  32. }
  33. }
  34. $OUTPUT->send();
  35. }
  36. define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
  37. $OUTPUT->set_pagetitle($RCMAIL->gettext('identities'));
  38. $OUTPUT->include_script('list.js');
  39. $OUTPUT->add_handler('identityframe', 'rcmail_identity_frame');
  40. $OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
  41. $OUTPUT->add_label('deleteidentityconfirm');
  42. $OUTPUT->send('identities');
  43. // similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
  44. function rcmail_identity_frame($attrib)
  45. {
  46. global $OUTPUT;
  47. if (!$attrib['id']) {
  48. $attrib['id'] = 'rcmIdentityFrame';
  49. }
  50. return $OUTPUT->frame($attrib, true);
  51. }