summaryrefslogtreecommitdiff
path: root/program/steps/settings
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/settings')
-rw-r--r--program/steps/settings/edit_folder.inc17
-rw-r--r--program/steps/settings/folders.inc51
-rw-r--r--program/steps/settings/func.inc18
-rw-r--r--program/steps/settings/save_folder.inc12
-rw-r--r--program/steps/settings/save_prefs.inc8
5 files changed, 53 insertions, 53 deletions
diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc
index 9860c2fdd..b99764c60 100644
--- a/program/steps/settings/edit_folder.inc
+++ b/program/steps/settings/edit_folder.inc
@@ -21,13 +21,12 @@
// WARNING: folder names in UI are encoded with RCMAIL_CHARSET
-// init IMAP connection
-$RCMAIL->imap_connect();
-
function rcmail_folder_form($attrib)
{
global $RCMAIL;
+ $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');
@@ -36,13 +35,13 @@ function rcmail_folder_form($attrib)
$parent = trim(get_input_value('_path', RCUBE_INPUT_GPC, true));
$parent_imap = rcube_charset_convert($parent, RCMAIL_CHARSET, 'UTF7-IMAP');
- $threading_supported = $RCMAIL->imap->get_capability('THREAD');
- $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
+ $threading_supported = $storage->get_capability('THREAD');
+ $delimiter = $storage->get_hierarchy_delimiter();
// Get mailbox parameters
if (strlen($mbox)) {
$options = rcmail_folder_options($mbox_imap);
- $namespace = $RCMAIL->imap->get_namespace();
+ $namespace = $storage->get_namespace();
$path = explode($delimiter, $mbox_imap);
$folder = array_pop($path);
@@ -57,14 +56,14 @@ function rcmail_folder_form($attrib)
// allow creating subfolders of INBOX folder
if ($path == 'INBOX') {
- $path = $RCMAIL->imap->mod_mailbox($path, 'in');
+ $path = $storage->mod_folder($path, 'in');
}
}
// remove personal namespace prefix
if (strlen($path)) {
$path_id = $path;
- $path = $RCMAIL->imap->mod_mailbox($path.$delimiter);
+ $path = $storage->mod_folder($path.$delimiter);
if ($path[strlen($path)-1] == $delimiter) {
$path = substr($path, 0, -1);
}
@@ -193,7 +192,7 @@ function rcmail_folder_form($attrib)
);
if ((!$options['noselect'] && !$options['is_root']) || $mbox_imap == 'INBOX') {
- $msgcount = $RCMAIL->imap->messagecount($mbox_imap, 'ALL', true, false);
+ $msgcount = $storage->count($mbox_imap, 'ALL', true, false);
// Size
if ($msgcount) {
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 7364c6eec..94f446265 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -23,20 +23,20 @@
// WARNING: folder names in UI are encoded with RCMAIL_CHARSET
// init IMAP connection
-$RCMAIL->imap_connect();
+$STORAGE = $RCMAIL->get_storage();
// subscribe mailbox
if ($RCMAIL->action == 'subscribe')
{
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP');
if (strlen($mbox)) {
- $result = $RCMAIL->imap->subscribe(array($mbox));
+ $result = $STORAGE->subscribe(array($mbox));
// Handle virtual (non-existing) folders
- if (!$result && $RCMAIL->imap->get_error_code() == -1 &&
- $RCMAIL->imap->get_response_code() == rcube_imap::TRYCREATE
+ if (!$result && $STORAGE->get_error_code() == -1 &&
+ $STORAGE->get_response_code() == rcube_storage::TRYCREATE
) {
- $result = $RCMAIL->imap->create_mailbox($mbox, true);
+ $result = $STORAGE->create_folder($mbox, true);
if ($result) {
// @TODO: remove 'virtual' class of folder's row
}
@@ -45,7 +45,7 @@ if ($RCMAIL->action == 'subscribe')
if ($result) {
// Handle subscription of protected folder (#1487656)
if ($CONFIG['protect_default_folders'] == true
- && in_array($mbox, $CONFIG['default_imap_folders'])
+ && in_array($mbox, $CONFIG['default_folders'])
) {
$OUTPUT->command('disable_subscription', $mbox);
}
@@ -62,7 +62,7 @@ else if ($RCMAIL->action == 'unsubscribe')
{
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP');
if (strlen($mbox)) {
- $result = $RCMAIL->imap->unsubscribe(array($mbox));
+ $result = $STORAGE->unsubscribe(array($mbox));
if ($result)
$OUTPUT->show_message('folderunsubscribed', 'confirmation');
else
@@ -80,7 +80,7 @@ else if ($RCMAIL->action == 'delete-folder')
$plugin = $RCMAIL->plugins->exec_hook('folder_delete', array('name' => $mbox));
if (!$plugin['abort']) {
- $deleted = $RCMAIL->imap->delete_mailbox($plugin['name']);
+ $deleted = $STORAGE->delete_folder($plugin['name']);
}
else {
$deleted = $plugin['result'];
@@ -126,19 +126,19 @@ 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 = $RCMAIL->imap->get_hierarchy_delimiter();
+ $delimiter = $STORAGE->get_hierarchy_delimiter();
$trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
// we should only be purging trash (or their subfolders)
if (!strlen($CONFIG['trash_mbox']) || $mbox == $CONFIG['trash_mbox']
|| preg_match($trash_regexp, $mbox)
) {
- $success = $RCMAIL->imap->clear_mailbox($mbox);
+ $success = $STORAGE->delete_message('*', $mbox);
$delete = true;
}
// copy to Trash
else {
- $success = $RCMAIL->imap->move_message('1:*', $CONFIG['trash_mbox'], $mbox);
+ $success = $STORAGE->move_message('1:*', $CONFIG['trash_mbox'], $mbox);
$delete = false;
}
@@ -164,7 +164,7 @@ else if ($RCMAIL->action == 'folder-size')
{
$name = trim(get_input_value('_mbox', RCUBE_INPUT_POST, true));
- $size = $RCMAIL->imap->get_mailbox_size($name);
+ $size = $STORAGE->folder_size($name);
// @TODO: check quota and show percentage usage of specified mailbox?
@@ -199,13 +199,15 @@ function rcube_subscription_form($attrib)
$table->add_header('subscribed', '');
}
+ $STORAGE = $RCMAIL->get_storage();
+
// get folders from server
- $RCMAIL->imap->clear_cache('mailboxes', true);
+ $STORAGE->clear_cache('mailboxes', true);
- $a_unsubscribed = $RCMAIL->imap->list_unsubscribed();
- $a_subscribed = $RCMAIL->imap->list_mailboxes('', '*', null, null, true); // unsorted
- $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
- $namespace = $RCMAIL->imap->get_namespace();
+ $a_unsubscribed = $STORAGE->list_folders();
+ $a_subscribed = $STORAGE->list_folders_subscribed('', '*', null, null, true); // unsorted
+ $delimiter = $STORAGE->get_hierarchy_delimiter();
+ $namespace = $STORAGE->get_namespace();
$a_js_folders = array();
$seen = array();
$list_folders = array();
@@ -213,7 +215,7 @@ function rcube_subscription_form($attrib)
// pre-process folders list
foreach ($a_unsubscribed as $i => $folder) {
$folder_id = $folder;
- $folder = $RCMAIL->imap->mod_mailbox($folder);
+ $folder = $STORAGE->mod_folder($folder);
$foldersplit = explode($delimiter, $folder);
$name = rcube_charset_convert(array_pop($foldersplit), 'UTF7-IMAP');
$parent_folder = join($delimiter, $foldersplit);
@@ -269,7 +271,7 @@ function rcube_subscription_form($attrib)
$idx = $i + 1;
$sub_key = array_search($folder['id'], $a_subscribed);
$subscribed = $sub_key !== false;
- $protected = ($CONFIG['protect_default_folders'] == true && in_array($folder['id'], $CONFIG['default_imap_folders']));
+ $protected = ($CONFIG['protect_default_folders'] == true && in_array($folder['id'], $CONFIG['default_folders']));
$noselect = false;
$classes = array($i%2 ? 'even' : 'odd');
@@ -283,7 +285,7 @@ function rcube_subscription_form($attrib)
}
if (!$protected) {
- $attrs = $RCMAIL->imap->mailbox_attributes($folder['id']);
+ $attrs = $STORAGE->folder_attributes($folder['id']);
$noselect = in_array('\\Noselect', $attrs);
}
@@ -342,7 +344,7 @@ function rcube_subscription_form($attrib)
$OUTPUT->add_gui_object('subscriptionlist', $attrib['id']);
$OUTPUT->set_env('subscriptionrows', $a_js_folders);
- $OUTPUT->set_env('defaultfolders', $CONFIG['default_imap_folders']);
+ $OUTPUT->set_env('defaultfolders', $CONFIG['default_folders']);
$OUTPUT->set_env('delimiter', $delimiter);
return $form_start . $table->show($attrib) . $form_end;
@@ -367,13 +369,14 @@ function rcmail_rename_folder($oldname, $newname)
{
global $RCMAIL;
- $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
+ $storage = $RCMAIL->get_storage();
+ $delimiter = $storage->get_hierarchy_delimiter();
$plugin = $RCMAIL->plugins->exec_hook('folder_rename', array(
'oldname' => $oldname, 'newname' => $newname));
if (!$plugin['abort']) {
- $renamed = $RCMAIL->imap->rename_mailbox($oldname, $newname);
+ $renamed = $storage->rename_folder($oldname, $newname);
}
else {
$renamed = $plugin['result'];
@@ -405,7 +408,7 @@ function rcmail_rename_folder($oldname, $newname)
$OUTPUT->set_pagetitle(rcube_label('folders'));
$OUTPUT->include_script('list.js');
-$OUTPUT->set_env('quota', $RCMAIL->imap->get_capability('QUOTA'));
+$OUTPUT->set_env('quota', $STORAGE->get_capability('QUOTA'));
// add some labels to client
$OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting',
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 44d3610f9..f91f2cf46 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -317,8 +317,8 @@ function rcmail_user_prefs($current=null)
);
}
- $RCMAIL->imap_connect();
- $threading_supported = $RCMAIL->imap->get_capability('THREAD');
+ $storage = $RCMAIL->get_storage();
+ $threading_supported = $storage->get_capability('THREAD');
if (!isset($no_override['autoexpand_threads']) && $threading_supported) {
$field_id = 'rcmfd_autoexpand_threads';
@@ -681,10 +681,7 @@ function rcmail_user_prefs($current=null)
);
// Configure special folders
- if (!isset($no_override['default_imap_folders'])) {
-
- $RCMAIL->imap_connect();
-
+ if (!isset($no_override['default_folders'])) {
// load folders list only when needed
if ($current) {
$select = rcmail_mailbox_select(array(
@@ -849,7 +846,7 @@ function rcmail_folder_options($mailbox)
{
global $RCMAIL;
- $options = $RCMAIL->imap->mailbox_info($mailbox);
+ $options = $RCMAIL->get_storage()->folder_info($mailbox);
$options['protected'] = $options['is_root'] || ($options['special'] && $RCMAIL->config->get('protect_default_folders'));
return $options;
@@ -867,11 +864,12 @@ function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class
{
global $RCMAIL, $CONFIG, $OUTPUT;
- $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
+ $storage = $RCMAIL->get_storage();
+ $delimiter = $storage->get_hierarchy_delimiter();
$name_utf8 = rcube_charset_convert($name, 'UTF7-IMAP');
- $protected = ($CONFIG['protect_default_folders'] == true && in_array($name, $CONFIG['default_imap_folders']));
+ $protected = ($CONFIG['protect_default_folders'] == true && in_array($name, $CONFIG['default_folders']));
- $foldersplit = explode($delimiter, $RCMAIL->imap->mod_mailbox($name));
+ $foldersplit = explode($delimiter, $storage->mod_folder($name));
$level = count($foldersplit) - 1;
$display_name = str_repeat('    ', $level)
. Q($protected ? rcmail_localize_foldername($name) : rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP'));
diff --git a/program/steps/settings/save_folder.inc b/program/steps/settings/save_folder.inc
index 0fc090e12..b912c099b 100644
--- a/program/steps/settings/save_folder.inc
+++ b/program/steps/settings/save_folder.inc
@@ -22,7 +22,7 @@
// WARNING: folder names in UI are encoded with RCMAIL_CHARSET
// init IMAP connection
-$RCMAIL->imap_connect();
+$STORAGE = $RCMAIL->get_storage();
$name = trim(get_input_value('_name', RCUBE_INPUT_POST, true));
@@ -33,7 +33,7 @@ $name_imap = rcube_charset_convert($name, RCMAIL_CHARSET, 'UTF7-IMAP');
$old_imap = rcube_charset_convert($old, RCMAIL_CHARSET, 'UTF7-IMAP');
// $path is in UTF7-IMAP already
-$delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
+$delimiter = $STORAGE->get_hierarchy_delimiter();
$options = strlen($old_imap) ? rcmail_folder_options($old_imap) : array();
// Folder name checks
@@ -66,13 +66,13 @@ else {
$name_imap = $path . $delimiter . $name_imap;
}
else {
- $name_imap = $RCMAIL->imap->mod_mailbox($name_imap, 'in');
+ $name_imap = $STORAGE->mod_folder($name_imap, 'in');
}
}
// Check access rights to the parent folder
if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap)) {
- $parent_opts = $RCMAIL->imap->mailbox_info($path);
+ $parent_opts = $STORAGE->folder_info($path);
if ($parent_opts['namespace'] != 'personal'
&& (empty($parent_opts['rights']) || !preg_match('/[ck]/', implode($parent_opts)))
) {
@@ -103,7 +103,7 @@ if (!$error && !strlen($old)) {
$folder = $plugin['record'];
if (!$plugin['abort']) {
- $created = $RCMAIL->imap->create_mailbox($folder['name'], $folder['subscribe']);
+ $created = $STORAGE->create_folder($folder['name'], $folder['subscribe']);
}
else {
$created = $plugin['result'];
@@ -143,7 +143,7 @@ else if (!$error) {
if (!$plugin['abort']) {
if ($rename) {
- $updated = $RCMAIL->imap->rename_mailbox($folder['oldname'], $folder['name']);
+ $updated = $STORAGE->rename_folder($folder['oldname'], $folder['name']);
}
else {
$updated = true;
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 18ef5e7dd..ccb851bdd 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -181,15 +181,15 @@ switch ($CURR_SECTION)
break;
case 'folders':
- // special handling for 'default_imap_folders'
- if (in_array('default_imap_folders', (array)$CONFIG['dont_override'])) {
+ // 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_imap_folders'] = array('INBOX');
+ $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_imap_folders'][] = $a_user_prefs[$p];
+ $a_user_prefs['default_folders'][] = $a_user_prefs[$p];
}
}