Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2990 → Rev 2991

/web/acc/admin/mail.php
File deleted
/web/acc/admin/services.php
1,87 → 1,6
<?php
/* written by steweb57 & Rexy */
 
 
// partie $_POST du service mail
 
$php_self = htmlspecialchars($_SERVER['PHP_SELF']);
// Traiter les formulaires de la partie MAIL SERVICE
if(!empty($_POST)){
 
var_dump($_POST);
/* // procéder a l'installtion de postfix
if (!empty($_POST['install'])){
exec('sudo dnf install -y postfix', $output, $retval);
// header("Location:services.php");
var_dump($output);
echo "<br>\$retval : " . $retval;
}
*/
// La variable qui contiendra les options et les arguments a passer à l'install
$optArg = "";
if(!empty($_POST['testConf'])){
$optArg .= " -".trim($_POST['testConf']);
}
if(!empty($_POST['smtp'])){
$optArg .= " -s \"".trim($_POST['smtp'])."\"";
}
if(!empty($_POST['port'])){
$optArg .= " -p \"".trim($_POST['port'])."\"";
}
if(!empty($_POST['smtpPort'])){
$smtpPort = explode(" ", $_POST['smtpPort']);
$optArg .= " -s \"".trim($smtpPort[0])."\" -p \"".trim($smtpPort[1])."\"";
}
if(!empty($_POST['smtpIP'])){
$optArg .= " -r \"".trim($_POST['smtpIP'])."\"";
}
if(!empty($_POST['mailAddr'])){
$optArg .= " -m \"".trim($_POST['mailAddr'])."\"";
}
if(!empty($_POST['pswd1']) && !empty($_POST['pswd2'])){
if (trim($_POST['pswd1']) == trim($_POST['pswd2'])){
$optArg .= " -o \"".trim($_POST['pswd2'])."\"";
} else {
echo "<script> alert(\"Les deux mots de passe sont différents\"); window.location.href=\"services.php\";</script>";
}
}
if(!empty($_POST['adminMail'])){
$optArg .= " -a \"".$_POST['adminMail']."\"";
}
if(!empty($_POST['wld'])){
$optArg .= " -w \"".str_replace("\r"," ",trim($_POST['wld']))."\"";
}
 
// Supprimer la WLD ou l'email de l'admin
if(!empty($_POST['unset'])){
exec("sudo sed -i '/". $_POST['unset']."/d' /usr/local/etc/alcasar-mail.conf", $output, $retval);
 
var_dump($output);
echo "<br>\$retval : " . $retval;
}
 
// Supprimer toute la configuration actuelle
if(!empty($_POST['uninstall'])){
// echo "sudo /usr/local/bin/alcasar-mail-uninstall.sh <br>";
exec("sudo /usr/local/bin/alcasar-mail-uninstall.sh", $output, $retval);
 
var_dump($output);
echo "<br>\$retval : " . $retval;
}
if(!empty($optArg)){
echo "sudo /usr/local/bin/alcasar-mail-install.sh".$optArg;
exec("sudo /usr/local/bin/alcasar-mail-install.sh".escapeshellcmd($optArg), $output, $retval);
var_dump($output);
echo "<br>\$retval : " . $retval;
}
// à décommenté une fois tests et debugs réalisé pour recharger la page sansle $_POST
// header("Location:services.php");
 
}// Fin de la partie $_POST du service mail
 
 
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
364,8 → 283,7
<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>
<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
<tr>
<?php if ($serviceName != "postfix"){
if ($statusOK) { ?>
<?php if ($statusOK) { ?>
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
<td width="80" align="center">---</td>
379,8 → 297,7
<td width="80" align="center">---</td>
<?php } ?>
</tr>
<?php }
} ?>
<?php } ?>
</table>
</div>
</div>
413,78 → 330,9
<div class="panel">
<div class="panel-header"><?= $l_opt_services ?></div>
<div class="panel-row">
 
<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"> </td><td colspan="3"><?php echo $l_service_action;?></td></tr>
 
<?php
/*
// POSTFIX
exec("sudo rpm" . escapeshellarg("-q postfix"), $output, $retval);
var_dump($output);
echo "<br>\$retval : " . $retval;
exec("sudo ip" . escapeshellarg("a"), $output, $retval);
var_dump($output);
echo "<br>\$retval : " . $retval;
// si POSTFIX n'est pas installé, on propose l'installation
if ($retval == 1){
 
echo <<<EOT
<tr align="center">
<td colspan="3"><b>POSTFIX n'est pas installé.</b></td>
<td>
<form id="install" action="$php_self" method=POST>
<input type="hidden" name="install" value="install">
<input type=submit form="install" value="Install">
</form>
</td>
</tr>
EOT;
 
// si POSFIX est installé
} else {
*/
// la partie tableau qui affiche les statut du service POSTFIX, et possiblité de start, restart & stop
$serviceName = "postfix";
if(array_key_exists($serviceName, $MainServiceStatus)){
 
$statusOK = $MainServiceStatus['postfix'];
$comment="l_$serviceName";
$stopService = $_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName);
$startService = $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName);
$restartService = $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName);
// $restartService = $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\\";
 
echo "<tr>";
if ($statusOK) {
echo <<<EOT
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="$l_service_status_img_ok"></td>
<td align="center"><b>$serviceName</b></td>
<td align="center">${$comment}</td>
<td width="80" align="center">---</td>
<td width="80" align="center">
<a href=$stopService>$l_service_stop</a></td>
<td width="80" align="center">
<a href=$restartService>$l_service_restart</a></td>
EOT;
} else {
echo <<<EOT
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="$l_service_status_img_ko"></td>
<td align="center">$serviceName</td>
<td align="center">${$comment}</td>
<td width="80" align="center">
<a href=$startService>$l_service_start</a></td>
<td width="80" align="center">---</td>
<td width="80" align="center">---</td>
EOT;
}
echo "</tr>";
}
//}
// POSTFIX end
?>
 
<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
<tr>
<?php if ($wifi4eu == "on") { ?>
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
500,13 → 348,10
<td width="80" align="center">---</td>
<?php } ?>
</tr>
</form>
 
</table>
</form>
</div>
</div>
 
 
<div class="panel">
<div class="panel-header"><?= $l_stop_restart ?></div>
<div class="panel-row">
523,391 → 368,5
</table>
</div>
</div>
 
 
<!-- Code de la partie mail service, il ne faut pas oublier de rajouter jquery dans le head du html -->
 
<?php
 
echo <<<EOT
 
<div class="panel">
<div class="panel-header">POSTFIX actuelle Configuration</div>
<div class="panel-row">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
 
EOT;
 
// la conf actuelle, si le fichier alcasar-mail.conf est présent
$alcasarMailConf = "/usr/local/etc/alcasar-mail.conf";
if (is_file ($alcasarMailConf)){
 
$tab=file($alcasarMailConf);
 
if ($tab){
foreach ($tab as $line) {
 
$field=explode("=", $line);
 
switch ($field[0]) {
case 'smtp':
$smtp = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>SMTP : </b>$smtp</td>
</tr>
EOT;
break;
case 'port':
$port = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Port : </b>$port</td>
</tr>
EOT;
break;
case 'smtpIP':
$smtpIP = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>SMTP ip : </b>$smtpIP</td>
</tr>
EOT;
break;
case 'mailAddr':
$mailAddr = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Email Addr : </b>$mailAddr</td>
</tr>
EOT;
break;
case 'adminMail':
$adminMail = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Admin email : </b>$adminMail</td>
</tr>
EOT;
break;
case 'whiteDomain':
$whiteDomain = explode(" ", trim($field[1]));
break;
}
}
}
echo <<<EOT
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="uninstall" value="uninstall">
<br><input type="submit" class="btn btn-default" name="submit" value="Supprimer toute la configuration">
</td>
</tr>
</form>
<tr align="center">
<td colspan="2"><font color=red>ATTENTION : la suppression enlève toute la configuration du SERVICE MAIL</font>
 
</td>
</tr>
EOT;
// si le fichier alcasar-mail.conf n'existe pas
} else {
 
echo <<<EOT
<tr align="center">
<td><b>POSTFIX n'est pas configuré par ALCASAR.</b></td>
</tr>
EOT;
 
}
 
// Partie de paramétrage de la configuration
 
// Configuration de l'adresse email de l'administrateur
echo <<<EOT
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">POSTFIX Configuration</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td><input type="radio" name="conf" class="mail" value="One"/><b>Service autonome</b></td>
<td><input type="radio" name="conf" class="mail" value="Two"/><b>Service relay</b></td>
<td><input type="radio" name="conf" class="mail" value="Three"/> <b>Adresse mail</b></td>
</tr>
</table><br>
</div>
<div class="myDiv hide" id="showOne">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td><b>Serveur mail est autonome :</b></td>
</tr>
<tr align="center">
<td>
<form action="$php_self" method="post">
<input type="hidden" name="testConf" value="1">
<input type="submit" class="btn btn-default" name="submit" value="Configurer"><br>
</form>
</td>
</tr>
</table>
</div>
 
<div class="myDiv hide" id="showTwo">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2"><b>SMTP Relais :</b></td>
</tr>
<tr align="center">
<td colspan="2">Postfix envois, ralaye les emails sorants à un autre serveur SMTP.</td>
</tr>
<tr>
<td><label>Enterez le serveur SMTP relai en FQDN ou IP</label></td>
<td><input type="text" name="smtp" placeholder="SMTP" required/></td>
</tr>
<tr>
<td><label>Enterez le port SMTP</label></td>
<td><input type="text" name="port" placeholder="port" required/></td>
</tr>
<tr>
<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>
<td><input type="text" name="smtpIP" placeholder="IP du SMTP relais" required/></td>
</tr>
<tr align="center">
<td colspan="2">
<input type="hidden" name="testConf" value="2">
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
</table><br>
</div>
 
<div class="myDiv hide" id="showThree">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form method="post" action="$php_self">
<tr colspan="2" align="center">
<td><b>Configuration de serveur mail via un compte email :</b></td>
</tr>
<tr align="center">
<td>
<table class="table table-striped">
<tr>
<td><label>Entez votre email</label></td>
<td><input type="email" name="mailAddr" placeholder="Enter your email" required/></td>
</tr>
<tr>
<td><label>Entez le mot de passe</label></td>
<td><input type="password" id="pswd1" name="pswd1" required/></td>
</tr>
<tr>
<td><label>Confirmer le mot de passe</label></td>
<td><input type="password" id="pswd2" name="pswd2" required/></td>
</tr>
 
</table>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">compte de messagerie</th>
<th scope="col">adresse de messagerie</th>
<th scope="col">serveur sortant</th>
<th scope="col">port sortant</th>
</tr>
</thead>
<tbody>
EOT;
$smtpsConf = [
["Orange", "Orange/Wanadoo", "orange.fr /wanadoo.fr", "smtp.orange.fr", 465],
["Hotmail", "Hotmail", "hotmail.com/.fr / live.com/.fr / msn.com", "smtp.live.com", 587],
["Outlook", "Outlook", "hotmail.xx/live.xx/msn.com/outlook/office365", "smtp.office365.com", 587],
["SFR", "SFR", "sfr.fr", "smtp.sfr.fr", 465],
["Free", "Free", "free.fr", "smtp.free.fr", 465],
["Gmail", "Gmail", "gmail.com", "smtp.gmail.com", 587],
["Laposte", "Laposte", "laposte.net", "smtp.laposte.net", 465],
["Bouygues", "Bouygues Telecom", "bbox.fr", "smtp.bbox.fr", 587]
];
 
foreach( $smtpsConf as $smtpConf ) {
echo <<< EOT
<tr>
<th scope="row"><input class="form-check-input blur" type="radio" name="smtpPort" value="$smtpConf[3] $smtpConf[4]"/></th>
 
<td>$smtpConf[1]</td>
<td>$smtpConf[2]</td>
<td>$smtpConf[3]</td>
<td align="center">$smtpConf[4]</td>
</tr>
EOT;
}
echo<<<EOT
<tr>
<th scope="row"><input id="perso" class="form-check-input" type="radio" name="smtpPort"/></th>
<td>Personalisez votre smtp</td>
<td><input type="text" id="smtpPerso" name="smtpPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur SMTP" disabled/></td>
<td>Personalisez le port</td>
<td><input type="text" id="portPerso" name="portPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur Port" disabled/></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr align="center">
<td class="testConf3">
</td>
</tr>
<tr align="center">
<td>
<input type="hidden" name="testConf" value="3">
<input type="submit" class="btn btn-default" name="submit" value="Valider" id="testConf3"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">Mail admin</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2"><b>Mail admin</b></td>
</tr>
<tr align="center">
<td colspan="2">L'adresse email de l'administrateur pour recevoir les alertes des nouvelles inscriptions, et l'archive hebdomadaire des logs</td>
</tr>
<tr>
EOT;
if (empty($adminMail)){
echo "<td><label>Enterez l'adresse email</label></td>";
} else {
echo "<td>L'email configuré actuellement est : " . $adminMail . "</td>";
}
echo <<<EOT
<td><input type="email" name="adminMail" placeholder="Enter your email" required/></td>
</tr>
 
<tr align="center">
<td colspan="2">
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="unset" value="adminMail">
<input type="submit" class="btn btn-default" name="submit" value="Supprimer l'admin email"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">WhiteList Domains Configuration</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td>La liste blanche limite les inscriptions utilisateurs à un, ou plusieurs domaines.</td>
</tr>
<form method="post" action="$php_self">
<tr align="center">
<td width="50%" align="center">Mettez vos domaines à configurer. Un par ligne</td>
</tr>
<tr align="center">
<td>
<br><textarea name='wld' rows=5 cols=50 placeholder="Aucune WLD configurée actuellement"">
EOT;
if(!empty($whiteDomain)){
foreach ($whiteDomain as $domain){
echo "$domain\n";
}
}
echo<<<EOT
</textarea>
</td>
</tr>
<tr align="center">
<td colspan="2">
<br><input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="unset" value="whiteDomain">
<input type="submit" class="btn btn-default" name="submit" value="Supprimer la WLD"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
 
EOT;
 
?>
 
<script>
$(document).ready(function(){
$("div.hide").hide();
 
$('#conf input[type="radio"]').click(function(){
var value = $(this).val();
$("div.myDiv").hide();
$("#show"+value).show();
});
 
//On vérifie si le mot de passe est ok
$("#pswd2").keyup(function(){
if($("#pswd1").val() != "" && $("#pswd2").val() != "" && $("#pswd1").val() != $("#pswd2").val()){
$(".testConf3").html("<br>Les deux mots de passe sont différents");
$("#testConf3").attr("disabled", true);
} else {
$("#testConf3").attr("disabled", false);
$(".testConf3").fadeOut(800);
}
})
});
 
$('#perso').click(function(){
 
$(".perso").attr("disabled", false);
});
 
$('.blur').click(function(){
 
$(".perso").attr("disabled", true);
});
 
function valPerso(){
var valSmtpPerso = document.getElementById("smtpPerso").value;
var valPortPerso = document.getElementById("portPerso").value;
document.getElementById("perso").value = valSmtpPerso + " " + valPortPerso;
};
 
function hideShow(x){
$("div." + x).toggle();
var value = $("input." + x).val();
var elem = document.getElementById("btn-" + x);
if (elem.value=="Configurer"){
elem.value = "Annuler";
} else{
elem.value = "Configurer";
}
};
 
</script>
 
 
</body>
</html>
</html>
/web/acc/manager/htdocs/autoregistration.php
File deleted
Property changes:
Deleted: svn:keywords
-Id
\ No newline at end of property
/web/acc/manager/htdocs/user_by_email.php
0,0 → 1,507
<?php
/* written by K@M3L & joss_p & Rexy */
 
// partie $_POST du service mail
$php_self = htmlspecialchars($_SERVER['PHP_SELF']);
if(!empty($_POST)){
var_dump($_POST);
// contient les options et les arguments au configurateur
$optArg = "";
if(!empty($_POST['testConf'])){
$optArg .= " -".trim($_POST['testConf']);
}
if(!empty($_POST['smtp'])){
$optArg .= " -s \"".trim($_POST['smtp'])."\"";
}
if(!empty($_POST['port'])){
$optArg .= " -p \"".trim($_POST['port'])."\"";
}
if(!empty($_POST['smtpPort'])){
$smtpPort = explode(" ", $_POST['smtpPort']);
$optArg .= " -s \"".trim($smtpPort[0])."\" -p \"".trim($smtpPort[1])."\"";
}
if(!empty($_POST['smtpIP'])){
$optArg .= " -r \"".trim($_POST['smtpIP'])."\"";
}
if(!empty($_POST['mailAddr'])){
$optArg .= " -m \"".trim($_POST['mailAddr'])."\"";
}
if(!empty($_POST['pswd1']) && !empty($_POST['pswd2'])){
if (trim($_POST['pswd1']) == trim($_POST['pswd2'])){
$optArg .= " -o \"".trim($_POST['pswd2'])."\"";
} else {
echo "<script> alert(\"Les deux mots de passe sont différents\"); window.location.href=\"services.php\";</script>";
}
}
if(!empty($_POST['adminMail'])){
$optArg .= " -a \"".$_POST['adminMail']."\"";
}
if(!empty($_POST['wld'])){
$optArg .= " -w \"".str_replace("\r"," ",trim($_POST['wld']))."\"";
}
 
// Supprimer la WLD ou l'email de l'admin
if(!empty($_POST['unset'])){
exec("sudo sed -i '/". $_POST['unset']."/d' /usr/local/etc/alcasar-mail.conf", $output, $retval);
 
var_dump($output);
echo "<br>\$retval : " . $retval;
}
 
// Supprimer toute la configuration actuelle
if(!empty($_POST['uninstall'])){
// echo "sudo /usr/local/bin/alcasar-mail-uninstall.sh <br>";
exec("sudo /usr/local/bin/alcasar-mail-uninstall.sh", $output, $retval);
 
var_dump($output);
echo "<br>\$retval : " . $retval;
}
if(!empty($optArg)){
echo "sudo /usr/local/bin/alcasar-mail-install.sh".$optArg;
exec("sudo /usr/local/bin/alcasar-mail-install.sh".escapeshellcmd($optArg), $output, $retval);
var_dump($output);
echo "<br>\$retval : " . $retval;
}
// à décommenté une fois tests et debugs réalisé pour recharger la page sans le $_POST
// header("Location:services.php");
 
}// Fin de la partie $_POST du service mail
 
 
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr') {
$l_reboot = "Relancer le système";
} else if($Language == 'es') {
$l_reboot = "Reiniciar el sistema";
} else {
$l_reboot = "Restart the system";
}
 
/****************************************************************
* CONST *
*****************************************************************/
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
 
/********************************************************
* CONF FILE test *
*********************************************************/
if (!file_exists(CONF_FILE)){
exit("Fichier de configuration ".CONF_FILE." non présent");
}
if (!is_readable(CONF_FILE)){
exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE);
}
$file_conf = fopen(CONF_FILE, 'r');
if (!$file_conf) {
exit('Error opening the file '.CONF_FILE);
}
while (!feof($file_conf)) {
$buffer = fgets($file_conf, 4096);
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
$tmp = explode('=', $buffer, 2);
$conf[trim($tmp[0])] = trim($tmp[1]);
}
}
fclose($file_conf);
 
/****************
* MAIN *
*****************/
 
?><!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $l_services_title; ?></title>
<link rel="stylesheet" href="/css/acc.css" type="text/css">
<script type="text/javascript" src="/js/jquery.min.js"></script>
</head>
<body>
<?php
 
echo <<<EOT
 
<div class="panel">
<div class="panel-header">POSTFIX actuelle Configuration</div>
<div class="panel-row">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
 
EOT;
 
// la conf actuelle, si le fichier alcasar-mail.conf est présent
$alcasarMailConf = "/usr/local/etc/alcasar-mail.conf";
if (is_file ($alcasarMailConf)){
 
$tab=file($alcasarMailConf);
 
if ($tab){
foreach ($tab as $line) {
 
$field=explode("=", $line);
 
switch ($field[0]) {
case 'smtp':
$smtp = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>SMTP : </b>$smtp</td>
</tr>
EOT;
break;
case 'port':
$port = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Port : </b>$port</td>
</tr>
EOT;
break;
case 'smtpIP':
$smtpIP = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>SMTP ip : </b>$smtpIP</td>
</tr>
EOT;
break;
case 'mailAddr':
$mailAddr = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Email Addr : </b>$mailAddr</td>
</tr>
EOT;
break;
case 'adminMail':
$adminMail = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Admin email : </b>$adminMail</td>
</tr>
EOT;
break;
case 'whiteDomain':
$whiteDomain = explode(" ", trim($field[1]));
break;
}
}
}
echo <<<EOT
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="uninstall" value="uninstall">
<br><input type="submit" class="btn btn-default" name="submit" value="Supprimer toute la configuration">
</td>
</tr>
</form>
<tr align="center">
<td colspan="2"><font color=red>ATTENTION : la suppression enlève toute la configuration du SERVICE MAIL</font>
 
</td>
</tr>
EOT;
// si le fichier alcasar-mail.conf n'existe pas
} else {
 
echo <<<EOT
<tr align="center">
<td><b>POSTFIX n'est pas configuré par ALCASAR.</b></td>
</tr>
EOT;
 
}
 
// Partie de paramétrage de la configuration
 
// Configuration de l'adresse email de l'administrateur
echo <<<EOT
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">POSTFIX Configuration</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td><input type="radio" name="conf" class="mail" value="One"/><b>Service autonome</b></td>
<td><input type="radio" name="conf" class="mail" value="Two"/><b>Service relay</b></td>
<td><input type="radio" name="conf" class="mail" value="Three"/> <b>Adresse mail</b></td>
</tr>
</table><br>
</div>
<div class="myDiv hide" id="showOne">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td><b>Serveur mail est autonome :</b></td>
</tr>
<tr align="center">
<td>
<form action="$php_self" method="post">
<input type="hidden" name="testConf" value="1">
<input type="submit" class="btn btn-default" name="submit" value="Configurer"><br>
</form>
</td>
</tr>
</table>
</div>
 
<div class="myDiv hide" id="showTwo">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2"><b>SMTP Relais :</b></td>
</tr>
<tr align="center">
<td colspan="2">Postfix envois, ralaye les emails sorants à un autre serveur SMTP.</td>
</tr>
<tr>
<td><label>Enterez le serveur SMTP relai en FQDN ou IP</label></td>
<td><input type="text" name="smtp" placeholder="SMTP" required/></td>
</tr>
<tr>
<td><label>Enterez le port SMTP</label></td>
<td><input type="text" name="port" placeholder="port" required/></td>
</tr>
<tr>
<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>
<td><input type="text" name="smtpIP" placeholder="IP du SMTP relais" required/></td>
</tr>
<tr align="center">
<td colspan="2">
<input type="hidden" name="testConf" value="2">
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
</table><br>
</div>
 
<div class="myDiv hide" id="showThree">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form method="post" action="$php_self">
<tr colspan="2" align="center">
<td><b>Configuration de serveur mail via un compte email :</b></td>
</tr>
<tr align="center">
<td>
<table class="table table-striped">
<tr>
<td><label>Entez votre email</label></td>
<td><input type="email" name="mailAddr" placeholder="Enter your email" required/></td>
</tr>
<tr>
<td><label>Entez le mot de passe</label></td>
<td><input type="password" id="pswd1" name="pswd1" required/></td>
</tr>
<tr>
<td><label>Confirmer le mot de passe</label></td>
<td><input type="password" id="pswd2" name="pswd2" required/></td>
</tr>
 
</table>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">compte de messagerie</th>
<th scope="col">adresse de messagerie</th>
<th scope="col">serveur sortant</th>
<th scope="col">port sortant</th>
</tr>
</thead>
<tbody>
EOT;
$smtpsConf = [
["Orange", "Orange/Wanadoo", "orange.fr /wanadoo.fr", "smtp.orange.fr", 465],
["Hotmail", "Hotmail", "hotmail.com/.fr / live.com/.fr / msn.com", "smtp.live.com", 587],
["Outlook", "Outlook", "hotmail.xx/live.xx/msn.com/outlook/office365", "smtp.office365.com", 587],
["SFR", "SFR", "sfr.fr", "smtp.sfr.fr", 465],
["Free", "Free", "free.fr", "smtp.free.fr", 465],
["Gmail", "Gmail", "gmail.com", "smtp.gmail.com", 587],
["Laposte", "Laposte", "laposte.net", "smtp.laposte.net", 465],
["Bouygues", "Bouygues Telecom", "bbox.fr", "smtp.bbox.fr", 587]
];
 
foreach( $smtpsConf as $smtpConf ) {
echo <<< EOT
<tr>
<th scope="row"><input class="form-check-input blur" type="radio" name="smtpPort" value="$smtpConf[3] $smtpConf[4]"/></th>
 
<td>$smtpConf[1]</td>
<td>$smtpConf[2]</td>
<td>$smtpConf[3]</td>
<td align="center">$smtpConf[4]</td>
</tr>
EOT;
}
echo<<<EOT
<tr>
<th scope="row"><input id="perso" class="form-check-input" type="radio" name="smtpPort"/></th>
<td>Personalisez votre smtp</td>
<td><input type="text" id="smtpPerso" name="smtpPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur SMTP" disabled/></td>
<td>Personalisez le port</td>
<td><input type="text" id="portPerso" name="portPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur Port" disabled/></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr align="center">
<td class="testConf3">
</td>
</tr>
<tr align="center">
<td>
<input type="hidden" name="testConf" value="3">
<input type="submit" class="btn btn-default" name="submit" value="Valider" id="testConf3"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">Mail admin</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2"><b>Mail admin</b></td>
</tr>
<tr align="center">
<td colspan="2">L'adresse email de l'administrateur pour recevoir les alertes des nouvelles inscriptions, et l'archive hebdomadaire des logs</td>
</tr>
<tr>
EOT;
if (empty($adminMail)){
echo "<td><label>Enterez l'adresse email</label></td>";
} else {
echo "<td>L'email configuré actuellement est : " . $adminMail . "</td>";
}
echo <<<EOT
<td><input type="email" name="adminMail" placeholder="Enter your email" required/></td>
</tr>
 
<tr align="center">
<td colspan="2">
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="unset" value="adminMail">
<input type="submit" class="btn btn-default" name="submit" value="Supprimer l'admin email"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">WhiteList Domains Configuration</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td>La liste blanche limite les inscriptions utilisateurs à un, ou plusieurs domaines.</td>
</tr>
<form method="post" action="$php_self">
<tr align="center">
<td width="50%" align="center">Mettez vos domaines à configurer. Un par ligne</td>
</tr>
<tr align="center">
<td>
<br><textarea name='wld' rows=5 cols=50 placeholder="Aucune WLD configurée actuellement"">
EOT;
if(!empty($whiteDomain)){
foreach ($whiteDomain as $domain){
echo "$domain\n";
}
}
echo<<<EOT
</textarea>
</td>
</tr>
<tr align="center">
<td colspan="2">
<br><input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="unset" value="whiteDomain">
<input type="submit" class="btn btn-default" name="submit" value="Supprimer la WLD"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
 
EOT;
 
?>
 
<script>
$(document).ready(function(){
$("div.hide").hide();
 
$('#conf input[type="radio"]').click(function(){
var value = $(this).val();
$("div.myDiv").hide();
$("#show"+value).show();
});
 
//On vérifie si le mot de passe est ok
$("#pswd2").keyup(function(){
if($("#pswd1").val() != "" && $("#pswd2").val() != "" && $("#pswd1").val() != $("#pswd2").val()){
$(".testConf3").html("<br>Les deux mots de passe sont différents");
$("#testConf3").attr("disabled", true);
} else {
$("#testConf3").attr("disabled", false);
$(".testConf3").fadeOut(800);
}
})
});
 
$('#perso').click(function(){
 
$(".perso").attr("disabled", false);
});
 
$('.blur').click(function(){
 
$(".perso").attr("disabled", true);
});
 
function valPerso(){
var valSmtpPerso = document.getElementById("smtpPerso").value;
var valPortPerso = document.getElementById("portPerso").value;
document.getElementById("perso").value = valSmtpPerso + " " + valPortPerso;
};
 
function hideShow(x){
$("div." + x).toggle();
var value = $("input." + x).val();
var elem = document.getElementById("btn-" + x);
if (elem.value=="Configurer"){
elem.value = "Annuler";
} else{
elem.value = "Configurer";
}
};
 
</script>
</body>
</html>
/web/acc/manager/htdocs/user_by_email_v2.php
0,0 → 1,508
<?php
# $Id: mail.php 2853 2020-07-19 21:50:07Z joss_p $
 
/* written by Joss_p */
/****************************************************************
* GLOBAL FILE PATHS *
*****************************************************************/
define('CONF_FILE', '/usr/local/etc/alcasar-mail.conf');
 
/****************************************************************
* FILE reading test *
*****************************************************************/
$conf_files = array(CONF_FILE);
foreach ($conf_files as $file) {
if (!file_exists($file)) {
exit("Fichier $file non présent");
}
if (!is_readable($file)) {
exit("Vous n'avez pas les droits de lecture sur le fichier $file");
}
}
 
/****************************************************************
* Read CONF_FILE *
*****************************************************************/
$file_conf = fopen(CONF_FILE, 'r');
if (!$file_conf) {
exit('Error opening the file '.CONF_FILE);
}
while (!feof($file_conf)) {
$buffer = fgets($file_conf, 4096);
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
$tmp = explode('=', $buffer, 2);
$conf[trim($tmp[0])] = trim($tmp[1]);
}
}
fclose($file_conf);
 
/****************************************************************
* Choice of language *
*****************************************************************/
$Language = 'en';
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]), 0, 2));
}
if ($Language === 'fr') {
$l_ldap_update = "Mise à jour des paramètres LDAP effectuée";
$l_mail_title = "Authentification externe : Adresse mail";
$l_ldap_legend = "Authentification LDAP";
$l_mail_auth_enable_label = "Activer l'authentification par mail :";
$l_mail_YES = "OUI";
$l_mail_NO = "NON";
$l_ldap_server_label = "Serveur LDAP:";
$l_ldap_server_text = "Adresse IP du serveur";
$l_ldap_base_dn_label = "DN de la base:";
$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'";
$l_ldap_uid_label = "Identifiant d'utilisateur (UID):";
$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'.";
$l_ldap_base_filter_label = "Filtre de recherche des utilisateurs (optionnel):";
$l_ldap_base_filter_text = "Vous pouvez limiter les objets recherchés avec des filtres additionnels.<br> Exemple 'objectClass=posixGroup' ajouterait le filtre '(&amp;(uid=username)(objectClass=posixGroup))'";
$l_ldap_user_label = "CN de l'utilisateur exploité par ALCASAR:";
$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'";
$l_ldap_password_label = "Mot de passe:";
$l_ldap_password_text = "Laissez vide pour un accès invité (ou anonyme). Obligatoire sur un AD.";
$l_ldap_ssl_label = "Connexion chiffré";
$l_mail_type_text = "Utiliser une connexion chiffré avec SSL (LDAPS)";
$l_ldap_cert_required_label = "Vérifier le certificat SSL";
$l_ldap_cert_required_text = "Vérifier que le serveur LDAP utilise un certificat connu";
$l_ldap_cert_label = "Certificat SSL (CA)";
$l_ldap_cert_text = "Certificat de l'authorité de certification signant celui du serveur LDAP";
$l_ad_dns_domain_label = "Nom de domaine interne";
$l_ad_dns_domain_text = "Nom de domaine qui sera redirigé vers le serveur DNS de l'annuaire LDAP (vide pour désactivé)";
$l_ldap_cert_status_cur = "Certificat actuel : ";
$l_ldap_cert_status_no = "Aucun certificat installé";
$l_mail_submit = "Enregistrer";
$l_ldap_test_service_failed = "Service LDAP injoignable sur ce serveur (vérifiez l'@IP).";
$l_ldap_test_service_ok = "Un port 389 (636 avec SSL) est actif sur ce serveur";
$l_ldap_test_connection_failed = "Connexion LDAP impossible (vérifiez le service LDAP sur ce serveur)";
$l_ldap_test_connection_ok = "Une connexion LDAP a été établie";
$l_ldap_test_bind_failed = "Echec d'authentification (vérifiez l'utilisateur et le mot de passe)";
$l_ldap_test_bind_ok = "L'authentification a réussie";
$l_ldap_test_dn_failed = "Le DN de la base semble incorrect (vérifiez le)";
$l_ldap_test_dn_ok = "Le DN de la base semble correct";
$l_ldap_error = "erreur LDAP";
$l_ldap_entries = "entrées dans la base";
$l_ldap_cert_cn_diff_dn = "Le CommonName du certificat (§cert_domainName§) est différent du nom de domaine du serveur";
$l_check = "Vérifier cette configuration";
$l_checkingConf = "Vérification de cette configuration...";
} else {
$l_ldap_update = "LDAP settings updated";
$l_mail_title = "External authentication : Address mail";
$l_ldap_legend = "LDAP authentication";
$l_mail_auth_enable_label = "Enable email authentication :";
$l_mail_YES = "YES";
$l_mail_NO = "NO";
$l_ldap_server_label = "LDAP server :";
$l_ldap_server_text = "IP address of the LDAP server.";
$l_ldap_base_dn_label = "DN of the base:";
$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'";
$l_ldap_uid_label = "User IDentifier (UID):";
$l_ldap_uid_text = "Key used to search for a given login identity.<br>e.g. 'uid', 'sn', etc.. For AD use 'sAMAccountName'.";
$l_ldap_base_filter_label = "User search filter (optional):";
$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 '(&amp;(uid=username)(objectClass=posixGroup))'";
$l_ldap_user_label = "CN of the user operated by ALCASAR:";
$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'";
$l_ldap_password_label = "Password:";
$l_ldap_password_text = "Leave blank to use anonymous binding. Mandatory for AD.";
$l_ldap_ssl_label = "Secure connection";
$l_mail_type_text = "Use an encrypted connection with SSL (LDAPS)";
$l_ldap_cert_required_label = "Check the SSL certificate";
$l_ldap_cert_required_text = "Verify that the LDAP server uses a trusted certificate";
$l_ldap_cert_label = "SSL certificate (CA)";
$l_ldap_cert_text = "Certificate of the certification authority that signed the LDAP server certificate";
$l_ad_dns_domain_label = "Internal domain name";
$l_ad_dns_domain_text = "Domain name that will be forwarded to the DNS server of the LDAP directory (empty for disabled)";
$l_ldap_cert_status_cur = "Current certificate:";
$l_ldap_cert_status_no = "No certificate imported";
$l_mail_submit = "Save";
$l_ldap_test_service_failed = "LDAP service is not reachable on that server (check IP)";
$l_ldap_test_service_ok = "A port 389 (636 with SSL) is open on this server";
$l_ldap_test_connection_failed = "LDAP connexion failed (check the LDAP service on this server)";
$l_ldap_test_connection_ok = "A LDAP connexion is established";
$l_ldap_test_bind_failed = "LDAP authentication failed (check the LDAP user and password)";
$l_ldap_test_bind_ok = "Successful authentication";
$l_ldap_test_dn_failed = "DN of the base seems to be wrong (check it)";
$l_ldap_test_dn_ok = "DN of the base seems to be ok";
$l_ldap_error = "LDAP error";
$l_ldap_entries = "entries in the base";
$l_ldap_cert_cn_diff_dn = "Certificate CommonName (§cert_domainName§) is different from the server domain name";
$l_check = "Check this config";
$l_checkingConf = "Checking this configuration...";
}
 
 
// Mail configuration params
$mail_status = $conf['MAIL'];
$mail_type = $conf['TYPE_MAIL'];
$mail_address_mail = $conf['mailAddr'];
$mail_smtp = $conf['smtp'];
$mail_port = $conf['port'];
$mail_address_ip = $conf['mailIP'];
$mail_server = "";
$mail_password_mail = "";
$mail_password_mail_2 = "";
$admin_address = $conf['adminMail'];
$mail_whitelist = $conf['whiteDomain'];
 
 
if(isset($_POST['submit'])){
if($_POST['auth_enable'] === '1')
{
exec("systemctl start postfix");
 
$mail_status = $_POST['auth_enable'];
$mail_type = $_POST['mail_type'];
$mail_address = $_POST['mail_address'];
$mail_ip = $_POST['mail_ip'];
$mail_server = $_POST['mail_server'];
$mail_mdp = $_POST['mail_mdp'];
$mail_mdp2 = $_POST['mail_mdp2'];
$admin_enable = $_POST['admin_enable'];
$admin_address = $_POST['admin_address'];
$mail_whitelist = $_POST['mail_whitelist'];
exec("cp /var/www/mail/header.php /var/www/html");
exec("cp /var/www/mail/inscription.php /var/www/html");
exec("cp /var/www/mail/inscription_traitement.php /var/www/html");
exec("cp /var/www/html/acc/admin/services.php /var/www/html/acc/admin/services.php.origin");
exec("cp /var/www/mail/services.php /var/www/html/acc/admin");
 
if ($mail_mdp == $mail_mdp2) {
switch ($mail_server) {
case '1':
$mail_smtp = "smtp.orange.fr";
$mail_port = 465;
break;
case '2':
$mail_smtp = "smtp.live.com";
$mail_port = 587;
break;
case '3':
$mail_smtp = "smtp.office365.com";
$mail_port = 587;
break;
case '4':
$mail_smtp = "smtp.sfr.fr";
$mail_port = 465;
break;
case '5':
$mail_smtp = "smtp.free.fr";
$mail_port = 465;
break;
case '6':
$mail_smtp = "smtp.gmail.com";
$mail_port = 587;
break;
case '7':
$mail_smtp = "smtp.laposte.net";
$mail_port = 465;
break;
case '8':
$mail_smtp = "smtp.bbox.fr";
$mail_port = 587;
break;
default:
echo "Erreur dans la saisie !";
break;
}
 
file_put_contents(CONF_FILE, str_replace('MAIL='.$conf['MAIL'],'MAIL='.$mail_status,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('TYPE_MAIL='.$conf['TYPE_MAIL'],'TYPE_MAIL='.$mail_type,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('mailAddr='.$conf['mailAddr'],'mailAddr='.$mail_address,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('mailIP='.$conf['mailIP'],'mailIP='.$mail_ip,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('smtp='.$conf['smtp'],'smtp='.$mail_smtp,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('port='.$conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('whiteDomain='.$conf['mail_whitelist'],'whiteDomain='.$mail_whitelist,file_get_contents(CONF_FILE)));
if (isset($admin_address)) {
file_put_contents(CONF_FILE, str_replace('adminMail='.$conf['admin_address'],'adminMail='.$admin_address,file_get_contents(CONF_FILE)));
}
 
switch ($mail_type) {
case '1':
$mail_port = 25;
file_put_contents(CONF_FILE, str_replace('port='.$conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
if(isset($mail_admin)){
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -1 -a $admin_address -w $mail_whitelist");
}
else {
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -1 -w $mail_whitelist");
}
break;
case '2':
if(isset($mail_admin)){
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");
}
else {
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");
}
break;
case '3':
if(isset($mail_admin)){
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");
}
else {
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");
}
break;
default:
echo "Erreur dans la saisie !";
break;
}
 
 
}
else {
echo "Erreur";
}
}
else {
 
exec("cp -f /etc/postfix/main.cf.origin /etc/postfix/main.cf");
 
exec("rm -rf /etc/postfix/sasl/");
 
exec("cp -f /var/www/mail/alcasar-mail.conf /usr/local/etc/");
 
exec("systemctl restart postfix");
exec("systemctl stop postfix");
 
exec("sed -i '/SMTP_IP=/ s/^/#/g' /usr/local/etc/alcasar-iptables-local.sh");
exec("sed -i '/SMTP_PORT=/ s/^/#/g' /usr/local/etc/alcasar-iptables-local.sh");
 
exec("rm -f /var/www/html/header.php");
exec("rm -f /var/www/html/inscription.php");
exec("rm -f /var/www/html/inscription_traitement.php");
exec("cp -f /var/www/html/acc/admin/services.php.origin /var/www/html/acc/admin/services.php");
 
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-iptables.sh");
 
}
header("Refresh:0");
 
exit;
}
 
 
 
 
 
 
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?= $l_mail_title ?></title>
<link type="text/css" href="/css/acc.css" rel="stylesheet">
<link type="text/css" href="/css/mail.css" rel="stylesheet">
<script>
function onMailStatusChange() {
var listToDisables1 = ['mail_type','admin_enable','admin_address','mail_whitelist'];
var listToDisables2 = ['mail_server','mail_type','admin_enable','admin_address','mail_whitelist','mail_ip'];
var listToDisables3 = ['mail_server','mail_mdp2','mail_mdp','mail_address','mail_type','admin_enable','admin_address','mail_whitelist'];
var formSubmit = document.querySelector('form input[type="submit"]');
var btn_checkConf = document.getElementById('btn-checkconf');
var isChecked = false;
 
if (document.getElementById('auth_enable').value === '1') {
for (var i=0; i<listToDisables1.length; i++) {
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables1[i]).disabled = true;
}
for (var i=0; i<listToDisables2.length; i++) {
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables2[i]).disabled = true;
}
for (var i=0; i<listToDisables3.length; i++) {
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables3[i]).disabled = true;
}
document.getElementById('mail_type').style.backgroundColor = null;
document.getElementById('mail_type').disabled = false;
if (document.getElementById('mail_type').value === '1') {
for (var i=0; i<listToDisables1.length; i++) {
document.getElementById(listToDisables1[i]).style.backgroundColor = null;
document.getElementById(listToDisables1[i]).disabled = false;
}
if (document.getElementById('admin_enable').value === '0') {
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
document.getElementById('admin_address').disabled = true;
}
}
else if (document.getElementById('mail_type').value === '2') {
for (var i=0; i<listToDisables2.length; i++) {
document.getElementById(listToDisables2[i]).style.backgroundColor = null;
document.getElementById(listToDisables2[i]).disabled = false;
}
if (document.getElementById('admin_enable').value === '0') {
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
document.getElementById('admin_address').disabled = true;
}
}
else if (document.getElementById('mail_type').value === '3') {
for (var i=0; i<listToDisables3.length; i++) {
document.getElementById(listToDisables3[i]).style.backgroundColor = null;
document.getElementById(listToDisables3[i]).disabled = false;
}
if (document.getElementById('admin_enable').value === '0') {
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
document.getElementById('admin_address').disabled = true;
}
}
formSubmit.style.display = null;
btn_checkConf.style.display = 'none';
} else {
for (var i=0; i<listToDisables1.length; i++) {
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables1[i]).disabled = true;
}
for (var i=0; i<listToDisables2.length; i++) {
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables2[i]).disabled = true;
}
for (var i=0; i<listToDisables3.length; i++) {
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables3[i]).disabled = true;
}
formSubmit.style.display = null;
btn_checkConf.style.display = 'none';
}
}
 
 
 
</script>
</head>
<body onLoad="onMailStatusChange();">
<div class="panel">
<div class="panel-header"><?= "Authentication Mail" ?></div>
<div class="panel-body">
<form id="form-config_mail" name="config_mail" method="POST" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
<fieldset>
<legend>
<br>
<div style="text-align: center">
</div>
</legend>
<dl>
<dt>
<label for="auth_enable"><?= "Activer l'authentification par mail :" ?></label>
</dt>
<dd>
<select id="auth_enable" name="auth_enable" onchange="onMailStatusChange();">
<option value="1"<?= ($mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
<option value="0"<?= (!$mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="mail_type"><?= "Type Messagerie" ?></label><br>
<?= "Choississez le type de messagerie a utiliser" ?><br>
</dt>
<dd>
<select id="mail_type" name="mail_type" onchange="onMailStatusChange();">
<option value=1>Nom de domaine</option>
<option value=2>Serveur mail ou serveur SMTP</option>
<option value=3>Adresse de messagerie</option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="mail_address"><?= "Adresse Messagerie"?></label><br>
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="mail_address" size="40" name="mail_address" value="<?= $mail_address_mail ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="mail_mdp"><?= "Mot de passe Messagerie"?></label><br>
<?= "Mot de passe de la messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="mail_mdp" size="40" name="mail_mdp" value="<?= $mail_password_mail ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="mail_mdp2"><?= "Confirmer Mot de passe Messagerie"?></label><br>
<?= "Confirmer le mot de passe de la messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="mail_mdp2" size="40" name="mail_mdp2" value="<?= $mail_password_mail_2 ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="mail_server"><?= "CHoix Serveur SMTP" ?></label><br>
<?= "Choissisiez le serveur SMTP correspondant à l'adress de messagerie" ?><br>
</dt>
<dd>
<select id="mail_server" name="mail_server" onchange="onMailStatusChange();">
<option value=1>Orange/Wanadoo</option>
<option value=2>Hotmail</option>
<option value=3>Outlook</option>
<option value=4>SFR</option>
<option value=5>Free</option>
<option value=6>Gmail</option>
<option value=7>Laposte</option>
<option value=8>Bouygues</option>
<option value=9>Personnalisé</option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="mail_ip"><?= "IP du serveur SMTP"?></label><br>
<?= "Adresse IP du serveur SMTP utilisé" ?>
</dt>
<dd>
<input type="text" id="mail_ip" size="40" name="mail_ip" value="<?= $mail_address_ip ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="admin_enable"><?= "Activer l'adresse admin :" ?></label>
</dt>
<dd>
<select id="admin_enable" name="admin_enable" onchange="onMailStatusChange();">
<option value="1"<?= ($mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
<option value="0"<?= (!$mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="admin_address"><?= "Adresse Messagerie admin"?></label><br>
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="admin_address" size="40" name="admin_address" value="<?= $admin_address ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="mail_whitelist"><?= "whitelist domaine"?></label><br>
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="mail_whitelist" size="40" name="mail_whitelist" value="<?= $mail_whitelist ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<p>
<!--<button id="btn-checkconf" onclick="checkConfig(); return false;"><?= $l_check ?></button>-->
<input id="submit" type="submit" value="<?= $l_mail_submit ?>" name="submit">
</p>
</fieldset>
</form>
</div>
</div>
</body>
</html>
/web/acc/manager/htdocs/user_by_sms.php
0,0 → 1,961
<?php
# $Id: autoregistration.php 2915 2021-02-07 22:59:23Z rexy $
 
#Define
$gammu_wrong_port = "";
$gammu_puk = "";
$gammu_simfail = "";
$gammu_simsecu = "";
$gammu_writeerror = "";
$gammu_timeout = "";
$error_pin = "";
$error_time_account = "";
$error_nb_essais = "";
$error_time_perm = "";
$error_num_alcasar = "";
$country_filter="";
$find_key="false";
$listen_on_right_port="false";
$script="/usr/local/bin/alcasar-sms.sh";
$vendor='';
$model='';
$gammu_smsd_port='';
 
# Test if a modem is plugged on serial-usb port
$open_port=exec("ls /dev/ttyUSB*",$openned_ports); // list of USB-Serial ports openned by a modem
if (!empty($open_port))
{
$find_key="true";
$vendor=exec("udevadm info -n $openned_ports[0] | grep 'MODEL=' | cut -d'=' -f2");
$model=exec("udevadm info -n $openned_ports[0] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep '^port\s\?=' | cut -d ' ' -f3"); // Gammu_smsd listen port
while ( list(,$row) = each($openned_ports))
{
if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ?
{
$listen_on_right_port="true";
}
}
}
$gammu_pid=exec("sudo $script --pidof");
if ($find_key == "false")
{ # close gammu if it's started
if ($gammu_pid!="")
{
exec("sudo $script --stop");
sleep(8);
header('Location: autoregistration.php');
exit();
}
}
 
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr'){
$l_title = "Auto enregistrement (SMS)";
$l_conf = "Configuration";
$l_conf_actu = "Configuration actuelle";
$l_speed = "Vitesse de connexion au MODEM";
$l_connect_port="Port de connexion au MODEM";
$l_pin = "Code PIN de la carte SIM";
$l_num_alcasar = "Numero de téléphone de la carte SIM";
$l_ban_temp = "Nombre d'essais avant le blocage";
$l_time_account = "Durée de validité des comptes crées";
$l_time_perm = "Durée du blocage (en jours)";
$l_status_gammu = "Etat du service";
$l_start = "Démarrer";
$l_status_device = "Status de votre MODEM GSM (clé 2G/3G/4G)";
$l_key_diseable = "Aucun périphérique détecté";
$l_key_enable_1 = "Un MODEM GSM '<b>".$vendor."(".$model.")</b>' est connecté.";
$l_key_enable_2 = "Il a ouvert les ports suivants : ";
$l_force_signal = "Force du signal";
$l_imei_device = "IMEI du périphérique";
$l_sms_received = "Nombre de SMS reçu";
$l_stop = "Arrêter";
$l_gammu_on="Le service est démarré";
$l_gammu_off="Le service est arrêté";
$l_edit = "Modifier";
$l_error_wrong_port = "Le port d'écoute ($gammu_smsd_port) n'existe pas";
$l_error_label_empty = "Le champ est vide";
$l_error_label_num = "Ce n'est pas un PIN valide";
$l_error_label_num2 = "Ce n'est pas un nombre";
$l_error_label_num3 = "Le format n'est pas correct: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
$l_error_writefail = "Le service ne parvient pas à discuter avec le port du MODEM GSM (ttyUSB0).";
$l_error_timeoutfail = "Impossible de se connecter au MODEM GSM (vérifiez la vitesse de connexion)";
$l_error_simfail = "Un problème au niveau de la carte SIM a été détecté. Est-elle présente?";
$l_error_simsecu_l = "Attention, lors du dernier démarrage, votre code PIN était erroné.<br>
La SIM doit être bloqué (code PUK). Consultez la documentation.";
$l_autorefresh = "Rafraichissement : 30 sec";
$l_days = "jours ";
$l_num_block="Liste des numéros bloqués";
$l_num_num="Numéro";
$l_num_raison="Raison";
$l_num_expiration="Date d'expiration";
$l_num_action="Action";
$l_num_exist="Un compte a été créé";
$l_num_flood="Le nombre d'essais maximum a été dépassé";
$l_num_unlock="Effacer";
$l_country_enable="Activer";
$l_country_disable="Désactiver";
$l_service_status_img_ok="Démarré";
$l_service_status_img_ko="Arrété";
$l_connect_speed="Modifier la vitesse de connexion : ";
$l_tab_first = "premier";
$l_tab_last = "dernier";
$l_tab_next = "suivant";
$l_tab_prev = "précédent";
$l_tab_search = "Recherche :";
$l_tab_pmenu = "Affiche la page _PAGE_ sur _PAGES_";
$l_tab_info = "Montrer _MENU_ résultats par page";
$l_tab_infoempty = "Aucun résultat";
$l_country_filter = "Filtrage en cours : ";
$l_country_filtering = " Filtrage par pays";
$l_country_filtering_plus = " Filtrage par pays avancé";
$l_phone_ban = " Comptes crées et numéros de téléphone bloqués";
$l_country_france_ena = "Autorise les numéros français";
$l_country_ue_ena = "Autorise les numéros européens";
$l_country_all_ena = "Autorise tous les pays";
$l_country_advanced_ena = "Autorisation personnalisée";
$l_advance = "Avancé";
} else if($Language == 'es') {
$l_title = "Auto-registro (SMS)";
$l_conf = "Configuración";
$l_conf_actu = "Configuración actual";
$l_speed = "Velocidad de conexión al MODEM";
$l_connect_port="Puerto de conexión al MODEM";
$l_pin = "PIN de la tarjeta SIM";
$l_num_alcasar = "Número de teléfono de la tarjeta SIM";
$l_ban_temp = "Número máximo de intentos antes de una prohibición permanente (baneo)";
$l_time_account = "Período de validez de la nueva cuenta.";
$l_time_perm = "Duración del baneo (por ejemplo, después de X intentar)";
$l_status_gammu = "Estado del servicio";
$l_start = "Iniciar";
$l_status_device = "Estado de su MODEM GSM (2G/3G/4G key)";
$l_key_diseable = "Ningún dispositivo detectado";
$l_key_enable_1 = "Un GSM MODEM '<b>".$vendor."(".$model.")</b>' está conectado.";
$l_key_enable_2 = "Ha abierto los siguientes puertos: ";
$l_force_signal = "Intensidad de señal";
$l_imei_device = "IMEI del dispositivo";
$l_sms_received = "Número de SMS recibidos";
$l_stop = "Detener";
$l_gammu_on="El servicio se está ejecutando";
$l_gammu_off="El servicio está caído";
$l_edit = "Modificar";
$l_error_wrong_port = "El puerto de escucha ($gammu_smsd_port) no existe";
$l_error_label_empty = "Campo vacío";
$l_error_label_num = "No es un PIN válido";
$l_error_label_num2 = "No es un número";
$l_error_label_num3 = "El número de teléfono no es correcto: +xxxYYYYYYYYY (xxx: cod. de país / YYYYYYYYY: numéro de teléfono)";
$l_error_writefail = "No hay comunicación con el puerto GSM MODEM (ttyUSB0).";
$l_error_timeoutfail = "No se puede conectar al MODEM GSM (verifique la velocidad de conexión).";
$l_error_simfail = "Se detectó un problema con su tarjeta SIM. ¿Está colocada?";
$l_error_simsecu_l = "Advertencia, durante el último inicio, el código PIN era incorrecto. <br>
La tarjeta Sim debe estar bloqueada. Por favor lea la documentación.";
$l_autorefresh = "Actualizar en: 30 seg";
$l_days = "días ";
$l_num_block="Lista de teléfonos bloqueados";
$l_num_num="Número de teléfono";
$l_num_raison="Motivo";
$l_num_expiration="Fecha de caducidad";
$l_num_action="Acción";
$l_num_exist="Una cuenta se ha creado";
$l_num_flood="Se ha alcanzado el número de intentos.";
$l_num_unlock="Borrar";
$l_country_enable="Activar";
$l_country_disable="Desactivar";
$l_service_status_img_ok="Corriendo";
$l_service_status_img_ko="Detenido";
$l_connect_speed="Modificar la velocidad de conexión: ";
$l_tab_first = "primero";
$l_tab_last = "último";
$l_tab_next = "siguiente";
$l_tab_prev = "anterior";
$l_tab_search = "Buscar:";
$l_tab_pmenu = "Mostrando _PAGE_ a _PAGE_ de _PAGE_ entradas:";
$l_tab_info = "Mostrar _MENU_ entradas";
$l_tab_infoempty = "No se encontraron registros coincidentes";
$l_country_filter = "Filtrado actual: ";
$l_country_filtering = "Filtrado de país";
$l_country_filtering_plus = " Filtrado de país avanzado";
$l_phone_ban = " Cuentas creadas y números de teléfono prohibidos";
$l_country_france_ena = "Autoriza los números franceses";
$l_country_ue_ena = "Autoriza números europeos";
$l_country_all_ena = "Autorizar todos los países";
$l_country_advanced_ena = "Autorización avanzada";
$l_advance = "Avanzado";
} else {
$l_title = "Auto registration (SMS)";
$l_conf = "Configuration";
$l_conf_actu = "Current configuration";
$l_speed = "Connection speed to the MODEM";
$l_connect_port="Connection port to the MODEM";
$l_pin = "PIN password of the SIM card";
$l_num_alcasar = "Phone number of the SIM card";
$l_ban_temp = "Max number of try before a permanent ban";
$l_time_account = "Validity period of new account";
$l_time_perm = "Duration of a ban (for example, after X try)";
$l_status_gammu = "Service status";
$l_start = "Start";
$l_status_device = "Status of your GSM MODEM (2G/3G/4G key)";
$l_key_diseable = "No device detected";
$l_key_enable_1 = "A GSM MODEM '<b>".$vendor."(".$model.")</b>' is connected.";
$l_key_enable_2 = "It has openned the following ports : ";
$l_force_signal = "Signal strength";
$l_imei_device = "Device IMEI";
$l_sms_received = "Number of SMS received";
$l_stop = "Stop";
$l_gammu_on="The service is running";
$l_gammu_off="The service is down";
$l_edit = "Modify";
$l_error_wrong_port = "The listening port ($gammu_smsd_port) doesn't exist";
$l_error_label_empty = "Field empty";
$l_error_label_num = "It's not a valid PIN password";
$l_error_label_num2 = "It's not a number";
$l_error_label_num3 = "The phone number is not good: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
$l_error_writefail = "Can not communicate with the GSM MODEM port (ttyUSB0).";
$l_error_timeoutfail = "Can not connect to the GSM MODEM (verify the connection speed).";
$l_error_simfail = "An issue with your Sim card was detected. Is it in the key?";
$l_error_simsecu_l = "Warning, during the last startup, the PIN code was wrong. <br>
The Sim card must be blocked. Please read the documentation.";
$l_autorefresh = "Refresh : 30 sec";
$l_days = "days ";
$l_num_block="List of blocked phone";
$l_num_num="Phone number";
$l_num_raison="Reason";
$l_num_expiration="Expiration date";
$l_num_action="Action";
$l_num_exist="An account has been created";
$l_num_flood="The number of try has been reached";
$l_num_unlock="Erase";
$l_country_enable="Enable";
$l_country_disable="Disable";
$l_service_status_img_ok="Running";
$l_service_status_img_ko="Stopped";
$l_connect_speed="Modify the connection speed : ";
$l_tab_first = "first";
$l_tab_last = "last";
$l_tab_next = "next";
$l_tab_prev = "previous";
$l_tab_search = "Search :";
$l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :";
$l_tab_info = "Show _MENU_ entries";
$l_tab_infoempty = "No matching records found";
$l_country_filter = "Current filtering : ";
$l_country_filtering = " Country filtering";
$l_country_filtering_plus = " Country filtering advanced";
$l_phone_ban = " Accounts created and phone Numbers banned";
$l_country_france_ena = "Authorize the french numbers";
$l_country_ue_ena = "Authorize european numbers";
$l_country_all_ena = "Authorize all countries";
$l_country_advanced_ena = "Advanced Authorization";
$l_advance = "Advanced";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><!-- written by Rexy -->
<head>
<!--<META HTTP-EQUIV="Refresh" CONTENT="30">-->
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
<title>Auto enregistrement</title>
<link rel="stylesheet" href="/css/acc.css">
<!-- DataTables CSS -->
<link rel="stylesheet" type="text/css" href="/css/jquery.dataTables.css">
<!-- jQuery -->
<script type="text/javascript" charset="utf8" src="/js/jquery.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="/js/jquery.dataTables.js"></script>
<script type="text/javascript">
function timedRefresh(timeoutPeriod) {
var interval = setInterval(refreshPage, timeoutPeriod);
}
 
function refreshPage() {
if ($("input[name=autoRefreshCheckboxes]").is(":checked")) {
location.reload(true);
}
}
 
$(document).ready( function () {
 
$('#table_id').DataTable({
"language": {
"paginate": {
"sFirst": "<?php echo $l_tab_first; ?>",
"sLast": "<?php echo $l_tab_last; ?>",
"sPrevious": "<?php echo $l_tab_prev; ?>",
"sNext": "<?php echo $l_tab_next; ?>"
},
"lengthMenu": "<?php echo $l_tab_info; ?>",
"zeroRecords": "<?php echo $l_tab_infoempty; ?>",
"info": "<?php echo $l_tab_pmenu; ?>",
"infoEmpty": "<?php echo $l_tab_infoempty; ?>",
"sSearch": "<?php echo $l_tab_search; ?>"
}
});
 
$('#table_country').DataTable({
"language": {
"paginate": {
"sFirst": "<?php echo $l_tab_first; ?>",
"sLast": "<?php echo $l_tab_last; ?>",
"sPrevious": "<?php echo $l_tab_prev; ?>",
"sNext": "<?php echo $l_tab_next; ?>"
},
"lengthMenu": "<?php echo $l_tab_info; ?>",
"zeroRecords": "<?php echo $l_tab_infoempty; ?>",
"info": "<?php echo $l_tab_pmenu; ?>",
"infoEmpty": "<?php echo $l_tab_infoempty; ?>",
"sSearch": "<?php echo $l_tab_search; ?>"
}
});
$(".showhide-div_country").slideUp("slow");
$(".showhide-div_ban").slideUp("slow");
$(".showhide-div_country_plus").slideUp("slow");
$(".showhide-but_country").on("click", function(){
$(".showhide-div_country").slideToggle("slow");
});
$(".showhide-but_country_plus").on("click", function(){
$(".showhide-div_country_plus").slideToggle("slow");
});
$(".showhide-but_ban").on("click", function(){
$(".showhide-div_ban").slideToggle("slow");
});
} );
</script>
</head>
<body onload="JavaScript:timedRefresh(30000);">
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
echo "
<tr>
<th>$l_title</th>
</tr>
<tr bgcolor=\"#FFCC66\">
<td><img src=\"/images/pix.gif\" width=\"1\" height=\"2\"></td>
</tr>
</TABLE>
<br>
<input type='checkbox' checked='checked' name='autoRefreshCheckboxes' >".$l_autorefresh."
";
?>
<center>
<br>
<table border=1 width=100%>
<tr>
<td colspan=2><h3><center><?php echo $l_status_device ?></center></h3></td>
</tr>
<tr>
<?php
if($find_key=="true")
{
# Start / stop of gammu-smsd (3*7sec) --> to be improve with systemd unit (see tarball in contrib/init folder)
if(isset($_POST["start"])){
$gammu_1=exec("sudo $script --start");
sleep(7);
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
sleep(7);
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
sleep(7);
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
header('Location: autoregistration.php');
exit();
}
if(isset($_POST["stop"])){
exec("sudo $script --stop");
sleep(8);
header('Location: autoregistration.php');
exit();
}
# Set the connexion speed to MODEM
if(isset($_POST['b_speed'])){
switch ($_POST['speed']) {
case "at":
exec("sudo $script --replace_speed");
break;
case "9600":
exec("sudo $script --replace_speed 9600");
break;
case "19200":
exec("sudo $script --replace_speed 19200");
break;
case "115200":
exec("sudo $script --replace_speed 115200");
break;
header('Location: autoregistration.php');
exit();
}
}
# Set the connexion port to MODEM
if(isset($_POST['b_port'])){
echo "speed = ".$_POST['port'];
$port = $_POST['port'];
exec("sudo $script --replace_port ".escapeshellarg($port));
header('Location: autoregistration.php');
exit();
}
 
# Set the SIM phone number
if(isset($_POST["b_num_alcasar"])){
echo "speed = ".$_POST['num_alcasar'];
$num = $_POST["num_alcasar"];
$error_num_alcasar = "";
if($num !="")
{
if(preg_match('#^\+#',$num))
{
exec("sudo $script --replace_numero_alcasar ".escapeshellarg($num));
header('Location: autoregistration.php');
exit();
}
else
{
$error_num_alcasar=$l_error_label_num3;
}
}
else
{
$error_num_alcasar=$l_error_label_empty;
}
}
# Set the SIM card PIN number
if(isset($_POST["b_pin"])){
$pin = $_POST["pin"];
$error_pin = "";
if($pin !="")
{
if(is_numeric($pin))
{
exec("sudo $script --replace_pin ".escapeshellarg($pin));
header('Location: autoregistration.php');
exit();
}
else
{
$error_pin=$l_error_label_num;
}
}
else
{
$error_pin=$l_error_label_empty;
}
}
 
# Set the session timeout for each new account
if(isset($_POST["b_time_account"])){
$time_account = $_POST["time_account"];
$error_time_account = "";
if($time_account !="")
{
if(is_numeric($time_account))
{
exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
header('Location: autoregistration.php');
exit();
}
else
{
$error_time_account=$l_error_label_num2;
}
}
else
{
$error_time_account=$l_error_label_empty;
}
}
 
# Set the number of tries before ban
if(isset($_POST["b_ban_temp"])){
$nb_ban_temp = $_POST["nb_essais"];
$error_nb_essais = "";
if($nb_ban_temp !="")
{
if(is_numeric($nb_ban_temp))
{
exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
header('Location: autoregistration.php');
exit();
}
else
{
$error_nb_essais=$l_error_label_num2;
}
}
else
{
$error_nb_essais=$l_error_label_empty;
}
}
 
# Set the ban timeout
if(isset($_POST["b_time_perm"])){
$time_perm = $_POST["time_perm"];
$error_time_perm = "";
if($time_perm !="")
{
if(is_numeric($time_perm))
{
exec("sudo $script --replace_time_perm ".escapeshellarg($time_perm));
header('Location: autoregistration.php');
exit();
}
else
{
$error_time_perm=$l_error_label_num2;
}
}
else
{
$error_time_perm=$l_error_label_empty;
}
}
# removing a banned phone number
if(isset($_POST['num_select'])){
$numero=$_POST['num_select'];
 
$add_mac=exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg($numero)." | cut -d ' ' -f1");
if (!empty($add_mac)) {
exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($add_mac));
}
exec("sudo $script --unlock_num $numero");
header('Location: autoregistration.php');
exit();
}
 
# Edition etat pays
if(isset($_POST['country_select'])){
$country=utf8_decode($_POST['country_select']);
exec("sudo $script --change_country ".escapeshellarg($country));
exec("sudo $script --change_country_filter advance");
header('Location: autoregistration.php');
exit();
}
if(isset($_POST['b_france_enable'])){
exec("sudo $script --change_country_dis_all");
exec("sudo $script --change_country France");
exec("sudo $script --change_country_filter fr");
header('Location: autoregistration.php');
exit();
}
if(isset($_POST['b_ue_enable'])){
exec("sudo $script --change_country_dis_all");
$array_ue = array("Allemagne","Autriche","Belgique","Bulgarie","Chypre","Croatie","Danemark","Espagne","Estonie","Finlande","France","Grece","Hongrie","Irlande","Italie","Lettonie","Lituanie","Luxembourg","Malte","Pays-Bas"," Pologne","Portugal","Republique Tcheque","Roumanie","Angleterre","Slovaquie","Slovenie","Suede");
foreach ($array_ue as $pays){
exec("sudo $script --change_country ".escapeshellarg($pays));
}
exec("sudo $script --change_country_filter ue");
header('Location: autoregistration.php');
exit();
}
if(isset($_POST["b_country_enable"])){
exec("sudo $script --change_country_ena_all");
exec("sudo $script --change_country_filter all");
header('Location: autoregistration.php');
exit();
}
if(isset($_POST["b_country_disable"])){
exec("sudo $script --change_country_dis_all");
header('Location: autoregistration.php');
exit();
}
 
echo ' <td>'.$l_key_enable_1;
echo '<br>'.$l_key_enable_2.'<b>';
reset ($openned_ports);
while ( list(,$row) = each($openned_ports))
{
echo $row." ";
}
echo '</b></td>';
}
else
{
echo "<td>$l_key_diseable</td>";
}
?>
</tr>
</table>
</center>
<br>
<?php
 
if ($find_key=="true")
{
#Nom du fichier de log lorsque gammu est démarré
#$file_log = "gammu-smsd.log";
 
#Recuperation de la vitesse de connexion
$current_speed = exec("sudo $script --connect");
 
#Recuperation du code PIN actuel
$current_pin = exec("sudo $script --pin");
#Recuperation du nombre de try avant le ban perm
$current_try_ban = exec("sudo $script --try_ban");
 
#Recuperation de la durée d'une session créée
$current_time_account = exec("sudo $script --time_account");
 
#Recuperation de la durée dun ban perm (après flood)
$current_time_perm = exec("sudo $script --time_perm");
 
#Detection neméro de tel
$current_num_alcasar = exec("sudo $script --numero_alcasar");
#Detection problème avec la SIM
$current_simfail = exec("sudo $script --last_nosim");
 
#Recuperation de la dernière ligne de START
$current_last_start = exec("sudo $script --last_start");
 
#Recuperarion de la dernière ligne de STOP
$current_last_stop = exec("sudo $script --last_stop");
 
#Recuperation de la dernière ligne de SECURITYERROR
$current_last_secu = exec("sudo $script --last_secu");
 
#Recuperation de la dernière ligne de DEVICEWRITEERROR
$current_last_write = exec("sudo $script --last_writeerror");
 
#Recuperation de la dernière ligne de TIMEOUT
$current_last_timeout = exec("sudo $script --last_timeout");
# Test si le service est lancé
if ($gammu_pid=="")
{
$force_signal = "-";
$imei_device = "-";
$sms_received = "-";
 
$gammu="<td><img src=\"/images/state_error.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ko."\"></td><td>$l_gammu_off</td>";
$gammu_status_on="";
$gammu_status_off="disabled";
 
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu < $current_last_stop))
{
$gammu_simsecu="<tr><td colspan=7><font color=red>$l_error_simsecu_l</font></td></tr>";
}
}
} else {
# Recuperation de la force du signal et IMEI et nombre de sms reçu
$val_force_signal = exec("sudo $script --signal_device");
$imei_device = exec("sudo $script --imei_device");
$sms_received = exec("sudo $script --sms_received");
 
if ($val_force_signal < 21) {
$force_signal = "<img src=\"/images/signal_0.png\"> -- ".$val_force_signal." %";
} elseif ($val_force_signal < 41) {
$force_signal = "<img src=\"/images/signal_20.png\"> -- ".$val_force_signal." %";
 
} elseif ($val_force_signal < 61) {
$force_signal = "<img src=\"/images/signal_40.png\"> -- ".$val_force_signal." %";
 
} elseif ($val_force_signal < 81) {
$force_signal = "<img src=\"/images/signal_60.png\"> -- ".$val_force_signal." %";
 
} elseif ($val_force_signal < 101) {
$force_signal = "<img src=\"/images/signal_80.png\"> -- ".$val_force_signal." %";
 
}
$gammu="<td><img src=\"/images/state_ok.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ok."\"></td><td>$l_gammu_on</td>";
if ($listen_on_right_port != "true"){
$gammu_wrong_port="<tr><td colspan=7><font color=red>$l_error_wrong_port</font></td></tr>";
}
if($current_last_timeout!=""){
if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop))
{
$gammu_timeout="<tr><td colspan=7><font color=red>$l_error_timeoutfail</font></td></tr>";
}
}
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
if($current_last_write!=""){
if(($current_last_write > $current_last_start) && ($current_last_write > $current_last_stop))
{
$gammu_writeerror="<tr><td colspan=7><font color=red>$l_error_writefail</font></td></tr>";
}
}
if($current_simfail!="")
{
if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop))
{
$gammu_simfail="<tr><td colspan=7><font color=red>$l_error_simfail</font></td></tr>";
}
}
$gammu_status_on="disabled";
$gammu_status_off="";
}
 
echo "<form action=\"autoregistration.php\" method=\"post\">
<table border=1>
<tr>
<td colspan=3><b>$l_conf</b></td>
<td><b>$l_conf_actu</b></td>
</tr>
<tr>
<td> $l_connect_port </td><td><select name=\"port\">'";
reset ($openned_ports);
while ( list(,$row) = each($openned_ports))
{
echo '<option value="'.$row.'"';;if ("$row" == "$gammu_smsd_port") echo " selected";echo '>'.$row.'</option>';
echo $row." ";
}
echo "</select></td>
<td><button type=\"submit\" name=\"b_port\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"green\">$gammu_smsd_port</font></center></td>
</tr>
<td> $l_speed </td><td>
<select name=\"speed\">
<option value=\"at\"";if ($current_speed == "at") echo " selected";echo ">Auto</option>
<option value=\"9600\"";if ($current_speed == "at9600") echo " selected"; echo ">9600 Bauds</option>
<option value=\"19200\"";if ($current_speed == "at19200") echo " selected"; echo ">19200 Bauds</option>
<option value=\"115200\"";if ($current_speed == "at115200") echo " selected";echo ">115200 Bauds</option>
</select>
<td><button type=\"submit\" name=\"b_speed\">$l_edit</button></td>
<td><center><font color=\"green\">".str_replace("at","",$current_speed);if ($current_speed == "at"){ echo "Auto"; } else { echo " Bauds";}echo "</font></center></td>
<tr>
<tr>
<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td>
<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"green\">$current_num_alcasar</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr>
<tr>
<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td>
<td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"green\">$current_pin</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr>
<tr>
<td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td>
<td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"blue\">$current_time_account</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr>
<tr>
<td> $l_ban_temp </td><td><input type=text name='nb_essais'></td>
<td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"orange\">$current_try_ban</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr>
<tr>
<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td>
<td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"orange\">$current_time_perm</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr>
</table>
<br>
<table border=1>
<tr>
<td colspan=4><b>$l_status_gammu</b></td>
<td><b><center>$l_force_signal</center></b></td>
<td><b><center>$l_imei_device</center></b></td>
<td><b><center>$l_sms_received</center></b></td>
</tr>
<tr>
$gammu
<td><button type=\"submit\" name=\"start\" $gammu_status_on>$l_start</button></td>
<td><button type=\"submit\" name=\"stop\" $gammu_status_off>$l_stop</button></td>
<td><center>$force_signal</center></td>
<td><center>$imei_device</center></td>
<td><center>$sms_received</center></td>
</tr>
$gammu_wrong_port
$gammu_puk
$gammu_simfail
$gammu_simsecu
$gammu_timeout
$gammu_writeerror
</table>
</form>";
require('/etc/freeradius-web/config.php');
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
else{
echo "<b>Could not include SQL library</b>\n";
exit();
}
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
if(mysqli_connect_errno())
{
echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
}
 
# Country table
?>
 
<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
<span class="showhide-but_country"><?php echo "<strong>$l_country_filtering</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
 
<div class="showhide-div_country">
<br />
<table width=100% style="background: #BDBDBD;">
<tr>
<?php
$result_country_filter = mysqli_query($con, "SELECT id FROM SMS_country WHERE name = 'FILTRAGE'");
$row = mysqli_fetch_array($result_country_filter);
 
if($row['id'] == "advance") {
$country_filter = $l_country_advanced_ena;
} elseif($row['id'] == "ue") {
$country_filter = $l_country_ue_ena;
} elseif($row['id'] == "fr") {
$country_filter = $l_country_france_ena;
} elseif($row['id'] == "all") {
$country_filter = $l_country_all_ena;
} else {
$country_filter = "Err.";
}
?>
<td colspan="3" align="center"><strong><?php echo $l_country_filter; ?></strong><font size="3" color="red"><?php echo $country_filter; ?></font></td>
</tr>
<tr>
<form action="autoregistration.php" method="post">
<td align="center" width=33%><button type="submit" name="b_france_enable"><?php echo "$l_country_france_ena" ?></button></td>
<td align="center" width=34%><button type="submit" name="b_ue_enable"><?php echo "$l_country_ue_ena" ?></button></td>
<td align="center" width=33%><button type="submit" name="b_country_enable"><?php echo "$l_country_all_ena" ?></button></td>
</form>
</tr>
</table>
<div style="border-radius: 5px; background: #D8D8D8; margin: 15px;">
<span class="showhide-but_country_plus"><?php echo "<strong>$l_country_filtering_plus</strong>" ?> <img src="/images/down2.gif" width="15" height="15"></span>
<div class="showhide-div_country_plus">
<table id="table_country" class="display">
<thead>
<tr>
<th><b><font color="black">Pays</font></b></th>
<th><b><font color="black">code</font></b></th>
<th><b><font color="black">Etat</font></b></th>
</tr>
</thead>
<tbody>
<?php
 
$result_country = mysqli_query($con, "SELECT * FROM SMS_country WHERE name != 'FILTRAGE'");
while($row = mysqli_fetch_array($result_country))
{
echo "
<tr>
<form action=\"autoregistration.php\" method=\"post\">
<td>
<input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\">
".$row['name']."
</td>
<td>".$row['id']."</td>
";
if($row['status']=='0')
{
echo "<td><input type='image' src=\"/images/state_error.gif\" width=\"15\" height=\"15\"></td>";
}
if($row['status']=='1')
{
echo "<td><input type='image' src=\"/images/state_ok.gif\" width=\"15\" height=\"15\"></td>";
}
echo " </form>
</tr>
";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm");
 
?>
 
<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
<span class="showhide-but_ban"><?php echo "<strong>$l_phone_ban</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
 
<div class="showhide-div_ban">
<table id="table_id" class="display">
<thead>
<tr>
<th><b><font color="black"><?php echo $l_num_num; ?></font></b></th>
<th><b><font color="black"><?php echo $l_num_raison; ?></font></b></th>
<th><b><font color="black"><?php echo $l_num_expiration; ?></font></b></th>
<th><b><font color="black">Action</font></b></th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($result))
{
echo "
<tr>
<form action=\"autoregistration.php\" method=\"post\">
<td>
<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">
".$row['SenderNumber']."
</td>";
if($row['Perm']=='0')
{
echo "<td>$l_num_exist</td>";
}
if($row['Perm']=='1')
{
echo "<td>$l_num_flood</td>";
}
echo " <td>" . $row['Expiration']. "</td>
<td>
<input type='submit' value='".$l_num_unlock."'>
</td>
</form>
</tr>
";
}
?>
</tbody>
</table>
</div>
</div>
<?php
mysqli_close($con);
}
?>
</html>
/web/acc/menu.php
73,7 → 73,6
$l_whitelist = "Liste blanche";
$l_network = "Réseau";
$l_ldap = "LDAP/A.D.";
$l_mail = "Mail";
$l_access_nb = "Nb d'accès à l'ACC";
$l_create_user = "Créer des utilisateurs";
$l_edit_user = "Gérer les utilisateurs";
88,7 → 87,8
$l_stat_detail_network = "Trafic détaillé";
$l_security = "Sécurité";
$l_menu = "Menu";
$l_gammu = "Auto enregistrement (SMS)";
$l_sms = "Utilisateurs par SMS";
$l_mail = "Utilisateurs par e-mail";
$l_backup_archive = "Archives";
$l_accountability_logs = "Journaux d'imputabilité";
$l_since = "depuis le :";
105,7 → 105,6
$l_whitelist = "Lista Blanca";
$l_network = "Red";
$l_ldap = "LDAP/A.D.";
$l_mail = "Mail";
$l_access_nb = "Registros de accesos ACC";
$l_create_user = "Crear usuarios";
$l_edit_user = "Administrar usuarios";
120,7 → 119,8
$l_stat_detail_network = "Tráfico detallado";
$l_security = "Seguridad";
$l_menu = "Principal";
$l_gammu = "Auto-registro (SMS)";
$l_sms = "usuarios por sms";
$l_mail = "usuarios por e-mail";
$l_backup_archive = "Archivos";
$l_accountability_logs = "registros de responsabilidad";
$l_since = "desde: ";
138,7 → 138,6
$l_whitelist = "Whitelist";
$l_network = "Network";
$l_ldap = "LDAP/A.D.";
$l_mail = "Mail";
$l_access_nb = "ACC access Nbr";
$l_create_user = "Create users";
$l_edit_user = "Manage users";
153,7 → 152,8
$l_stat_detail_network = "Detailed traffic";
$l_security = "Security";
$l_menu = "Main";
$l_gammu = "Auto registration (SMS)";
$l_sms = "Users by SMS";
$l_mail = "Users by e-mail";
$l_backup_archive = "Archives";
$l_accountability_logs = "accountability logs";
$l_since = "since:";
204,7 → 204,6
<li><div class="caret"></div><a href="admin/network.php" target="REXY2"><?= $l_network ?></a></li>
<li><div class="caret"></div><a href="admin/services.php" target="REXY2">Services</a></li>
<li><div class="caret"></div><a href="admin/ldap.php" target="REXY2"><?= $l_ldap ?></a></li>
<li><div class="caret"></div><a href="admin/mail.php" target="REXY2"><?= $l_mail ?></a></li>
</ul>
</li>
<?php endif; ?>
219,7 → 218,10
<li><div class="caret"></div><a href="manager/htdocs/show_groups.php" target="REXY2"><?= $l_edit_group ?></a></li>
<li><div class="caret"></div><a href="manager/htdocs/import_user.php" target="REXY2"><?= $l_import_empty ?></a></li>
<li><div class="caret"></div><a href="manager/auth_exceptions.php" target="REXY2">Exceptions</a></li>
<li><div class="caret"></div><a href="manager/htdocs/autoregistration.php" target="REXY2"><?= $l_gammu ?></a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_sms.php" target="REXY2"><?= $l_sms ?></a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_email.php" target="REXY2"><?= $l_mail ?></a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_email_V2.php" target="REXY2"> mail-V2 </a></li>
 
</ul>
</li>
<?php endif; ?>