Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
# $Id: index.php 2293 2017-06-20 15:31:12Z tom.houdayer $
|
2 |
# $Id: index.php 2370 2017-08-09 23:20:58Z tom.houdayer $
|
3 |
#
|
3 |
#
|
4 |
# index.php for ALCASAR by Rexy
|
4 |
# index.php for ALCASAR by Rexy
|
5 |
# UI & css style by stephane ERARD
|
5 |
# UI & css style by stephane ERARD
|
6 |
# The contents of this file may be used under the terms of the GNU
|
6 |
# The contents of this file may be used under the terms of the GNU
|
7 |
# General Public License Version 2, provided that the above copyright
|
7 |
# General Public License Version 2, provided that the above copyright
|
Line 36... |
Line 36... |
36 |
}
|
36 |
}
|
37 |
while (!feof($file_conf)) {
|
37 |
while (!feof($file_conf)) {
|
38 |
$buffer = fgets($file_conf, 4096);
|
38 |
$buffer = fgets($file_conf, 4096);
|
39 |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
|
39 |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
|
40 |
$tmp = explode('=', $buffer);
|
40 |
$tmp = explode('=', $buffer);
|
41 |
$conf[$tmp[0]] = trim($tmp[1]);
|
41 |
$conf[trim($tmp[0])] = trim($tmp[1]);
|
42 |
}
|
42 |
}
|
43 |
}
|
43 |
}
|
44 |
fclose($file_conf);
|
44 |
fclose($file_conf);
|
45 |
|
45 |
|
46 |
$organisme = $conf["ORGANISM"];
|
46 |
$organisme = $conf["ORGANISM"];
|
47 |
$hostname = $conf["HOSTNAME"].'.'.$conf["DOMAIN"];
|
47 |
$hostname = $conf["HOSTNAME"].'.'.$conf["DOMAIN"];
|
- |
|
48 |
$useHTTPS = ((isset($_SERVER['HTTPS'])) && (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] !== 'off'));
|
48 |
$network_pb = false; // "alcasar-watchdog.sh" changes this value if a network issue is detected
|
49 |
$network_pb = false; // "alcasar-watchdog.sh" changes this value if a network issue is detected
|
49 |
$diagnostic = "can't contact the default router"; // "alcasar-watchdog.sh" changes this value if a network issue is detected
|
50 |
$diagnostic = "can't contact the default router"; // "alcasar-watchdog.sh" changes this value if a network issue is detected
|
50 |
$certCa_link = "http://$hostname/certs/certificat_alcasar_ca.crt";
|
51 |
$certCa_link = (($useHTTPS) ? 'https' : 'http')."://$hostname/certs/certificat_alcasar_ca.crt";
|
- |
|
52 |
$logout_link = (($useHTTPS) ? 'https' : 'http').'://'.$hostname.':'.(($useHTTPS) ? 3991 : 3990).'/logoff';
|
51 |
$direct_access = false;
|
53 |
$direct_access = false;
|
52 |
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
|
54 |
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
|
53 |
$connection_history = '';
|
55 |
$connection_history = '';
|
54 |
$nb_connection_history = 3;
|
56 |
$nb_connection_history = 3;
|
55 |
|
57 |
|
Line 159... |
Line 161... |
159 |
if (!$user->connected) {
|
161 |
if (!$user->connected) {
|
160 |
$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre système.";
|
162 |
$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre système.";
|
161 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Ouvrir une session Internet</a>";
|
163 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Ouvrir une session Internet</a>";
|
162 |
} else {
|
164 |
} else {
|
163 |
if ($user->username != $user->mac) { // authentication exception or not
|
165 |
if ($user->username != $user->mac) { // authentication exception or not
|
164 |
$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
|
166 |
$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"$logout_link\" title=\"Deconnecter l'utilisateur $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
|
165 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>";
|
167 |
$l_logout = "<a href=\"$logout_link\">Se déconnecter d'internet</a>";
|
166 |
} else {
|
168 |
} else {
|
167 |
$l_logout_explain = "Votre système ($user->username) est en exception d'authentication.<br><br>$nb_connection_history dernières connexions :$connection_history";
|
169 |
$l_logout_explain = "Votre système ($user->username) est en exception d'authentication.<br><br>$nb_connection_history dernières connexions :$connection_history";
|
168 |
$l_logout = "Information des connexions";
|
170 |
$l_logout = "Information des connexions";
|
169 |
}
|
171 |
}
|
170 |
}
|
172 |
}
|
Line 206... |
Line 208... |
206 |
if (!$user->connected) {
|
208 |
if (!$user->connected) {
|
207 |
$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
|
209 |
$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
|
208 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
|
210 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
|
209 |
} else {
|
211 |
} else {
|
210 |
if ($user->username != $user->mac) { // authentication exception or not
|
212 |
if ($user->username != $user->mac) { // authentication exception or not
|
211 |
$l_logout_explain = "Se desejar, feche a conexão do usuário atual conectado.<br> Usuário conectado : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history logins últimos :$connection_history";
|
213 |
$l_logout_explain = "Se desejar, feche a conexão do usuário atual conectado.<br> Usuário conectado : <a href=\"$logout_link\" title=\"Disconnect user $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history logins últimos :$connection_history";
|
212 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
|
214 |
$l_logout = "<a href=\"$logout_link\">Sair da Internet</a>";
|
213 |
} else {
|
215 |
} else {
|
214 |
$l_logout_explain = "O sistema ($user->username) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
|
216 |
$l_logout_explain = "O sistema ($user->username) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
|
215 |
$l_logout = "Informações de conexões";
|
217 |
$l_logout = "Informações de conexões";
|
216 |
}
|
218 |
}
|
217 |
}
|
219 |
}
|
Line 253... |
Line 255... |
253 |
if (!$user->connected) {
|
255 |
if (!$user->connected) {
|
254 |
$l_logout_explain = "您的系统目前没有打开任何网络咨询进程。";
|
256 |
$l_logout_explain = "您的系统目前没有打开任何网络咨询进程。";
|
255 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">打开一个网络进程</a>";
|
257 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">打开一个网络进程</a>";
|
256 |
} else {
|
258 |
} else {
|
257 |
if ($user->username != $user->mac) { // authentication exception or not
|
259 |
if ($user->username != $user->mac) { // authentication exception or not
|
258 |
$l_logout_explain = "关闭当前连接进程。<br> 已连接用户:<a href=\"http://$hostname:3990/logoff\" title=\" $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history 最后连接 :$connection_history";
|
260 |
$l_logout_explain = "关闭当前连接进程。<br> 已连接用户:<a href=\"$logout_link\" title=\" $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history 最后连接 :$connection_history";
|
259 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">断开网络</a>";
|
261 |
$l_logout = "<a href=\"$logout_link\">断开网络</a>";
|
260 |
} else {
|
262 |
} else {
|
261 |
$l_logout_explain = "您的系统($user->username)验证例外<br><br>$nb_connection_history 最后连接: $connection_history";
|
263 |
$l_logout_explain = "您的系统($user->username)验证例外<br><br>$nb_connection_history 最后连接: $connection_history";
|
262 |
$l_logout = "连接信息";
|
264 |
$l_logout = "连接信息";
|
263 |
}
|
265 |
}
|
264 |
}
|
266 |
}
|
Line 307... |
Line 309... |
307 |
} else {
|
309 |
} else {
|
308 |
if ($user->username != $user->mac) { // authentication exception or not
|
310 |
if ($user->username != $user->mac) { // authentication exception or not
|
309 |
$close_session_text = "إقفال جلسة المستخدم المتصل حاليا";
|
311 |
$close_session_text = "إقفال جلسة المستخدم المتصل حاليا";
|
310 |
$userlogged_text = "المستخدم متصل";
|
312 |
$userlogged_text = "المستخدم متصل";
|
311 |
$disconnect_user_text = "قطع الاتصال على المستخدم";
|
313 |
$disconnect_user_text = "قطع الاتصال على المستخدم";
|
312 |
$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
|
314 |
$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"$logout_link\" title=\"Deconnecter l'utilisateur $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
|
313 |
$logout_internet_text = "قطع الاتصال على الإنترنت";
|
315 |
$logout_internet_text = "قطع الاتصال على الإنترنت";
|
314 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">$logout_internet_text</a>";
|
316 |
$l_logout = "<a href=\"$logout_link\">$logout_internet_text</a>";
|
315 |
} else {
|
317 |
} else {
|
316 |
$your_system_text = "نظامك";
|
318 |
$your_system_text = "نظامك";
|
317 |
$auth_except_text = "على توثيق استثنائي";
|
319 |
$auth_except_text = "على توثيق استثنائي";
|
318 |
$last_conn_text = "اتصالات مشاركة";
|
320 |
$last_conn_text = "اتصالات مشاركة";
|
319 |
$l_logout_explain = "$connection_history :$last_conn_text $nb_connection_history<br><br>$auth_except_text ($user->username) $your_system_text";
|
321 |
$l_logout_explain = "$connection_history :$last_conn_text $nb_connection_history<br><br>$auth_except_text ($user->username) $your_system_text";
|
Line 368... |
Line 370... |
368 |
if (!$user->connected) {
|
370 |
if (!$user->connected) {
|
369 |
$l_logout_explain = "No Internet consultation session is actualy open on your system";
|
371 |
$l_logout_explain = "No Internet consultation session is actualy open on your system";
|
370 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Open an Internet session</a>";
|
372 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Open an Internet session</a>";
|
371 |
} else {
|
373 |
} else {
|
372 |
if ($user->username != $user->mac) { // authentication exception or not
|
374 |
if ($user->username != $user->mac) { // authentication exception or not
|
373 |
$l_logout_explain = "Close the session of the user currently connected.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
375 |
$l_logout_explain = "Close the session of the user currently connected.<br> User logged-on : <a href=\"$logout_link\" title=\"Disconnect user $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
374 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
|
376 |
$l_logout = "<a href=\"$logout_link\">Logoff from internet</a>";
|
375 |
} else {
|
377 |
} else {
|
376 |
$l_logout_explain = "Your system ($user->username) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
|
378 |
$l_logout_explain = "Your system ($user->username) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
|
377 |
$l_logout = "Connections information";
|
379 |
$l_logout = "Connections information";
|
378 |
}
|
380 |
}
|
379 |
}
|
381 |
}
|