/** * Establish default configuration based on given or default server and path * Sets global $_server, $_path, and $config */ public static function initDefaults($server, $path) { global $_server, $_path, $config, $_PEAR; Event::clearHandlers(); self::$plugins = array(); // try to figure out where we are. $server and $path // can be set by including module, else we guess based // on HTTP info. if (isset($server)) { $_server = $server; } else { $_server = array_key_exists('SERVER_NAME', $_SERVER) ? strtolower($_SERVER['SERVER_NAME']) : null; } if (isset($path)) { $_path = $path; } else { $_path = array_key_exists('SERVER_NAME', $_SERVER) && array_key_exists('SCRIPT_NAME', $_SERVER) ? self::_sn_to_path($_SERVER['SCRIPT_NAME']) : null; } // Set config values initially to default values $default = self::defaultConfig(); $config = $default; // default configuration, overwritten in config.php // Keep DB_DataObject's db config synced to ours... $config['db'] =& $_PEAR->getStaticProperty('DB_DataObject', 'options'); $config['db'] = $default['db']; if (function_exists('date_default_timezone_set')) { /* Work internally in UTC */ date_default_timezone_set('UTC'); } }