_arrayMergeRecursive($config, $localConfig); } if (!defined('PATH_SEPARATOR')) { $config[$section]['PATH_SEPARATOR'] = (getenv('COMSPEC')) ? ';' : ':'; } if (null === $config['define']['DEBUG']) { $config['define']['DEBUG'] = (in_array($_SERVER['REMOTE_ADDR'], $config['debug']['ips']) && isset($_COOKIE[$config['debug']['cookie']])); } $this->_initBaseurlWebpath($config[$section]); $config[$section]['BASE_PATH'] = realpath($config[$section]['WWW_PATH'] . '/' . $config[$section]['BASE_PATH']); foreach($config[$section] as $var => $value) { define(strtoupper($var), $value); } } protected function _initBaseurlWebpath(&$config) { $host = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']; //$config['WWW_PATH'] = dirname($_SERVER['SCRIPT_FILENAME']); $config['WWW_PATH'] = realpath('.'); //$config['BASE_URL'] = $host . str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', $config['WWW_PATH']); $config['BASE_URL'] = $host . str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); $config['BASE_URL'] = substr($config['BASE_URL'], 0, -1); while (!is_file($config['WWW_PATH'] . '/_lib/_sys/Frwd_ConfigLite.php')) { $config['WWW_PATH'] = dirname($config['WWW_PATH']); $config['BASE_URL'] = dirname($config['BASE_URL']); if ('/' == $config['WWW_PATH']) { die('INCORECT SCRIPT LOCATION'); } } $config['BASE_URL_HTTP'] = str_replace('https://', 'http://', $config['BASE_URL']); $config['BASE_URL_HTTPS'] = str_replace('http://', 'https://', $config['BASE_URL']); $config['WEB_PATH'] = str_replace($host, '', $config['BASE_URL']); return true; } protected function _arrayMergeRecursive($array1, $array2) { if (is_array($array1) && is_array($array2)) { foreach ($array2 as $key => $value) { if (isset($array1[$key])) { $array1[$key] = $this->_arrayMergeRecursive($array1[$key], $value); } else { $array1[$key] = $value; } } } else { $array1 = $array2; } return $array1; } }