-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.php
67 lines (50 loc) · 1.6 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
63
64
65
66
67
<?php
$static_media = "//cdn.xfce.org";
/*error_reporting(E_ALL | E_STRICT);*/
date_default_timezone_set ('UTC');
function microtime_float ()
{
list ($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$timer_start = microtime_float ();
include ('lib/core.php');
$uri_a = explode('?', $_SERVER['REQUEST_URI']);
$uri = trim (strtolower ($uri_a[0]), '/');
/* compatibility with old website */
if (isset ($_GET['feed']) && $_GET['feed'] == 'rss2')
{
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: https://xfce.org/feed');
exit;
}
/* lookup to page from the uri */
$content_file = lookup_page ($uri);
/* news feed handling */
if ($uri == 'feed')
{
include ($content_file);
exit;
}
/* load the page content in a buffer (we don't need it yet,
* but we do need some variables for the header) */
ob_start ();
include ($content_file);
$contents = ob_get_clean ();
/* load the category navigation if there is one */
$navigation_file = dirname ($content_file) . '/nav.php';
if (is_file ($navigation_file))
$toc['filename'] = $navigation_file;
/* unique class name for the page content */
$page_class = str_replace (array ('pages/', '/'), array ('', '_'),
basename ($content_file, '.php'));
/* load the page header */
include ('pages/header.php');
/* write the contents */
echo $contents;
/* end with the footer */
$footer['mtime'] = date ('Y/m/d', filemtime ($content_file));
include ('pages/footer.php');
$timer_end = microtime_float ();
echo "<!-- Execution time: ". round ($timer_end - $timer_start, 4) ." second -->";
?>