Ejemplo n.º 1
0
define('ZNAP_ENV', $environment);
define('ZNAP_MODE', $mode);
// include environment specific settings
if (is_file(dirname(__FILE__) . '/environments/' . ZNAP_ENV . '.php')) {
    include_once dirname(__FILE__) . '/environments/' . ZNAP_ENV . '.php';
}
// set url prefix if needed
if (!empty($url_prefix)) {
    define('URL_PREFIX', $url_prefix);
}
// php error logging
define('ZNAP_ENABLE_LOGGING', $enable_logging);
define('ZNAP_INTERNAL_LOGGING', $internal_logging);
// include and initialize main zynapse class
require_once ZNAP_LIB_ROOT . '/zynapse.php';
Znap::initialize();
if (!empty($timer_enabled) || ZNAP_ENV != 'production') {
    Znap::start_timer();
}
// function to get all matched host settings
function match_host($list = array())
{
    if (is_array($list) && !empty($list)) {
        $new_config = array();
        foreach ($list as $host => $settings) {
            $regex = preg_quote($host, '/');
            $regex = str_replace('\\*', '.*', $regex);
            $http_host = substr($_SERVER['HTTP_HOST'], 0, 4) == 'www.' ? substr($_SERVER['HTTP_HOST'], 4) : $_SERVER['HTTP_HOST'];
            if (preg_match('/^' . $regex . '$/i', $http_host)) {
                foreach ($settings as $key => $value) {
                    if (!array_key_exists($key, $new_config)) {