forked from mwunsch/thimble
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.php
More file actions
28 lines (20 loc) · 735 Bytes
/
theme.php
File metadata and controls
28 lines (20 loc) · 735 Bytes
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
<?php
require_once 'parser/parser.php';
$VERSION = '0.3.0';
$DATA = 'demo.yml';
$LOCALE = 'en-us.yml';
$THEME = 'themes/'.$_GET['theme'];
$options = $_REQUEST;
unset($options['theme'], $options['auto-refresh']);
$last_modified_time = filemtime($THEME);
$etag = md5_file($THEME);
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT");
header("Etag: $etag");
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
header("HTTP/1.1 304 Not Modified");
exit;
}
$theme = new ThimbleParser(file_get_contents('data/'.$DATA), file_get_contents('lang/'.$LOCALE));
echo $theme->parse(file_get_contents($THEME), $options);
?>