Line 27... |
Line 27... |
27 |
}
|
27 |
}
|
28 |
while (!feof($file_conf)) {
|
28 |
while (!feof($file_conf)) {
|
29 |
$buffer = fgets($file_conf, 4096);
|
29 |
$buffer = fgets($file_conf, 4096);
|
30 |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
|
30 |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
|
31 |
$tmp = explode('=', $buffer, 2);
|
31 |
$tmp = explode('=', $buffer, 2);
|
32 |
$mail_conf[trim($tmp[0])] = trim($tmp[1]);
|
32 |
$conf[trim($tmp[0])] = trim($tmp[1]);
|
33 |
}
|
33 |
}
|
34 |
}
|
34 |
}
|
35 |
fclose($file_conf);
|
35 |
fclose($file_conf);
|
36 |
/****************************************
|
36 |
/****************************************
|
37 |
* Choice of language *
|
37 |
* Choice of language *
|
Line 58... |
Line 58... |
58 |
$l_mail_admin = "Adresse Email de l'administrateur";
|
58 |
$l_mail_admin = "Adresse Email de l'administrateur";
|
59 |
$l_whitelist_domain = "Noms de domaine autorisés (whitelist)";
|
59 |
$l_whitelist_domain = "Noms de domaine autorisés (whitelist)";
|
60 |
$l_mail_YES = "OUI";
|
60 |
$l_mail_YES = "OUI";
|
61 |
$l_mail_NO = "NON";
|
61 |
$l_mail_NO = "NON";
|
62 |
$l_mail_submit = "Enregistrer";
|
62 |
$l_mail_submit = "Enregistrer";
|
- |
|
63 |
} else if($Language == 'es') {
|
- |
|
64 |
$l_mail_title = "Registro por email";
|
- |
|
65 |
$l_mail_registration = "Activar el registro por correo electrónico :";
|
- |
|
66 |
$l_mail_choice = "Qué tipo de servicio de correo utiliza?";
|
- |
|
67 |
$l_use_internal_server = "Utilizar el servidor de correo interno";
|
- |
|
68 |
$l_use_external_server = "Retransmisión a un servidor de correo externo";
|
- |
|
69 |
$l_use_email_address = "Utilizar una dirección de correo electrónico";
|
- |
|
70 |
$l_email_address = "Dirección de correo electrónico utilizada para el envío de correo";
|
- |
|
71 |
$l_email_password = "Contraseña";
|
- |
|
72 |
$l_email_password_confirm = "Confirmar contraseña";
|
- |
|
73 |
$l_mail_service = "Elija el servicio de correo";
|
- |
|
74 |
$l_mail_smtp_ip = "Dirección IP o nombre del servidor de correo";
|
- |
|
75 |
$l_mail_smtp_port = "Puerto de escucha del servidor de correo";
|
- |
|
76 |
$l_admin_log = "Advertencia del administrador";
|
- |
|
77 |
$l_mail_admin = "Dirección de correo electrónico del administrador";
|
- |
|
78 |
$l_whitelist_domain = "Nombres de dominio autorizados (lista blanca)";
|
- |
|
79 |
$l_mail_YES = "SI";
|
- |
|
80 |
$l_mail_NO = "NO";
|
- |
|
81 |
$l_mail_submit = "SI";
|
63 |
} else {
|
82 |
} else {
|
64 |
$l_mail_title = "Registration by Email";
|
83 |
$l_mail_title = "Registration by Email";
|
65 |
$l_mail_registration = "Enable registration by Email :";
|
84 |
$l_mail_registration = "Enable registration by Email :";
|
66 |
$l_mail_choice = "What type of mail service use ?";
|
85 |
$l_mail_choice = "What type of mail service use ?";
|
67 |
$l_use_internal_server = "Use the internal mail server";
|
86 |
$l_use_internal_server = "Use the internal mail server";
|
Line 80... |
Line 99... |
80 |
$l_mail_NO = "NO";
|
99 |
$l_mail_NO = "NO";
|
81 |
$l_mail_submit = "Save";
|
100 |
$l_mail_submit = "Save";
|
82 |
}
|
101 |
}
|
83 |
|
102 |
|
84 |
// Mail configuration params
|
103 |
// Mail configuration params
|
85 |
$mail_status = $mail_conf['MAIL'];
|
104 |
$mail_status = $conf['MAIL'];
|
86 |
$mail_type = $mail_conf['MAIL_TYPE'];
|
105 |
$mail_type = $conf['MAIL_TYPE'];
|
87 |
$mail_address = $mail_conf['MAIL_ADDR'];
|
106 |
$mail_address = $conf['MAIL_ADDR'];
|
88 |
$mail_smtp_port = $mail_conf['MAIL_SMTP_PORT'];
|
107 |
$mail_smtp_ip = $conf['MAIL_SMTP_IP'];
|
89 |
$mail_smtp_ip = $mail_conf['MAIL_SMTP_IP'];
|
108 |
$mail_smtp_port = $conf['MAIL_SMTP_PORT'];
|
90 |
$mail_password_mail = "";
|
109 |
$mail_password_mail = "";
|
91 |
$mail_password_mail_2 = "";
|
110 |
$mail_password_mail_2 = "";
|
92 |
$mail_admin = $mail_conf['MAIL_ADMIN'];
|
111 |
$mail_admin = $conf['MAIL_ADMIN'];
|
93 |
$mail_whitelist = $mail_conf['MAIL_WHITEDOMAIN'];
|
112 |
$mail_whitelist = $conf['MAIL_WHITEDOMAIN'];
|
94 |
|
113 |
|
95 |
if(isset($_POST['submit'])){
|
114 |
if(isset($_POST['submit'])){
|
96 |
if($_POST['mail_enable'] === 'on')
|
115 |
if($_POST['mail_enable'] === 'on')
|
97 |
{
|
116 |
{
|
98 |
$mail_type = $_POST['mail_type'];
|
117 |
$mail_type = $_POST['mail_type'];
|
99 |
$mail_whitelist = $_POST['mail_whitelist'];
|
118 |
$mail_whitelist = $_POST['mail_whitelist'];
|
100 |
$admin_enable = $_POST['admin_enable'];
|
119 |
$admin_enable = $_POST['admin_enable'];
|
101 |
if(isset($_POST['mail_address'])) { $mail_address = $_POST['mail_address']; }
|
120 |
if(isset($_POST['mail_address'])) { $mail_address = $_POST['mail_address']; }
|
102 |
if(isset($_POST['mail_server'])) { $mail_server = $_POST['mail_server']; }
|
121 |
if(isset($_POST['mail_server'])) { $mail_server = $_POST['mail_server']; }
|
103 |
if(isset($_POST['mail_smtp_ip'])) { $mail_smtp_ip = $_POST['mail_smtp_ip']; }
|
122 |
if(isset($_POST['mail_smtp_ip'])) { $mail_smtp_ip = $_POST['mail_smtp_ip']; }
|
104 |
if(isset($_POST['mail_smtp_port'])) { $mail_smtp_ip = $_POST['mail_smtp_port']; }
|
123 |
if(isset($_POST['mail_smtp_port'])) { $mail_smtp_port = $_POST['mail_smtp_port']; }
|
105 |
if(isset($_POST['mail_mdp'])) { $mail_mdp = $_POST['mail_mdp']; }
|
124 |
if(isset($_POST['mail_mdp'])) { $mail_mdp = $_POST['mail_mdp']; }
|
106 |
if(isset($_POST['mail_mdp2'])) { $mail_mdp2 = $_POST['mail_mdp2']; }
|
125 |
if(isset($_POST['mail_mdp2'])) { $mail_mdp2 = $_POST['mail_mdp2']; }
|
107 |
if ($admin_enable == "1") { $mail_admin = $_POST['mail_admin']; }
|
126 |
if ($admin_enable == "1") { $mail_admin = $_POST['mail_admin']; }
|
108 |
switch ($mail_type) {
|
127 |
switch ($mail_type) {
|
109 |
case '1':
|
128 |
case '1': // Act as a SMTP server
|
110 |
$mail_smtp_port = 25;
|
129 |
$mail_smtp_port = 25;
|
111 |
if ($admin_enable == "1"){
|
130 |
if ($admin_enable == "1"){
|
112 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -a $mail_admin -w $mail_whitelist");
|
131 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -a $mail_admin -w $mail_whitelist");
|
113 |
}
|
132 |
}
|
114 |
else {
|
133 |
else {
|
115 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -w $mail_whitelist");
|
134 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -w $mail_whitelist");
|
116 |
}
|
135 |
}
|
117 |
break;
|
136 |
break;
|
118 |
case '2':
|
137 |
case '2': // Relay to an external SMTP server
|
119 |
if ($admin_enable == "1"){
|
138 |
if ($admin_enable == "1"){
|
120 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_smtp_port -a $mail_admin -w $mail_whitelist");
|
139 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_smtp_port -a $mail_admin -w $mail_whitelist");
|
121 |
}
|
140 |
}
|
122 |
else {
|
141 |
else {
|
123 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_smtp_port -w $mail_whitelist");
|
142 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_smtp_port -w $mail_whitelist");
|
124 |
}
|
143 |
}
|
125 |
break;
|
144 |
break;
|
126 |
case '3':
|
145 |
case '3': // Use an user Email address
|
127 |
if(($mail_mdp != '') && ($mail_mdp==$mail_mdp2)) {
|
146 |
if(($mail_mdp != '') && ($mail_mdp==$mail_mdp2)) {
|
128 |
switch ($mail_server) {
|
147 |
switch ($mail_server) {
|
129 |
case '1':
|
148 |
case '1':
|
130 |
$mail_smtp_ip = "smtp.orange.fr";
|
149 |
$mail_smtp_ip = "smtp.orange.fr";
|
131 |
$mail_smtp_port = 465;
|
150 |
$mail_smtp_port = 465;
|
Line 190... |
Line 209... |
190 |
<html>
|
209 |
<html>
|
191 |
<head>
|
210 |
<head>
|
192 |
<meta charset="UTF-8">
|
211 |
<meta charset="UTF-8">
|
193 |
<title><?= $l_mail_title ?></title>
|
212 |
<title><?= $l_mail_title ?></title>
|
194 |
<link type="text/css" href="/css/acc.css" rel="stylesheet">
|
213 |
<link type="text/css" href="/css/acc.css" rel="stylesheet">
|
195 |
<link type="text/css" href="/css/mail.css" rel="stylesheet">
|
- |
|
196 |
<script>
|
214 |
<script>
|
197 |
function onMailStatusChange() {
|
215 |
function onMailStatusChange() {
|
198 |
var listToDisables1 = ['mail_type','admin_enable','mail_admin','mail_whitelist'];
|
216 |
var listToDisables1 = ['mail_type','admin_enable','mail_admin','mail_whitelist'];
|
199 |
var listToDisables2 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip'];
|
217 |
var listToDisables2 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip','mail_smtp_port'];
|
200 |
var listToDisables3 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip','mail_mdp2','mail_mdp','mail_address'];
|
218 |
var listToDisables3 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip','mail_smtp_port','mail_address','mail_mdp','mail_mdp2'];
|
201 |
var formSubmit = document.querySelector('form input[type="submit"]');
|
219 |
var formSubmit = document.querySelector('form input[type="submit"]');
|
202 |
var isChecked = false;
|
220 |
var isChecked = false;
|
203 |
for (var i=0; i<listToDisables1.length; i++) {
|
- |
|
204 |
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
205 |
document.getElementById(listToDisables1[i]).disabled = true;
|
- |
|
206 |
}
|
- |
|
207 |
for (var i=0; i<listToDisables2.length; i++) {
|
- |
|
208 |
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
209 |
document.getElementById(listToDisables2[i]).disabled = true;
|
- |
|
210 |
}
|
- |
|
211 |
for (var i=0; i<listToDisables3.length; i++) {
|
221 |
for (var i=0; i<listToDisables3.length; i++) {
|
212 |
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
|
222 |
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
|
213 |
document.getElementById(listToDisables3[i]).disabled = true;
|
223 |
document.getElementById(listToDisables3[i]).disabled = true;
|
214 |
}
|
224 |
}
|
215 |
if (document.getElementById('mail_enable').value === 'on') {
|
225 |
if (document.getElementById('mail_enable').value === 'on') {
|
Line 235... |
Line 245... |
235 |
document.getElementById('mail_admin').disabled = true;
|
245 |
document.getElementById('mail_admin').disabled = true;
|
236 |
}
|
246 |
}
|
237 |
if (document.getElementById('mail_server').value != '9') {
|
247 |
if (document.getElementById('mail_server').value != '9') {
|
238 |
document.getElementById('mail_smtp_ip').style.backgroundColor = '#c0c0c0';
|
248 |
document.getElementById('mail_smtp_ip').style.backgroundColor = '#c0c0c0';
|
239 |
document.getElementById('mail_smtp_ip').disabled = true;
|
249 |
document.getElementById('mail_smtp_ip').disabled = true;
|
- |
|
250 |
document.getElementById('mail_smtp_port').style.backgroundColor = '#c0c0c0';
|
- |
|
251 |
document.getElementById('mail_smtp_port').disabled = true;
|
240 |
}
|
252 |
}
|
241 |
}
|
253 |
}
|
242 |
else if (document.getElementById('mail_type').value === '3') {
|
254 |
else if (document.getElementById('mail_type').value === '3') {
|
243 |
for (var i=0; i<listToDisables3.length; i++) {
|
255 |
for (var i=0; i<listToDisables3.length; i++) {
|
244 |
document.getElementById(listToDisables3[i]).style.backgroundColor = null;
|
256 |
document.getElementById(listToDisables3[i]).style.backgroundColor = null;
|
Line 249... |
Line 261... |
249 |
document.getElementById('mail_admin').disabled = true;
|
261 |
document.getElementById('mail_admin').disabled = true;
|
250 |
}
|
262 |
}
|
251 |
if (document.getElementById('mail_server').value != '9') {
|
263 |
if (document.getElementById('mail_server').value != '9') {
|
252 |
document.getElementById('mail_smtp_ip').style.backgroundColor = '#c0c0c0';
|
264 |
document.getElementById('mail_smtp_ip').style.backgroundColor = '#c0c0c0';
|
253 |
document.getElementById('mail_smtp_ip').disabled = true;
|
265 |
document.getElementById('mail_smtp_ip').disabled = true;
|
- |
|
266 |
document.getElementById('mail_smtp_port').style.backgroundColor = '#c0c0c0';
|
- |
|
267 |
document.getElementById('mail_smtp_port').disabled = true;
|
254 |
}
|
268 |
}
|
255 |
}
|
269 |
}
|
256 |
formSubmit.style.display = null;
|
270 |
formSubmit.style.display = null;
|
257 |
}
|
271 |
}
|
258 |
}
|
272 |
}
|
Line 284... |
Line 298... |
284 |
<dt>
|
298 |
<dt>
|
285 |
<label for="mail_type"><?= $l_mail_choice ?></label><br>
|
299 |
<label for="mail_type"><?= $l_mail_choice ?></label><br>
|
286 |
</dt>
|
300 |
</dt>
|
287 |
<dd>
|
301 |
<dd>
|
288 |
<select id="mail_type" name="mail_type" onchange="onMailStatusChange();">
|
302 |
<select id="mail_type" name="mail_type" onchange="onMailStatusChange();">
|
289 |
<!--<option value="1"<?= ($mail_type == '1') ? ' selected="selected"' : '' ?>><?= $l_use_internal_server ?></option>-->
|
303 |
<option value="1"<?= ($mail_type == '1') ? ' selected="selected"' : '' ?>><?= $l_use_internal_server ?></option>
|
290 |
<option value="2"<?= ($mail_type == '2') ? ' selected="selected"' : '' ?>><?= $l_use_external_server ?></option>
|
304 |
<option value="2"<?= ($mail_type == '2') ? ' selected="selected"' : '' ?>><?= $l_use_external_server ?></option>
|
291 |
<option value="3"<?= ($mail_type == '3') ? ' selected="selected"' : '' ?>><?= $l_use_email_address ?></option>
|
305 |
<option value="3"<?= ($mail_type == '3') ? ' selected="selected"' : '' ?>><?= $l_use_email_address ?></option>
|
292 |
</select>
|
306 |
</select>
|
293 |
</dd>
|
307 |
</dd>
|
294 |
</dl>
|
308 |
</dl>
|
Line 303... |
Line 317... |
303 |
<dl>
|
317 |
<dl>
|
304 |
<dt>
|
318 |
<dt>
|
305 |
<label for="mail_mdp"><?= $l_email_password ?></label><br>
|
319 |
<label for="mail_mdp"><?= $l_email_password ?></label><br>
|
306 |
</dt>
|
320 |
</dt>
|
307 |
<dd>
|
321 |
<dd>
|
308 |
<input type="text" id="mail_mdp" size="40" name="mail_mdp" value="<?= $mail_password_mail ?>" oninput="onMailStatusChange();">
|
322 |
<input type="password" id="mail_mdp" size="40" name="mail_mdp" value="<?= $mail_password_mail ?>" oninput="onMailStatusChange();">
|
309 |
</dd>
|
323 |
</dd>
|
310 |
</dl>
|
324 |
</dl>
|
311 |
<dl>
|
325 |
<dl>
|
312 |
<dt>
|
326 |
<dt>
|
313 |
<label for="mail_mdp2"><?= $l_email_password_confirm ?></label><br>
|
327 |
<label for="mail_mdp2"><?= $l_email_password_confirm ?></label><br>
|
314 |
</dt>
|
328 |
</dt>
|
315 |
<dd>
|
329 |
<dd>
|
316 |
<input type="text" id="mail_mdp2" size="40" name="mail_mdp2" value="<?= $mail_password_mail_2 ?>" oninput="onMailStatusChange();">
|
330 |
<input type="password" id="mail_mdp2" size="40" name="mail_mdp2" value="<?= $mail_password_mail_2 ?>" oninput="onMailStatusChange();">
|
317 |
</dd>
|
331 |
</dd>
|
318 |
</dl>
|
332 |
</dl>
|
319 |
<dl>
|
333 |
<dl>
|
320 |
<dt>
|
334 |
<dt>
|
321 |
<label for="mail_server"><?= $l_mail_service ?></label><br>
|
335 |
<label for="mail_server"><?= $l_mail_service ?></label><br>
|