forked from janpaul123/photoframed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·185 lines (167 loc) · 7.33 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
/*
* Photoframed, custom photoframe software
* Copyright (C) 2009-2010
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
session_start();
require_once("init.php");
?>
<html>
<head>
<title><?php echo $settings["display.name"] ?></title>
<link rel="stylesheet" href="css/default.css?<?php echo $version;?>" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.min.js?<?php echo $version;?>"></script>
<script type="text/javascript" src="js/jquery.text-overflow.min.js?<?php echo $version;?>"></script>
<script type="text/javascript" src="js/PhotoFrame.js?<?php echo $version;?>"></script>
<script type="text/javascript">
$(document).ready(function(){
PhotoFrame.init();
PhotoFrame.setDisplayInterval ( <?php echo($settings["display.interval"]); ?> );
PhotoFrame.setTrafficMap ("<?php echo($settings["traffic.map"]); ?>");
PhotoFrame.setTrafficOverlay ("<?php echo($settings["traffic.overlay"]); ?>");
PhotoFrame.setWeatherMap ("<?php echo($settings["weather.map"]); ?>");
PhotoFrame.setWeatherOverlay ("<?php echo($settings["weather.overlay"]); ?>");
PhotoFrame.setEnableBar ( <?php echo($settings["display.bar"]?'true':'false'); ?> );
PhotoFrame.setEnableFX ( <?php echo($settings["display.fx"]?'true':'false'); ?> );
PhotoFrame.setWebcamsInterval ( <?php echo($settings["webcams.interval"]); ?> );
PhotoFrame.setConnectionURL ("<?php echo(isset($settings["connection.url"])?$settings["connection.url"]:'http://www.nu.nl/images/logo_nu_nl.gif'); ?>");
<?php
if (isset($settings['photo.collapse_dirs']) && $settings['photo.collapse_dirs'])
{
require_once('dirs.php');
$files = findAllFiles($settings['photo.dirs']);
echo('PhotoFrame.setFileCount(' . trim(count($files)) . ');');
}
?>
$(document).keypress(function (event) {
var letter = String.fromCharCode(event.which);
<?php
foreach ($settings['display.keys'] as $key => $options)
{
echo('if (letter == "' . substr($key, 0, 1) .'") {');
echo($options['function'] . ';');
echo('}');
}
?>
event.stopPropagation()
return 0;
});
<?php
foreach ($settings['webcams.cams'] as $nr => $cam)
{
echo('PhotoFrame.addWebcam("webcam-' . $nr . '", "' . $cam['url'] . '", '
. (isset($cam['interval']) ? $cam['interval'] : '0') . ');');
}
?>
<?php if($settings["display.about"]) echo('PhotoFrame.showAbout();'); ?>
<?php if($settings["connection.check"]) echo('PhotoFrame.checkConnection();'); ?>
PhotoFrame.start();
});
</script>
</head>
<body>
<div id="container">
<div id="background"></div>
<?php if ($settings["display.bar"]) { ?>
<div id="bar" style="<?php if (isset($settings['display.bar_top'])) echo 'top:'.$settings['display.bar_top']; ?>">
<div id="clock">
<div class="holder" id="hours"></div>
<div class="holder" id="minutes"></div>
<?php if ($settings['connection.wifi']) {?>
<img id="connectionerror" src="img/transmit_error.png?<?php echo $version;?>"/>
<?php } else {?>
<img id="connectionerror" src="img/disconnect.png?<?php echo $version;?>"/>
<?php } ?>
</div>
<div id="quotes"></div>
</div>
<?php } ?>
<div id="traffic">
<?php
$trafficStyle = '';
if (!empty($settings['traffic.width'])) $trafficStyle .= 'width: ' . $settings['traffic.width'] . ';';
if (!empty($settings['traffic.height'])) $trafficStyle .= 'height: ' . $settings['traffic.height'] . ';';
if (!empty($settings['traffic.map'])) echo '<img class="map" src="' . $settings['traffic.map'] . '" style="' . $trafficStyle .'"/>';
if (!empty($settings['traffic.overlay'])) echo '<img class="overlay" src="' . $settings['traffic.overlay'] . '" style="' . $trafficStyle .'"/>';
?>
</div>
<div id="weather">
<?php
$weatherStyle = '';
if (!empty($settings['weather.width'])) $weatherStyle .= 'width: ' . $settings['weather.width'] . ';';
if (!empty($settings['weather.height'])) $weatherStyle .= 'height: ' . $settings['weather.height'] . ';';
if (!empty($settings['weather.map'])) echo '<img class="map" src="' . $settings['weather.map'] . '" style="' . $weatherStyle .'"/>';
if (!empty($settings['weather.overlay'])) echo '<img class="overlay" src="' . $settings['weather.overlay'] . '" style="' . $weatherStyle .'"/>';
?>
</div>
<div id="about">
<a href="http://github.com/janpaul123/photoframed" target="_blank">
<img src="img/logo.png?<?php echo $version;?>"/>
<div class="title">Photoframed</div>
<div class="link">github.com/janpaul123/photoframed</div>
</a>
press <strong>h</strong> for keyboard commands
</div>
<div id="help">
<table>
<?php
foreach ($settings['display.keys'] as $key => $options)
{
echo('<tr><td class="key">');
echo('<strong>' . (isset($options['key']) ? $options['key'] : $key) .'</strong>');
echo('</td><td class="title">');
echo($options['title'] . '<br />');
echo('</tr>');
}
?>
</table>
</div>
<div id="webcams">
<?php
$styleDivAllowed = array('top', 'bottom', 'left', 'right', 'float');
$styleImageAllowed = array('width', 'height', 'max-width', 'max-height', 'min-width', 'min-height');
foreach ($settings['webcams.cams'] as $nr => $cam)
{
$styleDiv='';
$styleImage='';
foreach($styleDivAllowed as $element)
{
if (isset($cam[$element])) $styleDiv .= $element . ': ' . $cam[$element] . '; ';
}
foreach($styleImageAllowed as $element)
{
if (isset($cam[$element])) $styleImage .= $element . ': ' . $cam[$element] . '; ';
}
if (isset($cam['top']) || isset($cam['bottom']) || isset($cam['left']) || isset($cam['right']))
{
$styleDiv .= 'position: fixed; ';
}
echo('<div class="container" style="' . $styleDiv . '">');
echo('<div class="holder">');
echo('<div class="border"></div>');
echo('<div id="webcam-' . $nr . '" >');
echo('<img class="webcam" style="' . $styleImage . '"/>');
echo('</div>');
echo('<div class="title">' . $cam['title'] . '</div>');
echo('<div class="shadow" id="shadow-webcam-' . $nr . '"></div>');
echo('<img class="error" id="error-webcam-' . $nr . '" src="img/webcam_error.png?<?php echo $version;?>"/>');
echo('</div>');
echo('</div>');
}
?>
</div>
</div>
</body>
</html>