From 15cf4fa9251f01313b5eb5cf1a91ec10643d42cb Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 21 Nov 2012 13:55:34 -0500
Subject: [PATCH] Rename rcube_bc.inc to bc.php for consistency

---
 program/include/rcmail.php |   47 ++++++++++++++++-------------------------------
 1 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index ec3d537..99a68e8 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -94,9 +94,6 @@
     // create user object
     $this->set_user(new rcube_user($_SESSION['user_id']));
 
-    // configure session (after user config merge!)
-    $this->session_configure();
-
     // set task and action properties
     $this->set_task(rcube_utils::get_input_value('_task', rcube_utils::INPUT_GPC));
     $this->action = asciiwords(rcube_utils::get_input_value('_action', rcube_utils::INPUT_GPC));
@@ -258,8 +255,8 @@
     $autocomplete = (array) $this->config->get('autocomplete_addressbooks');
     $list = array();
 
-    // We are using the DB address book
-    if ($abook_type != 'ldap') {
+    // We are using the DB address book or a plugin address book
+    if ($abook_type != 'ldap' && $abook_type != '') {
       if (!isset($this->address_books['0']))
         $this->address_books['0'] = new rcube_contacts($this->db, $this->get_user_id());
       $list['0'] = array(
@@ -320,10 +317,9 @@
     if (!($this->output instanceof rcube_output_html))
       $this->output = new rcube_output_html($this->task, $framed);
 
-    // set keep-alive/check-recent interval
-    if ($this->session && ($keep_alive = $this->session->get_keep_alive())) {
-      $this->output->set_env('keep_alive', $keep_alive);
-    }
+    // set refresh interval
+    $this->output->set_env('refresh_interval', $this->config->get('refresh_interval', 0));
+    $this->output->set_env('session_lifetime', $this->config->get('session_lifetime', 0) * 60);
 
     if ($framed) {
       $this->comm_path .= '&_framed=1';
@@ -336,7 +332,7 @@
     $this->output->set_charset(RCMAIL_CHARSET);
 
     // add some basic labels to client
-    $this->output->add_label('loading', 'servererror', 'requesttimedout');
+    $this->output->add_label('loading', 'servererror', 'requesttimedout', 'refreshing');
 
     return $this->output;
   }
@@ -452,6 +448,10 @@
         $username .= '@'.rcube_utils::parse_host($config['username_domain'], $host);
     }
 
+    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']) {
@@ -483,21 +483,7 @@
     $storage = $this->get_storage();
 
     // try to log in
-    if (!($login = $storage->connect($host, $username, $pass, $port, $ssl))) {
-      // try with lowercase
-      $username_lc = mb_strtolower($username);
-      if ($username_lc != $username) {
-        // try to find user record again -> overwrite username
-        if (!$user && ($user = rcube_user::query($username_lc, $host)))
-          $username_lc = $user->data['username'];
-
-        if ($login = $storage->connect($host, $username_lc, $pass, $port, $ssl))
-          $username = $username_lc;
-      }
-    }
-
-    // exit if login failed
-    if (!$login) {
+    if (!$storage->connect($host, $username, $pass, $port, $ssl)) {
       return false;
     }
 
@@ -532,7 +518,6 @@
       // Configure environment
       $this->set_user($user);
       $this->set_storage_prop();
-      $this->session_configure();
 
       // fix some old settings according to namespace prefix
       $this->fix_namespace_settings($user);
@@ -552,9 +537,7 @@
       $_SESSION['login_time']   = time();
 
       if (isset($_REQUEST['_timezone']) && $_REQUEST['_timezone'] != '_default_')
-        $_SESSION['timezone'] = floatval($_REQUEST['_timezone']);
-      if (isset($_REQUEST['_dstactive']) && $_REQUEST['_dstactive'] != '_default_')
-        $_SESSION['dst_active'] = intval($_REQUEST['_dstactive']);
+        $_SESSION['timezone'] = rcube_utils::get_input_value('_timezone', rcube_utils::INPUT_GPC);
 
       // force reloading complete list of subscribed mailboxes
       $storage->clear_cache('mailboxes', true);
@@ -787,6 +770,7 @@
     }
   }
 
+
   /**
    * Registers action aliases for current task
    *
@@ -801,6 +785,7 @@
     }
   }
 
+
   /**
    * Returns current action filename
    *
@@ -814,6 +799,7 @@
 
     return strtr($this->action, '-', '_') . '.inc';
   }
+
 
   /**
    * Fixes some user preferences according to namespace handling change.
@@ -2112,8 +2098,7 @@
 
             if (!$storage->connect($host, $user, $pass, $port, $ssl)) {
                 if (is_object($this->output)) {
-                    $error = $storage->get_error_code() == -1 ? 'storageerror' : 'sessionerror';
-                    $this->output->show_message($error, 'error');
+                    $this->output->show_message('storageerror', 'error');
                 }
             }
             else {

--
Gitblit v1.9.1