-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
104 lines (95 loc) · 3.42 KB
/
Copy pathindex.php
File metadata and controls
104 lines (95 loc) · 3.42 KB
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
<?php
/* shutdown calls in PHP:
system("shutdown now"); // basic shutdown task
system("shutdown -r now"); // reboot
system("shutdown -h now"); // shutdown and halt
system("shutdown -P now"); // shutdown and power off
*/
function makeTable( $aRows ){
$r = "<table border=0 class=\"center\">";
foreach( $aRows as $row ){
$r .= $row;
}
return $r."</table>";
}
function cell( $data, $attr, $blank, $autoblank ){
if( $blank || $autoblank == "" ) $data = " ";
else if( is_numeric($data) ){
$data = number_format( $data, 6 );
}
return "<td $attr>$data</td>";
}
function makeRow( $aData ){
$r = "<tr>";
foreach( $aData as $cell ){
$r .= $cell;
}
return $r."</tr>";
}
$langjson = json_decode( file_get_contents("data/language.json"), false );
$language = $langjson->language;
// load default language file
// with the defaults loaded, any other language file doesn't have to be complete
//
$lang = array();
include_once("lang/settings.php"); // initialise array and sub-arrays
include_once("lang/en/settings.php"); // populate with default data (english)
if( $language != "en" && is_file("lang/$language/settings.php") ){
include_once("lang/$language/settings.php"); // populate with partial or full optional language
}
?>
<html lang="<?php echo $language;?>">
<head>
<!-- default skin is skin1 -->
<link id=hstyle rel="stylesheet" href="style/global.css" type="text/css" />
<script>
<?php
//echo "let lango = $lang;\n";
$files = "";
$fc = 0;
$idir = __DIR__."/images/slides";
$dataDir = __DIR__."/data/";
$h = opendir($idir);
while( false !== ( $entry = readdir($h) ) ){
if( $entry != "." && $entry != ".." ){
if( $fc ){
$files .= ",";
}
$fc = 1;
$files .= '"'.$entry.'"';
}
}
echo "let slideDir = '/images/slides/';\n";
echo "let slides = [$files];\n";
//$siteInfo = "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s";
$skin = file_get_contents($dataDir."skin.json");
echo "let skin = $skin;\n";
$skin = json_decode( $skin, false );
$site = $skin->siteinfo;
$rows = array();
$blank = !$skin->table;
$rows[] = makeRow( array(cell( $lang['clock']['code'], "class=left", $blank, $site->code), cell( $site->code, "class=right", $blank, $site->code )) );
$rows[] = makeRow( array(cell( $lang['clock']['name'], "class=left", $blank, $site->name), cell( $site->name, "class=right", $blank, $site->name )) );
$rows[] = makeRow( array(cell( $lang['clock']['type'], "class=left", $blank, $site->type), cell( $site->type, "class=right", $blank, $site->type )) );
$rows[] = makeRow( array(cell( $lang['clock']['lat'] , "class=left", $blank, $site->lat), cell( $site->lat , "class=right", $blank, $site->lat )) );
$rows[] = makeRow( array(cell( $lang['clock']['lon'] , "class=left", $blank, $site->lon), cell( $site->lon , "class=right", $blank, $site->lon )) );
$rows[] = makeRow( array(cell( $lang['clock']['ls'], "class=left", !$skin->lsubs, "1" ),cell( "", "id=lsubs class=right", !$skin->lsubs, "1")) );
?>
</script>
<script type="module" src="/scripts/index.js" defer></script>
</head>
<body>
<div class=mdiv>
<center>
<div id="info" class="info2"><?php echo makeTable($rows);?></div>
<div id="time" class=content>
Initialising...
</div>
</center>
</div>
<img src="/images/gears-png-file-3c.png" class="gear" onClick="location.href = '/admin/admin.php';">
<div id=debug class=debug></div>
<script>
</script>
</body>
</html>