| | |
| | | |
| | | |
| | | /** |
| | | * Cleanup session data before saving |
| | | */ |
| | | public function cleanup() |
| | | { |
| | | // current compose information is stored in $_SESSION['compose'], move it to $_SESSION['compose_data'] |
| | | if ($_SESSION['compose']) { |
| | | $_SESSION['compose_data'][$_SESSION['compose']['id']] = $_SESSION['compose']; |
| | | $this->remove('compose'); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Register additional garbage collector functions |
| | | * |
| | | * @param mixed Callback function |
| | |
| | | |
| | | /** |
| | | * Generate and set new session id |
| | | * |
| | | * @param boolean $destroy If enabled the current session will be destroyed |
| | | */ |
| | | public function regenerate_id() |
| | | public function regenerate_id($destroy=true) |
| | | { |
| | | // delete old session record |
| | | $this->destroy(session_id()); |
| | | session_regenerate_id($destroy); |
| | | |
| | | $this->vars = false; |
| | | |
| | | $randval = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| | | |
| | | for ($random = '', $i=1; $i <= 32; $i++) { |
| | | $random .= substr($randval, mt_rand(0,(strlen($randval) - 1)), 1); |
| | | } |
| | | |
| | | // use md5 value for id |
| | | $this->key = md5($random); |
| | | session_id($this->key); |
| | | |
| | | $cookie = session_get_cookie_params(); |
| | | $lifetime = $cookie['lifetime'] ? time() + $cookie['lifetime'] : 0; |
| | | |
| | | rcmail::setcookie(session_name(), $this->key, $lifetime); |
| | | $this->key = session_id(); |
| | | |
| | | return true; |
| | | } |
| | |
| | | */ |
| | | public function kill() |
| | | { |
| | | $this->vars = false; |
| | | $this->destroy(session_id()); |
| | | rcmail::setcookie($this->cookiename, '-del-', time() - 60); |
| | | } |