summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-10-03 17:55:29 +0000
committeralecpl <alec@alec.pl>2011-10-03 17:55:29 +0000
commitf537504ed05a31762b0270ae22d1a00e5c9af41e (patch)
tree779eb98e92c411fd104e68300cf641438b463a53
parent03079a5a51adb2020fadd9fc2d7bf54049f82f43 (diff)
- Fix namespace handling in special folders settings (#1488112)
-rw-r--r--CHANGELOG1
-rw-r--r--program/include/rcmail.php37
2 files changed, 17 insertions, 21 deletions
diff --git a/CHANGELOG b/CHANGELOG
index df67dd8f7..5ed0568f4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix namespace handling in special folders settings (#1488112)
- Disable time limit for CLI scripts (#1488109)
- Fix misleading display when chaning editor type (#1488104)
- Add loading indicator on contact delete
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 6da5f2140..a4a783c80 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -730,7 +730,7 @@ class rcmail
$keep_alive = max(60, $keep_alive);
$this->session->set_keep_alive($keep_alive);
}
-
+
$this->session->set_secret($this->config->get('des_key') . $_SERVER['HTTP_USER_AGENT']);
$this->session->set_ip_check($this->config->get('ip_check'));
}
@@ -840,16 +840,8 @@ class rcmail
if (!$imap_login)
return false;
- $this->set_imap_prop();
-
// user already registered -> update user's record
if (is_object($user)) {
- // fix some old settings according to namespace prefix
- $this->fix_namespace_settings($user);
-
- // create default folders on first login
- if (!$user->data['last_login'] && $config['create_default_folders'])
- $this->imap->create_default_folders();
// update last login timestamp
$user->touch();
}
@@ -857,13 +849,6 @@ class rcmail
else if ($config['auto_create_user']) {
if ($created = rcube_user::create($username, $host)) {
$user = $created;
-
- // fix default settings according to namespace prefix
- $this->fix_namespace_settings($user);
-
- // create default folders on first login
- if ($config['create_default_folders'])
- $this->imap->create_default_folders();
}
else {
raise_error(array(
@@ -883,9 +868,19 @@ class rcmail
// login succeeded
if (is_object($user) && $user->ID) {
+ // Configure environment
$this->set_user($user);
+ $this->set_imap_prop();
$this->session_configure();
+ // fix some old settings according to namespace prefix
+ $this->fix_namespace_settings($user);
+
+ // create default folders on first login
+ if ($config['create_default_folders'] && (!empty($created) || empty($user->data['last_login']))) {
+ $this->imap->create_default_folders();
+ }
+
// set session vars
$_SESSION['user_id'] = $user->ID;
$_SESSION['username'] = $user->data['username'];
@@ -894,7 +889,7 @@ class rcmail
$_SESSION['imap_ssl'] = $imap_ssl;
$_SESSION['password'] = $this->encrypt($pass);
$_SESSION['login_time'] = mktime();
-
+
if (isset($_REQUEST['_timezone']) && $_REQUEST['_timezone'] != '_default_')
$_SESSION['timezone'] = floatval($_REQUEST['_timezone']);
if (isset($_REQUEST['_dstactive']) && $_REQUEST['_dstactive'] != '_default_')
@@ -1567,7 +1562,7 @@ class rcmail
// use strtr behaviour of going through source string once
$cmd = strtr($cmd, $replacements);
-
+
return (string)shell_exec($cmd);
}
@@ -1603,7 +1598,7 @@ class rcmail
}
}
}
-
+
/**
* Returns current action filename
*
@@ -1633,8 +1628,8 @@ class rcmail
if (!$prefix_len)
return;
- $prefs = $user->get_prefs();
- if (empty($prefs) || $prefs['namespace_fixed'])
+ $prefs = $this->config->all();
+ if (!empty($prefs['namespace_fixed']))
return;
// Build namespace prefix regexp