-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·119 lines (109 loc) · 4.61 KB
/
Copy pathindex.php
File metadata and controls
executable file
·119 lines (109 loc) · 4.61 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
header('Cache-Control: no-cache');
header('Content-Type: text/html; charset=UTF-8');
session_start();
session_unset();
require_once 'main/subs.php';
//sprache
$languages = dirlisting('language', 'xml');
if (!empty($_GET['c_lang']) && array_key_exists($_GET['c_lang'] . '.xml', $languages)) {
$_SESSION['language']['name'] = $_GET['c_lang'];
} else {
$_SESSION['language']['name'] = ($_ENV['GUI_LANGUAGE'] ?: 'deutsch');
}
$language_file = file_get_contents('language/' . $_SESSION['language']['name'] . '.xml');
$language_parser = xml_parser_create();
xml_set_element_handler($language_parser, function ($parser, $name, $attrs) {
$keys = array_keys($attrs);
$_SESSION['language'][$name] = [];
foreach ($keys as $l) {
$_SESSION['language'][$name][$l] = $attrs[$l];
}
}, null);
xml_parse($language_parser, $language_file);
xml_parser_free($language_parser);
$styles = dirlisting('style', 'php');
if (isset($_GET['c_style']) && array_key_exists($_GET['c_style'], $styles)) {
$_SESSION['stylefile'] = $_GET['c_style'];
} else {
$_SESSION['stylefile'] = $_ENV['GUI_STYLE'];
}
require_once 'style/' . $_SESSION['stylefile'];
$_SESSION['stylesheet'] = '<link rel="stylesheet" type="text/css" href="../style/' . $stylesheet . '" />';
?>
<!DOCTYPE html>
<html>
<head>
<title>php-applejuice</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style/<?php echo $stylesheet; ?>"/>
<style>
select {
width: 100%;
}
</style>
</head>
<body>
<div align="center">
<h2><?php echo $_SESSION['language']['LOGIN']['HEADLINE']; ?></h2>
<form name="loginform" action="main/index.php" method="post" autocomplete="off">
<table>
<tr>
<td>
<label for="host"><?php echo $_SESSION['language']['LOGIN']['CORE_HOST']; ?></label>:
</td>
<td>
<input type="url" id="host" name="host" value="<?php echo ($_ENV['CORE_HOST'] ?: $_ENV['REAL_IP']) . ':' . ($_ENV['CORE_PORT'] ?? 9851); ?>" size="24" required/>
</td>
</tr>
<tr>
<td>
<label for="cpass"><?php echo $_SESSION['language']['LOGIN']['CORE_PASSWORD']; ?></label>:
</td>
<td>
<input id="cpass" type="password" name="cpass" value="" size='24' autofocus required/>
</td>
</tr>
<tr>
<td>
<label for="c_style"><?php echo $_SESSION['language']['LOGIN']['GUI_STYLE']; ?></label>:
</td>
<td>
<select id="c_style" name="c_style" size="1" onchange="window.location.href='index.php?c_style='+document.forms[0].c_style.value+'&c_lang='+document.forms[0].c_lang.value;">
<?php foreach ($styles as $styleValue => $styleName): ?>
<option <?php if ($styleValue === $_SESSION['stylefile']) echo ' selected'; ?> value="<?php echo $styleValue; ?>"><?php echo $styleName; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<td>
<label for="c_lang"><?php echo $_SESSION['language']['LOGIN']['GUI_LANGUAGE']; ?></label>:
</td>
<td>
<select id="c_lang" name="c_lang" size="1" onchange="window.location.href='index.php?c_lang='+document.forms[0].c_lang.value+'&c_style='+document.forms[0].c_style.value;">
<?php foreach ($languages as $languageValue => $languageName): ?>
<option <?php if ($languageName === $_SESSION['language']['name']) echo ' selected'; ?> value="<?php echo $languageName; ?>"><?php echo $languageName; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<div align="right">
<input type="submit" value="<?php echo $_SESSION['language']['LOGIN']['OK']; ?>"/>
</div>
</td>
</tr>
</table>
</form>
<div class="authors">
Code by UP · maintained by <a href="https://github.com/red171/" target="_blank">red171</a>
</div>
<div class="authors">
<a href="https://github.com/applejuicenet/phpgui" target="_blank"><?php echo PHP_GUI_VERSION; ?></a>
</div>
</div>
</body>
</html>