Subversion Repositories ALCASAR

Rev

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

Rev 2997 Rev 3000
Line 50... Line 50...
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_server_ip		= "Adresse IP 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_mail			= "Adresse Email de l'administrateur";
57
	$l_admin_address		= "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 {
Line 68... Line 68...
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_server_ip		= "IP address 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_mail			= "Administrator Email address";
75
	$l_admin_address		= "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
}
81
 
81
 
82
// Mail configuration params
82
// Mail configuration params
83
$mail_status        	= $mail_conf['MAIL'];
83
$mail_status        	= $mail_conf['MAIL'];
84
$mail_type				= $mail_conf['MAIL_TYPE'];
84
$mail_type				= $mail_conf['MAIL_TYPE'];
85
$mail_address_mail		= $mail_conf['MAIL_ADDR'];
85
$mail_address			= $mail_conf['MAIL_ADDR'];
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_address_ip		= $mail_conf['MAIL_SMTP_IP'];
88
$mail_smtp_ip			= $mail_conf['MAIL_SMTP_IP'];
89
$mail_server			= "";
-
 
90
$mail_password_mail 	= "";
89
$mail_password_mail 	= "";
91
$mail_password_mail_2	= "";
90
$mail_password_mail_2	= "";
92
$admin_address			= $mail_conf['MAIL_ADMIN'];
91
$admin_address			= $mail_conf['MAIL_ADMIN'];
93
$mail_whitelist			= $mail_conf['MAIL_WHITEDOMAIN'];
92
$mail_whitelist			= $mail_conf['MAIL_WHITEDOMAIN'];
94
 
93
 
Line 96... Line 95...
96
	if($_POST['auth_enable'] === 'on')
95
	if($_POST['auth_enable'] === 'on')
97
	{
96
	{
98
		$mail_type 		= $_POST['mail_type'];
97
		$mail_type 		= $_POST['mail_type'];
99
		$mail_address 	= $_POST['mail_address'];
98
		$mail_address 	= $_POST['mail_address'];
100
		$mail_server 	= $_POST['mail_server'];
99
		$mail_server 	= $_POST['mail_server'];
101
		$mail_ip 		= $_POST['mail_ip'];
-
 
102
		$mail_mdp 		= $_POST['mail_mdp'];
100
		$mail_mdp 		= $_POST['mail_mdp'];
103
		$mail_mdp2 		= $_POST['mail_mdp2'];
101
		$mail_mdp2 		= $_POST['mail_mdp2'];
104
		$admin_enable	= $_POST['admin_enable'];
102
		$admin_enable	= $_POST['admin_enable'];
105
		$admin_address	= $_POST['admin_address'];
103
		$admin_address	= $_POST['admin_address'];
106
		$mail_whitelist	= $_POST['mail_whitelist'];
104
		$mail_whitelist	= $_POST['mail_whitelist'];
Line 114... Line 112...
114
					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");
115
				}
113
				}
116
				break;
114
				break;
117
			case '2':
115
			case '2':
118
				if(isset($mail_admin)){
116
				if(isset($mail_admin)){
119
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp -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 $admin_address -w $mail_whitelist");
120
				}
118
				}
121
				else {
119
				else {
122
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp -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");
123
				}
121
				}
124
				break;
122
				break;
125
			case '3':
123
			case '3':
126
				if ($mail_mdp == $mail_mdp2) {
124
				if ($mail_mdp == $mail_mdp2) {
127
					switch ($mail_server) {
125
					switch ($mail_server) {
128
						case '1':
126
						case '1':
129
							$mail_smtp		= "smtp.orange.fr";
127
							$mail_smtp_ip	= "smtp.orange.fr";
130
							$mail_port		= 465;
128
							$mail_port		= 465;
131
						break;
129
						break;
132
						case '2':
130
						case '2':
133
							$mail_smtp		= "smtp.live.com";
131
							$mail_smtp_ip	= "smtp.live.com";
134
							$mail_port		= 587;
132
							$mail_port		= 587;
135
						break;
133
						break;
136
						case '3':
134
						case '3':
137
							$mail_smtp		= "smtp.office365.com";
135
							$mail_smtp_ip	= "smtp.office365.com";
138
							$mail_port		= 587;
136
							$mail_port		= 587;
139
						break;
137
						break;
140
						case '4':
138
						case '4':
141
							$mail_smtp		= "smtp.sfr.fr";
139
							$mail_smtp_ip	= "smtp.sfr.fr";
142
							$mail_port		= 465;
140
							$mail_port		= 465;
143
						break;
141
						break;
144
						case '5':
142
						case '5':
145
							$mail_smtp		= "smtp.free.fr";
143
							$mail_smtp_ip	= "smtp.free.fr";
146
							$mail_port		= 465;	
144
							$mail_port		= 465;	
147
						break;
145
						break;
148
						case '6':
146
						case '6':
149
							$mail_smtp		= "smtp.gmail.com";
147
							$mail_smtp_ip	= "smtp.gmail.com";
150
							$mail_port		= 587;
148
							$mail_port		= 587;
151
						break;
149
						break;
152
						case '7':
150
						case '7':
153
							$mail_smtp		= "smtp.laposte.net";
151
							$mail_smtp_ip	= "smtp.laposte.net";
154
							$mail_port		= 465;
152
							$mail_port		= 465;
155
						break;
153
						break;
156
						case '8':
154
						case '8':
157
							$mail_smtp		= "smtp.bbox.fr";
155
							$mail_smtp_ip	= "smtp.bbox.fr";
158
							$mail_port		= 587;
156
							$mail_port		= 587;
159
						break;
157
						break;
160
						default:
158
						default:
161
							echo "Erreur dans la saisie !";
159
							echo "Erreur dans la saisie !";
162
						break;
160
						break;
163
					}
161
					}
164
					if(isset($mail_admin)){
162
					if(isset($mail_admin)){
165
						exec("sudo /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp -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 $admin_address -w $mail_whitelist");
166
					}
164
					}
167
					else {
165
					else {
168
						exec("sudo /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp -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");
169
					}
167
					}
170
				}
168
				}
171
				else { // password are not the same
169
				else { // password are not the same
172
					echo "Erreur";
170
					echo "Erreur";
173
				}
171
				}
Line 193... Line 191...
193
	<link type="text/css" href="/css/acc.css" rel="stylesheet">
191
	<link type="text/css" href="/css/acc.css" rel="stylesheet">
194
	<link type="text/css" href="/css/mail.css" rel="stylesheet">
192
	<link type="text/css" href="/css/mail.css" rel="stylesheet">
195
	<script>
193
	<script>
196
	function onMailStatusChange() {
194
	function onMailStatusChange() {
197
		var listToDisables1 = ['mail_type','admin_enable','admin_address','mail_whitelist'];
195
		var listToDisables1 = ['mail_type','admin_enable','admin_address','mail_whitelist'];
198
		var listToDisables2 = ['mail_server','mail_type','admin_enable','admin_address','mail_whitelist','mail_ip'];
196
		var listToDisables2 = ['mail_server','mail_type','admin_enable','admin_address','mail_whitelist','mail_smtp_ip'];
199
		var listToDisables3 = ['mail_server','mail_mdp2','mail_mdp','mail_address','mail_type','admin_enable','admin_address','mail_whitelist'];
197
		var listToDisables3 = ['mail_server','mail_mdp2','mail_mdp','mail_address','mail_type','admin_enable','admin_address','mail_whitelist'];
200
		var formSubmit = document.querySelector('form input[type="submit"]');
198
		var formSubmit = document.querySelector('form input[type="submit"]');
201
		var btn_checkConf = document.getElementById('btn-checkconf');
199
		var btn_checkConf = document.getElementById('btn-checkconf');
202
		var isChecked = false;
200
		var isChecked = false;
203
		if (document.getElementById('auth_enable').value === 'on') {
201
		if (document.getElementById('auth_enable').value === 'on') {
Line 303... Line 301...
303
					<dl>
301
					<dl>
304
						<dt>
302
						<dt>
305
							<label for="mail_address"><?= $l_email_address ?></label><br>
303
							<label for="mail_address"><?= $l_email_address ?></label><br>
306
						</dt>
304
						</dt>
307
						<dd>
305
						<dd>
308
							<input type="text" id="mail_address" size="40" name="mail_address" value="<?= $mail_address_mail ?>" oninput="onMailStatusChange();"> 
306
							<input type="text" id="mail_address" size="40" name="mail_address" value="<?= $mail_address ?>" oninput="onMailStatusChange();"> 
309
						</dd>
307
						</dd>
310
					</dl>
308
					</dl>
311
					<dl>
309
					<dl>
312
						<dt>
310
						<dt>
313
							<label for="mail_mdp"><?= $l_email_password ?></label><br>
311
							<label for="mail_mdp"><?= $l_email_password ?></label><br>
Line 328... Line 326...
328
						<dt>
326
						<dt>
329
							<label for="mail_server"><?= $l_mail_service ?></label><br>
327
							<label for="mail_server"><?= $l_mail_service ?></label><br>
330
						</dt>
328
						</dt>
331
						<dd>
329
						<dd>
332
							<select id="mail_server" name="mail_server" onchange="onMailStatusChange();">
330
							<select id="mail_server" name="mail_server" onchange="onMailStatusChange();">
333
								<option value=1>Orange/Wanadoo</option>
331
								<option value="1"<?= ($mail_smtp_ip == 'smtp.orange.fr') ? ' selected="selected"' : '' ?>>Orange/Wanadoo</option>
334
								<option value=2>Hotmail</option>
332
								<option value="2"<?= ($mail_smtp_ip == 'smtp.live.com') ? ' selected="selected"' : '' ?>>Hotmail</option>
335
								<option value=3>Outlook</option>
333
								<option value="3"<?= ($mail_smtp_ip == 'smtp.office365.com') ? ' selected="selected"' : '' ?>>Outlook</option>
336
								<option value=4>SFR</option>
334
								<option value="4"<?= ($mail_smtp_ip == 'smtp.sfr.fr') ? ' selected="selected"' : '' ?>>SFR</option>
337
								<option value=5>Free</option>
335
								<option value="5"<?= ($mail_smtp_ip == 'smtp.free.fr') ? ' selected="selected"' : '' ?>>Free</option>
338
								<option value=6>Gmail</option>
336
								<option value="6"<?= ($mail_smtp_ip == 'smtp.gmail.com') ? ' selected="selected"' : '' ?>>Gmail</option>
339
								<option value=7>Laposte</option>
337
								<option value="7"<?= ($mail_smtp_ip == 'smtp.laposte.net') ? ' selected="selected"' : '' ?>>Laposte</option>
340
								<option value=8>Bouygues</option>
338
								<option value="8"<?= ($mail_smtp_ip == 'smtp.bbox.fr') ? ' selected="selected"' : '' ?>>Bouygues</option>
341
								<option value=9>Personnalisé</option>
339
								<option value="9">Personnalisé</option>
342
							</select>
340
							</select>
343
						</dd>
341
						</dd>
344
					</dl>
342
					</dl>
345
					<dl>
343
					<dl>
346
						<dt>
344
						<dt>
347
							<label for="mail_ip"><?= $l_mail_server_ip ?></label><br>
345
							<label for="mail_smtp_ip"><?= $l_mail_smtp_ip ?></label><br>
348
						</dt>
346
						</dt>
349
						<dd>
347
						<dd>
350
							<input type="text" id="mail_ip" size="40" name="mail_ip" value="<?= $mail_address_ip ?>" oninput="onMailStatusChange();"> 
348
							<input type="text" id="mail_smtp_ip" size="40" name="mail_smtp_ip" value="<?= $mail_smtp_ip ?>" oninput="onMailStatusChange();"> 
351
						</dd>
349
						</dd>
352
					</dl>
350
					</dl>
353
					<dl>
351
					<dl>
354
						<dt>
352
						<dt>
355
							<label for="admin_enable"><?= $l_admin_log ?></label>
353
							<label for="admin_enable"><?= $l_admin_log ?></label>
356
						</dt>
354
						</dt>
357
						<dd>
355
						<dd>
358
							<select id="admin_enable" name="admin_enable" onchange="onMailStatusChange();">
356
							<select id="admin_enable" name="admin_enable" onchange="onMailStatusChange();">
359
								<option value="1"<?= ($mail_address != '')  ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
357
								<option value="1"<?= ($admin_address != '')  ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
360
								<option value="0"<?= ($mail_address == '') ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
358
								<option value="0"<?= ($admin_address == '') ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
361
							</select>
359
							</select>
362
						</dd>
360
						</dd>
363
					</dl>
361
					</dl>
364
					<dl>
362
					<dl>
365
						<dt>
363
						<dt>
366
							<label for="admin_address"><?= $l_admin_mail ?></label><br>
364
							<label for="admin_address"><?= $l_admin_address ?></label><br>
367
						</dt>
365
						</dt>
368
						<dd>
366
						<dd>
369
							<input type="text" id="admin_address" size="40" name="admin_address" value="<?= $admin_address ?>" oninput="onMailStatusChange();"> 
367
							<input type="text" id="admin_address" size="40" name="admin_address" value="<?= $admin_address ?>" oninput="onMailStatusChange();"> 
370
						</dd>
368
						</dd>
371
					</dl>
369
					</dl>