Subversion Repositories ALCASAR

Rev

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

Rev 3020 Rev 3021
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_smtp_ip			= "Adresse IP ou nom du du serveur SMTP";
55
	$l_mail_smtp_ip			= "Adresse IP ou nom du serveur SMTP";
-
 
56
	$l_mail_smtp_port		= "Port d'écoute du serveur SMTP";
56
	$l_admin_log			= "Avertissement de l'administratateur";
57
	$l_admin_log			= "Avertissement de l'administratateur";
57
	$l_mail_admin			= "Adresse Email de l'administrateur";
58
	$l_mail_admin			= "Adresse Email de l'administrateur";
58
	$l_whitelist_domain		= "Noms de domaine autorisés (whitelist)";
59
	$l_whitelist_domain		= "Noms de domaine autorisés (whitelist)";
59
	$l_mail_YES				= "OUI";
60
	$l_mail_YES				= "OUI";
60
	$l_mail_NO				= "NON";
61
	$l_mail_NO				= "NON";
Line 69... Line 70...
69
	$l_email_address		= "Email address used for sending mail";
70
	$l_email_address		= "Email address used for sending mail";
70
	$l_email_password		= "Password";
71
	$l_email_password		= "Password";
71
	$l_email_password_confirm	= "Confirm password";
72
	$l_email_password_confirm	= "Confirm password";
72
	$l_mail_service			= "Choose the mail service";
73
	$l_mail_service			= "Choose the mail service";
73
	$l_mail_smtp_ip			= "IP address or name of mail server";
74
	$l_mail_smtp_ip			= "IP address or name of mail server";
-
 
75
	$l_mail_smtp_port		= "Listen port of mail server";
74
	$l_admin_log			= "Administrator's warning";
76
	$l_admin_log			= "Administrator's warning";
75
	$l_mail_admin			= "Administrator Email address";
77
	$l_mail_admin			= "Administrator Email address";
76
	$l_whitelist_domain		= "Authorized domain names (whitelist)";
78
	$l_whitelist_domain		= "Authorized domain names (whitelist)";
77
	$l_mail_YES				= "YES";
79
	$l_mail_YES				= "YES";
78
	$l_mail_NO				= "NO";
80
	$l_mail_NO				= "NO";
Line 81... Line 83...
81
 
83
 
82
// Mail configuration params
84
// Mail configuration params
83
$mail_status        	= $mail_conf['MAIL'];
85
$mail_status        	= $mail_conf['MAIL'];
84
$mail_type				= $mail_conf['MAIL_TYPE'];
86
$mail_type				= $mail_conf['MAIL_TYPE'];
85
$mail_address			= $mail_conf['MAIL_ADDR'];
87
$mail_address			= $mail_conf['MAIL_ADDR'];
86
$mail_port				= $mail_conf['MAIL_PORT'];
88
$mail_smtp_port			= $mail_conf['MAIL_SMTP_PORT'];
87
$mail_smtp_ip			= $mail_conf['MAIL_SMTP_IP'];
89
$mail_smtp_ip			= $mail_conf['MAIL_SMTP_IP'];
88
$mail_password_mail 	= "";
90
$mail_password_mail 	= "";
89
$mail_password_mail_2	= "";
91
$mail_password_mail_2	= "";
90
$mail_admin				= $mail_conf['MAIL_ADMIN'];
92
$mail_admin				= $mail_conf['MAIL_ADMIN'];
91
$mail_whitelist			= $mail_conf['MAIL_WHITEDOMAIN'];
93
$mail_whitelist			= $mail_conf['MAIL_WHITEDOMAIN'];
92
 
94
 
93
if(isset($_POST['submit'])){
95
if(isset($_POST['submit'])){
94
	if($_POST['auth_enable'] === 'on')
96
	if($_POST['mail_enable'] === 'on')
95
	{
97
	{
96
		$mail_type 		= $_POST['mail_type'];
98
		$mail_type = $_POST['mail_type'];
97
		$mail_address 	= $_POST['mail_address'];
99
		$mail_whitelist = $_POST['mail_whitelist'];
98
		$mail_server 	= $_POST['mail_server'];
100
		$admin_enable = $_POST['admin_enable'];
-
 
101
		if(isset($_POST['mail_address']))	{ $mail_address = $_POST['mail_address']; }
99
		$mail_smtp_ip	= $_POST['mail_smtp_ip'];
102
		if(isset($_POST['mail_server']))	{ $mail_server = $_POST['mail_server']; }
100
		$mail_mdp 		= $_POST['mail_mdp'];
103
		if(isset($_POST['mail_smtp_ip']))	{ $mail_smtp_ip = $_POST['mail_smtp_ip']; }
101
		$mail_mdp2 		= $_POST['mail_mdp2'];
104
		if(isset($_POST['mail_smtp_port']))	{ $mail_smtp_ip = $_POST['mail_smtp_port']; }
102
		$admin_enable	= $_POST['admin_enable'];
105
		if(isset($_POST['mail_mdp']))		{ $mail_mdp = $_POST['mail_mdp']; }
103
		if ($admin_enable == "1") { $mail_admin = $_POST['mail_admin']; };
106
		if(isset($_POST['mail_mdp2']))		{ $mail_mdp2 = $_POST['mail_mdp2']; }
104
		$mail_whitelist	= $_POST['mail_whitelist'];
107
		if ($admin_enable == "1") { $mail_admin = $_POST['mail_admin']; }
105
		switch ($mail_type) {
108
		switch ($mail_type) {
106
			case '1':
109
			case '1':
107
				$mail_port = 25;
110
				$mail_smtp_port = 25;
108
				if ($admin_enable == "1"){
111
				if ($admin_enable == "1"){
109
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -a $mail_admin -w $mail_whitelist");
112
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -a $mail_admin -w $mail_whitelist");
110
				}
113
				}
111
				else {
114
				else {
112
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -w $mail_whitelist");
115
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -w $mail_whitelist");
113
				}
116
				}
114
				break;
117
				break;
115
			case '2':
118
			case '2':
116
				if ($admin_enable == "1"){
119
				if ($admin_enable == "1"){
117
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_port -a $mail_admin -w $mail_whitelist");
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");
118
				}
121
				}
119
				else {
122
				else {
120
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_port -w $mail_whitelist");
123
					exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_smtp_port -w $mail_whitelist");
121
				}
124
				}
122
				break;
125
				break;
123
			case '3':
126
			case '3':
124
				if(($mail_mdp != '') && ($mail_mdp==$mail_mdp2)) {
127
				if(($mail_mdp != '') && ($mail_mdp==$mail_mdp2)) {
125
					switch ($mail_server) {
128
					switch ($mail_server) {
126
						case '1':
129
						case '1':
127
							$mail_smtp_ip	= "smtp.orange.fr";
130
							$mail_smtp_ip	= "smtp.orange.fr";
128
							$mail_port		= 465;
131
							$mail_smtp_port		= 465;
129
						break;
132
						break;
130
						case '2':
133
						case '2':
131
							$mail_smtp_ip	= "smtp.live.com";
134
							$mail_smtp_ip	= "smtp.live.com";
132
							$mail_port		= 587;
135
							$mail_smtp_port		= 587;
133
						break;
136
						break;
134
						case '3':
137
						case '3':
135
							$mail_smtp_ip	= "smtp.office365.com";
138
							$mail_smtp_ip	= "smtp.office365.com";
136
							$mail_port		= 587;
139
							$mail_smtp_port		= 587;
137
						break;
140
						break;
138
						case '4':
141
						case '4':
139
							$mail_smtp_ip	= "smtp.sfr.fr";
142
							$mail_smtp_ip	= "smtp.sfr.fr";
140
							$mail_port		= 465;
143
							$mail_smtp_port		= 465;
141
						break;
144
						break;
142
						case '5':
145
						case '5':
143
							$mail_smtp_ip	= "smtp.free.fr";
146
							$mail_smtp_ip	= "smtp.free.fr";
144
							$mail_port		= 465;	
147
							$mail_smtp_port		= 465;	
145
						break;
148
						break;
146
						case '6':
149
						case '6':
147
							$mail_smtp_ip	= "smtp.gmail.com";
150
							$mail_smtp_ip	= "smtp.gmail.com";
148
							$mail_port		= 587;
151
							$mail_smtp_port		= 587;
149
						break;
152
						break;
150
						case '7':
153
						case '7':
151
							$mail_smtp_ip	= "smtp.laposte.net";
154
							$mail_smtp_ip	= "smtp.laposte.net";
152
							$mail_port		= 465;
155
							$mail_smtp_port		= 465;
153
						break;
156
						break;
154
						case '8':
157
						case '8':
155
							$mail_smtp_ip	= "smtp.bbox.fr";
158
							$mail_smtp_ip	= "smtp.bbox.fr";
156
							$mail_port		= 587;
159
							$mail_smtp_port		= 587;
157
						break;
160
						break;
158
						default:
161
						default:
159
							echo "Erreur dans la saisie !";
162
							echo "Erreur dans la saisie !";
160
						break;
163
						break;
161
					}
164
					}
162
					if ($admin_enable == "1"){
165
					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 $mail_admin -w $mail_whitelist");
166
						exec("sudo /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp_ip -p $mail_smtp_port -m $mail_address -o $mail_mdp -a $mail_admin -w $mail_whitelist");
164
					}
167
					}
165
					else {
168
					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");
169
						exec("sudo /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp_ip -p $mail_smtp_port -m $mail_address -o $mail_mdp -w $mail_whitelist");
167
					}
170
					}
168
				}
171
				}
169
				else { // no password or password are not same
172
				else { // no password or password are not same
170
					header("Refresh:0");
173
					header("Refresh:0");
171
				}
174
				}
Line 207... Line 210...
207
		}
210
		}
208
		for (var i=0; i<listToDisables3.length; i++) {
211
		for (var i=0; i<listToDisables3.length; i++) {
209
			document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
212
			document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
210
			document.getElementById(listToDisables3[i]).disabled = true;
213
			document.getElementById(listToDisables3[i]).disabled = true;
211
		}
214
		}
212
		if (document.getElementById('auth_enable').value === 'on') {
215
		if (document.getElementById('mail_enable').value === 'on') {
213
			document.getElementById('mail_type').style.backgroundColor = null;
216
			document.getElementById('mail_type').style.backgroundColor = null;
214
			document.getElementById('mail_type').disabled = false;
217
			document.getElementById('mail_type').disabled = false;
215
			if (document.getElementById('mail_type').value === '1') {
218
			if (document.getElementById('mail_type').value === '1') {
216
				for (var i=0; i<listToDisables1.length; i++) {
219
				for (var i=0; i<listToDisables1.length; i++) {
217
				document.getElementById(listToDisables1[i]).style.backgroundColor = null;
220
				document.getElementById(listToDisables1[i]).style.backgroundColor = null;
Line 266... Line 269...
266
						<div style="text-align: center">
269
						<div style="text-align: center">
267
						</div>
270
						</div>
268
					</legend>
271
					</legend>
269
					<dl>
272
					<dl>
270
						<dt>
273
						<dt>
271
							<label for="auth_enable"><?= $l_mail_registration ?></label>
274
							<label for="mail_enable"><?= $l_mail_registration ?></label>
272
						</dt>
275
						</dt>
273
						<dd>
276
						<dd>
274
							<select id="auth_enable" name="auth_enable" onchange="onMailStatusChange();">
277
							<select id="mail_enable" name="mail_enable" onchange="onMailStatusChange();">
275
								<option value="on"<?= ($mail_status == 'on') ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
278
								<option value="on"<?= ($mail_status == 'on') ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
276
								<option value="off"<?= ($mail_status == 'off') ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
279
								<option value="off"<?= ($mail_status == 'off') ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
277
							</select>
280
							</select>
278
						</dd>
281
						</dd>
279
					</dl>
282
					</dl>
Line 281... Line 284...
281
						<dt>
284
						<dt>
282
							<label for="mail_type"><?= $l_mail_choice ?></label><br>
285
							<label for="mail_type"><?= $l_mail_choice ?></label><br>
283
						</dt>
286
						</dt>
284
						<dd>
287
						<dd>
285
							<select id="mail_type" name="mail_type" onchange="onMailStatusChange();">
288
							<select id="mail_type" name="mail_type" onchange="onMailStatusChange();">
286
								<option value="1"<?= ($mail_type == '1') ? ' selected="selected"' : '' ?>><?= $l_use_internal_server ?></option>
289
								<!--<option value="1"<?= ($mail_type == '1') ? ' selected="selected"' : '' ?>><?= $l_use_internal_server ?></option>-->
287
								<option value="2"<?= ($mail_type == '2') ? ' selected="selected"' : '' ?>><?= $l_use_external_server ?></option>
290
								<option value="2"<?= ($mail_type == '2') ? ' selected="selected"' : '' ?>><?= $l_use_external_server ?></option>
288
								<option value="3"<?= ($mail_type == '3') ? ' selected="selected"' : '' ?>><?= $l_use_email_address ?></option>
291
								<option value="3"<?= ($mail_type == '3') ? ' selected="selected"' : '' ?>><?= $l_use_email_address ?></option>
289
							</select>
292
							</select>
290
						</dd>
293
						</dd>
291
					</dl>
294
					</dl>
Line 336... Line 339...
336
							<label for="mail_smtp_ip"><?= $l_mail_smtp_ip ?></label><br>
339
							<label for="mail_smtp_ip"><?= $l_mail_smtp_ip ?></label><br>
337
						</dt>
340
						</dt>
338
						<dd>
341
						<dd>
339
							<input type="text" id="mail_smtp_ip" size="40" name="mail_smtp_ip" value="<?= $mail_smtp_ip ?>" oninput="onMailStatusChange();"> 
342
							<input type="text" id="mail_smtp_ip" size="40" name="mail_smtp_ip" value="<?= $mail_smtp_ip ?>" oninput="onMailStatusChange();"> 
340
						</dd>
343
						</dd>
-
 
344
						<dt>
-
 
345
							<label for="mail_smtp_port"><?= $l_mail_smtp_port ?></label><br>
-
 
346
						</dt>
-
 
347
						<dd>
-
 
348
							<input type="text" id="mail_smtp_port" size="5" name="mail_smtp_port" value="<?= $mail_smtp_port ?>" oninput="onMailStatusChange();"> 
-
 
349
						</dd>
341
					</dl>
350
					</dl>
342
					<dl>
351
					<dl>
343
						<dt>
352
						<dt>
344
							<label for="admin_enable"><?= $l_admin_log ?></label>
353
							<label for="admin_enable"><?= $l_admin_log ?></label>
345
						</dt>
354
						</dt>