-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
126 lines (100 loc) · 2.13 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
require_once ('engine/content.php');
require_once ('engine/trackstate.php');
// Change me when css/js is changed
define ('CLIENT_VERSION', 30);
// Set me to true when the site works in a special (event) mode
define ('EVENT_OVERRIDE', false);
$route = explode('/', $_GET['route']);
if (empty(trim($route[0])))
{
$route[0] = 'index';
}
if ($route[0] === 'tracktype') {
$trackType = getCurrentTrackType();
header ('Content-Type: text/plain');
switch ($trackType) {
case 'night':
die('night');
break;
case 'day':
die('day');
break;
case 'evening':
die('evening');
break;
default:
die('evening');
break;
}
}
$content_template = get_template ($route[0]);
$page_title = get_title($route[0]);
$nowtime = (int)date('G');
$site_mode = 'night';
if (EVENT_OVERRIDE)
$site_mode = 'event';
else
{
if (!empty($_GET['mode']))
{
switch ($_GET['mode'])
{
case 'day':
$site_mode = 'day';
break;
case 'night':
$site_mode = 'night';
break;
case 'evening':
$site_mode = 'evening';
break;
default:
$site_mode = 'night';
break;
}
}
else
{
if ($nowtime >= 0 && $nowtime < 7)
$site_mode = 'night';
else if ($nowtime >= 7 && $nowtime < 19)
$site_mode = 'day';
else
$site_mode = 'evening';
/*$currentTrackType = getCurrentTrackType();
switch ($currentTrackType) {
case 'night':
$site_mode = 'night';
break;
case 'day':
$site_mode = 'day';
break;
case 'evening':
$site_mode = 'evening';
break;
default:
$site_mode = 'evening';
break;
}*/
}
}
$bg_color = ($site_mode == 'day') ? '5fb0e8' : '202020';
if (isset($_GET['ajax']))
{
include_once ('engine/content/'.$content_template);
include_once ('engine/title_set.tpl');
die();
}
else
{
$content['site_mode'] = $site_mode;
$content['background_mode'] = $site_mode;
$content['background_color'] = $bg_color;
$content['title'] = $page_title.' – Советская волна';
$content['logo'] = '#sovietwave';
include_once ('engine/header.tpl');
include_once ('engine/content/'.$content_template);
include_once ('engine/footer.tpl');
die();
}