Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
# $Id: index.php 2609 2018-08-22 07:55:28Z rexy $
|
2 |
# $Id: index.php 2612 2018-08-22 16:37:28Z 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 43... |
Line 43... |
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 |
$ssl_enable = $conf["HTTPS_LOGIN"];
|
48 |
$ssl_enable = ($conf['HTTPS_LOGIN'] === 'on');
|
49 |
$useHTTPS = ((isset($_SERVER['HTTPS'])) && (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] !== 'off'));
|
49 |
$useHTTPS = ((isset($_SERVER['HTTPS'])) && (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] !== 'off'));
|
50 |
$network_pb = false; // "alcasar-watchdog.sh" changes this value if a network issue is detected
|
50 |
$network_pb = false; // "alcasar-watchdog.sh" changes this value if a network issue is detected
|
51 |
$diagnostic = "can't contact the default router"; // "alcasar-watchdog.sh" changes this value if a network issue is detected
|
51 |
$diagnostic = "can't contact the default router"; // "alcasar-watchdog.sh" changes this value if a network issue is detected
|
52 |
$certCa_link = (($useHTTPS) ? 'https' : 'http')."://$hostname/certs/certificat_alcasar_ca.crt";
|
52 |
$certCa_link = (($useHTTPS) ? 'https' : 'http')."://$hostname/certs/certificat_alcasar_ca.crt";
|
53 |
$logout_link = ((($conf['HTTPS_CHILLI'] === 'on') && $useHTTPS) ? 'https://'.$hostname.':3991' : 'http://'.$hostname.':3990').'/logoff';
|
53 |
$logout_link = ((($conf['HTTPS_CHILLI'] === 'on') && $useHTTPS) ? 'https://'.$hostname.':3991' : 'http://'.$hostname.':3990').'/logoff';
|
Line 61... |
Line 61... |
61 |
// Check if the SMS service is enable
|
61 |
// Check if the SMS service is enable
|
62 |
$service_SMS_status = ($conf['SMS'] === 'on');
|
62 |
$service_SMS_status = ($conf['SMS'] === 'on');
|
63 |
|
63 |
|
64 |
// Retrieve the user info behind the remote ip
|
64 |
// Retrieve the user info behind the remote ip
|
65 |
$output = [];
|
65 |
$output = [];
|
66 |
exec('sudo /usr/sbin/chilli_query list | grep -Ew '.escapeshellarg($remote_ip), $output);
|
66 |
exec('sudo /usr/sbin/chilli_query list ip '.escapeshellarg($remote_ip), $output);
|
67 |
if (!empty($output)) {
|
67 |
if (!empty($output)) {
|
68 |
$userRaw = explode(' ', $output[0]);
|
68 |
$userRaw = explode(' ', $output[0]);
|
69 |
$user = (object) [
|
69 |
$user = (object) [
|
70 |
'mac' => $userRaw[0],
|
70 |
'mac' => $userRaw[0],
|
71 |
'connected' => ($userRaw[4] === '1'),
|
71 |
'connected' => ($userRaw[4] === '1'),
|
72 |
'username' => $userRaw[5]
|
72 |
'username' => $userRaw[5]
|
73 |
];
|
73 |
];
|
74 |
} else {
|
74 |
} else {
|
75 |
// CoovaChilli does not know the user
|
75 |
// CoovaChilli does not know the user
|
76 |
// TODO: useless?
|
- |
|
77 |
$user = (object) [
|
76 |
$user = (object) [
|
78 |
'mac' => '',
|
77 |
'mac' => '',
|
79 |
'connected' => false,
|
78 |
'connected' => false,
|
80 |
'username' => ''
|
79 |
'username' => ''
|
81 |
];
|
80 |
];
|
Line 523... |
Line 522... |
523 |
<?= $filteredUrlHtml ?>
|
522 |
<?= $filteredUrlHtml ?>
|
524 |
<?php endif; ?>
|
523 |
<?php endif; ?>
|
525 |
</div>
|
524 |
</div>
|
526 |
|
525 |
|
527 |
<?php if ($direct_access): ?>
|
526 |
<?php if ($direct_access): ?>
|
528 |
<?php if (!$network_pb): ?>
|
- |
|
529 |
<div class="box_menu" id="box_conn" onmouseover="setBoxInfoContent('text_conn');">
|
527 |
<div class="box_menu<?= (!$network_pb) ? '' : ' box-menu-disabled' ?>" id="box_conn" <?= (!$network_pb) ? 'onmouseover="setBoxInfoContent(\'text_conn\');"' : 'title=\'Not available\'' ?>>
|
530 |
<span><?= $l_logout ?></span>
|
528 |
<span><?= $l_logout ?></span>
|
531 |
<img src="<?= $img_rep.$img_internet ?>">
|
529 |
<img src="<?= $img_rep.$img_internet ?>">
|
532 |
</div>
|
530 |
</div>
|
- |
|
531 |
|
- |
|
532 |
<div class="box_menu<?= ($ssl_enable) ? '' : ' box-menu-disabled' ?>" id="box_certif" <?= ($ssl_enable) ? 'onmouseover="setBoxInfoContent(\'text_certif\');"' : 'title=\'Not available\'' ?>>
|
- |
|
533 |
<span><a href="<?= $certCa_link ?>"><?= $l_install_certif ?></a></span>
|
- |
|
534 |
<img src="<?= $img_rep.$img_certificate ?>">
|
533 |
<?php endif; ?>
|
535 |
</div>
|
534 |
|
536 |
|
535 |
<?php if ($ssl_enable == "on"): ?>
|
- |
|
536 |
<div class="box_menu" id="box_certif" onmouseover="setBoxInfoContent('text_certif');">
|
- |
|
537 |
<span><a href="<?= $certCa_link ?>"><?= $l_install_certif ?></a></span>
|
- |
|
538 |
<img src="<?= $img_rep.$img_certificate ?>">
|
- |
|
539 |
</div>
|
- |
|
540 |
<?php endif; ?>
|
- |
|
541 |
<div class="box_menu" id="box_mdp" onmouseover="setBoxInfoContent('text_mdp');">
|
537 |
<div class="box_menu" id="box_mdp" onmouseover="setBoxInfoContent('text_mdp');">
|
542 |
<img src="<?= $img_rep.$img_pwd ?>">
|
538 |
<img src="<?= $img_rep.$img_pwd ?>">
|
543 |
<span><?= $l_password_change ?></span>
|
539 |
<span><?= $l_password_change ?></span>
|
544 |
</div>
|
540 |
</div>
|
545 |
|
541 |
|