| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
$sf_symfony_lib_dir = sfConfig::get('sf_symfony_lib_dir'); |
|---|
| 22 |
if (!sfConfig::get('sf_in_bootstrap')) |
|---|
| 23 |
{ |
|---|
| 24 |
|
|---|
| 25 |
if (!function_exists('syck_load')) |
|---|
| 26 |
{ |
|---|
| 27 |
require_once($sf_symfony_lib_dir.'/util/Spyc.class.php'); |
|---|
| 28 |
} |
|---|
| 29 |
require_once($sf_symfony_lib_dir.'/util/sfYaml.class.php'); |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
require_once($sf_symfony_lib_dir.'/cache/sfCache.class.php'); |
|---|
| 33 |
require_once($sf_symfony_lib_dir.'/cache/sfFileCache.class.php'); |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
require_once($sf_symfony_lib_dir.'/config/sfConfigCache.class.php'); |
|---|
| 37 |
require_once($sf_symfony_lib_dir.'/config/sfConfigHandler.class.php'); |
|---|
| 38 |
require_once($sf_symfony_lib_dir.'/config/sfYamlConfigHandler.class.php'); |
|---|
| 39 |
require_once($sf_symfony_lib_dir.'/config/sfAutoloadConfigHandler.class.php'); |
|---|
| 40 |
require_once($sf_symfony_lib_dir.'/config/sfRootConfigHandler.class.php'); |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
require_once($sf_symfony_lib_dir.'/exception/sfException.class.php'); |
|---|
| 44 |
require_once($sf_symfony_lib_dir.'/exception/sfAutoloadException.class.php'); |
|---|
| 45 |
require_once($sf_symfony_lib_dir.'/exception/sfCacheException.class.php'); |
|---|
| 46 |
require_once($sf_symfony_lib_dir.'/exception/sfConfigurationException.class.php'); |
|---|
| 47 |
require_once($sf_symfony_lib_dir.'/exception/sfParseException.class.php'); |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
require_once($sf_symfony_lib_dir.'/util/sfParameterHolder.class.php'); |
|---|
| 51 |
} |
|---|
| 52 |
else |
|---|
| 53 |
{ |
|---|
| 54 |
require_once($sf_symfony_lib_dir.'/config/sfConfigCache.class.php'); |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
if (!function_exists('__autoload')) |
|---|
| 65 |
{ |
|---|
| 66 |
function __autoload($class) |
|---|
| 67 |
{ |
|---|
| 68 |
static $loaded; |
|---|
| 69 |
|
|---|
| 70 |
if (!$loaded) |
|---|
| 71 |
{ |
|---|
| 72 |
|
|---|
| 73 |
include_once(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/autoload.yml')); |
|---|
| 74 |
|
|---|
| 75 |
$loaded = true; |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
$classes = sfConfig::get('sf_class_autoload', array()); |
|---|
| 79 |
if (!isset($classes[$class])) |
|---|
| 80 |
{ |
|---|
| 81 |
if (sfContext::hasInstance()) |
|---|
| 82 |
{ |
|---|
| 83 |
|
|---|
| 84 |
// must be in a module context |
|---|
| 85 |
$current_module = sfContext::getInstance()->getModuleName(); |
|---|
| 86 |
if ($current_module) |
|---|
| 87 |
{ |
|---|
| 88 |
$module_lib = sfConfig::get('sf_app_module_dir').'/'.$current_module.'/'.sfConfig::get('sf_app_module_lib_dir_name').'/'.$class.'.class.php'; |
|---|
| 89 |
if (is_readable($module_lib)) |
|---|
| 90 |
{ |
|---|
| 91 |
require_once($module_lib); |
|---|
| 92 |
|
|---|
| 93 |
return; |
|---|
| 94 |
} |
|---|
| 95 |
} |
|---|
| 96 |
} |
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
$error = sprintf('Autoloading of class "%s" failed. Try to clear the symfony cache and refresh. [err0003]', $class); |
|---|
| 100 |
$e = new sfAutoloadException($error); |
|---|
| 101 |
|
|---|
| 102 |
$e->printStackTrace(); |
|---|
| 103 |
} |
|---|
| 104 |
else |
|---|
| 105 |
{ |
|---|
| 106 |
|
|---|
| 107 |
require_once($classes[$class]); |
|---|
| 108 |
} |
|---|
| 109 |
} |
|---|
| 110 |
} |
|---|
| 111 |
|
|---|
| 112 |
try |
|---|
| 113 |
{ |
|---|
| 114 |
$configCache = sfConfigCache::getInstance(); |
|---|
| 115 |
|
|---|
| 116 |
ini_set('unserialize_callback_func', '__autoload'); |
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
if (function_exists('date_default_timezone_get')) |
|---|
| 120 |
{ |
|---|
| 121 |
if ($default_timezone = sfConfig::get('sf_default_timezone')) |
|---|
| 122 |
{ |
|---|
| 123 |
date_default_timezone_set($default_timezone); |
|---|
| 124 |
} |
|---|
| 125 |
else if (sfConfig::get('sf_force_default_timezone', true)) |
|---|
| 126 |
{ |
|---|
| 127 |
date_default_timezone_set(@date_default_timezone_get()); |
|---|
| 128 |
} |
|---|
| 129 |
} |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
$sf_app_config_dir_name = sfConfig::get('sf_app_config_dir_name'); |
|---|
| 133 |
|
|---|
| 134 |
$sf_debug = sfConfig::get('sf_debug'); |
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
include($configCache->checkConfig($sf_app_config_dir_name.'/logging.yml')); |
|---|
| 138 |
$configCache->import($sf_app_config_dir_name.'/php.yml'); |
|---|
| 139 |
include($configCache->checkConfig($sf_app_config_dir_name.'/settings.yml')); |
|---|
| 140 |
include($configCache->checkConfig($sf_app_config_dir_name.'/app.yml')); |
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
if (!sfConfig::get('sf_in_bootstrap') && !$sf_debug && !sfConfig::get('sf_test')) |
|---|
| 144 |
{ |
|---|
| 145 |
$configCache->checkConfig($sf_app_config_dir_name.'/bootstrap_compile.yml'); |
|---|
| 146 |
} |
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
sfException::setFormat(isset($_SERVER['HTTP_HOST']) ? 'html' : 'plain'); |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
ini_set('display_errors', $sf_debug ? 'on' : 'off'); |
|---|
| 153 |
error_reporting(sfConfig::get('sf_error_reporting')); |
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : ''); |
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
if (!$sf_debug && !sfConfig::get('sf_test')) |
|---|
| 168 |
|
|---|
| 169 |
$core_classes = $sf_app_config_dir_name.'/core_compile.yml'; |
|---|
| 170 |
$configCache->import($core_classes); |
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
$configCache->import($sf_app_config_dir_name.'/routing.yml'); |
|---|
| 174 |
|
|---|
| 175 |
sfException $e) |
|---|
| 176 |
|
|---|
| 177 |
$e->printStackTrace(); |
|---|
| 178 |
|
|---|
| 179 |
Exception $e) |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
$e = new sfException($e->getMessage()); |
|---|
| 183 |
|
|---|
| 184 |
$e->printStackTrace(); |
|---|
| 185 |
|
|---|
| 186 |
|
|---|
| 187 |
?> |
|---|