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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
<?php require_once "../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
<?php
if (isset($_COOKIE['_NEUTRON_ADMIN_TOKEN']) && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != ".." && $_COOKIE['_NEUTRON_ADMIN_TOKEN'] != "/" && strpos($_COOKIE['_NEUTRON_ADMIN_TOKEN'], "/") === false) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/tokens/" . $_COOKIE['_NEUTRON_ADMIN_TOKEN'])) {
if (isset($_GET['pr'])) {
if (isset($_GET['pa'])) {
$callback = $_GET['pr'] . $_GET['pa'];
} else {
$callback = $_GET['pr'];
}
} else {
$callback = "{$GLOBALS["SYSTEM_ROOT"]}/cms-special/admin-v2";
}
header("Location: " . $callback);
}
}
if (isset($_GET['pr'])) {
if (isset($_GET['pa'])) {
$callback = $_GET['pr'] . $_GET['pa'];
} else {
$callback = $_GET['pr'];
}
} else {
$callback = "{$GLOBALS["SYSTEM_ROOT"]}/cms-special/admin-v2";
}
?>
<?php ob_start();echo("<!--\n\n" . str_replace('%year%', date('Y'), file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/private/license")) . "\n\n-->") ?>
<?php
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) {
$ready = true;
} else {
$ready = false;
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/preprocessor.php";
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/admin.css">
<link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/fonts-import.css">
<link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/ui.css">
<link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/alerts.css">
<link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/codename.css">
<link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/ajax.css">
<link href="<?= $_MD_INCLUDES ?>/material-components-web.min.css" rel="stylesheet">
<script src="<?= $_MD_INCLUDES ?>/material-components-web.min.js"></script>
<link rel="stylesheet" href="<?= $_MDI_PATH ?>">
<?php
echo('<link rel="stylesheet" href="' . $GLOBALS["SYSTEM_ROOT"] . '/cms-special/admin-v2/$resources/index-dark.css">');
?>
<title><?php
if ($ready) {
echo($lang["login"]["login"] . " - " . $lang["login"]["title"] . " - " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename"));
} else {
echo("Neutron");
}
?></title>
<?php
if (!$ready) {
require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<script>location.href = '{$GLOBALS["SYSTEM_ROOT"]}/cms-special/setup';</script></head>");
}
?>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documenthead.php"; ?>
<script>
window.onerror = () => {
location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin-v2/login-old";
}
</script>
</head>
<body id="login">
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documentbody.php"; ?>
<div id="loader" style="backdrop-filter: blur(10px);display:none;z-index:99;">
<svg class="spinner" width="48px" height="48px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
</svg>
</div>
<div id="admin">
<main class="main-content" id="main-content">
<div class="content">
<div class="inner">
<img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/upload/siteicon.png" style="border-radius:100%;" class="intro-element">
<h2><?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename"); ?></h2>
<div id="loginwith">
<button class="mdc-button mdc-button--raised" id="loginwith-password" onclick="disableAuthKey();">
<div class="mdc-button__ripple"></div>
<i class="material-icons-outlined mdc-button__icon" aria-hidden="true">vpn_key</i>
<span class="mdc-button__label"><?= $lang["admin-login"]["modes"][0] ?></span>
</button>
<?php if (file_exists($GLOBALS["ORIGINAL_DOCUMENT_ROOT"] . "/NeutronCloud") && is_file($GLOBALS["ORIGINAL_DOCUMENT_ROOT"] . "/NeutronCloud")): ?>
<button onclick="window.parent.location.href='https://admin.minteck.org/NeutronManage/?_='+location.pathname.split('/')[1];" class="mdc-button mdc-button--outlined" id="loginwith-authkey">
<div class="mdc-button__ripple"></div>
<i class="material-icons-outlined mdc-button__icon" aria-hidden="true">admin_panel_settings</i>
<span class="mdc-button__label">Cloud Admin Console</span>
</button>
<?php else: ?>
<button class="mdc-button mdc-button--outlined" id="loginwith-authkey" <?php if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/authkey")) { echo("disabled"); } else { echo('onclick="enableAuthKey();"'); } ?>>
<div class="mdc-button__ripple"></div>
<i class="material-icons-outlined mdc-button__icon" aria-hidden="true">fingerprint</i>
<span class="mdc-button__label"><?= $lang["admin-login"]["modes"][1] ?></span>
</button>
<?php endif; ?>
</div>
<script>useAuthKey = false;</script>
<div id="login-password">
<div class="nd_Field fallback nd_Field_input" id="searchbox">
<input id="password-box" type="password" placeholder="<?= $lang["admin-login"]["password"] ?>" spellcheck="false" autocomplete="off">
</div>
</div>
<div id="login-authkey" style="display:none;">
<div class="nd_Field fallback nd_Field_input" id="searchbox">
<input id="authkey-box" type="password" placeholder="<?= $lang["admin-login"]["key"] ?>" spellcheck="false" autocomplete="off">
</div>
</div>
<button class="mdc-button mdc-button--raised" id="loginwith-password" onclick="loginConfirm();">
<div class="mdc-button__ripple"></div>
<span class="mdc-button__label"><?= $lang["admin-login"]["confirm"] ?></span>
</button>
<p>
<small id="links">
<a onclick="window.parent.location.href = '<?= $GLOBALS["SYSTEM_ROOT"] ?>/';" class="sblink">
<?= $lang["admin-login"]["back"] ?></a>
<a onclick="window.open('<?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/api/bugs') ?>');" target="_blank" class="sblink">
<?= $lang["admin-login"]["report"] ?></a>
<a onclick="window.open('<?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/api/public') ?>');" class="sblink">
<?= $lang["admin-login"]["branding"] ?></a>
</small>
</p>
</div>
</div>
</main>
</div>
</body>
<script>
function alert(message) {
alert_full(message);
}
function enableAuthKey() {
useAuthKey = true;
document.getElementById('loginwith-authkey').classList.remove('mdc-button--outlined');
document.getElementById('loginwith-authkey').classList.add('mdc-button--raised');
document.getElementById('loginwith-password').classList.remove('mdc-button--raised');
document.getElementById('loginwith-password').classList.add('mdc-button--outlined');
document.getElementById('login-password').style.display = "none";
document.getElementById('login-authkey').style.display = "";
document.getElementById('password-box').value = "";
document.getElementById('authkey-box').value = "";
document.getElementById('authkey-box').focus();
}
function disableAuthKey() {
useAuthKey = false;
document.getElementById('loginwith-authkey').classList.add('mdc-button--outlined');
document.getElementById('loginwith-authkey').classList.remove('mdc-button--raised');
document.getElementById('loginwith-password').classList.add('mdc-button--raised');
document.getElementById('loginwith-password').classList.remove('mdc-button--outlined');
document.getElementById('login-password').style.display = "";
document.getElementById('login-authkey').style.display = "none";
document.getElementById('password-box').value = "";
document.getElementById('authkey-box').value = "";
document.getElementById('password-box').focus();
}
function loginConfirm() {
$("#loader").fadeIn(200);
var formData = new FormData();
if (useAuthKey) {
formData.append("password", document.getElementById('authkey-box').value);
formData.append("authkey", "1");
} else {
formData.append("password", document.getElementById('password-box').value);
}
$.ajax({
type: "POST",
dataType: 'html',
url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/login.php",
success: function (data) {
$("#loader").fadeOut(200);
if (data == "ok") {
location.href = "<?= $callback ?>";
} else {
alert(data)
}
},
error: function (error) {
$("#loader").fadeOut(200);
alert("<?= $lang["admin-errors"]["connerror"] ?>")
},
data: formData,
cache: false,
contentType: false,
processData: false
});
}
</script>
</html>
|