pull/160/head
Aleksander Machniak 11 years ago
parent f5d2eef55c
commit d575e46067

@ -5,8 +5,8 @@
| program/steps/settings/about.inc | | program/steps/settings/about.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 |
| Copyright (C) 2011, Kolab Systems AG | | Copyright (C) 2011-2013, Kolab Systems AG |
| | | |
| Licensed under the GNU General Public License version 3 or | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -21,78 +21,83 @@
*/ */
$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) function rcmail_supportlink($attrib)
{ {
global $RCMAIL; global $RCMAIL;
if ($url = $RCMAIL->config->get('support_url')) { if ($url = $RCMAIL->config->get('support_url')) {
$label = $attrib['label'] ? $attrib['label'] : 'support'; $label = $attrib['label'] ? $attrib['label'] : 'support';
$attrib['href'] = $url; $attrib['href'] = $url;
return html::a($attrib, $RCMAIL->gettext($label));
} return html::a($attrib, $RCMAIL->gettext($label));
}
} }
function rcmail_plugins_list($attrib) function rcmail_plugins_list($attrib)
{ {
global $RCMAIL; global $RCMAIL;
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))
$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)))
$plugin_info[$req_name] = $req_info;
}
}
}
if (empty($plugin_info)) { if (!$attrib['id']) {
return ''; $attrib['id'] = 'rcmpluginlist';
} }
ksort($plugin_info, SORT_LOCALE_STRING); $plugins = array_filter((array) $RCMAIL->config->get('plugins'));
$plugin_info = array();
$table = new html_table($attrib); foreach ($plugins as $name) {
if ($info = $RCMAIL->plugins->get_info($name)) {
$plugin_info[$name] = $info;
}
}
// add table header // load info from required plugins, too
$table->add_header('name', $RCMAIL->gettext('plugin')); foreach ($plugin_info as $name => $info) {
$table->add_header('version', $RCMAIL->gettext('version')); if (is_array($info['required']) && !empty($info['required'])) {
$table->add_header('license', $RCMAIL->gettext('license')); foreach ($info['required'] as $req_name) {
$table->add_header('source', $RCMAIL->gettext('source')); if (!isset($plugin_info[$req_name]) && ($req_info = $RCMAIL->plugins->get_info($req_name))) {
$plugin_info[$req_name] = $req_info;
}
}
}
}
foreach ($plugin_info as $name => $data) { if (empty($plugin_info)) {
$uri = $data['src_uri'] ? $data['src_uri'] : $data['uri']; return '';
if ($uri && stripos($uri, 'http') !== 0) {
$uri = 'http://' . $uri;
} }
$table->add_row(); ksort($plugin_info, SORT_LOCALE_STRING);
$table->add('name', rcube::Q($data['name'] ? $data['name'] : $name));
$table->add('version', rcube::Q($data['version'])); $table = new html_table($attrib);
$table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> rcube::Q($data['license_uri'])),
rcube::Q($data['license'])) : $data['license']); // add table header
$table->add('source', $uri ? html::a(array('target' => '_blank', href=> rcube::Q($uri)), $table->add_header('name', $RCMAIL->gettext('plugin'));
rcube::Q($RCMAIL->gettext('download'))) : ''); $table->add_header('version', $RCMAIL->gettext('version'));
} $table->add_header('license', $RCMAIL->gettext('license'));
$table->add_header('source', $RCMAIL->gettext('source'));
foreach ($plugin_info as $name => $data) {
$uri = $data['src_uri'] ? $data['src_uri'] : $data['uri'];
if ($uri && stripos($uri, 'http') !== 0) {
$uri = 'http://' . $uri;
}
$table->add_row();
$table->add('name', rcube::Q($data['name'] ? $data['name'] : $name));
$table->add('version', rcube::Q($data['version']));
$table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> rcube::Q($data['license_uri'])),
rcube::Q($data['license'])) : $data['license']);
$table->add('source', $uri ? html::a(array('target' => '_blank', href=> rcube::Q($uri)),
rcube::Q($RCMAIL->gettext('download'))) : '');
}
return $table->show(); 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');

@ -5,7 +5,7 @@
| program/steps/settings/delete_identity.inc | | program/steps/settings/delete_identity.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -23,29 +23,33 @@ $iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_GPC);
// check request token // check request token
if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(rcube_utils::INPUT_GPC)) { if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(rcube_utils::INPUT_GPC)) {
$OUTPUT->show_message('invalidrequest', 'error'); $OUTPUT->show_message('invalidrequest', 'error');
$RCMAIL->overwrite_action('identities'); $RCMAIL->overwrite_action('identities');
return; 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));
$plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid));
$deleted = !$plugin['abort'] ? $RCMAIL->user->delete_identity($iid) : $plugin['result']; $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); $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
else }
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving'), 'error', null, false); else {
$msg = $plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving');
$OUTPUT->show_message($msg, 'error', null, false);
}
// send response // send response
if ($OUTPUT->ajax_call) if ($OUTPUT->ajax_call) {
$OUTPUT->send(); $OUTPUT->send();
}
} }
if ($OUTPUT->ajax_call) if ($OUTPUT->ajax_call) {
exit; exit;
}
// go to identities page // go to identities page
$RCMAIL->overwrite_action('identities'); $RCMAIL->overwrite_action('identities');

@ -5,7 +5,7 @@
| program/steps/settings/edit_folder.inc | | program/steps/settings/edit_folder.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -19,6 +19,16 @@
+-----------------------------------------------------------------------+ +-----------------------------------------------------------------------+
*/ */
// 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 // WARNING: folder names in UI are encoded with RCUBE_CHARSET
function rcmail_folder_form($attrib) function rcmail_folder_form($attrib)
@ -256,7 +266,8 @@ function rcmail_folder_form($attrib)
foreach ($tab['fieldsets'] as $fieldset) { foreach ($tab['fieldsets'] as $fieldset) {
$subcontent = rcmail_get_form_part($fieldset, $attrib); $subcontent = rcmail_get_form_part($fieldset, $attrib);
if ($subcontent) { 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 @@ function rcmail_get_form_part($form, $attrib = array())
return $content; 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');

@ -5,7 +5,7 @@
| program/steps/settings/edit_identity.inc | | program/steps/settings/edit_identity.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -23,152 +23,158 @@ define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
// edit-identity // edit-identity
if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='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))
$OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']); if (is_array($IDENTITY_RECORD)) {
else { $OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']);
$OUTPUT->show_message('dberror', 'error'); }
// go to identities page else {
$RCMAIL->overwrite_action('identities'); $OUTPUT->show_message('dberror', 'error');
return; // go to identities page
} $RCMAIL->overwrite_action('identities');
return;
}
} }
// add-identity // add-identity
else { else {
if (IDENTITIES_LEVEL > 1) { if (IDENTITIES_LEVEL > 1) {
$OUTPUT->show_message('opnotpermitted', 'error'); $OUTPUT->show_message('opnotpermitted', 'error');
// go to identities page // go to identities page
$RCMAIL->overwrite_action('identities'); $RCMAIL->overwrite_action('identities');
return; return;
} }
else if (IDENTITIES_LEVEL == 1) { else if (IDENTITIES_LEVEL == 1) {
$IDENTITY_RECORD['email'] = $RCMAIL->get_user_email(); $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) function rcube_identity_form($attrib)
{ {
global $IDENTITY_RECORD, $RCMAIL, $OUTPUT; global $IDENTITY_RECORD, $RCMAIL, $OUTPUT;
// Add HTML editor script(s) // Add HTML editor script(s)
$RCMAIL->html_editor('identity'); $RCMAIL->html_editor('identity');
// add some labels to client // add some labels to client
$OUTPUT->add_label('noemailwarning', 'nonamewarning', 'converting', 'editorwarning'); $OUTPUT->add_label('noemailwarning', 'nonamewarning', 'converting', 'editorwarning');
$i_size = !empty($attrib['size']) ? $attrib['size'] : 40; $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
$t_rows = !empty($attrib['textarearows']) ? $attrib['textarearows'] : 6; $t_rows = !empty($attrib['textarearows']) ? $attrib['textarearows'] : 6;
$t_cols = !empty($attrib['textareacols']) ? $attrib['textareacols'] : 40; $t_cols = !empty($attrib['textareacols']) ? $attrib['textareacols'] : 40;
// list of available cols // list of available cols
$form = array( $form = array(
'addressing' => array( 'addressing' => array(
'name' => $RCMAIL->gettext('settings'), 'name' => $RCMAIL->gettext('settings'),
'content' => array( 'content' => array(
'name' => array('type' => 'text', 'size' => $i_size), 'name' => array('type' => 'text', 'size' => $i_size),
'email' => array('type' => 'text', 'size' => $i_size), 'email' => array('type' => 'text', 'size' => $i_size),
'organization' => array('type' => 'text', 'size' => $i_size), 'organization' => array('type' => 'text', 'size' => $i_size),
'reply-to' => array('type' => 'text', 'size' => $i_size), 'reply-to' => array('type' => 'text', 'size' => $i_size),
'bcc' => array('type' => 'text', 'size' => $i_size), 'bcc' => array('type' => 'text', 'size' => $i_size),
'standard' => array('type' => 'checkbox', 'label' => $RCMAIL->gettext('setdefault')), 'standard' => array('type' => 'checkbox', 'label' => $RCMAIL->gettext('setdefault')),
)), )),
'signature' => array( 'signature' => array(
'name' => $RCMAIL->gettext('signature'), 'name' => $RCMAIL->gettext('signature'),
'content' => array( 'content' => array(
'signature' => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows, 'signature' => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows,
'spellcheck' => true), 'spellcheck' => true),
'html_signature' => array('type' => 'checkbox', 'label' => $RCMAIL->gettext('htmlsignature'), 'html_signature' => array('type' => 'checkbox',
'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'), 'label' => $RCMAIL->gettext('htmlsignature'),
)) 'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'),
); ))
);
// Enable TinyMCE editor
if ($IDENTITY_RECORD['html_signature']) { // Enable TinyMCE editor
$form['signature']['content']['signature']['class'] = 'mce_editor'; if ($IDENTITY_RECORD['html_signature']) {
$form['signature']['content']['signature']['is_escaped'] = true; $form['signature']['content']['signature']['class'] = 'mce_editor';
$form['signature']['content']['signature']['is_escaped'] = true;
// Correctly handle HTML entities in HTML editor (#1488483)
$IDENTITY_RECORD['signature'] = htmlspecialchars($IDENTITY_RECORD['signature'], ENT_NOQUOTES, RCUBE_CHARSET); // Correctly handle HTML entities in HTML editor (#1488483)
} $IDENTITY_RECORD['signature'] = htmlspecialchars($IDENTITY_RECORD['signature'], ENT_NOQUOTES, RCUBE_CHARSET);
// disable some field according to access level
if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) {
$form['addressing']['content']['email']['disabled'] = true;
$form['addressing']['content']['email']['class'] = 'disabled';
}
if (IDENTITIES_LEVEL == 4) {
foreach($form['addressing']['content'] as $formfield => $value){
$form['addressing']['content'][$formfield]['disabled'] = true;
$form['addressing']['content'][$formfield]['class'] = 'disabled';
} }
}
$IDENTITY_RECORD['email'] = rcube_utils::idn_to_utf8($IDENTITY_RECORD['email']); // disable some field according to access level
if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) {
$form['addressing']['content']['email']['disabled'] = true;
$form['addressing']['content']['email']['class'] = 'disabled';
}
// Allow plugins to modify identity form content if (IDENTITIES_LEVEL == 4) {
$plugin = $RCMAIL->plugins->exec_hook('identity_form', array( foreach($form['addressing']['content'] as $formfield => $value){
'form' => $form, 'record' => $IDENTITY_RECORD)); $form['addressing']['content'][$formfield]['disabled'] = true;
$form['addressing']['content'][$formfield]['class'] = 'disabled';
}
}
$form = $plugin['form']; $IDENTITY_RECORD['email'] = rcube_utils::idn_to_utf8($IDENTITY_RECORD['email']);
$IDENTITY_RECORD = $plugin['record'];
// Set form tags and hidden fields // Allow plugins to modify identity form content
list($form_start, $form_end) = get_form_tags($attrib, 'save-identity', $plugin = $RCMAIL->plugins->exec_hook('identity_form', array(
intval($IDENTITY_RECORD['identity_id']), 'form' => $form, 'record' => $IDENTITY_RECORD));
array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id']));
unset($plugin); $form = $plugin['form'];
unset($attrib['form'], $attrib['id']); $IDENTITY_RECORD = $plugin['record'];
// return the complete edit form as table // Set form tags and hidden fields
$out = "$form_start\n"; list($form_start, $form_end) = get_form_tags($attrib, 'save-identity',
intval($IDENTITY_RECORD['identity_id']),
array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id']));
foreach ($form as $fieldset) { unset($plugin);
if (empty($fieldset['content'])) unset($attrib['form'], $attrib['id']);
continue;
$content = ''; // return the complete edit form as table
if (is_array($fieldset['content'])) { $out = "$form_start\n";
$table = new html_table(array('cols' => 2));
foreach ($fieldset['content'] as $col => $colprop) {
$colprop['id'] = 'rcmfd_'.$col;
$label = !empty($colprop['label']) ? $colprop['label'] : foreach ($form as $fieldset) {
$RCMAIL->gettext(str_replace('-', '', $col)); if (empty($fieldset['content'])) {
continue;
}
$value = !empty($colprop['value']) ? $colprop['value'] : $content = '';
rcube_output::get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']); if (is_array($fieldset['content'])) {
$table = new html_table(array('cols' => 2));
$table->add('title', html::label($colprop['id'], rcube::Q($label))); foreach ($fieldset['content'] as $col => $colprop) {
$table->add(null, $value); $colprop['id'] = 'rcmfd_'.$col;
}
$content = $table->show($attrib);
}
else {
$content = $fieldset['content'];
}
$out .= html::tag('fieldset', null, html::tag('legend', null, rcube::Q($fieldset['name'])) . $content) ."\n"; $label = !empty($colprop['label']) ? $colprop['label'] :
} $RCMAIL->gettext(str_replace('-', '', $col));
$out .= $form_end; $value = !empty($colprop['value']) ? $colprop['value'] :
rcube_output::get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']);
return $out; $table->add('title', html::label($colprop['id'], rcube::Q($label)));
} $table->add(null, $value);
}
$OUTPUT->include_script('list.js'); $content = $table->show($attrib);
$OUTPUT->add_handler('identityform', 'rcube_identity_form'); }
$OUTPUT->set_env('identities_level', IDENTITIES_LEVEL); else {
$OUTPUT->add_label('deleteidentityconfirm'); $content = $fieldset['content'];
}
$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'); $content = html::tag('legend', null, rcube::Q($fieldset['name'])) . $content;
$out .= html::tag('fieldset', null, $content) . "\n";
}
$out .= $form_end;
return $out;
}

@ -5,7 +5,7 @@
| program/steps/settings/edit_prefs.inc | | program/steps/settings/edit_prefs.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -19,65 +19,65 @@
+-----------------------------------------------------------------------+ +-----------------------------------------------------------------------+
*/ */
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); $CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_GPC);
list($SECTIONS,) = rcmail_user_prefs($CURR_SECTION); 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) function rcmail_user_prefs_form($attrib)
{ {
global $RCMAIL, $CURR_SECTION, $SECTIONS; global $RCMAIL, $CURR_SECTION, $SECTIONS;
// add some labels to client // add some labels to client
$RCMAIL->output->add_label('nopagesizewarning'); $RCMAIL->output->add_label('nopagesizewarning');
unset($attrib['form']); unset($attrib['form']);
list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null, list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null,
array('name' => '_section', 'value' => $CURR_SECTION)); array('name' => '_section', 'value' => $CURR_SECTION));
$out = $form_start; $out = $form_start;
foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $class => $block) { foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $class => $block) {
if (!empty($block['options'])) { if (!empty($block['options'])) {
$table = new html_table(array('cols' => 2)); $table = new html_table(array('cols' => 2));
foreach ($block['options'] as $option) { foreach ($block['options'] as $option) {
if (isset($option['title'])) { if (isset($option['title'])) {
$table->add('title', $option['title']); $table->add('title', $option['title']);
$table->add(null, $option['content']); $table->add(null, $option['content']);
}
else {
$table->add(array('colspan' => 2), $option['content']);
}
}
$out .= html::tag('fieldset', $class, html::tag('legend', null, $block['name']) . $table->show($attrib));
} }
else { else if (!empty($block['content'])) {
$table->add(array('colspan' => 2), $option['content']); $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $block['content']);
} }
}
$out .= html::tag('fieldset', $class, html::tag('legend', null, $block['name']) . $table->show($attrib));
} }
else if (!empty($block['content'])) {
$out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $block['content']);
}
}
return $out . $form_end; return $out . $form_end;
} }
function rcmail_prefs_section_name() function rcmail_prefs_section_name()
{ {
global $SECTIONS, $CURR_SECTION; global $SECTIONS, $CURR_SECTION;
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');
return $SECTIONS[$CURR_SECTION]['section'];
}

@ -70,6 +70,12 @@ if ($RCMAIL->action == 'save-response' && isset($_POST['_name']) && !$RESPONSE_R
} }
} }
$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) function rcube_response_form($attrib)
{ {
@ -88,20 +94,15 @@ function rcube_response_form($attrib)
$label = $RCMAIL->gettext('responsename'); $label = $RCMAIL->gettext('responsename');
$table->add('title', html::label('ffname', rcube::Q($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('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 .= $table->show($attrib);
$out .= $form_end; $out .= $form_end;
return $out; 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');

@ -378,8 +378,9 @@ function rcmail_folder_frame($attrib)
{ {
global $OUTPUT; global $OUTPUT;
if (!$attrib['id']) if (!$attrib['id']) {
$attrib['id'] = 'rcmfolderframe'; $attrib['id'] = 'rcmfolderframe';
}
return $OUTPUT->frame($attrib, true); return $OUTPUT->frame($attrib, true);
} }
@ -428,4 +429,3 @@ function rcmail_rename_folder($oldname, $newname)
return false; return false;
} }

@ -5,7 +5,7 @@
| program/steps/settings/func.inc | | program/steps/settings/func.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -23,6 +23,30 @@ if (!$OUTPUT->ajax_call) {
$OUTPUT->set_pagetitle($RCMAIL->gettext('preferences')); $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() // similar function as /steps/settings/identities.inc::rcmail_identity_frame()
function rcmail_preferences_frame($attrib) function rcmail_preferences_frame($attrib)
{ {
@ -1273,12 +1297,14 @@ function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class
$display_name = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level) $display_name = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level)
. rcube::Q($protected ? $RCMAIL->localize_foldername($name) : rcube_charset::convert($foldersplit[$level], 'UTF7-IMAP')); . 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, $OUTPUT->command('add_folder_row', $name_utf8, $display_name, $protected, $subscribe,
false, $class_name); false, $class_name);
else }
else {
$OUTPUT->command('replace_folder_row', rcube_charset::convert($oldname, 'UTF7-IMAP'), $OUTPUT->command('replace_folder_row', rcube_charset::convert($oldname, 'UTF7-IMAP'),
$name_utf8, $display_name, $protected, $class_name); $name_utf8, $display_name, $protected, $class_name);
}
} }
/** /**
@ -1295,18 +1321,18 @@ function rcmail_settings_tabs($attrib)
array('command' => 'preferences', 'type' => 'link', 'label' => 'preferences', 'title' => 'editpreferences'), array('command' => 'preferences', 'type' => 'link', 'label' => 'preferences', 'title' => 'editpreferences'),
array('command' => 'folders', 'type' => 'link', 'label' => 'folders', 'title' => 'managefolders'), array('command' => 'folders', 'type' => 'link', 'label' => 'folders', 'title' => 'managefolders'),
array('command' => 'identities', 'type' => 'link', 'label' => 'identities', 'title' => 'manageidentities'), array('command' => 'identities', 'type' => 'link', 'label' => 'identities', 'title' => 'manageidentities'),
array('command' => 'responses', 'type' => 'link', 'label' => 'responses', 'title' => 'editresponses'), array('command' => 'responses', 'type' => 'link', 'label' => 'responses', 'title' => 'editresponses'),
); );
// get all identites from DB and define list of cols to be displayed // get all identites from DB and define list of cols to be displayed
$plugin = $RCMAIL->plugins->exec_hook('settings_actions', array( $plugin = $RCMAIL->plugins->exec_hook('settings_actions', array(
'actions' => $default_actions, 'actions' => $default_actions,
'attrib' => $attrib, 'attrib' => $attrib,
)); ));
$attrib = $plugin['attrib']; $attrib = $plugin['attrib'];
$tagname = $attrib['tagname']; $tagname = $attrib['tagname'];
$tabs = array(); $tabs = array();
foreach ($plugin['actions'] as $k => $action) { foreach ($plugin['actions'] as $k => $action) {
if (!$action['command'] && !$action['href'] && $action['action']) { if (!$action['command'] && !$action['href'] && $action['action']) {
@ -1314,13 +1340,15 @@ function rcmail_settings_tabs($attrib)
} }
$button = $OUTPUT->button($action); $button = $OUTPUT->button($action);
$attr = $attrib; $attr = $attrib;
$cmd = $action['action'] ? $action['action'] : $action['command']; $cmd = $action['action'] ? $action['action'] : $action['command'];
$id = $action['id'] ? $action['id'] : $cmd; $id = $action['id'] ? $action['id'] : $cmd;
if (!empty($id)) { if (!empty($id)) {
$attr['id'] = preg_replace('/[^a-z0-9]/i', '', $attrib['idprefix'] . $id); $attr['id'] = preg_replace('/[^a-z0-9]/i', '', $attrib['idprefix'] . $id);
} }
$classnames = array($attrib['class']); $classnames = array($attrib['class']);
if (!empty($action['class'])) { if (!empty($action['class'])) {
$classnames[] = $action['class']; $classnames[] = $action['class'];
@ -1331,33 +1359,10 @@ function rcmail_settings_tabs($attrib)
if ($RCMAIL->action == $cmd) { if ($RCMAIL->action == $cmd) {
$classnames[] = $attrib['selclass']; $classnames[] = $attrib['selclass'];
} }
$attr['class'] = join(' ', $classnames); $attr['class'] = join(' ', $classnames);
$tabs[] = html::tag($tagname, $attr, $button, html::$common_attrib); $tabs[] = html::tag($tagname, $attr, $button, html::$common_attrib);
} }
return join('', $tabs); 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',
));

@ -5,7 +5,7 @@
| program/steps/settings/identities.inc | | program/steps/settings/identities.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -24,20 +24,21 @@ define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
$OUTPUT->set_pagetitle($RCMAIL->gettext('identities')); $OUTPUT->set_pagetitle($RCMAIL->gettext('identities'));
$OUTPUT->include_script('list.js'); $OUTPUT->include_script('list.js');
// similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
function rcmail_identity_frame($attrib)
{
global $OUTPUT;
if (!$attrib['id'])
$attrib['id'] = 'rcmIdentityFrame';
return $OUTPUT->frame($attrib, true);
}
$OUTPUT->add_handler('identityframe', 'rcmail_identity_frame'); $OUTPUT->add_handler('identityframe', 'rcmail_identity_frame');
$OUTPUT->set_env('identities_level', IDENTITIES_LEVEL); $OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
$OUTPUT->add_label('deleteidentityconfirm'); $OUTPUT->add_label('deleteidentityconfirm');
$OUTPUT->send('identities'); $OUTPUT->send('identities');
// similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
function rcmail_identity_frame($attrib)
{
global $OUTPUT;
if (!$attrib['id']) {
$attrib['id'] = 'rcmIdentityFrame';
}
return $OUTPUT->frame($attrib, true);
}

@ -51,7 +51,6 @@ if (!empty($_POST['_insert'])) {
$RCMAIL->output->send(); $RCMAIL->output->send();
} }
if ($RCMAIL->action == 'delete-response') { if ($RCMAIL->action == 'delete-response') {
if ($key = rcube_utils::get_input_value('_key', rcube_utils::INPUT_GPC)) { if ($key = rcube_utils::get_input_value('_key', rcube_utils::INPUT_GPC)) {
$responses = $RCMAIL->get_compose_responses(false, true); $responses = $RCMAIL->get_compose_responses(false, true);
@ -80,6 +79,14 @@ if ($RCMAIL->action == 'delete-response') {
$OUTPUT->set_pagetitle($RCMAIL->gettext('responses')); $OUTPUT->set_pagetitle($RCMAIL->gettext('responses'));
$OUTPUT->include_script('list.js'); $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 @@ function rcmail_responses_list($attrib)
return $out; return $out;
} }
// similar function as /steps/addressbook/func.inc::rcmail_contact_frame() // similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
function rcmail_response_frame($attrib) function rcmail_response_frame($attrib)
{ {
@ -116,13 +122,6 @@ function rcmail_response_frame($attrib)
} }
$OUTPUT->set_env('contentframe', $attrib['id']); $OUTPUT->set_env('contentframe', $attrib['id']);
return $OUTPUT->frame($attrib, true); return $OUTPUT->frame($attrib, true);
} }
$OUTPUT->add_handlers(array(
'responseframe' => 'rcmail_response_frame',
'responseslist' => 'rcmail_responses_list',
));
$OUTPUT->add_label('deleteresponseconfirm');
$OUTPUT->send('responses');

@ -1,6 +1,6 @@
<?php <?php
/** /*
+-----------------------------------------------------------------------+ +-----------------------------------------------------------------------+
| program/steps/settings/save_folder.inc | | program/steps/settings/save_folder.inc |
| | | |
@ -24,7 +24,6 @@
// init IMAP connection // init IMAP connection
$STORAGE = $RCMAIL->get_storage(); $STORAGE = $RCMAIL->get_storage();
$name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true)); $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); $old = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true);
$path = rcube_utils::get_input_value('_parent', rcube_utils::INPUT_POST, true); $path = rcube_utils::get_input_value('_parent', rcube_utils::INPUT_POST, true);
@ -98,7 +97,6 @@ else {
// create a new mailbox // create a new mailbox
if (!$error && !strlen($old)) { if (!$error && !strlen($old)) {
$folder['subscribe'] = true; $folder['subscribe'] = true;
$plugin = $RCMAIL->plugins->exec_hook('folder_create', array('record' => $folder)); $plugin = $RCMAIL->plugins->exec_hook('folder_create', array('record' => $folder));
@ -136,7 +134,6 @@ if (!$error && !strlen($old)) {
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
} }
} }
// update a mailbox // update a mailbox
else if (!$error) { else if (!$error) {
$plugin = $RCMAIL->plugins->exec_hook('folder_update', array('record' => $folder)); $plugin = $RCMAIL->plugins->exec_hook('folder_update', array('record' => $folder));

@ -5,7 +5,7 @@
| program/steps/settings/save_identity.inc | | program/steps/settings/save_identity.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -21,161 +21,173 @@
define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0))); define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
$a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature', 'html_signature'); $a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature', 'html_signature');
$a_boolean_cols = array('standard', 'html_signature'); $a_boolean_cols = array('standard', 'html_signature');
$updated = $default_id = false; $updated = $default_id = false;
// check input // check input
if (IDENTITIES_LEVEL != 4 && (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3))) { if (IDENTITIES_LEVEL != 4 && (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3))) {
$OUTPUT->show_message('formincomplete', 'warning'); $OUTPUT->show_message('formincomplete', 'warning');
$RCMAIL->overwrite_action('edit-identity'); $RCMAIL->overwrite_action('edit-identity');
return; return;
} }
$save_data = array(); $save_data = array();
foreach ($a_save_cols as $col) { foreach ($a_save_cols as $col) {
$fname = '_'.$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); $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 // set "off" values for checkboxes that were not checked, and therefore
// not included in the POST body. // not included in the POST body.
foreach ($a_boolean_cols as $col) { foreach ($a_boolean_cols as $col) {
$fname = '_' . $col; $fname = '_' . $col;
if (!isset($_POST[$fname])) if (!isset($_POST[$fname])) {
$save_data[$col] = 0; $save_data[$col] = 0;
}
} }
// unset email address if user has no rights to change it // unset email address if user has no rights to change it
if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) { if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) {
unset($save_data['email']); unset($save_data['email']);
} }
// unset all fields except signature // unset all fields except signature
else if (IDENTITIES_LEVEL == 4) { else if (IDENTITIES_LEVEL == 4) {
foreach ($save_data as $idx => $value) { foreach ($save_data as $idx => $value) {
if ($idx != 'signature' && $idx != 'html_signature') { if ($idx != 'signature' && $idx != 'html_signature') {
unset($save_data[$idx]); unset($save_data[$idx]);
}
} }
}
} }
// Validate e-mail addresses // Validate e-mail addresses
$email_checks = array(rcube_utils::idn_to_ascii($save_data['email'])); $email_checks = array(rcube_utils::idn_to_ascii($save_data['email']));
foreach (array('reply-to', 'bcc') as $item) { 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']); $email_checks[] = rcube_utils::idn_to_ascii($rcpt['mailto']);
}
} }
foreach ($email_checks as $email) { foreach ($email_checks as $email) {
if ($email && !rcube_utils::check_email($email)) { if ($email && !rcube_utils::check_email($email)) {
// show error message // show error message
$OUTPUT->show_message('emailformaterror', 'error', array('email' => rcube_utils::idn_to_utf8($email)), false); $OUTPUT->show_message('emailformaterror', 'error', array('email' => rcube_utils::idn_to_utf8($email)), false);
$RCMAIL->overwrite_action('edit-identity'); $RCMAIL->overwrite_action('edit-identity');
return; return;
} }
} }
// XSS protection in HTML signature (#1489251) // XSS protection in HTML signature (#1489251)
if (!empty($save_data['signature']) && !empty($save_data['html_signature'])) { if (!empty($save_data['signature']) && !empty($save_data['html_signature'])) {
$save_data['signature'] = rcmail_wash_html($save_data['signature']); $save_data['signature'] = rcmail_wash_html($save_data['signature']);
// clear POST data of signature, we want to use safe content // clear POST data of signature, we want to use safe content
// when the form is displayed again // when the form is displayed again
unset($_POST['_signature']); unset($_POST['_signature']);
} }
// update an existing contact // update an existing contact
if ($_POST['_iid']) { if ($_POST['_iid']) {
$iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_POST); $iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_POST);
if (in_array(IDENTITIES_LEVEL, array(1,3,4))) { if (in_array(IDENTITIES_LEVEL, array(1,3,4))) {
// merge with old identity data, fixes #1488834 // merge with old identity data, fixes #1488834
$identity = $RCMAIL->user->get_identity($iid); $identity = $RCMAIL->user->get_identity($iid);
$save_data = array_merge($identity, $save_data); $save_data = array_merge($identity, $save_data);
unset($save_data['changed'], $save_data['del'], $save_data['user_id'], $save_data['identity_id']);
} 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']; $plugin = $RCMAIL->plugins->exec_hook('identity_update', array('id' => $iid, 'record' => $save_data));
$save_data = $plugin['record'];
if ($save_data['email'])
$save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']); if ($save_data['email']) {
if (!$plugin['abort']) $save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']);
$updated = $RCMAIL->user->update_identity($iid, $save_data);
else
$updated = $plugin['result'];
if ($updated) {
$OUTPUT->show_message('successfullysaved', 'confirmation');
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']) .'>')));
} }
}
else {
// show error message
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
$RCMAIL->overwrite_action('edit-identity');
return;
}
}
if (!$plugin['abort'])
$updated = $RCMAIL->user->update_identity($iid, $save_data);
else
$updated = $plugin['result'];
if ($updated) {
$OUTPUT->show_message('successfullysaved', 'confirmation');
if (!empty($save_data['standard'])) {
$default_id = $iid;
}
if ($_POST['_framed']) {
// update the changed col in list
$name = $save_data['name'] . ' <' . rcube_utils::idn_to_utf8($save_data['email']) .'>';
$OUTPUT->command('parent.update_identity_row', $iid, rcube::Q(trim($name)));
}
}
else {
// show error message
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
$RCMAIL->overwrite_action('edit-identity');
return;
}
}
// insert a new identity record // insert a new identity record
else if (IDENTITIES_LEVEL < 2) { else if (IDENTITIES_LEVEL < 2) {
if (IDENTITIES_LEVEL == 1) { if (IDENTITIES_LEVEL == 1) {
$save_data['email'] = $RCMAIL->get_user_email(); $save_data['email'] = $RCMAIL->get_user_email();
} }
$plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data)); $plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data));
$save_data = $plugin['record']; $save_data = $plugin['record'];
if ($save_data['email']) if ($save_data['email']) {
$save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']); $save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']);
}
if (!$plugin['abort']) if (!$plugin['abort'])
$insert_id = $save_data['email'] ? $RCMAIL->user->insert_identity($save_data) : null; $insert_id = $save_data['email'] ? $RCMAIL->user->insert_identity($save_data) : null;
else else
$insert_id = $plugin['result']; $insert_id = $plugin['result'];
if ($insert_id) { if ($insert_id) {
$OUTPUT->show_message('successfullysaved', 'confirmation', null, false); $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
$_GET['_iid'] = $insert_id; $_GET['_iid'] = $insert_id;
if (!empty($save_data['standard'])) if (!empty($save_data['standard'])) {
$default_id = $insert_id; $default_id = $insert_id;
}
if ($_POST['_framed']) { if ($_POST['_framed']) {
// add a new row to the list // 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 {
// show error message
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
$RCMAIL->overwrite_action('edit-identity');
return;
} }
}
else {
// show error message
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
$RCMAIL->overwrite_action('edit-identity');
return;
}
} }
else else {
$OUTPUT->show_message('opnotpermitted', 'error'); $OUTPUT->show_message('opnotpermitted', 'error');
}
// mark all other identities as 'not-default' // mark all other identities as 'not-default'
if ($default_id) if ($default_id) {
$RCMAIL->user->set_default($default_id); $RCMAIL->user->set_default($default_id);
}
// go to next step // go to next step
if (!empty($_REQUEST['_framed'])) { if (!empty($_REQUEST['_framed'])) {
$RCMAIL->overwrite_action('edit-identity'); $RCMAIL->overwrite_action('edit-identity');
}
else {
$RCMAIL->overwrite_action('identities');
} }
else
$RCMAIL->overwrite_action('identities');
/** /**
@ -190,11 +202,11 @@ function rcmail_wash_html($html)
// clean HTML with washhtml by Frederic Motte // clean HTML with washhtml by Frederic Motte
$wash_opts = array( $wash_opts = array(
'show_washed' => false, 'show_washed' => false,
'allow_remote' => 1, 'allow_remote' => 1,
'charset' => RCUBE_CHARSET, 'charset' => RCUBE_CHARSET,
'html_elements' => array('body', 'link'), 'html_elements' => array('body', 'link'),
'html_attribs' => array('rel', 'type'), 'html_attribs' => array('rel', 'type'),
); );
// initialize HTML washer // initialize HTML washer
@ -211,5 +223,5 @@ function rcmail_wash_html($html)
// remove unwanted comments and tags (produced by washtml) // remove unwanted comments and tags (produced by washtml)
$html = preg_replace(array('/<!--[^>]+-->/', '/<\/?body>/'), '', $html); $html = preg_replace(array('/<!--[^>]+-->/', '/<\/?body>/'), '', $html);
return $html; return $html;
} }

@ -5,7 +5,7 @@
| program/steps/settings/save_prefs.inc | | program/steps/settings/save_prefs.inc |
| | | |
| This file is part of the Roundcube Webmail client | | 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 | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -20,190 +20,190 @@
*/ */
$CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_POST); $CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_POST);
$a_user_prefs = array(); $a_user_prefs = array();
// set options for specified section // set options for specified section
switch ($CURR_SECTION) switch ($CURR_SECTION) {
{ case 'general':
case 'general':
$a_user_prefs = array( $a_user_prefs = array(
'language' => isset($_POST['_language']) ? rcube_utils::get_input_value('_language', rcube_utils::INPUT_POST) : $CONFIG['language'], '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'], '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'], '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'), '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'], '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'], 'skin' => isset($_POST['_skin']) ? rcube_utils::get_input_value('_skin', rcube_utils::INPUT_POST) : $CONFIG['skin'],
); );
// compose derived date/time format strings // compose derived date/time format strings
if ((isset($_POST['_date_format']) || isset($_POST['_time_format'])) && $a_user_prefs['date_format'] && $a_user_prefs['time_format']) { if ((isset($_POST['_date_format']) || isset($_POST['_time_format'])) && $a_user_prefs['date_format'] && $a_user_prefs['time_format']) {
$a_user_prefs['date_short'] = 'D ' . $a_user_prefs['time_format']; $a_user_prefs['date_short'] = 'D ' . $a_user_prefs['time_format'];
$a_user_prefs['date_long'] = $a_user_prefs['date_format'] . ' ' . $a_user_prefs['time_format']; $a_user_prefs['date_long'] = $a_user_prefs['date_format'] . ' ' . $a_user_prefs['time_format'];
} }
break; break;
case 'mailbox': case 'mailbox':
$a_user_prefs = array( $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'], '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, 'autoexpand_threads' => isset($_POST['_autoexpand_threads']) ? intval($_POST['_autoexpand_threads']) : 0,
'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 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'], 'mail_pagesize' => is_numeric($_POST['_mail_pagesize']) ? max(2, intval($_POST['_mail_pagesize'])) : $CONFIG['mail_pagesize'],
); );
break; break;
case 'mailview': case 'mailview':
$a_user_prefs = array( $a_user_prefs = array(
'message_extwin' => intval($_POST['_message_extwin']), 'message_extwin' => intval($_POST['_message_extwin']),
'message_show_email' => isset($_POST['_message_show_email']) ? TRUE : FALSE, 'message_show_email' => isset($_POST['_message_show_email']) ? true : false,
'prefer_html' => isset($_POST['_prefer_html']) ? TRUE : FALSE, 'prefer_html' => isset($_POST['_prefer_html']) ? true : false,
'inline_images' => isset($_POST['_inline_images']) ? TRUE : FALSE, 'inline_images' => isset($_POST['_inline_images']) ? true : false,
'show_images' => isset($_POST['_show_images']) ? intval($_POST['_show_images']) : 0, '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), 'default_charset' => rcube_utils::get_input_value('_default_charset', rcube_utils::INPUT_POST),
); );
break; break;
case 'compose': case 'compose':
$a_user_prefs = array( $a_user_prefs = array(
'compose_extwin' => intval($_POST['_compose_extwin']), 'compose_extwin' => intval($_POST['_compose_extwin']),
'htmleditor' => intval($_POST['_htmleditor']), 'htmleditor' => intval($_POST['_htmleditor']),
'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0, '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, 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0,
'force_7bit' => isset($_POST['_force_7bit']) ? TRUE : FALSE, 'force_7bit' => isset($_POST['_force_7bit']) ? true : false,
'mdn_default' => isset($_POST['_mdn_default']) ? TRUE : FALSE, 'mdn_default' => isset($_POST['_mdn_default']) ? true : false,
'dsn_default' => isset($_POST['_dsn_default']) ? TRUE : FALSE, 'dsn_default' => isset($_POST['_dsn_default']) ? true : false,
'reply_same_folder' => isset($_POST['_reply_same_folder']) ? TRUE : FALSE, 'reply_same_folder' => isset($_POST['_reply_same_folder']) ? true : false,
'spellcheck_before_send' => isset($_POST['_spellcheck_before_send']) ? TRUE : FALSE, 'spellcheck_before_send' => isset($_POST['_spellcheck_before_send']) ? true : false,
'spellcheck_ignore_syms' => isset($_POST['_spellcheck_ignore_syms']) ? TRUE : FALSE, 'spellcheck_ignore_syms' => isset($_POST['_spellcheck_ignore_syms']) ? true : false,
'spellcheck_ignore_nums' => isset($_POST['_spellcheck_ignore_nums']) ? TRUE : FALSE, 'spellcheck_ignore_nums' => isset($_POST['_spellcheck_ignore_nums']) ? true : false,
'spellcheck_ignore_caps' => isset($_POST['_spellcheck_ignore_caps']) ? TRUE : FALSE, 'spellcheck_ignore_caps' => isset($_POST['_spellcheck_ignore_caps']) ? true : false,
'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1, 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1,
'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0, 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0,
'strip_existing_sig' => isset($_POST['_strip_existing_sig']), 'strip_existing_sig' => isset($_POST['_strip_existing_sig']),
'default_font' => rcube_utils::get_input_value('_default_font', rcube_utils::INPUT_POST), 'default_font' => rcube_utils::get_input_value('_default_font', rcube_utils::INPUT_POST),
'default_font_size' => rcube_utils::get_input_value('_default_font_size', rcube_utils::INPUT_POST), 'default_font_size' => rcube_utils::get_input_value('_default_font_size', rcube_utils::INPUT_POST),
'reply_all_mode' => intval($_POST['_reply_all_mode']), 'reply_all_mode' => intval($_POST['_reply_all_mode']),
'forward_attachment' => !empty($_POST['_forward_attachment']), 'forward_attachment' => !empty($_POST['_forward_attachment']),
); );
break; break;
case 'addressbook': case 'addressbook':
$a_user_prefs = array( $a_user_prefs = array(
'default_addressbook' => rcube_utils::get_input_value('_default_addressbook', rcube_utils::INPUT_POST, true), '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_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_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'], 'addressbook_pagesize' => is_numeric($_POST['_addressbook_pagesize']) ? max(2, intval($_POST['_addressbook_pagesize'])) : $CONFIG['addressbook_pagesize'],
); );
break; break;
case 'server': case 'server':
$a_user_prefs = array( $a_user_prefs = array(
'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE, 'read_when_deleted' => isset($_POST['_read_when_deleted']) ? true : false,
'skip_deleted' => isset($_POST['_skip_deleted']) ? TRUE : FALSE, 'skip_deleted' => isset($_POST['_skip_deleted']) ? true : false,
'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? TRUE : FALSE, 'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? true : false,
'delete_always' => isset($_POST['_delete_always']) ? TRUE : FALSE, 'delete_always' => isset($_POST['_delete_always']) ? true : false,
'delete_junk' => isset($_POST['_delete_junk']) ? TRUE : FALSE, 'delete_junk' => isset($_POST['_delete_junk']) ? true : false,
'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE, 'logout_purge' => isset($_POST['_logout_purge']) ? true : false,
'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE, 'logout_expunge' => isset($_POST['_logout_expunge']) ? true : false,
); );
break; break;
case 'folders': case 'folders':
$a_user_prefs = array( $a_user_prefs = array(
'show_real_foldernames' => 'show_real_foldernames' => isset($_POST['_show_real_foldernames']) ? true : false,
isset($_POST['_show_real_foldernames']) ? TRUE : FALSE, 'drafts_mbox' => rcube_utils::get_input_value('_drafts_mbox', rcube_utils::INPUT_POST, true),
'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),
'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),
'junk_mbox' => rcube_utils::get_input_value('_junk_mbox', rcube_utils::INPUT_POST, true), 'trash_mbox' => rcube_utils::get_input_value('_trash_mbox', rcube_utils::INPUT_POST, true),
'trash_mbox' => rcube_utils::get_input_value('_trash_mbox', rcube_utils::INPUT_POST, true),
); );
break; break;
} }
$plugin = rcmail::get_instance()->plugins->exec_hook('preferences_save', $plugin = rcmail::get_instance()->plugins->exec_hook('preferences_save',
array('prefs' => $a_user_prefs, 'section' => $CURR_SECTION)); array('prefs' => $a_user_prefs, 'section' => $CURR_SECTION));
$a_user_prefs = $plugin['prefs']; $a_user_prefs = $plugin['prefs'];
// don't override these parameters // 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]; $a_user_prefs[$p] = $CONFIG[$p];
}
// verify some options // verify some options
switch ($CURR_SECTION) switch ($CURR_SECTION) {
{ case 'general':
case 'general':
// switch UI language // switch UI language
if (isset($_POST['_language']) && $a_user_prefs['language'] != $_SESSION['language']) { if (isset($_POST['_language']) && $a_user_prefs['language'] != $_SESSION['language']) {
$RCMAIL->load_language($a_user_prefs['language']); $RCMAIL->load_language($a_user_prefs['language']);
$OUTPUT->command('reload', 500); $OUTPUT->command('reload', 500);
} }
// switch skin (if valid, otherwise unset the pref and fall back to default) // switch skin (if valid, otherwise unset the pref and fall back to default)
if (!$OUTPUT->set_skin($a_user_prefs['skin'])) if (!$OUTPUT->set_skin($a_user_prefs['skin']))
unset($a_user_prefs['skin']); unset($a_user_prefs['skin']);
else if ($RCMAIL->config->get('skin') != $a_user_prefs['skin']) else if ($RCMAIL->config->get('skin') != $a_user_prefs['skin'])
$OUTPUT->command('reload', 500); $OUTPUT->command('reload', 500);
$a_user_prefs['timezone'] = (string) $a_user_prefs['timezone']; $a_user_prefs['timezone'] = (string) $a_user_prefs['timezone'];
if (!empty($a_user_prefs['refresh_interval']) && !empty($CONFIG['min_refresh_interval'])) { if (!empty($a_user_prefs['refresh_interval']) && !empty($CONFIG['min_refresh_interval'])) {
if ($a_user_prefs['refresh_interval'] < $CONFIG['min_refresh_interval']) { if ($a_user_prefs['refresh_interval'] < $CONFIG['min_refresh_interval']) {
$a_user_prefs['refresh_interval'] = $CONFIG['min_refresh_interval']; $a_user_prefs['refresh_interval'] = $CONFIG['min_refresh_interval'];
} }
} }
break; break;
case 'mailbox': case 'mailbox':
// force min size // force min size
if ($a_user_prefs['mail_pagesize'] < 1) if ($a_user_prefs['mail_pagesize'] < 1) {
$a_user_prefs['mail_pagesize'] = 10; $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']; $a_user_prefs['mail_pagesize'] = (int) $CONFIG['max_pagesize'];
}
break; break;
case 'addressbook': case 'addressbook':
// force min size // force min size
if ($a_user_prefs['addressbook_pagesize'] < 1) if ($a_user_prefs['addressbook_pagesize'] < 1) {
$a_user_prefs['addressbook_pagesize'] = 10; $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']; $a_user_prefs['addressbook_pagesize'] = (int) $CONFIG['max_pagesize'];
}
break; break;
case 'folders': case 'folders':
// special handling for 'default_folders' // special handling for 'default_folders'
if (in_array('default_folders', (array)$CONFIG['dont_override'])) { 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]; $a_user_prefs[$p] = $CONFIG[$p];
} else { }
$a_user_prefs['default_folders'] = array('INBOX'); }
foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p) { else {
if ($a_user_prefs[$p]) $a_user_prefs['default_folders'] = array('INBOX');
$a_user_prefs['default_folders'][] = $a_user_prefs[$p]; foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p) {
} if ($a_user_prefs[$p]) {
$a_user_prefs['default_folders'][] = $a_user_prefs[$p];
}
}
} }
break; break;
@ -211,14 +211,14 @@ switch ($CURR_SECTION)
// Save preferences // Save preferences
if (!$plugin['abort']) if (!$plugin['abort'])
$saved = $RCMAIL->user->save_prefs($a_user_prefs); $saved = $RCMAIL->user->save_prefs($a_user_prefs);
else else
$saved = $plugin['result']; $saved = $plugin['result'];
if ($saved) if ($saved)
$OUTPUT->show_message('successfullysaved', 'confirmation'); $OUTPUT->show_message('successfullysaved', 'confirmation');
else else
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error'); $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
// display the form again // display the form again
$RCMAIL->overwrite_action('edit-prefs'); $RCMAIL->overwrite_action('edit-prefs');

Loading…
Cancel
Save