symphonycms /
symphony-2
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * @package boot |
||
| 5 | */ |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Used to determine if Symphony has been loaded, useful to prevent |
||
| 9 | * files from being accessed directly. |
||
| 10 | * @var boolean |
||
| 11 | */ |
||
| 12 | define_safe('__IN_SYMPHONY__', true); |
||
| 13 | |||
| 14 | /** |
||
| 15 | * The filesystem path to the `manifest` folder |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | define_safe('MANIFEST', DOCROOT . '/manifest'); |
||
| 19 | |||
| 20 | /** |
||
| 21 | * The filesystem path to the `extensions` folder |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | define_safe('EXTENSIONS', DOCROOT . '/extensions'); |
||
| 25 | |||
| 26 | /** |
||
| 27 | * The filesystem path to the `workspace` folder |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | define_safe('WORKSPACE', DOCROOT . '/workspace'); |
||
| 31 | |||
| 32 | /** |
||
| 33 | * The filesystem path to the `symphony` folder |
||
| 34 | * @var string |
||
| 35 | */ |
||
| 36 | define_safe('SYMPHONY', DOCROOT . '/symphony'); |
||
| 37 | |||
| 38 | /** |
||
| 39 | * The filesystem path to the `lib` folder which is contained within |
||
| 40 | * the `symphony` folder. |
||
| 41 | * @var string |
||
| 42 | */ |
||
| 43 | define_safe('LIBRARY', SYMPHONY . '/lib'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 44 | |||
| 45 | /** |
||
| 46 | * The filesystem path to the `assets` folder which is contained within |
||
| 47 | * the `symphony` folder. |
||
| 48 | * @var string |
||
| 49 | */ |
||
| 50 | define_safe('ASSETS', SYMPHONY . '/assets'); |
||
| 51 | |||
| 52 | /** |
||
| 53 | * The filesystem path to the `content` folder which is contained within |
||
| 54 | * the `symphony` folder. |
||
| 55 | * @var string |
||
| 56 | */ |
||
| 57 | define_safe('CONTENT', SYMPHONY . '/content'); |
||
| 58 | |||
| 59 | /** |
||
| 60 | * The filesystem path to the `template` folder which is contained within |
||
| 61 | * the `symphony` folder. |
||
| 62 | * @var string |
||
| 63 | */ |
||
| 64 | define_safe('TEMPLATE', SYMPHONY . '/template'); |
||
| 65 | |||
| 66 | /** |
||
| 67 | * The filesystem path to the `utilities` folder which is contained within |
||
| 68 | * the `workspace` folder. |
||
| 69 | * @var string |
||
| 70 | */ |
||
| 71 | define_safe('UTILITIES', WORKSPACE . '/utilities'); |
||
|
0 ignored issues
–
show
|
|||
| 72 | |||
| 73 | /** |
||
| 74 | * The filesystem path to the `data-sources` folder which is contained within |
||
| 75 | * the `workspace` folder. |
||
| 76 | * @var string |
||
| 77 | */ |
||
| 78 | define_safe('DATASOURCES', WORKSPACE . '/data-sources'); |
||
| 79 | |||
| 80 | /** |
||
| 81 | * The filesystem path to the `events` folder which is contained within |
||
| 82 | * the `workspace` folder. |
||
| 83 | * @var string |
||
| 84 | */ |
||
| 85 | define_safe('EVENTS', WORKSPACE . '/events'); |
||
| 86 | |||
| 87 | /** |
||
| 88 | * The filesystem path to the `text-formatters` folder which is contained within |
||
| 89 | * the `workspace` folder. |
||
| 90 | * @var string |
||
| 91 | */ |
||
| 92 | define_safe('TEXTFORMATTERS', WORKSPACE . '/text-formatters'); |
||
| 93 | |||
| 94 | /** |
||
| 95 | * The filesystem path to the `pages` folder which is contained within |
||
| 96 | * the `workspace` folder. |
||
| 97 | * @var string |
||
| 98 | */ |
||
| 99 | define_safe('PAGES', WORKSPACE . '/pages'); |
||
| 100 | |||
| 101 | /** |
||
| 102 | * The filesystem path to the `cache` folder which is contained within |
||
| 103 | * the `manifest` folder. |
||
| 104 | * @var string |
||
| 105 | */ |
||
| 106 | define_safe('CACHE', MANIFEST . '/cache'); |
||
|
0 ignored issues
–
show
|
|||
| 107 | |||
| 108 | $dir = @sys_get_temp_dir(); |
||
| 109 | |||
| 110 | if ($dir == false || !@is_writable($dir)) { |
||
|
0 ignored issues
–
show
|
|||
| 111 | $dir = @ini_get('upload_tmp_dir'); |
||
| 112 | } |
||
| 113 | |||
| 114 | if ($dir == false || !is_writable($dir)) { |
||
|
0 ignored issues
–
show
|
|||
| 115 | $dir = MANIFEST . '/tmp'; |
||
| 116 | } |
||
|
0 ignored issues
–
show
|
|||
| 117 | /** |
||
| 118 | * The filesystem path to the `tmp` folder which is contained within |
||
| 119 | * the system's temp directory (sys_get_temp_dir()), or the `upload_tmp_dir` |
||
| 120 | * or falling back to use `manifest/tmp`. |
||
| 121 | * @var string |
||
| 122 | */ |
||
| 123 | define_safe('TMP', $dir); |
||
| 124 | unset($dir); |
||
| 125 | |||
| 126 | /** |
||
| 127 | * The filesystem path to the `logs` folder which is contained within |
||
| 128 | * the `manifest` folder. The default Symphony Log file is saved at this |
||
| 129 | * path. |
||
| 130 | * @var string |
||
| 131 | */ |
||
| 132 | define_safe('LOGS', MANIFEST . '/logs'); |
||
| 133 | |||
| 134 | /** |
||
| 135 | * The filesystem path to the `main` file which is contained within |
||
| 136 | * the `manifest/logs` folder. This is the default Symphony log file. |
||
| 137 | * @var string |
||
| 138 | */ |
||
| 139 | define_safe('ACTIVITY_LOG', LOGS . '/main'); |
||
|
0 ignored issues
–
show
|
|||
| 140 | |||
| 141 | /** |
||
| 142 | * The filesystem path to the `config.php` file which is contained within |
||
| 143 | * the `manifest` folder. This holds all the Symphony configuration settings |
||
| 144 | * for this install. |
||
| 145 | * @var string |
||
| 146 | */ |
||
| 147 | define_safe('CONFIG', MANIFEST . '/config.php'); |
||
| 148 | |||
| 149 | /** |
||
| 150 | * The filesystem path to the `boot` folder which is contained within |
||
| 151 | * the `symphony/lib` folder. |
||
| 152 | * @var string |
||
| 153 | */ |
||
| 154 | define_safe('BOOT', LIBRARY . '/boot'); |
||
|
0 ignored issues
–
show
|
|||
| 155 | |||
| 156 | /** |
||
| 157 | * The filesystem path to the `core` folder which is contained within |
||
| 158 | * the `symphony/lib` folder. |
||
| 159 | * @var string |
||
| 160 | */ |
||
| 161 | define_safe('CORE', LIBRARY . '/core'); |
||
| 162 | |||
| 163 | /** |
||
| 164 | * The filesystem path to the `lang` folder which is contained within |
||
| 165 | * the `symphony/lib` folder. By default, the Symphony install comes with |
||
| 166 | * an english language translation. |
||
| 167 | * @var string |
||
| 168 | */ |
||
| 169 | define_safe('LANG', LIBRARY . '/lang'); |
||
| 170 | |||
| 171 | /** |
||
| 172 | * The filesystem path to the `toolkit` folder which is contained within |
||
| 173 | * the `symphony/lib` folder. |
||
| 174 | * @var string |
||
| 175 | */ |
||
| 176 | define_safe('TOOLKIT', LIBRARY . '/toolkit'); |
||
| 177 | |||
| 178 | /** |
||
| 179 | * The filesystem path to the `interface` folder which is contained within |
||
| 180 | * the `symphony/lib` folder. |
||
| 181 | * @since Symphony 2.3 |
||
| 182 | * @var string |
||
| 183 | */ |
||
| 184 | define_safe('FACE', LIBRARY . '/interface'); |
||
| 185 | |||
| 186 | /** |
||
| 187 | * The filesystem path to the `email-gateways` folder which is contained within |
||
| 188 | * the `symphony/lib/toolkit` folder. |
||
| 189 | * @since Symphony 2.2 |
||
| 190 | * @var string |
||
| 191 | */ |
||
| 192 | define_safe('EMAILGATEWAYS', TOOLKIT . '/email-gateways'); |
||
|
0 ignored issues
–
show
|
|||
| 193 | |||
| 194 | /** |
||
| 195 | * Used as a default seed, this returns the time in seconds that Symphony started |
||
| 196 | * to load. Most profiling runs use this as a benchmark. |
||
| 197 | * @var float |
||
| 198 | */ |
||
| 199 | define_safe('STARTTIME', precision_timer()); |
||
| 200 | |||
| 201 | /** |
||
| 202 | * Returns the number of seconds that represent two weeks. |
||
| 203 | * @var integer |
||
| 204 | */ |
||
| 205 | define_safe('TWO_WEEKS', (60*60*24*14)); |
||
| 206 | |||
| 207 | /** |
||
| 208 | * Returns the environmental variable if HTTPS is in use. |
||
| 209 | * @var string|boolean |
||
| 210 | */ |
||
| 211 | define_safe('HTTPS', server_safe('HTTPS')); |
||
| 212 | |||
| 213 | /** |
||
| 214 | * Returns the current host, e.g. google.com |
||
| 215 | * @var string |
||
| 216 | */ |
||
| 217 | $http_host = server_safe('HTTP_HOST'); |
||
| 218 | if (function_exists('idn_to_utf8')) { |
||
| 219 | // In PHP 7.2, `idn_to_utf8` should not be called with default parameters, |
||
| 220 | // because the default for `variant` has been deprecated. However, the |
||
| 221 | // alternative variant `INTL_IDNA_VARIANT_UTS46` was not introduced before |
||
| 222 | // PHP 5.4, so we must be careful. |
||
| 223 | // https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003 |
||
| 224 | // https://bugs.php.net/bug.php?id=75609 |
||
| 225 | // @deprecated: This 'hack' can be removed later; when dropping PHP < 5.4, |
||
| 226 | // `idn_to_utf8($http_host, 0, INTL_IDNA_VARIANT_UTS46)` can be used |
||
| 227 | // exclusively. |
||
| 228 | if (defined('INTL_IDNA_VARIANT_UTS46')) { |
||
| 229 | $host_utf8 = idn_to_utf8($http_host, 0, INTL_IDNA_VARIANT_UTS46); |
||
| 230 | } else { |
||
| 231 | $host_utf8 = idn_to_utf8($http_host); |
||
| 232 | } |
||
| 233 | |||
| 234 | if ($host_utf8 !== false) { |
||
| 235 | $http_host = $host_utf8; |
||
| 236 | } |
||
|
0 ignored issues
–
show
|
|||
| 237 | unset($host_utf8); |
||
| 238 | } |
||
|
0 ignored issues
–
show
|
|||
| 239 | define_safe('HTTP_HOST', $http_host); |
||
| 240 | unset($http_host); |
||
| 241 | |||
| 242 | /** |
||
| 243 | * Returns the IP address of the machine that is viewing the current page. |
||
| 244 | * @var string |
||
| 245 | */ |
||
| 246 | define_safe('REMOTE_ADDR', server_safe('REMOTE_ADDR')); |
||
| 247 | |||
| 248 | /** |
||
| 249 | * Returns the User Agent string of the browser that is viewing the current page |
||
| 250 | * @var string |
||
| 251 | */ |
||
| 252 | define_safe('HTTP_USER_AGENT', server_safe('HTTP_USER_AGENT')); |
||
| 253 | |||
| 254 | /** |
||
| 255 | * If HTTPS is on, `__SECURE__` will be set to true, otherwise false. Use union of |
||
| 256 | * the `HTTPS` environmental variable and the X-Forwarded-Proto header to allow |
||
| 257 | * downstream proxies to inform the webserver of secured downstream connections |
||
| 258 | * @var string|boolean |
||
| 259 | */ |
||
| 260 | define_safe('__SECURE__', |
||
| 261 | (HTTPS == 'on' || server_safe('HTTP_X_FORWARDED_PROTO') == 'https') |
||
|
0 ignored issues
–
show
|
|||
| 262 | ); |
||
| 263 | |||
| 264 | /** |
||
| 265 | * Returns the protocol used to this request. |
||
| 266 | * If __SECURE__ it will be https: |
||
| 267 | * If not, http: |
||
| 268 | * @var string |
||
| 269 | */ |
||
| 270 | define_safe('HTTP_PROTO', 'http' . (defined('__SECURE__') && __SECURE__ ? 's' : '') . ':'); |
||
|
0 ignored issues
–
show
|
|||
| 271 | |||
| 272 | /** |
||
| 273 | * The root url directory. |
||
| 274 | * This constant will be empty if Symphony |
||
| 275 | * is installed at the root level |
||
| 276 | * |
||
| 277 | * @since Symphony 2.7.0 |
||
| 278 | * @var string |
||
| 279 | */ |
||
| 280 | define_safe('DIRROOT', rtrim(dirname(server_safe('PHP_SELF')), '\/')); |
||
| 281 | |||
| 282 | /** |
||
| 283 | * The current domain name. |
||
| 284 | * @var string |
||
| 285 | */ |
||
| 286 | define_safe('DOMAIN', HTTP_HOST . DIRROOT); |
||
|
0 ignored issues
–
show
|
|||
| 287 | |||
| 288 | /** |
||
| 289 | * The base URL of this Symphony install, minus the symphony path. |
||
| 290 | * @var string |
||
| 291 | */ |
||
| 292 | define_safe('URL', HTTP_PROTO . '//' . DOMAIN); |
||
|
0 ignored issues
–
show
|
|||
| 293 | |||
| 294 | /** |
||
| 295 | * Returns the folder name for Symphony as an application |
||
| 296 | * @since Symphony 2.3.2 |
||
| 297 | * @var string |
||
| 298 | */ |
||
| 299 | define_safe('APPLICATION_URL', URL . '/symphony'); |
||
|
0 ignored issues
–
show
|
|||
| 300 | |||
| 301 | /** |
||
| 302 | * Returns the folder name for Symphony as an application |
||
| 303 | * @since Symphony 2.6.0 |
||
| 304 | * @var string |
||
| 305 | */ |
||
| 306 | define_safe('ASSETS_URL', APPLICATION_URL . '/assets'); |
||
|
0 ignored issues
–
show
|
|||
| 307 | |||
| 308 | /** |
||
| 309 | * The integer value for event-type resources. |
||
| 310 | * |
||
| 311 | * @deprecated Use ResourceManager::RESOURCE_TYPE_EVENT, this will be removed in Symphony 3.0. |
||
| 312 | * @var integer |
||
| 313 | */ |
||
| 314 | define_safe('RESOURCE_TYPE_EVENT', 20); |
||
| 315 | |||
| 316 | /** |
||
| 317 | * The integer value for datasource-type resources. |
||
| 318 | * |
||
| 319 | * @deprecated Use ResourceManager::RESOURCE_TYPE_DS, this will be removed in Symphony 3.0. |
||
| 320 | * @var integer |
||
| 321 | */ |
||
| 322 | define_safe('RESOURCE_TYPE_DS', 21); |
||
| 323 | |||
| 324 | /** |
||
| 325 | * The constant for when an Entry is ok, that is, no errors have |
||
| 326 | * been raised by any of it's Fields. |
||
| 327 | * @deprecated Use Entry::__ENTRY_OK__, this will be removed in Symphony 3.0. |
||
| 328 | * @var integer |
||
| 329 | */ |
||
| 330 | define_safe('__ENTRY_OK__', 0); |
||
| 331 | |||
| 332 | /** |
||
| 333 | * The constant for an Entry if there is an error is raised by any of |
||
| 334 | * it's Fields. |
||
| 335 | * @deprecated Use Entry::__ENTRY_FIELD_ERROR__, this will be removed in Symphony 3.0. |
||
| 336 | * @var integer |
||
| 337 | */ |
||
| 338 | define_safe('__ENTRY_FIELD_ERROR__', 100); |
||
| 339 | |||
| 340 | /** |
||
| 341 | * Status when an extension is installed and enabled |
||
| 342 | * @deprecated Use Extension::EXTENSION_ENABLED, this will be removed in Symphony 3.0. |
||
| 343 | * @var integer |
||
| 344 | */ |
||
| 345 | define_safe('EXTENSION_ENABLED', 10); |
||
| 346 | |||
| 347 | /** |
||
| 348 | * Status when an extension is disabled |
||
| 349 | * @deprecated Use Extension::EXTENSION_DISABLED, this will be removed in Symphony 3.0. |
||
| 350 | * @var integer |
||
| 351 | */ |
||
| 352 | define_safe('EXTENSION_DISABLED', 11); |
||
| 353 | |||
| 354 | /** |
||
| 355 | * Status when an extension is in the file system, but has not been installed. |
||
| 356 | * @deprecated Use Extension::EXTENSION_NOT_INSTALLED, this will be removed in Symphony 3.0. |
||
| 357 | * @var integer |
||
| 358 | */ |
||
| 359 | define_safe('EXTENSION_NOT_INSTALLED', 12); |
||
| 360 | |||
| 361 | /** |
||
| 362 | * Status when an extension version in the file system is different to |
||
| 363 | * the version stored in the database for the extension |
||
| 364 | * @deprecated Use Extension::EXTENSION_REQUIRES_UPDATE, this will be removed in Symphony 3.0. |
||
| 365 | * @var integer |
||
| 366 | */ |
||
| 367 | define_safe('EXTENSION_REQUIRES_UPDATE', 13); |
||
| 368 | |||
| 369 | /** |
||
| 370 | * Status when the extension is not compatible with the current version of |
||
| 371 | * Symphony |
||
| 372 | * @deprecated Use Extension::EXTENSION_NOT_COMPATIBLE, this will be removed in Symphony 3.0. |
||
| 373 | * @since Symphony 2.3 |
||
| 374 | * @var integer |
||
| 375 | */ |
||
| 376 | define_safe('EXTENSION_NOT_COMPATIBLE', 14); |
||
| 377 | |||
| 378 | /** |
||
| 379 | * Defines a constant for when the Profiler should be a complete snapshot of |
||
| 380 | * the page load, from the very start, to the very end. |
||
| 381 | * @var integer |
||
| 382 | */ |
||
| 383 | define_safe('PROFILE_RUNNING_TOTAL', 0); |
||
| 384 | |||
| 385 | /** |
||
| 386 | * Defines a constant for when a snapshot should be between two points, |
||
| 387 | * usually when a start time has been given |
||
| 388 | * @var integer |
||
| 389 | */ |
||
| 390 | define_safe('PROFILE_LAP', 1); |
||
| 391 | |||
| 392 | /** |
||
| 393 | * Defines a constant for the opening tag of a CDATA section in xml |
||
| 394 | * @since Symphony 2.3.4 |
||
| 395 | * @var string |
||
| 396 | */ |
||
| 397 | define_safe('CDATA_BEGIN', '<![CDATA['); |
||
| 398 | |||
| 399 | /** |
||
| 400 | * Defines a constant for the closing tag of a CDATA section in xml |
||
| 401 | * @since Symphony 2.3.4 |
||
| 402 | * @var string |
||
| 403 | */ |
||
| 404 | define_safe('CDATA_END', ']]>'); |
||
| 405 |