Thomas Bruederli
2013-08-15 8d2963a4bf916d047cb0aebd825588a5e20b838f
program/lib/Roundcube/rcube.php
@@ -105,13 +105,14 @@
     * This implements the 'singleton' design pattern
     *
     * @param integer Options to initialize with this instance. See rcube::INIT_WITH_* constants
     * @param string Environment name to run (e.g. live, dev, test)
     *
     * @return rcube The one and only instance
     */
    static function get_instance($mode = 0)
    static function get_instance($mode = 0, $env = '')
    {
        if (!self::$instance) {
            self::$instance = new rcube();
            self::$instance = new rcube($env);
            self::$instance->init($mode);
        }
@@ -122,10 +123,10 @@
    /**
     * Private constructor
     */
    protected function __construct()
    protected function __construct($env = '')
    {
        // load configuration
        $this->config  = new rcube_config;
        $this->config  = new rcube_config($env);
        $this->plugins = new rcube_dummy_plugin_api;
        register_shutdown_function(array($this, 'shutdown'));
@@ -377,6 +378,7 @@
            '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"),
            'timeout'     => (int) $this->config->get("{$driver}_timeout"),
            'skip_deleted' => (bool) $this->config->get('skip_deleted'),
            'driver'      => $driver,
@@ -465,6 +467,10 @@
        $this->session->set_secret($this->config->get('des_key') . dirname($_SERVER['SCRIPT_NAME']));
        $this->session->set_ip_check($this->config->get('ip_check'));
        if ($this->config->get('session_auth_name')) {
            $this->session->set_cookiename($this->config->get('session_auth_name'));
        }
        // start PHP session (if not in CLI mode)
        if ($_SERVER['REMOTE_ADDR']) {
            $this->session->start();
@@ -496,11 +502,11 @@
        if ($tmp && ($dir = opendir($tmp))) {
            while (($fname = readdir($dir)) !== false) {
                if ($fname{0} == '.') {
                if ($fname[0] == '.') {
                    continue;
                }
                if (filemtime($tmp.'/'.$fname) < $expire) {
                if (@filemtime($tmp.'/'.$fname) < $expire) {
                    @unlink($tmp.'/'.$fname);
                }
            }
@@ -1487,7 +1493,7 @@
                    $subject    = str_replace("\r\n", $delim, $subject);
                }
                if (ini_get('safe_mode'))
                if (filter_var(ini_get('safe_mode'), FILTER_VALIDATE_BOOLEAN))
                    $sent = mail($to, $subject, $msg_body, $header_str);
                else
                    $sent = mail($to, $subject, $msg_body, $header_str, "-f$from");