PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/modxcms/revolution
PHP | 72 lines | 64 code | 0 blank | 8 comment | 0 complexity | b9a860af7c473e35c10496caca7ff135 MD5 | raw file
Possible License(s): GPL-2.0, Apache-2.0, BSD-3-Clause, LGPL-2.1
  1. <?php
  2. /*
  3. * This file is part of MODX Revolution.
  4. *
  5. * Copyright (c) MODX, LLC. All Rights Reserved.
  6. *
  7. * For complete copyright and license information, see the COPYRIGHT and LICENSE
  8. * files found in the top-level directory of this distribution.
  9. */
  10. require_once strtr(realpath(MODX_SETUP_PATH.'includes/config/modconfigreader.class.php'),'\\','/');
  11. /**
  12. * Reads from a Revolution config file
  13. *
  14. * @package modx
  15. * @subpackage setup
  16. */
  17. class modRevolutionConfigReader extends modConfigReader {
  18. public function read(array $config = array()) {
  19. global $database_dsn, $database_type, $database_server, $dbase, $database_user, $database_password,
  20. $database_connection_charset, $table_prefix, $config_options, $driver_options;
  21. $database_connection_charset = 'utf8';
  22. /* get http host */
  23. $this->getHttpHost();
  24. @ob_start();
  25. $included = @ include MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
  26. @ob_end_clean();
  27. if ($included && isset ($dbase)) {
  28. $this->config['mgr_path'] = MODX_MANAGER_PATH;
  29. $this->config['connectors_path'] = MODX_CONNECTORS_PATH;
  30. $this->config['web_path'] = MODX_BASE_PATH;
  31. $this->config['context_mgr_path'] = MODX_MANAGER_PATH;
  32. $this->config['context_connectors_path'] = MODX_CONNECTORS_PATH;
  33. $this->config['context_web_path'] = MODX_BASE_PATH;
  34. $this->config['mgr_url'] = MODX_MANAGER_URL;
  35. $this->config['connectors_url'] = MODX_CONNECTORS_URL;
  36. $this->config['web_url'] = MODX_BASE_URL;
  37. $this->config['context_mgr_url'] = MODX_MANAGER_URL;
  38. $this->config['context_connectors_url'] = MODX_CONNECTORS_URL;
  39. $this->config['context_web_url'] = MODX_BASE_URL;
  40. $this->config['core_path'] = MODX_CORE_PATH;
  41. $this->config['processors_path'] = MODX_CORE_PATH.'model/modx/processors/';
  42. $this->config['assets_path'] = MODX_ASSETS_PATH;
  43. $this->config['assets_url'] = MODX_ASSETS_URL;
  44. $config_options = is_array($config_options) ? $config_options : array();
  45. $driver_options = is_array($driver_options) ? $driver_options : array();
  46. $this->config = array_merge(array(
  47. 'database_type' => $database_type,
  48. 'database_server' => $database_server,
  49. 'dbase' => trim($dbase, '`[]'),
  50. 'database_user' => $database_user,
  51. 'database_password' => $database_password,
  52. 'database_connection_charset' => $database_connection_charset,
  53. 'database_charset' => $database_connection_charset,
  54. 'table_prefix' => $table_prefix,
  55. 'https_port' => isset ($https_port) ? $https_port : '443',
  56. 'http_host' => defined('MODX_HTTP_HOST') ? MODX_HTTP_HOST : $this->config['http_host'],
  57. 'site_sessionname' => isset ($site_sessionname) ? $site_sessionname : 'SN' . uniqid(''),
  58. 'inplace' => isset ($_POST['inplace']) ? 1 : 0,
  59. 'unpacked' => isset ($_POST['unpacked']) ? 1 : 0,
  60. 'config_options' => $config_options,
  61. 'driver_options' => $driver_options,
  62. ),$this->config,$config);
  63. }
  64. return $this->config;
  65. }
  66. }