]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/include/rcube_session.php
Imported Upstream version 0.5.2+dfsg
[roundcube.git] / program / include / rcube_session.php
index 59ce42379432faf2db4ec6b0d13dcd9bda176808..0bae4a7116f10908258ed7d5649028dffe305d11 100644 (file)
@@ -183,27 +183,12 @@ class rcube_session
   }
 
 
-  public function regenerate_id()
+  public function regenerate_id($destroy=true)
   {
-    $randval = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
-
-    for ($random = '', $i=1; $i <= 32; $i++) {
-      $random .= substr($randval, mt_rand(0,(strlen($randval) - 1)), 1);
-    }
-
-    // use md5 value for id or remove capitals from string $randval
-    $random = md5($random);
-
-    // delete old session record
-    $this->destroy(session_id());
-
-    session_id($random);
-
-    $cookie   = session_get_cookie_params();
-    $lifetime = $cookie['lifetime'] ? time() + $cookie['lifetime'] : 0;
-
-    rcmail::setcookie(session_name(), $random, $lifetime);
+    session_regenerate_id($destroy);
 
+    $this->vars = false;
+    $this->key  = session_id();
     return true;
   }