roundcubemail/program/lib/Roundcube/rcube_config.php
private function load()
    {
        // Load default settings
        if (!$this->load_from_file('defaults.inc.php')) {
            $this->errors[] = 'defaults.inc.php was not found.';
        }

        // load main config file
        if (!$this->load_from_file('config.inc.php')) {
            // Old configuration files
            if (!$this->load_from_file('main.inc.php') || !$this->load_from_file('db.inc.php')) {
                $this->errors[] = 'config.inc.php was not found.';
            }
            else if (rand(1,100) == 10) {  // log warning on every 100th request (average)
                trigger_error("config.inc.php was not found. Please migrate your config by running bin/update.sh", E_USER_WARNING);
            }
        }

        // load host-specific configuration
        $this->load_host_config();

        // set skin (with fallback to old 'skin_path' property)
        if (empty($this->prop['skin'])) {
            if (!empty($this->prop['skin_path'])) {
                $this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
            }
            else {
                $this->prop['skin'] = self::DEFAULT_SKIN;
            }
        }

        // larry is the new default skin :-)
        if ($this->prop['skin'] == 'default') {
            $this->prop['skin'] = self::DEFAULT_SKIN;
        }

        // fix paths
        foreach (array('log_dir' => 'logs', 'temp_dir' => 'temp') as $key => $dir) {
            foreach (array($this->prop[$key], '../' . $this->prop[$key], RCUBE_INSTALL_PATH . $dir) as $path) {
                if ($path && ($realpath = realpath(unslashify($path)))) {
                    $this->prop[$key] = $realpath;
                    break;
                }
            }
        }

        // fix default imap folders encoding
        foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder) {
            $this->prop[$folder] = rcube_charset::convert($this->prop[$folder], RCUBE_CHARSET, 'UTF7-IMAP');
        }

        // set PHP error logging according to config
        if ($this->prop['debug_level'] & 1) {
            ini_set('log_errors', 1);

            if ($this->prop['log_driver'] == 'syslog') {
                ini_set('error_log', 'syslog');
            }
            else {
                ini_set('error_log', $this->prop['log_dir'].'/errors');
            }
        }

        // enable display_errors in 'show' level, but not for ajax requests
        ini_set('display_errors', intval(empty($_REQUEST['_remote']) && ($this->prop['debug_level'] & 4)));

        // remove deprecated properties
        unset($this->prop['dst_active']);

        // export config data
        $GLOBALS['CONFIG'] = &$this->prop;
    }
private function load()
    {
        // Load default settings
        if (!$this->load_from_file('defaults.inc.php')) {
            $this->errors[] = 'defaults.inc.php was not found.';
        }

        // load main config file
        if (!$this->load_from_file('config.inc.php')) {
            // Old configuration files
            if (!$this->load_from_file('main.inc.php') || !$this->load_from_file('db.inc.php')) {
                $this->errors[] = 'config.inc.php was not found.';
            }
            else if (rand(1,100) == 10) {  // log warning on every 100th request (average)
                trigger_error("config.inc.php was not found. Please migrate your config by running bin/update.sh", E_USER_WARNING);
            }
        }

        // load host-specific configuration
        $this->load_host_config();

        // set skin (with fallback to old 'skin_path' property)
        if (empty($this->prop['skin'])) {
            if (!empty($this->prop['skin_path'])) {
                $this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
            }
            else {
                $this->prop['skin'] = self::DEFAULT_SKIN;
            }
        }

        // larry is the new default skin :-)
        if ($this->prop['skin'] == 'default') {
            $this->prop['skin'] = self::DEFAULT_SKIN;
        }

        // fix paths
        foreach (array('log_dir' => 'logs', 'temp_dir' => 'temp') as $key => $dir) {
            foreach (array($this->prop[$key], '../' . $this->prop[$key], RCUBE_INSTALL_PATH . $dir) as $path) {
                if ($path && ($realpath = realpath(unslashify($path)))) {
                    $this->prop[$key] = $realpath;
                    break;
                }
            }
        }

        // fix default imap folders encoding
        foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder) {
            $this->prop[$folder] = rcube_charset::convert($this->prop[$folder], RCUBE_CHARSET, 'UTF7-IMAP');
        }

        // set PHP error logging according to config
        if ($this->prop['debug_level'] & 1) {
            ini_set('log_errors', 1);

            if ($this->prop['log_driver'] == 'syslog') {
                ini_set('error_log', 'syslog');
            }
            else {
                ini_set('error_log', $this->prop['log_dir'].'/errors');
            }
        }

        // enable display_errors in 'show' level, but not for ajax requests
        ini_set('display_errors', intval(empty($_REQUEST['_remote']) && ($this->prop['debug_level'] & 4)));

        // remove deprecated properties
        unset($this->prop['dst_active']);

        // export config data
        $GLOBALS['CONFIG'] = &$this->prop;
    }
private function load ( ) { // Load default settings if ( ! $ this -> load_from_file ( 'defaults.inc.php' ) ) { $ this -> errors [ ] = 'defaults.inc.php was not found.' ; } // load main config file if ( ! $ this -> load_from_file ( 'config.inc.php' ) ) { // Old configuration files if ( ! $ this -> load_from_file ( 'main.inc.php' ) || ! $ this -> load_from_file ( 'db.inc.php' ) ) { $ this -> errors [ ] = 'config.inc.php was not found.' ; } else if ( rand ( 1 , 100 ) == 10 ) { // log warning on every 100th request (average) trigger_error ( "config.inc.php was not found. Please migrate your config by running bin/update.sh" , E_USER_WARNING ) ; } } // load host-specific configuration $ this -> load_host_config ( ) ; // set skin (with fallback to old 'skin_path' property) if ( empty ( $ this -> prop [ 'skin' ] ) ) { if ( ! empty ( $ this -> prop [ 'skin_path' ] ) ) { $ this -> prop [ 'skin' ] = str_replace ( 'skins/' , '' , unslashify ( $ this -> prop [ 'skin_path' ] ) ) ; } else { $ this -> prop [ 'skin' ] = self :: DEFAULT_SKIN ; } } // larry is the new default skin :-) if ( $ this -> prop [ 'skin' ] == 'default' ) { $ this -> prop [ 'skin' ] = self :: DEFAULT_SKIN ; } // fix paths foreach ( array ( 'log_dir' => 'logs' , 'temp_dir' => 'temp' ) as $ key => $ dir ) { foreach ( array ( $ this -> prop [ $ key ] , '../' . $ this -> prop [ $ key ] , RCUBE_INSTALL_PATH . $ dir ) as $ path ) { if ( $ path && ( $ realpath = realpath ( unslashify ( $ path ) ) ) ) { $ this -> prop [ $ key ] = $ realpath ; break ; } } } // fix default imap folders encoding foreach ( array ( 'drafts_mbox' , 'junk_mbox' , 'sent_mbox' , 'trash_mbox' ) as $ folder ) { $ this -> prop [ $ folder ] = rcube_charset :: convert ( $ this -> prop [ $ folder ] , RCUBE_CHARSET , 'UTF7-IMAP' ) ; } // set PHP error logging according to config if ( $ this -> prop [ 'debug_level' ] & 1 ) { ini_set ( 'log_errors' , 1 ) ; if ( $ this -> prop [ 'log_driver' ] == 'syslog' ) { ini_set ( 'error_log' , 'syslog' ) ; } else { ini_set ( 'error_log' , $ this -> prop [ 'log_dir' ] . '/errors' ) ; } } // enable display_errors in 'show' level, but not for ajax requests ini_set ( 'display_errors' , intval ( empty ( $ _REQUEST [ '_remote' ] ) && ( $ this -> prop [ 'debug_level' ] & 4 ) ) ) ; // remove deprecated properties unset ( $ this -> prop [ 'dst_active' ] ) ; // export config data $ GLOBALS [ 'CONFIG' ] = & $ this -> prop ; }
Load config from local config file

@todo Remove global $CONFIG
Load config from local config file