-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.php
56 lines (48 loc) · 1.77 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
<?php
require 'api/cora/setting.php';
$setting = cora\setting::get_instance();
// Dump you straight into the demo.
if($setting->is_demo() === true) {
setcookie(
'session_key',
'd31d3ef451fe65885928e5e1bdf4af321f702009',
4294967295,
'/',
'demo.beestat.io',
$setting->get('force_ssl'),
true
);
// Just so I can make some simpler assumptions in app.php since the
// superglobal is not updated when calling setcookie().
$_COOKIE['session_key'] = 'd31d3ef451fe65885928e5e1bdf4af321f702009';
}
// If you're not logged in, just take you directly to the ecobee login page.
if(isset($_COOKIE['session_key']) === false) {
header('Location: https://' . $_SERVER['HTTP_HOST'] . '/api/?resource=ecobee&method=authorize&arguments={}&api_key=' . $setting->get('beestat_api_key_local'));
die();
}
?>
<!doctype html>
<html>
<head>
<title>beestat</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#222222">
<!-- Icon for pinning on iOS -->
<link rel="apple-touch-icon" href="/favicon_apple.png">
<?php
if($setting->is_demo() === false) {
echo '<!-- On iOS, place a banner to download the app -->';
echo '<meta name="apple-itunes-app" content="app-id=6469190206">';
}
?>
<?php
echo '<link rel="manifest" href="/manifest.json?' . $setting->get('commit') . '">';
echo '<link href="../css/dashboard.css?' . $setting->get('commit') . '" rel="stylesheet">';
require 'js/js.php';
?>
</head>
<body></body>
</html>