revolution /setup/includes/config/modrevolutionconfigreader.class.php

Language PHP Lines 74
MD5 Hash f58d40cda8a0ac6450d8a004eafdfaf1 Estimated Cost $1,187 (why?)
Repository git://github.com/modxcms/revolution.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/*
 * This file is part of MODX Revolution.
 *
 * Copyright (c) MODX, LLC. All Rights Reserved.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once strtr(realpath(MODX_SETUP_PATH.'includes/config/modconfigreader.class.php'),'\\','/');
/**
 * Reads from a Revolution config file
 *
 * @package modx
 * @subpackage setup
 */
class modRevolutionConfigReader extends modConfigReader {
    public function read(array $config = array()) {
        global $database_dsn, $database_type, $database_server, $dbase, $database_user, $database_password,
               $database_connection_charset, $table_prefix, $config_options, $driver_options;
        $database_connection_charset = 'utf8';

        /* get http host */
        $this->getHttpHost();

        @ob_start();
        $included = @ include MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
        @ob_end_clean();
        if ($included && isset ($dbase)) {
            $this->config['mgr_path'] = MODX_MANAGER_PATH;
            $this->config['connectors_path'] = MODX_CONNECTORS_PATH;
            $this->config['web_path'] = MODX_BASE_PATH;
            $this->config['context_mgr_path'] = MODX_MANAGER_PATH;
            $this->config['context_connectors_path'] = MODX_CONNECTORS_PATH;
            $this->config['context_web_path'] = MODX_BASE_PATH;

            $this->config['mgr_url'] = MODX_MANAGER_URL;
            $this->config['connectors_url'] = MODX_CONNECTORS_URL;
            $this->config['web_url'] = MODX_BASE_URL;
            $this->config['context_mgr_url'] = MODX_MANAGER_URL;
            $this->config['context_connectors_url'] = MODX_CONNECTORS_URL;
            $this->config['context_web_url'] = MODX_BASE_URL;

            $this->config['core_path'] = MODX_CORE_PATH;
            $this->config['processors_path'] = MODX_CORE_PATH.'model/modx/processors/';
            $this->config['assets_path'] = MODX_ASSETS_PATH;
            $this->config['assets_url'] = MODX_ASSETS_URL;

            $config_options = is_array($config_options) ? $config_options : array();
            $driver_options = is_array($driver_options) ? $driver_options : array();

            $this->config = array_merge(array(
                'database_type' => $database_type,
                'database_server' => $database_server,
                'dbase' => trim($dbase, '`[]'),
                'database_user' => $database_user,
                'database_password' => $database_password,
                'database_connection_charset' => $database_connection_charset,
                'database_charset' => $database_connection_charset,
                'table_prefix' => $table_prefix,
                'https_port' => isset ($https_port) ? $https_port : '443',
                'http_host' => defined('MODX_HTTP_HOST') ? MODX_HTTP_HOST : $this->config['http_host'],
                'site_sessionname' => isset ($site_sessionname) ? $site_sessionname : 'SN' . uniqid(''),
                'cache_disabled' => isset ($cache_disabled) && $cache_disabled ? 'true' : 'false',
                'inplace' => isset ($_POST['inplace']) ? 1 : 0,
                'unpacked' => isset ($_POST['unpacked']) ? 1 : 0,
                'config_options' => $config_options,
                'driver_options' => $driver_options,
            ),$this->config,$config);
        }
        return $this->config;
    }
}
Back to Top