-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
62 lines (51 loc) · 1.1 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
56
57
58
59
60
61
62
<?php
include('classes/DocketRoute.php');
include('classes/DocketConfigLoader.php');
include('classes/DocketParser.php');
include('classes/DocketStringNormalize.php');
include('libs/Parsedown/Parsedown.php');
include('libs/ParsedownExtra/ParsedownExtra.php');
$config = new DocketConfigLoader;
$config->loadConfig("config.json");
$router = new DocketRoute();
$parts = $router->loadRoute($_SERVER['REQUEST_URI'], $config->configData->wiki_root_url);
$loadedUrl = '';
$current_page_name = '';
if(count($parts) >= 1)
{
if(count($parts) == 1)
{
if($parts[0] == '')
{
$loadedUrl = $config->configData->start_page;
$current_page_name = $loadedUrl;
}
else
{
$loadedUrl = $parts[0];
$current_page_name = $loadedUrl;
}
}
else
{
$counter = 1;
$limit = count($parts);
foreach($parts as $part)
{
$loadedUrl = $loadedUrl . $part;
if($counter != $limit)
{
$loadedUrl = $loadedUrl . '/';
}
else
{
$current_page_name = $part;
}
$counter++;
}
}
}
$parser = new DocketParser();
$normalizer = new DocketStringNormalize;
include('layouts/template/app.php');
?>