Thomas Bruederli
2012-11-17 be9aacaa5296dfca63fb3a01c2dc52538d1546aa
program/include/rcube_session.php
@@ -24,7 +24,8 @@
/**
 * Class to provide database supported session storage
 *
 * @package    Core
 * @package    Framework
 * @subpackage Core
 * @author     Thomas Bruederli <roundcube@gmail.com>
 * @author     Aleksander Machniak <alec@alec.pl>
 */
@@ -43,7 +44,6 @@
  private $secret = '';
  private $ip_check = false;
  private $logging = false;
  private $keep_alive = 0;
  private $memcache;
  /**
@@ -218,13 +218,14 @@
   * Handler for session_destroy()
   *
   * @param string Session ID
   *
   * @return boolean True on success
   */
  public function db_destroy($key)
  {
    $this->db->query(
      sprintf("DELETE FROM %s WHERE sess_id = ?", $this->db->table_name('session')),
      $key);
    if ($key) {
      $this->db->query(sprintf("DELETE FROM %s WHERE sess_id = ?", $this->db->table_name('session')), $key);
    }
    return true;
  }
@@ -305,11 +306,17 @@
   * Handler for session_destroy() with memcache backend
   *
   * @param string Session ID
   *
   * @return boolean True on success
   */
  public function mc_destroy($key)
  {
    return $this->memcache->delete($key);
    if ($key) {
      // #1488592: use 2nd argument
      $this->memcache->delete($key, 0);
    }
    return true;
  }
@@ -518,24 +525,6 @@
      $this->now = $now - ($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);
  }
  /**
   * Getter for keep_alive interval
   */
  public function get_keep_alive()
  {
    return $this->keep_alive;
  }
  /**
   * Getter for remote IP saved with this session
@@ -544,7 +533,8 @@
  {
    return $this->ip;
  }
  /**
   * Setter for cookie encryption secret
   */
@@ -561,7 +551,8 @@
  {
    $this->ip_check = $check;
  }
  /**
   * Setter for the cookie name used for session cookie
   */
@@ -598,7 +589,7 @@
          $result = true;
        }
      }
   }
    }
    if (!$result)
      $this->log("Session authentication failed for " . $this->key . "; invalid auth cookie sent; timeslot = " . date('Y-m-d H:i:s', $prev));
@@ -630,7 +621,7 @@
  }
  /**
   *
   * Writes debug information to the log
   */
  function log($line)
  {