-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
55 lines (47 loc) · 1.6 KB
/
Copy pathindex.php
File metadata and controls
55 lines (47 loc) · 1.6 KB
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
53
54
55
<?php // @codingStandardsIgnoreFile
/**
* This file is part of Pico. It's copyrighted by the contributors recorded
* in the version control history of the file, available from the following
* original location:
*
* <https://github.com/picocms/Pico/blob/master/index.php.dist>
*
* SPDX-License-Identifier: MIT
* License-Filename: LICENSE
*/
// check PHP platform requirements
if (PHP_VERSION_ID < 50306) {
die('Pico requires PHP 5.3.6 or above to run');
}
if (!extension_loaded('dom')) {
die("Pico requires the PHP extension 'dom' to run");
}
if (!extension_loaded('mbstring')) {
die("Pico requires the PHP extension 'mbstring' to run");
}
// Normalize the public protocol and port reported by a trusted reverse proxy.
// Pico otherwise combines X-Forwarded-Proto with Apache's internal port.
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
$forwardedProtocols = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO']);
$forwardedProtocol = strtolower(trim($forwardedProtocols[0]));
$isForwardedHttps = in_array($forwardedProtocol, array('https', 'on', 'ssl', '1'), true);
if ($isForwardedHttps) {
$_SERVER['HTTPS'] = 'on';
}
if (empty($_SERVER['HTTP_X_FORWARDED_PORT'])) {
$_SERVER['HTTP_X_FORWARDED_PORT'] = $isForwardedHttps ? '443' : '80';
}
}
// load dependencies
require_once(__DIR__ . '/vendor/autoload.php');
// instance Pico
$pico = new Pico(
__DIR__, // root dir
'config/', // config dir
'plugins/', // plugins dir
'themes/' // themes dir
);
// override configuration?
//$pico->setConfig(array());
// run application
echo $pico->run();