Aleksander Machniak
2013-12-31 d575e46067c06f1165adb249865f3812e270df12
CS fixes
13 files modified
411 ■■■■ changed files
program/steps/settings/about.inc 31 ●●●●● patch | view | raw | blame | history
program/steps/settings/delete_identity.inc 26 ●●●●● patch | view | raw | blame | history
program/steps/settings/edit_folder.inc 27 ●●●● patch | view | raw | blame | history
program/steps/settings/edit_identity.inc 46 ●●●●● patch | view | raw | blame | history
program/steps/settings/edit_prefs.inc 28 ●●●● patch | view | raw | blame | history
program/steps/settings/edit_response.inc 19 ●●●● patch | view | raw | blame | history
program/steps/settings/folders.inc 4 ●●●● patch | view | raw | blame | history
program/steps/settings/func.inc 59 ●●●● patch | view | raw | blame | history
program/steps/settings/identities.inc 17 ●●●● patch | view | raw | blame | history
program/steps/settings/responses.inc 19 ●●●● patch | view | raw | blame | history
program/steps/settings/save_folder.inc 5 ●●●● patch | view | raw | blame | history
program/steps/settings/save_identity.inc 42 ●●●●● patch | view | raw | blame | history
program/steps/settings/save_prefs.inc 88 ●●●● patch | view | raw | blame | history
program/steps/settings/about.inc
@@ -5,8 +5,8 @@
 | program/steps/settings/about.inc                                      |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2011, The Roundcube Dev Team                       |
 | Copyright (C) 2011, Kolab Systems AG                                  |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 | Copyright (C) 2011-2013, Kolab Systems AG                             |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -21,6 +21,15 @@
*/
$OUTPUT->set_pagetitle($RCMAIL->gettext('about'));
$OUTPUT->add_handler('supportlink', 'rcmail_supportlink');
$OUTPUT->add_handler('pluginlist', 'rcmail_plugins_list');
$OUTPUT->send('about');
function rcmail_supportlink($attrib)
{
  global $RCMAIL;
@@ -28,6 +37,7 @@
  if ($url = $RCMAIL->config->get('support_url')) {
    $label = $attrib['label'] ? $attrib['label'] : 'support';
    $attrib['href'] = $url;
    return html::a($attrib, $RCMAIL->gettext($label));
  }
}
@@ -36,23 +46,26 @@
{
  global $RCMAIL;
  if (!$attrib['id'])
    if (!$attrib['id']) {
    $attrib['id'] = 'rcmpluginlist';
    }
  $plugins = array_filter((array) $RCMAIL->config->get('plugins'));
  $plugin_info = array();
  foreach ($plugins as $name) {
    if ($info = $RCMAIL->plugins->get_info($name))
        if ($info = $RCMAIL->plugins->get_info($name)) {
      $plugin_info[$name] = $info;
        }
  }
  // load info from required plugins, too
  foreach ($plugin_info as $name => $info) {
    if (is_array($info['required']) && !empty($info['required'])) {
      foreach ($info['required'] as $req_name) {
        if (!isset($plugin_info[$req_name]) && ($req_info = $RCMAIL->plugins->get_info($req_name)))
                if (!isset($plugin_info[$req_name]) && ($req_info = $RCMAIL->plugins->get_info($req_name))) {
          $plugin_info[$req_name] = $req_info;
                }
      }
    }
  }
@@ -88,11 +101,3 @@
  return $table->show();
}
$OUTPUT->set_pagetitle($RCMAIL->gettext('about'));
$OUTPUT->add_handler('supportlink', 'rcmail_supportlink');
$OUTPUT->add_handler('pluginlist', 'rcmail_plugins_list');
$OUTPUT->send('about');
program/steps/settings/delete_identity.inc
@@ -5,7 +5,7 @@
 | program/steps/settings/delete_identity.inc                            |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2009, The Roundcube Dev Team                       |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -28,24 +28,28 @@
  return;
}
if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid))
{
if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid)) {
  $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid));
  $deleted = !$plugin['abort'] ? $RCMAIL->user->delete_identity($iid) : $plugin['result'];
  if ($deleted > 0 && $deleted !== false)
    if ($deleted > 0 && $deleted !== false) {
    $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
  else
    $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving'), 'error', null, false);
  // send response
  if ($OUTPUT->ajax_call)
    $OUTPUT->send();
    }
    else {
        $msg = $plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving');
        $OUTPUT->show_message($msg, 'error', null, false);
}
if ($OUTPUT->ajax_call)
    // send response
    if ($OUTPUT->ajax_call) {
        $OUTPUT->send();
    }
}
if ($OUTPUT->ajax_call) {
  exit;
}
// go to identities page
$RCMAIL->overwrite_action('identities');
program/steps/settings/edit_folder.inc
@@ -5,7 +5,7 @@
 | program/steps/settings/edit_folder.inc                                |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2009, The Roundcube Dev Team                       |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -18,6 +18,16 @@
 | Author: Aleksander Machniak <alec@alec.pl>                            |
 +-----------------------------------------------------------------------+
*/
// register UI objects
$OUTPUT->add_handlers(array(
    'folderdetails' => 'rcmail_folder_form',
));
$OUTPUT->add_label('nonamewarning');
$OUTPUT->send('folderedit');
// WARNING: folder names in UI are encoded with RCUBE_CHARSET
@@ -256,7 +266,8 @@
            foreach ($tab['fieldsets'] as $fieldset) {
                $subcontent = rcmail_get_form_part($fieldset, $attrib);
                if ($subcontent) {
                    $content .= html::tag('fieldset', null, html::tag('legend', null, rcube::Q($fieldset['name'])) . $subcontent) ."\n";
                    $subcontent = html::tag('legend', null, rcube::Q($fieldset['name'])) . $subcontent;
                    $content .= html::tag('fieldset', null, $subcontent) ."\n";
                }
            }
        }
@@ -300,15 +311,3 @@
    return $content;
}
//$OUTPUT->set_pagetitle($RCMAIL->gettext('folders'));
// register UI objects
$OUTPUT->add_handlers(array(
    'folderdetails' => 'rcmail_folder_form',
));
$OUTPUT->add_label('nonamewarning');
$OUTPUT->send('folderedit');
program/steps/settings/edit_identity.inc
@@ -5,7 +5,7 @@
 | program/steps/settings/edit_identity.inc                              |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2011, The Roundcube Dev Team                       |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -23,10 +23,12 @@
// edit-identity
if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='edit-identity') {
  $IDENTITY_RECORD = $RCMAIL->user->get_identity(rcube_utils::get_input_value('_iid', rcube_utils::INPUT_GPC));
    $id = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_GPC);
    $IDENTITY_RECORD = $RCMAIL->user->get_identity($id);
  if (is_array($IDENTITY_RECORD))
    if (is_array($IDENTITY_RECORD)) {
    $OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']);
    }
  else {
    $OUTPUT->show_message('dberror', 'error');
    // go to identities page
@@ -46,6 +48,19 @@
    $IDENTITY_RECORD['email'] = $RCMAIL->get_user_email();
  }
}
$OUTPUT->include_script('list.js');
$OUTPUT->add_handler('identityform', 'rcube_identity_form');
$OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
$OUTPUT->add_label('deleteidentityconfirm');
$OUTPUT->set_pagetitle($RCMAIL->gettext(($RCMAIL->action == 'add-identity' ? 'newidentity' : 'edititem')));
if ($RCMAIL->action == 'add-identity' && $OUTPUT->template_exists('identityadd')) {
    $OUTPUT->send('identityadd');
}
$OUTPUT->send('identityedit');
function rcube_identity_form($attrib)
@@ -79,7 +94,8 @@
      'content' => array(
        'signature'      => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows,
            'spellcheck' => true),
        'html_signature' => array('type' => 'checkbox', 'label' => $RCMAIL->gettext('htmlsignature'),
                'html_signature' => array('type' => 'checkbox',
                    'label'   => $RCMAIL->gettext('htmlsignature'),
            'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'),
    ))
  );
@@ -127,12 +143,14 @@
  $out = "$form_start\n";
  foreach ($form as $fieldset) {
    if (empty($fieldset['content']))
        if (empty($fieldset['content'])) {
      continue;
        }
    $content = '';
    if (is_array($fieldset['content'])) {
      $table = new html_table(array('cols' => 2));
      foreach ($fieldset['content'] as $col => $colprop) {
        $colprop['id'] = 'rcmfd_'.$col;
@@ -145,30 +163,18 @@
        $table->add('title', html::label($colprop['id'], rcube::Q($label)));
        $table->add(null, $value);
      }
      $content = $table->show($attrib);
    }
    else {
      $content = $fieldset['content'];
    }
    $out .= html::tag('fieldset', null, html::tag('legend', null, rcube::Q($fieldset['name'])) . $content) ."\n";
        $content = html::tag('legend', null, rcube::Q($fieldset['name'])) . $content;
        $out .= html::tag('fieldset', null, $content) . "\n";
  }
  $out .= $form_end;
  return $out;
}
$OUTPUT->include_script('list.js');
$OUTPUT->add_handler('identityform', 'rcube_identity_form');
$OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
$OUTPUT->add_label('deleteidentityconfirm');
$OUTPUT->set_pagetitle($RCMAIL->gettext(($RCMAIL->action=='add-identity' ? 'newidentity' : 'edititem')));
if ($RCMAIL->action=='add-identity' && $OUTPUT->template_exists('identityadd'))
  $OUTPUT->send('identityadd');
$OUTPUT->send('identityedit');
program/steps/settings/edit_prefs.inc
@@ -5,7 +5,7 @@
 | program/steps/settings/edit_prefs.inc                                 |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2007, The Roundcube Dev Team                       |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -19,12 +19,23 @@
 +-----------------------------------------------------------------------+
*/
if (!$OUTPUT->ajax_call)
  $OUTPUT->set_pagetitle($RCMAIL->gettext('preferences'));
if (!$OUTPUT->ajax_call) {
    $OUTPUT->set_pagetitle($RCMAIL->gettext('preferences'));
}
$CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_GPC);
list($SECTIONS,) = rcmail_user_prefs($CURR_SECTION);
// register UI objects
$OUTPUT->add_handlers(array(
    'userprefs'   => 'rcmail_user_prefs_form',
    'sectionname' => 'rcmail_prefs_section_name',
));
$OUTPUT->send('settingsedit');
function rcmail_user_prefs_form($attrib)
{
@@ -70,14 +81,3 @@
  
  return $SECTIONS[$CURR_SECTION]['section'];
}
// register UI objects
$OUTPUT->add_handlers(array(
  'userprefs' => 'rcmail_user_prefs_form',
  'sectionname' => 'rcmail_prefs_section_name',
));
$OUTPUT->send('settingsedit');
program/steps/settings/edit_response.inc
@@ -70,6 +70,12 @@
    }
}
$OUTPUT->set_env('readonly', !empty($RESPONSE_RECORD['static']));
$OUTPUT->add_handler('responseform', 'rcube_response_form');
$OUTPUT->set_pagetitle($RCMAIL->gettext($RCMAIL->action == 'add-response' ? 'savenewresponse' : 'editresponse'));
$OUTPUT->send('responseedit');
function rcube_response_form($attrib)
{
@@ -88,20 +94,15 @@
    $label = $RCMAIL->gettext('responsename');
    $table->add('title', html::label('ffname', rcube::Q($RCMAIL->gettext('responsename'))));
    $table->add(null, rcube_output::get_edit_field('name', $RESPONSE_RECORD['name'], array('id' => 'ffname', 'size' => $attrib['size'], 'disabled' => $disabled), 'text'));
    $table->add(null, rcube_output::get_edit_field('name', $RESPONSE_RECORD['name'],
        array('id' => 'ffname', 'size' => $attrib['size'], 'disabled' => $disabled), 'text'));
    $table->add('title', html::label('fftext', rcube::Q($RCMAIL->gettext('responsetext'))));
    $table->add(null, rcube_output::get_edit_field('text', $RESPONSE_RECORD['text'], array('id' => 'fftext', 'size' => $attrib['textareacols'], 'rows' => $attrib['textarearows'], 'disabled' => $disabled), 'textarea'));
    $table->add(null, rcube_output::get_edit_field('text', $RESPONSE_RECORD['text'],
        array('id' => 'fftext', 'size' => $attrib['textareacols'], 'rows' => $attrib['textarearows'], 'disabled' => $disabled), 'textarea'));
    $out .= $table->show($attrib);
    $out .= $form_end;
    return $out;
}
$OUTPUT->set_env('readonly', !empty($RESPONSE_RECORD['static']));
$OUTPUT->add_handler('responseform', 'rcube_response_form');
$OUTPUT->set_pagetitle($RCMAIL->gettext($RCMAIL->action == 'add-response' ? 'savenewresponse' : 'editresponse'));
$OUTPUT->send('responseedit');
program/steps/settings/folders.inc
@@ -378,8 +378,9 @@
{
    global $OUTPUT;
    if (!$attrib['id'])
    if (!$attrib['id']) {
        $attrib['id'] = 'rcmfolderframe';
    }
    return $OUTPUT->frame($attrib, true);
}
@@ -428,4 +429,3 @@
    return false;
}
program/steps/settings/func.inc
@@ -5,7 +5,7 @@
 | program/steps/settings/func.inc                                       |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2012, The Roundcube Dev Team                       |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -22,6 +22,30 @@
if (!$OUTPUT->ajax_call) {
    $OUTPUT->set_pagetitle($RCMAIL->gettext('preferences'));
}
// register UI objects
$OUTPUT->add_handlers(array(
    'settingstabs'   => 'rcmail_settings_tabs',
    'prefsframe'     => 'rcmail_preferences_frame',
    'sectionslist'   => 'rcmail_sections_list',
    'identitieslist' => 'rcmail_identities_list',
));
// register action aliases
$RCMAIL->register_action_map(array(
    'folders'       => 'folders.inc',
    'rename-folder' => 'folders.inc',
    'delete-folder' => 'folders.inc',
    'subscribe'     => 'folders.inc',
    'unsubscribe'   => 'folders.inc',
    'purge'         => 'folders.inc',
    'folder-size'   => 'folders.inc',
    'add-identity'  => 'edit_identity.inc',
    'add-response'  => 'edit_response.inc',
    'save-response' => 'edit_response.inc',
    'delete-response' => 'responses.inc',
));
// similar function as /steps/settings/identities.inc::rcmail_identity_frame()
function rcmail_preferences_frame($attrib)
@@ -1273,12 +1297,14 @@
    $display_name = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level)
        . rcube::Q($protected ? $RCMAIL->localize_foldername($name) : rcube_charset::convert($foldersplit[$level], 'UTF7-IMAP'));
    if ($oldname === null)
    if ($oldname === null) {
        $OUTPUT->command('add_folder_row', $name_utf8, $display_name, $protected, $subscribe,
            false, $class_name);
    else
    }
    else {
        $OUTPUT->command('replace_folder_row', rcube_charset::convert($oldname, 'UTF7-IMAP'),
            $name_utf8, $display_name, $protected, $class_name);
    }
}
/**
@@ -1318,9 +1344,11 @@
        $cmd = $action['action'] ? $action['action'] : $action['command'];
        $id = $action['id'] ? $action['id'] : $cmd;
        if (!empty($id)) {
            $attr['id'] = preg_replace('/[^a-z0-9]/i', '', $attrib['idprefix'] . $id);
        }
        $classnames = array($attrib['class']);
        if (!empty($action['class'])) {
            $classnames[] = $action['class'];
@@ -1331,33 +1359,10 @@
        if ($RCMAIL->action == $cmd) {
            $classnames[] = $attrib['selclass'];
        }
        $attr['class'] = join(' ', $classnames);
        $tabs[] = html::tag($tagname, $attr, $button, html::$common_attrib);
    }
    return join('', $tabs);
}
// register UI objects
$OUTPUT->add_handlers(array(
    'settingstabs' => 'rcmail_settings_tabs',
    'prefsframe' => 'rcmail_preferences_frame',
    'sectionslist' => 'rcmail_sections_list',
    'identitieslist' => 'rcmail_identities_list',
));
// register action aliases
$RCMAIL->register_action_map(array(
    'folders'       => 'folders.inc',
    'rename-folder' => 'folders.inc',
    'delete-folder' => 'folders.inc',
    'subscribe'     => 'folders.inc',
    'unsubscribe'   => 'folders.inc',
    'purge'         => 'folders.inc',
    'folder-size'   => 'folders.inc',
    'add-identity'  => 'edit_identity.inc',
    'add-response'  => 'edit_response.inc',
    'save-response' => 'edit_response.inc',
    'delete-response' => 'responses.inc',
));
program/steps/settings/identities.inc
@@ -5,7 +5,7 @@
 | program/steps/settings/identities.inc                                 |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2007, The Roundcube Dev Team                       |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -24,20 +24,21 @@
$OUTPUT->set_pagetitle($RCMAIL->gettext('identities'));
$OUTPUT->include_script('list.js');
$OUTPUT->add_handler('identityframe', 'rcmail_identity_frame');
$OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
$OUTPUT->add_label('deleteidentityconfirm');
$OUTPUT->send('identities');
// similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
function rcmail_identity_frame($attrib)
  {
  global $OUTPUT;
  if (!$attrib['id'])
    if (!$attrib['id']) {
    $attrib['id'] = 'rcmIdentityFrame';
    }
  return $OUTPUT->frame($attrib, true);
  }
$OUTPUT->add_handler('identityframe', 'rcmail_identity_frame');
$OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
$OUTPUT->add_label('deleteidentityconfirm');
$OUTPUT->send('identities');
program/steps/settings/responses.inc
@@ -51,7 +51,6 @@
    $RCMAIL->output->send();
}
if ($RCMAIL->action == 'delete-response') {
    if ($key = rcube_utils::get_input_value('_key', rcube_utils::INPUT_GPC)) {
        $responses = $RCMAIL->get_compose_responses(false, true);
@@ -80,6 +79,14 @@
$OUTPUT->set_pagetitle($RCMAIL->gettext('responses'));
$OUTPUT->include_script('list.js');
$OUTPUT->add_handlers(array(
    'responseframe' => 'rcmail_response_frame',
    'responseslist' => 'rcmail_responses_list',
));
$OUTPUT->add_label('deleteresponseconfirm');
$OUTPUT->send('responses');
/**
 *
@@ -105,7 +112,6 @@
    return $out;
}
// similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
function rcmail_response_frame($attrib)
{
@@ -116,13 +122,6 @@
    }
    $OUTPUT->set_env('contentframe', $attrib['id']);
    return $OUTPUT->frame($attrib, true);
}
$OUTPUT->add_handlers(array(
    'responseframe' => 'rcmail_response_frame',
    'responseslist' => 'rcmail_responses_list',
));
$OUTPUT->add_label('deleteresponseconfirm');
$OUTPUT->send('responses');
program/steps/settings/save_folder.inc
@@ -1,6 +1,6 @@
<?php
/**
/*
 +-----------------------------------------------------------------------+
 | program/steps/settings/save_folder.inc                                |
 |                                                                       |
@@ -23,7 +23,6 @@
// init IMAP connection
$STORAGE = $RCMAIL->get_storage();
$name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true));
$old  = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true);
@@ -98,7 +97,6 @@
// create a new mailbox
if (!$error && !strlen($old)) {
    $folder['subscribe'] = true;
    $plugin = $RCMAIL->plugins->exec_hook('folder_create', array('record' => $folder));
@@ -136,7 +134,6 @@
        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
    }
}
// update a mailbox
else if (!$error) {
    $plugin = $RCMAIL->plugins->exec_hook('folder_update', array('record' => $folder));
program/steps/settings/save_identity.inc
@@ -5,7 +5,7 @@
 | program/steps/settings/save_identity.inc                              |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2009, The Roundcube Dev Team                       |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -35,16 +35,18 @@
$save_data = array();
foreach ($a_save_cols as $col) {
  $fname = '_'.$col;
  if (isset($_POST[$fname]))
    if (isset($_POST[$fname])) {
    $save_data[$col] = rcube_utils::get_input_value($fname, rcube_utils::INPUT_POST, true);
    }
}
// set "off" values for checkboxes that were not checked, and therefore
// not included in the POST body.
foreach ($a_boolean_cols as $col) {
  $fname = '_' . $col;
  if (!isset($_POST[$fname]))
    if (!isset($_POST[$fname])) {
    $save_data[$col] = 0;
    }
}
// unset email address if user has no rights to change it
@@ -63,8 +65,9 @@
// Validate e-mail addresses
$email_checks = array(rcube_utils::idn_to_ascii($save_data['email']));
foreach (array('reply-to', 'bcc') as $item) {
  foreach (rcube_mime::decode_address_list($save_data[$item], null, false) as $rcpt)
    foreach (rcube_mime::decode_address_list($save_data[$item], null, false) as $rcpt) {
    $email_checks[] = rcube_utils::idn_to_ascii($rcpt['mailto']);
    }
}
foreach ($email_checks as $email) {
@@ -93,14 +96,17 @@
    // merge with old identity data, fixes #1488834
    $identity  = $RCMAIL->user->get_identity($iid);
    $save_data = array_merge($identity, $save_data);
    unset($save_data['changed'], $save_data['del'], $save_data['user_id'], $save_data['identity_id']);
  }
  $plugin = $RCMAIL->plugins->exec_hook('identity_update', array('id' => $iid, 'record' => $save_data));
  $save_data = $plugin['record'];
  if ($save_data['email'])
    if ($save_data['email']) {
    $save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']);
    }
  if (!$plugin['abort'])
    $updated = $RCMAIL->user->update_identity($iid, $save_data);
  else
@@ -109,12 +115,14 @@
  if ($updated) {
    $OUTPUT->show_message('successfullysaved', 'confirmation');
    if (!empty($save_data['standard']))
        if (!empty($save_data['standard'])) {
      $default_id = $iid;
        }
    if ($_POST['_framed']) {
      // update the changed col in list
      $OUTPUT->command('parent.update_identity_row', $iid, rcube::Q(trim($save_data['name'] . ' <' . rcube_utils::idn_to_utf8($save_data['email']) .'>')));
            $name = $save_data['name'] . ' <' . rcube_utils::idn_to_utf8($save_data['email']) .'>';
            $OUTPUT->command('parent.update_identity_row', $iid, rcube::Q(trim($name)));
    }
  }
  else {
@@ -124,7 +132,6 @@
    return;
  }
}
// insert a new identity record
else if (IDENTITIES_LEVEL < 2) {
  if (IDENTITIES_LEVEL == 1) {
@@ -134,8 +141,9 @@
  $plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data));
  $save_data = $plugin['record'];
  if ($save_data['email'])
    if ($save_data['email']) {
    $save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']);
    }
  if (!$plugin['abort'])
    $insert_id = $save_data['email'] ? $RCMAIL->user->insert_identity($save_data) : null;
@@ -147,12 +155,14 @@
    $_GET['_iid'] = $insert_id;
    if (!empty($save_data['standard']))
        if (!empty($save_data['standard'])) {
      $default_id = $insert_id;
        }
    if ($_POST['_framed']) {
      // add a new row to the list
      $OUTPUT->command('parent.update_identity_row', $insert_id, rcube::Q(trim($save_data['name'] . ' <' . rcube_utils::idn_to_utf8($save_data['email']) .'>')), true);
            $name = $save_data['name'] . ' <' . rcube_utils::idn_to_utf8($save_data['email']) .'>';
            $OUTPUT->command('parent.update_identity_row', $insert_id, rcube::Q(trim($name)), true);
    }
  }
  else {
@@ -162,20 +172,22 @@
    return;
  }
}
else
else {
  $OUTPUT->show_message('opnotpermitted', 'error');
}
// mark all other identities as 'not-default'
if ($default_id)
if ($default_id) {
  $RCMAIL->user->set_default($default_id);
}
// go to next step
if (!empty($_REQUEST['_framed'])) {
  $RCMAIL->overwrite_action('edit-identity');
}
else
else {
  $RCMAIL->overwrite_action('identities');
}
/**
program/steps/settings/save_prefs.inc
@@ -5,7 +5,7 @@
 | program/steps/settings/save_prefs.inc                                 |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2009, The Roundcube Dev Team                       |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -20,21 +20,19 @@
*/
$CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_POST);
$a_user_prefs = array();
// set options for specified section
switch ($CURR_SECTION)
{
switch ($CURR_SECTION) {
  case 'general':
    $a_user_prefs = array(
      'language'     => isset($_POST['_language']) ? rcube_utils::get_input_value('_language', rcube_utils::INPUT_POST) : $CONFIG['language'],
      'timezone'     => isset($_POST['_timezone']) ? rcube_utils::get_input_value('_timezone', rcube_utils::INPUT_POST) : $CONFIG['timezone'],
      'date_format'  => isset($_POST['_date_format']) ? rcube_utils::get_input_value('_date_format', rcube_utils::INPUT_POST) : $CONFIG['date_format'],
      'time_format'  => isset($_POST['_time_format']) ? rcube_utils::get_input_value('_time_format', rcube_utils::INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'),
      'prettydate'   => isset($_POST['_pretty_date']) ? TRUE : FALSE,
        'prettydate'   => isset($_POST['_pretty_date']) ? true : false,
      'refresh_interval' => isset($_POST['_refresh_interval']) ? intval($_POST['_refresh_interval'])*60 : $CONFIG['refresh_interval'],
      'standard_windows' => isset($_POST['_standard_windows']) ? TRUE : FALSE,
        'standard_windows' => isset($_POST['_standard_windows']) ? true : false,
      'skin'         => isset($_POST['_skin']) ? rcube_utils::get_input_value('_skin', rcube_utils::INPUT_POST) : $CONFIG['skin'],
    );
@@ -48,11 +46,11 @@
  case 'mailbox':
    $a_user_prefs = array(
      'preview_pane'         => isset($_POST['_preview_pane']) ? TRUE : FALSE,
        'preview_pane'         => isset($_POST['_preview_pane']) ? true : false,
      'preview_pane_mark_read' => isset($_POST['_preview_pane_mark_read']) ? intval($_POST['_preview_pane_mark_read']) : $CONFIG['preview_pane_mark_read'],
      'autoexpand_threads'   => isset($_POST['_autoexpand_threads']) ? intval($_POST['_autoexpand_threads']) : 0,
      'mdn_requests'         => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0,
      'check_all_folders'    => isset($_POST['_check_all_folders']) ? TRUE : FALSE,
        'check_all_folders'    => isset($_POST['_check_all_folders']) ? true : false,
      'mail_pagesize'        => is_numeric($_POST['_mail_pagesize']) ? max(2, intval($_POST['_mail_pagesize'])) : $CONFIG['mail_pagesize'],
    );
@@ -61,11 +59,11 @@
  case 'mailview':
    $a_user_prefs = array(
      'message_extwin'  => intval($_POST['_message_extwin']),
      'message_show_email' => isset($_POST['_message_show_email']) ? TRUE : FALSE,
      'prefer_html'     => isset($_POST['_prefer_html']) ? TRUE : FALSE,
      'inline_images'   => isset($_POST['_inline_images']) ? TRUE : FALSE,
        'message_show_email' => isset($_POST['_message_show_email']) ? true : false,
        'prefer_html'     => isset($_POST['_prefer_html']) ? true : false,
        'inline_images'   => isset($_POST['_inline_images']) ? true : false,
      'show_images'     => isset($_POST['_show_images']) ? intval($_POST['_show_images']) : 0,
      'display_next'    => isset($_POST['_display_next']) ? TRUE : FALSE,
        'display_next'    => isset($_POST['_display_next']) ? true : false,
      'default_charset' => rcube_utils::get_input_value('_default_charset', rcube_utils::INPUT_POST),
    );
@@ -77,14 +75,14 @@
      'htmleditor'         => intval($_POST['_htmleditor']),
      'draft_autosave'     => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0,
      'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0,
      'force_7bit'         => isset($_POST['_force_7bit']) ? TRUE : FALSE,
      'mdn_default'        => isset($_POST['_mdn_default']) ? TRUE : FALSE,
      'dsn_default'        => isset($_POST['_dsn_default']) ? TRUE : FALSE,
      'reply_same_folder'  => isset($_POST['_reply_same_folder']) ? TRUE : FALSE,
      'spellcheck_before_send' => isset($_POST['_spellcheck_before_send']) ? TRUE : FALSE,
      'spellcheck_ignore_syms' => isset($_POST['_spellcheck_ignore_syms']) ? TRUE : FALSE,
      'spellcheck_ignore_nums' => isset($_POST['_spellcheck_ignore_nums']) ? TRUE : FALSE,
      'spellcheck_ignore_caps' => isset($_POST['_spellcheck_ignore_caps']) ? TRUE : FALSE,
        'force_7bit'         => isset($_POST['_force_7bit']) ? true : false,
        'mdn_default'        => isset($_POST['_mdn_default']) ? true : false,
        'dsn_default'        => isset($_POST['_dsn_default']) ? true : false,
        'reply_same_folder'  => isset($_POST['_reply_same_folder']) ? true : false,
        'spellcheck_before_send' => isset($_POST['_spellcheck_before_send']) ? true : false,
        'spellcheck_ignore_syms' => isset($_POST['_spellcheck_ignore_syms']) ? true : false,
        'spellcheck_ignore_nums' => isset($_POST['_spellcheck_ignore_nums']) ? true : false,
        'spellcheck_ignore_caps' => isset($_POST['_spellcheck_ignore_caps']) ? true : false,
      'show_sig'           => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1,
      'reply_mode'         => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0,
      'strip_existing_sig' => isset($_POST['_strip_existing_sig']),
@@ -99,7 +97,7 @@
  case 'addressbook':
    $a_user_prefs = array(
      'default_addressbook'  => rcube_utils::get_input_value('_default_addressbook', rcube_utils::INPUT_POST, true),
      'autocomplete_single'  => isset($_POST['_autocomplete_single']) ? TRUE : FALSE,
        'autocomplete_single'  => isset($_POST['_autocomplete_single']) ? true : false,
      'addressbook_sort_col' => rcube_utils::get_input_value('_addressbook_sort_col', rcube_utils::INPUT_POST),
      'addressbook_name_listing' => intval(rcube_utils::get_input_value('_addressbook_name_listing', rcube_utils::INPUT_POST)),
      'addressbook_pagesize' => is_numeric($_POST['_addressbook_pagesize']) ? max(2, intval($_POST['_addressbook_pagesize'])) : $CONFIG['addressbook_pagesize'],
@@ -109,21 +107,20 @@
  case 'server':
    $a_user_prefs = array(
      'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE,
      'skip_deleted'      => isset($_POST['_skip_deleted']) ? TRUE : FALSE,
      'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? TRUE : FALSE,
      'delete_always'       => isset($_POST['_delete_always']) ? TRUE : FALSE,
      'delete_junk'       => isset($_POST['_delete_junk']) ? TRUE : FALSE,
      'logout_purge'      => isset($_POST['_logout_purge']) ? TRUE : FALSE,
      'logout_expunge'    => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
        'read_when_deleted' => isset($_POST['_read_when_deleted']) ? true : false,
        'skip_deleted'      => isset($_POST['_skip_deleted']) ? true : false,
        'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? true : false,
        'delete_always'     => isset($_POST['_delete_always']) ? true : false,
        'delete_junk'       => isset($_POST['_delete_junk']) ? true : false,
        'logout_purge'      => isset($_POST['_logout_purge']) ? true : false,
        'logout_expunge'    => isset($_POST['_logout_expunge']) ? true : false,
    );
  break;
  case 'folders':
    $a_user_prefs = array(
      'show_real_foldernames'  =>
      isset($_POST['_show_real_foldernames']) ? TRUE : FALSE,
        'show_real_foldernames' => isset($_POST['_show_real_foldernames']) ? true : false,
      'drafts_mbox' => rcube_utils::get_input_value('_drafts_mbox', rcube_utils::INPUT_POST, true),
      'sent_mbox'   => rcube_utils::get_input_value('_sent_mbox', rcube_utils::INPUT_POST, true),
      'junk_mbox'   => rcube_utils::get_input_value('_junk_mbox', rcube_utils::INPUT_POST, true),
@@ -139,15 +136,14 @@
$a_user_prefs = $plugin['prefs'];
// don't override these parameters
foreach ((array)$CONFIG['dont_override'] as $p)
foreach ((array)$CONFIG['dont_override'] as $p) {
  $a_user_prefs[$p] = $CONFIG[$p];
}
// verify some options
switch ($CURR_SECTION)
{
switch ($CURR_SECTION) {
  case 'general':
    // switch UI language
    if (isset($_POST['_language']) && $a_user_prefs['language'] != $_SESSION['language']) {
      $RCMAIL->load_language($a_user_prefs['language']);
@@ -171,40 +167,44 @@
    break;
  case 'mailbox':
    // force min size
    if ($a_user_prefs['mail_pagesize'] < 1)
    if ($a_user_prefs['mail_pagesize'] < 1) {
      $a_user_prefs['mail_pagesize'] = 10;
    }
    if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['mail_pagesize'] > $CONFIG['max_pagesize']))
    if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['mail_pagesize'] > $CONFIG['max_pagesize'])) {
      $a_user_prefs['mail_pagesize'] = (int) $CONFIG['max_pagesize'];
    }
    break;
  case 'addressbook':
    // force min size
    if ($a_user_prefs['addressbook_pagesize'] < 1)
    if ($a_user_prefs['addressbook_pagesize'] < 1) {
      $a_user_prefs['addressbook_pagesize'] = 10;
    }
    if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['addressbook_pagesize'] > $CONFIG['max_pagesize']))
    if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['addressbook_pagesize'] > $CONFIG['max_pagesize'])) {
      $a_user_prefs['addressbook_pagesize'] = (int) $CONFIG['max_pagesize'];
    }
    break;
  case 'folders':
    // special handling for 'default_folders'
    if (in_array('default_folders', (array)$CONFIG['dont_override'])) {
      foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p)
        foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p) {
        $a_user_prefs[$p] = $CONFIG[$p];
    } else {
        }
    }
    else {
      $a_user_prefs['default_folders'] = array('INBOX');
      foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p) {
        if ($a_user_prefs[$p])
            if ($a_user_prefs[$p]) {
          $a_user_prefs['default_folders'][] = $a_user_prefs[$p];
      }
    }
    }
    break;
}