From ea33cd1be8d13d9efee75669d4e1259f2b1dfd4c Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 24 Nov 2010 07:38:38 -0500
Subject: [PATCH] Updated Hebrew, Estonian, Portuguese, Flemish, Bulgarian, Hungarian and Chinese localizations upon user submissions

---
 program/include/rcube_session.php |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/program/include/rcube_session.php b/program/include/rcube_session.php
index c3332f0..b4f75ed 100644
--- a/program/include/rcube_session.php
+++ b/program/include/rcube_session.php
@@ -4,8 +4,8 @@
  +-----------------------------------------------------------------------+
  | program/include/rcube_session.php                                     |
  |                                                                       |
- | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2005-2010, RoundCube Dev. - Switzerland                 |
+ | This file is part of the Roundcube Webmail client                     |
+ | Copyright (C) 2005-2010, Roundcube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -91,7 +91,7 @@
 
     return false;
   }
-  
+
 
   // save session data
   public function write($key, $vars)
@@ -105,7 +105,7 @@
     } else { // else read data again from DB
       $oldvars = $this->read($key);
     }
-    
+
     if ($oldvars !== false) {
       $a_oldvars = $this->unserialize($oldvars); 
       foreach ((array)$this->unsets as $k)
@@ -114,25 +114,28 @@
       $newvars = $this->serialize(array_merge(
         (array)$a_oldvars, (array)$this->unserialize($vars)));
 
-      if ($this->keep_alive>0) {
-	$timeout = min($this->lifetime * 0.5, 
-		       $this->lifetime - $this->keep_alive);
+      if (!$this->lifetime) {
+        $timeout = 600;
+      }
+      else if ($this->keep_alive>0) {
+        $timeout = min($this->lifetime * 0.5,
+		  $this->lifetime - $this->keep_alive);
       } else {
-	$timeout = 0;
+        $timeout = 0;
       }
 
       if (!($newvars === $oldvars) || ($ts - $this->changed > $timeout)) {
         $this->db->query(
-	  sprintf("UPDATE %s SET vars = ?, changed = %s WHERE sess_id = ?",
-	    get_table_name('session'), $now),
-	  $newvars, $key);
+          sprintf("UPDATE %s SET vars = ?, changed = %s WHERE sess_id = ?",
+            get_table_name('session'), $now),
+          $newvars, $key);
       }
     }
     else {
       $this->db->query(
         sprintf("INSERT INTO %s (sess_id, vars, ip, created, changed) ".
           "VALUES (?, ?, ?, %s, %s)",
-	  get_table_name('session'), $now, $now),
+          get_table_name('session'), $now, $now),
         $key, $vars, (string)$_SERVER['REMOTE_ADDR']);
     }
 

--
Gitblit v1.9.1