roundcubemail/program/lib/Roundcube/rcube.php
public function storage_init()
    {
        // already initialized
        if (is_object($this->storage)) {
            return;
        }

        $driver       = $this->config->get('storage_driver', 'imap');
        $driver_class = "rcube_{$driver}";

        if (!class_exists($driver_class)) {
            self::raise_error(array(
                'code' => 700, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Storage driver class ($driver) not found!"),
                true, true);
        }

        // Initialize storage object
        $this->storage = new $driver_class;

        // for backward compat. (deprecated, will be removed)
        $this->imap = $this->storage;

        // set class options
        $options = array(
            'auth_type'      => $this->config->get("{$driver}_auth_type", 'check'),
            'auth_cid'       => $this->config->get("{$driver}_auth_cid"),
            'auth_pw'        => $this->config->get("{$driver}_auth_pw"),
            'debug'          => (bool) $this->config->get("{$driver}_debug"),
            'force_caps'     => (bool) $this->config->get("{$driver}_force_caps"),
            'disabled_caps'  => $this->config->get("{$driver}_disabled_caps"),
            'socket_options' => $this->config->get("{$driver}_conn_options"),
            'timeout'        => (int) $this->config->get("{$driver}_timeout"),
            'skip_deleted'   => (bool) $this->config->get('skip_deleted'),
            'driver'         => $driver,
        );

        if (!empty($_SESSION['storage_host'])) {
            $options['language'] = $_SESSION['language'];
            $options['host']     = $_SESSION['storage_host'];
            $options['user']     = $_SESSION['username'];
            $options['port']     = $_SESSION['storage_port'];
            $options['ssl']      = $_SESSION['storage_ssl'];
            $options['password'] = $this->decrypt($_SESSION['password']);
            $_SESSION[$driver.'_host'] = $_SESSION['storage_host'];
        }

        $options = $this->plugins->exec_hook("storage_init", $options);

        // for backward compat. (deprecated, to be removed)
        $options = $this->plugins->exec_hook("imap_init", $options);

        $this->storage->set_options($options);
        $this->set_storage_prop();

        // subscribe to 'storage_connected' hook for session logging
        if ($this->config->get('imap_log_session', false)) {
            $this->plugins->register_hook('storage_connected', array($this, 'storage_log_session'));
        }
    }
public function storage_init()
    {
        // already initialized
        if (is_object($this->storage)) {
            return;
        }

        $driver       = $this->config->get('storage_driver', 'imap');
        $driver_class = "rcube_{$driver}";

        if (!class_exists($driver_class)) {
            self::raise_error(array(
                'code' => 700, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Storage driver class ($driver) not found!"),
                true, true);
        }

        // Initialize storage object
        $this->storage = new $driver_class;

        // for backward compat. (deprecated, will be removed)
        $this->imap = $this->storage;

        // set class options
        $options = array(
            'auth_type'      => $this->config->get("{$driver}_auth_type", 'check'),
            'auth_cid'       => $this->config->get("{$driver}_auth_cid"),
            'auth_pw'        => $this->config->get("{$driver}_auth_pw"),
            'debug'          => (bool) $this->config->get("{$driver}_debug"),
            'force_caps'     => (bool) $this->config->get("{$driver}_force_caps"),
            'disabled_caps'  => $this->config->get("{$driver}_disabled_caps"),
            'socket_options' => $this->config->get("{$driver}_conn_options"),
            'timeout'        => (int) $this->config->get("{$driver}_timeout"),
            'skip_deleted'   => (bool) $this->config->get('skip_deleted'),
            'driver'         => $driver,
        );

        if (!empty($_SESSION['storage_host'])) {
            $options['language'] = $_SESSION['language'];
            $options['host']     = $_SESSION['storage_host'];
            $options['user']     = $_SESSION['username'];
            $options['port']     = $_SESSION['storage_port'];
            $options['ssl']      = $_SESSION['storage_ssl'];
            $options['password'] = $this->decrypt($_SESSION['password']);
            $_SESSION[$driver.'_host'] = $_SESSION['storage_host'];
        }

        $options = $this->plugins->exec_hook("storage_init", $options);

        // for backward compat. (deprecated, to be removed)
        $options = $this->plugins->exec_hook("imap_init", $options);

        $this->storage->set_options($options);
        $this->set_storage_prop();

        // subscribe to 'storage_connected' hook for session logging
        if ($this->config->get('imap_log_session', false)) {
            $this->plugins->register_hook('storage_connected', array($this, 'storage_log_session'));
        }
    }
public function storage_init ( ) { // already initialized if ( is_object ( $ this -> storage ) ) { return ; } $ driver = $ this -> config -> get ( 'storage_driver' , 'imap' ) ; $ driver_class = "rcube_{$driver}" ; if ( ! class_exists ( $ driver_class ) ) { self :: raise_error ( array ( 'code' => 700 , 'type' => 'php' , 'file' => __FILE__ , 'line' => __LINE__ , 'message' => "Storage driver class ($driver) not found!" ) , true , true ) ; } // Initialize storage object $ this -> storage = new $ driver_class ; // for backward compat. (deprecated, will be removed) $ this -> imap = $ this -> storage ; // set class options $ options = array ( 'auth_type' => $ this -> config -> get ( "{$driver}_auth_type" , 'check' ) , 'auth_cid' => $ this -> config -> get ( "{$driver}_auth_cid" ) , 'auth_pw' => $ this -> config -> get ( "{$driver}_auth_pw" ) , 'debug' => ( bool ) $ this -> config -> get ( "{$driver}_debug" ) , 'force_caps' => ( bool ) $ this -> config -> get ( "{$driver}_force_caps" ) , 'disabled_caps' => $ this -> config -> get ( "{$driver}_disabled_caps" ) , 'socket_options' => $ this -> config -> get ( "{$driver}_conn_options" ) , 'timeout' => ( int ) $ this -> config -> get ( "{$driver}_timeout" ) , 'skip_deleted' => ( bool ) $ this -> config -> get ( 'skip_deleted' ) , 'driver' => $ driver , ) ; if ( ! empty ( $ _SESSION [ 'storage_host' ] ) ) { $ options [ 'language' ] = $ _SESSION [ 'language' ] ; $ options [ 'host' ] = $ _SESSION [ 'storage_host' ] ; $ options [ 'user' ] = $ _SESSION [ 'username' ] ; $ options [ 'port' ] = $ _SESSION [ 'storage_port' ] ; $ options [ 'ssl' ] = $ _SESSION [ 'storage_ssl' ] ; $ options [ 'password' ] = $ this -> decrypt ( $ _SESSION [ 'password' ] ) ; $ _SESSION [ $ driver . '_host' ] = $ _SESSION [ 'storage_host' ] ; } $ options = $ this -> plugins -> exec_hook ( "storage_init" , $ options ) ; // for backward compat. (deprecated, to be removed) $ options = $ this -> plugins -> exec_hook ( "imap_init" , $ options ) ; $ this -> storage -> set_options ( $ options ) ; $ this -> set_storage_prop ( ) ; // subscribe to 'storage_connected' hook for session logging if ( $ this -> config -> get ( 'imap_log_session' , false ) ) { $ this -> plugins -> register_hook ( 'storage_connected' , array ( $ this , 'storage_log_session' ) ) ; } }
Initialize storage object
Initialize storage object