Subversion Repositories ALCASAR

Rev

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

Rev 2990 Rev 2991
Line 1... Line 1...
1
<?php
1
<?php
2
/* written by steweb57 & Rexy */
2
/* written by steweb57 & Rexy */
3
 
3
 
4
 
-
 
5
// partie $_POST du service mail
-
 
6
 
-
 
7
$php_self = htmlspecialchars($_SERVER['PHP_SELF']);
-
 
8
// Traiter les formulaires de la partie MAIL SERVICE
-
 
9
if(!empty($_POST)){
-
 
10
 
-
 
11
	var_dump($_POST);
-
 
12
/*	// procéder a l'installtion de postfix
-
 
13
	if (!empty($_POST['install'])){
-
 
14
		exec('sudo dnf install -y postfix', $output, $retval);
-
 
15
//		header("Location:services.php");
-
 
16
		var_dump($output);
-
 
17
		echo "<br>\$retval : " . $retval;
-
 
18
	}
-
 
19
*/
-
 
20
// La variable qui contiendra les options et les arguments a passer à l'install
-
 
21
	$optArg = "";
-
 
22
	
-
 
23
	if(!empty($_POST['testConf'])){ 	
-
 
24
		$optArg .= " -".trim($_POST['testConf']);
-
 
25
	}
-
 
26
	if(!empty($_POST['smtp'])){ 	
-
 
27
		$optArg .= " -s \"".trim($_POST['smtp'])."\"";
-
 
28
	}
-
 
29
	if(!empty($_POST['port'])){ 	
-
 
30
		$optArg .= " -p \"".trim($_POST['port'])."\"";
-
 
31
	}
-
 
32
	if(!empty($_POST['smtpPort'])){ 	
-
 
33
		$smtpPort = explode(" ", $_POST['smtpPort']);
-
 
34
		$optArg .= " -s \"".trim($smtpPort[0])."\" -p \"".trim($smtpPort[1])."\"";
-
 
35
	}
-
 
36
	if(!empty($_POST['smtpIP'])){ 	
-
 
37
		$optArg .= " -r \"".trim($_POST['smtpIP'])."\"";
-
 
38
	}
-
 
39
	if(!empty($_POST['mailAddr'])){ 	
-
 
40
		$optArg .= " -m \"".trim($_POST['mailAddr'])."\"";
-
 
41
	}
-
 
42
	if(!empty($_POST['pswd1']) && !empty($_POST['pswd2'])){
-
 
43
		if (trim($_POST['pswd1']) == trim($_POST['pswd2'])){
-
 
44
			$optArg .= " -o \"".trim($_POST['pswd2'])."\"";
-
 
45
		} else {
-
 
46
			echo "<script> alert(\"Les deux mots de passe sont différents\"); window.location.href=\"services.php\";</script>";
-
 
47
		}
-
 
48
	}
-
 
49
	if(!empty($_POST['adminMail'])){ 	
-
 
50
		$optArg .= " -a \"".$_POST['adminMail']."\"";
-
 
51
	}
-
 
52
	if(!empty($_POST['wld'])){ 	
-
 
53
		$optArg .= " -w \"".str_replace("\r"," ",trim($_POST['wld']))."\"";
-
 
54
	}
-
 
55
 
-
 
56
// Supprimer la WLD ou l'email de l'admin
-
 
57
	if(!empty($_POST['unset'])){
-
 
58
		exec("sudo sed -i '/". $_POST['unset']."/d' /usr/local/etc/alcasar-mail.conf", $output, $retval);
-
 
59
 
-
 
60
		var_dump($output);
-
 
61
		echo "<br>\$retval : " . $retval;
-
 
62
	}
-
 
63
 
-
 
64
// Supprimer toute la configuration actuelle
-
 
65
	if(!empty($_POST['uninstall'])){
-
 
66
//		echo "sudo /usr/local/bin/alcasar-mail-uninstall.sh <br>";
-
 
67
		exec("sudo /usr/local/bin/alcasar-mail-uninstall.sh", $output, $retval);
-
 
68
 
-
 
69
		var_dump($output);
-
 
70
		echo "<br>\$retval : " . $retval;
-
 
71
	}
-
 
72
	
-
 
73
	if(!empty($optArg)){
-
 
74
		echo "sudo /usr/local/bin/alcasar-mail-install.sh".$optArg;
-
 
75
		exec("sudo /usr/local/bin/alcasar-mail-install.sh".escapeshellcmd($optArg), $output, $retval);
-
 
76
		var_dump($output);
-
 
77
		echo "<br>\$retval : " . $retval;
-
 
78
	}
-
 
79
//	à décommenté une fois tests et debugs réalisé pour recharger la page sansle $_POST
-
 
80
//	header("Location:services.php");
-
 
81
 
-
 
82
}// Fin de la partie $_POST du service mail
-
 
83
 
-
 
84
 
-
 
85
# Choice of language
4
# Choice of language
86
$Language = 'en';
5
$Language = 'en';
87
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
6
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
88
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
7
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
89
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
8
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
Line 362... Line 281...
362
	<div class="panel-row">
281
	<div class="panel-row">
363
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
282
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
364
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
283
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
365
		<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
284
		<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
366
		<tr>
285
		<tr>
367
		<?php if ($serviceName != "postfix"){
-
 
368
			if ($statusOK) { ?>
286
		<?php if ($statusOK) { ?>
369
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
287
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
370
			<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
288
			<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
371
			<td width="80" align="center">---</td>
289
			<td width="80" align="center">---</td>
372
			<td width="80" align="center"><?php if (($serviceName != "chilli") && ($serviceName != "lighttpd")) { echo "<a href=\"".$_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop</a>"; } else echo "---";?></td>
290
			<td width="80" align="center"><?php if (($serviceName != "chilli") && ($serviceName != "lighttpd")) { echo "<a href=\"".$_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop</a>"; } else echo "---";?></td>
373
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td>
291
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td>
Line 377... Line 295...
377
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td>
295
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td>
378
			<td width="80" align="center">---</td>
296
			<td width="80" align="center">---</td>
379
			<td width="80" align="center">---</td>
297
			<td width="80" align="center">---</td>
380
		<?php } ?>
298
		<?php } ?>
381
		</tr>
299
		</tr>
382
		<?php }
300
		<?php } ?>
383
		} ?>
-
 
384
	</table>
301
	</table>
385
	</div>
302
	</div>
386
</div>
303
</div>
387
<div class="panel">
304
<div class="panel">
388
	<div class="panel-header"><?= $l_filter_services ?></div>
305
	<div class="panel-header"><?= $l_filter_services ?></div>
Line 411... Line 328...
411
	</div>
328
	</div>
412
</div>
329
</div>
413
<div class="panel">
330
<div class="panel">
414
	<div class="panel-header"><?= $l_opt_services ?></div>
331
	<div class="panel-header"><?= $l_opt_services ?></div>
415
	<div class="panel-row">
332
	<div class="panel-row">
416
 
-
 
-
 
333
	<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
417
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
334
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
418
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"> </td><td colspan="3"><?php echo $l_service_action;?></td></tr>
335
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"> </td><td colspan="3"><?php echo $l_service_action;?></td></tr>
419
 
-
 
420
<?php
-
 
421
/*
-
 
422
// POSTFIX
-
 
423
exec("sudo rpm" . escapeshellarg("-q postfix"), $output, $retval);
-
 
424
		var_dump($output);
-
 
425
		echo "<br>\$retval : " . $retval;
-
 
426
exec("sudo ip" . escapeshellarg("a"), $output, $retval);
-
 
427
		var_dump($output);
-
 
428
		echo "<br>\$retval : " . $retval;
-
 
429
// si POSTFIX n'est pas installé, on propose l'installation
-
 
430
if ($retval == 1){  
-
 
431
 
-
 
432
echo <<<EOT
-
 
433
		<tr align="center">
-
 
434
			<td colspan="3"><b>POSTFIX n'est pas installé.</b></td>
-
 
435
			<td>
-
 
436
				<form id="install" action="$php_self" method=POST>
-
 
437
					<input type="hidden" name="install" value="install">
-
 
438
					<input type=submit form="install" value="Install">
-
 
439
				</form>
-
 
440
			</td>
-
 
441
		</tr>
-
 
442
EOT;
-
 
443
 
-
 
444
// si POSFIX est installé
-
 
445
} else {
-
 
446
*/
-
 
447
// la partie tableau qui affiche les statut du service POSTFIX, et possiblité de start, restart & stop
-
 
448
		$serviceName = "postfix";
-
 
449
		if(array_key_exists($serviceName, $MainServiceStatus)){
-
 
450
 
-
 
451
			$statusOK = $MainServiceStatus['postfix'];
-
 
452
			$comment="l_$serviceName";
-
 
453
			$stopService =  $_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName);
-
 
454
			$startService = $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName);
-
 
455
			$restartService = $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName);
-
 
456
//			$restartService = $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\\";
-
 
457
 
-
 
458
			echo "<tr>";
-
 
459
			if ($statusOK) {
-
 
460
echo <<<EOT
-
 
461
				<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="$l_service_status_img_ok"></td>
-
 
462
				<td align="center"><b>$serviceName</b></td>
-
 
463
				<td align="center">${$comment}</td>
-
 
464
				<td width="80" align="center">---</td>
-
 
465
				<td width="80" align="center">
-
 
466
					<a href=$stopService>$l_service_stop</a></td>
-
 
467
				<td width="80" align="center">
-
 
468
					<a href=$restartService>$l_service_restart</a></td>
-
 
469
EOT;
-
 
470
			} else {
-
 
471
echo <<<EOT
-
 
472
				<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="$l_service_status_img_ko"></td>
-
 
473
				<td align="center">$serviceName</td>
-
 
474
				<td align="center">${$comment}</td>
-
 
475
				<td width="80" align="center">
-
 
476
					<a href=$startService>$l_service_start</a></td>
-
 
477
				<td width="80" align="center">---</td>
-
 
478
				<td width="80" align="center">---</td>
-
 
479
EOT;
-
 
480
			}
-
 
481
			echo "</tr>";
-
 
482
		}
-
 
483
//}
-
 
484
// POSTFIX end
-
 
485
?>
-
 
486
 
-
 
487
		<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
-
 
488
		<tr>
336
		<tr>
489
			<?php if ($wifi4eu == "on") { ?>
337
			<?php if ($wifi4eu == "on") { ?>
490
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
338
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
491
			<td align="center"><b>WIFI4EU</b></td><td><?php echo "network ID : $wifi4eu_code"; ?></td>
339
			<td align="center"><b>WIFI4EU</b></td><td><?php echo "network ID : $wifi4eu_code"; ?></td>
492
			<td width="80" align="center">---</td>
340
			<td width="80" align="center">---</td>
Line 498... Line 346...
498
			<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
346
			<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
499
			<td width="80" align="center">---</td>
347
			<td width="80" align="center">---</td>
500
			<td width="80" align="center">---</td>
348
			<td width="80" align="center">---</td>
501
			<?php } ?>
349
			<?php } ?>
502
		</tr>
350
		</tr>
503
		</form>
-
 
504
 
-
 
505
	</table>
351
	</table>
-
 
352
	</form>
506
	</div>
353
	</div>
507
</div>
354
</div>
508
 
-
 
509
 
-
 
510
<div class="panel">
355
<div class="panel">
511
	<div class="panel-header"><?= $l_stop_restart ?></div>
356
	<div class="panel-header"><?= $l_stop_restart ?></div>
512
	<div class="panel-row">
357
	<div class="panel-row">
513
	<table width="100%" border=0 cellspacing=0 cellpadding=1>
358
	<table width="100%" border=0 cellspacing=0 cellpadding=1>
514
		<tr><td valign="middle" align="left">
359
		<tr><td valign="middle" align="left">
Line 521... Line 366...
521
			</form>
366
			</form>
522
		</td></tr>
367
		</td></tr>
523
	</table>
368
	</table>
524
	</div>
369
	</div>
525
</div>
370
</div>
526
 
-
 
527
 
-
 
528
<!-- Code de la partie mail service, il ne faut pas oublier de rajouter jquery dans le head du html -->
-
 
529
 
-
 
530
<?php
-
 
531
 
-
 
532
echo <<<EOT
-
 
533
 
-
 
534
<div class="panel">
-
 
535
	<div class="panel-header">POSTFIX actuelle Configuration</div>
-
 
536
	<div class="panel-row">
-
 
537
		<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
-
 
538
 
-
 
539
EOT;
-
 
540
 
-
 
541
// la conf actuelle, si le fichier alcasar-mail.conf est présent
-
 
542
			$alcasarMailConf = "/usr/local/etc/alcasar-mail.conf";
-
 
543
			if (is_file ($alcasarMailConf)){
-
 
544
 
-
 
545
				$tab=file($alcasarMailConf);
-
 
546
 
-
 
547
				if ($tab){
-
 
548
					foreach ($tab as $line)		{
-
 
549
 
-
 
550
						$field=explode("=", $line);
-
 
551
 
-
 
552
						switch ($field[0]) {
-
 
553
						
-
 
554
							case 'smtp':
-
 
555
								$smtp = trim($field[1]);
-
 
556
echo <<<EOT
-
 
557
								<tr align="center">
-
 
558
									<td><b>SMTP : </b>$smtp</td>
-
 
559
								</tr>
-
 
560
EOT;
-
 
561
							break;
-
 
562
							case 'port':
-
 
563
								$port = trim($field[1]);
-
 
564
echo <<<EOT
-
 
565
								<tr align="center">
-
 
566
									<td><b>Port : </b>$port</td>
-
 
567
								</tr>
-
 
568
EOT;
-
 
569
							break;
-
 
570
							case 'smtpIP':
-
 
571
								$smtpIP = trim($field[1]);
-
 
572
echo <<<EOT
-
 
573
								<tr align="center">
-
 
574
									<td><b>SMTP ip : </b>$smtpIP</td>
-
 
575
								</tr>
-
 
576
EOT;
-
 
577
							break;
-
 
578
							case 'mailAddr':
-
 
579
								$mailAddr = trim($field[1]);
-
 
580
echo <<<EOT
-
 
581
								<tr align="center">
-
 
582
									<td><b>Email Addr : </b>$mailAddr</td>
-
 
583
								</tr>
-
 
584
EOT;
-
 
585
							break;
-
 
586
							case 'adminMail':
-
 
587
								$adminMail = trim($field[1]);
-
 
588
echo <<<EOT
-
 
589
								<tr align="center">
-
 
590
									<td><b>Admin email : </b>$adminMail</td>
-
 
591
								</tr>
-
 
592
EOT;
-
 
593
							break;
-
 
594
							case 'whiteDomain':
-
 
595
								$whiteDomain = explode(" ", trim($field[1]));
-
 
596
							break;
-
 
597
						}
-
 
598
					}
-
 
599
				}
-
 
600
echo <<<EOT
-
 
601
			<form action="$php_self" method="post">
-
 
602
				<tr align="center">
-
 
603
					<td colspan="2">
-
 
604
						<input type="hidden" name="uninstall" value="uninstall">
-
 
605
						<br><input type="submit" class="btn btn-default" name="submit" value="Supprimer toute la configuration">
-
 
606
					</td>
-
 
607
				</tr>
-
 
608
			</form>
-
 
609
				<tr align="center">
-
 
610
					<td colspan="2"><font color=red>ATTENTION : la suppression enlève toute la configuration du SERVICE MAIL</font>
-
 
611
 
-
 
612
					</td>
-
 
613
				</tr>
-
 
614
EOT;
-
 
615
			// si le fichier alcasar-mail.conf n'existe pas
-
 
616
			} else {
-
 
617
 
-
 
618
echo <<<EOT
-
 
619
			<tr align="center">
-
 
620
				<td><b>POSTFIX n'est pas configuré par ALCASAR.</b></td>
-
 
621
			</tr>
-
 
622
EOT;
-
 
623
 
-
 
624
			}
-
 
625
 
-
 
626
// Partie de paramétrage de la configuration
-
 
627
 
-
 
628
// Configuration de l'adresse email de l'administrateur
-
 
629
echo <<<EOT
-
 
630
		</table><br>
-
 
631
	</div>
-
 
632
</div><br>
-
 
633
<div class="panel">
-
 
634
	<div class="panel-header">POSTFIX Configuration</div>
-
 
635
	<div class="panel-row conf" id="conf">	
-
 
636
		<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
-
 
637
			<tr align="center">
-
 
638
				<td><input type="radio" name="conf" class="mail" value="One"/><b>Service autonome</b></td>
-
 
639
				<td><input type="radio" name="conf" class="mail" value="Two"/><b>Service relay</b></td>
-
 
640
				<td><input type="radio" name="conf" class="mail" value="Three"/> <b>Adresse mail</b></td>
-
 
641
			</tr>
-
 
642
		</table><br>
-
 
643
	</div>
-
 
644
	<div class="myDiv hide" id="showOne">
-
 
645
		<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
-
 
646
			<tr align="center">
-
 
647
				<td><b>Serveur mail est autonome :</b></td>
-
 
648
			</tr>
-
 
649
			<tr align="center">
-
 
650
				<td>
-
 
651
					<form action="$php_self" method="post">
-
 
652
						<input type="hidden" name="testConf" value="1">
-
 
653
						<input type="submit" class="btn btn-default" name="submit" value="Configurer"><br>
-
 
654
					</form>
-
 
655
				</td>
-
 
656
			</tr>
-
 
657
		</table>
-
 
658
	</div>
-
 
659
 
-
 
660
	<div class="myDiv hide" id="showTwo">
-
 
661
		<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
-
 
662
			<form action="$php_self" method="post">
-
 
663
				<tr align="center">
-
 
664
					<td colspan="2"><b>SMTP Relais :</b></td>
-
 
665
				</tr>
-
 
666
				<tr align="center">
-
 
667
					<td colspan="2">Postfix envois, ralaye les emails sorants à un autre serveur SMTP.</td>
-
 
668
				</tr>
-
 
669
				<tr>
-
 
670
					<td><label>Enterez le serveur SMTP relai en FQDN ou IP</label></td>
-
 
671
					<td><input type="text" name="smtp" placeholder="SMTP" required/></td>
-
 
672
				</tr>
-
 
673
				<tr>
-
 
674
					<td><label>Enterez le port SMTP</label></td>
-
 
675
					<td><input type="text" name="port" placeholder="port" required/></td>
-
 
676
				</tr>
-
 
677
				<tr>
-
 
678
					<td><label>Enterez l'IP du serveur SMTP relais (0.0.0.0/0 si c'est dynamique/par défaut si vide)</label></td>
-
 
679
					<td><input type="text" name="smtpIP" placeholder="IP du SMTP relais" required/></td>
-
 
680
				</tr>
-
 
681
				<tr align="center">
-
 
682
					<td colspan="2">
-
 
683
						<input type="hidden" name="testConf" value="2">
-
 
684
						<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
-
 
685
					</td>
-
 
686
				</tr>
-
 
687
			</form>
-
 
688
		</table><br>
-
 
689
	</div>
-
 
690
 
-
 
691
	<div class="myDiv hide" id="showThree">
-
 
692
		<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
-
 
693
			<form method="post" action="$php_self">
-
 
694
				<tr colspan="2" align="center">
-
 
695
					<td><b>Configuration de serveur mail via un compte email :</b></td>
-
 
696
				</tr>
-
 
697
				<tr align="center">
-
 
698
					<td>
-
 
699
						<table class="table table-striped">
-
 
700
							<tr>
-
 
701
								<td><label>Entez votre email</label></td>
-
 
702
								<td><input type="email" name="mailAddr" placeholder="Enter your email" required/></td>
-
 
703
							</tr>
-
 
704
							<tr>
-
 
705
								<td><label>Entez le mot de passe</label></td>
-
 
706
								<td><input type="password" id="pswd1" name="pswd1" required/></td>
-
 
707
							</tr>
-
 
708
							<tr>
-
 
709
								<td><label>Confirmer le mot de passe</label></td>
-
 
710
								<td><input type="password" id="pswd2" name="pswd2" required/></td>
-
 
711
							</tr>
-
 
712
 
-
 
713
						</table>
-
 
714
						<table class="table table-striped">
-
 
715
						  <thead>
-
 
716
							    <tr>
-
 
717
							      <th scope="col">#</th>
-
 
718
							      <th scope="col">compte de messagerie</th>
-
 
719
							      <th scope="col">adresse de messagerie</th>
-
 
720
							      <th scope="col">serveur sortant</th>
-
 
721
							      <th scope="col">port sortant</th>
-
 
722
							    </tr>
-
 
723
						  </thead>
-
 
724
						  <tbody>
-
 
725
EOT;
-
 
726
$smtpsConf = [
-
 
727
	["Orange", "Orange/Wanadoo", "orange.fr /wanadoo.fr", "smtp.orange.fr", 465],
-
 
728
	["Hotmail", "Hotmail", "hotmail.com/.fr / live.com/.fr / msn.com", "smtp.live.com", 587],
-
 
729
	["Outlook", "Outlook", "hotmail.xx/live.xx/msn.com/outlook/office365", "smtp.office365.com", 587],
-
 
730
	["SFR", "SFR", "sfr.fr", "smtp.sfr.fr", 465],
-
 
731
	["Free", "Free", "free.fr", "smtp.free.fr", 465],
-
 
732
	["Gmail", "Gmail", "gmail.com", "smtp.gmail.com", 587],
-
 
733
	["Laposte", "Laposte", "laposte.net", "smtp.laposte.net", 465],
-
 
734
	["Bouygues", "Bouygues Telecom", "bbox.fr", "smtp.bbox.fr", 587]
-
 
735
];
-
 
736
 
-
 
737
foreach( $smtpsConf as $smtpConf ) {
-
 
738
echo <<< EOT
-
 
739
							    <tr>
-
 
740
							      <th scope="row"><input class="form-check-input blur" type="radio" name="smtpPort" value="$smtpConf[3] $smtpConf[4]"/></th>
-
 
741
 
-
 
742
							      <td>$smtpConf[1]</td>
-
 
743
							      <td>$smtpConf[2]</td>
-
 
744
							      <td>$smtpConf[3]</td>
-
 
745
							      <td align="center">$smtpConf[4]</td>
-
 
746
							    </tr>
-
 
747
EOT;
-
 
748
}
-
 
749
echo<<<EOT
-
 
750
							    <tr>
-
 
751
							      <th scope="row"><input id="perso" class="form-check-input" type="radio" name="smtpPort"/></th>
-
 
752
							      <td>Personalisez votre smtp</td>
-
 
753
							      <td><input type="text" id="smtpPerso" name="smtpPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur SMTP" disabled/></td>
-
 
754
							      <td>Personalisez le port</td>
-
 
755
							      <td><input type="text" id="portPerso" name="portPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur Port" disabled/></td>
-
 
756
							    </tr>
-
 
757
						  </tbody>
-
 
758
						</table>
-
 
759
			  		</td>
-
 
760
				</tr>
-
 
761
				<tr align="center">
-
 
762
					<td class="testConf3">
-
 
763
					</td>
-
 
764
				</tr>
-
 
765
				<tr align="center">
-
 
766
					<td>
-
 
767
						<input type="hidden" name="testConf" value="3">
-
 
768
						<input type="submit" class="btn btn-default" name="submit" value="Valider" id="testConf3"><br>
-
 
769
					</td>
-
 
770
				</tr>
-
 
771
			</form>	  
-
 
772
		</table><br>
-
 
773
	</div>
-
 
774
</div><br>
-
 
775
<div class="panel">
-
 
776
	<div class="panel-header">Mail admin</div>
-
 
777
	<div class="panel-row conf" id="conf">	
-
 
778
		<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
-
 
779
			<form action="$php_self" method="post">
-
 
780
				<tr align="center">
-
 
781
					<td colspan="2"><b>Mail admin</b></td>
-
 
782
				</tr>
-
 
783
				<tr align="center">
-
 
784
					<td colspan="2">L'adresse email de l'administrateur pour recevoir les alertes des nouvelles inscriptions, et l'archive hebdomadaire des logs</td>
-
 
785
				</tr>
-
 
786
				<tr>
-
 
787
EOT;
-
 
788
					if (empty($adminMail)){
-
 
789
						echo "<td><label>Enterez l'adresse email</label></td>";
-
 
790
					} else {
-
 
791
						echo "<td>L'email configuré actuellement est : " . $adminMail . "</td>";
-
 
792
					}
-
 
793
echo <<<EOT
-
 
794
					<td><input type="email" name="adminMail" placeholder="Enter your email" required/></td>
-
 
795
				</tr>
-
 
796
 
-
 
797
				<tr align="center">
-
 
798
					<td colspan="2">
-
 
799
						<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
-
 
800
					</td>
-
 
801
				</tr>
-
 
802
			</form>
-
 
803
			<form action="$php_self" method="post">
-
 
804
				<tr align="center">
-
 
805
					<td colspan="2">
-
 
806
						<input type="hidden" name="unset" value="adminMail">
-
 
807
						<input type="submit" class="btn btn-default" name="submit" value="Supprimer l'admin email"><br>
-
 
808
					</td>
-
 
809
				</tr>
-
 
810
			</form>
-
 
811
		</table><br>
-
 
812
	</div>
-
 
813
</div><br>
-
 
814
<div class="panel">
-
 
815
	<div class="panel-header">WhiteList Domains Configuration</div>
-
 
816
	<div class="panel-row conf" id="conf">	
-
 
817
		<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
-
 
818
			<tr align="center">
-
 
819
				<td>La liste blanche limite les inscriptions utilisateurs à un, ou plusieurs domaines.</td>
-
 
820
			</tr>
-
 
821
			<form method="post" action="$php_self">
-
 
822
				<tr align="center">
-
 
823
					<td width="50%" align="center">Mettez vos domaines à configurer. Un par ligne</td>
-
 
824
				</tr>
-
 
825
				<tr align="center">
-
 
826
					<td>
-
 
827
 						<br><textarea name='wld' rows=5 cols=50 placeholder="Aucune WLD configurée actuellement"">
-
 
828
EOT;
-
 
829
if(!empty($whiteDomain)){
-
 
830
	foreach ($whiteDomain as $domain){
-
 
831
		echo "$domain\n";
-
 
832
	}
-
 
833
}
-
 
834
echo<<<EOT
-
 
835
</textarea>
-
 
836
					</td>
-
 
837
				</tr>
-
 
838
				<tr align="center">
-
 
839
					<td colspan="2">
-
 
840
						<br><input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
-
 
841
					</td>
-
 
842
				</tr>
-
 
843
			</form>
-
 
844
			<form action="$php_self" method="post">
-
 
845
				<tr align="center">
-
 
846
					<td colspan="2">
-
 
847
						<input type="hidden" name="unset" value="whiteDomain">
-
 
848
						<input type="submit" class="btn btn-default" name="submit" value="Supprimer la WLD"><br>
-
 
849
					</td>
-
 
850
				</tr>
-
 
851
			</form>
-
 
852
		</table><br>
-
 
853
	</div>
-
 
854
</div><br>
-
 
855
 
-
 
856
EOT;
-
 
857
 
-
 
858
?>
-
 
859
 
-
 
860
<script>
-
 
861
	$(document).ready(function(){
-
 
862
		$("div.hide").hide();
-
 
863
 
-
 
864
		$('#conf input[type="radio"]').click(function(){
-
 
865
			var value = $(this).val(); 
-
 
866
			$("div.myDiv").hide();
-
 
867
			$("#show"+value).show();
-
 
868
		});
-
 
869
 
-
 
870
		//On vérifie si le mot de passe est ok
-
 
871
		$("#pswd2").keyup(function(){
-
 
872
			if($("#pswd1").val() != "" && $("#pswd2").val() != "" && $("#pswd1").val() != $("#pswd2").val()){
-
 
873
				$(".testConf3").html("<br>Les deux mots de passe sont différents");
-
 
874
				$("#testConf3").attr("disabled", true);
-
 
875
			} else {
-
 
876
				$("#testConf3").attr("disabled", false);
-
 
877
				$(".testConf3").fadeOut(800);
-
 
878
			}
-
 
879
		})
-
 
880
	});
-
 
881
 
-
 
882
	$('#perso').click(function(){
-
 
883
 
-
 
884
		$(".perso").attr("disabled", false);
-
 
885
	});
-
 
886
 
-
 
887
	$('.blur').click(function(){
-
 
888
 
-
 
889
		$(".perso").attr("disabled", true);
-
 
890
	});
-
 
891
 
-
 
892
	function valPerso(){
-
 
893
		var valSmtpPerso = document.getElementById("smtpPerso").value;
-
 
894
		var valPortPerso = document.getElementById("portPerso").value;
-
 
895
		document.getElementById("perso").value = valSmtpPerso + " " + valPortPerso;
-
 
896
	};
-
 
897
 
-
 
898
	function hideShow(x){
-
 
899
		$("div." + x).toggle();
-
 
900
		var value = $("input." + x).val();
-
 
901
		var elem = document.getElementById("btn-" + x);
-
 
902
		if (elem.value=="Configurer"){
-
 
903
			elem.value = "Annuler";
-
 
904
		} else{
-
 
905
			elem.value = "Configurer";
-
 
906
		}
-
 
907
	};
-
 
908
 
-
 
909
</script>
-
 
910
 
-
 
911
 
-
 
912
</body>
371
</body>
913
</html>
-
 
914
 
372
</html>
-
 
373