forked from bolt/bolt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
52 lines (47 loc) · 1.46 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* Bolt entry script
*
* Here we'll require in the first stage load script, which handles all the
* tasks needed to return the app. Once we get the app, we simply tell it
* to run, building a beautiful web page for you and other visitors.
*
* We get things started by ensuring the PHP version we're running on
* is supported by the app. We'll display a friendly error page if not.
*
* Next, we'll check if the script is being run with PHP's built in web
* server, and make sure static assets are handled gracefully.
*
*/
/**
* Version must be greater than 5.3.3.
*
* Note, we use `dirname(__FILE__)` instead of `__DIR__`. The latter was introduced "only" in
* PHP 5.3, and we need to be able to show the notice to the poor souls who are still on PHP 5.2.
*
* @see: https://github.com/bolt/bolt/issues/1531
* @see: https://github.com/bolt/bolt/issues/3371
*/
if (version_compare(PHP_VERSION, '5.3.3', '<')) {
require dirname(__FILE__) . '/app/legacy.php';
return false;
}
/**
* Return false if the requested file is available on the filesystem.
* @see: http://silex.sensiolabs.org/doc/web_servers.html#php-5-4
*/
if (php_sapi_name() == 'cli-server') {
$filename = __DIR__ . preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
if (is_file($filename)) {
return false;
}
}
/**
* @var \Bolt\Application $app
*/
$app = require_once __DIR__ . '/app/bootstrap.php';
if ($app) {
$app->run();
} else {
return false;
}