From 3221c95a29c19677ff7c82e259aa683de4c224e7 Mon Sep 17 00:00:00 2001
From: svncommit <devs@roundcube.net>
Date: Tue, 15 Feb 2011 09:33:45 -0500
Subject: [PATCH] Update dutch translations.

---
 program/include/rcube_session.php |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/program/include/rcube_session.php b/program/include/rcube_session.php
index 55c2e14..2bd663c 100644
--- a/program/include/rcube_session.php
+++ b/program/include/rcube_session.php
@@ -50,14 +50,10 @@
   public function __construct($db, $lifetime=60)
   {
     $this->db = $db;
-    $this->lifetime = $lifetime;
     $this->start = microtime(true);
     $this->ip = $_SERVER['REMOTE_ADDR'];
 
-    // valid time range is now - 1/2 lifetime to now + 1/2 lifetime
-    $now = time();
-    $this->now = $now - ($now % ($this->lifetime / 2));
-    $this->prev = $this->now - ($this->lifetime / 2);
+    $this->set_lifetime($lifetime);
 
     // set custom functions for PHP session management
     session_set_save_handler(
@@ -257,6 +253,7 @@
    */
   public function kill()
   {
+    $this->vars = false;
     $this->destroy(session_id());
     rcmail::setcookie($this->cookiename, '-del-', time() - 60);
   }
@@ -365,12 +362,29 @@
     return unserialize( 'a:' . $items . ':{' . $serialized . '}' );
   }
 
+
+  /**
+   * Setter for session lifetime
+   */
+  public function set_lifetime($lifetime)
+  {
+      $this->lifetime = max(120, $lifetime);
+
+      // valid time range is now - 1/2 lifetime to now + 1/2 lifetime
+      $now = time();
+      $this->now = $now - ($now % ($this->lifetime / 2));
+      $this->prev = $this->now - ($this->lifetime / 2);
+  }
+
   /**
    * Setter for keep_alive interval
    */
   public function set_keep_alive($keep_alive)
   {
     $this->keep_alive = $keep_alive;
+    
+    if ($this->lifetime < $keep_alive)
+        $this->set_lifetime($keep_alive + 30);
   }
 
   /**

--
Gitblit v1.9.1