summaryrefslogtreecommitdiff
path: root/program/steps/settings
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/settings')
-rw-r--r--program/steps/settings/about.inc127
-rw-r--r--program/steps/settings/delete_identity.inc46
-rw-r--r--program/steps/settings/edit_folder.inc109
-rw-r--r--program/steps/settings/edit_identity.inc252
-rw-r--r--program/steps/settings/edit_prefs.inc84
-rw-r--r--program/steps/settings/edit_response.inc108
-rw-r--r--program/steps/settings/folders.inc139
-rw-r--r--program/steps/settings/func.inc378
-rw-r--r--program/steps/settings/identities.inc29
-rw-r--r--program/steps/settings/responses.inc133
-rw-r--r--program/steps/settings/save_folder.inc38
-rw-r--r--program/steps/settings/save_identity.inc224
-rw-r--r--program/steps/settings/save_prefs.inc240
13 files changed, 1105 insertions, 802 deletions
diff --git a/program/steps/settings/about.inc b/program/steps/settings/about.inc
index 0fdefddda..026bfc1a2 100644
--- a/program/steps/settings/about.inc
+++ b/program/steps/settings/about.inc
@@ -5,8 +5,8 @@
| program/steps/settings/about.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2011, The Roundcube Dev Team |
- | Copyright (C) 2011, Kolab Systems AG |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
+ | Copyright (C) 2011-2013, Kolab Systems AG |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -21,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)
{
- global $RCMAIL;
+ global $RCMAIL;
+
+ if ($url = $RCMAIL->config->get('support_url')) {
+ $label = $attrib['label'] ? $attrib['label'] : 'support';
+ $attrib['href'] = $url;
- if ($url = $RCMAIL->config->get('support_url')) {
- $label = $attrib['label'] ? $attrib['label'] : 'support';
- $attrib['href'] = $url;
- return html::a($attrib, rcube_label($label));
- }
+ return html::a($attrib, $RCMAIL->gettext($label));
+ }
}
function rcmail_plugins_list($attrib)
{
- 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;
- }
- }
- }
+ global $RCMAIL;
- if (empty($plugin_info)) {
- return '';
- }
+ if (!$attrib['id']) {
+ $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
- $table->add_header('name', rcube_label('plugin'));
- $table->add_header('version', rcube_label('version'));
- $table->add_header('license', rcube_label('license'));
- $table->add_header('source', rcube_label('source'));
+ // 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;
+ }
+ }
+ }
+ }
- foreach ($plugin_info as $name => $data) {
- $uri = $data['src_uri'] ? $data['src_uri'] : $data['uri'];
- if ($uri && stripos($uri, 'http') !== 0) {
- $uri = 'http://' . $uri;
+ if (empty($plugin_info)) {
+ return '';
}
- $table->add_row();
- $table->add('name', Q($data['name'] ? $data['name'] : $name));
- $table->add('version', Q($data['version']));
- $table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> Q($data['license_uri'])),
- Q($data['license'])) : $data['license']);
- $table->add('source', $uri ? html::a(array('target' => '_blank', href=> Q($uri)),
- Q(rcube_label('download'))) : '');
- }
+ ksort($plugin_info, SORT_LOCALE_STRING);
+
+ $table = new html_table($attrib);
+
+ // add table header
+ $table->add_header('name', $RCMAIL->gettext('plugin'));
+ $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(rcube_label('about'));
-
-$OUTPUT->add_handler('supportlink', 'rcmail_supportlink');
-$OUTPUT->add_handler('pluginlist', 'rcmail_plugins_list');
-
-$OUTPUT->send('about');
diff --git a/program/steps/settings/delete_identity.inc b/program/steps/settings/delete_identity.inc
index d5146db66..f77620438 100644
--- a/program/steps/settings/delete_identity.inc
+++ b/program/steps/settings/delete_identity.inc
@@ -5,7 +5,7 @@
| program/steps/settings/delete_identity.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -19,33 +19,37 @@
+-----------------------------------------------------------------------+
*/
-$iid = get_input_value('_iid', RCUBE_INPUT_GPC);
+$iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_GPC);
// check request token
-if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(RCUBE_INPUT_GPC)) {
- $OUTPUT->show_message('invalidrequest', 'error');
- rcmail_overwrite_action('identities');
- return;
+if (!$OUTPUT->ajax_call && !$RCMAIL->check_request(rcube_utils::INPUT_GPC)) {
+ $OUTPUT->show_message('invalidrequest', 'error');
+ $RCMAIL->overwrite_action('identities');
+ return;
}
-if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid))
-{
- $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid));
-
- $deleted = !$plugin['abort'] ? $RCMAIL->user->delete_identity($iid) : $plugin['result'];
+if ($iid && preg_match('/^[0-9]+(,[0-9]+)*$/', $iid)) {
+ $plugin = $RCMAIL->plugins->exec_hook('identity_delete', array('id' => $iid));
- if ($deleted > 0 && $deleted !== false)
- $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
- else
- $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving'), 'error', null, false);
+ $deleted = !$plugin['abort'] ? $RCMAIL->user->delete_identity($iid) : $plugin['result'];
- // send response
- if ($OUTPUT->ajax_call)
- $OUTPUT->send();
+ if ($deleted > 0 && $deleted !== false) {
+ $OUTPUT->show_message('deletedsuccessfully', 'confirmation', null, false);
+ }
+ else {
+ $msg = $plugin['message'] ? $plugin['message'] : ($deleted < 0 ? 'nodeletelastidentity' : 'errorsaving');
+ $OUTPUT->show_message($msg, 'error', null, false);
+ }
+
+ // send response
+ if ($OUTPUT->ajax_call) {
+ $OUTPUT->send();
+ }
}
-if ($OUTPUT->ajax_call)
- exit;
+if ($OUTPUT->ajax_call) {
+ exit;
+}
// go to identities page
-rcmail_overwrite_action('identities');
+$RCMAIL->overwrite_action('identities');
diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc
index f19e2177b..fc6b2cd16 100644
--- a/program/steps/settings/edit_folder.inc
+++ b/program/steps/settings/edit_folder.inc
@@ -5,7 +5,7 @@
| program/steps/settings/edit_folder.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -19,7 +19,17 @@
+-----------------------------------------------------------------------+
*/
-// WARNING: folder names in UI are encoded with RCMAIL_CHARSET
+// 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
function rcmail_folder_form($attrib)
{
@@ -28,12 +38,12 @@ function rcmail_folder_form($attrib)
$storage = $RCMAIL->get_storage();
// edited folder name (empty in create-folder mode)
- $mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true));
- $mbox_imap = rcube_charset_convert($mbox, RCMAIL_CHARSET, 'UTF7-IMAP');
+ $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true);
+ $mbox_imap = rcube_charset::convert($mbox, RCUBE_CHARSET, 'UTF7-IMAP');
// predefined path for new folder
- $parent = trim(get_input_value('_path', RCUBE_INPUT_GPC, true));
- $parent_imap = rcube_charset_convert($parent, RCMAIL_CHARSET, 'UTF7-IMAP');
+ $parent = rcube_utils::get_input_value('_path', rcube_utils::INPUT_GPC, true);
+ $parent_imap = rcube_charset::convert($parent, RCUBE_CHARSET, 'UTF7-IMAP');
$threading_supported = $storage->get_capability('THREAD');
$delimiter = $storage->get_hierarchy_delimiter();
@@ -46,7 +56,7 @@ function rcmail_folder_form($attrib)
$path = explode($delimiter, $mbox_imap);
$folder = array_pop($path);
$path = implode($delimiter, $path);
- $folder = rcube_charset_convert($folder, 'UTF7-IMAP');
+ $folder = rcube_charset::convert($folder, 'UTF7-IMAP');
$hidden_fields = array('name' => '_mbox', 'value' => $mbox);
}
@@ -73,33 +83,33 @@ function rcmail_folder_form($attrib)
// General tab
$form['props'] = array(
- 'name' => rcube_label('properties'),
+ 'name' => $RCMAIL->gettext('properties'),
);
// Location (name)
if ($options['protected']) {
- $foldername = str_replace($delimiter, ' &raquo; ', Q(rcmail_localize_folderpath($mbox_imap)));
+ $foldername = str_replace($delimiter, ' &raquo; ', rcube::Q($RCMAIL->localize_folderpath($mbox_imap)));
}
else if ($options['norename']) {
- $foldername = Q($folder);
+ $foldername = rcube::Q($folder);
}
else {
if (isset($_POST['_name']))
- $folder = trim(get_input_value('_name', RCUBE_INPUT_POST, true));
+ $folder = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true));
$foldername = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30));
$foldername = $foldername->show($folder);
if ($options['special']) {
- $foldername .= '&nbsp;(' . Q(rcmail_localize_foldername($mbox_imap)) .')';
+ $foldername .= '&nbsp;(' . rcube::Q($RCMAIL->localize_foldername($mbox_imap)) .')';
}
}
$form['props']['fieldsets']['location'] = array(
- 'name' => rcube_label('location'),
+ 'name' => $RCMAIL->gettext('location'),
'content' => array(
'name' => array(
- 'label' => rcube_label('foldername'),
+ 'label' => $RCMAIL->gettext('foldername'),
'value' => $foldername,
),
),
@@ -121,7 +131,7 @@ function rcmail_folder_form($attrib)
$exceptions[] = substr($prefix, 0, -1);
}
- $select = rcmail_mailbox_select(array(
+ $select = $RCMAIL->folder_selector(array(
'name' => '_parent',
'noselection' => '---',
'realnames' => false,
@@ -132,21 +142,21 @@ function rcmail_folder_form($attrib)
));
$form['props']['fieldsets']['location']['content']['path'] = array(
- 'label' => rcube_label('parentfolder'),
+ 'label' => $RCMAIL->gettext('parentfolder'),
'value' => $select->show($selected),
);
}
// Settings
$form['props']['fieldsets']['settings'] = array(
- 'name' => rcube_label('settings'),
+ 'name' => $RCMAIL->gettext('settings'),
);
// Settings: threading
if ($threading_supported && ($mbox_imap == 'INBOX' || (!$options['noselect'] && !$options['is_root']))) {
$select = new html_select(array('name' => '_viewmode', 'id' => '_listmode'));
- $select->add(rcube_label('list'), 0);
- $select->add(rcube_label('threads'), 1);
+ $select->add($RCMAIL->gettext('list'), 0);
+ $select->add($RCMAIL->gettext('threads'), 1);
if (isset($_POST['_viewmode'])) {
$value = (int) $_POST['_viewmode'];
@@ -157,38 +167,38 @@ function rcmail_folder_form($attrib)
}
$form['props']['fieldsets']['settings']['content']['viewmode'] = array(
- 'label' => rcube_label('listmode'),
+ 'label' => $RCMAIL->gettext('listmode'),
'value' => $select->show($value),
);
}
/*
// Settings: sorting column
$select = new html_select(array('name' => '_sortcol', 'id' => '_sortcol'));
- $select->add(rcube_label('nonesort'), '');
- $select->add(rcube_label('arrival'), 'arrival');
- $select->add(rcube_label('sentdate'), 'date');
- $select->add(rcube_label('subject'), 'subject');
- $select->add(rcube_label('fromto'), 'from');
- $select->add(rcube_label('replyto'), 'replyto');
- $select->add(rcube_label('cc'), 'cc');
- $select->add(rcube_label('size'), 'size');
+ $select->add($RCMAIL->gettext('nonesort'), '');
+ $select->add($RCMAIL->gettext('arrival'), 'arrival');
+ $select->add($RCMAIL->gettext('sentdate'), 'date');
+ $select->add($RCMAIL->gettext('subject'), 'subject');
+ $select->add($RCMAIL->gettext('fromto'), 'from');
+ $select->add($RCMAIL->gettext('replyto'), 'replyto');
+ $select->add($RCMAIL->gettext('cc'), 'cc');
+ $select->add($RCMAIL->gettext('size'), 'size');
$value = isset($_POST['_sortcol']) ? $_POST['_sortcol'] : '';
$form['props']['fieldsets']['settings']['content']['sortcol'] = array(
- 'label' => rcube_label('listsorting'),
+ 'label' => $RCMAIL->gettext('listsorting'),
'value' => $select->show($value),
);
// Settings: sorting order
$select = new html_select(array('name' => '_sortord', 'id' => '_sortord'));
- $select->add(rcube_label('asc'), 'ASC');
- $select->add(rcube_label('desc'), 'DESC');
+ $select->add($RCMAIL->gettext('asc'), 'ASC');
+ $select->add($RCMAIL->gettext('desc'), 'DESC');
$value = isset($_POST['_sortord']) ? $_POST['_sortord'] : '';
$form['props']['fieldsets']['settings']['content']['sortord'] = array(
- 'label' => rcube_label('listorder'),
+ 'label' => $RCMAIL->gettext('listorder'),
'value' => $select->show(),
);
*/
@@ -196,7 +206,7 @@ function rcmail_folder_form($attrib)
if (strlen($mbox)) {
// Number of messages
$form['props']['fieldsets']['info'] = array(
- 'name' => rcube_label('info'),
+ 'name' => $RCMAIL->gettext('info'),
'content' => array()
);
@@ -207,9 +217,9 @@ function rcmail_folder_form($attrib)
if ($msgcount) {
// create link with folder-size command
$onclick = sprintf("return %s.command('folder-size', '%s', this)",
- JS_OBJECT_NAME, JQ($mbox_imap));
+ rcmail_output::JS_OBJECT_NAME, rcube::JQ($mbox_imap));
$size = html::a(array('href' => '#', 'onclick' => $onclick,
- 'id' => 'folder-size'), rcube_label('getfoldersize'));
+ 'id' => 'folder-size'), $RCMAIL->gettext('getfoldersize'));
}
else {
// no messages -> zero size
@@ -217,11 +227,11 @@ function rcmail_folder_form($attrib)
}
$form['props']['fieldsets']['info']['content']['count'] = array(
- 'label' => rcube_label('messagecount'),
+ 'label' => $RCMAIL->gettext('messagecount'),
'value' => (int) $msgcount
);
$form['props']['fieldsets']['info']['content']['size'] = array(
- 'label' => rcube_label('size'),
+ 'label' => $RCMAIL->gettext('size'),
'value' => $size,
);
}
@@ -229,8 +239,8 @@ function rcmail_folder_form($attrib)
// show folder type only if we have non-private namespaces
if (!empty($namespace['shared']) || !empty($namespace['others'])) {
$form['props']['fieldsets']['info']['content']['foldertype'] = array(
- 'label' => rcube_label('foldertype'),
- 'value' => rcube_label($options['namespace'] . 'folder'));
+ 'label' => $RCMAIL->gettext('foldertype'),
+ 'value' => $RCMAIL->gettext($options['namespace'] . 'folder'));
}
}
@@ -256,7 +266,8 @@ function rcmail_folder_form($attrib)
foreach ($tab['fieldsets'] as $fieldset) {
$subcontent = rcmail_get_form_part($fieldset, $attrib);
if ($subcontent) {
- $content .= html::tag('fieldset', null, html::tag('legend', null, Q($fieldset['name'])) . $subcontent) ."\n";
+ $subcontent = html::tag('legend', null, rcube::Q($fieldset['name'])) . $subcontent;
+ $content .= html::tag('fieldset', null, $subcontent) ."\n";
}
}
}
@@ -265,7 +276,7 @@ function rcmail_folder_form($attrib)
}
if ($content && sizeof($form) > 1) {
- $out .= html::tag('fieldset', null, html::tag('legend', null, Q($tab['name'])) . $content) ."\n";
+ $out .= html::tag('fieldset', null, html::tag('legend', null, rcube::Q($tab['name'])) . $content) ."\n";
}
else {
$out .= $content ."\n";
@@ -287,9 +298,9 @@ function rcmail_get_form_part($form, $attrib = array())
$table = new html_table(array('cols' => 2));
foreach ($form['content'] as $col => $colprop) {
$colprop['id'] = '_'.$col;
- $label = !empty($colprop['label']) ? $colprop['label'] : rcube_label($col);
+ $label = !empty($colprop['label']) ? $colprop['label'] : $RCMAIL->gettext($col);
- $table->add('title', html::label($colprop['id'], Q($label)));
+ $table->add('title', html::label($colprop['id'], rcube::Q($label)));
$table->add(null, $colprop['value']);
}
$content = $table->show($attrib);
@@ -300,15 +311,3 @@ function rcmail_get_form_part($form, $attrib = array())
return $content;
}
-
-
-//$OUTPUT->set_pagetitle(rcube_label('folders'));
-
-// register UI objects
-$OUTPUT->add_handlers(array(
- 'folderdetails' => 'rcmail_folder_form',
-));
-
-$OUTPUT->add_label('nonamewarning');
-
-$OUTPUT->send('folderedit');
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc
index edd4ba60d..f208c8a05 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -5,7 +5,7 @@
| program/steps/settings/edit_identity.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2011, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -23,152 +23,158 @@ define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
// edit-identity
if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='edit-identity') {
- $IDENTITY_RECORD = $RCMAIL->user->get_identity(get_input_value('_iid', RCUBE_INPUT_GPC));
-
- if (is_array($IDENTITY_RECORD))
- $OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']);
- else {
- $OUTPUT->show_message('dberror', 'error');
- // go to identities page
- rcmail_overwrite_action('identities');
- return;
- }
+ $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']);
+ }
+ else {
+ $OUTPUT->show_message('dberror', 'error');
+ // go to identities page
+ $RCMAIL->overwrite_action('identities');
+ return;
+ }
}
// add-identity
else {
- if (IDENTITIES_LEVEL > 1) {
- $OUTPUT->show_message('opnotpermitted', 'error');
- // go to identities page
- rcmail_overwrite_action('identities');
- return;
- }
- else if (IDENTITIES_LEVEL == 1) {
- $IDENTITY_RECORD['email'] = $RCMAIL->get_user_email();
- }
+ if (IDENTITIES_LEVEL > 1) {
+ $OUTPUT->show_message('opnotpermitted', 'error');
+ // go to identities page
+ $RCMAIL->overwrite_action('identities');
+ return;
+ }
+ else if (IDENTITIES_LEVEL == 1) {
+ $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)
{
- global $IDENTITY_RECORD, $RCMAIL, $OUTPUT;
-
- // Add HTML editor script(s)
- rcube_html_editor('identity');
-
- // add some labels to client
- $OUTPUT->add_label('noemailwarning', 'nonamewarning', 'converting', 'editorwarning');
-
- $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
- $t_rows = !empty($attrib['textarearows']) ? $attrib['textarearows'] : 6;
- $t_cols = !empty($attrib['textareacols']) ? $attrib['textareacols'] : 40;
-
- // list of available cols
- $form = array(
- 'addressing' => array(
- 'name' => rcube_label('settings'),
- 'content' => array(
- 'name' => array('type' => 'text', 'size' => $i_size),
- 'email' => array('type' => 'text', 'size' => $i_size),
- 'organization' => array('type' => 'text', 'size' => $i_size),
- 'reply-to' => array('type' => 'text', 'size' => $i_size),
- 'bcc' => array('type' => 'text', 'size' => $i_size),
- 'standard' => array('type' => 'checkbox', 'label' => rcube_label('setdefault')),
- )),
- 'signature' => array(
- 'name' => rcube_label('signature'),
- 'content' => array(
- 'signature' => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows,
- 'spellcheck' => true),
- 'html_signature' => array('type' => 'checkbox', 'label' => rcube_label('htmlsignature'),
- 'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'),
- ))
- );
-
- // Enable TinyMCE editor
- if ($IDENTITY_RECORD['html_signature']) {
- $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, RCMAIL_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';
+ global $IDENTITY_RECORD, $RCMAIL, $OUTPUT;
+
+ // Add HTML editor script(s)
+ $RCMAIL->html_editor('identity');
+
+ // add some labels to client
+ $OUTPUT->add_label('noemailwarning', 'nonamewarning', 'converting', 'editorwarning');
+
+ $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
+ $t_rows = !empty($attrib['textarearows']) ? $attrib['textarearows'] : 6;
+ $t_cols = !empty($attrib['textareacols']) ? $attrib['textareacols'] : 40;
+
+ // list of available cols
+ $form = array(
+ 'addressing' => array(
+ 'name' => $RCMAIL->gettext('settings'),
+ 'content' => array(
+ 'name' => array('type' => 'text', 'size' => $i_size),
+ 'email' => array('type' => 'text', 'size' => $i_size),
+ 'organization' => array('type' => 'text', 'size' => $i_size),
+ 'reply-to' => array('type' => 'text', 'size' => $i_size),
+ 'bcc' => array('type' => 'text', 'size' => $i_size),
+ 'standard' => array('type' => 'checkbox', 'label' => $RCMAIL->gettext('setdefault')),
+ )),
+ 'signature' => array(
+ 'name' => $RCMAIL->gettext('signature'),
+ 'content' => array(
+ 'signature' => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows,
+ 'spellcheck' => true),
+ 'html_signature' => array('type' => 'checkbox',
+ 'label' => $RCMAIL->gettext('htmlsignature'),
+ 'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'),
+ ))
+ );
+
+ // Enable TinyMCE editor
+ if ($IDENTITY_RECORD['html_signature']) {
+ $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);
}
- }
- $IDENTITY_RECORD['email'] = rcube_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
- $plugin = $RCMAIL->plugins->exec_hook('identity_form', array(
- 'form' => $form, 'record' => $IDENTITY_RECORD));
+ if (IDENTITIES_LEVEL == 4) {
+ foreach($form['addressing']['content'] as $formfield => $value){
+ $form['addressing']['content'][$formfield]['disabled'] = true;
+ $form['addressing']['content'][$formfield]['class'] = 'disabled';
+ }
+ }
- $form = $plugin['form'];
- $IDENTITY_RECORD = $plugin['record'];
+ $IDENTITY_RECORD['email'] = rcube_utils::idn_to_utf8($IDENTITY_RECORD['email']);
- // Set form tags and hidden fields
- list($form_start, $form_end) = get_form_tags($attrib, 'save-identity',
- intval($IDENTITY_RECORD['identity_id']),
- array('name' => '_iid', 'value' => $IDENTITY_RECORD['identity_id']));
+ // Allow plugins to modify identity form content
+ $plugin = $RCMAIL->plugins->exec_hook('identity_form', array(
+ 'form' => $form, 'record' => $IDENTITY_RECORD));
- unset($plugin);
- unset($attrib['form'], $attrib['id']);
+ $form = $plugin['form'];
+ $IDENTITY_RECORD = $plugin['record'];
- // return the complete edit form as table
- $out = "$form_start\n";
+ // Set form tags and hidden fields
+ 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) {
- if (empty($fieldset['content']))
- continue;
+ unset($plugin);
+ unset($attrib['form'], $attrib['id']);
- $content = '';
- if (is_array($fieldset['content'])) {
- $table = new html_table(array('cols' => 2));
- foreach ($fieldset['content'] as $col => $colprop) {
- $colprop['id'] = 'rcmfd_'.$col;
+ // return the complete edit form as table
+ $out = "$form_start\n";
- $label = !empty($colprop['label']) ? $colprop['label'] :
- rcube_label(str_replace('-', '', $col));
+ foreach ($form as $fieldset) {
+ if (empty($fieldset['content'])) {
+ continue;
+ }
- $value = !empty($colprop['value']) ? $colprop['value'] :
- rcmail_get_edit_field($col, $IDENTITY_RECORD[$col], $colprop, $colprop['type']);
+ $content = '';
+ if (is_array($fieldset['content'])) {
+ $table = new html_table(array('cols' => 2));
- $table->add('title', html::label($colprop['id'], Q($label)));
- $table->add(null, $value);
- }
- $content = $table->show($attrib);
- }
- else {
- $content = $fieldset['content'];
- }
+ foreach ($fieldset['content'] as $col => $colprop) {
+ $colprop['id'] = 'rcmfd_'.$col;
- $out .= html::tag('fieldset', null, html::tag('legend', null, 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');
-$OUTPUT->add_handler('identityform', 'rcube_identity_form');
-$OUTPUT->set_env('identities_level', IDENTITIES_LEVEL);
-$OUTPUT->add_label('deleteidentityconfirm');
-
-$OUTPUT->set_pagetitle(rcube_label(($RCMAIL->action=='add-identity' ? 'newidentity' : 'edititem')));
-
-if ($RCMAIL->action=='add-identity' && $OUTPUT->template_exists('identityadd'))
- $OUTPUT->send('identityadd');
+ $content = $table->show($attrib);
+ }
+ else {
+ $content = $fieldset['content'];
+ }
-$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;
+}
diff --git a/program/steps/settings/edit_prefs.inc b/program/steps/settings/edit_prefs.inc
index adf6b1623..05f4db6a6 100644
--- a/program/steps/settings/edit_prefs.inc
+++ b/program/steps/settings/edit_prefs.inc
@@ -5,7 +5,7 @@
| program/steps/settings/edit_prefs.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2007, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -19,65 +19,65 @@
+-----------------------------------------------------------------------+
*/
-if (!$OUTPUT->ajax_call)
- $OUTPUT->set_pagetitle(rcube_label('preferences'));
+if (!$OUTPUT->ajax_call) {
+ $OUTPUT->set_pagetitle($RCMAIL->gettext('preferences'));
+}
-$CURR_SECTION = get_input_value('_section', RCUBE_INPUT_GPC);
+$CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_GPC);
list($SECTIONS,) = rcmail_user_prefs($CURR_SECTION);
+// register UI objects
+$OUTPUT->add_handlers(array(
+ 'userprefs' => 'rcmail_user_prefs_form',
+ 'sectionname' => 'rcmail_prefs_section_name',
+));
+
+$OUTPUT->send('settingsedit');
+
+
+
function rcmail_user_prefs_form($attrib)
{
- global $RCMAIL, $CURR_SECTION, $SECTIONS;
+ global $RCMAIL, $CURR_SECTION, $SECTIONS;
- // add some labels to client
- $RCMAIL->output->add_label('nopagesizewarning');
+ // add some labels to client
+ $RCMAIL->output->add_label('nopagesizewarning');
- unset($attrib['form']);
+ unset($attrib['form']);
- list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null,
- array('name' => '_section', 'value' => $CURR_SECTION));
+ list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null,
+ array('name' => '_section', 'value' => $CURR_SECTION));
- $out = $form_start;
+ $out = $form_start;
- foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $class => $block) {
- if (!empty($block['options'])) {
- $table = new html_table(array('cols' => 2));
+ foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $class => $block) {
+ if (!empty($block['options'])) {
+ $table = new html_table(array('cols' => 2));
- foreach ($block['options'] as $option) {
- if (isset($option['title'])) {
- $table->add('title', $option['title']);
- $table->add(null, $option['content']);
+ foreach ($block['options'] as $option) {
+ if (isset($option['title'])) {
+ $table->add('title', $option['title']);
+ $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 {
- $table->add(array('colspan' => 2), $option['content']);
+ else if (!empty($block['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()
{
- 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');
-
+ global $SECTIONS, $CURR_SECTION;
+ return $SECTIONS[$CURR_SECTION]['section'];
+}
diff --git a/program/steps/settings/edit_response.inc b/program/steps/settings/edit_response.inc
new file mode 100644
index 000000000..760f28290
--- /dev/null
+++ b/program/steps/settings/edit_response.inc
@@ -0,0 +1,108 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/settings/edit_response.inc |
+ | |
+ | This file is part of the Roundcube Webmail client |
+ | Copyright (C) 2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ | PURPOSE: |
+ | Show edit form for a canned response record or to add a new one |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+*/
+
+$responses = $RCMAIL->get_compose_responses();
+
+// edit-response
+if (($key = rcube_utils::get_input_value('_key', rcube_utils::INPUT_GPC))) {
+ foreach ($responses as $i => $response) {
+ if ($response['key'] == $key) {
+ $RESPONSE_RECORD = $response;
+ $RESPONSE_RECORD['index'] = $i;
+ break;
+ }
+ }
+}
+
+// save response
+if ($RCMAIL->action == 'save-response' && isset($_POST['_name']) && !$RESPONSE_RECORD['static']) {
+ $name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST));
+ $text = trim(rcube_utils::get_input_value('_text', rcube_utils::INPUT_POST));
+
+ if (!empty($name) && !empty($text)) {
+ $dupes = 0;
+ foreach ($responses as $i => $resp) {
+ if ($RESPONSE_RECORD && $RESPONSE_RECORD['index'] === $i)
+ continue;
+ if (strcasecmp($name, preg_replace('/\s\(\d+\)$/', '', $resp['name'])) == 0)
+ $dupes++;
+ }
+ if ($dupes) { // require a unique name
+ $name .= ' (' . ++$dupes . ')';
+ }
+
+ $response = array('name' => $name, 'text' => $text, 'format' => 'text', 'key' => substr(md5($name), 0, 16));
+ if ($RESPONSE_RECORD && $responses[$RESPONSE_RECORD['index']]) {
+ $responses[$RESPONSE_RECORD['index']] = $response;
+ }
+ else {
+ $responses[] = $response;
+ }
+
+ $responses = array_filter($responses, function($item){ return empty($item['static']); });
+ if ($RCMAIL->user->save_prefs(array('compose_responses' => array_values($responses)))) {
+ $RCMAIL->output->show_message('successfullysaved', 'confirmation');
+ $RCMAIL->output->command('parent.update_response_row', $response, $key);
+ $RCMAIL->overwrite_action('edit-response');
+ $RESPONSE_RECORD = $response;
+ }
+ }
+ else {
+ $RCMAIL->output->show_message('formincomplete', 'error');
+ }
+}
+
+$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)
+{
+ global $RCMAIL, $OUTPUT, $RESPONSE_RECORD;
+
+ // Set form tags and hidden fields
+ $disabled = !empty($RESPONSE_RECORD['static']);
+ $key = $RESPONSE_RECORD['key'];
+ list($form_start, $form_end) = get_form_tags($attrib, 'save-response', $key, array('name' => '_key', 'value' => $key));
+ unset($attrib['form'], $attrib['id']);
+
+ // return the complete edit form as table
+ $out = "$form_start\n";
+
+ $table = new html_table(array('cols' => 2));
+ $label = $RCMAIL->gettext('responsename');
+
+ $table->add('title', html::label('ffname', rcube::Q($RCMAIL->gettext('responsename'))));
+ $table->add(null, rcube_output::get_edit_field('name', $RESPONSE_RECORD['name'],
+ array('id' => 'ffname', 'size' => $attrib['size'], 'disabled' => $disabled), 'text'));
+
+ $table->add('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'));
+
+ $out .= $table->show($attrib);
+ $out .= $form_end;
+
+ return $out;
+}
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 64af18d62..b09ea03ce 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -5,7 +5,7 @@
| program/steps/settings/folders.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -20,15 +20,15 @@
+-----------------------------------------------------------------------+
*/
-// WARNING: folder names in UI are encoded with RCMAIL_CHARSET
+// WARNING: folder names in UI are encoded with RCUBE_CHARSET
// init IMAP connection
$STORAGE = $RCMAIL->get_storage();
// subscribe mailbox
-if ($RCMAIL->action == 'subscribe')
-{
- $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP');
+if ($RCMAIL->action == 'subscribe') {
+ $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true, 'UTF7-IMAP');
+
if (strlen($mbox)) {
$result = $STORAGE->subscribe(array($mbox));
@@ -53,28 +53,24 @@ if ($RCMAIL->action == 'subscribe')
$OUTPUT->show_message('foldersubscribed', 'confirmation');
}
else
- rcmail_display_server_error('errorsaving');
+ $RCMAIL->display_server_error('errorsaving');
}
}
-
// unsubscribe mailbox
-else if ($RCMAIL->action == 'unsubscribe')
-{
- $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP');
+else if ($RCMAIL->action == 'unsubscribe') {
+ $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true, 'UTF7-IMAP');
if (strlen($mbox)) {
$result = $STORAGE->unsubscribe(array($mbox));
if ($result)
$OUTPUT->show_message('folderunsubscribed', 'confirmation');
else
- rcmail_display_server_error('errorsaving');
+ $RCMAIL->display_server_error('errorsaving');
}
}
-
// delete an existing mailbox
-else if ($RCMAIL->action == 'delete-folder')
-{
- $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true);
- $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP');
+else if ($RCMAIL->action == 'delete-folder') {
+ $mbox_utf8 = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true);
+ $mbox = rcube_charset::convert($mbox_utf8, RCUBE_CHARSET, 'UTF7-IMAP');
if (strlen($mbox)) {
$plugin = $RCMAIL->plugins->exec_hook('folder_delete', array('name' => $mbox));
@@ -98,22 +94,20 @@ else if ($RCMAIL->action == 'delete-folder')
$OUTPUT->show_message('folderdeleted', 'confirmation');
// Clear content frame
$OUTPUT->command('subscription_select');
- $OUTPUT->command('set_quota', rcmail_quota_content());
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content());
}
else if (!$deleted) {
- rcmail_display_server_error('errorsaving');
+ $RCMAIL->display_server_error('errorsaving');
}
}
-
// rename an existing mailbox
-else if ($RCMAIL->action == 'rename-folder')
-{
- $name_utf8 = trim(get_input_value('_folder_newname', RCUBE_INPUT_POST, true));
- $oldname_utf8 = trim(get_input_value('_folder_oldname', RCUBE_INPUT_POST, true));
+else if ($RCMAIL->action == 'rename-folder') {
+ $name_utf8 = trim(rcube_utils::get_input_value('_folder_newname', rcube_utils::INPUT_POST, true));
+ $oldname_utf8 = rcube_utils::get_input_value('_folder_oldname', rcube_utils::INPUT_POST, true);
if (strlen($name_utf8) && strlen($oldname_utf8)) {
- $name = rcube_charset_convert($name_utf8, RCMAIL_CHARSET, 'UTF7-IMAP');
- $oldname = rcube_charset_convert($oldname_utf8, RCMAIL_CHARSET, 'UTF7-IMAP');
+ $name = rcube_charset::convert($name_utf8, RCUBE_CHARSET, 'UTF7-IMAP');
+ $oldname = rcube_charset::convert($oldname_utf8, RCUBE_CHARSET, 'UTF7-IMAP');
$rename = rcmail_rename_folder($oldname, $name);
}
@@ -122,20 +116,19 @@ else if ($RCMAIL->action == 'rename-folder')
rcmail_update_folder_row($name, $oldname);
}
else if (!$rename) {
- rcmail_display_server_error('errorsaving');
+ $RCMAIL->display_server_error('errorsaving');
}
}
-
// clear mailbox
-else if ($RCMAIL->action == 'purge')
-{
- $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true);
- $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP');
- $delimiter = $STORAGE->get_hierarchy_delimiter();
- $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
+else if ($RCMAIL->action == 'purge') {
+ $mbox_utf8 = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true);
+ $mbox = rcube_charset::convert($mbox_utf8, RCUBE_CHARSET, 'UTF7-IMAP');
+ $delimiter = $STORAGE->get_hierarchy_delimiter();
+ $trash_mbox = $RCMAIL->config->get('trash_mbox');
+ $trash_regexp = '/^' . preg_quote($trash . $delimiter, '/') . '/';
// we should only be purging trash (or their subfolders)
- if (!strlen($CONFIG['trash_mbox']) || $mbox == $CONFIG['trash_mbox']
+ if (!strlen($trash_mbox) || $mbox === $trash_mbox
|| preg_match($trash_regexp, $mbox)
) {
$success = $STORAGE->delete_message('*', $mbox);
@@ -143,7 +136,7 @@ else if ($RCMAIL->action == 'purge')
}
// copy to Trash
else {
- $success = $STORAGE->move_message('1:*', $CONFIG['trash_mbox'], $mbox);
+ $success = $STORAGE->move_message('1:*', $trash_mbox, $mbox);
$delete = false;
}
@@ -151,7 +144,7 @@ else if ($RCMAIL->action == 'purge')
$OUTPUT->set_env('messagecount', 0);
if ($delete) {
$OUTPUT->show_message('folderpurged', 'confirmation');
- $OUTPUT->command('set_quota', rcmail_quota_content());
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content());
}
else {
$OUTPUT->show_message('messagemoved', 'confirmation');
@@ -160,29 +153,48 @@ else if ($RCMAIL->action == 'purge')
$OUTPUT->command('show_folder', $mbox_utf8, null, true);
}
else {
- rcmail_display_server_error('errorsaving');
+ $RCMAIL->display_server_error('errorsaving');
}
}
-
// get mailbox size
-else if ($RCMAIL->action == 'folder-size')
-{
- $name = trim(get_input_value('_mbox', RCUBE_INPUT_POST, true));
+else if ($RCMAIL->action == 'folder-size') {
+ $name = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true);
$size = $STORAGE->folder_size($name);
// @TODO: check quota and show percentage usage of specified mailbox?
if ($size !== false) {
- $OUTPUT->command('folder_size_update', show_bytes($size));
+ $OUTPUT->command('folder_size_update', $RCMAIL->show_bytes($size));
}
else {
- rcmail_display_server_error();
+ $RCMAIL->display_server_error();
}
}
-if ($OUTPUT->ajax_call)
+if ($OUTPUT->ajax_call) {
$OUTPUT->send();
+}
+
+$OUTPUT->set_pagetitle($RCMAIL->gettext('folders'));
+$OUTPUT->include_script('list.js');
+$OUTPUT->set_env('prefix_ns', $STORAGE->get_namespace('prefix'));
+if ($STORAGE->get_capability('QUOTA')) {
+ $OUTPUT->set_env('quota', true);
+}
+
+// add some labels to client
+$OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting',
+ 'foldermoving', 'foldersubscribing', 'folderunsubscribing', 'quota');
+
+// register UI objects
+$OUTPUT->add_handlers(array(
+ 'foldersubscription' => 'rcube_subscription_form',
+ 'folderframe' => 'rcmail_folder_frame',
+ 'quotadisplay' => array($RCMAIL, 'quota_display'),
+));
+
+$OUTPUT->send('folders');
// build table with all folders listed by server
@@ -200,7 +212,7 @@ function rcube_subscription_form($attrib)
if ($attrib['noheader'] !== true && $attrib['noheader'] != "true") {
// add table header
- $table->add_header('name', rcube_label('foldername'));
+ $table->add_header('name', $RCMAIL->gettext('foldername'));
$table->add_header('subscribed', '');
}
@@ -225,7 +237,7 @@ function rcube_subscription_form($attrib)
$folder_id = $folder;
$folder = $STORAGE->mod_folder($folder);
$foldersplit = explode($delimiter, $folder);
- $name = rcube_charset_convert(array_pop($foldersplit), 'UTF7-IMAP');
+ $name = rcube_charset::convert(array_pop($foldersplit), 'UTF7-IMAP');
$parent_folder = join($delimiter, $foldersplit);
$level = count($foldersplit);
@@ -234,7 +246,7 @@ function rcube_subscription_form($attrib)
for ($i=1; $i<=$level; $i++) {
$ancestor_folder = join($delimiter, array_slice($foldersplit, 0, $i));
if ($ancestor_folder && !$seen[$ancestor_folder]++) {
- $ancestor_name = rcube_charset_convert($foldersplit[$i-1], 'UTF7-IMAP');
+ $ancestor_name = rcube_charset::convert($foldersplit[$i-1], 'UTF7-IMAP');
$list_folders[] = array(
'id' => $ancestor_folder,
'name' => $ancestor_name,
@@ -270,8 +282,8 @@ function rcube_subscription_form($attrib)
$checkbox_subscribe = new html_checkbox(array(
'name' => '_subscribed[]',
- 'title' => rcube_label('changesubscription'),
- 'onclick' => JS_OBJECT_NAME.".command(this.checked?'subscribe':'unsubscribe',this.value)",
+ 'title' => $RCMAIL->gettext('changesubscription'),
+ 'onclick' => rcmail_output::JS_OBJECT_NAME.".command(this.checked?'subscribe':'unsubscribe',this.value)",
));
// create list of available folders
@@ -283,9 +295,9 @@ function rcube_subscription_form($attrib)
$noselect = false;
$classes = array($i%2 ? 'even' : 'odd');
- $folder_utf8 = rcube_charset_convert($folder['id'], 'UTF7-IMAP');
+ $folder_utf8 = rcube_charset::convert($folder['id'], 'UTF7-IMAP');
$display_folder = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $folder['level'])
- . Q($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']);
+ . rcube::Q($protected ? $RCMAIL->localize_foldername($folder['id']) : $folder['name']);
if ($folder['virtual']) {
$classes[] = 'virtual';
@@ -366,8 +378,9 @@ function rcmail_folder_frame($attrib)
{
global $OUTPUT;
- if (!$attrib['id'])
+ if (!$attrib['id']) {
$attrib['id'] = 'rcmfolderframe';
+ }
return $OUTPUT->frame($attrib, true);
}
@@ -416,25 +429,3 @@ function rcmail_rename_folder($oldname, $newname)
return false;
}
-
-
-$OUTPUT->set_pagetitle(rcube_label('folders'));
-$OUTPUT->include_script('list.js');
-$OUTPUT->set_env('prefix_ns', $STORAGE->get_namespace('prefix'));
-if ($STORAGE->get_capability('QUOTA')) {
- $OUTPUT->set_env('quota', true);
-}
-
-// add some labels to client
-$OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting',
- 'foldermoving', 'foldersubscribing', 'folderunsubscribing', 'quota');
-
-// register UI objects
-$OUTPUT->add_handlers(array(
- 'foldersubscription' => 'rcube_subscription_form',
- 'folderframe' => 'rcmail_folder_frame',
- 'quotadisplay' => 'rcmail_quota_display',
-));
-
-$OUTPUT->send('folders');
-
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index af278e5fa..7c36df3b1 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -5,7 +5,7 @@
| program/steps/settings/func.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2012, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -20,9 +20,33 @@
*/
if (!$OUTPUT->ajax_call) {
- $OUTPUT->set_pagetitle(rcube_label('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()
function rcmail_preferences_frame($attrib)
{
@@ -48,7 +72,7 @@ function rcmail_sections_list($attrib)
list($list, $cols) = rcmail_user_prefs();
// create XHTML table
- $out = rcube_table_output($attrib, $list, $cols, 'id');
+ $out = $RCMAIL->table_output($attrib, $list, $cols, 'id');
// set client env
$RCMAIL->output->add_gui_object('sectionslist', $attrib['id']);
@@ -70,7 +94,7 @@ function rcmail_identities_list($attrib)
// get identities list and define 'mail' column
$list = $RCMAIL->user->list_identities();
foreach ($list as $idx => $row) {
- $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_idn_to_utf8($row['email']) .'>');
+ $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_utils::idn_to_utf8($row['email']) .'>');
}
// get all identites from DB and define list of cols to be displayed
@@ -81,7 +105,7 @@ function rcmail_identities_list($attrib)
// @TODO: use <UL> instead of <TABLE> for identities list
// create XHTML table
- $out = rcube_table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id');
+ $out = $RCMAIL->table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id');
// set client env
$OUTPUT->add_gui_object('identitieslist', $attrib['id']);
@@ -127,13 +151,13 @@ function rcmail_user_prefs($current = null)
{
global $RCMAIL;
- $sections['general'] = array('id' => 'general', 'section' => rcube_label('uisettings'));
- $sections['mailbox'] = array('id' => 'mailbox', 'section' => rcube_label('mailboxview'));
- $sections['mailview'] = array('id' => 'mailview','section' => rcube_label('messagesdisplaying'));
- $sections['compose'] = array('id' => 'compose', 'section' => rcube_label('messagescomposition'));
- $sections['addressbook'] = array('id' => 'addressbook','section' => rcube_label('addressbook'));
- $sections['folders'] = array('id' => 'folders', 'section' => rcube_label('specialfolders'));
- $sections['server'] = array('id' => 'server', 'section' => rcube_label('serversettings'));
+ $sections['general'] = array('id' => 'general', 'section' => $RCMAIL->gettext('uisettings'));
+ $sections['mailbox'] = array('id' => 'mailbox', 'section' => $RCMAIL->gettext('mailboxview'));
+ $sections['mailview'] = array('id' => 'mailview','section' => $RCMAIL->gettext('messagesdisplaying'));
+ $sections['compose'] = array('id' => 'compose', 'section' => $RCMAIL->gettext('messagescomposition'));
+ $sections['addressbook'] = array('id' => 'addressbook','section' => $RCMAIL->gettext('addressbook'));
+ $sections['folders'] = array('id' => 'folders', 'section' => $RCMAIL->gettext('specialfolders'));
+ $sections['server'] = array('id' => 'server', 'section' => $RCMAIL->gettext('serversettings'));
// hook + define list cols
$plugin = $RCMAIL->plugins->exec_hook('preferences_sections_list',
@@ -155,10 +179,10 @@ function rcmail_user_prefs($current = null)
// general
case 'general':
$blocks = array(
- 'main' => array('name' => Q(rcube_label('mainoptions'))),
- 'skin' => array('name' => Q(rcube_label('skin'))),
- 'browser' => array('name' => Q(rcube_label('browseroptions'))),
- 'advanced'=> array('name' => Q(rcube_label('advancedoptions'))),
+ 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))),
+ 'skin' => array('name' => rcube::Q($RCMAIL->gettext('skin'))),
+ 'browser' => array('name' => rcube::Q($RCMAIL->gettext('browseroptions'))),
+ 'advanced'=> array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))),
);
// language selection
@@ -175,7 +199,7 @@ function rcmail_user_prefs($current = null)
$select->add(array_values($a_lang), array_keys($a_lang));
$blocks['main']['options']['language'] = array(
- 'title' => html::label($field_id, Q(rcube_label('language'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('language'))),
'content' => $select->show($RCMAIL->user->language),
);
}
@@ -188,7 +212,7 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_timezone';
$select = new html_select(array('name' => '_timezone', 'id' => $field_id));
- $select->add(rcube_label('autodetect'), 'auto');
+ $select->add($RCMAIL->gettext('autodetect'), 'auto');
$zones = array();
foreach (DateTimeZone::listIdentifiers() as $i => $tzs) {
@@ -210,7 +234,7 @@ function rcmail_user_prefs($current = null)
}
$blocks['main']['options']['timezone'] = array(
- 'title' => html::label($field_id, Q(rcube_label('timezone'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('timezone'))),
'content' => $select->show((string)$config['timezone']),
);
}
@@ -232,7 +256,7 @@ function rcmail_user_prefs($current = null)
}
$blocks['main']['options']['time_format'] = array(
- 'title' => html::label($field_id, Q(rcube_label('timeformat'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('timeformat'))),
'content' => $select->show($RCMAIL->config->get('time_format')),
);
}
@@ -253,7 +277,7 @@ function rcmail_user_prefs($current = null)
}
$blocks['main']['options']['date_format'] = array(
- 'title' => html::label($field_id, Q(rcube_label('dateformat'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('dateformat'))),
'content' => $select->show($config['date_format']),
);
}
@@ -268,7 +292,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['prettydate'] = array(
- 'title' => html::label($field_id, Q(rcube_label('prettydate'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('prettydate'))),
'content' => $input->show($config['prettydate']?1:0),
);
}
@@ -281,16 +305,16 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_refresh_interval';
$select = new html_select(array('name' => '_refresh_interval', 'id' => $field_id));
- $select->add(rcube_label('never'), 0);
+ $select->add($RCMAIL->gettext('never'), 0);
foreach (array(1, 3, 5, 10, 15, 30, 60) as $min) {
if (!$config['min_refresh_interval'] || $config['min_refresh_interval'] <= $min * 60) {
- $label = rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min)));
+ $label = $RCMAIL->gettext(array('name' => 'everynminutes', 'vars' => array('n' => $min)));
$select->add($label, $min);
}
}
$blocks['main']['options']['refresh_interval'] = array(
- 'title' => html::label($field_id, Q(rcube_label('refreshinterval'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('refreshinterval'))),
'content' => $select->show($config['refresh_interval']/60),
);
}
@@ -318,16 +342,16 @@ function rcmail_user_prefs($current = null)
if (is_array($meta) && $meta['name']) {
$skinname = $meta['name'];
- $author_link = $meta['url'] ? html::a(array('href' => $meta['url'], 'target' => '_blank'), Q($meta['author'])) : Q($meta['author']);
- $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank'), Q($meta['license'])) : Q($meta['license']);
+ $author_link = $meta['url'] ? html::a(array('href' => $meta['url'], 'target' => '_blank'), rcube::Q($meta['author'])) : rcube::Q($meta['author']);
+ $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank'), rcube::Q($meta['license'])) : rcube::Q($meta['license']);
}
$blocks['skin']['options'][$skin]['content'] = html::label(array('class' => 'skinselection'),
html::span('skinitem', $input->show($config['skin'], array('value' => $skin, 'id' => $field_id.$skin))) .
html::span('skinitem', html::img(array('src' => $thumbnail, 'class' => 'skinthumbnail', 'alt' => $skin, 'width' => 64, 'height' => 64))) .
- html::span('skinitem', html::span('skinname', Q($skinname)) . html::br() .
+ html::span('skinitem', html::span('skinname', rcube::Q($skinname)) . html::br() .
html::span('skinauthor', $author_link ? 'by ' . $author_link : '') . html::br() .
- html::span('skinlicense', $license_link ? rcube_label('license').':&nbsp;' . $license_link : ''))
+ html::span('skinlicense', $license_link ? $RCMAIL->gettext('license').':&nbsp;' . $license_link : ''))
);
}
}
@@ -344,7 +368,7 @@ function rcmail_user_prefs($current = null)
$checkbox = new html_checkbox(array('name' => '_standard_windows', 'id' => $field_id, 'value' => 1));
$blocks['browser']['options']['standard_windows'] = array(
- 'title' => html::label($field_id, Q(rcube_label('standardwindows'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('standardwindows'))),
'content' => $checkbox->show($config['standard_windows']?1:0),
);
}
@@ -352,13 +376,13 @@ function rcmail_user_prefs($current = null)
if ($current) {
$product_name = $RCMAIL->config->get('product_name', 'Roundcube Webmail');
$RCMAIL->output->add_script(sprintf("%s.check_protocol_handler('%s', '#mailtoprotohandler');",
- JS_OBJECT_NAME, JQ($product_name)), 'foot');
+ rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'foot');
}
$blocks['browser']['options']['mailtoprotohandler'] = array(
'content' => html::a(array(
'href' => '#',
- 'id' => 'mailtoprotohandler'), Q(rcube_label('mailtoprotohandler'))),
+ 'id' => 'mailtoprotohandler'), rcube::Q($RCMAIL->gettext('mailtoprotohandler'))),
);
break;
@@ -366,9 +390,9 @@ function rcmail_user_prefs($current = null)
// Mailbox view (mail screen)
case 'mailbox':
$blocks = array(
- 'main' => array('name' => Q(rcube_label('mainoptions'))),
- 'new_message' => array('name' => Q(rcube_label('newmessage'))),
- 'advanced' => array('name' => Q(rcube_label('advancedoptions'))),
+ 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))),
+ 'new_message' => array('name' => rcube::Q($RCMAIL->gettext('newmessage'))),
+ 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))),
);
// show config parameter for preview pane
@@ -382,7 +406,7 @@ function rcmail_user_prefs($current = null)
'onchange' => "$('#rcmfd_preview_pane_mark_read').prop('disabled', !this.checked)"));
$blocks['main']['options']['preview_pane'] = array(
- 'title' => html::label($field_id, Q(rcube_label('previewpane'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('previewpane'))),
'content' => $input->show($config['preview_pane']?1:0),
);
}
@@ -400,16 +424,16 @@ function rcmail_user_prefs($current = null)
$select = new html_select(array('name' => '_preview_pane_mark_read', 'id' => $field_id,
'disabled' => $config['preview_pane']?0:1));
- $select->add(rcube_label('never'), '-1');
- $select->add(rcube_label('immediately'), 0);
+ $select->add($RCMAIL->gettext('never'), '-1');
+ $select->add($RCMAIL->gettext('immediately'), 0);
foreach (array(5, 10, 20, 30) as $sec) {
- $label = rcube_label(array('name' => 'afternseconds', 'vars' => array('n' => $sec)));
+ $label = $RCMAIL->gettext(array('name' => 'afternseconds', 'vars' => array('n' => $sec)));
$select->add($label, $sec);
}
$blocks['main']['options']['preview_pane_mark_read'] = array(
- 'title' => html::label($field_id, Q(rcube_label('previewpanemarkread'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('previewpanemarkread'))),
'content' => $select->show(intval($config['preview_pane_mark_read'])),
);
}
@@ -421,14 +445,14 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_mdn_requests';
$select = new html_select(array('name' => '_mdn_requests', 'id' => $field_id));
- $select->add(rcube_label('askuser'), 0);
- $select->add(rcube_label('autosend'), 1);
- $select->add(rcube_label('autosendknown'), 3);
- $select->add(rcube_label('autosendknownignore'), 4);
- $select->add(rcube_label('ignore'), 2);
+ $select->add($RCMAIL->gettext('askuser'), 0);
+ $select->add($RCMAIL->gettext('autosend'), 1);
+ $select->add($RCMAIL->gettext('autosendknown'), 3);
+ $select->add($RCMAIL->gettext('autosendknownignore'), 4);
+ $select->add($RCMAIL->gettext('ignore'), 2);
$blocks['main']['options']['mdn_requests'] = array(
- 'title' => html::label($field_id, Q(rcube_label('mdnrequests'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('mdnrequests'))),
'content' => $select->show($config['mdn_requests']),
);
}
@@ -444,12 +468,12 @@ function rcmail_user_prefs($current = null)
if ($supported) {
$field_id = 'rcmfd_autoexpand_threads';
$select = new html_select(array('name' => '_autoexpand_threads', 'id' => $field_id));
- $select->add(rcube_label('never'), 0);
- $select->add(rcube_label('do_expand'), 1);
- $select->add(rcube_label('expand_only_unread'), 2);
+ $select->add($RCMAIL->gettext('never'), 0);
+ $select->add($RCMAIL->gettext('do_expand'), 1);
+ $select->add($RCMAIL->gettext('expand_only_unread'), 2);
$blocks['main']['options']['autoexpand_threads'] = array(
- 'title' => html::label($field_id, Q(rcube_label('autoexpand_threads'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autoexpand_threads'))),
'content' => $select->show($config['autoexpand_threads']),
);
}
@@ -466,7 +490,7 @@ function rcmail_user_prefs($current = null)
$size = intval($config['mail_pagesize'] ? $config['mail_pagesize'] : $config['pagesize']);
$blocks['main']['options']['pagesize'] = array(
- 'title' => html::label($field_id, Q(rcube_label('pagesize'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))),
'content' => $input->show($size ? $size : 50),
);
}
@@ -480,7 +504,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1));
$blocks['new_message']['options']['check_all_folders'] = array(
- 'title' => html::label($field_id, Q(rcube_label('checkallfolders'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('checkallfolders'))),
'content' => $input->show($config['check_all_folders']?1:0),
);
}
@@ -489,8 +513,8 @@ function rcmail_user_prefs($current = null)
// Message viewing
case 'mailview':
$blocks = array(
- 'main' => array('name' => Q(rcube_label('mainoptions'))),
- 'advanced' => array('name' => Q(rcube_label('advancedoptions'))),
+ 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))),
+ 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))),
);
// show checkbox to open message view in new window
@@ -503,7 +527,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_message_extwin', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['message_extwin'] = array(
- 'title' => html::label($field_id, Q(rcube_label('showinextwin'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showinextwin'))),
'content' => $input->show($config['message_extwin']?1:0),
);
}
@@ -518,7 +542,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_message_show_email', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['message_show_email'] = array(
- 'title' => html::label($field_id, Q(rcube_label('showemail'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showemail'))),
'content' => $input->show($config['message_show_email']?1:0),
);
}
@@ -534,7 +558,7 @@ function rcmail_user_prefs($current = null)
'onchange' => "$('#rcmfd_show_images').prop('disabled', !this.checked).val(0)"));
$blocks['main']['options']['prefer_html'] = array(
- 'title' => html::label($field_id, Q(rcube_label('preferhtml'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('preferhtml'))),
'content' => $input->show($config['prefer_html']?1:0),
);
}
@@ -547,7 +571,7 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_default_charset';
$blocks['advanced']['options']['default_charset'] = array(
- 'title' => html::label($field_id, Q(rcube_label('defaultcharset'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultcharset'))),
'content' => $RCMAIL->output->charset_selector(array(
'id' => $field_id, 'name' => '_default_charset', 'selected' => $config['default_charset']
)));
@@ -562,12 +586,12 @@ function rcmail_user_prefs($current = null)
$input = new html_select(array('name' => '_show_images', 'id' => $field_id,
'disabled' => !$config['prefer_html']));
- $input->add(rcube_label('never'), 0);
- $input->add(rcube_label('fromknownsenders'), 1);
- $input->add(rcube_label('always'), 2);
+ $input->add($RCMAIL->gettext('never'), 0);
+ $input->add($RCMAIL->gettext('fromknownsenders'), 1);
+ $input->add($RCMAIL->gettext('always'), 2);
$blocks['main']['options']['show_images'] = array(
- 'title' => html::label($field_id, Q(rcube_label('showremoteimages'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showremoteimages'))),
'content' => $input->show($config['prefer_html'] ? $config['show_images'] : 0),
);
}
@@ -581,7 +605,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_inline_images', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['inline_images'] = array(
- 'title' => html::label($field_id, Q(rcube_label('showinlineimages'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showinlineimages'))),
'content' => $input->show($config['inline_images']?1:0),
);
}
@@ -596,7 +620,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['display_next'] = array(
- 'title' => html::label($field_id, Q(rcube_label('displaynext'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('displaynext'))),
'content' => $input->show($config['display_next']?1:0),
);
}
@@ -605,10 +629,10 @@ function rcmail_user_prefs($current = null)
// Mail composition
case 'compose':
$blocks = array(
- 'main' => array('name' => Q(rcube_label('mainoptions'))),
- 'sig' => array('name' => Q(rcube_label('signatureoptions'))),
- 'spellcheck' => array('name' => Q(rcube_label('spellcheckoptions'))),
- 'advanced' => array('name' => Q(rcube_label('advancedoptions'))),
+ 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))),
+ 'sig' => array('name' => rcube::Q($RCMAIL->gettext('signatureoptions'))),
+ 'spellcheck' => array('name' => rcube::Q($RCMAIL->gettext('spellcheckoptions'))),
+ 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))),
);
// show checkbox to compose messages in a new window
@@ -621,7 +645,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_compose_extwin', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['compose_extwin'] = array(
- 'title' => html::label($field_id, Q(rcube_label('composeextwin'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('composeextwin'))),
'content' => $input->show($config['compose_extwin']?1:0),
);
}
@@ -634,13 +658,13 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_htmleditor';
$select = new html_select(array('name' => '_htmleditor', 'id' => $field_id));
- $select->add(rcube_label('never'), 0);
- $select->add(rcube_label('always'), 1);
- $select->add(rcube_label('htmlonreply'), 2);
- $select->add(rcube_label('htmlonreplyandforward'), 3);
+ $select->add($RCMAIL->gettext('never'), 0);
+ $select->add($RCMAIL->gettext('always'), 1);
+ $select->add($RCMAIL->gettext('htmlonreply'), 2);
+ $select->add($RCMAIL->gettext('htmlonreplyandforward'), 3);
$blocks['main']['options']['htmleditor'] = array(
- 'title' => html::label($field_id, Q(rcube_label('htmleditor'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('htmleditor'))),
'content' => $select->show(intval($config['htmleditor'])),
);
}
@@ -653,14 +677,14 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_autosave';
$select = new html_select(array('name' => '_draft_autosave', 'id' => $field_id, 'disabled' => empty($config['drafts_mbox'])));
- $select->add(rcube_label('never'), 0);
+ $select->add($RCMAIL->gettext('never'), 0);
foreach (array(1, 3, 5, 10) as $i => $min) {
- $label = rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min)));
+ $label = $RCMAIL->gettext(array('name' => 'everynminutes', 'vars' => array('n' => $min)));
$select->add($label, $min*60);
}
$blocks['main']['options']['draft_autosave'] = array(
- 'title' => html::label($field_id, Q(rcube_label('autosavedraft'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autosavedraft'))),
'content' => $select->show($config['draft_autosave']),
);
}
@@ -673,12 +697,12 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_param_folding';
$select = new html_select(array('name' => '_mime_param_folding', 'id' => $field_id));
- $select->add(rcube_label('2231folding'), 0);
- $select->add(rcube_label('miscfolding'), 1);
- $select->add(rcube_label('2047folding'), 2);
+ $select->add($RCMAIL->gettext('2231folding'), 0);
+ $select->add($RCMAIL->gettext('miscfolding'), 1);
+ $select->add($RCMAIL->gettext('2047folding'), 2);
$blocks['advanced']['options']['mime_param_folding'] = array(
- 'title' => html::label($field_id, Q(rcube_label('mimeparamfolding'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('mimeparamfolding'))),
'content' => $select->show($config['mime_param_folding']),
);
}
@@ -692,7 +716,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_force_7bit', 'id' => $field_id, 'value' => 1));
$blocks['advanced']['options']['force_7bit'] = array(
- 'title' => html::label($field_id, Q(rcube_label('force7bit'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('force7bit'))),
'content' => $input->show($config['force_7bit']?1:0),
);
}
@@ -706,7 +730,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_mdn_default', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['mdn_default'] = array(
- 'title' => html::label($field_id, Q(rcube_label('reqmdn'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('reqmdn'))),
'content' => $input->show($config['mdn_default']?1:0),
);
}
@@ -720,7 +744,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_dsn_default', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['dsn_default'] = array(
- 'title' => html::label($field_id, Q(rcube_label('reqdsn'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('reqdsn'))),
'content' => $input->show($config['dsn_default']?1:0),
);
}
@@ -734,7 +758,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_reply_same_folder', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['reply_same_folder'] = array(
- 'title' => html::label($field_id, Q(rcube_label('replysamefolder'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replysamefolder'))),
'content' => $input->show($config['reply_same_folder']?1:0),
);
}
@@ -747,12 +771,12 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_reply_mode';
$select = new html_select(array('name' => '_reply_mode', 'id' => $field_id));
- $select->add(rcube_label('replyempty'), -1);
- $select->add(rcube_label('replybottomposting'), 0);
- $select->add(rcube_label('replytopposting'), 1);
+ $select->add($RCMAIL->gettext('replyempty'), -1);
+ $select->add($RCMAIL->gettext('replybottomposting'), 0);
+ $select->add($RCMAIL->gettext('replytopposting'), 1);
$blocks['main']['options']['reply_mode'] = array(
- 'title' => html::label($field_id, Q(rcube_label('whenreplying'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('whenreplying'))),
'content' => $select->show(intval($config['reply_mode'])),
);
}
@@ -766,7 +790,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_spellcheck_before_send', 'id' => $field_id, 'value' => 1));
$blocks['spellcheck']['options']['spellcheck_before_send'] = array(
- 'title' => html::label($field_id, Q(rcube_label('spellcheckbeforesend'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('spellcheckbeforesend'))),
'content' => $input->show($config['spellcheck_before_send']?1:0),
);
}
@@ -782,7 +806,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_'.$key, 'id' => 'rcmfd_'.$key, 'value' => 1));
$blocks['spellcheck']['options'][$key] = array(
- 'title' => html::label($field_id, Q(rcube_label(str_replace('_', '', $key)))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext(str_replace('_', '', $key)))),
'content' => $input->show($config[$key]?1:0),
);
}
@@ -797,13 +821,13 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_show_sig';
$select = new html_select(array('name' => '_show_sig', 'id' => $field_id));
- $select->add(rcube_label('never'), 0);
- $select->add(rcube_label('always'), 1);
- $select->add(rcube_label('newmessageonly'), 2);
- $select->add(rcube_label('replyandforwardonly'), 3);
+ $select->add($RCMAIL->gettext('never'), 0);
+ $select->add($RCMAIL->gettext('always'), 1);
+ $select->add($RCMAIL->gettext('newmessageonly'), 2);
+ $select->add($RCMAIL->gettext('replyandforwardonly'), 3);
$blocks['sig']['options']['show_sig'] = array(
- 'title' => html::label($field_id, Q(rcube_label('autoaddsignature'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autoaddsignature'))),
'content' => $select->show($RCMAIL->config->get('show_sig', 1)),
);
}
@@ -817,7 +841,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_strip_existing_sig', 'id' => $field_id, 'value' => 1));
$blocks['sig']['options']['strip_existing_sig'] = array(
- 'title' => html::label($field_id, Q(rcube_label('replyremovesignature'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replyremovesignature'))),
'content' => $input->show($config['strip_existing_sig']?1:0),
);
}
@@ -830,11 +854,11 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_forward_attachment';
$select = new html_select(array('name' => '_forward_attachment', 'id' => $field_id));
- $select->add(rcube_label('inline'), 0);
- $select->add(rcube_label('asattachment'), 1);
+ $select->add($RCMAIL->gettext('inline'), 0);
+ $select->add($RCMAIL->gettext('asattachment'), 1);
$blocks['main']['options']['forward_attachment'] = array(
- 'title' => html::label($field_id, Q(rcube_label('forwardmode'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('forwardmode'))),
'content' => $select->show(intval($config['forward_attachment'])),
);
}
@@ -858,24 +882,42 @@ function rcmail_user_prefs($current = null)
$select_default_font = new html_select(array('name' => '_default_font', 'id' => $field_id));
$select_default_font->add('', '');
- $fonts = rcube_fontdefs();
+ $fonts = rcmail::font_defs();
foreach ($fonts as $fname => $font) {
$select_default_font->add($fname, $fname);
}
$blocks['main']['options']['default_font'] = array(
- 'title' => html::label($field_id, Q(rcube_label('defaultfont'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultfont'))),
'content' => $select_default_font->show($RCMAIL->config->get('default_font', 1)) .
$select_default_font_size->show($RCMAIL->config->get('default_font_size', 1))
);
}
+
+ if (!isset($no_override['reply_all_mode'])) {
+ if (!$current) {
+ continue 2;
+ }
+
+ $field_id = 'rcmfd_reply_all_mode';
+ $select = new html_select(array('name' => '_reply_all_mode', 'id' => $field_id));
+
+ $select->add($RCMAIL->gettext('replyalldefault'), 0);
+ $select->add($RCMAIL->gettext('replyalllist'), 1);
+
+ $blocks['main']['options']['reply_all_mode'] = array(
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replyallmode'))),
+ 'content' => $select->show(intval($config['reply_all_mode'])),
+ );
+ }
+
break;
// Addressbook config
case 'addressbook':
$blocks = array(
- 'main' => array('name' => Q(rcube_label('mainoptions'))),
- 'advanced' => array('name' => Q(rcube_label('advancedoptions'))),
+ 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))),
+ 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))),
);
if (!isset($no_override['default_addressbook'])
@@ -893,7 +935,7 @@ function rcmail_user_prefs($current = null)
}
$blocks['main']['options']['default_addressbook'] = array(
- 'title' => html::label($field_id, Q(rcube_label('defaultabook'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultabook'))),
'content' => $select->show($config['default_addressbook']),
);
}
@@ -907,13 +949,13 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_addressbook_name_listing';
$select = new html_select(array('name' => '_addressbook_name_listing', 'id' => $field_id));
- $select->add(rcube_label('name'), 0);
- $select->add(rcube_label('firstname') . ' ' . rcube_label('surname'), 1);
- $select->add(rcube_label('surname') . ' ' . rcube_label('firstname'), 2);
- $select->add(rcube_label('surname') . ', ' . rcube_label('firstname'), 3);
+ $select->add($RCMAIL->gettext('name'), 0);
+ $select->add($RCMAIL->gettext('firstname') . ' ' . $RCMAIL->gettext('surname'), 1);
+ $select->add($RCMAIL->gettext('surname') . ' ' . $RCMAIL->gettext('firstname'), 2);
+ $select->add($RCMAIL->gettext('surname') . ', ' . $RCMAIL->gettext('firstname'), 3);
$blocks['main']['options']['list_name_listing'] = array(
- 'title' => html::label($field_id, Q(rcube_label('listnamedisplay'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('listnamedisplay'))),
'content' => $select->show($config['addressbook_name_listing']),
);
}
@@ -927,12 +969,12 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_addressbook_sort_col';
$select = new html_select(array('name' => '_addressbook_sort_col', 'id' => $field_id));
- $select->add(rcube_label('name'), 'name');
- $select->add(rcube_label('firstname'), 'firstname');
- $select->add(rcube_label('surname'), 'surname');
+ $select->add($RCMAIL->gettext('name'), 'name');
+ $select->add($RCMAIL->gettext('firstname'), 'firstname');
+ $select->add($RCMAIL->gettext('surname'), 'surname');
$blocks['main']['options']['sort_col'] = array(
- 'title' => html::label($field_id, Q(rcube_label('listsorting'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('listsorting'))),
'content' => $select->show($config['addressbook_sort_col']),
);
}
@@ -948,7 +990,7 @@ function rcmail_user_prefs($current = null)
$size = intval($config['addressbook_pagesize'] ? $config['addressbook_pagesize'] : $config['pagesize']);
$blocks['main']['options']['pagesize'] = array(
- 'title' => html::label($field_id, Q(rcube_label('pagesize'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))),
'content' => $input->show($size ? $size : 50),
);
}
@@ -962,7 +1004,7 @@ function rcmail_user_prefs($current = null)
$checkbox = new html_checkbox(array('name' => '_autocomplete_single', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['autocomplete_single'] = array(
- 'title' => html::label($field_id, Q(rcube_label('autocompletesingle'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autocompletesingle'))),
'content' => $checkbox->show($config['autocomplete_single']?1:0),
);
}
@@ -971,8 +1013,8 @@ function rcmail_user_prefs($current = null)
// Special IMAP folders
case 'folders':
$blocks = array(
- 'main' => array('name' => Q(rcube_label('mainoptions'))),
- 'advanced' => array('name' => Q(rcube_label('advancedoptions'))),
+ 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))),
+ 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))),
);
if (!isset($no_override['show_real_foldernames'])) {
@@ -984,14 +1026,14 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_show_real_foldernames', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['show_real_foldernames'] = array(
- 'title' => html::label($field_id, Q(rcube_label('show_real_foldernames'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('show_real_foldernames'))),
'content' => $input->show($config['show_real_foldernames']?1:0),
);
}
// Configure special folders
if (!isset($no_override['default_folders']) && $current) {
- $select = rcmail_mailbox_select(array(
+ $select = $RCMAIL->folder_selector(array(
'noselection' => '---',
'realnames' => true,
'maxlength' => 30,
@@ -1009,7 +1051,7 @@ function rcmail_user_prefs($current = null)
}
$blocks['main']['options']['drafts_mbox'] = array(
- 'title' => Q(rcube_label('drafts')),
+ 'title' => rcube::Q($RCMAIL->gettext('drafts')),
'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox", 'onchange' => $onchange)),
);
}
@@ -1020,7 +1062,7 @@ function rcmail_user_prefs($current = null)
}
$blocks['main']['options']['sent_mbox'] = array(
- 'title' => Q(rcube_label('sent')),
+ 'title' => rcube::Q($RCMAIL->gettext('sent')),
'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox", 'onchange' => '')),
);
}
@@ -1031,7 +1073,7 @@ function rcmail_user_prefs($current = null)
}
$blocks['main']['options']['junk_mbox'] = array(
- 'title' => Q(rcube_label('junk')),
+ 'title' => rcube::Q($RCMAIL->gettext('junk')),
'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox", 'onchange' => $onchange)),
);
}
@@ -1042,7 +1084,7 @@ function rcmail_user_prefs($current = null)
}
$blocks['main']['options']['trash_mbox'] = array(
- 'title' => Q(rcube_label('trash')),
+ 'title' => rcube::Q($RCMAIL->gettext('trash')),
'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox", 'onchange' => $onchange)),
);
}
@@ -1051,9 +1093,9 @@ function rcmail_user_prefs($current = null)
// Server settings
case 'server':
$blocks = array(
- 'main' => array('name' => Q(rcube_label('mainoptions'))),
- 'maintenance' => array('name' => Q(rcube_label('maintenance'))),
- 'advanced' => array('name' => Q(rcube_label('advancedoptions'))),
+ 'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))),
+ 'maintenance' => array('name' => rcube::Q($RCMAIL->gettext('maintenance'))),
+ 'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))),
);
if (!isset($no_override['read_when_deleted'])) {
@@ -1065,7 +1107,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_read_when_deleted', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['read_when_deleted'] = array(
- 'title' => html::label($field_id, Q(rcube_label('readwhendeleted'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('readwhendeleted'))),
'content' => $input->show($config['read_when_deleted']?1:0),
);
}
@@ -1079,7 +1121,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_flag_for_deletion', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['flag_for_deletion'] = array(
- 'title' => html::label($field_id, Q(rcube_label('flagfordeletion'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('flagfordeletion'))),
'content' => $input->show($config['flag_for_deletion']?1:0),
);
}
@@ -1094,7 +1136,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_skip_deleted', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['skip_deleted'] = array(
- 'title' => html::label($field_id, Q(rcube_label('skipdeleted'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('skipdeleted'))),
'content' => $input->show($config['skip_deleted']?1:0),
);
}
@@ -1108,7 +1150,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_delete_always', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['delete_always'] = array(
- 'title' => html::label($field_id, Q(rcube_label('deletealways'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('deletealways'))),
'content' => $input->show($config['delete_always']?1:0),
);
}
@@ -1122,7 +1164,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_delete_junk', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['delete_junk'] = array(
- 'title' => html::label($field_id, Q(rcube_label('deletejunk'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('deletejunk'))),
'content' => $input->show($config['delete_junk']?1:0),
);
}
@@ -1137,7 +1179,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_logout_purge', 'id' => $field_id, 'value' => 1));
$blocks['maintenance']['options']['logout_purge'] = array(
- 'title' => html::label($field_id, Q(rcube_label('logoutclear'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('logoutclear'))),
'content' => $input->show($config['logout_purge']?1:0),
);
}
@@ -1152,7 +1194,7 @@ function rcmail_user_prefs($current = null)
$input = new html_checkbox(array('name' => '_logout_expunge', 'id' => $field_id, 'value' => 1));
$blocks['maintenance']['options']['logout_expunge'] = array(
- 'title' => html::label($field_id, Q(rcube_label('logoutcompact'))),
+ 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('logoutcompact'))),
'content' => $input->show($config['logout_expunge']?1:0),
);
}
@@ -1162,14 +1204,31 @@ function rcmail_user_prefs($current = null)
$data = $RCMAIL->plugins->exec_hook('preferences_list',
array('section' => $sect['id'], 'blocks' => $blocks, 'current' => $current));
+ $advanced_prefs = (array) $RCMAIL->config->get('advanced_prefs');
+
// create output
- foreach ($data['blocks'] as $block) {
+ foreach ($data['blocks'] as $key => $block) {
if (!empty($block['content']) || !empty($block['options'])) {
$found = true;
- break;
+ }
+ // move some options to the 'advanced' block as configured by admin
+ if ($key != 'advanced') {
+ foreach ($advanced_prefs as $opt) {
+ if ($block['options'][$opt]) {
+ $data['blocks']['advanced']['options'][$opt] = $block['options'][$opt];
+ unset($data['blocks'][$key]['options'][$opt]);
+ }
+ }
}
}
+ // move 'advanced' block to the end of the list
+ if (!empty($data['blocks']['advanced'])) {
+ $adv = $data['blocks']['advanced'];
+ unset($data['blocks']['advanced']);
+ $data['blocks']['advanced'] = $adv;
+ }
+
if (!$found)
unset($sections[$idx]);
else
@@ -1230,20 +1289,22 @@ function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class
$storage = $RCMAIL->get_storage();
$delimiter = $storage->get_hierarchy_delimiter();
- $name_utf8 = rcube_charset_convert($name, 'UTF7-IMAP');
+ $name_utf8 = rcube_charset::convert($name, 'UTF7-IMAP');
$protected = $protect_folders && in_array($name, $default_folders);
$foldersplit = explode($delimiter, $storage->mod_folder($name));
$level = count($foldersplit) - 1;
$display_name = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level)
- . 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,
false, $class_name);
- else
- $OUTPUT->command('replace_folder_row', rcube_charset_convert($oldname, 'UTF7-IMAP'),
+ }
+ else {
+ $OUTPUT->command('replace_folder_row', rcube_charset::convert($oldname, 'UTF7-IMAP'),
$name_utf8, $display_name, $protected, $class_name);
+ }
}
/**
@@ -1260,17 +1321,18 @@ function rcmail_settings_tabs($attrib)
array('command' => 'preferences', 'type' => 'link', 'label' => 'preferences', 'title' => 'editpreferences'),
array('command' => 'folders', 'type' => 'link', 'label' => 'folders', 'title' => 'managefolders'),
array('command' => 'identities', 'type' => 'link', 'label' => 'identities', 'title' => 'manageidentities'),
+ array('command' => 'responses', 'type' => 'link', 'label' => 'responses', 'title' => 'editresponses'),
);
// get all identites from DB and define list of cols to be displayed
$plugin = $RCMAIL->plugins->exec_hook('settings_actions', array(
'actions' => $default_actions,
- 'attrib' => $attrib,
+ 'attrib' => $attrib,
));
- $attrib = $plugin['attrib'];
+ $attrib = $plugin['attrib'];
$tagname = $attrib['tagname'];
- $tabs = array();
+ $tabs = array();
foreach ($plugin['actions'] as $k => $action) {
if (!$action['command'] && !$action['href'] && $action['action']) {
@@ -1278,13 +1340,15 @@ function rcmail_settings_tabs($attrib)
}
$button = $OUTPUT->button($action);
- $attr = $attrib;
+ $attr = $attrib;
$cmd = $action['action'] ? $action['action'] : $action['command'];
- $id = $action['id'] ? $action['id'] : $cmd;
+ $id = $action['id'] ? $action['id'] : $cmd;
+
if (!empty($id)) {
$attr['id'] = preg_replace('/[^a-z0-9]/i', '', $attrib['idprefix'] . $id);
}
+
$classnames = array($attrib['class']);
if (!empty($action['class'])) {
$classnames[] = $action['class'];
@@ -1295,30 +1359,10 @@ function rcmail_settings_tabs($attrib)
if ($RCMAIL->action == $cmd) {
$classnames[] = $attrib['selclass'];
}
+
$attr['class'] = join(' ', $classnames);
$tabs[] = html::tag($tagname, $attr, $button, html::$common_attrib);
}
return join('', $tabs);
}
-
-
-// register UI objects
-$OUTPUT->add_handlers(array(
- 'settingstabs' => 'rcmail_settings_tabs',
- 'prefsframe' => 'rcmail_preferences_frame',
- 'sectionslist' => 'rcmail_sections_list',
- 'identitieslist' => 'rcmail_identities_list',
-));
-
-// register action aliases
-$RCMAIL->register_action_map(array(
- 'folders' => 'folders.inc',
- 'rename-folder' => 'folders.inc',
- 'delete-folder' => 'folders.inc',
- 'subscribe' => 'folders.inc',
- 'unsubscribe' => 'folders.inc',
- 'purge' => 'folders.inc',
- 'folder-size' => 'folders.inc',
- 'add-identity' => 'edit_identity.inc',
-));
diff --git a/program/steps/settings/identities.inc b/program/steps/settings/identities.inc
index 82a1841a3..e19c16c79 100644
--- a/program/steps/settings/identities.inc
+++ b/program/steps/settings/identities.inc
@@ -5,7 +5,7 @@
| program/steps/settings/identities.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2007, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -21,23 +21,24 @@
define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
-$OUTPUT->set_pagetitle(rcube_label('identities'));
+$OUTPUT->set_pagetitle($RCMAIL->gettext('identities'));
$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->set_env('identities_level', IDENTITIES_LEVEL);
$OUTPUT->add_label('deleteidentityconfirm');
$OUTPUT->send('identities');
+
+
+// similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
+function rcmail_identity_frame($attrib)
+{
+ global $OUTPUT;
+
+ if (!$attrib['id']) {
+ $attrib['id'] = 'rcmIdentityFrame';
+ }
+
+ return $OUTPUT->frame($attrib, true);
+}
diff --git a/program/steps/settings/responses.inc b/program/steps/settings/responses.inc
new file mode 100644
index 000000000..35a2a1b64
--- /dev/null
+++ b/program/steps/settings/responses.inc
@@ -0,0 +1,133 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/settings/responses.inc |
+ | |
+ | This file is part of the Roundcube Webmail client |
+ | Copyright (C) 2013, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ | PURPOSE: |
+ | Manage and save canned response texts |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+*/
+
+
+if (!empty($_POST['_insert'])) {
+ $name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST));
+ $text = trim(rcube_utils::get_input_value('_text', rcube_utils::INPUT_POST));
+
+ if (!empty($name) && !empty($text)) {
+ $dupes = 0;
+ $responses = $RCMAIL->get_compose_responses(false, true);
+ foreach ($responses as $resp) {
+ if (strcasecmp($name, preg_replace('/\s\(\d+\)$/', '', $resp['name'])) == 0)
+ $dupes++;
+ }
+ if ($dupes) { // require a unique name
+ $name .= ' (' . ++$dupes . ')';
+ }
+
+ $response = array('name' => $name, 'text' => $text, 'format' => 'text', 'key' => substr(md5($name), 0, 16));
+ $responses[] = $response;
+
+ if ($RCMAIL->user->save_prefs(array('compose_responses' => $responses))) {
+ $RCMAIL->output->command('add_response_item', $response);
+ $RCMAIL->output->command('display_message', $RCMAIL->gettext('successfullysaved'), 'confirmation');
+ }
+ else {
+ $RCMAIL->output->command('display_message', $RCMAIL->gettext('errorsaving'), 'error');
+ }
+ }
+
+ // send response
+ $RCMAIL->output->send();
+}
+
+if ($RCMAIL->action == 'delete-response') {
+ if ($key = rcube_utils::get_input_value('_key', rcube_utils::INPUT_GPC)) {
+ $responses = $RCMAIL->get_compose_responses(false, true);
+ foreach ($responses as $i => $response) {
+ if (empty($response['key']))
+ $response['key'] = substr(md5($response['name']), 0, 16);
+ if ($response['key'] == $key) {
+ unset($responses[$i]);
+ $deleted = $RCMAIL->user->save_prefs(array('compose_responses' => $responses));
+ break;
+ }
+ }
+ }
+
+ if ($deleted) {
+ $RCMAIL->output->command('display_message', $RCMAIL->gettext('deletedsuccessfully'), 'confirmation');
+ $RCMAIL->output->command('remove_response', $key);
+ }
+
+ if ($RCMAIL->output->ajax_call) {
+ $RCMAIL->output->send();
+ }
+}
+
+
+$OUTPUT->set_pagetitle($RCMAIL->gettext('responses'));
+$OUTPUT->include_script('list.js');
+
+$OUTPUT->add_handlers(array(
+ 'responseframe' => 'rcmail_response_frame',
+ 'responseslist' => 'rcmail_responses_list',
+));
+$OUTPUT->add_label('deleteresponseconfirm');
+
+$OUTPUT->send('responses');
+
+
+/**
+ *
+ */
+function rcmail_responses_list($attrib)
+{
+ global $RCMAIL, $OUTPUT;
+
+ $attrib += array('id' => 'rcmresponseslist', 'tagname' => 'table', 'cols' => 1);
+
+ $plugin = $RCMAIL->plugins->exec_hook('responses_list', array(
+ 'list' => $RCMAIL->get_compose_responses(true),
+ 'cols' => array('name')
+ ));
+
+ $out = $RCMAIL->table_output($attrib, $plugin['list'], $plugin['cols'], 'key');
+
+ $readonly_responses = array();
+ foreach ($plugin['list'] as $item) {
+ if (!empty($item['static'])) {
+ $readonly_responses[] = $item['key'];
+ }
+ }
+
+ // set client env
+ $OUTPUT->add_gui_object('responseslist', $attrib['id']);
+ $OUTPUT->set_env('readonly_responses', $readonly_responses);
+
+ return $out;
+}
+
+// similar function as /steps/addressbook/func.inc::rcmail_contact_frame()
+function rcmail_response_frame($attrib)
+{
+ global $OUTPUT;
+
+ if (!$attrib['id']) {
+ $attrib['id'] = 'rcmResponseFrame';
+ }
+
+ $OUTPUT->set_env('contentframe', $attrib['id']);
+
+ return $OUTPUT->frame($attrib, true);
+}
diff --git a/program/steps/settings/save_folder.inc b/program/steps/settings/save_folder.inc
index 877b0fbbe..d1449bb38 100644
--- a/program/steps/settings/save_folder.inc
+++ b/program/steps/settings/save_folder.inc
@@ -1,11 +1,11 @@
<?php
-/**
+/*
+-----------------------------------------------------------------------+
| program/steps/settings/save_folder.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2012, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -19,18 +19,17 @@
+-----------------------------------------------------------------------+
*/
-// WARNING: folder names in UI are encoded with RCMAIL_CHARSET
+// WARNING: folder names in UI are encoded with RCUBE_CHARSET
// init IMAP connection
$STORAGE = $RCMAIL->get_storage();
+$name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true));
+$old = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true);
+$path = rcube_utils::get_input_value('_parent', rcube_utils::INPUT_POST, true);
-$name = trim(get_input_value('_name', RCUBE_INPUT_POST, true));
-$old = trim(get_input_value('_mbox', RCUBE_INPUT_POST, true));
-$path = trim(get_input_value('_parent', RCUBE_INPUT_POST, true));
-
-$name_imap = rcube_charset_convert($name, RCMAIL_CHARSET, 'UTF7-IMAP');
-$old_imap = rcube_charset_convert($old, RCMAIL_CHARSET, 'UTF7-IMAP');
+$name_imap = rcube_charset::convert($name, RCUBE_CHARSET, 'UTF7-IMAP');
+$old_imap = rcube_charset::convert($old, RCUBE_CHARSET, 'UTF7-IMAP');
// $path is in UTF7-IMAP already
$delimiter = $STORAGE->get_hierarchy_delimiter();
@@ -40,16 +39,16 @@ $options = strlen($old_imap) ? rcmail_folder_options($old_imap) : array();
if ($options['protected'] || $options['norename']) {
}
else if (!strlen($name)) {
- $error = rcube_label('cannotbeempty');
+ $error = $RCMAIL->gettext('namecannotbeempty');
}
else if (mb_strlen($name) > 128) {
- $error = rcube_label('nametoolong');
+ $error = $RCMAIL->gettext('nametoolong');
}
else {
// these characters are problematic e.g. when used in LIST/LSUB
foreach (array($delimiter, '%', '*') as $char) {
if (strpos($name, $delimiter) !== false) {
- $error = rcube_label('forbiddencharacter') . " ($char)";
+ $error = $RCMAIL->gettext('forbiddencharacter') . " ($char)";
break;
}
}
@@ -76,7 +75,7 @@ if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap))
if ($parent_opts['namespace'] != 'personal'
&& (empty($parent_opts['rights']) || !preg_match('/[ck]/', implode($parent_opts['rights'])))
) {
- $error = rcube_label('parentnotwritable');
+ $error = $RCMAIL->gettext('parentnotwritable');
}
}
@@ -90,15 +89,14 @@ else {
$folder['options'] = $options;
$folder['settings'] = array(
// List view mode: 0-list, 1-threads
- 'view_mode' => (int) get_input_value('_viewmode', RCUBE_INPUT_POST),
- 'sort_column' => get_input_value('_sortcol', RCUBE_INPUT_POST),
- 'sort_order' => get_input_value('_sortord', RCUBE_INPUT_POST),
+ 'view_mode' => (int) rcube_utils::get_input_value('_viewmode', rcube_utils::INPUT_POST),
+ 'sort_column' => rcube_utils::get_input_value('_sortcol', rcube_utils::INPUT_POST),
+ 'sort_order' => rcube_utils::get_input_value('_sortord', rcube_utils::INPUT_POST),
);
}
// create a new mailbox
if (!$error && !strlen($old)) {
-
$folder['subscribe'] = true;
$plugin = $RCMAIL->plugins->exec_hook('folder_create', array('record' => $folder));
@@ -136,7 +134,6 @@ if (!$error && !strlen($old)) {
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
}
}
-
// update a mailbox
else if (!$error) {
$plugin = $RCMAIL->plugins->exec_hook('folder_update', array('record' => $folder));
@@ -192,6 +189,9 @@ else if (!$error) {
rcmail_update_folder_row($folder['name'], $folder['oldname'], $folder['subscribe'], $folder['class']);
$OUTPUT->send('iframe');
}
+ else if (!empty($folder['class'])) {
+ rcmail_update_folder_row($folder['name'], $folder['oldname'], $folder['subscribe'], $folder['class']);
+ }
}
else {
// show error message
@@ -199,4 +199,4 @@ else if (!$error) {
}
}
-rcmail_overwrite_action('edit-folder');
+$RCMAIL->overwrite_action('edit-folder');
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index d3b132f8b..1584c5f00 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -5,7 +5,7 @@
| program/steps/settings/save_identity.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -21,161 +21,173 @@
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');
$updated = $default_id = false;
// check input
if (IDENTITIES_LEVEL != 4 && (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3))) {
- $OUTPUT->show_message('formincomplete', 'warning');
- rcmail_overwrite_action('edit-identity');
- return;
+ $OUTPUT->show_message('formincomplete', 'warning');
+ $RCMAIL->overwrite_action('edit-identity');
+ return;
}
$save_data = array();
foreach ($a_save_cols as $col) {
- $fname = '_'.$col;
- if (isset($_POST[$fname]))
- $save_data[$col] = get_input_value($fname, RCUBE_INPUT_POST, true);
+ $fname = '_'.$col;
+ if (isset($_POST[$fname])) {
+ $save_data[$col] = rcube_utils::get_input_value($fname, rcube_utils::INPUT_POST, true);
+ }
}
// set "off" values for checkboxes that were not checked, and therefore
// not included in the POST body.
foreach ($a_boolean_cols as $col) {
- $fname = '_' . $col;
- if (!isset($_POST[$fname]))
- $save_data[$col] = 0;
+ $fname = '_' . $col;
+ if (!isset($_POST[$fname])) {
+ $save_data[$col] = 0;
+ }
}
// unset email address if user has no rights to change it
if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) {
- unset($save_data['email']);
+ unset($save_data['email']);
}
// unset all fields except signature
else if (IDENTITIES_LEVEL == 4) {
- foreach ($save_data as $idx => $value) {
- if ($idx != 'signature' && $idx != 'html_signature') {
- unset($save_data[$idx]);
+ foreach ($save_data as $idx => $value) {
+ if ($idx != 'signature' && $idx != 'html_signature') {
+ unset($save_data[$idx]);
+ }
}
- }
}
// Validate e-mail addresses
-$email_checks = array(rcube_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 (rcube_mime::decode_address_list($save_data[$item], null, false) as $rcpt)
- $email_checks[] = rcube_idn_to_ascii($rcpt['mailto']);
+ foreach (rcube_mime::decode_address_list($save_data[$item], null, false) as $rcpt) {
+ $email_checks[] = rcube_utils::idn_to_ascii($rcpt['mailto']);
+ }
}
foreach ($email_checks as $email) {
- if ($email && !check_email($email)) {
- // show error message
- $OUTPUT->show_message('emailformaterror', 'error', array('email' => rcube_idn_to_utf8($email)), false);
- rcmail_overwrite_action('edit-identity');
- return;
- }
+ if ($email && !rcube_utils::check_email($email)) {
+ // show error message
+ $OUTPUT->show_message('emailformaterror', 'error', array('email' => rcube_utils::idn_to_utf8($email)), false);
+ $RCMAIL->overwrite_action('edit-identity');
+ return;
+ }
}
// XSS protection in HTML signature (#1489251)
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
- // when the form is displayed again
- unset($_POST['_signature']);
+ // clear POST data of signature, we want to use safe content
+ // when the form is displayed again
+ unset($_POST['_signature']);
}
// update an existing contact
if ($_POST['_iid']) {
- $iid = get_input_value('_iid', RCUBE_INPUT_POST);
-
- if (in_array(IDENTITIES_LEVEL, array(1,3,4))) {
- // merge with old identity data, fixes #1488834
- $identity = $RCMAIL->user->get_identity($iid);
- $save_data = array_merge($identity, $save_data);
- unset($save_data['changed'], $save_data['del'], $save_data['user_id'], $save_data['identity_id']);
- }
-
- $plugin = $RCMAIL->plugins->exec_hook('identity_update', array('id' => $iid, 'record' => $save_data));
- $save_data = $plugin['record'];
-
- if ($save_data['email'])
- $save_data['email'] = rcube_idn_to_ascii($save_data['email']);
- 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
- $OUTPUT->command('parent.update_identity_row', $iid, Q(trim($save_data['name'] . ' <' . rcube_idn_to_utf8($save_data['email']) .'>')));
+ $iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_POST);
+
+ if (in_array(IDENTITIES_LEVEL, array(1,3,4))) {
+ // merge with old identity data, fixes #1488834
+ $identity = $RCMAIL->user->get_identity($iid);
+ $save_data = array_merge($identity, $save_data);
+
+ unset($save_data['changed'], $save_data['del'], $save_data['user_id'], $save_data['identity_id']);
}
- }
- else {
- // show error message
- $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false);
- rcmail_overwrite_action('edit-identity');
- return;
- }
-}
+ $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 (!$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
else if (IDENTITIES_LEVEL < 2) {
- if (IDENTITIES_LEVEL == 1) {
- $save_data['email'] = $RCMAIL->get_user_email();
- }
+ if (IDENTITIES_LEVEL == 1) {
+ $save_data['email'] = $RCMAIL->get_user_email();
+ }
- $plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data));
- $save_data = $plugin['record'];
+ $plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data));
+ $save_data = $plugin['record'];
- if ($save_data['email'])
- $save_data['email'] = rcube_idn_to_ascii($save_data['email']);
+ if ($save_data['email']) {
+ $save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']);
+ }
- if (!$plugin['abort'])
- $insert_id = $save_data['email'] ? $RCMAIL->user->insert_identity($save_data) : null;
- else
- $insert_id = $plugin['result'];
+ if (!$plugin['abort'])
+ $insert_id = $save_data['email'] ? $RCMAIL->user->insert_identity($save_data) : null;
+ else
+ $insert_id = $plugin['result'];
- if ($insert_id) {
- $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
+ if ($insert_id) {
+ $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
- $_GET['_iid'] = $insert_id;
+ $_GET['_iid'] = $insert_id;
- if (!empty($save_data['standard']))
- $default_id = $insert_id;
+ if (!empty($save_data['standard'])) {
+ $default_id = $insert_id;
+ }
- if ($_POST['_framed']) {
- // add a new row to the list
- $OUTPUT->command('parent.update_identity_row', $insert_id, Q(trim($save_data['name'] . ' <' . rcube_idn_to_utf8($save_data['email']) .'>')), true);
+ if ($_POST['_framed']) {
+ // add a new row to the list
+ $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
- $OUTPUT->show_message('opnotpermitted', 'error');
-
+else {
+ $OUTPUT->show_message('opnotpermitted', 'error');
+}
// mark all other identities as 'not-default'
-if ($default_id)
- $RCMAIL->user->set_default($default_id);
+if ($default_id) {
+ $RCMAIL->user->set_default($default_id);
+}
// go to next step
if (!empty($_REQUEST['_framed'])) {
- rcmail_overwrite_action('edit-identity');
+ $RCMAIL->overwrite_action('edit-identity');
+}
+else {
+ $RCMAIL->overwrite_action('identities');
}
-else
- rcmail_overwrite_action('identities');
/**
@@ -185,16 +197,16 @@ function rcmail_wash_html($html)
{
// Add header with charset spec., washtml cannot work without that
$html = '<html><head>'
- . '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />'
+ . '<meta http-equiv="Content-Type" content="text/html; charset='.RCUBE_CHARSET.'" />'
. '</head><body>' . $html . '</body></html>';
// clean HTML with washhtml by Frederic Motte
$wash_opts = array(
- 'show_washed' => false,
- 'allow_remote' => 1,
- 'charset' => RCMAIL_CHARSET,
+ 'show_washed' => false,
+ 'allow_remote' => 1,
+ 'charset' => RCUBE_CHARSET,
'html_elements' => array('body', 'link'),
- 'html_attribs' => array('rel', 'type'),
+ 'html_attribs' => array('rel', 'type'),
);
// initialize HTML washer
@@ -204,12 +216,12 @@ function rcmail_wash_html($html)
//$washer->add_callback('style', 'rcmail_washtml_callback');
// Remove non-UTF8 characters (#1487813)
- $html = rc_utf8_clean($html);
+ $html = rcube_charset::clean($html);
$html = $washer->wash($html);
// remove unwanted comments and tags (produced by washtml)
$html = preg_replace(array('/<!--[^>]+-->/', '/<\/?body>/'), '', $html);
- return $html;
+ return $html;
}
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 717c7ad8c..f71eee39a 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -5,7 +5,7 @@
| program/steps/settings/save_prefs.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -19,190 +19,191 @@
+-----------------------------------------------------------------------+
*/
-$CURR_SECTION = get_input_value('_section', RCUBE_INPUT_POST);
-
+$CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_POST);
$a_user_prefs = array();
// set options for specified section
-switch ($CURR_SECTION)
-{
- case 'general':
+switch ($CURR_SECTION) {
+case 'general':
$a_user_prefs = array(
- 'language' => isset($_POST['_language']) ? get_input_value('_language', RCUBE_INPUT_POST) : $CONFIG['language'],
- 'timezone' => isset($_POST['_timezone']) ? get_input_value('_timezone', RCUBE_INPUT_POST) : $CONFIG['timezone'],
- 'date_format' => isset($_POST['_date_format']) ? get_input_value('_date_format', RCUBE_INPUT_POST) : $CONFIG['date_format'],
- 'time_format' => isset($_POST['_time_format']) ? get_input_value('_time_format', RCUBE_INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'),
- 'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE,
- 'refresh_interval' => isset($_POST['_refresh_interval']) ? intval($_POST['_refresh_interval'])*60 : $CONFIG['refresh_interval'],
- 'standard_windows' => isset($_POST['_standard_windows']) ? TRUE : FALSE,
- 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'],
+ 'language' => isset($_POST['_language']) ? rcube_utils::get_input_value('_language', rcube_utils::INPUT_POST) : $CONFIG['language'],
+ 'timezone' => isset($_POST['_timezone']) ? rcube_utils::get_input_value('_timezone', rcube_utils::INPUT_POST) : $CONFIG['timezone'],
+ 'date_format' => isset($_POST['_date_format']) ? rcube_utils::get_input_value('_date_format', rcube_utils::INPUT_POST) : $CONFIG['date_format'],
+ 'time_format' => isset($_POST['_time_format']) ? rcube_utils::get_input_value('_time_format', rcube_utils::INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'),
+ 'prettydate' => isset($_POST['_pretty_date']) ? true : false,
+ 'refresh_interval' => isset($_POST['_refresh_interval']) ? intval($_POST['_refresh_interval'])*60 : $CONFIG['refresh_interval'],
+ 'standard_windows' => isset($_POST['_standard_windows']) ? true : false,
+ 'skin' => isset($_POST['_skin']) ? rcube_utils::get_input_value('_skin', rcube_utils::INPUT_POST) : $CONFIG['skin'],
);
// 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']) {
- $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_short'] = 'D ' . $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(
- 'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
- 'preview_pane_mark_read' => isset($_POST['_preview_pane_mark_read']) ? intval($_POST['_preview_pane_mark_read']) : $CONFIG['preview_pane_mark_read'],
- 'autoexpand_threads' => isset($_POST['_autoexpand_threads']) ? intval($_POST['_autoexpand_threads']) : 0,
- 'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0,
- 'check_all_folders' => isset($_POST['_check_all_folders']) ? TRUE : FALSE,
- 'mail_pagesize' => is_numeric($_POST['_mail_pagesize']) ? max(2, intval($_POST['_mail_pagesize'])) : $CONFIG['mail_pagesize'],
+ 'preview_pane' => isset($_POST['_preview_pane']) ? true : false,
+ 'preview_pane_mark_read' => isset($_POST['_preview_pane_mark_read']) ? intval($_POST['_preview_pane_mark_read']) : $CONFIG['preview_pane_mark_read'],
+ 'autoexpand_threads' => isset($_POST['_autoexpand_threads']) ? intval($_POST['_autoexpand_threads']) : 0,
+ 'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0,
+ 'check_all_folders' => isset($_POST['_check_all_folders']) ? true : false,
+ '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(
- 'message_extwin' => intval($_POST['_message_extwin']),
- 'message_show_email' => isset($_POST['_message_show_email']) ? TRUE : FALSE,
- 'prefer_html' => isset($_POST['_prefer_html']) ? TRUE : FALSE,
- 'inline_images' => isset($_POST['_inline_images']) ? TRUE : FALSE,
- 'show_images' => isset($_POST['_show_images']) ? intval($_POST['_show_images']) : 0,
- 'display_next' => isset($_POST['_display_next']) ? TRUE : FALSE,
- 'default_charset' => get_input_value('_default_charset', RCUBE_INPUT_POST),
+ 'message_extwin' => intval($_POST['_message_extwin']),
+ 'message_show_email' => isset($_POST['_message_show_email']) ? true : false,
+ 'prefer_html' => isset($_POST['_prefer_html']) ? true : false,
+ 'inline_images' => isset($_POST['_inline_images']) ? true : false,
+ 'show_images' => isset($_POST['_show_images']) ? intval($_POST['_show_images']) : 0,
+ 'display_next' => isset($_POST['_display_next']) ? true : false,
+ 'default_charset' => rcube_utils::get_input_value('_default_charset', rcube_utils::INPUT_POST),
);
- break;
+ break;
- case 'compose':
+case 'compose':
$a_user_prefs = array(
- 'compose_extwin' => intval($_POST['_compose_extwin']),
- 'htmleditor' => intval($_POST['_htmleditor']),
- 'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0,
- 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0,
- 'force_7bit' => isset($_POST['_force_7bit']) ? TRUE : FALSE,
- 'mdn_default' => isset($_POST['_mdn_default']) ? TRUE : FALSE,
- 'dsn_default' => isset($_POST['_dsn_default']) ? TRUE : FALSE,
- 'reply_same_folder' => isset($_POST['_reply_same_folder']) ? TRUE : FALSE,
- 'spellcheck_before_send' => isset($_POST['_spellcheck_before_send']) ? TRUE : FALSE,
- 'spellcheck_ignore_syms' => isset($_POST['_spellcheck_ignore_syms']) ? TRUE : FALSE,
- 'spellcheck_ignore_nums' => isset($_POST['_spellcheck_ignore_nums']) ? TRUE : FALSE,
- 'spellcheck_ignore_caps' => isset($_POST['_spellcheck_ignore_caps']) ? TRUE : FALSE,
- 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1,
- 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0,
- 'strip_existing_sig' => isset($_POST['_strip_existing_sig']),
- 'default_font' => get_input_value('_default_font', RCUBE_INPUT_POST),
- 'default_font_size' => get_input_value('_default_font_size', RCUBE_INPUT_POST),
- 'forward_attachment' => !empty($_POST['_forward_attachment']),
+ 'compose_extwin' => intval($_POST['_compose_extwin']),
+ 'htmleditor' => intval($_POST['_htmleditor']),
+ 'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0,
+ 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0,
+ 'force_7bit' => isset($_POST['_force_7bit']) ? true : false,
+ 'mdn_default' => isset($_POST['_mdn_default']) ? true : false,
+ 'dsn_default' => isset($_POST['_dsn_default']) ? true : false,
+ 'reply_same_folder' => isset($_POST['_reply_same_folder']) ? true : false,
+ 'spellcheck_before_send' => isset($_POST['_spellcheck_before_send']) ? true : false,
+ 'spellcheck_ignore_syms' => isset($_POST['_spellcheck_ignore_syms']) ? true : false,
+ 'spellcheck_ignore_nums' => isset($_POST['_spellcheck_ignore_nums']) ? true : false,
+ 'spellcheck_ignore_caps' => isset($_POST['_spellcheck_ignore_caps']) ? true : false,
+ 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1,
+ 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0,
+ 'strip_existing_sig' => isset($_POST['_strip_existing_sig']),
+ '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),
+ 'reply_all_mode' => intval($_POST['_reply_all_mode']),
+ 'forward_attachment' => !empty($_POST['_forward_attachment']),
);
- break;
+ break;
- case 'addressbook':
+case 'addressbook':
$a_user_prefs = array(
- 'default_addressbook' => get_input_value('_default_addressbook', RCUBE_INPUT_POST, true),
- 'autocomplete_single' => isset($_POST['_autocomplete_single']) ? TRUE : FALSE,
- 'addressbook_sort_col' => get_input_value('_addressbook_sort_col', RCUBE_INPUT_POST),
- 'addressbook_name_listing' => intval(get_input_value('_addressbook_name_listing', RCUBE_INPUT_POST)),
- 'addressbook_pagesize' => is_numeric($_POST['_addressbook_pagesize']) ? max(2, intval($_POST['_addressbook_pagesize'])) : $CONFIG['addressbook_pagesize'],
+ 'default_addressbook' => rcube_utils::get_input_value('_default_addressbook', rcube_utils::INPUT_POST, true),
+ 'autocomplete_single' => isset($_POST['_autocomplete_single']) ? true : false,
+ 'addressbook_sort_col' => rcube_utils::get_input_value('_addressbook_sort_col', rcube_utils::INPUT_POST),
+ 'addressbook_name_listing' => intval(rcube_utils::get_input_value('_addressbook_name_listing', rcube_utils::INPUT_POST)),
+ 'addressbook_pagesize' => is_numeric($_POST['_addressbook_pagesize']) ? max(2, intval($_POST['_addressbook_pagesize'])) : $CONFIG['addressbook_pagesize'],
);
- break;
+ break;
- case 'server':
+case 'server':
$a_user_prefs = array(
- 'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE,
- 'skip_deleted' => isset($_POST['_skip_deleted']) ? TRUE : FALSE,
- 'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? TRUE : FALSE,
- 'delete_always' => isset($_POST['_delete_always']) ? TRUE : FALSE,
- 'delete_junk' => isset($_POST['_delete_junk']) ? TRUE : FALSE,
- 'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE,
- 'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
+ 'read_when_deleted' => isset($_POST['_read_when_deleted']) ? true : false,
+ 'skip_deleted' => isset($_POST['_skip_deleted']) ? true : false,
+ 'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? true : false,
+ 'delete_always' => isset($_POST['_delete_always']) ? true : false,
+ 'delete_junk' => isset($_POST['_delete_junk']) ? true : false,
+ 'logout_purge' => isset($_POST['_logout_purge']) ? true : false,
+ 'logout_expunge' => isset($_POST['_logout_expunge']) ? true : false,
);
- break;
+ break;
- case 'folders':
+case 'folders':
$a_user_prefs = array(
- 'show_real_foldernames' =>
- isset($_POST['_show_real_foldernames']) ? TRUE : FALSE,
- 'drafts_mbox' => get_input_value('_drafts_mbox', RCUBE_INPUT_POST, true),
- 'sent_mbox' => get_input_value('_sent_mbox', RCUBE_INPUT_POST, true),
- 'junk_mbox' => get_input_value('_junk_mbox', RCUBE_INPUT_POST, true),
- 'trash_mbox' => get_input_value('_trash_mbox', RCUBE_INPUT_POST, true),
+ 'show_real_foldernames' => isset($_POST['_show_real_foldernames']) ? true : false,
+ 'drafts_mbox' => rcube_utils::get_input_value('_drafts_mbox', rcube_utils::INPUT_POST, true),
+ 'sent_mbox' => rcube_utils::get_input_value('_sent_mbox', rcube_utils::INPUT_POST, true),
+ 'junk_mbox' => rcube_utils::get_input_value('_junk_mbox', rcube_utils::INPUT_POST, true),
+ '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',
- array('prefs' => $a_user_prefs, 'section' => $CURR_SECTION));
+ array('prefs' => $a_user_prefs, 'section' => $CURR_SECTION));
$a_user_prefs = $plugin['prefs'];
// don't override these parameters
-foreach ((array)$CONFIG['dont_override'] as $p)
- $a_user_prefs[$p] = $CONFIG[$p];
+foreach ((array)$CONFIG['dont_override'] as $p) {
+ $a_user_prefs[$p] = $CONFIG[$p];
+}
// verify some options
-switch ($CURR_SECTION)
-{
- case 'general':
-
+switch ($CURR_SECTION) {
+case 'general':
// switch UI language
if (isset($_POST['_language']) && $a_user_prefs['language'] != $_SESSION['language']) {
- $RCMAIL->load_language($a_user_prefs['language']);
- $OUTPUT->command('reload', 500);
+ $RCMAIL->load_language($a_user_prefs['language']);
+ $OUTPUT->command('reload', 500);
}
// switch skin (if valid, otherwise unset the pref and fall back to default)
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'])
- $OUTPUT->command('reload', 500);
+ $OUTPUT->command('reload', 500);
$a_user_prefs['timezone'] = (string) $a_user_prefs['timezone'];
if (!empty($a_user_prefs['refresh_interval']) && !empty($CONFIG['min_refresh_interval'])) {
- if ($a_user_prefs['refresh_interval'] < $CONFIG['min_refresh_interval']) {
- $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'];
+ }
}
break;
- case 'mailbox':
-
+case 'mailbox':
// force min size
- if ($a_user_prefs['mail_pagesize'] < 1)
- $a_user_prefs['mail_pagesize'] = 10;
+ if ($a_user_prefs['mail_pagesize'] < 1) {
+ $a_user_prefs['mail_pagesize'] = 10;
+ }
- if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['mail_pagesize'] > $CONFIG['max_pagesize']))
- $a_user_prefs['mail_pagesize'] = (int) $CONFIG['max_pagesize'];
+ if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['mail_pagesize'] > $CONFIG['max_pagesize'])) {
+ $a_user_prefs['mail_pagesize'] = (int) $CONFIG['max_pagesize'];
+ }
break;
- case 'addressbook':
-
+case 'addressbook':
// force min size
- if ($a_user_prefs['addressbook_pagesize'] < 1)
- $a_user_prefs['addressbook_pagesize'] = 10;
+ if ($a_user_prefs['addressbook_pagesize'] < 1) {
+ $a_user_prefs['addressbook_pagesize'] = 10;
+ }
- if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['addressbook_pagesize'] > $CONFIG['max_pagesize']))
- $a_user_prefs['addressbook_pagesize'] = (int) $CONFIG['max_pagesize'];
+ if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['addressbook_pagesize'] > $CONFIG['max_pagesize'])) {
+ $a_user_prefs['addressbook_pagesize'] = (int) $CONFIG['max_pagesize'];
+ }
break;
- case 'folders':
-
+case 'folders':
// special handling for 'default_folders'
if (in_array('default_folders', (array)$CONFIG['dont_override'])) {
- foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p)
- $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) {
- if ($a_user_prefs[$p])
- $a_user_prefs['default_folders'][] = $a_user_prefs[$p];
- }
+ foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $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) {
+ if ($a_user_prefs[$p]) {
+ $a_user_prefs['default_folders'][] = $a_user_prefs[$p];
+ }
+ }
}
break;
@@ -210,15 +211,14 @@ switch ($CURR_SECTION)
// Save preferences
if (!$plugin['abort'])
- $saved = $RCMAIL->user->save_prefs($a_user_prefs);
+ $saved = $RCMAIL->user->save_prefs($a_user_prefs);
else
- $saved = $plugin['result'];
+ $saved = $plugin['result'];
if ($saved)
- $OUTPUT->show_message('successfullysaved', 'confirmation');
+ $OUTPUT->show_message('successfullysaved', 'confirmation');
else
- $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
+ $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
// display the form again
-rcmail_overwrite_action('edit-prefs');
-
+$RCMAIL->overwrite_action('edit-prefs');