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,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) function rcmail_supportlink($attrib)
{ {
global $RCMAIL; global $RCMAIL;
@ -28,6 +37,7 @@ function rcmail_supportlink($attrib)
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));
} }
} }
@ -36,26 +46,29 @@ function rcmail_plugins_list($attrib)
{ {
global $RCMAIL; global $RCMAIL;
if (!$attrib['id']) if (!$attrib['id']) {
$attrib['id'] = 'rcmpluginlist'; $attrib['id'] = 'rcmpluginlist';
}
$plugins = array_filter((array) $RCMAIL->config->get('plugins')); $plugins = array_filter((array) $RCMAIL->config->get('plugins'));
$plugin_info = array(); $plugin_info = array();
foreach ($plugins as $name) { foreach ($plugins as $name) {
if ($info = $RCMAIL->plugins->get_info($name)) if ($info = $RCMAIL->plugins->get_info($name)) {
$plugin_info[$name] = $info; $plugin_info[$name] = $info;
} }
}
// load info from required plugins, too // load info from required plugins, too
foreach ($plugin_info as $name => $info) { foreach ($plugin_info as $name => $info) {
if (is_array($info['required']) && !empty($info['required'])) { if (is_array($info['required']) && !empty($info['required'])) {
foreach ($info['required'] as $req_name) { 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; $plugin_info[$req_name] = $req_info;
} }
} }
} }
}
if (empty($plugin_info)) { if (empty($plugin_info)) {
return ''; return '';
@ -88,11 +101,3 @@ function rcmail_plugins_list($attrib)
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. |
@ -28,24 +28,28 @@ if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(rcube_utils::INPUT_GPC)) {
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,10 +23,12 @@ 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)) if (is_array($IDENTITY_RECORD)) {
$OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']); $OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']);
}
else { else {
$OUTPUT->show_message('dberror', 'error'); $OUTPUT->show_message('dberror', 'error');
// go to identities page // go to identities page
@ -47,6 +49,19 @@ else {
} }
} }
$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)
{ {
@ -79,7 +94,8 @@ function rcube_identity_form($attrib)
'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',
'label' => $RCMAIL->gettext('htmlsignature'),
'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'), 'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'),
)) ))
); );
@ -127,12 +143,14 @@ function rcube_identity_form($attrib)
$out = "$form_start\n"; $out = "$form_start\n";
foreach ($form as $fieldset) { foreach ($form as $fieldset) {
if (empty($fieldset['content'])) if (empty($fieldset['content'])) {
continue; continue;
}
$content = ''; $content = '';
if (is_array($fieldset['content'])) { if (is_array($fieldset['content'])) {
$table = new html_table(array('cols' => 2)); $table = new html_table(array('cols' => 2));
foreach ($fieldset['content'] as $col => $colprop) { foreach ($fieldset['content'] as $col => $colprop) {
$colprop['id'] = 'rcmfd_'.$col; $colprop['id'] = 'rcmfd_'.$col;
@ -145,30 +163,18 @@ function rcube_identity_form($attrib)
$table->add('title', html::label($colprop['id'], rcube::Q($label))); $table->add('title', html::label($colprop['id'], rcube::Q($label)));
$table->add(null, $value); $table->add(null, $value);
} }
$content = $table->show($attrib); $content = $table->show($attrib);
} }
else { else {
$content = $fieldset['content']; $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; $out .= $form_end;
return $out; 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');

@ -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,13 +19,24 @@
+-----------------------------------------------------------------------+ +-----------------------------------------------------------------------+
*/ */
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;
@ -70,14 +81,3 @@ function rcmail_prefs_section_name()
return $SECTIONS[$CURR_SECTION]['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');

@ -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);
}
} }
/** /**
@ -1318,9 +1344,11 @@ function rcmail_settings_tabs($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');
$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() // similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
function rcmail_identity_frame($attrib) function rcmail_identity_frame($attrib)
{ {
global $OUTPUT; global $OUTPUT;
if (!$attrib['id']) if (!$attrib['id']) {
$attrib['id'] = 'rcmIdentityFrame'; $attrib['id'] = 'rcmIdentityFrame';
return $OUTPUT->frame($attrib, true);
} }
$OUTPUT->add_handler('identityframe', 'rcmail_identity_frame'); return $OUTPUT->frame($attrib, true);
$OUTPUT->set_env('identities_level', IDENTITIES_LEVEL); }
$OUTPUT->add_label('deleteidentityconfirm');
$OUTPUT->send('identities');

@ -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. |
@ -35,16 +35,18 @@ if (IDENTITIES_LEVEL != 4 && (empty($_POST['_name']) || (empty($_POST['_email'])
$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
@ -63,8 +65,9 @@ else if (IDENTITIES_LEVEL == 4) {
// 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) {
@ -93,14 +96,17 @@ if ($_POST['_iid']) {
// 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)); $plugin = $RCMAIL->plugins->exec_hook('identity_update', array('id' => $iid, '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'])
$updated = $RCMAIL->user->update_identity($iid, $save_data); $updated = $RCMAIL->user->update_identity($iid, $save_data);
else else
@ -109,12 +115,14 @@ if ($_POST['_iid']) {
if ($updated) { if ($updated) {
$OUTPUT->show_message('successfullysaved', 'confirmation'); $OUTPUT->show_message('successfullysaved', 'confirmation');
if (!empty($save_data['standard'])) if (!empty($save_data['standard'])) {
$default_id = $iid; $default_id = $iid;
}
if ($_POST['_framed']) { if ($_POST['_framed']) {
// update the changed col in list // 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 { else {
@ -124,7 +132,6 @@ if ($_POST['_iid']) {
return; 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) {
@ -134,8 +141,9 @@ else if (IDENTITIES_LEVEL < 2) {
$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;
@ -147,12 +155,14 @@ else if (IDENTITIES_LEVEL < 2) {
$_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 { else {
@ -162,20 +172,22 @@ else if (IDENTITIES_LEVEL < 2) {
return; 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 else {
$RCMAIL->overwrite_action('identities'); $RCMAIL->overwrite_action('identities');
}
/** /**

@ -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,21 +20,19 @@
*/ */
$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'],
); );
@ -46,45 +44,45 @@ switch ($CURR_SECTION)
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']),
@ -96,10 +94,10 @@ switch ($CURR_SECTION)
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'],
@ -107,23 +105,22 @@ switch ($CURR_SECTION)
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),
@ -139,15 +136,14 @@ $plugin = rcmail::get_instance()->plugins->exec_hook('preferences_save',
$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']);
@ -170,41 +166,45 @@ switch ($CURR_SECTION)
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 { }
}
else {
$a_user_prefs['default_folders'] = array('INBOX'); $a_user_prefs['default_folders'] = array('INBOX');
foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p) { 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]; $a_user_prefs['default_folders'][] = $a_user_prefs[$p];
} }
} }
}
break; break;
} }

Loading…
Cancel
Save