summaryrefslogtreecommitdiff
path: root/program/include/rcube.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/include/rcube.php')
-rw-r--r--program/include/rcube.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/program/include/rcube.php b/program/include/rcube.php
index 3e43ace96..494b5c3dd 100644
--- a/program/include/rcube.php
+++ b/program/include/rcube.php
@@ -106,12 +106,14 @@ class rcube
/**
* This implements the 'singleton' design pattern
*
+ * @param integer Options to initialize with this instance. See rcube::INIT_WITH_* constants
* @return rcube The one and only instance
*/
- static function get_instance()
+ static function get_instance($mode = 0)
{
if (!self::$instance) {
self::$instance = new rcube();
+ self::$instance->init($mode);
}
return self::$instance;
@@ -189,11 +191,17 @@ class rcube
$this->memcache = new Memcache;
$this->mc_available = 0;
- // add alll configured hosts to pool
+ // add all configured hosts to pool
$pconnect = $this->config->get('memcache_pconnect', true);
foreach ($this->config->get('memcache_hosts', array()) as $host) {
- list($host, $port) = explode(':', $host);
- if (!$port) $port = 11211;
+ if (substr($host, 0, 7) != 'unix://') {
+ list($host, $port) = explode(':', $host);
+ if (!$port) $port = 11211;
+ }
+ else {
+ $port = 0;
+ }
+
$this->mc_available += intval($this->memcache->addServer($host, $port, $pconnect, 1, 1, 15, false, array($this, 'memcache_failure')));
}
@@ -238,8 +246,7 @@ class rcube
*/
public function get_cache($name, $type='db', $ttl=0, $packed=true)
{
- if (!isset($this->caches[$name])) {
- $userid = $this->get_user_id();
+ if (!isset($this->caches[$name]) && ($userid = $this->get_user_id())) {
$this->caches[$name] = new rcube_cache($type, $userid, $name, $ttl, $packed);
}
@@ -406,6 +413,7 @@ class rcube
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
ini_set('session.serialize_handler', 'php');
+ ini_set('session.cookie_httponly', 1);
// use database for storing session data
$this->session = new rcube_session($this->get_dbh(), $this->config);