summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-06-28 10:07:44 +0200
committerAleksander Machniak <alec@alec.pl>2014-06-28 10:07:44 +0200
commit6d5a1b9e8f426d5ddc7c5bf2840a25859ab9d9e1 (patch)
treea7c6f5fe2eb5a44a74ed76256845a6e55d0f18c0 /program
parent2c3c5884e3005bfec7408c6718e48bc5af380000 (diff)
Get rid of some rcube_config::all() calls
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail.php35
-rw-r--r--program/lib/Roundcube/rcube.php10
2 files changed, 27 insertions, 18 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index cfdd1816e..0151020c7 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -730,14 +730,16 @@ class rcmail extends rcube
*/
public function logout_actions()
{
- $config = $this->config->all();
- $storage = $this->get_storage();
+ $storage = $this->get_storage();
+ $logout_expunge = $this->config->get('logout_expunge');
+ $logout_purge = $this->config->get('logout_purge');
+ $trash_mbox = $this->config->get('trash_mbox');
- if ($config['logout_purge'] && !empty($config['trash_mbox'])) {
- $storage->clear_folder($config['trash_mbox']);
+ if ($logout_purge && !empty($trash_mbox)) {
+ $storage->clear_folder($trash_mbox);
}
- if ($config['logout_expunge']) {
+ if ($logout_expunge) {
$storage->expunge_folder('INBOX');
}
@@ -887,12 +889,15 @@ class rcmail extends rcube
$prefix = $this->storage->get_namespace('prefix');
$prefix_len = strlen($prefix);
- if (!$prefix_len)
+ if (!$prefix_len) {
return;
+ }
- $prefs = $this->config->all();
- if (!empty($prefs['namespace_fixed']))
+ if ($this->config->get('namespace_fixed')) {
return;
+ }
+
+ $prefs = array();
// Build namespace prefix regexp
$ns = $this->storage->get_namespace();
@@ -912,16 +917,16 @@ class rcmail extends rcube
// Fix preferences
$opts = array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox', 'archive_mbox');
foreach ($opts as $opt) {
- if ($value = $prefs[$opt]) {
+ if ($value = $this->config->get($opt)) {
if ($value != 'INBOX' && !preg_match($regexp, $value)) {
$prefs[$opt] = $prefix.$value;
}
}
}
- if (!empty($prefs['search_mods'])) {
+ if (($search_mods = $this->config->get('search_mods')) && !empty($search_mods)) {
$folders = array();
- foreach ($prefs['search_mods'] as $idx => $value) {
+ foreach ($search_mods as $idx => $value) {
if ($idx != 'INBOX' && $idx != '*' && !preg_match($regexp, $idx)) {
$idx = $prefix.$idx;
}
@@ -931,9 +936,9 @@ class rcmail extends rcube
$prefs['search_mods'] = $folders;
}
- if (!empty($prefs['message_threading'])) {
+ if (($threading = $this->config->get('message_threading')) && !empty($threading)) {
$folders = array();
- foreach ($prefs['message_threading'] as $idx => $value) {
+ foreach ($threading as $idx => $value) {
if ($idx != 'INBOX' && !preg_match($regexp, $idx)) {
$idx = $prefix.$idx;
}
@@ -943,8 +948,8 @@ class rcmail extends rcube
$prefs['message_threading'] = $folders;
}
- if (!empty($prefs['collapsed_folders'])) {
- $folders = explode('&&', $prefs['collapsed_folders']);
+ if ($collapsed = $this->config->get('collapsed_folders')) {
+ $folders = explode('&&', $collapsed);
$count = count($folders);
$folders_str = '';
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index cf54c3c12..5f55414e6 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -172,9 +172,13 @@ class rcube
public function get_dbh()
{
if (!$this->db) {
- $config_all = $this->config->all();
- $this->db = rcube_db::factory($config_all['db_dsnw'], $config_all['db_dsnr'], $config_all['db_persistent']);
- $this->db->set_debug((bool)$config_all['sql_debug']);
+ $this->db = rcube_db::factory(
+ $this->config->get('db_dsnw'),
+ $this->config->get('db_dsnr'),
+ $this->config->get('db_persistent')
+ );
+
+ $this->db->set_debug((bool)$this->config->get('sql_debug'));
}
return $this->db;