forked from getkirby-v2/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
55 lines (41 loc) · 1.15 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
53
54
55
<?php
use Kirby\Panel;
define('DS', DIRECTORY_SEPARATOR);
// fetch the site's index directory
$index = dirname(__DIR__);
// load the kirby bootstrapper
require($index . DS . 'kirby' . DS . 'bootstrap.php');
// load the panel bootstrapper
require(__DIR__ . DS . 'app' . DS . 'bootstrap.php');
// check for a custom site.php
if(file_exists($index . DS . 'site.php')) {
// load the custom config
require($index . DS . 'site.php');
} else {
// create a new kirby object
$kirby = kirby();
}
// fix the base url for the kirby installation
if(!isset($kirby->urls->index)) {
$kirby->urls->index = dirname($kirby->url());
}
// the default index directory
if(!isset($kirby->roots->index)) {
$kirby->roots->index = $index;
}
// the default avatar directory
if(!isset($kirby->roots->avatars)) {
$kirby->roots->avatars = $index . DS . 'assets' . DS . 'avatars';
}
// the default thumbs directory
if(!isset($kirby->roots->thumbs)) {
$kirby->roots->thumbs = $index . DS . 'thumbs';
}
try {
// create the panel object
$panel = new Panel($kirby, __DIR__);
// launch the panel
echo $panel->launch();
} catch(Exception $e) {
echo Panel::fatal($e, __DIR__);
}