Subversion Repositories ALCASAR

Rev

Rev 2708 | Rev 2713 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2708 Rev 2709
1
<?php
1
<?php
2
# $Id: network.php 2708 2019-03-05 23:17:43Z tom.houdayer $
2
# $Id: network.php 2709 2019-03-05 23:20:31Z tom.houdayer $
3
 
3
 
4
// written by steweb57, Rexy & Tom HOUDAYER
4
// written by steweb57, Rexy & Tom HOUDAYER
5
 
5
 
6
/********************
6
/********************
7
*  READ CONF FILES  *
7
*  READ CONF FILES  *
8
*********************/
8
*********************/
9
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
9
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
10
define('ETHERS_FILE', '/usr/local/etc/alcasar-ethers');
10
define('ETHERS_FILE', '/usr/local/etc/alcasar-ethers');
11
define('ETHERS_INFO_FILE', '/usr/local/etc/alcasar-ethers-info');
11
define('ETHERS_INFO_FILE', '/usr/local/etc/alcasar-ethers-info');
12
define('DNS_LOCAL_FILE', '/etc/hosts');
12
define('DNS_LOCAL_FILE', '/etc/hosts');
13
define('LETS_ENCRYPT_FILE', '/usr/local/etc/alcasar-letsencrypt');
13
define('LETS_ENCRYPT_FILE', '/usr/local/etc/alcasar-letsencrypt');
14
$conf_files = [CONF_FILE, ETHERS_FILE, ETHERS_INFO_FILE, DNS_LOCAL_FILE, LETS_ENCRYPT_FILE];
14
$conf_files = [CONF_FILE, ETHERS_FILE, ETHERS_INFO_FILE, DNS_LOCAL_FILE, LETS_ENCRYPT_FILE];
15
 
15
 
16
// Files reading test
16
// Files reading test
17
foreach ($conf_files as $file) {
17
foreach ($conf_files as $file) {
18
	if (!file_exists($file)) {
18
	if (!file_exists($file)) {
19
		exit("Requested file $file isn't present");
19
		exit("Requested file $file isn't present");
20
	}
20
	}
21
	if (!is_readable($file)) {
21
	if (!is_readable($file)) {
22
		exit("Can't read the file $file");
22
		exit("Can't read the file $file");
23
	}
23
	}
24
}
24
}
25
 
25
 
26
// Read ALCASAR CONF_FILE
26
// Read ALCASAR CONF_FILE
27
$file_conf = fopen(CONF_FILE, 'r');
27
$file_conf = fopen(CONF_FILE, 'r');
28
if (!$file_conf) {
28
if (!$file_conf) {
29
	exit('Error opening the file '.CONF_FILE);
29
	exit('Error opening the file '.CONF_FILE);
30
}
30
}
31
while (!feof($file_conf)) {
31
while (!feof($file_conf)) {
32
	$buffer = fgets($file_conf, 4096);
32
	$buffer = fgets($file_conf, 4096);
33
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
33
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
34
		$tmp = explode('=', $buffer, 2);
34
		$tmp = explode('=', $buffer, 2);
35
		$conf[trim($tmp[0])] = trim($tmp[1]);
35
		$conf[trim($tmp[0])] = trim($tmp[1]);
36
	}
36
	}
37
}
37
}
38
fclose($file_conf);
38
fclose($file_conf);
39
 
39
 
40
// Choice of language
40
// Choice of language
41
$Language = 'en';
41
$Language = 'en';
42
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
42
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
43
	$Langue	  = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
43
	$Langue	  = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
44
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
44
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
45
}
45
}
46
if ($Language === 'fr') {	// French
46
if ($Language === 'fr') {	// French
47
	$l_network_title	= "Configuration réseau";
47
	$l_network_title	= "Configuration réseau";
48
	$l_internet_legend	= "INTERNET";
48
	$l_internet_legend	= "INTERNET";
49
	$l_ip_mask		= "Masque";
49
	$l_ip_mask		= "Masque";
50
	$l_ip_router		= "Passerelle";
50
	$l_ip_router		= "Passerelle";
51
	$l_ip_public		= "Adresse IP publique";
51
	$l_ip_public		= "Adresse IP publique";
52
	$l_ip_dns1		= "DNS n°1";
52
	$l_ip_dns1		= "DNS n°1";
53
	$l_ip_dns2		= "DNS n°2";
53
	$l_ip_dns2		= "DNS n°2";
54
	$l_dhcp_title		= "Service DHCP";
54
	$l_dhcp_title		= "Service DHCP";
55
	$l_dhcp_state		= "Mode actuel";
55
	$l_dhcp_state		= "Mode actuel";
56
	$l_DHCP_on		= "actif";
56
	$l_DHCP_on		= "actif";
57
	$l_DHCP_off		= "inactif";
57
	$l_DHCP_off		= "inactif";
58
	$l_DHCP_off_explain	= "/!\\ Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
58
	$l_DHCP_off_explain	= "/!\\ Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
59
	$l_static_dhcp_title	= "Réservation d'adresses IP statiques";
59
	$l_static_dhcp_title	= "Réservation d'adresses IP statiques";
60
	$l_dhcp_relay		= "Relais DHCP";
60
	$l_dhcp_relay		= "Relais DHCP";
61
	$l_dhcp_relay_local_ip	= "Adresse IP locale";
61
	$l_dhcp_relay_local_ip	= "Adresse IP locale";
62
	$l_dhcp_relay_ip	= "Adresse IP DHCP";
62
	$l_dhcp_relay_ip	= "Adresse IP DHCP";
63
	$l_dhcp_relay_port	= "Port DHCP";
63
	$l_dhcp_relay_port	= "Port DHCP";
64
	$l_mac_address		= "Adresse MAC";
64
	$l_mac_address		= "Adresse MAC";
65
	$l_ip_address		= "Adresse IP";
65
	$l_ip_address		= "Adresse IP";
66
	$l_host_name		= "Nom d'hôte";
66
	$l_host_name		= "Nom d'hôte";
67
	$l_del			= "Supprimer de la liste";
67
	$l_del			= "Supprimer de la liste";
68
	$l_add_to_list		= "Ajouter";
68
	$l_add_to_list		= "Ajouter";
69
	$l_apply		= "Appliquer les changements";
69
	$l_apply		= "Appliquer les changements";
-
 
70
	$l_dns_title		= "Service DNS";
70
	$l_local_dns		= "Résolution local de nom";
71
	$l_local_dns		= "Résolution local de nom";
-
 
72
	$l_dns_internal		= "Serveur DNS interne";
71
	$l_import_cert		= "Import de certificat";
73
	$l_import_cert		= "Import de certificat";
72
	$l_private_key		= "Clé privée (.key) :";
74
	$l_private_key		= "Clé privée (.key) :";
73
	$l_certificate		= "Certificat (.crt) :";
75
	$l_certificate		= "Certificat (.crt) :";
74
	$l_server_chain		= "Chaîne de certification (si nécéssaire : .crt) :";
76
	$l_server_chain		= "Chaîne de certification (si nécéssaire : .crt) :";
75
	$l_default_cert		= "Revenir au certificat d'origine";
77
	$l_default_cert		= "Revenir au certificat d'origine";
76
	$l_import		= "Importer";
78
	$l_import		= "Importer";
77
	$l_current_certificate  = "Certificat actuel";
79
	$l_current_certificate  = "Certificat actuel";
78
	$l_validated		= "Validé par :";
80
	$l_validated		= "Validé par :";
79
	$l_empty		= "Vide";
81
	$l_empty		= "Vide";
80
	$l_yes			= "Oui";
82
	$l_yes			= "Oui";
81
	$l_no			= "Non";
83
	$l_no			= "Non";
82
	$l_ssl_title		= "Chiffrer les flux réseau entre les utilisateurs et ALCASAR";
84
	$l_ssl_title		= "Chiffrer les flux réseau entre les utilisateurs et ALCASAR";
83
	$l_cert_expiration	= "Date d'expiration :";
85
	$l_cert_expiration	= "Date d'expiration :";
84
	$l_cert_commonname	= "Nom commun :";
86
	$l_cert_commonname	= "Nom commun :";
85
	$l_cert_organization	= "Organisation :";
87
	$l_cert_organization	= "Organisation :";
86
	$l_upload_certificate	= "Importer un certificat";
88
	$l_upload_certificate	= "Importer un certificat";
87
	$l_le_integration	= "Intégration Let's Encrypt";
89
	$l_le_integration	= "Intégration Let's Encrypt";
88
	$l_le_status		= "Status :";
90
	$l_le_status		= "Status :";
89
	$l_disabled		= "Inactif";
91
	$l_disabled		= "Inactif";
90
	$l_pending_validation	= "En attente de validation";
92
	$l_pending_validation	= "En attente de validation";
91
	$l_enabled		= "Actif";
93
	$l_enabled		= "Actif";
92
	$l_le_email		= "Email :";
94
	$l_le_email		= "Email :";
93
	$l_le_domain_name	= "Nom de domaine :";
95
	$l_le_domain_name	= "Nom de domaine :";
94
	$l_send			= "Envoyer";
96
	$l_send			= "Envoyer";
95
	$l_le_ask_on		= "Demandé le :";
97
	$l_le_ask_on		= "Demandé le :";
96
	$l_le_dns_entry_txt	= "Entrée DNS TXT :";
98
	$l_le_dns_entry_txt	= "Entrée DNS TXT :";
97
	$l_le_challenge		= "Challenge :";
99
	$l_le_challenge		= "Challenge :";
98
	$l_recheck		= "Revérifier";
100
	$l_recheck		= "Revérifier";
99
	$l_cancel		= "Annuler";
101
	$l_cancel		= "Annuler";
100
	$l_le_api		= "API :";
102
	$l_le_api		= "API :";
101
	$l_le_next_renewal	= "Prochain renouvellement :";
103
	$l_le_next_renewal	= "Prochain renouvellement :";
102
	$l_renew		= "Renouveller";
104
	$l_renew		= "Renouveller";
103
	$l_renew_force		= "Renouveller (forcer)";
105
	$l_renew_force		= "Renouveller (forcer)";
104
} else {			// English
106
} else {			// English
105
	$l_network_title	= "Network configuration";
107
	$l_network_title	= "Network configuration";
106
	$l_internet_legend	= "INTERNET";
108
	$l_internet_legend	= "INTERNET";
107
	$l_ip_mask		= "Mask";
109
	$l_ip_mask		= "Mask";
108
	$l_ip_router		= "Gateway";
110
	$l_ip_router		= "Gateway";
109
	$l_ip_public		= "Public IP address";
111
	$l_ip_public		= "Public IP address";
110
	$l_ip_dns1		= "DNS n°1";
112
	$l_ip_dns1		= "DNS n°1";
111
	$l_ip_dns2		= "DNS n°2";
113
	$l_ip_dns2		= "DNS n°2";
112
	$l_dhcp_title		= "DHCP service";
114
	$l_dhcp_title		= "DHCP service";
113
	$l_dhcp_state		= "Current mode";
115
	$l_dhcp_state		= "Current mode";
114
	$l_DHCP_on		= "enabled";
116
	$l_DHCP_on		= "enabled";
115
	$l_DHCP_off		= "disabled";
117
	$l_DHCP_off		= "disabled";
116
	$l_DHCP_off_explain	= "/!\\ Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
118
	$l_DHCP_off_explain	= "/!\\ Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
117
	$l_static_dhcp_title	= "Static IP addresses reservation";
119
	$l_static_dhcp_title	= "Static IP addresses reservation";
118
	$l_dhcp_relay		= "DHCP relay";
120
	$l_dhcp_relay		= "DHCP relay";
119
	$l_dhcp_relay_local_ip	= "Locale IP address";
121
	$l_dhcp_relay_local_ip	= "Locale IP address";
120
	$l_dhcp_relay_ip	= "DHCP IP address";
122
	$l_dhcp_relay_ip	= "DHCP IP address";
121
	$l_dhcp_relay_port	= "DHCP port";
123
	$l_dhcp_relay_port	= "DHCP port";
122
	$l_mac_address		= "MAC address";
124
	$l_mac_address		= "MAC address";
123
	$l_ip_address		= "IP address";
125
	$l_ip_address		= "IP address";
124
	$l_port			= "Port";
126
	$l_port			= "Port";
125
	$l_host_name		= "Host name";
127
	$l_host_name		= "Host name";
126
	$l_del			= "Delete from list";
128
	$l_del			= "Delete from list";
127
	$l_add_to_list		= "Add";
129
	$l_add_to_list		= "Add";
128
	$l_apply		= "Apply changes";
130
	$l_apply		= "Apply changes";
-
 
131
	$l_dns_title		= "DNS service";
129
	$l_local_dns		= "Local name resolution";
132
	$l_local_dns		= "Local name resolution";
-
 
133
	$l_dns_internal		= "DNS internal";
130
	$l_import_cert		= "Certificate import";
134
	$l_import_cert		= "Certificate import";
131
	$l_private_key		= "Private key (.key) :";
135
	$l_private_key		= "Private key (.key) :";
132
	$l_certificate		= "Certificate (.crt) :";
136
	$l_certificate		= "Certificate (.crt) :";
133
	$l_server_chain		= "Server-chain (if necessary : .crt) :";
137
	$l_server_chain		= "Server-chain (if necessary : .crt) :";
134
	$l_default_cert		= "Back to default certificate";
138
	$l_default_cert		= "Back to default certificate";
135
	$l_import		= "Import";
139
	$l_import		= "Import";
136
	$l_current_certificate  = "Current certificate";
140
	$l_current_certificate  = "Current certificate";
137
	$l_validated		= "Validated by :";
141
	$l_validated		= "Validated by :";
138
	$l_empty		= "Empty";
142
	$l_empty		= "Empty";
139
	$l_yes			= "Yes";
143
	$l_yes			= "Yes";
140
	$l_no			= "No";
144
	$l_no			= "No";
141
	$l_ssl_title		= "Cipher the network flows between users and ALCASAR";
145
	$l_ssl_title		= "Cipher the network flows between users and ALCASAR";
142
	$l_cert_expiration	= "Expiration date:";
146
	$l_cert_expiration	= "Expiration date:";
143
	$l_cert_commonname	= "Common name:";
147
	$l_cert_commonname	= "Common name:";
144
	$l_cert_organization	= "Organization:";
148
	$l_cert_organization	= "Organization:";
145
	$l_upload_certificate	= "Importer un certificat";
149
	$l_upload_certificate	= "Importer un certificat";
146
	$l_le_integration	= "Let's Encrypt integration";
150
	$l_le_integration	= "Let's Encrypt integration";
147
	$l_le_status		= "Status:";
151
	$l_le_status		= "Status:";
148
	$l_disabled		= "Disabled";
152
	$l_disabled		= "Disabled";
149
	$l_pending_validation	= "Pending validation";
153
	$l_pending_validation	= "Pending validation";
150
	$l_enabled		= "Enabled";
154
	$l_enabled		= "Enabled";
151
	$l_le_email		= "Email:";
155
	$l_le_email		= "Email:";
152
	$l_le_domain_name	= "Domain name:";
156
	$l_le_domain_name	= "Domain name:";
153
	$l_send			= "Send";
157
	$l_send			= "Send";
154
	$l_le_ask_on		= "Ask on:";
158
	$l_le_ask_on		= "Ask on:";
155
	$l_le_dns_entry_txt	= "DNS TXT entry:";
159
	$l_le_dns_entry_txt	= "DNS TXT entry:";
156
	$l_le_challenge		= "Challenge:";
160
	$l_le_challenge		= "Challenge:";
157
	$l_recheck		= "Recheck";
161
	$l_recheck		= "Recheck";
158
	$l_cancel		= "Cancel";
162
	$l_cancel		= "Cancel";
159
	$l_le_api		= "API:";
163
	$l_le_api		= "API:";
160
	$l_le_next_renewal	= "Next renewal:";
164
	$l_le_next_renewal	= "Next renewal:";
161
	$l_renew		= "Renew";
165
	$l_renew		= "Renew";
162
	$l_renew_force		= "Renew (force)";
166
	$l_renew_force		= "Renew (force)";
163
}
167
}
164
 
168
 
165
$reg_ip      = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
169
$reg_ip      = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
166
$reg_ip_cidr = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/';
170
$reg_ip_cidr = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/';
167
$reg_mac     = '/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/';
171
$reg_mac     = '/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/';
168
$reg_host    = '/^[a-zA-Z0-9-_]+$/';
172
$reg_host    = '/^[a-zA-Z0-9-_]+$/';
169
 
173
 
170
$choix = (isset($_POST['choix'])) ? $_POST['choix'] : '';
174
$choix = (isset($_POST['choix'])) ? $_POST['choix'] : '';
171
 
175
 
172
switch ($choix) {
176
switch ($choix) {
173
	case 'DHCP_On':
177
	case 'DHCP_On':
174
		exec('sudo /usr/local/bin/alcasar-dhcp.sh -on');
178
		exec('sudo /usr/local/bin/alcasar-dhcp.sh -on');
175
		header('Location: '.$_SERVER['PHP_SELF']);
179
		header('Location: '.$_SERVER['PHP_SELF']);
176
		exit();
180
		exit();
177
	case 'DHCP_Off':
181
	case 'DHCP_Off':
178
		exec('sudo /usr/local/bin/alcasar-dhcp.sh -off');
182
		exec('sudo /usr/local/bin/alcasar-dhcp.sh -off');
179
		header('Location: '.$_SERVER['PHP_SELF']);
183
		header('Location: '.$_SERVER['PHP_SELF']);
180
		exit();
184
		exit();
181
 
185
 
182
	case 'new_mac':
186
	case 'new_mac':
183
		$new_mac_addr = trim($_POST['add_mac']);
187
		$new_mac_addr = trim($_POST['add_mac']);
184
		$new_ip_addr  = trim($_POST['add_ip']);
188
		$new_ip_addr  = trim($_POST['add_ip']);
185
		if (((!empty($new_mac_addr)) && (preg_match($reg_mac, $new_mac_addr))) && ((!empty($new_ip_addr)) && (preg_match($reg_ip, $new_ip_addr)))) {
189
		if (((!empty($new_mac_addr)) && (preg_match($reg_mac, $new_mac_addr))) && ((!empty($new_ip_addr)) && (preg_match($reg_ip, $new_ip_addr)))) {
186
			$tab = file(ETHERS_FILE);
190
			$tab = file(ETHERS_FILE);
187
			if ($tab) { // the file isn't empty
191
			if ($tab) { // the file isn't empty
188
				$insert = true;
192
				$insert = true;
189
				foreach ($tab as $line) { // verify that MAC or IP address doesn't exist
193
				foreach ($tab as $line) { // verify that MAC or IP address doesn't exist
190
					$field = explode(' ', $line);
194
					$field = explode(' ', $line);
191
					$mac_addr = trim($field[0]);
195
					$mac_addr = trim($field[0]);
192
					$ip_addr  = trim($field[1]);
196
					$ip_addr  = trim($field[1]);
193
					if (strcasecmp($new_mac_addr, $mac_addr) === 0) {
197
					if (strcasecmp($new_mac_addr, $mac_addr) === 0) {
194
						$insert = false;
198
						$insert = false;
195
						break;
199
						break;
196
					}
200
					}
197
					if (strcasecmp($new_ip_addr, $ip_addr) === 0) {
201
					if (strcasecmp($new_ip_addr, $ip_addr) === 0) {
198
						$insert = false;
202
						$insert = false;
199
						break;
203
						break;
200
					}
204
					}
201
				}
205
				}
202
				if ($insert) {
206
				if ($insert) {
203
					$line = $new_mac_addr . ' ' . $new_ip_addr . "\n";
207
					$line = $new_mac_addr . ' ' . $new_ip_addr . "\n";
204
					$pointeur = fopen(ETHERS_FILE, 'a');
208
					$pointeur = fopen(ETHERS_FILE, 'a');
205
					fwrite($pointeur, $line);
209
					fwrite($pointeur, $line);
206
					fclose($pointeur);
210
					fclose($pointeur);
207
					$pointeur = fopen(ETHERS_INFO_FILE, 'a');
211
					$pointeur = fopen(ETHERS_INFO_FILE, 'a');
208
					$line = "$new_mac_addr $new_ip_addr #" . trim($_POST['info'],"\x00..\x20") . "\n";
212
					$line = "$new_mac_addr $new_ip_addr #" . trim($_POST['info'],"\x00..\x20") . "\n";
209
					fwrite($pointeur, $line);
213
					fwrite($pointeur, $line);
210
					fclose($pointeur);
214
					fclose($pointeur);
211
					exec('sudo /usr/bin/systemctl reload chilli');
215
					exec('sudo /usr/bin/systemctl reload chilli');
212
				}
216
				}
213
			}
217
			}
214
		}
218
		}
215
		header('Location: '.$_SERVER['PHP_SELF']);
219
		header('Location: '.$_SERVER['PHP_SELF']);
216
		exit();
220
		exit();
217
	case 'del_mac':
221
	case 'del_mac':
218
		foreach ($_POST as $key => $value) {
222
		foreach ($_POST as $key => $value) {
219
			if ($value == 'on') {
223
			if ($value == 'on') {
220
				$ether_file = ETHERS_FILE;
224
				$ether_file = ETHERS_FILE;
221
				$ether_file_info = ETHERS_INFO_FILE;
225
				$ether_file_info = ETHERS_INFO_FILE;
222
				exec("/bin/sed -i ".escapeshellarg("/^$key/d")." $ether_file");
226
				exec("/bin/sed -i ".escapeshellarg("/^$key/d")." $ether_file");
223
				exec("/bin/sed -i ".escapeshellarg("/^$key/d")." $ether_file_info");
227
				exec("/bin/sed -i ".escapeshellarg("/^$key/d")." $ether_file_info");
224
				exec('sudo /usr/bin/systemctl reload chilli');
228
				exec('sudo /usr/bin/systemctl reload chilli');
225
			}
229
			}
226
		}
230
		}
227
		header('Location: '.$_SERVER['PHP_SELF']);
231
		header('Location: '.$_SERVER['PHP_SELF']);
228
		exit();
232
		exit();
229
 
233
 
230
	case 'dhcp_relay':	// DHCP relay
234
	case 'dhcp_relay':	// DHCP relay
231
		// TODO : check DHCP relay before apply?
235
		// TODO : check DHCP relay before apply?
232
		file_put_contents(CONF_FILE, str_replace('EXT_DHCP_IP='.$conf['EXT_DHCP_IP'],         'EXT_DHCP_IP='.trim($_POST['dhcp_relay_ext_ip']),   file_get_contents(CONF_FILE)));
236
		file_put_contents(CONF_FILE, str_replace('EXT_DHCP_IP='.$conf['EXT_DHCP_IP'],         'EXT_DHCP_IP='.trim($_POST['dhcp_relay_ext_ip']),   file_get_contents(CONF_FILE)));
233
		file_put_contents(CONF_FILE, str_replace('RELAY_DHCP_IP='.$conf['RELAY_DHCP_IP'],     'RELAY_DHCP_IP='.trim($_POST['dhcp_relay_ip']),     file_get_contents(CONF_FILE)));
237
		file_put_contents(CONF_FILE, str_replace('RELAY_DHCP_IP='.$conf['RELAY_DHCP_IP'],     'RELAY_DHCP_IP='.trim($_POST['dhcp_relay_ip']),     file_get_contents(CONF_FILE)));
234
		file_put_contents(CONF_FILE, str_replace('RELAY_DHCP_PORT='.$conf['RELAY_DHCP_PORT'], 'RELAY_DHCP_PORT='.trim($_POST['dhcp_relay_port']), file_get_contents(CONF_FILE)));
238
		file_put_contents(CONF_FILE, str_replace('RELAY_DHCP_PORT='.$conf['RELAY_DHCP_PORT'], 'RELAY_DHCP_PORT='.trim($_POST['dhcp_relay_port']), file_get_contents(CONF_FILE)));
235
		header('Location: '.$_SERVER['PHP_SELF']);
239
		header('Location: '.$_SERVER['PHP_SELF']);
236
		exit();
240
		exit();
237
 
241
 
238
	case 'new_host':
242
	case 'new_host':
239
		$add_host = trim($_POST['add_host']);
243
		$add_host = trim($_POST['add_host']);
240
		$add_ip   = trim($_POST['add_ip']);
244
		$add_ip   = trim($_POST['add_ip']);
241
		if (((!empty($add_host)) && (preg_match($reg_host, $add_host))) && ((!empty($add_ip)) && (preg_match($reg_ip, $add_ip)))) {
245
		if (((!empty($add_host)) && (preg_match($reg_host, $add_host))) && ((!empty($add_ip)) && (preg_match($reg_ip, $add_ip)))) {
242
			$tab = file(DNS_LOCAL_FILE);
246
			$tab = file(DNS_LOCAL_FILE);
243
			if ($tab) { // the file isn't empty
247
			if ($tab) { // the file isn't empty
244
				$insert = true;
248
				$insert = true;
245
				foreach ($tab as $line) { // verify that host or IP address doesn't exist
249
				foreach ($tab as $line) { // verify that host or IP address doesn't exist
246
					if (preg_match('/^\d+/', $line)) {
250
					if (preg_match('/^\d+/', $line)) {
247
						$field = preg_split("/\s+/",$line);
251
						$field = preg_split("/\s+/",$line);
248
						$ip_addr = $field[0];
252
						$ip_addr = $field[0];
249
						$host_name = trim($field[1]);
253
						$host_name = trim($field[1]);
250
						if (strcasecmp($add_host, $host_name) === 0) {
254
						if (strcasecmp($add_host, $host_name) === 0) {
251
							$insert = false;
255
							$insert = false;
252
							break;
256
							break;
253
						}
257
						}
254
					}
258
					}
255
				}
259
				}
256
				if ($insert) {
260
				if ($insert) {
257
					exec("sudo /usr/local/bin/alcasar-dns-local.sh --add $add_ip $add_host");
261
					exec("sudo /usr/local/bin/alcasar-dns-local.sh --add $add_ip $add_host");
258
				}
262
				}
259
			}
263
			}
260
		}
264
		}
261
		header('Location: '.$_SERVER['PHP_SELF']);
265
		header('Location: '.$_SERVER['PHP_SELF']);
262
		exit();
266
		exit();
263
	case 'del_host':
267
	case 'del_host':
264
		foreach ($_POST as $key => $value) {
268
		foreach ($_POST as $key => $value) {
265
			if ($value == 'on') {
269
			if ($value == 'on') {
266
				$del_host = explode ("|", $key);
270
				$del_host = explode ("|", $key);
267
				$del_ip = str_replace("_",".",$del_host[0]);
271
				$del_ip = str_replace("_",".",$del_host[0]);
268
				exec("sudo /usr/local/bin/alcasar-dns-local.sh --del $del_ip $del_host[1]");
272
				exec("sudo /usr/local/bin/alcasar-dns-local.sh --del $del_ip $del_host[1]");
269
			}
273
			}
270
		}
274
		}
271
		header('Location: '.$_SERVER['PHP_SELF']);
275
		header('Location: '.$_SERVER['PHP_SELF']);
272
		exit();
276
		exit();
273
 
277
 
-
 
278
	case 'dns_internal':	// Internal DNS
-
 
279
		// TODO : check @IP / domain before apply? (can break DNS server and shut down the Internet!)
-
 
280
		file_put_contents(CONF_FILE, str_replace('INT_DNS_IP='.$conf['INT_DNS_IP'],         'INT_DNS_IP='.trim($_POST['dns_internal_ip']),         file_get_contents(CONF_FILE)));
-
 
281
		file_put_contents(CONF_FILE, str_replace('INT_DNS_DOMAIN='.$conf['INT_DNS_DOMAIN'], 'INT_DNS_DOMAIN='.trim($_POST['dns_internal_domain']), file_get_contents(CONF_FILE)));
-
 
282
		if ($_POST['dns_internal_active'] === 'on') {
-
 
283
			exec('sudo /usr/local/bin/alcasar-dns-local.sh --on');
-
 
284
		} else {
-
 
285
			exec('sudo /usr/local/bin/alcasar-dns-local.sh --off');
-
 
286
		}
-
 
287
		header('Location: '.$_SERVER['PHP_SELF']);
-
 
288
		exit();
-
 
289
 
274
	case 'default_cert':	// Restore default certificate
290
	case 'default_cert':	// Restore default certificate
275
		exec('sudo alcasar-importcert.sh -d');
291
		exec('sudo alcasar-importcert.sh -d');
276
		break;
292
		break;
277
 
293
 
278
	case 'import_cert':	// Import certificate
294
	case 'import_cert':	// Import certificate
279
		$maxsize = 100000;
295
		$maxsize = 100000;
280
		if (isset($_FILES['key']) && isset($_FILES['crt']) && ($_FILES['key']['error'] == 0) && ($_FILES['crt']['error'] == 0)) {
296
		if (isset($_FILES['key']) && isset($_FILES['crt']) && ($_FILES['key']['error'] == 0) && ($_FILES['crt']['error'] == 0)) {
281
			if ($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize) {
297
			if ($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize) {
282
				if (pathinfo($_FILES['key']['name'])['extension'] == 'key' && ((pathinfo($_FILES['crt']['name'])['extension'] == 'crt') || (pathinfo($_FILES['crt']['name'])['extension'] == 'cer'))) {
298
				if (pathinfo($_FILES['key']['name'])['extension'] == 'key' && ((pathinfo($_FILES['crt']['name'])['extension'] == 'crt') || (pathinfo($_FILES['crt']['name'])['extension'] == 'cer'))) {
283
					$dest = '/tmp/';
299
					$dest = '/tmp/';
284
					$scpath = '';
300
					$scpath = '';
285
					if (isset($_FILES['sc']) && ((pathinfo($_FILES['sc']['name'])['extension'] == 'crt') || (pathinfo($_FILES['sc']['name'])['extension'] == 'cer'))) {
301
					if (isset($_FILES['sc']) && ((pathinfo($_FILES['sc']['name'])['extension'] == 'crt') || (pathinfo($_FILES['sc']['name'])['extension'] == 'cer'))) {
286
						$scpath = $dest.'server-chain.crt';
302
						$scpath = $dest.'server-chain.crt';
287
						move_uploaded_file($_FILES['sc']['tmp_name'], $scpath);
303
						move_uploaded_file($_FILES['sc']['tmp_name'], $scpath);
288
					}
304
					}
289
					$keypath = $dest.'alcasar.key';
305
					$keypath = $dest.'alcasar.key';
290
					$crtpath = $dest.'alcasar.crt';
306
					$crtpath = $dest.'alcasar.crt';
291
					move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
307
					move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
292
					move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
308
					move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
293
					exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
309
					exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
294
					if (file_exists($crtpath)) unlink($crtpath);
310
					if (file_exists($crtpath)) unlink($crtpath);
295
					if (file_exists($keypath)) unlink($keypath);
311
					if (file_exists($keypath)) unlink($keypath);
296
					if (file_exists($scpath))  unlink($scpath);
312
					if (file_exists($scpath))  unlink($scpath);
297
				}
313
				}
298
			}
314
			}
299
		}
315
		}
300
		break;
316
		break;
301
 
317
 
302
	case 'https_login':	// Set HTTPS login status
318
	case 'https_login':	// Set HTTPS login status
303
		if ($_POST['https_login'] === 'on') {
319
		if ($_POST['https_login'] === 'on') {
304
			exec('sudo /usr/local/bin/alcasar-https.sh --on');
320
			exec('sudo /usr/local/bin/alcasar-https.sh --on');
305
		} else {
321
		} else {
306
			exec('sudo /usr/local/bin/alcasar-https.sh --off');
322
			exec('sudo /usr/local/bin/alcasar-https.sh --off');
307
		}
323
		}
308
		header('Location: '.$_SERVER['PHP_SELF']);
324
		header('Location: '.$_SERVER['PHP_SELF']);
309
		exit();
325
		exit();
310
}
326
}
311
 
327
 
312
// Network changes
328
// Network changes
313
if ($choix === 'network_change') {
329
if ($choix === 'network_change') {
314
	$network_modification = false;
330
	$network_modification = false;
315
 
331
 
316
	if (isset($_POST['dns1']) && (trim($_POST['dns1']) !== $conf['DNS1']) && preg_match($reg_ip, $_POST['dns1'])) {
332
	if (isset($_POST['dns1']) && (trim($_POST['dns1']) !== $conf['DNS1']) && preg_match($reg_ip, $_POST['dns1'])) {
317
		file_put_contents(CONF_FILE, str_replace('DNS1='.$conf['DNS1'], 'DNS1='.trim($_POST['dns1']), file_get_contents(CONF_FILE)));
333
		file_put_contents(CONF_FILE, str_replace('DNS1='.$conf['DNS1'], 'DNS1='.trim($_POST['dns1']), file_get_contents(CONF_FILE)));
318
		$network_modification = true;
334
		$network_modification = true;
319
	}
335
	}
320
	if (isset($_POST['dns2']) && (trim($_POST['dns2']) !== $conf['DNS2']) && preg_match($reg_ip, $_POST['dns2'])) {
336
	if (isset($_POST['dns2']) && (trim($_POST['dns2']) !== $conf['DNS2']) && preg_match($reg_ip, $_POST['dns2'])) {
321
		file_put_contents(CONF_FILE, str_replace('DNS2='.$conf['DNS2'], 'DNS2='.trim($_POST['dns2']), file_get_contents(CONF_FILE)));
337
		file_put_contents(CONF_FILE, str_replace('DNS2='.$conf['DNS2'], 'DNS2='.trim($_POST['dns2']), file_get_contents(CONF_FILE)));
322
		$network_modification = true;
338
		$network_modification = true;
323
	}
339
	}
324
	if (isset($_POST['ip_public']) && (trim($_POST['ip_public']) !== $conf['PUBLIC_IP']) && preg_match($reg_ip_cidr, $_POST['ip_public'])) {
340
	if (isset($_POST['ip_public']) && (trim($_POST['ip_public']) !== $conf['PUBLIC_IP']) && preg_match($reg_ip_cidr, $_POST['ip_public'])) {
325
		file_put_contents(CONF_FILE, str_replace('PUBLIC_IP='.$conf['PUBLIC_IP'], 'PUBLIC_IP='.trim($_POST['ip_public']), file_get_contents(CONF_FILE)));
341
		file_put_contents(CONF_FILE, str_replace('PUBLIC_IP='.$conf['PUBLIC_IP'], 'PUBLIC_IP='.trim($_POST['ip_public']), file_get_contents(CONF_FILE)));
326
		$network_modification = true;
342
		$network_modification = true;
327
	}
343
	}
328
	if (isset($_POST['ip_gw']) && (trim($_POST['ip_gw']) !== $conf['GW']) && preg_match($reg_ip, $_POST['ip_gw'])) {
344
	if (isset($_POST['ip_gw']) && (trim($_POST['ip_gw']) !== $conf['GW']) && preg_match($reg_ip, $_POST['ip_gw'])) {
329
		file_put_contents(CONF_FILE, str_replace('GW='.$conf['GW'], 'GW='.trim($_POST['ip_gw']), file_get_contents(CONF_FILE)));
345
		file_put_contents(CONF_FILE, str_replace('GW='.$conf['GW'], 'GW='.trim($_POST['ip_gw']), file_get_contents(CONF_FILE)));
330
		$network_modification = true;
346
		$network_modification = true;
331
	}
347
	}
332
	if (isset($_POST['ip_private']) && (trim($_POST['ip_private']) !== $conf['PRIVATE_IP']) && preg_match($reg_ip_cidr, $_POST['ip_private'])) {
348
	if (isset($_POST['ip_private']) && (trim($_POST['ip_private']) !== $conf['PRIVATE_IP']) && preg_match($reg_ip_cidr, $_POST['ip_private'])) {
333
		file_put_contents(CONF_FILE, str_replace('PRIVATE_IP='.$conf['PRIVATE_IP'], 'PRIVATE_IP='.trim($_POST['ip_private']), file_get_contents(CONF_FILE)));
349
		file_put_contents(CONF_FILE, str_replace('PRIVATE_IP='.$conf['PRIVATE_IP'], 'PRIVATE_IP='.trim($_POST['ip_private']), file_get_contents(CONF_FILE)));
334
		$network_modification = true;
350
		$network_modification = true;
335
	}
351
	}
336
 
352
 
337
	if ($network_modification) {
353
	if ($network_modification) {
338
		exec('sudo /usr/local/bin/alcasar-conf.sh -apply');
354
		exec('sudo /usr/local/bin/alcasar-conf.sh -apply');
339
	}
355
	}
340
 
356
 
341
	// Read CONF_FILE updated
357
	// Read CONF_FILE updated
342
	$file_conf = fopen(CONF_FILE, 'r');
358
	$file_conf = fopen(CONF_FILE, 'r');
343
	if (!$file_conf) {
359
	if (!$file_conf) {
344
		exit('Error opening the file '.CONF_FILE);
360
		exit('Error opening the file '.CONF_FILE);
345
	}
361
	}
346
	while (!feof($file_conf)) {
362
	while (!feof($file_conf)) {
347
		$buffer = fgets($file_conf, 4096);
363
		$buffer = fgets($file_conf, 4096);
348
		if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
364
		if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
349
			$tmp = explode('=', $buffer, 2);
365
			$tmp = explode('=', $buffer, 2);
350
			$conf[trim($tmp[0])] = trim($tmp[1]);
366
			$conf[trim($tmp[0])] = trim($tmp[1]);
351
		}
367
		}
352
	}
368
	}
353
	fclose($file_conf);
369
	fclose($file_conf);
354
}
370
}
355
 
371
 
356
// Let's Encrypt actions
372
// Let's Encrypt actions
357
if ($choix === 'le_issueCert') {
373
if ($choix === 'le_issueCert') {
358
	// TODO: check ndd & mail format
374
	// TODO: check ndd & mail format
359
 
375
 
360
	$email      = $_POST['email'];
376
	$email      = $_POST['email'];
361
	$domainName = $_POST['domainname'];
377
	$domainName = $_POST['domainname'];
362
 
378
 
363
	exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
379
	exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
364
 
380
 
365
	$cmdResponse = implode("<br>\n", $output);
381
	$cmdResponse = implode("<br>\n", $output);
366
}
382
}
367
if ($choix === 'le_renewCert') {
383
if ($choix === 'le_renewCert') {
368
	if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
384
	if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
369
		$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';
385
		$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';
370
 
386
 
371
		exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --renew' . $forceOpt, $output, $exitCode);
387
		exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --renew' . $forceOpt, $output, $exitCode);
372
 
388
 
373
		$cmdResponse = implode("<br>\n", $output);
389
		$cmdResponse = implode("<br>\n", $output);
374
	} else if ((isset($_POST['cancel'])) && (!empty($_POST['cancel']))) {
390
	} else if ((isset($_POST['cancel'])) && (!empty($_POST['cancel']))) {
375
		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/challenge=.*/','challenge=', file_get_contents(LETS_ENCRYPT_FILE)));
391
		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/challenge=.*/','challenge=', file_get_contents(LETS_ENCRYPT_FILE)));
376
		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/domainRequest=.*/','domainRequest=', file_get_contents(LETS_ENCRYPT_FILE)));
392
		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/domainRequest=.*/','domainRequest=', file_get_contents(LETS_ENCRYPT_FILE)));
377
	}
393
	}
378
}
394
}
379
 
395
 
380
 
396
 
381
// Read Let's Encrypt configuration file
397
// Read Let's Encrypt configuration file
382
$file_conf_LE = fopen(LETS_ENCRYPT_FILE, 'r');
398
$file_conf_LE = fopen(LETS_ENCRYPT_FILE, 'r');
383
if (!$file_conf_LE) {
399
if (!$file_conf_LE) {
384
	exit('Error opening the file '.LETS_ENCRYPT_FILE);
400
	exit('Error opening the file '.LETS_ENCRYPT_FILE);
385
}
401
}
386
while (!feof($file_conf_LE)) {
402
while (!feof($file_conf_LE)) {
387
	$buffer = fgets($file_conf_LE, 4096);
403
	$buffer = fgets($file_conf_LE, 4096);
388
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
404
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
389
		$tmp = explode('=', $buffer, 2);
405
		$tmp = explode('=', $buffer, 2);
390
		$LE_conf[trim($tmp[0])] = trim($tmp[1]);
406
		$LE_conf[trim($tmp[0])] = trim($tmp[1]);
391
	}
407
	}
392
}
408
}
393
fclose($file_conf_LE);
409
fclose($file_conf_LE);
394
 
410
 
395
 
411
 
396
// Fonction de test de connectivité internet
412
// Fonction de test de connectivité internet
397
function internetTest() {
413
function internetTest() {
398
	$host = 'www.google.fr'; # Google Test
414
	$host = 'www.google.fr'; # Google Test
399
	$port = '80';
415
	$port = '80';
400
 
416
 
401
	if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
417
	if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
402
		return false;
418
		return false;
403
	} else {
419
	} else {
404
		fclose($sock);
420
		fclose($sock);
405
		return true;
421
		return true;
406
	}
422
	}
407
}
423
}
408
 
424
 
409
$internet_connected = InternetTest();
425
$internet_connected = InternetTest();
410
if ($internet_connected) {
426
if ($internet_connected) {
411
	$ch = curl_init('https://api.ipify.org/');
427
	$ch = curl_init('https://api.ipify.org/');
412
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
428
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
413
	$internet_publicIP = curl_exec($ch);
429
	$internet_publicIP = curl_exec($ch);
414
	curl_close($ch);
430
	curl_close($ch);
415
} else {
431
} else {
416
	$internet_publicIP = '-.-.-.-';
432
	$internet_publicIP = '-.-.-.-';
417
}
433
}
418
 
434
 
419
 
435
 
420
// Network interfaces
436
// Network interfaces
421
$interfacesIgnored = ['lo', 'tun[0-9]*', $conf['EXTIF'], $conf['INTIF']];
437
$interfacesIgnored = ['lo', 'tun[0-9]*', $conf['EXTIF'], $conf['INTIF']];
422
exec("ip -o link show | awk -F': ' '{print $2}' | sed '/^" . implode('\\|', $interfacesIgnored) . "$/d'", $interfacesAvailable);
438
exec("ip -o link show | awk -F': ' '{print $2}' | sed '/^" . implode('\\|', $interfacesIgnored) . "$/d'", $interfacesAvailable);
423
 
439
 
424
// TODO: Pending the next version
440
// TODO: Pending the next version
425
$externalNetworks = [
441
$externalNetworks = [
426
	(object) [
442
	(object) [
427
		'interface' => $conf['EXTIF'],
443
		'interface' => $conf['EXTIF'],
428
		'ip'        => $conf['PUBLIC_IP'],
444
		'ip'        => $conf['PUBLIC_IP'],
429
		'gateway'   => $conf['GW']
445
		'gateway'   => $conf['GW']
430
	]
446
	]
431
];
447
];
432
$internalNetworks = [
448
$internalNetworks = [
433
	(object) [
449
	(object) [
434
		'interface' => $conf['INTIF'],
450
		'interface' => $conf['INTIF'],
435
		'ip'        => $conf['PRIVATE_IP']
451
		'ip'        => $conf['PRIVATE_IP']
436
	]
452
	]
437
];
453
];
438
 
454
 
439
?>
455
?>
440
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
456
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
441
<html>
457
<html>
442
<head>
458
<head>
443
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
459
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
444
	<title><?= $l_network_title ?></title>
460
	<title><?= $l_network_title ?></title>
445
	<link rel="stylesheet" href="/css/style.css" type="text/css">
461
	<link rel="stylesheet" href="/css/style.css" type="text/css">
446
	<link rel="stylesheet" href="/css/acc.css" type="text/css">
462
	<link rel="stylesheet" href="/css/acc.css" type="text/css">
447
	<script src="/js/jquery.min.js"></script>
463
	<script src="/js/jquery.min.js"></script>
448
	<script src="/js/jquery.connections.js"></script>
464
	<script src="/js/jquery.connections.js"></script>
449
	<script type="text/javascript">
465
	<script type="text/javascript">
450
	function MAC_Control(formulaire){
466
	function MAC_Control(formulaire){
451
		// MAC control (upper case and '-' separator)
467
		// MAC control (upper case and '-' separator)
452
		var regex_mac = /^([0-9a-fA-F]{2}(-|:)){5}[0-9a-fA-F]{2}$/;
468
		var regex_mac = /^([0-9a-fA-F]{2}(-|:)){5}[0-9a-fA-F]{2}$/;
453
		if (regex_mac.test(document.forms[formulaire].add_mac.value)){
469
		if (regex_mac.test(document.forms[formulaire].add_mac.value)){
454
			document.forms[formulaire].add_mac.value = document.forms[formulaire].add_mac.value.toUpperCase().replace(/:/g, '-');
470
			document.forms[formulaire].add_mac.value = document.forms[formulaire].add_mac.value.toUpperCase().replace(/:/g, '-');
455
			return true;
471
			return true;
456
		} else {
472
		} else {
457
			alert('Invalid MAC address');
473
			alert('Invalid MAC address');
458
			return false;
474
			return false;
459
		}
475
		}
460
	}
476
	}
461
	</script>
477
	</script>
462
	<style>
478
	<style>
463
	.network-configurator {
479
	.network-configurator {
464
		width: 100%;
480
		width: 100%;
465
	}
481
	}
466
	.network-configurator > * {
482
	.network-configurator > * {
467
		display: inline-block;
483
		display: inline-block;
468
		vertical-align: top;
484
		vertical-align: top;
469
		text-align: center;
485
		text-align: center;
470
	}
486
	}
471
	.network-configurator > .internet, .network-configurator > .alcasar {
487
	.network-configurator > .internet, .network-configurator > .alcasar {
472
		width: 20%;
488
		width: 20%;
473
	}
489
	}
474
	.network-configurator > .externals, .network-configurator > .internals {
490
	.network-configurator > .externals, .network-configurator > .internals {
475
		width: 30%;
491
		width: 30%;
476
	}
492
	}
477
	.network-configurator .actions {
493
	.network-configurator .actions {
478
		position: absolute;
494
		position: absolute;
479
		background-color: #ddd;
495
		background-color: #ddd;
480
		padding: 0 2px;
496
		padding: 0 2px;
481
	}
497
	}
482
	.network-configurator .actions a {
498
	.network-configurator .actions a {
483
		text-decoration: none;
499
		text-decoration: none;
484
	}
500
	}
485
	.network-configurator .actions a:hover {
501
	.network-configurator .actions a:hover {
486
		font-weight: bold;
502
		font-weight: bold;
487
	}
503
	}
488
	.network-configurator > .alcasar .actions-externals {
504
	.network-configurator > .alcasar .actions-externals {
489
		bottom: 0;
505
		bottom: 0;
490
		left: 0;
506
		left: 0;
491
		border-radius: 0 5px;
507
		border-radius: 0 5px;
492
	}
508
	}
493
	.network-configurator > .alcasar .actions-internals {
509
	.network-configurator > .alcasar .actions-internals {
494
		bottom: 0;
510
		bottom: 0;
495
		right: 0;
511
		right: 0;
496
		border-radius: 5px 0;
512
		border-radius: 5px 0;
497
	}
513
	}
498
	.network-configurator .actions-network {
514
	.network-configurator .actions-network {
499
		top: 0;
515
		top: 0;
500
		right: 0;
516
		right: 0;
501
		border-radius: 0 5px;
517
		border-radius: 0 5px;
502
	}
518
	}
503
	.network-configurator .network-box {
519
	.network-configurator .network-box {
504
		display: inline-block;
520
		display: inline-block;
505
		min-height: 100px;
521
		min-height: 100px;
506
		margin: 5px;
522
		margin: 5px;
507
		padding: 3px;
523
		padding: 3px;
508
		text-align: left;
524
		text-align: left;
509
		background-color: #f7f3ef;
525
		background-color: #f7f3ef;
510
		position: relative;
526
		position: relative;
511
		border-radius: 5px;
527
		border-radius: 5px;
512
		border: 2px solid grey;
528
		border: 2px solid grey;
513
	}
529
	}
514
	.network-configurator .network-connector {
530
	.network-configurator .network-connector {
515
		display: inline-block;
531
		display: inline-block;
516
		position: absolute;
532
		position: absolute;
517
		top: 50%;
533
		top: 50%;
518
		margin-top: -5px;
534
		margin-top: -5px;
519
		margin-left: -5px;
535
		margin-left: -5px;
520
		width: 10px;
536
		width: 10px;
521
		height: 10px;
537
		height: 10px;
522
		border-radius: 5px;
538
		border-radius: 5px;
523
		background-color: black;
539
		background-color: black;
524
	}
540
	}
525
	.network-configurator .network-connector[data-connector-direction="left"] {
541
	.network-configurator .network-connector[data-connector-direction="left"] {
526
		border-radius: 5px 0px 0px 5px;
542
		border-radius: 5px 0px 0px 5px;
527
	}
543
	}
528
	.network-configurator .network-connector[data-connector-direction="right"] {
544
	.network-configurator .network-connector[data-connector-direction="right"] {
529
		border-radius: 0px 5px 5px 0px;
545
		border-radius: 0px 5px 5px 0px;
530
	}
546
	}
531
	.network-configurator div[data-network-type] {
547
	.network-configurator div[data-network-type] {
532
		position: relative;
548
		position: relative;
533
	}
549
	}
534
	</style>
550
	</style>
535
	<script>
551
	<script>
536
	$(document).ready(function () {
552
	$(document).ready(function () {
537
		const interfacesAvailable = <?= ((!empty($interfacesAvailable)) ? "['".implode("', '", $interfacesAvailable)."']" : '[]') ?>;
553
		const interfacesAvailable = <?= ((!empty($interfacesAvailable)) ? "['".implode("', '", $interfacesAvailable)."']" : '[]') ?>;
538
 
554
 
539
		const wireStyles = {
555
		const wireStyles = {
540
			available: { border: '5px double green' }
556
			available: { border: '5px double green' }
541
		};
557
		};
542
 
558
 
543
		// Add external network
559
		// Add external network
544
		$('.network-configurator .add-external-network').click(function (event) {
560
		$('.network-configurator .add-external-network').click(function (event) {
545
			event.preventDefault();
561
			event.preventDefault();
546
			let options = '';
562
			let options = '';
547
			if (interfacesAvailable.length === 0) {
563
			if (interfacesAvailable.length === 0) {
548
				options = '<option value=""></option>';
564
				options = '<option value=""></option>';
549
			} else {
565
			} else {
550
				for (let i = 0; i < interfacesAvailable.length; i++) {
566
				for (let i = 0; i < interfacesAvailable.length; i++) {
551
					options += '<option value="' + interfacesAvailable[i] + '">' + interfacesAvailable[i] + '</option>';
567
					options += '<option value="' + interfacesAvailable[i] + '">' + interfacesAvailable[i] + '</option>';
552
				}
568
				}
553
			}
569
			}
554
			$('.network-configurator .externals').append(' \
570
			$('.network-configurator .externals').append(' \
555
				<div data-network-type="external"> \
571
				<div data-network-type="external"> \
556
					<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div> \
572
					<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div> \
557
					<div class="network-box"> \
573
					<div class="network-box"> \
558
						<div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> \
574
						<div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> \
559
						<label for="ext_interface_X"><?= 'Interface' ?></label> <select name="interface" id="ext_interface_X">' + options + '</select><br> \
575
						<label for="ext_interface_X"><?= 'Interface' ?></label> <select name="interface" id="ext_interface_X">' + options + '</select><br> \
560
						<label for="ext_ip_X"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_public" id="ext_ip_X" value="" /><br> \
576
						<label for="ext_ip_X"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_public" id="ext_ip_X" value="" /><br> \
561
						<label for="ext_gateway_X"><?= $l_ip_router ?></label> <input style="width:120px" type="text" name="ip_gw" id="ext_gateway_X" value="" /> \
577
						<label for="ext_gateway_X"><?= $l_ip_router ?></label> <input style="width:120px" type="text" name="ip_gw" id="ext_gateway_X" value="" /> \
562
					</div> \
578
					</div> \
563
					<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div> \
579
					<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div> \
564
				</div>');
580
				</div>');
565
			addWire($('div[data-network-type="external"]:last'));
581
			addWire($('div[data-network-type="external"]:last'));
566
		});
582
		});
567
 
583
 
568
		// Add internal network
584
		// Add internal network
569
		$('.network-configurator .add-internal-network').click(function (event) {
585
		$('.network-configurator .add-internal-network').click(function (event) {
570
			event.preventDefault();
586
			event.preventDefault();
571
			$('.network-configurator .internals').append(' \
587
			$('.network-configurator .internals').append(' \
572
					<div data-network-type="internal"> \
588
					<div data-network-type="internal"> \
573
						<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div> \
589
						<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div> \
574
						<div class="network-box"> \
590
						<div class="network-box"> \
575
							<div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> \
591
							<div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> \
576
							<label for="int_interface_X"><?= 'Interface' ?></label> <select name="interface" id="int_interface_X" disabled><option value=""></option></select><br> \
592
							<label for="int_interface_X"><?= 'Interface' ?></label> <select name="interface" id="int_interface_X" disabled><option value=""></option></select><br> \
577
							<label for="int_ip_X"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_private" id="int_ip_X" value="" /><br> \
593
							<label for="int_ip_X"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_private" id="int_ip_X" value="" /><br> \
578
						</div> \
594
						</div> \
579
					</div>');
595
					</div>');
580
			addWire($('div[data-network-type="internal"]:last'));
596
			addWire($('div[data-network-type="internal"]:last'));
581
		});
597
		});
582
 
598
 
583
		// Remove network
599
		// Remove network
584
		$('.network-configurator').on('click', '.remove-network', function (event) {
600
		$('.network-configurator').on('click', '.remove-network', function (event) {
585
			event.preventDefault();
601
			event.preventDefault();
586
			$(this).parent().parent().parent().fadeOut(200, function() {
602
			$(this).parent().parent().parent().fadeOut(200, function() {
587
				const networkType = $(this).data('networkType');
603
				const networkType = $(this).data('networkType');
588
				$(this).remove();
604
				$(this).remove();
589
 
605
 
590
				// Update wires
606
				// Update wires
591
				if (networkType === 'external') {
607
				if (networkType === 'external') {
592
					$('div[data-network-type="internet"]>div.network-connector[data-connector-network="internet"]').connections('update');
608
					$('div[data-network-type="internet"]>div.network-connector[data-connector-network="internet"]').connections('update');
593
					$('div[data-network-type="alcasar"]>div.network-connector[data-connector-network="external"]').connections('update');
609
					$('div[data-network-type="alcasar"]>div.network-connector[data-connector-network="external"]').connections('update');
594
				} else if (networkType === 'internal') {
610
				} else if (networkType === 'internal') {
595
					$('div[data-network-type="alcasar"]>div.network-connector[data-connector-network="internal"]').connections('update');
611
					$('div[data-network-type="alcasar"]>div.network-connector[data-connector-network="internal"]').connections('update');
596
				}
612
				}
597
			});
613
			});
598
		});
614
		});
599
 
615
 
600
		const addWire = function (network) {
616
		const addWire = function (network) {
601
			const networkType = network.data('networkType');
617
			const networkType = network.data('networkType');
602
			if (networkType === 'external') {
618
			if (networkType === 'external') {
603
				$().connections({ from: 'div[data-network-type="internet"]>div.network-connector[data-connector-network="internet"]', to: 'div[data-network-type="external"]>div.network-connector[data-connector-network="internet"]:last', css: wireStyles.available, within: 'div[data-network-type="external"]:last' });
619
				$().connections({ from: 'div[data-network-type="internet"]>div.network-connector[data-connector-network="internet"]', to: 'div[data-network-type="external"]>div.network-connector[data-connector-network="internet"]:last', css: wireStyles.available, within: 'div[data-network-type="external"]:last' });
604
				$().connections({ from: 'div[data-network-type="alcasar"]>div.network-connector[data-connector-network="external"]', to: 'div[data-network-type="external"]>div.network-connector[data-connector-network="external"]:last', css: wireStyles.available, within: 'div[data-network-type="external"]:last' });
620
				$().connections({ from: 'div[data-network-type="alcasar"]>div.network-connector[data-connector-network="external"]', to: 'div[data-network-type="external"]>div.network-connector[data-connector-network="external"]:last', css: wireStyles.available, within: 'div[data-network-type="external"]:last' });
605
			} else if (networkType === 'internal') {
621
			} else if (networkType === 'internal') {
606
				$().connections({ from: 'div[data-network-type="alcasar"]>div.network-connector[data-connector-network="internal"]', to: 'div[data-network-type="internal"]>div.network-connector[data-connector-network="internal"]:last', css: wireStyles.available, within: 'div[data-network-type="internal"]:last' });
622
				$().connections({ from: 'div[data-network-type="alcasar"]>div.network-connector[data-connector-network="internal"]', to: 'div[data-network-type="internal"]>div.network-connector[data-connector-network="internal"]:last', css: wireStyles.available, within: 'div[data-network-type="internal"]:last' });
607
			}
623
			}
608
		};
624
		};
609
 
625
 
610
		window.addEventListener('resize', function () {
626
		window.addEventListener('resize', function () {
611
			$('div.network-connector[data-connector-network]').connections('update');
627
			$('div.network-connector[data-connector-network]').connections('update');
612
		});
628
		});
613
 
629
 
614
		// Add wires to existing networks
630
		// Add wires to existing networks
615
		$('div[data-network-type="external"]').add('div[data-network-type="internal"]').each(function (index, element) {
631
		$('div[data-network-type="external"]').add('div[data-network-type="internal"]').each(function (index, element) {
616
			addWire($(this));
632
			addWire($(this));
617
		});
633
		});
618
	});
634
	});
619
	</script>
635
	</script>
620
</head>
636
</head>
621
<body>
637
<body>
622
	<div class="panel">
638
	<div class="panel">
623
		<div class="panel-header"><?= $l_network_title ?></div>
639
		<div class="panel-header"><?= $l_network_title ?></div>
624
		<div class="panel-body">
640
		<div class="panel-body">
625
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
641
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
626
				<div class="network-configurator">
642
				<div class="network-configurator">
627
					<div class="internet">
643
					<div class="internet">
628
						<div data-network-type="internet">
644
						<div data-network-type="internet">
629
							<div class="network-box">
645
							<div class="network-box">
630
								<?= $l_internet_legend ?> <img src="/images/state_<?= (($internet_connected) ? 'ok' : 'error') ?>.gif"><br>
646
								<?= $l_internet_legend ?> <img src="/images/state_<?= (($internet_connected) ? 'ok' : 'error') ?>.gif"><br>
631
								<?= $l_ip_public ?> : <?= $internet_publicIP ?><br>
647
								<?= $l_ip_public ?> : <?= $internet_publicIP ?><br>
632
								<label for="dns1"><?= $l_ip_dns1 ?></label> : <input style="width:120px" type="text" id="dns1" name="dns1" value="<?= $conf['DNS1'] ?>" /><br>
648
								<label for="dns1"><?= $l_ip_dns1 ?></label> : <input style="width:120px" type="text" id="dns1" name="dns1" value="<?= $conf['DNS1'] ?>" /><br>
633
								<label for="dns2"><?= $l_ip_dns2 ?></label> : <input style="width:120px" type="text" id="dns2" name="dns2" value="<?= $conf['DNS2'] ?>" />
649
								<label for="dns2"><?= $l_ip_dns2 ?></label> : <input style="width:120px" type="text" id="dns2" name="dns2" value="<?= $conf['DNS2'] ?>" />
634
							</div>
650
							</div>
635
							<div class="network-connector" data-connector-network="internet" data-connector-direction="right"></div>
651
							<div class="network-connector" data-connector-network="internet" data-connector-direction="right"></div>
636
						</div>
652
						</div>
637
					</div><div class="externals">
653
					</div><div class="externals">
638
						<?php foreach ($externalNetworks as $index => $network): ?>
654
						<?php foreach ($externalNetworks as $index => $network): ?>
639
							<div data-network-type="external">
655
							<div data-network-type="external">
640
								<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div>
656
								<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div>
641
								<div class="network-box">
657
								<div class="network-box">
642
									<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
658
									<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
643
									<label for="ext_interface_<?= $index ?>"><?= 'Interface' ?></label> <select name="ext_interface[<?= $index ?>]" id="ext_interface_<?= $index ?>" disabled><option value="<?= $network->interface ?>"><?= $network->interface ?></option></select><br>
659
									<label for="ext_interface_<?= $index ?>"><?= 'Interface' ?></label> <select name="ext_interface[<?= $index ?>]" id="ext_interface_<?= $index ?>" disabled><option value="<?= $network->interface ?>"><?= $network->interface ?></option></select><br>
644
									<label for="ext_ip_<?= $index ?>"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_public" id="ext_ip_<?= $index ?>" value="<?= $network->ip ?>" /><br>
660
									<label for="ext_ip_<?= $index ?>"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_public" id="ext_ip_<?= $index ?>" value="<?= $network->ip ?>" /><br>
645
									<label for="ext_gateway_<?= $index ?>"><?= $l_ip_router ?></label> <input style="width:120px" type="text" name="ip_gw" id="ext_gateway_<?= $index ?>" value="<?= $network->gateway ?>" />
661
									<label for="ext_gateway_<?= $index ?>"><?= $l_ip_router ?></label> <input style="width:120px" type="text" name="ip_gw" id="ext_gateway_<?= $index ?>" value="<?= $network->gateway ?>" />
646
								</div>
662
								</div>
647
								<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div>
663
								<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div>
648
							</div>
664
							</div>
649
						<? endforeach; ?>
665
						<? endforeach; ?>
650
					</div><div class="alcasar">
666
					</div><div class="alcasar">
651
						<div data-network-type="alcasar">
667
						<div data-network-type="alcasar">
652
							<div class="network-connector" data-connector-network="external" data-connector-direction="left"></div>
668
							<div class="network-connector" data-connector-network="external" data-connector-direction="left"></div>
653
							<div class="network-box">
669
							<div class="network-box">
654
								<!-- <div class="actions actions-externals">
670
								<!-- <div class="actions actions-externals">
655
									<div><a href="#" class="add-external-network" title="Ajouter un réseau externe">+</a></div>
671
									<div><a href="#" class="add-external-network" title="Ajouter un réseau externe">+</a></div>
656
								</div> -->
672
								</div> -->
657
								<div class="alcasar-logo"><img src="/images/logo-alcasar.png" style="width: 100px;height: 100px;"></div>
673
								<div class="alcasar-logo"><img src="/images/logo-alcasar.png" style="width: 100px;height: 100px;"></div>
658
								<!-- <div class="actions actions-internals">
674
								<!-- <div class="actions actions-internals">
659
									<div><a href="#" class="add-internal-network" title="Ajouter un réseau interne">+</a></div>
675
									<div><a href="#" class="add-internal-network" title="Ajouter un réseau interne">+</a></div>
660
									<div><a href="#" class="add-internal-wifi-network">++</a></div>
676
									<div><a href="#" class="add-internal-wifi-network">++</a></div>
661
								</div> -->
677
								</div> -->
662
							</div>
678
							</div>
663
							<div class="network-connector" data-connector-network="internal" data-connector-direction="right"></div>
679
							<div class="network-connector" data-connector-network="internal" data-connector-direction="right"></div>
664
						</div>
680
						</div>
665
					</div><div class="internals">
681
					</div><div class="internals">
666
						<?php foreach ($internalNetworks as $network): ?>
682
						<?php foreach ($internalNetworks as $network): ?>
667
							<div data-network-type="internal">
683
							<div data-network-type="internal">
668
								<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div>
684
								<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div>
669
								<div class="network-box">
685
								<div class="network-box">
670
									<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
686
									<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
671
									<label for="int_interface_<?= $index ?>"><?= 'Interface' ?></label> <select name="int_interface[<?= $index ?>]" id="int_interface_<?= $index ?>" disabled><option value="<?= $network->interface ?>"><?= $network->interface ?></option></select><br>
687
									<label for="int_interface_<?= $index ?>"><?= 'Interface' ?></label> <select name="int_interface[<?= $index ?>]" id="int_interface_<?= $index ?>" disabled><option value="<?= $network->interface ?>"><?= $network->interface ?></option></select><br>
672
									<label for="int_ip_<?= $index ?>"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_private" id="int_ip_<?= $index ?>" value="<?= $network->ip ?>" /><br>
688
									<label for="int_ip_<?= $index ?>"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_private" id="int_ip_<?= $index ?>" value="<?= $network->ip ?>" /><br>
673
								</div>
689
								</div>
674
							</div>
690
							</div>
675
						<? endforeach; ?>
691
						<? endforeach; ?>
676
					</div>
692
					</div>
677
				</div>
693
				</div>
678
				<hr>
694
				<hr>
679
				<div style="text-align: center; margin: 5px">
695
				<div style="text-align: center; margin: 5px">
680
					<input type="hidden" name="choix" value="network_change">
696
					<input type="hidden" name="choix" value="network_change">
681
					<input type="submit" value="<?= $l_apply ?>">
697
					<input type="submit" value="<?= $l_apply ?>">
682
				</div>
698
				</div>
683
			</form>
699
			</form>
684
		</div>
700
		</div>
685
	</div>
701
	</div>
686
	<br>
702
	<br>
687
 
703
 
688
<table width="100%" cellspacing="0" cellpadding="0" border="0">
704
<table width="100%" cellspacing="0" cellpadding="0" border="0">
689
	<tr><th><?= $l_dhcp_title?></th></tr>
705
	<tr><th><?= $l_dhcp_title?></th></tr>
690
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
706
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
691
</table>
707
</table>
692
<table width="100%" cellspacing="0" cellpadding="5" border="1">
708
<table width="100%" cellspacing="0" cellpadding="5" border="1">
693
	<tr><td colspan="2" valign="middle" align="left">
709
	<tr><td colspan="2" valign="middle" align="left">
694
	<center><h3><?= $l_dhcp_state ?> : <?= ${'l_DHCP_'.$conf['DHCP']} ?></h3></center>
710
	<center><h3><?= $l_dhcp_state ?> : <?= ${'l_DHCP_'.$conf['DHCP']} ?></h3></center>
695
	<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
711
	<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
696
		<select name="choix">
712
		<select name="choix">
697
			<option value="DHCP_Off"<?= ((!strcmp($conf['DHCP'], 'off')) ? ' selected' : '') ?>><?= $l_DHCP_off ?></option>
713
			<option value="DHCP_Off"<?= ((!strcmp($conf['DHCP'], 'off')) ? ' selected' : '') ?>><?= $l_DHCP_off ?></option>
698
			<option value="DHCP_On"<?= ((!strcmp($conf['DHCP'], 'on')) ? ' selected' : '') ?>><?= $l_DHCP_on ?></option>
714
			<option value="DHCP_On"<?= ((!strcmp($conf['DHCP'], 'on')) ? ' selected' : '') ?>><?= $l_DHCP_on ?></option>
699
		</select>
715
		</select>
700
		<input type="submit" value="<?= $l_apply ?>">
716
		<input type="submit" value="<?= $l_apply ?>">
701
		<br><?= $l_DHCP_off_explain ?>
717
		<br><?= $l_DHCP_off_explain ?>
702
	</form>
718
	</form>
703
	</td></tr>
719
	</td></tr>
704
 
720
 
705
<?php if ($conf['DHCP'] === 'on'): ?>
721
<?php if ($conf['DHCP'] === 'on'): ?>
706
	<tr><td colspan="2" align="center"><?= $l_static_dhcp_title ?></td></tr>
722
	<tr><td colspan="2" align="center"><?= $l_static_dhcp_title ?></td></tr>
707
	<tr><td width="50%" align="center" valign="middle">
723
	<tr><td width="50%" align="center" valign="middle">
708
		<form action="network.php" method="POST">
724
		<form action="network.php" method="POST">
709
		<table cellspacing="2" cellpadding="3" border="1">
725
		<table cellspacing="2" cellpadding="3" border="1">
710
		<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info<th><?= $l_del ?></th></tr>
726
		<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info<th><?= $l_del ?></th></tr>
711
		<?php
727
		<?php
712
		// Read the "ether" file
728
		// Read the "ether" file
713
		exec('sudo /sbin/ip link show '.escapeshellarg($conf["INTIF"]), $output);
729
		exec('sudo /sbin/ip link show '.escapeshellarg($conf["INTIF"]), $output);
714
		$detail = explode(' ', $output[1]);
730
		$detail = explode(' ', $output[1]);
715
		$intif_mac_addr = strtoupper(str_replace(':', '-', $detail[5]));
731
		$intif_mac_addr = strtoupper(str_replace(':', '-', $detail[5]));
716
		unset($output); unset($detail);
732
		unset($output); unset($detail);
717
		$line_exist = false;
733
		$line_exist = false;
718
		$tab = file(ETHERS_INFO_FILE);
734
		$tab = file(ETHERS_INFO_FILE);
719
		if ($tab) { // le fichier n'est pas vide
735
		if ($tab) { // le fichier n'est pas vide
720
			foreach ($tab as $line) {
736
			foreach ($tab as $line) {
721
				$fields = explode(' ', $line);
737
				$fields = explode(' ', $line);
722
				$mac_addr = $fields[0];
738
				$mac_addr = $fields[0];
723
				$ip_addr  = $fields[1];
739
				$ip_addr  = $fields[1];
724
				$info     = (isset($fields[2])) ? $fields[2] : ' ';
740
				$info     = (isset($fields[2])) ? $fields[2] : ' ';
725
 
741
 
726
				echo '<tr>';
742
				echo '<tr>';
727
				echo "<td>$mac_addr</td>";
743
				echo "<td>$mac_addr</td>";
728
				echo "<td>$ip_addr</td>";
744
				echo "<td>$ip_addr</td>";
729
				if ($mac_addr !== $intif_mac_addr) {
745
				if ($mac_addr !== $intif_mac_addr) {
730
					echo '<td>'.ltrim($info, '#').'</td>';
746
					echo '<td>'.ltrim($info, '#').'</td>';
731
					echo "<td><input type=\"checkbox\" name=\"$mac_addr\"></td>";
747
					echo "<td><input type=\"checkbox\" name=\"$mac_addr\"></td>";
732
					$line_exist=True;
748
					$line_exist=True;
733
				} else {
749
				} else {
734
					echo '<td>ALCASAR</td>';
750
					echo '<td>ALCASAR</td>';
735
					echo '<td></td>';
751
					echo '<td></td>';
736
				}
752
				}
737
				echo '</tr>';
753
				echo '</tr>';
738
			}
754
			}
739
		}
755
		}
740
		?>
756
		?>
741
		</table>
757
		</table>
742
		<?php if ($line_exist): ?>
758
		<?php if ($line_exist): ?>
743
			<input type="hidden" name="choix" value="del_mac">
759
			<input type="hidden" name="choix" value="del_mac">
744
			<input type="submit" value="<?= $l_apply ?>">
760
			<input type="submit" value="<?= $l_apply ?>">
745
		<?php endif; ?>
761
		<?php endif; ?>
746
		</form>
762
		</form>
747
	</td><td width="50%" valign="middle" align="center">
763
	</td><td width="50%" valign="middle" align="center">
748
		<form name="new_mac" action="network.php" method="POST">
764
		<form name="new_mac" action="network.php" method="POST">
749
			<table cellspacing="2" cellpadding="3" border="1">
765
			<table cellspacing="2" cellpadding="3" border="1">
750
				<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info</th><td></td></tr>
766
				<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info</th><td></td></tr>
751
				<tr><td>Ex. : 12-2F-36-A4-DF-43</td><td>Ex. : 192.168.182.10</td><td>Ex. : Switch<td></td></tr>
767
				<tr><td>Ex. : 12-2F-36-A4-DF-43</td><td>Ex. : 192.168.182.10</td><td>Ex. : Switch<td></td></tr>
752
				<tr><td><input type="text" name="add_mac" size="17"></td>
768
				<tr><td><input type="text" name="add_mac" size="17"></td>
753
				<td><input type="text" name="add_ip" size="10"></td>
769
				<td><input type="text" name="add_ip" size="10"></td>
754
				<td><input type="text" name="info" size="10"></td>
770
				<td><input type="text" name="info" size="10"></td>
755
				<td>
771
				<td>
756
					<input type="hidden" name="choix" value="new_mac">
772
					<input type="hidden" name="choix" value="new_mac">
757
					<input type="submit" class="button" value="<?= $l_add_to_list ?>" onclick="return MAC_Control('new_mac');">
773
					<input type="submit" class="button" value="<?= $l_add_to_list ?>" onclick="return MAC_Control('new_mac');">
758
				</td>
774
				</td>
759
			</tr></table>
775
			</tr></table>
760
		</form>
776
		</form>
761
	</td></tr>
777
	</td></tr>
762
<?php else: ?>
778
<?php else: ?>
763
	<tr><td colspan="2" align="center"><?= $l_dhcp_relay ?></td></tr>
779
	<tr><td colspan="2" align="center"><?= $l_dhcp_relay ?></td></tr>
764
	<tr>
780
	<tr>
765
		<td colspan="2" align="center">
781
		<td colspan="2" align="center">
766
			<form name="new_host" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
782
			<form name="new_host" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
767
			<table cellspacing="2" cellpadding="3" border="1">
783
			<table cellspacing="2" cellpadding="3" border="1">
768
			<tr>
784
			<tr>
769
				<th><label for="dhcp_relay_ip"><?= $l_dhcp_relay_local_ip ?></label></th><td><input type="text" name="dhcp_relay_ip" id="dhcp_relay_ip" value="<?= $conf['RELAY_DHCP_IP'] ?>" size="32"></td>
785
				<th><label for="dhcp_relay_ip"><?= $l_dhcp_relay_local_ip ?></label></th><td><input type="text" name="dhcp_relay_ip" id="dhcp_relay_ip" value="<?= $conf['RELAY_DHCP_IP'] ?>" size="32"></td>
770
			</tr>
786
			</tr>
771
			<tr>
787
			<tr>
772
				<th><label for="dhcp_relay_ext_ip"><?= $l_dhcp_relay_ip ?></label></th><td><input type="text" name="dhcp_relay_ext_ip" id="dhcp_relay_ext_ip" value="<?= $conf['EXT_DHCP_IP'] ?>" size="32"></td>
788
				<th><label for="dhcp_relay_ext_ip"><?= $l_dhcp_relay_ip ?></label></th><td><input type="text" name="dhcp_relay_ext_ip" id="dhcp_relay_ext_ip" value="<?= $conf['EXT_DHCP_IP'] ?>" size="32"></td>
773
			</tr>
789
			</tr>
774
			<tr>
790
			<tr>
775
				<th><label for="dhcp_relay_port"><?= $l_dhcp_relay_port ?></label></th><td><input type="text" name="dhcp_relay_port" id="dhcp_relay_port" value="<?= $conf['RELAY_DHCP_PORT'] ?>" size="32"></td>
791
				<th><label for="dhcp_relay_port"><?= $l_dhcp_relay_port ?></label></th><td><input type="text" name="dhcp_relay_port" id="dhcp_relay_port" value="<?= $conf['RELAY_DHCP_PORT'] ?>" size="32"></td>
776
			</tr>
792
			</tr>
777
			</table>
793
			</table>
778
			<input type="hidden" name="choix" value="dhcp_relay">
794
			<input type="hidden" name="choix" value="dhcp_relay">
779
			<input type="submit" value="<?= $l_apply ?>">
795
			<input type="submit" value="<?= $l_apply ?>">
780
			</form>
796
			</form>
781
		</td>
797
		</td>
782
	</tr>
798
	</tr>
783
<?php endif; ?>
799
<?php endif; ?>
784
</table>
800
</table>
-
 
801
<br>
-
 
802
 
-
 
803
<table width="100%" cellspacing="0" cellpadding="0" border="0">
-
 
804
	<tr><th><?= $l_dns_title ?></th></tr>
-
 
805
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
806
</table>
-
 
807
<table width="100%" cellspacing="0" cellpadding="5" border="1">
-
 
808
	<tr><td colspan="2" align="center"><?= $l_local_dns ?></td></tr>
-
 
809
	<tr>
-
 
810
		<td width="50%" align="center">
-
 
811
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
-
 
812
			<table cellspacing="2" cellpadding="3" border="1">
-
 
813
			<tr><th><?= $l_ip_address ?></th><th><?= $l_host_name ?></th><th><?= $l_del ?></th></tr>
-
 
814
			<?php
-
 
815
			// Read the "dns_local" file
-
 
816
			$line_exist = false;
-
 
817
			$tab = file(DNS_LOCAL_FILE);
-
 
818
			if ($tab) { // not empty
-
 
819
				foreach ($tab as $line) {
-
 
820
					if (preg_match ('/^\d+/', $line)) { # begin with one or several digit
-
 
821
						$line_exist = true;
-
 
822
						$field = preg_split("/\s+/",$line); # split with one or several whitespace (or tab)
-
 
823
						$ip_addr   = $field[0];
-
 
824
						$host_name = $field[1];
-
 
825
						echo "<tr><td>$ip_addr</td>";
-
 
826
						echo "<td>$host_name</td>";
-
 
827
						if (($ip_addr == "127.0.0.1")|($host_name == "alcasar")) {
-
 
828
							echo "<td>";}
-
 
829
						else {
-
 
830
							echo "<td><input type=\"checkbox\" name=\"$ip_addr|$host_name\">";
-
 
831
						}
-
 
832
						echo "</td></tr>";
-
 
833
					}
-
 
834
				}
-
 
835
			}
-
 
836
			if (!$line_exist) {
-
 
837
				echo '<tr><td colspan="3" style="text-align: center;font-style: italic;">'.$l_empty.'</td></tr>';
-
 
838
			}
-
 
839
			?>
-
 
840
			</table>
-
 
841
			<?php if ($line_exist): ?>
-
 
842
				<input type="hidden" name="choix" value="del_host">
-
 
843
				<input type="submit" value="<?= $l_apply ?>">
-
 
844
			<?php endif; ?>
-
 
845
			</form>
-
 
846
		</td>
-
 
847
		<td width="50%" valign="middle" align="center">
-
 
848
			<form name="new_host" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
-
 
849
			<table cellspacing="2" cellpadding="3" border="1">
-
 
850
			<tr>
-
 
851
				<th><?= $l_ip_address ?></th><th><?= $l_host_name ?></th><td></td>
-
 
852
			</tr>
-
 
853
			<tr>
-
 
854
				<td>Ex. : 192.168.182.10</td><td>Ex. : my_nas</td><td></td>
-
 
855
			</tr>
-
 
856
			<tr>
-
 
857
				<td><input type="text" name="add_ip" size="10"><input type="hidden" name="choix" value="new_host"></td>
-
 
858
				<td><input type="text" name="add_host" size="17"></td>
-
 
859
				<td><input type=submit class=button value="<?= $l_add_to_list ?>"></td>
-
 
860
			</tr>
-
 
861
			</table>
-
 
862
			</form>
-
 
863
		</td>
-
 
864
	</tr>
-
 
865
	<tr><td colspan="2" align="center"><?= $l_dns_internal ?></td></tr>
-
 
866
	<tr>
-
 
867
		<td colspan="2" align="center">
-
 
868
			<form name="new_host" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
-
 
869
			<table cellspacing="2" cellpadding="3" border="1">
-
 
870
			<tr>
-
 
871
				<th><?= $l_enabled ?></th>
-
 
872
				<td>
-
 
873
					<select name="dns_internal_active">
-
 
874
						<option value="on"<?=  (($conf['INT_DNS_ACTIVE'] === 'on')  ? ' selected' : '') ?>><?= $l_yes ?></option>
-
 
875
						<option value="off"<?= (($conf['INT_DNS_ACTIVE'] === 'off') ? ' selected' : '') ?>><?= $l_no ?></option>
-
 
876
					</select>
-
 
877
				</td>
-
 
878
			</tr>
-
 
879
			<tr>
-
 
880
				<th><?= $l_ip_address ?></th><td><input type="text" name="dns_internal_ip" value="<?= $conf['INT_DNS_IP'] ?>" size="32"></td>
-
 
881
			</tr>
-
 
882
			<tr>
-
 
883
				<th><?= $l_host_name ?></th><td><input type="text" name="dns_internal_domain" value="<?= $conf['INT_DNS_DOMAIN'] ?>" size="32"></td>
-
 
884
			</tr>
-
 
885
			</table>
-
 
886
			<input type="hidden" name="choix" value="dns_internal">
-
 
887
			<input type="submit" value="<?= $l_apply ?>">
-
 
888
			</form>
-
 
889
		</td>
-
 
890
	</tr>
-
 
891
</table>
785
<br>
892
<br>
786
 
893
 
787
<table width="100%" cellspacing="0" cellpadding="0" border="0">
894
<table width="100%" cellspacing="0" cellpadding="0" border="0">
788
	<tr><th><?= $l_ssl_title ?></th></tr>
895
	<tr><th><?= $l_ssl_title ?></th></tr>
789
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
896
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
790
</table>
897
</table>
791
<table width="100%" cellspacing="0" cellpadding="5" border="1">
898
<table width="100%" cellspacing="0" cellpadding="5" border="1">
792
	<tr><td valign="middle" align="left">
899
	<tr><td valign="middle" align="left">
793
		<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
900
		<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
794
		<input type="hidden" name="choix" value="https_login">
901
		<input type="hidden" name="choix" value="https_login">
795
		<select name="https_login">
902
		<select name="https_login">
796
			<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>><?= $l_yes ?></option>
903
			<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>><?= $l_yes ?></option>
797
			<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_no ?></option>
904
			<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_no ?></option>
798
		</select>
905
		</select>
799
		<input type="submit" value="<?= $l_apply ?>"><br>
906
		<input type="submit" value="<?= $l_apply ?>"><br>
800
		</form>
907
		</form>
801
		<br>
908
		<br>
802
	</td></tr>
909
	</td></tr>
803
</table>
910
</table>
804
<br>
911
<br>
805
 
912
 
806
<table width="100%" cellspacing="0" cellpadding="0" border="0">
913
<table width="100%" cellspacing="0" cellpadding="0" border="0">
807
	<tr><th><?= $l_import_cert ?></th></tr>
914
	<tr><th><?= $l_import_cert ?></th></tr>
808
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
915
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
809
</table>
916
</table>
810
<table width="100%" cellspacing="0" cellpadding="5" border="1">
917
<table width="100%" cellspacing="0" cellpadding="5" border="1">
811
	<tr>
918
	<tr>
812
		<td width="50%" valign="top">
919
		<td width="50%" valign="top">
813
			<?php
920
			<?php
814
			$certificateInfos = openssl_x509_parse(file_get_contents('/etc/pki/tls/certs/alcasar.crt'));
921
			$certificateInfos = openssl_x509_parse(file_get_contents('/etc/pki/tls/certs/alcasar.crt'));
815
 
922
 
816
			$cert_expiration_date = date('d-m-Y H:i:s', $certificateInfos['validTo_time_t']);
923
			$cert_expiration_date = date('d-m-Y H:i:s', $certificateInfos['validTo_time_t']);
817
			$domain               = $certificateInfos['subject']['CN'];
924
			$domain               = $certificateInfos['subject']['CN'];
818
			$organization         = (isset($certificateInfos['subject']['O'])) ? $certificateInfos['subject']['O'] : '';
925
			$organization         = (isset($certificateInfos['subject']['O'])) ? $certificateInfos['subject']['O'] : '';
819
			$CAdomain             = $certificateInfos['issuer']['CN'];
926
			$CAdomain             = $certificateInfos['issuer']['CN'];
820
			$CAorganization       = (isset($certificateInfos['issuer']['O'])) ? $certificateInfos['issuer']['O'] : '';
927
			$CAorganization       = (isset($certificateInfos['issuer']['O'])) ? $certificateInfos['issuer']['O'] : '';
821
			?>
928
			?>
822
			<h3><?= $l_current_certificate ?></h3>
929
			<h3><?= $l_current_certificate ?></h3>
823
			<?= $l_cert_expiration ?> <?= $cert_expiration_date ?><br>
930
			<?= $l_cert_expiration ?> <?= $cert_expiration_date ?><br>
824
			<?= $l_cert_commonname ?> <?= $domain ?><br>
931
			<?= $l_cert_commonname ?> <?= $domain ?><br>
825
			<?= $l_cert_organization ?> <?= $organization ?><br/>
932
			<?= $l_cert_organization ?> <?= $organization ?><br/>
826
			<h4><?=  $l_validated ?></h4>
933
			<h4><?=  $l_validated ?></h4>
827
			<?= $l_cert_commonname ?> <?= $CAdomain ?><br>
934
			<?= $l_cert_commonname ?> <?= $CAdomain ?><br>
828
			<?= $l_cert_organization ?> <?= $CAorganization ?><br>
935
			<?= $l_cert_organization ?> <?= $CAorganization ?><br>
829
		</td>
936
		</td>
830
		<td width="50%" valign="center">
937
		<td width="50%" valign="center">
831
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
938
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
832
				<input type="hidden" name="choix" value="default_cert">
939
				<input type="hidden" name="choix" value="default_cert">
833
				<input type="submit" value="<?= $l_default_cert ?>" <?= (!file_exists('/etc/pki/tls/certs/alcasar.crt.old') || !file_exists('/etc/pki/tls/private/alcasar.key.old')) ? ' disabled' : '' ?>>
940
				<input type="submit" value="<?= $l_default_cert ?>" <?= (!file_exists('/etc/pki/tls/certs/alcasar.crt.old') || !file_exists('/etc/pki/tls/private/alcasar.key.old')) ? ' disabled' : '' ?>>
834
			</form>
941
			</form>
835
		</td>
942
		</td>
836
	</tr>
943
	</tr>
837
	<tr>
944
	<tr>
838
		<td width="50%" valign="top">
945
		<td width="50%" valign="top">
839
			<h3><?= $l_upload_certificate ?></h3>
946
			<h3><?= $l_upload_certificate ?></h3>
840
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
947
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
841
				<?= $l_private_key;?> <input type="file" name="key"><br>
948
				<?= $l_private_key;?> <input type="file" name="key"><br>
842
				<?= $l_certificate;?> <input type="file" name="crt"><br>
949
				<?= $l_certificate;?> <input type="file" name="crt"><br>
843
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
950
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
844
				<input type="hidden" name="choix" value="import_cert">
951
				<input type="hidden" name="choix" value="import_cert">
845
				<input type="submit" value="<?= $l_import ?>">
952
				<input type="submit" value="<?= $l_import ?>">
846
			</form>
953
			</form>
847
		</td>
954
		</td>
848
		<td width="50%" valign="top">
955
		<td width="50%" valign="top">
849
			<?php
956
			<?php
850
			// Get step
957
			// Get step
851
			if (empty($LE_conf['domainRequest'])) {
958
			if (empty($LE_conf['domainRequest'])) {
852
				$step = 1;
959
				$step = 1;
853
			} else if (!empty($LE_conf['challenge'])) {
960
			} else if (!empty($LE_conf['challenge'])) {
854
				$step = 2;
961
				$step = 2;
855
			} else if (($domain === $LE_conf['domainRequest']) && (empty($LE_conf['challenge']))) {
962
			} else if (($domain === $LE_conf['domainRequest']) && (empty($LE_conf['challenge']))) {
856
				$step = 3;
963
				$step = 3;
857
			} else {
964
			} else {
858
				$step = 1;
965
				$step = 1;
859
			}
966
			}
860
			?>
967
			?>
861
			<h3><?= $l_le_integration ?></h3>
968
			<h3><?= $l_le_integration ?></h3>
862
			<?php if ($step === 1): ?>
969
			<?php if ($step === 1): ?>
863
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
970
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
864
					<input type="hidden" name="choix" value="le_issueCert">
971
					<input type="hidden" name="choix" value="le_issueCert">
865
					<?= $l_le_status ?> <?= $l_disabled ?><br>
972
					<?= $l_le_status ?> <?= $l_disabled ?><br>
866
					<?= $l_le_email ?> <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
973
					<?= $l_le_email ?> <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
867
					<?= $l_le_domain_name ?> <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
974
					<?= $l_le_domain_name ?> <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
868
					<input type="submit" name="issue" value="<?= $l_send ?>"><br>
975
					<input type="submit" name="issue" value="<?= $l_send ?>"><br>
869
				</form>
976
				</form>
870
			<?php elseif ($step === 2): ?>
977
			<?php elseif ($step === 2): ?>
871
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
978
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
872
					<input type="hidden" name="choix" value="le_renewCert">
979
					<input type="hidden" name="choix" value="le_renewCert">
873
					<?= $l_le_status ?> <?= $l_pending_validation ?><br>
980
					<?= $l_le_status ?> <?= $l_pending_validation ?><br>
874
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
981
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
875
					<?= $l_le_ask_on ?> <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
982
					<?= $l_le_ask_on ?> <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
876
					<?= $l_le_dns_entry_txt ?> "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
983
					<?= $l_le_dns_entry_txt ?> "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
877
					<?= $l_le_challenge ?> "<?= $LE_conf['challenge'] ?>"<br>
984
					<?= $l_le_challenge ?> "<?= $LE_conf['challenge'] ?>"<br>
878
					<input type="submit" name="recheck" value="<?= $l_recheck ?>"> <input type="submit" name="cancel" value="<?= $l_cancel ?>"><br>
985
					<input type="submit" name="recheck" value="<?= $l_recheck ?>"> <input type="submit" name="cancel" value="<?= $l_cancel ?>"><br>
879
				</form>
986
				</form>
880
			<?php elseif ($step === 3): ?>
987
			<?php elseif ($step === 3): ?>
881
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
988
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
882
					<input type="hidden" name="choix" value="le_renewCert">
989
					<input type="hidden" name="choix" value="le_renewCert">
883
					<?= $l_le_status ?> <?= $l_enabled ?><br>
990
					<?= $l_le_status ?> <?= $l_enabled ?><br>
884
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
991
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
885
					<?= $l_le_api ?>  <?= $LE_conf['dnsapi'] ?><br>
992
					<?= $l_le_api ?>  <?= $LE_conf['dnsapi'] ?><br>
886
					<?= $l_le_next_renewal ?> <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
993
					<?= $l_le_next_renewal ?> <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
887
					<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
994
					<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
888
						<input type="submit" name="recheck" value="<?= $l_renew ?>"><br>
995
						<input type="submit" name="recheck" value="<?= $l_renew ?>"><br>
889
					<?php else: ?>
996
					<?php else: ?>
890
						<input type="submit" name="recheck_force" value="<?= $l_renew_force ?>"><br>
997
						<input type="submit" name="recheck_force" value="<?= $l_renew_force ?>"><br>
891
					<?php endif; ?>
998
					<?php endif; ?>
892
				</form>
999
				</form>
893
			<?php endif; ?>
1000
			<?php endif; ?>
894
			<?php if (isset($cmdResponse)): ?>
1001
			<?php if (isset($cmdResponse)): ?>
895
				<p><?= $cmdResponse ?></p>
1002
				<p><?= $cmdResponse ?></p>
896
			<?php endif; ?>
1003
			<?php endif; ?>
897
		</td>
1004
		</td>
898
	</tr>
1005
	</tr>
899
</table>
1006
</table>
900
</body>
1007
</body>
901
</html>
1008
</html>
902
 
1009