Subversion Repositories ALCASAR

Rev

Rev 2234 | Rev 2252 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2234 Rev 2250
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: index.php 2234 2017-05-18 21:20:10Z richard $
2
# $Id: index.php 2250 2017-05-22 22:00:03Z 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
8
# notice and this permission notice is included in all copies or
8
# notice and this permission notice is included in all copies or
9
# substantial portions of the software.
9
# substantial portions of the software.
-
 
10
 
10
/****************************************************************
11
/****************************************************************
11
*			GLOBAL FILE PATHS			*
12
*			GLOBAL FILE PATHS			*
12
*****************************************************************/
13
*****************************************************************/
13
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
14
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
14
define ("DOMAIN_ALLOWED_LIST", "/usr/local/etc/alcasar-uamdomain");
15
define('DOMAIN_ALLOWED_LIST', '/usr/local/etc/alcasar-uamdomain');
15
 
16
 
16
/****************************************************************
17
/****************************************************************
17
*			FILE reading test			*
18
*			FILE reading test			*
18
*****************************************************************/
19
*****************************************************************/
19
$conf_files = array(CONF_FILE);
20
$conf_files = array(CONF_FILE, DOMAIN_ALLOWED_LIST);
20
foreach ($conf_files as $file) {
21
foreach ($conf_files as $file) {
21
	if (!file_exists($file)) {
22
	if (!file_exists($file)) {
22
		exit("File ".$file." unknown");
23
		exit("Fichier $file non présent");
23
	}
24
	}
24
	if (!is_readable($file)) {
25
	if (!is_readable($file)) {
25
		exit("You don't have read rights on the file ".$file);
26
		exit("Vous n'avez pas les droits de lecture sur le fichier $file");
26
	}
27
	}
27
}
28
}
-
 
29
 
28
/****************************************************************
30
/****************************************************************
29
*			Read CONF_FILE				*
31
*			Read CONF_FILE				*
30
*****************************************************************/
32
*****************************************************************/
31
$file_conf = fopen(CONF_FILE, 'r');
33
$file_conf = fopen(CONF_FILE, 'r');
32
if (!$file_conf) {
34
if (!$file_conf) {
33
	exit('Error opening the file '.CONF_FILE);
35
	exit('Error opening the file '.CONF_FILE);
34
}
36
}
35
while (!feof($file_conf)) {
37
while (!feof($file_conf)) {
36
	$buffer = fgets($file_conf, 4096);
38
	$buffer = fgets($file_conf, 4096);
37
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
39
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '//')) {
38
		$tmp = explode('=', $buffer);
40
		$tmp = explode('=', $buffer);
39
		$conf[$tmp[0]] = trim($tmp[1]);
41
		$conf[$tmp[0]] = trim($tmp[1]);
40
	}
42
	}
41
}
43
}
42
fclose($file_conf);
44
fclose($file_conf);
43
 
45
 
44
$organisme = $conf["ORGANISM"];
46
$organisme = $conf["ORGANISM"];
45
$hostname  = $conf["HOSTNAME"].'.'.$conf["DOMAIN"];
47
$hostname  = $conf["HOSTNAME"].'.'.$conf["DOMAIN"];
46
$network_pb = False; # "alcasar-watchdog.sh" changes this value if a network issue is detected
48
$network_pb = false; // "alcasar-watchdog.sh" changes this value if a network issue is detected
47
$diagnostic = "can't contact the default router"; # "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
48
$cert_add = "http://$hostname/certs";
50
$cert_add = "http://$hostname/certs";
49
$direct_access = False;
51
$direct_access = false;
50
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "";
52
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
51
$tab = array();$user = array();
-
 
52
$connection_history =  "";
53
$connection_history = '';
53
$nb_connection_history = 3;
54
$nb_connection_history = 3;
54
$Language = 'en';
-
 
55
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
-
 
56
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
-
 
57
	$Language = strtolower(substr(chop($Langue[0]),0,2));
-
 
58
}
-
 
59
$redirect_link = "www.euronews.com"; # Default redirection for HTTPS interception (beware, this website must run in HTTP)
-
 
60
 
55
 
61
# Retrieve the user info behind the remote ip
56
$redirect_link = 'www.euronews.com'; // Default redirection for HTTPS interception (beware, this website must run in HTTP)
-
 
57
 
62
exec ("sudo /usr/sbin/chilli_query list | grep -Ew $remote_ip" , $tab);
58
// Check if the SMS service is enable
63
$user = explode (" ", $tab[0]);
59
$service_SMS_status = false;
64
 
60
 
-
 
61
// Retrieve the user info behind the remote ip
-
 
62
$output = [];
-
 
63
exec('sudo /usr/sbin/chilli_query list | grep -Ew '.escapeshellarg($remote_ip), $output);
-
 
64
if (!empty($output)) {
-
 
65
	$userRaw = explode(' ', $output[0]);
-
 
66
	$user = (object) [
-
 
67
		'mac'       =>  $userRaw[0],
-
 
68
		'connected' => ($userRaw[4] === '1'),
-
 
69
		'username'  =>  $userRaw[5]
-
 
70
	];
-
 
71
} else {
-
 
72
	// CoovaChilli does not know the user
-
 
73
	// TODO: useless?
-
 
74
	$user = (object) [
-
 
75
		'mac'       => '',
-
 
76
		'connected' => false,
-
 
77
		'username'  => ''
-
 
78
	];
-
 
79
}
-
 
80
 
65
# Test if it's a direct connexion to ALCASAR
81
// Test if it's a direct connexion to ALCASAR
66
if (isset($_SERVER['HTTP_HOST']) && (($_SERVER['HTTP_HOST'] === $_SERVER['SERVER_ADDR']) || ($_SERVER['HTTP_HOST'] === 'alcasar') || ($_SERVER['HTTP_HOST'] === $hostname) || ($_SERVER['HTTP_HOST'] === $organisme))) {
82
if (isset($_SERVER['HTTP_HOST']) && (($_SERVER['HTTP_HOST'] === $_SERVER['SERVER_ADDR']) || ($_SERVER['HTTP_HOST'] === 'alcasar') || ($_SERVER['HTTP_HOST'] === $hostname) || ($_SERVER['HTTP_HOST'] === $organisme))) {
67
	$direct_access = true;
83
	$direct_access = true;
68
}
84
}
69
 
85
 
70
# Function to adapt time connexion in seconds to H,M,S
86
// Function to adapt time connexion in seconds to H,M,S
71
function secondsToDuration($seconds = null){
87
function secondsToDuration($seconds = null){
72
	if ($seconds == null) return "";
88
	if ($seconds == null) return "";
73
	$temp = $seconds % 3600;
89
	$temp = $seconds % 3600;
74
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
90
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
75
	$time[2] = $temp % 60 ;				// seconds
91
	$time[2] = $temp % 60 ;				// seconds
76
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
92
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
77
	return $time[0]." h ".$time[1]." m ".$time[2]." s";
93
	return $time[0].' h '.$time[1].' m '.$time[2].' s';
78
}
94
}
79
 
95
 
80
# if user need to be warned
96
// if user need to be warned
81
if (isset($_GET['warn']) && isset($_GET['url'])) {
97
if (isset($_GET['warn']) && isset($_GET['url'])) {
82
	$direct_access = false;
98
	$direct_access = false;
83
}
99
}
84
 
100
 
85
if ((isset($user[4])) && ($user[4] != "0")) { # the user is authenticated
101
if ($user->connected) { // the user is authenticated
86
	if (isset($_GET['redirect'])) { # if user has been warned, we redirect him to his website
102
	if (isset($_GET['redirect'])) { // if user has been warned, we redirect him to his website
87
		header('Location: '.$_GET['url'], true, 307);
103
		header('Location: '.$_GET['url'], true, 307);
88
		exit();
104
		exit();
89
	}
105
	}
90
 
106
 
91
	# we retrieve his three last connections
107
	// We retrieve his three last connections
92
	if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
108
	if ((is_file('./acc/manager/lib/sql/drivers/mysql/functions.php'))&&(is_file('/etc/freeradius-web/config.php'))){
93
		include_once("/etc/freeradius-web/config.php");
109
		include_once('/etc/freeradius-web/config.php');
94
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
110
		include_once('./acc/manager/lib/sql/drivers/mysql/functions.php');
95
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
111
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user->username' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
96
		$link = @da_sql_pconnect($config);
112
		$link = @da_sql_pconnect($config);
97
		if ($link){
113
		if ($link) {
98
			$res = @da_sql_query($link,$config,$sql);
114
			$res = @da_sql_query($link,$config,$sql);
99
			if ($res){
115
			if ($res) {
100
				$connection_history.= "<ul>";
116
				$connection_history .= '<ul>';
101
				while(($row = @da_sql_fetch_array($res,$config))){
117
				while (($row = @da_sql_fetch_array($res,$config))) {
102
					$connected = "";
118
					$connected = '';
103
					if ($row['acctstoptime'] == "") $connected = " (active)";
119
					if ($row['acctstoptime'] === '') {
-
 
120
						$connected = ' (active)';
-
 
121
					}
-
 
122
					$sessionTimeFormated = secondsToDuration($row['acctsessiontime']);
104
					$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row['acctsessiontime']).")'>$row[acctstarttime] (".secondsToDuration($row['acctsessiontime']).") $connected</li>";
123
					$connection_history .= "<li title=\"$row[username] $row[acctstarttime] $row[acctstoptime] ($sessionTimeFormated)\">$row[acctstarttime] ($sessionTimeFormated) $connected</li>";
105
				}
124
				}
106
				$connection_history.="</ul>";
125
				$connection_history .= '</ul>';
107
			}
126
			}
108
		}
127
		}
109
	}
128
	}
110
}
-
 
111
else { # the user isn't authenticated
129
} else { // the user isn't authenticated
112
	if (isset($_GET['url'])) { # it's the second stage (when user has clicked on the button "open a connection")
130
	if (isset($_GET['url'])) { // it's the second stage (when user has clicked on the button "open a connection")
113
		$redir = 'http://'.$_GET['url'];
131
		$redir = 'http://'.$_GET['url'];
114
		header("Location: $redir", true, 307);
132
		header("Location: $redir", true, 307);
115
		exit(); 
133
		exit(); 
116
	}
134
	}
117
}
135
}
-
 
136
 
118
# Choice of language
137
// Choice of language
119
if($Language == 'fr'){
138
$Language = 'en';
-
 
139
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
-
 
140
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
-
 
141
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
-
 
142
}
-
 
143
if ($Language === 'fr') {		// French
120
	$l_access_denied = "Contrôle d'accès";
144
	$l_access_denied = "Contrôle d'accès";
121
	$l_access_welcome = "Bienvenue sur ALCASAR";
145
	$l_access_welcome = "Bienvenue sur ALCASAR";
122
	$l_access_unavailable = "ACCÈS INDISPONIBLE";
146
	$l_access_unavailable = "ACCÈS INDISPONIBLE";
123
	$l_required_domain = "Site WEB demandé";
147
	$l_required_domain = "Site WEB demandé";
124
	$l_explain_acc_access = "Le centre de gestion permet d'administrer le portail. Vous devez posséder un compte d'administration ou de gestion pour y accéder.";
148
	$l_explain_acc_access = "Le centre de gestion permet d'administrer le portail. Vous devez posséder un compte d'administration ou de gestion pour y accéder.";
Line 130... Line 154...
130
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installer le certificat racine</a>";
154
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installer le certificat racine</a>";
131
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installation du certificat de l'autorité; racine d'ALCASAR</a>";
155
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installation du certificat de l'autorité; racine d'ALCASAR</a>";
132
	$l_certif_explain = "Permet l'échange de données sécurisées entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistré sur votre station de consultation, il est possible que des alertes de sécurité soient émises par votre navigateur.<br><br>";
156
	$l_certif_explain = "Permet l'échange de données sécurisées entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistré sur votre station de consultation, il est possible que des alertes de sécurité soient émises par votre navigateur.<br><br>";
133
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
157
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
134
	$l_category = "catégorie :";
158
	$l_category = "catégorie :";
135
	if ((isset ($user[4])) && ($user[4] == "0")){
159
	if (!$user->connected) {
136
		$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre système.";
160
		$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre système.";
137
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Ouvrir une session Internet</a>";
161
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Ouvrir une session Internet</a>";
138
	}
-
 
139
	else{
162
	} else {
140
		if ($user[5] != $user[0]){ # authentication exception or not
163
		if ($user->username != $user->mac) { // authentication exception or not
141
			$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[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
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";
142
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>";
165
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>";
143
		}
-
 
144
		else{
166
		} else {
145
			$l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history dernières connexions :$connection_history";
167
			$l_logout_explain = "Votre système ($user->username) est en exception d'authentication.<br><br>$nb_connection_history dernières connexions :$connection_history";
146
			$l_logout = "Information des connexions";
168
			$l_logout = "Information des connexions";
147
		}
169
		}
148
	}
170
	}
149
	$l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
171
	$l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
150
	$l_password_change_explain = "Vous redirige sur la page de changement du mot de passe de votre compte d'accès à Internet.<br><br>Vous devez avoir un compte internet valide.";
172
	$l_password_change_explain = "Vous redirige sur la page de changement du mot de passe de votre compte d'accès à Internet.<br><br>Vous devez avoir un compte internet valide.";
Line 152... Line 174...
152
	$l_back_page = "<a href=\"javascript:history.back()\">Page précédente</a>";
174
	$l_back_page = "<a href=\"javascript:history.back()\">Page précédente</a>";
153
	$l_service_sms = "Service SMS actif";
175
	$l_service_sms = "Service SMS actif";
154
	$l_service_sms_n = "Service SMS non actif";
176
	$l_service_sms_n = "Service SMS non actif";
155
	$l_acc_sms = "Auto enregistrement par SMS";
177
	$l_acc_sms = "Auto enregistrement par SMS";
156
	$l_explain_warn = "L'administrateur a créé une archive contenant vos journaux de connexion dans le cadre d'une affaire judiciaire.";
178
	$l_explain_warn = "L'administrateur a créé une archive contenant vos journaux de connexion dans le cadre d'une affaire judiciaire.";
157
	if(isset($_GET['url'])){
179
	if (isset($_GET['url'])) {
158
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">Je comprends et je souhaite continuer ma navigation.</a>";
180
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">Je comprends et je souhaite continuer ma navigation.</a>";
159
	}
-
 
160
	else{
181
	} else {
161
		$l_continue_link = "<a href=\"index.php\" class=\"button\">Je comprends et je souhaite continuer ma navigation.</a>";
182
		$l_continue_link = "<a href=\"index.php\" class=\"button\">Je comprends et je souhaite continuer ma navigation.</a>";
162
	}
183
	}
163
	$l_title_warn="Cher utilisateur, ";
184
	$l_title_warn="Cher utilisateur, ";
164
	$l_explain_warn_name="Une personne sous le nom de ";
185
	$l_explain_warn_name="Une personne sous le nom de ";
165
	$l_explain_warn_ip="sous cette IP : ";
186
	$l_explain_warn_ip="sous cette IP : ";
166
	$l_explain_warn_date="a consulté vos journaux de connexion le ";
187
	$l_explain_warn_date="a consulté vos journaux de connexion le ";
167
	$l_explain_warn_reason="Raison invoquée : ";
188
	$l_explain_warn_reason="Raison invoquée : ";
168
	$l_uam_domain = "Sites autorisés : ";
189
	$l_uam_domain = "Sites autorisés : ";
169
}
-
 
170
else if($Language == 'pt'){
190
} else if ($Language === 'pt') {	// Portuguese
171
	$l_access_denied = "Controle de acesso";
191
	$l_access_denied = "Controle de acesso";
172
	$l_access_welcome = "Bem-vindo ao Alcasar";
192
	$l_access_welcome = "Bem-vindo ao Alcasar";
173
	$l_access_unavailable = "ACESSO INDISPONÍVEL";
193
	$l_access_unavailable = "ACESSO INDISPONÍVEL";
174
	$l_required_domain = "Site WEB Obrigatório";
194
	$l_required_domain = "Site WEB Obrigatório";
175
	$l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
195
	$l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
Line 181... Line 201...
181
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
201
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
182
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
202
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
183
	$l_certif_explain = "O certificado Permiti a troca de dados seguro entre seu computador e o portal Alcasar.<BR>Se este certificado não estiver incorporado no seu computador, alguns alertas de segurança deverá aparecer no navegador.<br><br>";
203
	$l_certif_explain = "O certificado Permiti a troca de dados seguro entre seu computador e o portal Alcasar.<BR>Se este certificado não estiver incorporado no seu computador, alguns alertas de segurança deverá aparecer no navegador.<br><br>";
184
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
204
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
185
	$l_category = "categoria :";
205
	$l_category = "categoria :";
186
	if ((isset ($user[4])) && ($user[4] == "0")){
206
	if (!$user->connected) {
187
		$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
207
		$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
188
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
208
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
189
	}
-
 
190
	else{
209
	} else {
191
		if ($user[5] != $user[0]){ # authentication exception or not
210
		if ($user->username != $user->mac) { // authentication exception or not
192
			$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[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history logins últimos :$connection_history";
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";
193
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
212
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
194
		}
-
 
195
		else{
213
		} else {
196
			$l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
214
			$l_logout_explain = "O sistema ($user->username) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
197
			$l_logout = "Informações de conexões";
215
			$l_logout = "Informações de conexões";
198
		}
216
		}
199
	}
217
	}
200
	$l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
218
	$l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
201
	$l_password_change_explain = "Você será redirecionado à página de alteração de senha.<br><br> e deverá ter uma conta de usuário valido para efetuar a troca e acessar à Internet.";
219
	$l_password_change_explain = "Você será redirecionado à página de alteração de senha.<br><br> e deverá ter uma conta de usuário valido para efetuar a troca e acessar à Internet.";
Line 203... Line 221...
203
	$l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
221
	$l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
204
	$l_service_sms = "SMS service enable";
222
	$l_service_sms = "SMS service enable";
205
	$l_service_sms_n = "SMS service disable";
223
	$l_service_sms_n = "SMS service disable";
206
	$l_acc_sms = "Auto registration by SMS";
224
	$l_acc_sms = "Auto registration by SMS";
207
	$l_explain_warn = "El administrador ha creado un archivo que contiene los periódicos de inicio de sesión como parte de un proceso judicial."; 
225
	$l_explain_warn = "El administrador ha creado un archivo que contiene los periódicos de inicio de sesión como parte de un proceso judicial."; 
208
	if(isset($_GET['url'])){
226
	if (isset($_GET['url'])) {
209
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">Lo comprendo y deseo continuar mi navegación.</a>";
227
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">Lo comprendo y deseo continuar mi navegación.</a>";
210
	}
-
 
211
	else{
228
	} else {
212
		$l_continue_link = "<a href=\"index.php\" class=\"button\">Lo comprendo y deseo continuar mi navegación.</a>";
229
		$l_continue_link = "<a href=\"index.php\" class=\"button\">Lo comprendo y deseo continuar mi navegación.</a>";
213
	}
230
	}
214
	$l_title_warn="Estimado usuario,";
231
	$l_title_warn="Estimado usuario,";
215
	$l_explain_warn_name="El usario ";
232
	$l_explain_warn_name="El usario ";
216
	$l_explain_warn_ip="con este IP : ";
233
	$l_explain_warn_ip="con este IP : ";
217
	$l_explain_warn_date="consultó a sus registros de conexión el ";
234
	$l_explain_warn_date="consultó a sus registros de conexión el ";
218
	$l_explain_warn_reason="con la siguiente razón : ";
235
	$l_explain_warn_reason="con la siguiente razón : ";
219
	$l_uam_domain = "Sites autorizados : ";
236
	$l_uam_domain = "Sites autorizados : ";
220
}
-
 
221
else if($Language == 'zn'){
237
} else if ($Language === 'zn') {	// Chinese
222
	$l_access_denied = "访问控制";
238
	$l_access_denied = "访问控制";
223
	$l_access_welcome = "欢迎来到ALCASAR";
239
	$l_access_welcome = "欢迎来到ALCASAR";
224
	$l_access_unavailable = "不可访问";
240
	$l_access_unavailable = "不可访问";
225
	$l_required_domain = "访问的网站";
241
	$l_required_domain = "访问的网站";
226
	$l_explain_acc_access = "管理中心能管理门户,您必须通过超级用户或者管理用户来访问。";
242
	$l_explain_acc_access = "管理中心能管理门户,您必须通过超级用户或者管理用户来访问。";
Line 232... Line 248...
232
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">安装根证书 </a>";
248
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">安装根证书 </a>";
233
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">安装根证书 </a>";
249
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">安装根证书 </a>";
234
	$l_certif_explain = "允许您的计算机与ALCASAR门户进行安全数据交换。<BR>如果该证书未包含在您的计算机中,您的浏览器将出现一些安全提醒。<br><br>";
250
	$l_certif_explain = "允许您的计算机与ALCASAR门户进行安全数据交换。<BR>如果该证书未包含在您的计算机中,您的浏览器将出现一些安全提醒。<br><br>";
235
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">额外帮助</a>";
251
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">额外帮助</a>";
236
	$l_category = "类别 :";
252
	$l_category = "类别 :";
237
	if ((isset ($user[4])) && ($user[4] == "0")){
253
	if (!$user->connected) {
238
		$l_logout_explain = "您的系统目前没有打开任何网络咨询进程。";
254
		$l_logout_explain = "您的系统目前没有打开任何网络咨询进程。";
239
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">打开一个网络进程</a>";
255
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">打开一个网络进程</a>";
240
	}
-
 
241
	else{
256
	} else {
242
		if ($user[5] != $user[0]){ # authentication exception or not
257
		if ($user->username != $user->mac) { // authentication exception or not
243
			$l_logout_explain = "关闭当前连接进程。<br> 已连接用户:<a href=\"http://$hostname:3990/logoff\" title=\" $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history 最后连接 :$connection_history";
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";
244
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">断开网络</a>";
259
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">断开网络</a>";
245
		}
-
 
246
		else{
260
		} else {
247
			$l_logout_explain = "您的系统($user[5])验证例外<br><br>$nb_connection_history 最后连接: $connection_history";
261
			$l_logout_explain = "您的系统($user->username)验证例外<br><br>$nb_connection_history 最后连接: $connection_history";
248
			$l_logout = "连接信息";
262
			$l_logout = "连接信息";
249
		}
263
		}
250
	}
264
	}
251
	$l_password_change = "<a href=\"https://$hostname/pass\">更改您的密码</a>";
265
	$l_password_change = "<a href=\"https://$hostname/pass\">更改您的密码</a>";
252
	$l_password_change_explain = "重新指向密码修改页面。<br><br> 您需要一个可用的网络账户。";
266
	$l_password_change_explain = "重新指向密码修改页面。<br><br> 您需要一个可用的网络账户。";
Line 254... Line 268...
254
	$l_back_page = "<a href=\"javascript:history.back()\">上一页</a>";
268
	$l_back_page = "<a href=\"javascript:history.back()\">上一页</a>";
255
	$l_service_sms = "短信服务可用";
269
	$l_service_sms = "短信服务可用";
256
	$l_service_sms_n = "短信服务禁用";
270
	$l_service_sms_n = "短信服务禁用";
257
	$l_acc_sms = "短信自动注册";
271
	$l_acc_sms = "短信自动注册";
258
	$l_explain_warn = "管理员创建了一份可用于司法调查的连接日志文档。";
272
	$l_explain_warn = "管理员创建了一份可用于司法调查的连接日志文档。";
259
	if(isset($_GET['url'])){
273
	if (isset($_GET['url'])) {
260
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">我明白并希望继续浏览。</a>";
274
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">我明白并希望继续浏览。</a>";
261
	}
-
 
262
	else{
275
	} else {
263
		$l_continue_link = "<a href=\"index.php\" class=\"button\">我明白并希望继续浏览。</a>";
276
		$l_continue_link = "<a href=\"index.php\" class=\"button\">我明白并希望继续浏览。</a>";
264
	}
277
	}
265
	$l_title_warn="亲爱的用户,";
278
	$l_title_warn="亲爱的用户,";
266
	$l_explain_warn_name="一人名为";
279
	$l_explain_warn_name="一人名为";
267
	$l_explain_warn_ip="在此IP:";
280
	$l_explain_warn_ip="在此IP:";
268
	$l_explain_warn_date="查看您的连接日志于";
281
	$l_explain_warn_date="查看您的连接日志于";
269
	$l_explain_warn_reason=" 如下原因:";
282
	$l_explain_warn_reason=" 如下原因:";
270
	$l_uam_domain = "授权网站 : ";
283
	$l_uam_domain = "授权网站 : ";
271
}
-
 
272
else if ($Language == 'ar'){
284
} else if ($Language === 'ar') {	// Arabic
273
	$l_access_denied = "مراقبة الدخول";
285
	$l_access_denied = "مراقبة الدخول";
274
	$l_access_welcome = "ALCASAR مرحبا بك في";
286
	$l_access_welcome = "ALCASAR مرحبا بك في";
275
	$l_access_unavailable = "الدخول غير متوفر";
287
	$l_access_unavailable = "الدخول غير متوفر";
276
	$l_required_domain = "موقع إنترنيت مطلوب";
288
	$l_required_domain = "موقع إنترنيت مطلوب";
277
	$l_explain_acc_access = "مركز التحكم يمكنك من إدارة البوابة. يلزمك التوفر على حساب الادارة للدخول.";
289
	$l_explain_acc_access = "مركز التحكم يمكنك من إدارة البوابة. يلزمك التوفر على حساب الادارة للدخول.";
Line 287... Line 299...
287
	$exchange_data_text = "يمَكن من تبادل البيانات المؤمّنة بين محطة الاستفسار و بوابة الكزار الأسيرة";
299
	$exchange_data_text = "يمَكن من تبادل البيانات المؤمّنة بين محطة الاستفسار و بوابة الكزار الأسيرة";
288
	$cert_not_saved_text = "إذا لم يتم تسجيل هذه الشهادة على محطة الاستفسار الخاصة بك، فمن الممكن ان يتم إصدار تنبيهات أمنية من متصحفك";
300
	$cert_not_saved_text = "إذا لم يتم تسجيل هذه الشهادة على محطة الاستفسار الخاصة بك، فمن الممكن ان يتم إصدار تنبيهات أمنية من متصحفك";
289
	$l_certif_explain = "<br><br>.$cert_not_saved_text<br> .$exchange_data_text";
301
	$l_certif_explain = "<br><br>.$cert_not_saved_text<br> .$exchange_data_text";
290
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">مساعدة إضافية </a>";
302
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">مساعدة إضافية </a>";
291
	$l_category = "فئة :";
303
	$l_category = "فئة :";
292
	if ((isset ($user[4])) && ($user[4] == "0")){
304
	if (!$user->connected) {
293
		$l_logout_explain = "و لا جلسة استفسار للإنترنت مفتوحة حاليا على نظامك";
305
		$l_logout_explain = "و لا جلسة استفسار للإنترنت مفتوحة حاليا على نظامك";
294
		$close_session_text = "فتح جلسة الإنترنت";
306
		$close_session_text = "فتح جلسة الإنترنت";
295
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">$close_session_text</a>";
307
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">$close_session_text</a>";
296
	}
-
 
297
	else{
308
	} else {
298
		if ($user[5] != $user[0]){ # authentication exception or not
309
		if ($user->username != $user->mac) { // authentication exception or not
299
			$close_session_text = "إقفال جلسة المستخدم المتصل حاليا";
310
			$close_session_text = "إقفال جلسة المستخدم المتصل حاليا";
300
			$user_logged_text = "المستخدم متصل";
311
			$userlogged_text = "المستخدم متصل";
301
			$disconnect_user_text = "قطع الاتصال على المستخدم";
312
			$disconnect_user_text = "قطع الاتصال على المستخدم";
302
			$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[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
313
			$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";
303
			$logout_internet_text = "قطع الاتصال على الإنترنت";
314
			$logout_internet_text = "قطع الاتصال على الإنترنت";
304
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">$logout_internet_text</a>";
315
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">$logout_internet_text</a>";
305
		}
-
 
306
		else{
316
		} else {
307
			$your_system_text = "نظامك";
317
			$your_system_text = "نظامك";
308
			$auth_except_text = "على توثيق استثنائي";
318
			$auth_except_text = "على توثيق استثنائي";
309
			$last_conn_text = "اتصالات مشاركة";
319
			$last_conn_text = "اتصالات مشاركة";
310
			$l_logout_explain = "$connection_history :$last_conn_text $nb_connection_history<br><br>$auth_except_text ($user[5]) $your_system_text";
320
			$l_logout_explain = "$connection_history :$last_conn_text $nb_connection_history<br><br>$auth_except_text ($user->username) $your_system_text";
311
			$l_logout = "معلومات على الاتصالات ";
321
			$l_logout = "معلومات على الاتصالات ";
312
		}
322
		}
313
	}
323
	}
314
	$change_pass_text = "غير كلمتك السرية";
324
	$change_pass_text = "غير كلمتك السرية";
315
	$l_password_change = "<a href=\"https://$hostname/pass\">$change_pass_text</a>";
325
	$l_password_change = "<a href=\"https://$hostname/pass\">$change_pass_text</a>";
Line 327... Line 337...
327
	$l_service_sms = "نشطة SMS خدمة";
337
	$l_service_sms = "نشطة SMS خدمة";
328
	$l_service_sms_n = "غير نشطة SMS خدمة";
338
	$l_service_sms_n = "غير نشطة SMS خدمة";
329
	$l_acc_sms = "تسجيل ذاتي عن طريق SMS";
339
	$l_acc_sms = "تسجيل ذاتي عن طريق SMS";
330
	$l_explain_warn = "المسؤول أنشأ أرشيفاً تحتوي على سجلات الاتصال في إطار تحقيق قضائي";
340
	$l_explain_warn = "المسؤول أنشأ أرشيفاً تحتوي على سجلات الاتصال في إطار تحقيق قضائي";
331
	$understand_text = "أنا متفهم و أريد ان أواصل التصفح";
341
	$understand_text = "أنا متفهم و أريد ان أواصل التصفح";
332
	if(isset($_GET['url'])){
342
	if (isset($_GET['url'])) {
333
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">$understand_text</a>";
343
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">$understand_text</a>";
334
	}
-
 
335
	else{
344
	} else {
336
		$l_continue_link = "<a href=\"index.php\" class=\"button\">$understand_text</a>";
345
		$l_continue_link = "<a href=\"index.php\" class=\"button\">$understand_text</a>";
337
	}
346
	}
338
	$l_title_warn = "عزيزي المستعمل, ";
347
	$l_title_warn = "عزيزي المستعمل, ";
339
	$l_explain_warn_name = "شخص مسمىٰ ";
348
	$l_explain_warn_name = "شخص مسمىٰ ";
340
	$l_explain_warn_ip = "تحت هذا IP: ";
349
	$l_explain_warn_ip = "تحت هذا IP: ";
341
	$l_explain_warn_date = "إطّلع على سجلات الاتصال الخاصة بك في";
350
	$l_explain_warn_date = "إطّلع على سجلات الاتصال الخاصة بك في";
342
	$l_explain_warn_reason = "السبب المسرّح به: ";
351
	$l_explain_warn_reason = "السبب المسرّح به: ";
343
	$l_uam_domain = ":المواقع المسموحة ";
352
	$l_uam_domain = ":المواقع المسموحة ";
344
}
-
 
345
else{
353
} else {	// English
346
	$l_access_denied = "Access control";
354
	$l_access_denied = "Access control";
347
	$l_access_welcome = "Welcome on ALCASAR";
355
	$l_access_welcome = "Welcome on ALCASAR";
348
	$l_access_unavailable = "ACCESS UNAVAILABLE";
356
	$l_access_unavailable = "ACCESS UNAVAILABLE";
349
	$l_required_domain = "Required WEB site";
357
	$l_required_domain = "Required WEB site";
350
	$l_explain_acc_access = "This center control the portal. You must have an administrative account.";
358
	$l_explain_acc_access = "This center control the portal. You must have an administrative account.";
Line 356... Line 364...
356
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
364
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
357
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
365
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
358
	$l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>";
366
	$l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>";
359
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
367
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
360
	$l_category = "category :";
368
	$l_category = "category :";
361
	if ((isset ($user[4])) && ($user[4] == "0")){
369
	if (!$user->connected) {
362
		$l_logout_explain = "No Internet consultation session is actualy open on your system";
370
		$l_logout_explain = "No Internet consultation session is actualy open on your system";
363
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Open an Internet session</a>";
371
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Open an Internet session</a>";
364
	}
-
 
365
	else{
372
	} else {
366
		if ($user[5] != $user[0]){ # authentication exception or not
373
		if ($user->username != $user->mac) { // authentication exception or not
367
			$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[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
374
			$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";
368
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
375
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
369
		}
-
 
370
		else{
376
		} else {
371
			$l_logout_explain = "Your system ($user[5]) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
377
			$l_logout_explain = "Your system ($user->username) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
372
			$l_logout = "Connections information";
378
			$l_logout = "Connections information";
373
		}
379
		}
374
	}
380
	}
375
	$l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
381
	$l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
376
	$l_password_change_explain = "Redirect you on password change page.<br><br> You should already have an Internet access account.";
382
	$l_password_change_explain = "Redirect you on password change page.<br><br> You should already have an Internet access account.";
Line 378... Line 384...
378
	$l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
384
	$l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
379
	$l_service_sms = "SMS service enable";
385
	$l_service_sms = "SMS service enable";
380
	$l_service_sms_n = "SMS service disable";
386
	$l_service_sms_n = "SMS service disable";
381
	$l_acc_sms = "Auto registration by SMS";
387
	$l_acc_sms = "Auto registration by SMS";
382
	$l_explain_warn = "The administrator created an archive which contains your imputabilities logs for a judicial investigation.";
388
	$l_explain_warn = "The administrator created an archive which contains your imputabilities logs for a judicial investigation.";
383
	if(isset($_GET['url'])){
389
	if (isset($_GET['url'])) {
384
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">I understand and I wish to continue.</a>";
390
		$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">I understand and I wish to continue.</a>";
385
	}
-
 
386
	else{
391
	} else {
387
		$l_continue_link = "<a href=\"index.php\" class=\"button\">I understand and I wish to continue.</a>";
392
		$l_continue_link = "<a href=\"index.php\" class=\"button\">I understand and I wish to continue.</a>";
388
	}
393
	}
389
	$l_title_warn="Dear user,";
394
	$l_title_warn="Dear user,";
390
	$l_explain_warn_name="Someone called ";
395
	$l_explain_warn_name="Someone called ";
391
	$l_explain_warn_ip="with this IP : ";
396
	$l_explain_warn_ip="with this IP : ";
Line 395... Line 400...
395
}
400
}
396
 
401
 
397
$l_title   = ($direct_access ? $l_access_welcome     : ($network_pb ? $l_access_unavailable : $l_access_denied));
402
$l_title   = ($direct_access ? $l_access_welcome     : ($network_pb ? $l_access_unavailable : $l_access_denied));
398
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb     : $l_explain_access_deny));
403
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb     : $l_explain_access_deny));
399
 
404
 
400
# set the icons
405
// Set the icons
401
$img_rep = "/images/";
406
$img_rep         = '/images/';
402
$img_organisme = "organisme.png";
407
$img_organisme   = 'organisme.png';
403
$img_access = "globe_acces_70.png";
408
$img_access      = 'globe_acces_70.png';
404
$img_connect = "globe_70.png";
409
$img_connect     = 'globe_70.png';
405
$img_warning = "globe_warning_70.png";
410
$img_warning     = 'globe_warning_70.png';
406
$img_pwd = "cle_ombre.png";
411
$img_pwd         = 'cle_ombre.png';
407
$img_certificate = "certificat.png";
412
$img_certificate = 'certificat.png';
408
$img_acc = "logo-alcasar_70.png";
413
$img_acc         = 'logo-alcasar_70.png';
409
$img_sms = "sms.png";
414
$img_sms         = 'sms.png';
410
$img_false = "interdit.png";
415
$img_false       = 'interdit.png';
411
$img_adm = "adm.png";
416
$img_adm         = 'adm.png';
412
$img_internet = $img_connect;
-
 
413
 
-
 
414
if ((isset ($user[4])) && ($user[4] == "0")){
-
 
415
	if (! $network_pb){
-
 
416
		$img_internet = $img_access;
-
 
417
	}
-
 
418
	else{
-
 
419
		$img_internet = $img_warning;
-
 
420
	}
-
 
421
}
-
 
422
else{
-
 
423
	$img_internet = $img_connect;
-
 
424
}
-
 
425
 
-
 
426
# cleaning the cache
-
 
427
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
-
 
428
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
-
 
429
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
-
 
430
header("Cache-Control: post-check=0, pre-check=0", false);
-
 
431
header("Pragma: no-cache");
-
 
432
 
-
 
433
?>
-
 
434
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
 
435
<html>
-
 
436
<head>
-
 
437
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-
 
438
	<title>ALCASAR - <?php echo $l_title; ?></title>
-
 
439
	<meta http-equiv="Cache-control" content="no-cache">
-
 
440
	<meta http-equiv="Pragma" content="no-cache">
-
 
441
	<link rel="stylesheet" href="/css/style_intercept.css" type="text/css">
-
 
442
	<script type="text/javascript">
-
 
443
	function valoriserDiv5(param){
-
 
444
		document.getElementById("box_info").innerHTML = param.innerHTML;
-
 
445
	}
-
 
446
	</script>
-
 
447
</head>
-
 
448
<body onload="valoriserDiv5(text_conn);">
-
 
449
<?php
-
 
450
if ($direct_access){
-
 
451
	echo "
-
 
452
	<div id=\"cadre_titre\" class=\"titre_controle\">
-
 
453
		<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
-
 
454
	if ($network_pb) {
-
 
455
		echo "	<span>$l_explain_net_pb</span>";
-
 
456
	}
-
 
457
}
-
 
458
else{ # the user is intercepted
-
 
459
	# if user need to be warned that someone reads his logs
-
 
460
	if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1') {
-
 
461
		echo "
-
 
462
		<div id=\"cadre_titre\" class=\"titre_refus\">
-
 
463
		<p id=\"acces_controle\" class=\"titre_refus\">$l_title_warn</p>";
-
 
464
	}
-
 
465
	else{ # the user is blacklisted (or whitelisted)
-
 
466
		echo "
-
 
467
		<div id=\"cadre_titre\" class=\"titre_refus\">
-
 
468
		<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
-
 
469
	}
-
 
470
}
-
 
471
?>
-
 
472
 
-
 
473
		<div id="boite_logo">
-
 
474
			<img src="<?php echo "$img_rep$img_organisme"; ?>">
-
 
475
		</div>
-
 
476
	</div>
-
 
477
		<div id="contenu_acces">
-
 
478
			<div id="box_url">
-
 
479
				<?php 
-
 
480
				// Search blacklist categories
-
 
481
				if ((!$direct_access) && (!$network_pb) && (!isset($_GET['warn']))) {
-
 
482
					$pattern = str_replace('www.', '', $_SERVER['HTTP_HOST']);
-
 
483
					exec('grep -Re ' . escapeshellarg('^'.$pattern.'$') . " /etc/dansguardian/lists/blacklists/*/domains | cut -d'/' -f6", $output);
-
 
484
					$lists = [];
-
 
485
					foreach ($output as $line) {
-
 
486
						$lists[] = $line;
-
 
487
					}
-
 
488
 
417
 
489
					echo $l_required_domain.' : '.htmlspecialchars($_SERVER['HTTP_HOST']);
-
 
490
					if (!empty($lists)) {
-
 
491
						echo "<br>$l_category ".implode(', ', $lists);
-
 
492
					}
-
 
493
				}
-
 
494
				?>
-
 
495
			</div>
-
 
496
<?php
-
 
497
# Check if the SMS service is enable
-
 
498
$service_SMS_status="false";
-
 
499
if ($service_SMS_status == "true"){
-
 
500
	$sms_div='
-
 
501
		<div class="box_menu" id="box_acc" onmouseover="valoriserDiv5(text_acc);">
418
$img_internet    = (($user->connected) ? $img_connect : ($network_pb ? $img_warning : $img_access));
502
			<span>'.$l_sms_access.'</span>
-
 
503
			<img src="'.$img_rep.''.$img_sms.'">
-
 
504
		</div>
-
 
505
';
-
 
506
 
419
 
507
$sms_div_over='
-
 
508
		<div class="div-cache" id="text_acc">
-
 
509
			<h2>'.$l_sms_access.'</h2>
-
 
510
			<p>'.$l_sms_explain.'</p>
-
 
511
			<p><font color="green"><center>'.$l_service_sms.'</center></font></p>
-
 
512
			<img src="'.$img_rep.''.$img_sms.'">
-
 
513
		</div>
-
 
514
';
-
 
515
}
-
 
516
else {
-
 
517
	$sms_div='';
-
 
518
	$sms_div_over='';
-
 
519
}
-
 
520
if ($direct_access) {
420
if ($direct_access) {
521
	if (!$network_pb) {
-
 
522
		echo "
-
 
523
		<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
-
 
524
			<span>$l_logout</span>
-
 
525
			<img src=\"$img_rep$img_internet\">
-
 
526
		</div>";
-
 
527
	}
-
 
528
 
-
 
529
	// Read the "Domain allowed" file
421
	// Read the "Domain allowed" file
530
	$domainAllowedHtml = '';
422
	$domainsAllowed = [];
531
	$tab = file(DOMAIN_ALLOWED_LIST);
423
	$fileContent = file(DOMAIN_ALLOWED_LIST);
532
	if ($tab) { // the file isn't empty
424
	if ($fileContent) { // the file isn't empty
533
		$domainAllowedHtml .= '<p>'.$l_uam_domain.'<br><ul>';
-
 
534
		foreach ($tab as $line) {
425
		foreach ($fileContent as $line) {
535
			if (trim($line) !== '') { // the line isn't empty
426
			if (!empty(trim($line))) {
536
				$domain_allowed = explode('#', $line);
427
				$domain_fields = explode('#', $line);
537
				if (trim($domain_allowed[1]) !== '') {
428
				if (!empty(trim($domain_fields[1]))) {
538
					$domain = explode('"', $domain_allowed[0]);
429
					$domain = explode('"', $domain_fields[0]);
539
					// remove every '.' from the beginning of domain
430
					$domain[1] = ltrim($domain[1], '.'); // remove every '.' from the beginning of domain
-
 
431
					$domainsAllowed[] = (object) [
540
					$domain[1] = ltrim($domain[1], '.');
432
						'name'   => trim($domain_fields[1]),
541
					$domainAllowedHtml .= '<li><a href="http://'.trim($domain[1]).'">'.trim($domain_allowed[1]).'</a></li>';
433
						'domain' => trim($domain[1])
-
 
434
					];
542
				}
435
				}
543
			}
436
			}
544
		}
437
		}
545
		$domainAllowedHtml .= '</ul></p>';
-
 
546
	}
438
	}
547
 
-
 
548
	echo "
439
} else {
549
		<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
-
 
550
			<span>$l_install_certif</span>
-
 
551
			<img src=\"$img_rep$img_certificate\">
-
 
552
		</div>
-
 
553
		<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
440
	 if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] === '1') {
554
			<img src=\"$img_rep$img_pwd\">
-
 
555
			<span>$l_password_change</span>
-
 
556
		</div>		
-
 
557
		$sms_div
-
 
558
		<div class=\"div-cache\" id=\"text_conn\">
-
 
559
			<h2>$l_logout</h2>
-
 
560
			<p>$l_logout_explain</p>
-
 
561
			$domainAllowedHtml
-
 
562
			<img src=\"$img_rep$img_internet\">
-
 
563
		</div>
-
 
564
		<div class=\"div-cache\" id=\"text_certif\">
-
 
565
			<h2>$l_install_certif_more</h2>
-
 
566
			<p>$l_certif_explain $l_certif_explain_help</p>
-
 
567
			<img src=\"$img_rep$img_certificate\">				
-
 
568
		</div>
-
 
569
		<div class=\"div-cache\" id=\"text_mdp\">
-
 
570
			<h2>$l_password_change</h2>
-
 
571
			<p>$l_password_change_explain</p>
-
 
572
			<img src=\"$img_rep$img_pwd\">
-
 
573
		</div>
-
 
574
		$sms_div_over
-
 
575
		<div id=\"box_info\">
-
 
576
		</div>";
-
 
577
}
-
 
578
else {
-
 
579
	# user need to be warned that someone reads his logs
441
		// user need to be warned that someone reads his logs
580
	if(isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] === '1'){
-
 
581
		$filename = '/var/www/html/acc/backup/log_info.txt';
442
		$filename = '/var/www/html/acc/backup/log_info.txt';
582
		$l_explain_warn = '';
-
 
583
		if (file_exists($filename)) {
443
		if (file_exists($filename)) {
584
			$fichier = fopen($filename, 'r');
444
			$fichier = fopen($filename, 'r');
585
			$content = file($filename);
445
			$content = file($filename);
586
			foreach ($content as $line) {
446
			foreach ($content as $line) {
587
				$infos = explode('|||', $line);
447
				$infos = explode('|||', $line);
588
				$log_date   = $infos[0];	
448
				$log_date   = $infos[0];
589
				$log_user   = $infos[1];	
449
				$log_user   = $infos[1];
590
				$log_reason = $infos[2];	
450
				$log_reason = $infos[2];
591
				$log_ip     = $infos[3];	
451
				$log_ip     = $infos[3];
592
			}
452
			}
593
			$l_explain_warn = "$l_explain_warn_name$log_user ($l_explain_warn_ip$log_ip) $l_explain_warn_date$log_date.<br>$l_explain_warn_reason<br>$log_reason";
453
			$l_explain_warn = "$l_explain_warn_name$log_user ($l_explain_warn_ip$log_ip) $l_explain_warn_date$log_date.<br>$l_explain_warn_reason<br>$log_reason";
-
 
454
		} else {
-
 
455
			$l_explain_warn = 'Log error!';
594
		}
456
		}
595
		else{
-
 
596
			echo "Log error!";
-
 
597
		}
-
 
598
		echo "
-
 
599
			<div id=\"box_refuse\">
-
 
600
				<img src=\"$img_rep$img_warning\">
-
 
601
				<p>$l_explain_warn</p>
-
 
602
			</div>
-
 
603
			<div id=\"liens_redir\">
-
 
604
				<p>$l_continue_link</p>
-
 
605
			</div>";
-
 
606
	}
-
 
607
	else{
-
 
608
		echo "
-
 
609
			<div id=\"box_refuse\">
-
 
610
				<img src=\"$img_rep$img_false\">
-
 
611
				<p>$l_explain</p>
-
 
612
			</div>
-
 
613
			<div id=\"liens_redir\">
-
 
614
				<p>$l_back_page</p>
-
 
615
			</div>";
-
 
616
	}
457
	}
617
}
458
}
-
 
459
 
-
 
460
// Search blacklist categories
618
	if (($network_pb)&&(! $direct_access)) {
461
if ((!$direct_access) && (!$network_pb) && (!isset($_GET['warn']))) {
619
		echo "	<span>Diagnostic : $diagnostic</span>";
462
	$pattern = str_replace('www.', '', $_SERVER['HTTP_HOST']);
620
	}
-
 
621
	echo "</div>";
463
	$output = [];
622
	if($direct_access){ # display the admin logo (wheel) at the bottom right
464
	exec('grep -Re ' . escapeshellarg('^'.$pattern.'$') . " /etc/dansguardian/lists/blacklists/*/domains | cut -d'/' -f6", $output);
-
 
465
	$lists = [];
623
		echo "<div id=\"corner\">";
466
	foreach ($output as $line) {
624
		echo "<div id=\"adm\" class=\"corn\">";
467
		$lists[] = $line;
-
 
468
	}
-
 
469
 
625
		echo "<a href=\"https://$hostname/acc/\"><img src=\"$img_rep$img_adm\"></a>";
470
	$filteredUrlHtml = $l_required_domain.' : '.htmlspecialchars($_SERVER['HTTP_HOST']);
626
		echo "</div>";
471
	if (!empty($lists)) {
627
		echo "</div>";
472
		$filteredUrlHtml .= "<br>$l_category ".implode(', ', $lists);
628
	}
473
	}
-
 
474
}
-
 
475
 
-
 
476
// Cleaning the cache
-
 
477
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
-
 
478
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
-
 
479
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
-
 
480
header('Cache-Control: post-check=0, pre-check=0', false);
-
 
481
header('Pragma: no-cache');
629
?>
482
?>
-
 
483
<!DOCTYPE html>
-
 
484
<html>
-
 
485
	<head>
-
 
486
		<meta charset="UTF-8">
-
 
487
		<title>ALCASAR - <?= $l_title ?></title>
-
 
488
		<link type="text/css" href="/css/style_intercept.css" rel="stylesheet">
-
 
489
		<?php if ($direct_access): ?>
-
 
490
			<script>
-
 
491
			function setBoxInfoContent(param){
-
 
492
				document.getElementById('box_info').innerHTML = document.getElementById(param).innerHTML;
-
 
493
			}
-
 
494
			</script>
-
 
495
		<?php endif; ?>
-
 
496
	</head>
-
 
497
	<body<? (($direct_access) ? ' onload="setBoxInfoContent(\'text_conn\');"' : '') ?>>
-
 
498
		<?php if ($direct_access): ?>
-
 
499
			<div id="cadre_titre" class="titre_controle">
-
 
500
				<p id="acces_controle" class="titre_controle"><?= $l_title ?></p>
-
 
501
				<?php if ($network_pb): ?>
-
 
502
					<span><?= $l_explain_net_pb ?></span>
-
 
503
				<?php endif; ?>
-
 
504
		<?php else: // the user is intercepted ?>
-
 
505
			<?php if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1'): // if user need to be warned that someone reads his logs ?>
-
 
506
				<div id="cadre_titre" class="titre_refus">
-
 
507
					<p id="acces_controle" class="titre_refus"><?= $l_title_warn ?></p>
-
 
508
			<?php else: // the user is blacklisted (or whitelisted) ?>
-
 
509
				<div id="cadre_titre" class="titre_refus">
-
 
510
					<p id="acces_controle" class="titre_refus"><?= $l_title ?></p>
-
 
511
			<?php endif; ?>
-
 
512
		<?php endif; ?>
-
 
513
 
-
 
514
			<div id="boite_logo">
-
 
515
				<img src="<?= $img_rep.$img_organisme ?>">
-
 
516
			</div>
-
 
517
		</div>
-
 
518
		<div id="contenu_acces">
-
 
519
			<div id="box_url">
-
 
520
				<?php if ((!$direct_access) && (!$network_pb) && (!isset($_GET['warn']))): // Print blacklist categories ?>
-
 
521
					<?= $filteredUrlHtml ?>
-
 
522
				<?php endif; ?>
-
 
523
			</div>
-
 
524
 
-
 
525
			<?php if ($direct_access): ?>
-
 
526
				<?php if (!$network_pb): ?>
-
 
527
					<div class="box_menu" id="box_conn" onmouseover="setBoxInfoContent('text_conn');">
-
 
528
						<span><?= $l_logout ?></span>
-
 
529
						<img src="<?= $img_rep.$img_internet ?>">
-
 
530
					</div>
-
 
531
				<?php endif; ?>
-
 
532
 
-
 
533
				<div class="box_menu" id="box_certif" onmouseover="setBoxInfoContent('text_certif');">
-
 
534
					<span><?= $l_install_certif ?></span>
-
 
535
					<img src="<?= $img_rep.$img_certificate ?>">
-
 
536
				</div>
-
 
537
 
-
 
538
				<div class="box_menu" id="box_mdp" onmouseover="setBoxInfoContent('text_mdp');">
-
 
539
					<img src="<?= $img_rep.$img_pwd ?>">
-
 
540
					<span><?= $l_password_change ?></span>
-
 
541
				</div>
-
 
542
 
-
 
543
				<?php if ($service_SMS_status === true): ?>
-
 
544
					<div class="box_menu" id="box_acc" onmouseover="setBoxInfoContent('text_acc');">
-
 
545
						<span><?= $l_sms_access ?></span>
-
 
546
						<img src="<?= $img_rep.$img_sms ?>">
-
 
547
					</div>
-
 
548
				<?php endif; ?>
-
 
549
 
-
 
550
				<div class="div-cache" id="text_conn">
-
 
551
					<h2><?= $l_logout ?></h2>
-
 
552
					<p><?= $l_logout_explain ?></p>
-
 
553
					<?php if (!empty($domainsAllowed)): ?>
-
 
554
						<p><?= $l_uam_domain ?>
-
 
555
							<ul>
-
 
556
								<?php foreach ($domainsAllowed as $domainAllowed): ?>
-
 
557
									<li><a href="http://<?= $domainAllowed->domain ?>"><?= $domainAllowed->name ?></a></li>
-
 
558
								<?php endforeach; ?>
-
 
559
							</ul>
-
 
560
						</p>
-
 
561
					<?php endif; ?>
-
 
562
					<img src="<?= $img_rep.$img_internet ?>">
-
 
563
				</div>
-
 
564
 
-
 
565
				<div class="div-cache" id="text_certif">
-
 
566
					<h2><?= $l_install_certif_more ?></h2>
-
 
567
					<p><?= "$l_certif_explain $l_certif_explain_help" ?></p>
-
 
568
					<img src="<?= $img_rep.$img_certificate ?>">				
-
 
569
				</div>
-
 
570
 
-
 
571
				<div class="div-cache" id="text_mdp">
-
 
572
					<h2><?= $l_password_change ?></h2>
-
 
573
					<p><?= $l_password_change_explain ?></p>
-
 
574
					<img src="<?= $img_rep.$img_pwd ?>">
-
 
575
				</div>
-
 
576
 
-
 
577
				<?php if ($service_SMS_status === true): ?>
-
 
578
					<div class="div-cache" id="text_acc">
-
 
579
						<h2><?= $l_sms_access ?></h2>
-
 
580
						<p><?= $l_sms_explain ?></p>
-
 
581
						<p style="color: green; text-align: center;"><?= $l_service_sms ?></p>
-
 
582
						<img src="<?= $img_rep.$img_sms ?>">
-
 
583
					</div>
-
 
584
				<?php endif; ?>
-
 
585
 
-
 
586
				<div id="box_info">
-
 
587
				</div>
-
 
588
			<?php else: // the user is intercepted ?>
-
 
589
				<?php if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] === '1'): // user need to be warned that someone reads his logs ?>
-
 
590
					<div id="box_refuse">
-
 
591
						<img src="<?= $img_rep.$img_warning ?>">
-
 
592
						<p><?= $l_explain_warn ?></p>
-
 
593
					</div>
-
 
594
					<div id="liens_redir">
-
 
595
						<p><?= $l_continue_link ?></p>
-
 
596
					</div>
-
 
597
				<?php else: ?>
-
 
598
					<div id="box_refuse">
-
 
599
						<img src="<?= $img_rep.$img_false ?>">
-
 
600
						<p><?= $l_explain ?></p>
-
 
601
					</div>
-
 
602
					<div id="liens_redir">
-
 
603
						<p><?= $l_back_page ?></p>
-
 
604
					</div>
-
 
605
				<?php endif; ?>
-
 
606
			<?php endif; ?>
-
 
607
 
-
 
608
			<?php if (($network_pb) && (!$direct_access)): ?>
-
 
609
				<span>Diagnostic : <?= $diagnostic ?></span>
-
 
610
			<?php endif; ?>
-
 
611
		</div>
-
 
612
 
-
 
613
		<?php if ($direct_access): // display the admin logo (wheel) at the bottom right ?>
-
 
614
			<div id="corner">
-
 
615
				<div id="adm" class="corn">
-
 
616
					<a href="<?= "https://$hostname/acc/" ?>"><img src="<?= $img_rep.$img_adm ?>"></a>
-
 
617
				</div>
-
 
618
			</div>
-
 
619
		<?php endif; ?>
630
	</body>
620
	</body>
631
</html>
621
</html>