Line 43... |
Line 43... |
43 |
}
|
43 |
}
|
44 |
if ($Language === 'fr') {
|
44 |
if ($Language === 'fr') {
|
45 |
$l_mail_title = "Inscription par Email";
|
45 |
$l_mail_title = "Inscription par Email";
|
46 |
$l_mail_registration = "Activer l'inscription par Email :";
|
46 |
$l_mail_registration = "Activer l'inscription par Email :";
|
47 |
$l_mail_choice = "Quel type de service mail utiliser ?";
|
47 |
$l_mail_choice = "Quel type de service mail utiliser ?";
|
48 |
$l_use_internal_server = "Utiliser le serveur interne";
|
48 |
$l_use_internal_server = "Utiliser le serveur de messagerie interne";
|
49 |
$l_use_external_server = "Relayer vers un serveur externe";
|
49 |
$l_use_external_server = "Relayer vers un serveur de messagerie externe";
|
50 |
$l_use_email_address = "Utiliser une adresse mail";
|
50 |
$l_use_email_address = "Utiliser une adresse mail";
|
51 |
$l_email_address = "Adresse mail utilisée pour l'envoi de mail";
|
51 |
$l_email_address = "Adresse mail utilisée pour l'envoi de mail";
|
52 |
$l_email_password = "Mot de passe";
|
52 |
$l_email_password = "Mot de passe";
|
53 |
$l_email_password_confirm = "Confirmez le mot de passe";
|
53 |
$l_email_password_confirm = "Confirmez le mot de passe";
|
54 |
$l_mail_service = "Choisissez le service de messagerie";
|
54 |
$l_mail_service = "Choisissez le service de messagerie";
|
55 |
$l_mail_smtp_ip = "Adresse IP ou nom du du serveur SMTP";
|
55 |
$l_mail_smtp_ip = "Adresse IP ou nom du du serveur SMTP";
|
56 |
$l_admin_log = "Avertissement de l'administratateur";
|
56 |
$l_admin_log = "Avertissement de l'administratateur";
|
57 |
$l_admin_address = "Adresse Email de l'administrateur";
|
57 |
$l_mail_admin = "Adresse Email de l'administrateur";
|
58 |
$l_whitelist_domain = "Noms de domaine autorisés (whitelist)";
|
58 |
$l_whitelist_domain = "Noms de domaine autorisés (whitelist)";
|
59 |
$l_mail_YES = "OUI";
|
59 |
$l_mail_YES = "OUI";
|
60 |
$l_mail_NO = "NON";
|
60 |
$l_mail_NO = "NON";
|
61 |
$l_mail_submit = "Enregistrer";
|
61 |
$l_mail_submit = "Enregistrer";
|
62 |
} else {
|
62 |
} else {
|
63 |
$l_mail_title = "Registration by Email";
|
63 |
$l_mail_title = "Registration by Email";
|
64 |
$l_mail_registration = "Enable registration by Email :";
|
64 |
$l_mail_registration = "Enable registration by Email :";
|
65 |
$l_mail_choice = "What type of mail service use ?";
|
65 |
$l_mail_choice = "What type of mail service use ?";
|
66 |
$l_internal_server = "Use the internal server";
|
66 |
$l_internal_server = "Use the internal mail server";
|
67 |
$l_external_server = "Relay to an external server";
|
67 |
$l_external_server = "Relay to an external mail server";
|
68 |
$l_email_address = "Use an email address";
|
68 |
$l_email_address = "Use an email address";
|
69 |
$l_email_address = "Email address used for sending mail";
|
69 |
$l_email_address = "Email address used for sending mail";
|
70 |
$l_email_password = "Password";
|
70 |
$l_email_password = "Password";
|
71 |
$l_email_password_confirm = "Confirm password";
|
71 |
$l_email_password_confirm = "Confirm password";
|
72 |
$l_mail_service = "Choose the mail service";
|
72 |
$l_mail_service = "Choose the mail service";
|
73 |
$l_mail_smtp_ip = "IP address or name of mail server";
|
73 |
$l_mail_smtp_ip = "IP address or name of mail server";
|
74 |
$l_admin_log = "Administrator's warning";
|
74 |
$l_admin_log = "Administrator's warning";
|
75 |
$l_admin_address = "Administrator Email address";
|
75 |
$l_mail_admin = "Administrator Email address";
|
76 |
$l_whitelist_domain = "Authorized domain names (whitelist)";
|
76 |
$l_whitelist_domain = "Authorized domain names (whitelist)";
|
77 |
$l_mail_YES = "YES";
|
77 |
$l_mail_YES = "YES";
|
78 |
$l_mail_NO = "NO";
|
78 |
$l_mail_NO = "NO";
|
79 |
$l_mail_submit = "Save";
|
79 |
$l_mail_submit = "Save";
|
80 |
}
|
80 |
}
|
Line 86... |
Line 86... |
86 |
$mail_smtp = $mail_conf['MAIL_SMTP'];
|
86 |
$mail_smtp = $mail_conf['MAIL_SMTP'];
|
87 |
$mail_port = $mail_conf['MAIL_PORT'];
|
87 |
$mail_port = $mail_conf['MAIL_PORT'];
|
88 |
$mail_smtp_ip = $mail_conf['MAIL_SMTP_IP'];
|
88 |
$mail_smtp_ip = $mail_conf['MAIL_SMTP_IP'];
|
89 |
$mail_password_mail = "";
|
89 |
$mail_password_mail = "";
|
90 |
$mail_password_mail_2 = "";
|
90 |
$mail_password_mail_2 = "";
|
91 |
$admin_address = $mail_conf['MAIL_ADMIN'];
|
91 |
$mail_admin = $mail_conf['MAIL_ADMIN'];
|
92 |
$mail_whitelist = $mail_conf['MAIL_WHITEDOMAIN'];
|
92 |
$mail_whitelist = $mail_conf['MAIL_WHITEDOMAIN'];
|
93 |
|
93 |
|
94 |
if(isset($_POST['submit'])){
|
94 |
if(isset($_POST['submit'])){
|
95 |
if($_POST['auth_enable'] === 'on')
|
95 |
if($_POST['auth_enable'] === 'on')
|
96 |
{
|
96 |
{
|
Line 98... |
Line 98... |
98 |
$mail_address = $_POST['mail_address'];
|
98 |
$mail_address = $_POST['mail_address'];
|
99 |
$mail_server = $_POST['mail_server'];
|
99 |
$mail_server = $_POST['mail_server'];
|
100 |
$mail_mdp = $_POST['mail_mdp'];
|
100 |
$mail_mdp = $_POST['mail_mdp'];
|
101 |
$mail_mdp2 = $_POST['mail_mdp2'];
|
101 |
$mail_mdp2 = $_POST['mail_mdp2'];
|
102 |
$admin_enable = $_POST['admin_enable'];
|
102 |
$admin_enable = $_POST['admin_enable'];
|
103 |
$admin_address = $_POST['admin_address'];
|
103 |
if ($admin_enable == "1") { $mail_admin = $_POST['mail_admin']; };
|
104 |
$mail_whitelist = $_POST['mail_whitelist'];
|
104 |
$mail_whitelist = $_POST['mail_whitelist'];
|
105 |
switch ($mail_type) {
|
105 |
switch ($mail_type) {
|
106 |
case '1':
|
106 |
case '1':
|
107 |
$mail_port = 25;
|
107 |
$mail_port = 25;
|
108 |
if(isset($mail_admin)){
|
108 |
if ($admin_enable == "1"){
|
109 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -a $admin_address -w $mail_whitelist");
|
109 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -a $mail_admin -w $mail_whitelist");
|
110 |
}
|
110 |
}
|
111 |
else {
|
111 |
else {
|
112 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -w $mail_whitelist");
|
112 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -w $mail_whitelist");
|
113 |
}
|
113 |
}
|
114 |
break;
|
114 |
break;
|
115 |
case '2':
|
115 |
case '2':
|
116 |
if(isset($mail_admin)){
|
116 |
if ($admin_enable == "1"){
|
117 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_port -r $mail_ip -a $admin_address -w $mail_whitelist");
|
117 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_port -r $mail_ip -a $mail_admin -w $mail_whitelist");
|
118 |
}
|
118 |
}
|
119 |
else {
|
119 |
else {
|
120 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_port -r $mail_ip -w $mail_whitelist");
|
120 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_port -r $mail_ip -w $mail_whitelist");
|
121 |
}
|
121 |
}
|
122 |
break;
|
122 |
break;
|
123 |
case '3':
|
123 |
case '3':
|
124 |
if ($mail_mdp == $mail_mdp2) {
|
124 |
if(($mail_mdp != '') && ($mail_mdp==$mail_mdp2)) {
|
125 |
switch ($mail_server) {
|
125 |
switch ($mail_server) {
|
126 |
case '1':
|
126 |
case '1':
|
127 |
$mail_smtp_ip = "smtp.orange.fr";
|
127 |
$mail_smtp_ip = "smtp.orange.fr";
|
128 |
$mail_port = 465;
|
128 |
$mail_port = 465;
|
129 |
break;
|
129 |
break;
|
Line 157... |
Line 157... |
157 |
break;
|
157 |
break;
|
158 |
default:
|
158 |
default:
|
159 |
echo "Erreur dans la saisie !";
|
159 |
echo "Erreur dans la saisie !";
|
160 |
break;
|
160 |
break;
|
161 |
}
|
161 |
}
|
162 |
if(isset($mail_admin)){
|
162 |
if ($admin_enable == "1"){
|
163 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp_ip -p $mail_port -m $mail_address -o $mail_mdp -a $admin_address -w $mail_whitelist");
|
163 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp_ip -p $mail_port -m $mail_address -o $mail_mdp -a $mail_admin -w $mail_whitelist");
|
164 |
}
|
164 |
}
|
165 |
else {
|
165 |
else {
|
166 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp_ip -p $mail_port -m $mail_address -o $mail_mdp -w $mail_whitelist");
|
166 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp_ip -p $mail_port -m $mail_address -o $mail_mdp -w $mail_whitelist");
|
167 |
}
|
167 |
}
|
168 |
}
|
168 |
}
|
169 |
else { // password are not the same
|
169 |
else { // no password or password are not same
|
170 |
echo "Erreur";
|
170 |
header("Refresh:0");
|
171 |
}
|
171 |
}
|
172 |
break;
|
172 |
break;
|
173 |
default:
|
173 |
default:
|
174 |
echo "Erreur dans la saisie !";
|
174 |
echo "Erreur dans la saisie !";
|
175 |
break;
|
175 |
break;
|
Line 190... |
Line 190... |
190 |
<title><?= $l_mail_title ?></title>
|
190 |
<title><?= $l_mail_title ?></title>
|
191 |
<link type="text/css" href="/css/acc.css" rel="stylesheet">
|
191 |
<link type="text/css" href="/css/acc.css" rel="stylesheet">
|
192 |
<link type="text/css" href="/css/mail.css" rel="stylesheet">
|
192 |
<link type="text/css" href="/css/mail.css" rel="stylesheet">
|
193 |
<script>
|
193 |
<script>
|
194 |
function onMailStatusChange() {
|
194 |
function onMailStatusChange() {
|
195 |
var listToDisables1 = ['mail_type','admin_enable','admin_address','mail_whitelist'];
|
195 |
var listToDisables1 = ['mail_type','admin_enable','mail_admin','mail_whitelist'];
|
196 |
var listToDisables2 = ['mail_server','mail_type','admin_enable','admin_address','mail_whitelist','mail_smtp_ip'];
|
196 |
var listToDisables2 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip'];
|
197 |
var listToDisables3 = ['mail_server','mail_mdp2','mail_mdp','mail_address','mail_type','admin_enable','admin_address','mail_whitelist'];
|
197 |
var listToDisables3 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip','mail_mdp2','mail_mdp','mail_address'];
|
198 |
var formSubmit = document.querySelector('form input[type="submit"]');
|
198 |
var formSubmit = document.querySelector('form input[type="submit"]');
|
199 |
var btn_checkConf = document.getElementById('btn-checkconf');
|
- |
|
200 |
var isChecked = false;
|
199 |
var isChecked = false;
|
- |
|
200 |
for (var i=0; i<listToDisables1.length; i++) {
|
- |
|
201 |
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
202 |
document.getElementById(listToDisables1[i]).disabled = true;
|
- |
|
203 |
}
|
- |
|
204 |
for (var i=0; i<listToDisables2.length; i++) {
|
- |
|
205 |
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
206 |
document.getElementById(listToDisables2[i]).disabled = true;
|
- |
|
207 |
}
|
- |
|
208 |
for (var i=0; i<listToDisables3.length; i++) {
|
- |
|
209 |
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
210 |
document.getElementById(listToDisables3[i]).disabled = true;
|
- |
|
211 |
}
|
201 |
if (document.getElementById('auth_enable').value === 'on') {
|
212 |
if (document.getElementById('auth_enable').value === 'on') {
|
202 |
for (var i=0; i<listToDisables1.length; i++) {
|
- |
|
203 |
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
204 |
document.getElementById(listToDisables1[i]).disabled = true;
|
- |
|
205 |
}
|
- |
|
206 |
for (var i=0; i<listToDisables2.length; i++) {
|
- |
|
207 |
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
208 |
document.getElementById(listToDisables2[i]).disabled = true;
|
- |
|
209 |
}
|
- |
|
210 |
for (var i=0; i<listToDisables3.length; i++) {
|
- |
|
211 |
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
212 |
document.getElementById(listToDisables3[i]).disabled = true;
|
- |
|
213 |
}
|
- |
|
214 |
document.getElementById('mail_type').style.backgroundColor = null;
|
213 |
document.getElementById('mail_type').style.backgroundColor = null;
|
215 |
document.getElementById('mail_type').disabled = false;
|
214 |
document.getElementById('mail_type').disabled = false;
|
216 |
if (document.getElementById('mail_type').value === 'on') {
|
215 |
if (document.getElementById('mail_type').value === '1') {
|
217 |
for (var i=0; i<listToDisables1.length; i++) {
|
216 |
for (var i=0; i<listToDisables1.length; i++) {
|
218 |
document.getElementById(listToDisables1[i]).style.backgroundColor = null;
|
217 |
document.getElementById(listToDisables1[i]).style.backgroundColor = null;
|
219 |
document.getElementById(listToDisables1[i]).disabled = false;
|
218 |
document.getElementById(listToDisables1[i]).disabled = false;
|
220 |
}
|
219 |
}
|
221 |
if (document.getElementById('admin_enable').value === '0') {
|
220 |
if (document.getElementById('admin_enable').value === '0') {
|
222 |
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
|
221 |
document.getElementById('mail_admin').style.backgroundColor = '#c0c0c0';
|
223 |
document.getElementById('admin_address').disabled = true;
|
222 |
document.getElementById('mail_admin').disabled = true;
|
224 |
}
|
223 |
}
|
225 |
}
|
224 |
}
|
226 |
else if (document.getElementById('mail_type').value === '2') {
|
225 |
else if (document.getElementById('mail_type').value === '2') {
|
227 |
for (var i=0; i<listToDisables2.length; i++) {
|
226 |
for (var i=0; i<listToDisables2.length; i++) {
|
228 |
document.getElementById(listToDisables2[i]).style.backgroundColor = null;
|
227 |
document.getElementById(listToDisables2[i]).style.backgroundColor = null;
|
229 |
document.getElementById(listToDisables2[i]).disabled = false;
|
228 |
document.getElementById(listToDisables2[i]).disabled = false;
|
230 |
}
|
229 |
}
|
231 |
if (document.getElementById('admin_enable').value === '0') {
|
230 |
if (document.getElementById('admin_enable').value === '0') {
|
232 |
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
|
231 |
document.getElementById('mail_admin').style.backgroundColor = '#c0c0c0';
|
233 |
document.getElementById('admin_address').disabled = true;
|
232 |
document.getElementById('mail_admin').disabled = true;
|
- |
|
233 |
}
|
- |
|
234 |
if (document.getElementById('mail_server').value != '9') {
|
- |
|
235 |
document.getElementById('mail_smtp_ip').style.backgroundColor = '#c0c0c0';
|
- |
|
236 |
document.getElementById('mail_smtp_ip').disabled = true;
|
234 |
}
|
237 |
}
|
235 |
}
|
238 |
}
|
236 |
else if (document.getElementById('mail_type').value === '3') {
|
239 |
else if (document.getElementById('mail_type').value === '3') {
|
237 |
for (var i=0; i<listToDisables3.length; i++) {
|
240 |
for (var i=0; i<listToDisables3.length; i++) {
|
238 |
document.getElementById(listToDisables3[i]).style.backgroundColor = null;
|
241 |
document.getElementById(listToDisables3[i]).style.backgroundColor = null;
|
239 |
document.getElementById(listToDisables3[i]).disabled = false;
|
242 |
document.getElementById(listToDisables3[i]).disabled = false;
|
240 |
}
|
243 |
}
|
241 |
if (document.getElementById('admin_enable').value === '0') {
|
244 |
if (document.getElementById('admin_enable').value === '0') {
|
242 |
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
|
245 |
document.getElementById('mail_admin').style.backgroundColor = '#c0c0c0';
|
243 |
document.getElementById('admin_address').disabled = true;
|
246 |
document.getElementById('mail_admin').disabled = true;
|
- |
|
247 |
}
|
- |
|
248 |
if (document.getElementById('mail_server').value != '9') {
|
- |
|
249 |
document.getElementById('mail_smtp_ip').style.backgroundColor = '#c0c0c0';
|
- |
|
250 |
document.getElementById('mail_smtp_ip').disabled = true;
|
244 |
}
|
251 |
}
|
245 |
}
|
252 |
}
|
246 |
formSubmit.style.display = null;
|
253 |
formSubmit.style.display = null;
|
247 |
btn_checkConf.style.display = 'none';
|
- |
|
248 |
} else {
|
- |
|
249 |
for (var i=0; i<listToDisables1.length; i++) {
|
- |
|
250 |
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
251 |
document.getElementById(listToDisables1[i]).disabled = true;
|
- |
|
252 |
}
|
- |
|
253 |
for (var i=0; i<listToDisables2.length; i++) {
|
- |
|
254 |
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
255 |
document.getElementById(listToDisables2[i]).disabled = true;
|
- |
|
256 |
}
|
- |
|
257 |
for (var i=0; i<listToDisables3.length; i++) {
|
- |
|
258 |
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
|
- |
|
259 |
document.getElementById(listToDisables3[i]).disabled = true;
|
- |
|
260 |
}
|
- |
|
261 |
formSubmit.style.display = null;
|
- |
|
262 |
btn_checkConf.style.display = 'none';
|
- |
|
263 |
}
|
254 |
}
|
264 |
}
|
255 |
}
|
265 |
</script>
|
256 |
</script>
|
266 |
</head>
|
257 |
</head>
|
267 |
<body onLoad="onMailStatusChange();">
|
258 |
<body onLoad="onMailStatusChange();">
|
Line 352... |
Line 343... |
352 |
<dt>
|
343 |
<dt>
|
353 |
<label for="admin_enable"><?= $l_admin_log ?></label>
|
344 |
<label for="admin_enable"><?= $l_admin_log ?></label>
|
354 |
</dt>
|
345 |
</dt>
|
355 |
<dd>
|
346 |
<dd>
|
356 |
<select id="admin_enable" name="admin_enable" onchange="onMailStatusChange();">
|
347 |
<select id="admin_enable" name="admin_enable" onchange="onMailStatusChange();">
|
357 |
<option value="1"<?= ($admin_address != '') ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
|
348 |
<option value="1"<?= ($mail_admin != '') ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
|
358 |
<option value="0"<?= ($admin_address == '') ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
|
349 |
<option value="0"<?= ($mail_admin == '') ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
|
359 |
</select>
|
350 |
</select>
|
360 |
</dd>
|
351 |
</dd>
|
361 |
</dl>
|
352 |
</dl>
|
362 |
<dl>
|
353 |
<dl>
|
363 |
<dt>
|
354 |
<dt>
|
364 |
<label for="admin_address"><?= $l_admin_address ?></label><br>
|
355 |
<label for="mail_admin"><?= $l_mail_admin ?></label><br>
|
365 |
</dt>
|
356 |
</dt>
|
366 |
<dd>
|
357 |
<dd>
|
367 |
<input type="text" id="admin_address" size="40" name="admin_address" value="<?= $admin_address ?>" oninput="onMailStatusChange();">
|
358 |
<input type="text" id="mail_admin" size="40" name="mail_admin" value="<?= $mail_admin ?>" oninput="onMailStatusChange();">
|
368 |
</dd>
|
359 |
</dd>
|
369 |
</dl>
|
360 |
</dl>
|
370 |
<dl>
|
361 |
<dl>
|
371 |
<dt>
|
362 |
<dt>
|
372 |
<label for="mail_whitelist"><?= $l_whitelist_domain ?></label><br>
|
363 |
<label for="mail_whitelist"><?= $l_whitelist_domain ?></label><br>
|