From 8cc567c00423a343f3b785ee4dd856111b985fe7 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 22 Mar 2014 07:56:49 -0400
Subject: [PATCH] Drop support for PHP < 5.3.7
---
program/include/rcmail.php | 48 +++++++++++++++++++++---------------------------
1 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index bb42cab..d1b5441 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -5,8 +5,8 @@
| program/include/rcmail.php |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2008-2013, The Roundcube Dev Team |
- | Copyright (C) 2011-2013, Kolab Systems AG |
+ | Copyright (C) 2008-2014, The Roundcube Dev Team |
+ | Copyright (C) 2011-2014, Kolab Systems AG |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -25,7 +25,7 @@
* Application class of Roundcube Webmail
* implemented as singleton
*
- * @package Core
+ * @package Webmail
*/
class rcmail extends rcube
{
@@ -157,12 +157,7 @@
*/
public function set_user($user)
{
- if (is_object($user)) {
- $this->user = $user;
-
- // overwrite config with user preferences
- $this->config->set_user_prefs((array)$this->user->get_prefs());
- }
+ parent::set_user($user);
$lang = $this->language_prop($this->config->get('language', $_SESSION['language']));
$_SESSION['language'] = $this->user->language = $lang;
@@ -492,17 +487,20 @@
return false;
}
- $config = $this->config->all();
+ $default_host = $this->config->get('default_host');
+ $default_port = $this->config->get('default_port');
+ $username_domain = $this->config->get('username_domain');
+ $login_lc = $this->config->get('login_lc', 2);
if (!$host) {
- $host = $config['default_host'];
+ $host = $default_host;
}
// Validate that selected host is in the list of configured hosts
- if (is_array($config['default_host'])) {
+ if (is_array($default_host)) {
$allowed = false;
- foreach ($config['default_host'] as $key => $host_allowed) {
+ foreach ($default_host as $key => $host_allowed) {
if (!is_numeric($key)) {
$host_allowed = $key;
}
@@ -516,7 +514,7 @@
$host = null;
}
}
- else if (!empty($config['default_host']) && $host != rcube_utils::parse_host($config['default_host'])) {
+ else if (!empty($default_host) && $host != rcube_utils::parse_host($default_host)) {
$host = null;
}
@@ -533,23 +531,23 @@
if (!empty($a_host['port']))
$port = $a_host['port'];
- else if ($ssl && $ssl != 'tls' && (!$config['default_port'] || $config['default_port'] == 143))
+ else if ($ssl && $ssl != 'tls' && (!$default_port || $default_port == 143))
$port = 993;
}
if (!$port) {
- $port = $config['default_port'];
+ $port = $default_port;
}
// Check if we need to add/force domain to username
- if (!empty($config['username_domain'])) {
- $domain = is_array($config['username_domain']) ? $config['username_domain'][$host] : $config['username_domain'];
+ if (!empty($username_domain)) {
+ $domain = is_array($username_domain) ? $username_domain[$host] : $username_domain;
if ($domain = rcube_utils::parse_host((string)$domain, $host)) {
$pos = strpos($username, '@');
// force configured domains
- if (!empty($config['username_domain_forced']) && $pos !== false) {
+ if ($pos !== false && $this->config->get('username_domain_forced')) {
$username = substr($username, 0, $pos) . '@' . $domain;
}
// just add domain if not specified
@@ -559,14 +557,10 @@
}
}
- if (!isset($config['login_lc'])) {
- $config['login_lc'] = 2; // default
- }
-
// Convert username to lowercase. If storage backend
// is case-insensitive we need to store always the same username (#1487113)
- if ($config['login_lc']) {
- if ($config['login_lc'] == 2 || $config['login_lc'] === true) {
+ if ($login_lc) {
+ if ($login_lc == 2 || $login_lc === true) {
$username = mb_strtolower($username);
}
else if (strpos($username, '@')) {
@@ -604,7 +598,7 @@
$user->touch();
}
// create new system user
- else if ($config['auto_create_user']) {
+ else if ($this->config->get('auto_create_user')) {
if ($created = rcube_user::create($username, $host)) {
$user = $created;
}
@@ -651,7 +645,7 @@
$this->fix_namespace_settings($user);
// create default folders on login
- if ($config['create_default_folders']) {
+ if ($this->config->get('create_default_folders')) {
$storage->create_default_folders();
}
--
Gitblit v1.9.1