2990 |
rexy |
1 |
<?php
|
|
|
2 |
# $Id: mail.php 2853 2020-07-19 21:50:07Z joss_p $
|
|
|
3 |
|
|
|
4 |
/* written by Joss_p */
|
|
|
5 |
/****************************************************************
|
|
|
6 |
* GLOBAL FILE PATHS *
|
|
|
7 |
*****************************************************************/
|
|
|
8 |
define('CONF_FILE', '/usr/local/etc/alcasar-mail.conf');
|
|
|
9 |
|
|
|
10 |
/****************************************************************
|
|
|
11 |
* FILE reading test *
|
|
|
12 |
*****************************************************************/
|
|
|
13 |
$conf_files = array(CONF_FILE);
|
|
|
14 |
foreach ($conf_files as $file) {
|
|
|
15 |
if (!file_exists($file)) {
|
|
|
16 |
exit("Fichier $file non présent");
|
|
|
17 |
}
|
|
|
18 |
if (!is_readable($file)) {
|
|
|
19 |
exit("Vous n'avez pas les droits de lecture sur le fichier $file");
|
|
|
20 |
}
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
/****************************************************************
|
|
|
24 |
* Read CONF_FILE *
|
|
|
25 |
*****************************************************************/
|
|
|
26 |
$file_conf = fopen(CONF_FILE, 'r');
|
|
|
27 |
if (!$file_conf) {
|
|
|
28 |
exit('Error opening the file '.CONF_FILE);
|
|
|
29 |
}
|
|
|
30 |
while (!feof($file_conf)) {
|
|
|
31 |
$buffer = fgets($file_conf, 4096);
|
|
|
32 |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
|
|
|
33 |
$tmp = explode('=', $buffer, 2);
|
|
|
34 |
$conf[trim($tmp[0])] = trim($tmp[1]);
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
fclose($file_conf);
|
|
|
38 |
|
|
|
39 |
/****************************************************************
|
|
|
40 |
* Choice of language *
|
|
|
41 |
*****************************************************************/
|
|
|
42 |
$Language = 'en';
|
|
|
43 |
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
|
|
44 |
$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
45 |
$Language = strtolower(substr(chop($Langue[0]), 0, 2));
|
|
|
46 |
}
|
|
|
47 |
if ($Language === 'fr') {
|
|
|
48 |
$l_ldap_update = "Mise à jour des paramètres LDAP effectuée";
|
|
|
49 |
$l_mail_title = "Authentification externe : Adresse mail";
|
|
|
50 |
$l_ldap_legend = "Authentification LDAP";
|
|
|
51 |
$l_mail_auth_enable_label = "Activer l'authentification par mail :";
|
|
|
52 |
$l_mail_YES = "OUI";
|
|
|
53 |
$l_mail_NO = "NON";
|
|
|
54 |
$l_ldap_server_label = "Serveur LDAP:";
|
|
|
55 |
$l_ldap_server_text = "Adresse IP du serveur";
|
|
|
56 |
$l_ldap_base_dn_label = "DN de la base:";
|
|
|
57 |
$l_ldap_base_dn_text = "Le DN (Distinguished Name) définit où se situent les informations des utilisateurs dans l'annuaire.<br> - Exemple LDAP: 'o=mycompany, c=FR'.<br> - Exemple AD 'cn=Users,dc=server_name,dc=localdomain'";
|
|
|
58 |
$l_ldap_uid_label = "Identifiant d'utilisateur (UID):";
|
|
|
59 |
$l_ldap_uid_text = "Clé utilisée pour rechercher un identifiant de connexion.<br> - Exemple LDAP: 'uid', 'sn', etc.<br> - Pour A.D. mettre 'sAMAccountName'.";
|
|
|
60 |
$l_ldap_base_filter_label = "Filtre de recherche des utilisateurs (optionnel):";
|
|
|
61 |
$l_ldap_base_filter_text = "Vous pouvez limiter les objets recherchés avec des filtres additionnels.<br> Exemple 'objectClass=posixGroup' ajouterait le filtre '(&(uid=username)(objectClass=posixGroup))'";
|
|
|
62 |
$l_ldap_user_label = "CN de l'utilisateur exploité par ALCASAR:";
|
|
|
63 |
$l_ldap_user_text = "CN=Common Name. Laissez vide pour utiliser un accès invité (ou anonyme). Obligatoire sur un AD.<br> - Exemple LDAP : 'uid=username,ou=my_lan,o=mycompany,c=FR'.<br> - Exemple AD : 'username' ou 'cn=username,cn=Users,dc=server_name,dc=localdomain'";
|
|
|
64 |
$l_ldap_password_label = "Mot de passe:";
|
|
|
65 |
$l_ldap_password_text = "Laissez vide pour un accès invité (ou anonyme). Obligatoire sur un AD.";
|
|
|
66 |
$l_ldap_ssl_label = "Connexion chiffré";
|
|
|
67 |
$l_mail_type_text = "Utiliser une connexion chiffré avec SSL (LDAPS)";
|
|
|
68 |
$l_ldap_cert_required_label = "Vérifier le certificat SSL";
|
|
|
69 |
$l_ldap_cert_required_text = "Vérifier que le serveur LDAP utilise un certificat connu";
|
|
|
70 |
$l_ldap_cert_label = "Certificat SSL (CA)";
|
|
|
71 |
$l_ldap_cert_text = "Certificat de l'authorité de certification signant celui du serveur LDAP";
|
|
|
72 |
$l_ad_dns_domain_label = "Nom de domaine interne";
|
|
|
73 |
$l_ad_dns_domain_text = "Nom de domaine qui sera redirigé vers le serveur DNS de l'annuaire LDAP (vide pour désactivé)";
|
|
|
74 |
$l_ldap_cert_status_cur = "Certificat actuel : ";
|
|
|
75 |
$l_ldap_cert_status_no = "Aucun certificat installé";
|
|
|
76 |
$l_mail_submit = "Enregistrer";
|
|
|
77 |
$l_ldap_test_service_failed = "Service LDAP injoignable sur ce serveur (vérifiez l'@IP).";
|
|
|
78 |
$l_ldap_test_service_ok = "Un port 389 (636 avec SSL) est actif sur ce serveur";
|
|
|
79 |
$l_ldap_test_connection_failed = "Connexion LDAP impossible (vérifiez le service LDAP sur ce serveur)";
|
|
|
80 |
$l_ldap_test_connection_ok = "Une connexion LDAP a été établie";
|
|
|
81 |
$l_ldap_test_bind_failed = "Echec d'authentification (vérifiez l'utilisateur et le mot de passe)";
|
|
|
82 |
$l_ldap_test_bind_ok = "L'authentification a réussie";
|
|
|
83 |
$l_ldap_test_dn_failed = "Le DN de la base semble incorrect (vérifiez le)";
|
|
|
84 |
$l_ldap_test_dn_ok = "Le DN de la base semble correct";
|
|
|
85 |
$l_ldap_error = "erreur LDAP";
|
|
|
86 |
$l_ldap_entries = "entrées dans la base";
|
|
|
87 |
$l_ldap_cert_cn_diff_dn = "Le CommonName du certificat (§cert_domainName§) est différent du nom de domaine du serveur";
|
|
|
88 |
$l_check = "Vérifier cette configuration";
|
|
|
89 |
$l_checkingConf = "Vérification de cette configuration...";
|
|
|
90 |
} else {
|
|
|
91 |
$l_ldap_update = "LDAP settings updated";
|
|
|
92 |
$l_mail_title = "External authentication : Address mail";
|
|
|
93 |
$l_ldap_legend = "LDAP authentication";
|
|
|
94 |
$l_mail_auth_enable_label = "Enable email authentication :";
|
|
|
95 |
$l_mail_YES = "YES";
|
|
|
96 |
$l_mail_NO = "NO";
|
|
|
97 |
$l_ldap_server_label = "LDAP server :";
|
|
|
98 |
$l_ldap_server_text = "IP address of the LDAP server.";
|
|
|
99 |
$l_ldap_base_dn_label = "DN of the base:";
|
|
|
100 |
$l_ldap_base_dn_text = "The DN (Distinguished Name) is used to locate the users information in the directory.<br> e.g. LDAP : 'o=MyCompany,c=US'.<br> e.g. AD : 'cn=Users,dc=server_name,dc=localdomain'";
|
|
|
101 |
$l_ldap_uid_label = "User IDentifier (UID):";
|
|
|
102 |
$l_ldap_uid_text = "Key used to search for a given login identity.<br>e.g. 'uid', 'sn', etc.. For AD use 'sAMAccountName'.";
|
|
|
103 |
$l_ldap_base_filter_label = "User search filter (optional):";
|
|
|
104 |
$l_ldap_base_filter_text = "You can further limit the searched objects with additional filters.<br> For example 'objectClass=posixGroup' would result in the use of '(&(uid=username)(objectClass=posixGroup))'";
|
|
|
105 |
$l_ldap_user_label = "CN of the user operated by ALCASAR:";
|
|
|
106 |
$l_ldap_user_text = "CN=Common Name. Leave blank to use anonymous binding. Mandatory for AD.<br> e.g. LDAP :'uid=Username,ou=my_lan,o=mycompany,c=US'.<br> e.g. AD : 'username' or 'cn=username,cn=Users,dc=server_name,dc=localdomain'";
|
|
|
107 |
$l_ldap_password_label = "Password:";
|
|
|
108 |
$l_ldap_password_text = "Leave blank to use anonymous binding. Mandatory for AD.";
|
|
|
109 |
$l_ldap_ssl_label = "Secure connection";
|
|
|
110 |
$l_mail_type_text = "Use an encrypted connection with SSL (LDAPS)";
|
|
|
111 |
$l_ldap_cert_required_label = "Check the SSL certificate";
|
|
|
112 |
$l_ldap_cert_required_text = "Verify that the LDAP server uses a trusted certificate";
|
|
|
113 |
$l_ldap_cert_label = "SSL certificate (CA)";
|
|
|
114 |
$l_ldap_cert_text = "Certificate of the certification authority that signed the LDAP server certificate";
|
|
|
115 |
$l_ad_dns_domain_label = "Internal domain name";
|
|
|
116 |
$l_ad_dns_domain_text = "Domain name that will be forwarded to the DNS server of the LDAP directory (empty for disabled)";
|
|
|
117 |
$l_ldap_cert_status_cur = "Current certificate:";
|
|
|
118 |
$l_ldap_cert_status_no = "No certificate imported";
|
|
|
119 |
$l_mail_submit = "Save";
|
|
|
120 |
$l_ldap_test_service_failed = "LDAP service is not reachable on that server (check IP)";
|
|
|
121 |
$l_ldap_test_service_ok = "A port 389 (636 with SSL) is open on this server";
|
|
|
122 |
$l_ldap_test_connection_failed = "LDAP connexion failed (check the LDAP service on this server)";
|
|
|
123 |
$l_ldap_test_connection_ok = "A LDAP connexion is established";
|
|
|
124 |
$l_ldap_test_bind_failed = "LDAP authentication failed (check the LDAP user and password)";
|
|
|
125 |
$l_ldap_test_bind_ok = "Successful authentication";
|
|
|
126 |
$l_ldap_test_dn_failed = "DN of the base seems to be wrong (check it)";
|
|
|
127 |
$l_ldap_test_dn_ok = "DN of the base seems to be ok";
|
|
|
128 |
$l_ldap_error = "LDAP error";
|
|
|
129 |
$l_ldap_entries = "entries in the base";
|
|
|
130 |
$l_ldap_cert_cn_diff_dn = "Certificate CommonName (§cert_domainName§) is different from the server domain name";
|
|
|
131 |
$l_check = "Check this config";
|
|
|
132 |
$l_checkingConf = "Checking this configuration...";
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
// Mail configuration params
|
|
|
137 |
$mail_status = $conf['MAIL'];
|
|
|
138 |
$mail_type = $conf['TYPE_MAIL'];
|
|
|
139 |
$mail_address_mail = $conf['mailAddr'];
|
|
|
140 |
$mail_smtp = $conf['smtp'];
|
|
|
141 |
$mail_port = $conf['port'];
|
|
|
142 |
$mail_address_ip = $conf['mailIP'];
|
|
|
143 |
$mail_server = "";
|
|
|
144 |
$mail_password_mail = "";
|
|
|
145 |
$mail_password_mail_2 = "";
|
|
|
146 |
$admin_address = $conf['adminMail'];
|
|
|
147 |
$mail_whitelist = $conf['whiteDomain'];
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
if(isset($_POST['submit'])){
|
|
|
151 |
if($_POST['auth_enable'] === '1')
|
|
|
152 |
{
|
|
|
153 |
exec("systemctl start postfix");
|
|
|
154 |
|
|
|
155 |
$mail_status = $_POST['auth_enable'];
|
|
|
156 |
$mail_type = $_POST['mail_type'];
|
|
|
157 |
$mail_address = $_POST['mail_address'];
|
|
|
158 |
$mail_ip = $_POST['mail_ip'];
|
|
|
159 |
$mail_server = $_POST['mail_server'];
|
|
|
160 |
$mail_mdp = $_POST['mail_mdp'];
|
|
|
161 |
$mail_mdp2 = $_POST['mail_mdp2'];
|
|
|
162 |
$admin_enable = $_POST['admin_enable'];
|
|
|
163 |
$admin_address = $_POST['admin_address'];
|
|
|
164 |
$mail_whitelist = $_POST['mail_whitelist'];
|
|
|
165 |
|
|
|
166 |
exec("cp /var/www/mail/header.php /var/www/html");
|
|
|
167 |
exec("cp /var/www/mail/inscription.php /var/www/html");
|
|
|
168 |
exec("cp /var/www/mail/inscription_traitement.php /var/www/html");
|
|
|
169 |
exec("cp /var/www/html/acc/admin/services.php /var/www/html/acc/admin/services.php.origin");
|
|
|
170 |
exec("cp /var/www/mail/services.php /var/www/html/acc/admin");
|
|
|
171 |
|
|
|
172 |
if ($mail_mdp == $mail_mdp2) {
|
|
|
173 |
switch ($mail_server) {
|
|
|
174 |
case '1':
|
|
|
175 |
$mail_smtp = "smtp.orange.fr";
|
|
|
176 |
$mail_port = 465;
|
|
|
177 |
break;
|
|
|
178 |
case '2':
|
|
|
179 |
$mail_smtp = "smtp.live.com";
|
|
|
180 |
$mail_port = 587;
|
|
|
181 |
break;
|
|
|
182 |
case '3':
|
|
|
183 |
$mail_smtp = "smtp.office365.com";
|
|
|
184 |
$mail_port = 587;
|
|
|
185 |
break;
|
|
|
186 |
case '4':
|
|
|
187 |
$mail_smtp = "smtp.sfr.fr";
|
|
|
188 |
$mail_port = 465;
|
|
|
189 |
break;
|
|
|
190 |
case '5':
|
|
|
191 |
$mail_smtp = "smtp.free.fr";
|
|
|
192 |
$mail_port = 465;
|
|
|
193 |
break;
|
|
|
194 |
case '6':
|
|
|
195 |
$mail_smtp = "smtp.gmail.com";
|
|
|
196 |
$mail_port = 587;
|
|
|
197 |
break;
|
|
|
198 |
case '7':
|
|
|
199 |
$mail_smtp = "smtp.laposte.net";
|
|
|
200 |
$mail_port = 465;
|
|
|
201 |
break;
|
|
|
202 |
case '8':
|
|
|
203 |
$mail_smtp = "smtp.bbox.fr";
|
|
|
204 |
$mail_port = 587;
|
|
|
205 |
break;
|
|
|
206 |
default:
|
|
|
207 |
echo "Erreur dans la saisie !";
|
|
|
208 |
break;
|
|
|
209 |
}
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
file_put_contents(CONF_FILE, str_replace('MAIL='.$conf['MAIL'],'MAIL='.$mail_status,file_get_contents(CONF_FILE)));
|
|
|
213 |
file_put_contents(CONF_FILE, str_replace('TYPE_MAIL='.$conf['TYPE_MAIL'],'TYPE_MAIL='.$mail_type,file_get_contents(CONF_FILE)));
|
|
|
214 |
file_put_contents(CONF_FILE, str_replace('mailAddr='.$conf['mailAddr'],'mailAddr='.$mail_address,file_get_contents(CONF_FILE)));
|
|
|
215 |
file_put_contents(CONF_FILE, str_replace('mailIP='.$conf['mailIP'],'mailIP='.$mail_ip,file_get_contents(CONF_FILE)));
|
|
|
216 |
file_put_contents(CONF_FILE, str_replace('smtp='.$conf['smtp'],'smtp='.$mail_smtp,file_get_contents(CONF_FILE)));
|
|
|
217 |
file_put_contents(CONF_FILE, str_replace('port='.$conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
|
|
|
218 |
file_put_contents(CONF_FILE, str_replace('whiteDomain='.$conf['mail_whitelist'],'whiteDomain='.$mail_whitelist,file_get_contents(CONF_FILE)));
|
|
|
219 |
if (isset($admin_address)) {
|
|
|
220 |
file_put_contents(CONF_FILE, str_replace('adminMail='.$conf['admin_address'],'adminMail='.$admin_address,file_get_contents(CONF_FILE)));
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
switch ($mail_type) {
|
|
|
224 |
case '1':
|
|
|
225 |
$mail_port = 25;
|
|
|
226 |
file_put_contents(CONF_FILE, str_replace('port='.$conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
|
|
|
227 |
if(isset($mail_admin)){
|
|
|
228 |
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -1 -a $admin_address -w $mail_whitelist");
|
|
|
229 |
}
|
|
|
230 |
else {
|
|
|
231 |
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -1 -w $mail_whitelist");
|
|
|
232 |
}
|
|
|
233 |
break;
|
|
|
234 |
case '2':
|
|
|
235 |
if(isset($mail_admin)){
|
|
|
236 |
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -2 -s $mail_smtp -p $mail_port -r $mail_ip -a $admin_address -w $mail_whitelist");
|
|
|
237 |
}
|
|
|
238 |
else {
|
|
|
239 |
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -2 -s $mail_smtp -p $mail_port -r $mail_ip -w $mail_whitelist");
|
|
|
240 |
}
|
|
|
241 |
break;
|
|
|
242 |
case '3':
|
|
|
243 |
if(isset($mail_admin)){
|
|
|
244 |
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -3 -s $mail_smtp -p $mail_port -m $mail_address -o $mail_mdp -a $admin_address -w $mail_whitelist");
|
|
|
245 |
}
|
|
|
246 |
else {
|
|
|
247 |
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -3 -s $mail_smtp -p $mail_port -m $mail_address -o $mail_mdp -w $mail_whitelist");
|
|
|
248 |
}
|
|
|
249 |
break;
|
|
|
250 |
default:
|
|
|
251 |
echo "Erreur dans la saisie !";
|
|
|
252 |
break;
|
|
|
253 |
}
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
}
|
|
|
257 |
else {
|
|
|
258 |
echo "Erreur";
|
|
|
259 |
}
|
|
|
260 |
}
|
|
|
261 |
else {
|
|
|
262 |
|
|
|
263 |
exec("cp -f /etc/postfix/main.cf.origin /etc/postfix/main.cf");
|
|
|
264 |
|
|
|
265 |
exec("rm -rf /etc/postfix/sasl/");
|
|
|
266 |
|
|
|
267 |
exec("cp -f /var/www/mail/alcasar-mail.conf /usr/local/etc/");
|
|
|
268 |
|
|
|
269 |
exec("systemctl restart postfix");
|
|
|
270 |
exec("systemctl stop postfix");
|
|
|
271 |
|
|
|
272 |
exec("sed -i '/SMTP_IP=/ s/^/#/g' /usr/local/etc/alcasar-iptables-local.sh");
|
|
|
273 |
exec("sed -i '/SMTP_PORT=/ s/^/#/g' /usr/local/etc/alcasar-iptables-local.sh");
|
|
|
274 |
|
|
|
275 |
exec("rm -f /var/www/html/header.php");
|
|
|
276 |
exec("rm -f /var/www/html/inscription.php");
|
|
|
277 |
exec("rm -f /var/www/html/inscription_traitement.php");
|
|
|
278 |
exec("cp -f /var/www/html/acc/admin/services.php.origin /var/www/html/acc/admin/services.php");
|
|
|
279 |
|
|
|
280 |
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-iptables.sh");
|
|
|
281 |
|
|
|
282 |
}
|
|
|
283 |
|
|
|
284 |
header("Refresh:0");
|
|
|
285 |
|
|
|
286 |
exit;
|
|
|
287 |
}
|
|
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
?>
|
|
|
295 |
<!DOCTYPE html>
|
|
|
296 |
<html>
|
|
|
297 |
<head>
|
|
|
298 |
<meta charset="UTF-8">
|
|
|
299 |
<title><?= $l_mail_title ?></title>
|
|
|
300 |
<link type="text/css" href="/css/acc.css" rel="stylesheet">
|
|
|
301 |
<link type="text/css" href="/css/mail.css" rel="stylesheet">
|
|
|
302 |
<script>
|
|
|
303 |
function onMailStatusChange() {
|
|
|
304 |
var listToDisables1 = ['mail_type','admin_enable','admin_address','mail_whitelist'];
|
|
|
305 |
var listToDisables2 = ['mail_server','mail_type','admin_enable','admin_address','mail_whitelist','mail_ip'];
|
|
|
306 |
var listToDisables3 = ['mail_server','mail_mdp2','mail_mdp','mail_address','mail_type','admin_enable','admin_address','mail_whitelist'];
|
|
|
307 |
var formSubmit = document.querySelector('form input[type="submit"]');
|
|
|
308 |
var btn_checkConf = document.getElementById('btn-checkconf');
|
|
|
309 |
var isChecked = false;
|
|
|
310 |
|
|
|
311 |
if (document.getElementById('auth_enable').value === '1') {
|
|
|
312 |
for (var i=0; i<listToDisables1.length; i++) {
|
|
|
313 |
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
|
|
|
314 |
document.getElementById(listToDisables1[i]).disabled = true;
|
|
|
315 |
}
|
|
|
316 |
for (var i=0; i<listToDisables2.length; i++) {
|
|
|
317 |
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
|
|
|
318 |
document.getElementById(listToDisables2[i]).disabled = true;
|
|
|
319 |
}
|
|
|
320 |
for (var i=0; i<listToDisables3.length; i++) {
|
|
|
321 |
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
|
|
|
322 |
document.getElementById(listToDisables3[i]).disabled = true;
|
|
|
323 |
}
|
|
|
324 |
document.getElementById('mail_type').style.backgroundColor = null;
|
|
|
325 |
document.getElementById('mail_type').disabled = false;
|
|
|
326 |
if (document.getElementById('mail_type').value === '1') {
|
|
|
327 |
for (var i=0; i<listToDisables1.length; i++) {
|
|
|
328 |
document.getElementById(listToDisables1[i]).style.backgroundColor = null;
|
|
|
329 |
document.getElementById(listToDisables1[i]).disabled = false;
|
|
|
330 |
}
|
|
|
331 |
if (document.getElementById('admin_enable').value === '0') {
|
|
|
332 |
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
|
|
|
333 |
document.getElementById('admin_address').disabled = true;
|
|
|
334 |
}
|
|
|
335 |
}
|
|
|
336 |
else if (document.getElementById('mail_type').value === '2') {
|
|
|
337 |
for (var i=0; i<listToDisables2.length; i++) {
|
|
|
338 |
document.getElementById(listToDisables2[i]).style.backgroundColor = null;
|
|
|
339 |
document.getElementById(listToDisables2[i]).disabled = false;
|
|
|
340 |
}
|
|
|
341 |
if (document.getElementById('admin_enable').value === '0') {
|
|
|
342 |
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
|
|
|
343 |
document.getElementById('admin_address').disabled = true;
|
|
|
344 |
}
|
|
|
345 |
}
|
|
|
346 |
else if (document.getElementById('mail_type').value === '3') {
|
|
|
347 |
for (var i=0; i<listToDisables3.length; i++) {
|
|
|
348 |
document.getElementById(listToDisables3[i]).style.backgroundColor = null;
|
|
|
349 |
document.getElementById(listToDisables3[i]).disabled = false;
|
|
|
350 |
}
|
|
|
351 |
if (document.getElementById('admin_enable').value === '0') {
|
|
|
352 |
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
|
|
|
353 |
document.getElementById('admin_address').disabled = true;
|
|
|
354 |
}
|
|
|
355 |
}
|
|
|
356 |
formSubmit.style.display = null;
|
|
|
357 |
btn_checkConf.style.display = 'none';
|
|
|
358 |
} else {
|
|
|
359 |
for (var i=0; i<listToDisables1.length; i++) {
|
|
|
360 |
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
|
|
|
361 |
document.getElementById(listToDisables1[i]).disabled = true;
|
|
|
362 |
}
|
|
|
363 |
for (var i=0; i<listToDisables2.length; i++) {
|
|
|
364 |
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
|
|
|
365 |
document.getElementById(listToDisables2[i]).disabled = true;
|
|
|
366 |
}
|
|
|
367 |
for (var i=0; i<listToDisables3.length; i++) {
|
|
|
368 |
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
|
|
|
369 |
document.getElementById(listToDisables3[i]).disabled = true;
|
|
|
370 |
}
|
|
|
371 |
formSubmit.style.display = null;
|
|
|
372 |
btn_checkConf.style.display = 'none';
|
|
|
373 |
}
|
|
|
374 |
}
|
|
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
|
378 |
</script>
|
|
|
379 |
</head>
|
|
|
380 |
<body onLoad="onMailStatusChange();">
|
|
|
381 |
<div class="panel">
|
|
|
382 |
<div class="panel-header"><?= "Authentication Mail" ?></div>
|
|
|
383 |
<div class="panel-body">
|
|
|
384 |
<form id="form-config_mail" name="config_mail" method="POST" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
|
|
|
385 |
<fieldset>
|
|
|
386 |
<legend>
|
|
|
387 |
<br>
|
|
|
388 |
<div style="text-align: center">
|
|
|
389 |
</div>
|
|
|
390 |
</legend>
|
|
|
391 |
<dl>
|
|
|
392 |
<dt>
|
|
|
393 |
<label for="auth_enable"><?= "Activer l'authentification par mail :" ?></label>
|
|
|
394 |
</dt>
|
|
|
395 |
<dd>
|
|
|
396 |
<select id="auth_enable" name="auth_enable" onchange="onMailStatusChange();">
|
|
|
397 |
<option value="1"<?= ($mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
|
|
|
398 |
<option value="0"<?= (!$mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
|
|
|
399 |
</select>
|
|
|
400 |
</dd>
|
|
|
401 |
</dl>
|
|
|
402 |
<dl>
|
|
|
403 |
<dt>
|
|
|
404 |
<label for="mail_type"><?= "Type Messagerie" ?></label><br>
|
|
|
405 |
<?= "Choississez le type de messagerie a utiliser" ?><br>
|
|
|
406 |
</dt>
|
|
|
407 |
<dd>
|
|
|
408 |
<select id="mail_type" name="mail_type" onchange="onMailStatusChange();">
|
|
|
409 |
<option value=1>Nom de domaine</option>
|
|
|
410 |
<option value=2>Serveur mail ou serveur SMTP</option>
|
|
|
411 |
<option value=3>Adresse de messagerie</option>
|
|
|
412 |
</select>
|
|
|
413 |
</dd>
|
|
|
414 |
</dl>
|
|
|
415 |
<dl>
|
|
|
416 |
<dt>
|
|
|
417 |
<label for="mail_address"><?= "Adresse Messagerie"?></label><br>
|
|
|
418 |
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
|
|
|
419 |
</dt>
|
|
|
420 |
<dd>
|
|
|
421 |
<input type="text" id="mail_address" size="40" name="mail_address" value="<?= $mail_address_mail ?>" oninput="onMailStatusChange();">
|
|
|
422 |
</dd>
|
|
|
423 |
</dl>
|
|
|
424 |
<dl>
|
|
|
425 |
<dt>
|
|
|
426 |
<label for="mail_mdp"><?= "Mot de passe Messagerie"?></label><br>
|
|
|
427 |
<?= "Mot de passe de la messagerie utilisé pour l'envoi" ?>
|
|
|
428 |
</dt>
|
|
|
429 |
<dd>
|
|
|
430 |
<input type="text" id="mail_mdp" size="40" name="mail_mdp" value="<?= $mail_password_mail ?>" oninput="onMailStatusChange();">
|
|
|
431 |
</dd>
|
|
|
432 |
</dl>
|
|
|
433 |
<dl>
|
|
|
434 |
<dt>
|
|
|
435 |
<label for="mail_mdp2"><?= "Confirmer Mot de passe Messagerie"?></label><br>
|
|
|
436 |
<?= "Confirmer le mot de passe de la messagerie utilisé pour l'envoi" ?>
|
|
|
437 |
</dt>
|
|
|
438 |
<dd>
|
|
|
439 |
<input type="text" id="mail_mdp2" size="40" name="mail_mdp2" value="<?= $mail_password_mail_2 ?>" oninput="onMailStatusChange();">
|
|
|
440 |
</dd>
|
|
|
441 |
</dl>
|
|
|
442 |
<dl>
|
|
|
443 |
<dt>
|
|
|
444 |
<label for="mail_server"><?= "CHoix Serveur SMTP" ?></label><br>
|
|
|
445 |
<?= "Choissisiez le serveur SMTP correspondant à l'adress de messagerie" ?><br>
|
|
|
446 |
</dt>
|
|
|
447 |
<dd>
|
|
|
448 |
<select id="mail_server" name="mail_server" onchange="onMailStatusChange();">
|
|
|
449 |
<option value=1>Orange/Wanadoo</option>
|
|
|
450 |
<option value=2>Hotmail</option>
|
|
|
451 |
<option value=3>Outlook</option>
|
|
|
452 |
<option value=4>SFR</option>
|
|
|
453 |
<option value=5>Free</option>
|
|
|
454 |
<option value=6>Gmail</option>
|
|
|
455 |
<option value=7>Laposte</option>
|
|
|
456 |
<option value=8>Bouygues</option>
|
|
|
457 |
<option value=9>Personnalisé</option>
|
|
|
458 |
</select>
|
|
|
459 |
</dd>
|
|
|
460 |
</dl>
|
|
|
461 |
<dl>
|
|
|
462 |
<dt>
|
|
|
463 |
<label for="mail_ip"><?= "IP du serveur SMTP"?></label><br>
|
|
|
464 |
<?= "Adresse IP du serveur SMTP utilisé" ?>
|
|
|
465 |
</dt>
|
|
|
466 |
<dd>
|
|
|
467 |
<input type="text" id="mail_ip" size="40" name="mail_ip" value="<?= $mail_address_ip ?>" oninput="onMailStatusChange();">
|
|
|
468 |
</dd>
|
|
|
469 |
</dl>
|
|
|
470 |
<dl>
|
|
|
471 |
<dt>
|
|
|
472 |
<label for="admin_enable"><?= "Activer l'adresse admin :" ?></label>
|
|
|
473 |
</dt>
|
|
|
474 |
<dd>
|
|
|
475 |
<select id="admin_enable" name="admin_enable" onchange="onMailStatusChange();">
|
|
|
476 |
<option value="1"<?= ($mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
|
|
|
477 |
<option value="0"<?= (!$mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
|
|
|
478 |
</select>
|
|
|
479 |
</dd>
|
|
|
480 |
</dl>
|
|
|
481 |
<dl>
|
|
|
482 |
<dt>
|
|
|
483 |
<label for="admin_address"><?= "Adresse Messagerie admin"?></label><br>
|
|
|
484 |
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
|
|
|
485 |
</dt>
|
|
|
486 |
<dd>
|
|
|
487 |
<input type="text" id="admin_address" size="40" name="admin_address" value="<?= $admin_address ?>" oninput="onMailStatusChange();">
|
|
|
488 |
</dd>
|
|
|
489 |
</dl>
|
|
|
490 |
<dl>
|
|
|
491 |
<dt>
|
|
|
492 |
<label for="mail_whitelist"><?= "whitelist domaine"?></label><br>
|
|
|
493 |
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
|
|
|
494 |
</dt>
|
|
|
495 |
<dd>
|
|
|
496 |
<input type="text" id="mail_whitelist" size="40" name="mail_whitelist" value="<?= $mail_whitelist ?>" oninput="onMailStatusChange();">
|
|
|
497 |
</dd>
|
|
|
498 |
</dl>
|
|
|
499 |
<p>
|
|
|
500 |
<!--<button id="btn-checkconf" onclick="checkConfig(); return false;"><?= $l_check ?></button>-->
|
|
|
501 |
<input id="submit" type="submit" value="<?= $l_mail_submit ?>" name="submit">
|
|
|
502 |
</p>
|
|
|
503 |
</fieldset>
|
|
|
504 |
</form>
|
|
|
505 |
</div>
|
|
|
506 |
</div>
|
|
|
507 |
</body>
|
|
|
508 |
</html>
|