Premier commit : publication du logiciel "EvoAdmin", interface web pour gérer les packs Evolix Mail et/ou Samba
This commit is contained in:
commit
d16f85f071
0
evoadmin/AUTHOR
Normal file
0
evoadmin/AUTHOR
Normal file
10
evoadmin/INSTALL
Normal file
10
evoadmin/INSTALL
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
cp evoadmin.sh /usr/share/scripts/
|
||||||
|
chmod +x evoadmin.sh
|
||||||
|
visudo
|
||||||
|
|
||||||
|
User_Alias WWW = www-data
|
||||||
|
Cmnd_Alias EVOAUTH = /usr/share/scripts/evoadmin.sh
|
||||||
|
WWW ALL= NOPASSWD: EVOAUTH
|
||||||
|
|
||||||
|
apt-get install php5-mhash
|
||||||
|
|
0
evoadmin/LICENSE
Normal file
0
evoadmin/LICENSE
Normal file
0
evoadmin/README
Normal file
0
evoadmin/README
Normal file
12
evoadmin/TODO
Normal file
12
evoadmin/TODO
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
- Gestion des comptes avec un nom identique
|
||||||
|
- Gerer les erreurs si le compte existe deja
|
||||||
|
- Gerer les quotas
|
||||||
|
- Gerer les entrees accentuees en latin1 et utf8
|
||||||
|
- Gerer les hooks pour insertions (par exemple, ldap spamassassin)
|
||||||
|
- Gerer la detection de logins differents (login,login2,login3, etc.)
|
||||||
|
lors d'une utilisation mutualisee non-virtuelle...
|
||||||
|
|
||||||
|
- Dans le cas du mode virtuel, il y a un bug avec maildrop: qui est optionnel... mais dans le code
|
||||||
|
il doit toujours en avoir un ! Du coup, à corriger (attention la conf Postfix doit aussi etre
|
||||||
|
correcte pour gerer les entrees contenant virtualaliases+virtualmailboxes)... ou désactiver la possibilité
|
||||||
|
de positionner des maildrop dans le cas du mode virtuel
|
100
evoadmin/docs/inc/evoadmin.sh
Normal file
100
evoadmin/docs/inc/evoadmin.sh
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PASSWORD='xxx'
|
||||||
|
DATE=$(date +"%d-%m-%Y")
|
||||||
|
|
||||||
|
while getopts "p:qu:g:sad" option ; do
|
||||||
|
case $option in
|
||||||
|
|
||||||
|
p)
|
||||||
|
READPASS=$OPTARG
|
||||||
|
;;
|
||||||
|
|
||||||
|
q)
|
||||||
|
QUOTA='on'
|
||||||
|
;;
|
||||||
|
|
||||||
|
u)
|
||||||
|
USERIS=$OPTARG
|
||||||
|
;;
|
||||||
|
|
||||||
|
g)
|
||||||
|
GROUPIS=$OPTARG
|
||||||
|
;;
|
||||||
|
|
||||||
|
s)
|
||||||
|
SIZE='on'
|
||||||
|
;;
|
||||||
|
|
||||||
|
a)
|
||||||
|
ADD='on'
|
||||||
|
;;
|
||||||
|
|
||||||
|
d)
|
||||||
|
DEL='on'
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "script error"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$PASSWORD" != "$READPASS" ]; then
|
||||||
|
echo "Invalid password"
|
||||||
|
echo "Use -p <password>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$QUOTA" == "on" ]; then
|
||||||
|
if [ -n "$USERIS" ]; then
|
||||||
|
NOW=`LANG=C quota $USERIS | tr -d "\n" | sed -e "s/^.*\/dev\///" | tr -s " " | cut -d" " -f2`
|
||||||
|
LIMIT=`LANG=C quota $USERIS | tr -d "\n" | sed -e "s/^.*\/dev\///" | tr -s " " | cut -d" " -f3`
|
||||||
|
echo "$NOW/$LIMIT"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$GROUPIS" ]; then
|
||||||
|
# no quota
|
||||||
|
if LANG=C quota -g $GROUPIS | grep none > /dev/null; then
|
||||||
|
echo "0/0"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
NOW=`LANG=C quota -g $GROUPIS | tr -d "\n" | sed -e "s/^.*\/dev\///" | tr -s " " | cut -d" " -f2`
|
||||||
|
LIMIT=`LANG=C quota -g $GROUPIS | tr -d "\n" | sed -e "s/^.*\/dev\///" | tr -s " " | cut -d" " -f3`
|
||||||
|
echo "$NOW/$LIMIT"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SIZE" == "on" ]; then
|
||||||
|
NOW=`df | grep "/home" | tr -s " " | cut -d " " -f3`
|
||||||
|
LIMIT=`df | grep "/home" | tr -s " " | cut -d " " -f2`
|
||||||
|
echo "$NOW/$LIMIT"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ADD" == "on" ]; then
|
||||||
|
if [[ -n $USERIS && $GROUPIS && ! -e "/home/$USERIS" ]]; then
|
||||||
|
mkdir /home/$USERIS
|
||||||
|
chmod 0700 /home/$USERIS
|
||||||
|
chown "$USERIS:$GROUPIS" /home/$USERIS
|
||||||
|
setquota -u $USERIS 5000000 8000000 0 0 -a
|
||||||
|
echo "Mail d'initialisation du compte." |\
|
||||||
|
mail -s "Premier message" $USERIS@localhost
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$DEL" == "on" ]; then
|
||||||
|
if [[ -n $USERIS && -e "/home/$USERIS" ]]; then
|
||||||
|
mv /home/$USERIS /home/$USERIS.$DATE
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
|
1
evoadmin/htdocs/.svnignore
Normal file
1
evoadmin/htdocs/.svnignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
connect.php
|
199
evoadmin/htdocs/admin.php
Executable file
199
evoadmin/htdocs/admin.php
Executable file
|
@ -0,0 +1,199 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listing of all account/aliases
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2005 Evolix - Tous droits reserves
|
||||||
|
* $Id: admin.php,v 1.13 2009-09-02 17:22:13 gcolpart Exp $
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show account/alias details
|
||||||
|
* @param string $compte
|
||||||
|
* @param string $type
|
||||||
|
* @return NULL
|
||||||
|
*/
|
||||||
|
function show_my_details($name,$type) {
|
||||||
|
|
||||||
|
print '<tr><td><a href="' .$type. '.php?view='
|
||||||
|
.$name. '">' .$name. '</a></td>';
|
||||||
|
|
||||||
|
if ( $type == 'compte' ) {
|
||||||
|
print '<td>' .getquota($name,'user'). '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print '<a href="' .$type. '.php?del=' .$name. '">
|
||||||
|
<img src="inc/suppr.png" /></a>';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path
|
||||||
|
*/
|
||||||
|
define('EVOADMIN_BASE','./');
|
||||||
|
|
||||||
|
//recuperer la session en cours
|
||||||
|
session_name('EVOADMIN_SESS');
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// TODO : restrictions if non superadmin
|
||||||
|
|
||||||
|
if (isset($_SESSION['login'])) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires
|
||||||
|
*/
|
||||||
|
require_once EVOADMIN_BASE . 'common.php';
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'haut.php';
|
||||||
|
|
||||||
|
$login = $_SESSION['login'];
|
||||||
|
|
||||||
|
if (isset($_GET['domain'])) {
|
||||||
|
// TODO : verifier si le domaine existe !!
|
||||||
|
$_SESSION['domain'] = Html::clean($_GET['domain']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : verifier que le domaine est actif
|
||||||
|
// et que les droits sont corrects
|
||||||
|
$domain = $_SESSION['domain'];
|
||||||
|
|
||||||
|
// RDN for all LDAP search
|
||||||
|
if (! $conf['domaines']['onlyone']) {
|
||||||
|
|
||||||
|
// compatibilite anciens schemas
|
||||||
|
if ($conf['evoadmin']['version'] <= 2) {
|
||||||
|
$rdn= "domain=" .$domain. "," .LDAP_BASE;
|
||||||
|
} else {
|
||||||
|
$rdn= "cn=" .$domain. "," .LDAP_BASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$rdn= "ou=people," .LDAP_BASE;
|
||||||
|
}
|
||||||
|
$_SESSION['rdn'] = $rdn;
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'debut.php';
|
||||||
|
|
||||||
|
// tableau contenant tous les comptes
|
||||||
|
$comptes = array();
|
||||||
|
// tableau contenant tous les alias
|
||||||
|
$aliases = array();
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
|
||||||
|
$filter="(objectClass=mailAccount)";
|
||||||
|
$sr=ldap_search($ldapconn, $rdn, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
// We use uid attribute for account
|
||||||
|
for ($i=0;$i<$info["count"];$i++) {
|
||||||
|
array_push($comptes,$info[$i]["uid"][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We use cn attribute for alias
|
||||||
|
$filter="(objectClass=mailAlias)";
|
||||||
|
// compatibilite anciens schemas
|
||||||
|
if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
$filter="(&(objectClass=mailAlias)(onlyAlias=TRUE))";
|
||||||
|
}
|
||||||
|
$sr=ldap_search($ldapconn, $rdn, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
for ($i=0;$i<$info["count"];$i++) {
|
||||||
|
array_push($aliases,$info[$i]["cn"][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ldap_unbind($ldapconn);
|
||||||
|
|
||||||
|
//tri alphanumeriques des tableaux
|
||||||
|
sort($comptes);
|
||||||
|
sort($aliases);
|
||||||
|
?>
|
||||||
|
<center>
|
||||||
|
|
||||||
|
<a href="compte.php">Ajouter un nouveau compte</a><br />
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// only for mail mode
|
||||||
|
if (($conf['admin']['what'] == 1) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
$viewonly1= ( (isset($_POST['viewonly'])) && ($_POST['viewonly']==2) ) ? "" : "selected='selected'";
|
||||||
|
$viewonly2= ( (isset($_POST['viewonly'])) && ($_POST['viewonly']==2) ) ? "selected='selected'" : "";
|
||||||
|
?>
|
||||||
|
|
||||||
|
<a href="alias.php">Ajouter un nouvel alias/groupe de diffusion</a><br /><br />
|
||||||
|
<form class='center' action='<?php print $_SERVER['PHP_SELF'];?>'
|
||||||
|
method='POST' name='listing'>
|
||||||
|
|
||||||
|
<select name='viewonly' onchange="document.listing.submit()">
|
||||||
|
<option value='1' <?php print $viewonly1; ?>>Liste des comptes</option>
|
||||||
|
<option value='2' <?php print $viewonly2; ?>>Liste des alias/groupe de diffusion</option>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!isset($_POST['viewonly'])) || ($_POST['viewonly']==1) ) {
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h3>Liste des comptes :</h3>
|
||||||
|
|
||||||
|
<table width="500px" bgcolor="#ddd" border="1">
|
||||||
|
<tr>
|
||||||
|
<td><strong>Nom du compte</strong></td>
|
||||||
|
<td>Quota</td>
|
||||||
|
<td width="50px">Suppr</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach ($comptes as $compte) {
|
||||||
|
show_my_details($compte,'compte');
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
} elseif ( (isset($_POST['viewonly'])) && ($_POST['viewonly']==2) ) {
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h3>Liste des alias/groupe de diffusion :</h3>
|
||||||
|
|
||||||
|
<table width="500px" bgcolor="#ddd" border="1">
|
||||||
|
<tr>
|
||||||
|
<td><strong>Nom de l'alias/groupe de diffusion</strong></td>
|
||||||
|
<td width="50px">Suppr</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
foreach ($aliases as $alias) {
|
||||||
|
show_my_details($alias,'alias');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} else { //if (isset($_SESSION['login']))
|
||||||
|
header("location: auth.php\n\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'fin.php';
|
||||||
|
|
||||||
|
?>
|
476
evoadmin/htdocs/alias.php
Executable file
476
evoadmin/htdocs/alias.php
Executable file
|
@ -0,0 +1,476 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add/Modify an alias
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: alias.php,v 1.12 2009-02-18 23:19:29 gcolpart Exp $
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path
|
||||||
|
*/
|
||||||
|
define('EVOADMIN_BASE','./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP cookies session
|
||||||
|
*/
|
||||||
|
session_name('EVOADMIN_SESS');
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (isset($_SESSION['login']))
|
||||||
|
{
|
||||||
|
require_once EVOADMIN_BASE . 'common.php';
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'haut.php';
|
||||||
|
|
||||||
|
$login = $_SESSION['login'];
|
||||||
|
$rdn = $_SESSION['rdn'];
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'debut.php';
|
||||||
|
|
||||||
|
if (isset($_GET['view'])) {
|
||||||
|
|
||||||
|
$cn = Html::clean($_GET['view']);
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
|
||||||
|
$filter="(cn=$cn)";
|
||||||
|
$sr=ldap_search($ldapconn, $rdn, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
if ( (isset($_GET['modif'])) && ($_GET['modif'] == 'yes')) {
|
||||||
|
|
||||||
|
print "<center>";
|
||||||
|
print "<p>Modification en cours...</p>";
|
||||||
|
|
||||||
|
// on obtient une table avec les nouveaux champs mailacceptinggeneralid
|
||||||
|
// TODO : if onlyone = false, verifier le domaine !!
|
||||||
|
$count = array_shift($info[0]["mailacceptinggeneralid"]);
|
||||||
|
|
||||||
|
// in multi-domains mode, we force @domain
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
// add @domain for each element
|
||||||
|
array_walk($_POST['mailaccept'],'adddomain');
|
||||||
|
}
|
||||||
|
|
||||||
|
$newmailaccept[0] = array_pop($_POST['mailaccept']);
|
||||||
|
$newmailaccept[1] = array_pop($_POST['mailaccept']);
|
||||||
|
$newmailaccept[2] = array_pop($_POST['mailaccept']);
|
||||||
|
if ( ($newmailaccept[0] != NULL) || ($newmailaccept[1] != NULL) ||
|
||||||
|
($newmailaccept[2] != NULL) ||
|
||||||
|
array_diff($info[0]["mailacceptinggeneralid"],$_POST['mailaccept']) ) {
|
||||||
|
$new["mailacceptinggeneralid"] = $_POST['mailaccept'];
|
||||||
|
$new["mailacceptinggeneralid"][$count]= $newmailaccept[0];
|
||||||
|
$new["mailacceptinggeneralid"][$count+1]= $newmailaccept[1];
|
||||||
|
$new["mailacceptinggeneralid"][$count+2]= $newmailaccept[2];
|
||||||
|
|
||||||
|
// on vire les valeurs nulles
|
||||||
|
sort($new["mailacceptinggeneralid"]);
|
||||||
|
while ( $new["mailacceptinggeneralid"][0] == NULL ) {
|
||||||
|
array_shift($new["mailacceptinggeneralid"]);
|
||||||
|
|
||||||
|
// on evite une boucle infinie
|
||||||
|
if ( count($new["mailacceptinggeneralid"]) == 0 ) {
|
||||||
|
print "Erreur, vous devez avoir au moins un mail entrant\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// idem avec maildrop
|
||||||
|
$count = array_shift($info[0]["maildrop"]);
|
||||||
|
$newmaildrop[0] = array_pop($_POST['maildrop']);
|
||||||
|
$newmaildrop[1] = array_pop($_POST['maildrop']);
|
||||||
|
$newmaildrop[2] = array_pop($_POST['maildrop']);
|
||||||
|
if ( ($newmaildrop[0] != NULL) | ($newmaildrop[1] != NULL) |
|
||||||
|
($newmaildrop[2] != NULL) |
|
||||||
|
array_diff($info[0]["maildrop"],$_POST['maildrop']) ) {
|
||||||
|
$new["maildrop"] = $_POST['maildrop'];
|
||||||
|
$new["maildrop"][$count]= $newmaildrop[0];
|
||||||
|
$new["maildrop"][$count+1]= $newmaildrop[1];
|
||||||
|
$new["maildrop"][$count+2]= $newmaildrop[2];
|
||||||
|
|
||||||
|
// on vire les valeurs nulles
|
||||||
|
sort($new["maildrop"]);
|
||||||
|
while ( $new["maildrop"][0] == NULL ) {
|
||||||
|
array_shift($new["maildrop"]);
|
||||||
|
|
||||||
|
// on evite une boucle infinie
|
||||||
|
if ( count($new["maildrop"]) == 0 ) {
|
||||||
|
print "Erreur, vous devez avoir au moins une redirection.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$postisactive = (isset($_POST['isactive']) ? 'TRUE' : 'FALSE');
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP
|
||||||
|
//if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
// if ( $info[0]["accountactive"][0] != $postisactive ) {
|
||||||
|
// $new["accountActive"] = $postisactive;
|
||||||
|
// }
|
||||||
|
//} else {
|
||||||
|
if ( $info[0]["isactive"][0] != $postisactive ) {
|
||||||
|
$new["isActive"] = $postisactive;
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
// if $new not null, set modification
|
||||||
|
if ( (isset($new)) && ($new != NULL) ) {
|
||||||
|
$sr=ldap_modify($ldapconn,"cn=" .$cn. ",".$rdn,$new);
|
||||||
|
|
||||||
|
// Si LDAP est content, c'est bon :)
|
||||||
|
if ( $sr ) {
|
||||||
|
print "<p class='strong'>Modifications effectuées.</p>";
|
||||||
|
print "<a href='alias.php?view=$cn'>Voir l'alias modifié</p>";
|
||||||
|
} else {
|
||||||
|
print "<p class='error'>Erreur, envoyez le message d'erreur
|
||||||
|
suivant a votre administrateur :</p>";
|
||||||
|
var_dump($new);
|
||||||
|
Evolog::log("Modify error of $cn by $login");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='strong'>Aucune modification nécessaire.</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$filter="(&(cn=$cn)(objectClass=mailAlias))";
|
||||||
|
$sr=ldap_search($ldapconn, $rdn, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
// On verifie que le compte existe bien
|
||||||
|
if ( $info['count'] != 1 ) {
|
||||||
|
print "<p class='error'>Erreur, alias inexistant</p>";
|
||||||
|
EvoLog::log("alias $cn unknown");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<center>\n";
|
||||||
|
print "<h4>Modification de l'alias $cn</h4>\n";
|
||||||
|
|
||||||
|
print "<form name='add'
|
||||||
|
action='alias.php?view=$cn&modif=yes'
|
||||||
|
method='post'>\n";
|
||||||
|
|
||||||
|
print "<table>\n";
|
||||||
|
|
||||||
|
print "<tr><td colspan='2'>";
|
||||||
|
print "<p class='italic'>Ajoutez/modifiez/supprimez les mails acceptés en entrée).<br />
|
||||||
|
Un minimum d'un mail est requis. Mêmes instructions<br />
|
||||||
|
pour les redirections (compte(s) dans le(s)quel(s) est/sont délivré(s) les mails).
|
||||||
|
</p>";
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
// compteur pour les tabindex
|
||||||
|
$tab=1;
|
||||||
|
|
||||||
|
for ($i=0;$i<$info[0]["mailacceptinggeneralid"]['count'];$i++) {
|
||||||
|
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
$info[0]['mailacceptinggeneralid'][$i] =
|
||||||
|
ereg_replace('@'.$_SESSION['domain'],'',$info[0]['mailacceptinggeneralid'][$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Mail accepté en entrée :</td>
|
||||||
|
<td align='left'><input type='text' name='mailaccept[$i]' tabindex='" .$tab++. "'
|
||||||
|
size='30' value='".$info[0]['mailacceptinggeneralid'][$i]."' />\n";
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Création d'un nouveau mail accepté en entrée :</td>
|
||||||
|
<td align='left'><input type='text' name='mailaccept[" .$i++. "]'
|
||||||
|
size='30' tabindex='" .$tab++. "' />\n";
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Création d'un nouveau mail accepté en entrée :</td>
|
||||||
|
<td align='left'><input type='text' name='mailaccept[" .$i++. "]'
|
||||||
|
size='30' tabindex='" .$tab++. "' />\n";
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Création d'un nouveau mail accepté en entrée :</td>
|
||||||
|
<td align='left'><input type='text' name='mailaccept[" .$i++. "]'
|
||||||
|
size='30' tabindex='" .$tab++. "' />\n";
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
|
||||||
|
for ($i=0;$i<$info[0]["maildrop"]['count'];$i++) {
|
||||||
|
print "<tr><td align='right'>Mails entrants redirigés vers :</td>
|
||||||
|
<td align='left'><input type='text' name='maildrop[$i]'
|
||||||
|
size='30' value='" .$info[0]['maildrop'][$i]. "' tabindex='" .$tab++. "' />
|
||||||
|
</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Nouvelle redirection vers :</td>
|
||||||
|
<td align='left'><input type='text' name='maildrop[" .$i++. "]'
|
||||||
|
size='30' tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
print "<tr><td align='right'>Nouvelle redirection vers :</td>
|
||||||
|
<td align='left'><input type='text' name='maildrop[" .$i++. "]'
|
||||||
|
size='30' tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
print "<tr><td align='right'>Nouvelle redirection vers :</td>
|
||||||
|
<td align='left'><input type='text' name='maildrop[" .$i++. "]'
|
||||||
|
size='30' tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
|
||||||
|
print "<tr><td colspan='2'>";
|
||||||
|
print "<p class='italic'>Activer/désactiver l'alias</p>";
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP
|
||||||
|
//if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
// $isactive= ($info[0]["accountactive"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
//} else {
|
||||||
|
$isactive= ($info[0]["isactive"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
//}
|
||||||
|
print "<tr><td align='right'>Alias actif :</td>
|
||||||
|
<td align='left'><input type='checkbox' name='isactive'
|
||||||
|
$isactive tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
|
||||||
|
print "<tr><td> ,</td><td align='left'>";
|
||||||
|
print "<p><input type='submit' class='button'
|
||||||
|
value='Valider' name='valider' tabindex='" .$tab++. "' /></p>\n";
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
print "</table>\n";
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif ( isset($_GET['del']) ) {
|
||||||
|
|
||||||
|
$cn = Html::clean($_GET['del']);
|
||||||
|
|
||||||
|
if ( (isset($_GET['modif'])) && ($_GET['modif'] == 'yes')) {
|
||||||
|
|
||||||
|
print "<center>";
|
||||||
|
|
||||||
|
print "<p>Suppression $cn en cours...</p>";
|
||||||
|
|
||||||
|
// TODO : Verifier que l'objet existe avant sa suppression
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$sr = Ldap::lda_del($ldapconn,"cn=" .$cn. "," .$rdn);
|
||||||
|
|
||||||
|
if ( $sr ) {
|
||||||
|
|
||||||
|
print "<p class='strong'>Suppression $cn effectuée.</p>";
|
||||||
|
|
||||||
|
EvoLog::log("Del alias ".$cn);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='error>Erreur, suppression non effectuée.</p>";
|
||||||
|
EvoLog::log("Delete $cn failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<center>";
|
||||||
|
print "<p>Vous allez effacer l'alias <b>$cn</b>...<br />";
|
||||||
|
print "<a href='alias.php?del=$cn&modif=yes'>Confirmer la suppression</a>";
|
||||||
|
print "</center>";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if ( (isset($_GET['modif'])) && ($_GET['modif'] == 'yes')) {
|
||||||
|
|
||||||
|
$cn = Html::clean(Html::purgeaccents(utf8_decode($_POST['cn'])));
|
||||||
|
|
||||||
|
$aliases = $_POST['alias'];
|
||||||
|
|
||||||
|
// in multi-domains mode, we force @domain
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
// add @domain for each element
|
||||||
|
array_walk($aliases,'adddomain');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maildrop = $_POST['maildrop'];
|
||||||
|
|
||||||
|
print '<center>';
|
||||||
|
print "<p>Ajout en cours</p>";
|
||||||
|
|
||||||
|
// on vire les valeurs nulles
|
||||||
|
sort($aliases);
|
||||||
|
sort($maildrop);
|
||||||
|
// TODO : if driver = ldap, verifier le domaine !!
|
||||||
|
while ( $aliases[0] == NULL ) {
|
||||||
|
array_shift($aliases);
|
||||||
|
|
||||||
|
// on evite une boucle infinie
|
||||||
|
if ( count($aliases) == 0 ) {
|
||||||
|
print "Erreur, vous devez avoir au moins un alias.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while ( $maildrop[0] == NULL ) {
|
||||||
|
array_shift($maildrop);
|
||||||
|
|
||||||
|
// on evite une boucle infinie
|
||||||
|
if ( count($maildrop) == 0 ) {
|
||||||
|
print "Erreur, vous devez avoir au moins une redirection.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$info["cn"]=$cn;
|
||||||
|
$info["objectclass"][0] = "mailAlias";
|
||||||
|
$info["isActive"] = ($_POST['isactive']) ? "TRUE" : "FALSE";
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP
|
||||||
|
if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
$info["objectclass"][1] = "inetOrgPerson";
|
||||||
|
$info["onlyAlias"] = "TRUE";
|
||||||
|
$info["sn"]=$cn;
|
||||||
|
//$info["accountActive"] = ($_POST['isactive']) ? "TRUE" : "FALSE";
|
||||||
|
}
|
||||||
|
|
||||||
|
$info["mailacceptinggeneralid"] = $aliases;
|
||||||
|
$info["maildrop"] = $maildrop;
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$sr=ldap_add($ldapconn,"cn=" .$cn. "," .$rdn, $info);
|
||||||
|
|
||||||
|
// on teste si LDAP est content
|
||||||
|
if ( $sr ) {
|
||||||
|
print "<p class='strong'>Ajout effectué.</p>";
|
||||||
|
print "<a href='alias.php?view=$cn'>Voir l'alias ajouté</p>";
|
||||||
|
EvoLog::log("Add alias ".$cn);
|
||||||
|
} else {
|
||||||
|
print "<p class='error'>Erreur, envoyez le message d'erreur
|
||||||
|
suivant a votre administrateur :</p>";
|
||||||
|
var_dump($info);
|
||||||
|
EvoLog::log("Add alias $cn failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<center>
|
||||||
|
|
||||||
|
<h4>Ajout d'un alias</h4>
|
||||||
|
|
||||||
|
<form name="add"
|
||||||
|
action="alias.php?modif=yes"
|
||||||
|
method="post">
|
||||||
|
|
||||||
|
<p class="italic">Remplissez lez champs.</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
|
||||||
|
<tr><td align="right">Nom (unique) de l'alias :</td>
|
||||||
|
<td align="left"><input type='text' name='cn' tabindex='1' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias :</td>
|
||||||
|
<td align="left"><input type='text' name='alias[0]' tabindex='2' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias :</td>
|
||||||
|
<td align="left"><input type='text' name='alias[1]' tabindex='3' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias :</td>
|
||||||
|
<td align="left"><input type='text' name='alias[2]' tabindex='4' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias :</td>
|
||||||
|
<td align="left"><input type='text' name='alias[3]' tabindex='5' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias :</td>
|
||||||
|
<td align="left"><input type='text' name='alias[4]' tabindex='6' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Redirection :</td>
|
||||||
|
<td align="left"><input type='text' name='maildrop[5]' tabindex='7' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Redirection :</td>
|
||||||
|
<td align="left"><input type='text' name='maildrop[1]' tabindex='8' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Redirection :</td>
|
||||||
|
<td align="left"><input type='text' name='maildrop[2]' tabindex='9' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Redirection :</td>
|
||||||
|
<td align="left"><input type='text' name='maildrop[3]' tabindex='10' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Redirection :</td>
|
||||||
|
<td align="left"><input type='text' name='maildrop[4]' tabindex='11' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2">
|
||||||
|
<p class="italic">Activer/désactiver l'alias</p>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias actif :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='10'
|
||||||
|
name='isactive' checked /></td></tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr><td> </td><td align="left">
|
||||||
|
<p><input type="submit" class="button" tabindex='15'
|
||||||
|
value="Valider" name="valider" /></p>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} //if (isset($_SESSION['login']))
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("location: auth.php\n\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'fin.php';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
169
evoadmin/htdocs/auth.php
Executable file
169
evoadmin/htdocs/auth.php
Executable file
|
@ -0,0 +1,169 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Authentification page
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: auth.php,v 1.5 2008-09-21 03:28:03 gcolpart Exp $
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path
|
||||||
|
*/
|
||||||
|
define('EVOADMIN_BASE','./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires
|
||||||
|
*/
|
||||||
|
require_once EVOADMIN_BASE . 'common.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display message for bad authentification
|
||||||
|
*
|
||||||
|
* @param NULL
|
||||||
|
* @return NULL
|
||||||
|
*/
|
||||||
|
function badauth() {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
display("Échec de l'authentification, utilisateur ou mot de passe incorrect.<br />
|
||||||
|
Si vous avez oublié votre mot de passe, contactez <a href='
|
||||||
|
mailto:" .$conf['admin']['mail']. "'>" .$conf['admin']['mail']. "</a>");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display FORM HTML formular for connexion
|
||||||
|
*
|
||||||
|
* @param NULL
|
||||||
|
* @return NULL
|
||||||
|
*/
|
||||||
|
function Formulaire() {
|
||||||
|
|
||||||
|
?>
|
||||||
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>"
|
||||||
|
method="post" name="auth">
|
||||||
|
|
||||||
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
<td align="right" class="light"><b>Utilisateur</b></td>
|
||||||
|
<td align="left" class="light">
|
||||||
|
<input type="text" tabindex="1" name="login" value="" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right" class="light"><b>Mot de passe</b></td>
|
||||||
|
<td align="left"><input type="password" tabindex="2" name="password" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td align="left" class="light">
|
||||||
|
<input type="submit" class="button" name="loginButton"
|
||||||
|
tabindex="3" value="Connexion" onclick="return submit_login();" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br /><br />
|
||||||
|
<center><a href="/">Webmail</a></center>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// we start PHP output buffering to use HTTP header later
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires and includes
|
||||||
|
*/
|
||||||
|
include EVOADMIN_BASE . 'haut.php';
|
||||||
|
include EVOADMIN_BASE . 'inc/login.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP cookies session
|
||||||
|
* (cookies must be actived on browser)
|
||||||
|
*
|
||||||
|
* 3 steps:
|
||||||
|
* - We use current session (or create new): session_start()
|
||||||
|
* - We destroy current session: session_unset() et session_destroy()
|
||||||
|
* - We create a new (and then empty) session: session_start()
|
||||||
|
*/
|
||||||
|
session_name('EVOADMIN_SESS');
|
||||||
|
session_start();
|
||||||
|
if (isset($_SESSION['login'])) {
|
||||||
|
display("Déconnexion");
|
||||||
|
}
|
||||||
|
session_unset('EVOADMIN_SESS');
|
||||||
|
session_destroy();
|
||||||
|
session_name('EVOADMIN_SESS');
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Case with $_POST data
|
||||||
|
* We try to verify login/password
|
||||||
|
* and we forward to superadmin.php
|
||||||
|
*/
|
||||||
|
if (isset($_POST['login']))
|
||||||
|
{
|
||||||
|
// connexion pour rechercher uid
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
|
||||||
|
if ($ldapconn)
|
||||||
|
{
|
||||||
|
$login = Html::clean($_POST['login']);
|
||||||
|
$filter="(&(uid=" .$login. ")(isAdmin=TRUE))";
|
||||||
|
$sr=ldap_search($ldapconn, LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
if ($info['count'])
|
||||||
|
{
|
||||||
|
$bind = @ldap_bind($ldapconn,$info[0]['dn'],$_POST['password']);
|
||||||
|
if ($bind)
|
||||||
|
{
|
||||||
|
$_SESSION['login'] = $login;
|
||||||
|
$_SESSION['dn'] = $info[0]['dn'];
|
||||||
|
|
||||||
|
EvoLog::log("Login success for " . $login);
|
||||||
|
header("location: superadmin.php\n\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
badauth();
|
||||||
|
EvoLog::log("Password failed : " . $login);
|
||||||
|
Formulaire();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
badauth();
|
||||||
|
EvoLog::log("Login failed : " . $login);
|
||||||
|
Formulaire();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Case with no $_POST data
|
||||||
|
* we display Formular
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
Formulaire();
|
||||||
|
}
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'fin.php';
|
||||||
|
|
||||||
|
ob_end_flush();
|
||||||
|
|
||||||
|
?>
|
72
evoadmin/htdocs/common.php
Executable file
72
evoadmin/htdocs/common.php
Executable file
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2004-2008 Evolix - Tous droits reserves
|
||||||
|
* $Id: common.php,v 1.13 2009-02-21 03:55:15 gcolpart Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* common.php
|
||||||
|
* file included in every PHP file
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Functions
|
||||||
|
*/
|
||||||
|
function test_exist($file) {
|
||||||
|
if(!file_exists($file)) {
|
||||||
|
die("Erreur, vous devez mettre en place le fichier $file !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We verify if 'install/' directory is removed
|
||||||
|
if (file_exists('install')) {
|
||||||
|
die("Erreur 001 : logiciel non installe ou repertoire 'install/' non
|
||||||
|
supprime !");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Includes
|
||||||
|
*/
|
||||||
|
|
||||||
|
// PEAR libs
|
||||||
|
// change include_path for PEAR
|
||||||
|
// http://pear.php.net/manual/en/installation.shared.php
|
||||||
|
//if (!(ini_set('include_path', CONF_PWD . 'pear/' . PATH_SEPARATOR . ini_get('include_path'))))
|
||||||
|
if (!(ini_set('include_path', ini_get('include_path')))) {
|
||||||
|
die('bibliotheques PEAR non presentes');
|
||||||
|
} else {
|
||||||
|
|
||||||
|
require_once 'PEAR.php';
|
||||||
|
require_once 'Log.php';
|
||||||
|
|
||||||
|
// config files
|
||||||
|
// (here because need Log PEAR lib)
|
||||||
|
test_exist('connect.php');
|
||||||
|
require_once('connect.php');
|
||||||
|
test_exist('config/conf.php');
|
||||||
|
require_once('config/conf.php');
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
// only for samba mode
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
require_once 'Crypt/CHAP.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// functions
|
||||||
|
require_once 'inc/functions.php';
|
||||||
|
if ($conf['admin']['use_hook']) {
|
||||||
|
require_once 'inc/hook.php';
|
||||||
|
} else {
|
||||||
|
require_once 'inc/hook-dist.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// evolibs
|
||||||
|
require_once 'evolibs/Ldap.php';
|
||||||
|
require_once 'evolibs/Html.php';
|
||||||
|
require_once 'evolibs/Math.php';
|
||||||
|
require_once 'evolibs/EvoLog.php';
|
||||||
|
require_once 'evolibs/Auth.php';
|
||||||
|
|
916
evoadmin/htdocs/compte.php
Executable file
916
evoadmin/htdocs/compte.php
Executable file
|
@ -0,0 +1,916 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add/Modify an account
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: compte.php,v 1.34 2009-09-02 23:10:52 gcolpart Exp $
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path
|
||||||
|
*/
|
||||||
|
define('EVOADMIN_BASE','./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP cookies session
|
||||||
|
*/
|
||||||
|
session_name('EVOADMIN_SESS');
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($_SESSION['login']))
|
||||||
|
{
|
||||||
|
|
||||||
|
// $login var need for debut.php
|
||||||
|
$login = $_SESSION['login'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires
|
||||||
|
*/
|
||||||
|
require_once EVOADMIN_BASE . 'common.php';
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'haut.php';
|
||||||
|
include EVOADMIN_BASE . 'inc/add.js';
|
||||||
|
include EVOADMIN_BASE . 'debut.php';
|
||||||
|
|
||||||
|
$rdn = $_SESSION['rdn'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account modification
|
||||||
|
*/
|
||||||
|
if (isset($_GET['view'])) {
|
||||||
|
|
||||||
|
$uid = Html::clean($_GET['view']);
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
|
||||||
|
$filter="(uid=$uid)";
|
||||||
|
$sr=ldap_search($ldapconn, $rdn, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
$cn = $info[0]["cn"][0];
|
||||||
|
$sn = $info[0]["sn"][0];
|
||||||
|
$gid = $info[0]["gidnumber"][0];
|
||||||
|
// optional
|
||||||
|
$mail = array_key_exists("mail",$info[0]) ? $info[0]["mail"][0] : '';
|
||||||
|
|
||||||
|
// Cas d'un compte Samba
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
$displayname = $info[0]["displayname"][0];
|
||||||
|
$sambagroup = array_search($gid,getsambagroups('unix'));
|
||||||
|
if (!$sambagroup) {
|
||||||
|
$sambagroup = "!!undefined!!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set account modification
|
||||||
|
*/
|
||||||
|
if ( (isset($_GET['modif'])) && ($_GET['modif'] == 'yes')) {
|
||||||
|
|
||||||
|
print "<center>";
|
||||||
|
print "<p>Modification en cours...</p>";
|
||||||
|
|
||||||
|
// TODO : contraintes sur cn, sn, etc.
|
||||||
|
if ( $cn != Html::clean($_POST['cn']) ) {
|
||||||
|
$new["cn"] = Html::justclean(Html::purgeaccents(utf8_decode($_POST['cn'])));
|
||||||
|
|
||||||
|
if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
$new["sn"] = $new["cn"];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ($conf['evoadmin']['version'] > 1) && (!$conf['domaines']['ldap']['virtual']) && ( $sn != Html::clean($_POST['sn']) ) ) {
|
||||||
|
$new["sn"] = Html::justclean(Html::purgeaccents(utf8_decode($_POST['sn'])));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (!$conf['domaines']['ldap']['virtual']) && ( $mail != Html::clean($_POST['mail']) )) {
|
||||||
|
$new["mail"] = Html::clean($_POST['mail']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $_POST['pass1'] != '' ) {
|
||||||
|
if ( $_POST['pass1'] != $_POST['pass2'] ) {
|
||||||
|
print "<p class='error'>Erreur, vous avez tapé
|
||||||
|
deux mots de passe différents</p>";
|
||||||
|
EvoLog::log("Reinit password failed for $uid by $login");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( Auth::badpassword($_POST['pass1']) ) {
|
||||||
|
print "<p class='error'>Erreur, mot de passe invalide
|
||||||
|
(trop court ou avec des caracteres incorrects)</p>";
|
||||||
|
EvoLog::log("Set password failed for $uid by $login");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$new["userPassword"] = "{SSHA}".Ldap::ssha($_POST['pass1']);
|
||||||
|
|
||||||
|
// Cas d'un compte Samba
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
$new["sambaPwdLastSet"] = strtotime("now");
|
||||||
|
$new["sambaLMPassword"] = Ldap::sambalm($_POST['pass1']);
|
||||||
|
$new["sambaNTPassword"] = Ldap::sambant($_POST['pass1']);
|
||||||
|
$new["shadowLastChange"] = floor(strtotime("now")/(3600*24));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$postisactive = (isset($_POST['isactive']) ? 'TRUE' : 'FALSE');
|
||||||
|
if ( $info[0]["isactive"][0] != $postisactive ) {
|
||||||
|
$new["isActive"] = $postisactive;
|
||||||
|
}
|
||||||
|
|
||||||
|
$postisadmin = (isset($_POST['isadmin']) ? 'TRUE' : 'FALSE');
|
||||||
|
if ( $info[0]["isadmin"][0] != $postisadmin ) {
|
||||||
|
$new["isAdmin"] = $postisadmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only for mail mode
|
||||||
|
if (($conf['admin']['what'] == 1) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
$postaccountactive = (isset($_POST['accountactive']) ? 'TRUE' : 'FALSE');
|
||||||
|
if ( $info[0]["accountactive"][0] != $postaccountactive ) {
|
||||||
|
$new["accountActive"] = $postaccountactive;
|
||||||
|
}
|
||||||
|
|
||||||
|
$postauthsmtpactive = (isset($_POST['authsmtpactive']) ? 'TRUE' : 'FALSE');
|
||||||
|
if ( $info[0]["authsmtpactive"][0] != $postauthsmtpactive ) {
|
||||||
|
$new["authsmtpActive"] = $postauthsmtpactive;
|
||||||
|
}
|
||||||
|
|
||||||
|
$postwebmailactive = (isset($_POST['webmailactive']) ? 'TRUE' : 'FALSE');
|
||||||
|
if ( $info[0]["webmailactive"][0] != $postwebmailactive ) {
|
||||||
|
$new["webmailActive"] = $postwebmailactive;
|
||||||
|
}
|
||||||
|
|
||||||
|
$postcourieractive = (isset($_POST['courieractive']) ? 'TRUE' : 'FALSE');
|
||||||
|
if ( $info[0]["courieractive"][0] != $postcourieractive ) {
|
||||||
|
$new["courierActive"] = $postcourieractive;
|
||||||
|
}
|
||||||
|
|
||||||
|
// on obtient une table avec les nouveaux champs mailacceptinggeneralid
|
||||||
|
// TODO : if driver == ldap, verifier le domaine !!
|
||||||
|
$count = array_shift($info[0]["mailacceptinggeneralid"]);
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP et mode "virtuel"
|
||||||
|
if (($conf['evoadmin']['version'] == 1) || ($conf['domaines']['ldap']['virtual'])) {
|
||||||
|
// add @domain for each element
|
||||||
|
array_walk($_POST['mailaccept'],'adddomain');
|
||||||
|
}
|
||||||
|
|
||||||
|
$newmailaccept = array_pop($_POST['mailaccept']);
|
||||||
|
if ( ($newmailaccept != NULL) |
|
||||||
|
array_diff($info[0]["mailacceptinggeneralid"],$_POST['mailaccept']) ) {
|
||||||
|
$new["mailacceptinggeneralid"] = $_POST['mailaccept'];
|
||||||
|
$new["mailacceptinggeneralid"][$count]= $newmailaccept;
|
||||||
|
|
||||||
|
// on vire les valeurs nulles en triant puis supprimant les premieres valeurs
|
||||||
|
sort($new["mailacceptinggeneralid"]);
|
||||||
|
while ( $new["mailacceptinggeneralid"][0] == NULL ) {
|
||||||
|
array_shift($new["mailacceptinggeneralid"]);
|
||||||
|
|
||||||
|
// on evite une boucle infinie
|
||||||
|
if ( count($new["mailacceptinggeneralid"]) == 0 ) {
|
||||||
|
print "Erreur, vous devez avoir au moins un mail entrant\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// idem avec maildrop
|
||||||
|
$count = array_shift($info[0]["maildrop"]);
|
||||||
|
$newmaildrop = array_pop($_POST['maildrop']);
|
||||||
|
if ( ($newmaildrop != NULL) |
|
||||||
|
array_diff($info[0]["maildrop"],$_POST['maildrop']) ) {
|
||||||
|
$new["maildrop"] = $_POST['maildrop'];
|
||||||
|
$new["maildrop"][$count]= $newmaildrop;
|
||||||
|
|
||||||
|
// on vire les valeurs nulles
|
||||||
|
sort($new["maildrop"]);
|
||||||
|
while ( $new["maildrop"][0] == NULL ) {
|
||||||
|
array_shift($new["maildrop"]);
|
||||||
|
|
||||||
|
// on evite une boucle infinie
|
||||||
|
if ( count($new["maildrop"]) == 0 ) {
|
||||||
|
print "Erreur, vous devez avoir au moins une redirection.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// only for samba mode
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
$postsmbactive = (isset($_POST['smbactive']) ? 'TRUE' : 'FALSE');
|
||||||
|
if ( $info[0]["smbactive"][0] != $postsmbactive ) {
|
||||||
|
$new["smbActive"] = $postsmbactive;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $displayname != Html::clean($_POST['displayname']) ) {
|
||||||
|
$new["displayname"] = Html::clean($_POST['displayname']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if $new not null, set modification
|
||||||
|
if ( (isset($new)) && ($new != NULL) ) {
|
||||||
|
$sr=ldap_modify($ldapconn,"uid=" .$uid. ",".$rdn,$new);
|
||||||
|
|
||||||
|
// Si LDAP est content, c'est bon :)
|
||||||
|
if ( $sr ) {
|
||||||
|
print "<p class='strong'>Modifications effectuées.</p>";
|
||||||
|
print "<a href='compte.php?view=$uid'>Voir le compte modifié</a>";
|
||||||
|
} else {
|
||||||
|
print "<p class='error'>Erreur, envoyez le message d'erreur
|
||||||
|
suivant à votre administrateur :</p>";
|
||||||
|
var_dump($new);
|
||||||
|
Evolog::log("Modify error of $uid by $login");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='strong'>Aucune modification nécessaire.</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Formular for account modification
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$filter="(uid=$uid)";
|
||||||
|
$sr=ldap_search($ldapconn, $rdn, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
// On verifie que le compte existe bien
|
||||||
|
if ( $info['count'] != 1 ) {
|
||||||
|
print "<p class='error'>Erreur, compte inexistant</p>";
|
||||||
|
EvoLog::log("login $uid unknown");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<center>\n";
|
||||||
|
print "<h4>Modification du compte $uid</h4>\n";
|
||||||
|
|
||||||
|
print"<p class='italic'>Modifiez les champs que vous désirez changer.<br />
|
||||||
|
[*] indique ceux qui ne doivent pas être nuls.<br />
|
||||||
|
Vous pouvez réinitialiser le mot de passe si besoin.</p>";
|
||||||
|
|
||||||
|
print "<form name='add'
|
||||||
|
action='compte.php?view=$uid&modif=yes'
|
||||||
|
method='post'>\n";
|
||||||
|
|
||||||
|
print "<table>\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP ou mode "virtuel"
|
||||||
|
if (($conf['evoadmin']['version'] != 1) && (!$conf['domaines']['ldap']['virtual'])) {
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Nom [*] :</td>
|
||||||
|
<td align='left'><input type='text' name='sn' tabindex='2'
|
||||||
|
value='$sn' /></td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Nom Complet [*] :</td>
|
||||||
|
<td align='left'><input type='text' name='cn' tabindex='1'
|
||||||
|
value='$cn' /></td></tr>\n";
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Nouveau mot de passe :</td>
|
||||||
|
<td align='left'><input type='password' name='pass1' tabindex='3' /></td></tr>\n";
|
||||||
|
print "<tr><td align='right'>Confirmation du mot de passe :</td>
|
||||||
|
<td align='left'><input type='password' name='pass2' tabindex='4' /></td></tr>\n";
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP
|
||||||
|
if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Mail principal :";
|
||||||
|
print "</td><td align='left'>$mail</td></tr>\n";
|
||||||
|
print "<input type='hidden' name='mail' value='$mail' />";
|
||||||
|
|
||||||
|
} elseif (!$conf['domaines']['ldap']['virtual']) {
|
||||||
|
print "<tr><td align='right'>Mail annoncé dans l'annuaire ";
|
||||||
|
print " :</td><td align='left'><input type='text' name='mail' size='30'
|
||||||
|
value='$mail' tabindex='5' /></td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// count for tabindex
|
||||||
|
$tab=6;
|
||||||
|
|
||||||
|
// only for samba mode
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
print "<tr><td colspan='2'>";
|
||||||
|
print "<p class='italic'>Modification pour Samba</p>";
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Nom dans Samba :</td>
|
||||||
|
<td align='left'><input type='text' name='displayname' tabindex='" .$tab++. "'
|
||||||
|
value='$displayname' /></td></tr>\n";
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Groupe Samba :</td>
|
||||||
|
<td align='left'>$sambagroup</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// only for mail mode
|
||||||
|
if (($conf['admin']['what'] == 1) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
print "<tr><td colspan='2'>";
|
||||||
|
print "<p class='italic'>Ajoutez/modifiez/supprimez les alias (mails acceptés en entrée).<br />
|
||||||
|
Un minimum d'un alias est requis. Mêmes instructions<br />
|
||||||
|
pour les redirections (compte(s) dans le(s)quel(s) est/sont délivré(s) les mails).
|
||||||
|
</p>";
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
|
||||||
|
for ($i=0;$i<$info[0]["mailacceptinggeneralid"]['count'];$i++) {
|
||||||
|
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
$info[0]['mailacceptinggeneralid'][$i] =
|
||||||
|
ereg_replace('@'.$_SESSION['domain'],'',$info[0]['mailacceptinggeneralid'][$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Mail accepté en entrée :</td>
|
||||||
|
<td align='left'><input type='text' name='mailaccept[$i]' tabindex='" .$tab++. "'
|
||||||
|
size='30' value='".$info[0]['mailacceptinggeneralid'][$i]."' />";
|
||||||
|
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Création d'un nouveau mail accepté en entrée :</td>
|
||||||
|
<td align='left'><input type='text' name='mailaccept[$i]'
|
||||||
|
size='30' tabindex='" .$tab++. "' />";
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
for ($i=0;$i<$info[0]["maildrop"]['count'];$i++) {
|
||||||
|
print "<tr><td align='right'>Mails entrants redirigés vers :</td>
|
||||||
|
<td align='left'><input type='text' name='maildrop[$i]'
|
||||||
|
size='30' value='" .$info[0]['maildrop'][$i]. "' tabindex='" .$tab++. "' />
|
||||||
|
</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td align='right'>Nouvelle redirection vers :</td>
|
||||||
|
<td align='left'><input type='text' name='maildrop[$i]'
|
||||||
|
size='30' tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td colspan='2'>";
|
||||||
|
print "<p class='italic'>Modifiez les autorisations du compte si besoin.</p>";
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
$isactive= ($info[0]["isactive"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
print "<tr><td align='right'>Activation globale :</td>
|
||||||
|
<td align='left'><input type='checkbox' name='isactive'
|
||||||
|
$isactive tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
|
||||||
|
$isadmin= ($info[0]["isadmin"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
print "<tr><td align='right'>Compte admin:</td>
|
||||||
|
<td align='left'><input type='checkbox' name='isadmin'
|
||||||
|
$isadmin tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
|
||||||
|
// only for samba mode
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
$smbactive= ($info[0]["smbactive"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
print "<tr><td align='right'>Compte Samba actif :</td>
|
||||||
|
<td align='left'><input type='checkbox' name='smbactive'
|
||||||
|
$smbactive tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// only for mail mode
|
||||||
|
if (($conf['admin']['what'] == 1) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
$accountactive= ($info[0]["accountactive"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
print "<tr><td align='right'>Compte mail actif :</td>
|
||||||
|
<td align='left'><input type='checkbox' name='accountactive'
|
||||||
|
$accountactive tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
|
||||||
|
$courieractive= ($info[0]["courieractive"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
print "<tr><td align='right'>Utilisation POP/IMAP :</td>
|
||||||
|
<td align='left'><input type='checkbox' name='courieractive'
|
||||||
|
$courieractive tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
|
||||||
|
$webmailactive= ($info[0]["webmailactive"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
print "<tr><td align='right'>Webmail actif :</td>
|
||||||
|
<td align='left'><input type='checkbox' name='webmailactive'
|
||||||
|
$webmailactive tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
|
||||||
|
$authsmtpactive= ($info[0]["authsmtpactive"][0] == 'TRUE') ? 'checked' : '';
|
||||||
|
print "<tr><td align='right'>Authentification SMTP :</td>
|
||||||
|
<td align='left'><input type='checkbox' name='authsmtpactive'
|
||||||
|
$authsmtpactive tabindex='" .$tab++. "' /></td></tr>\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr><td> ,</td><td align='left'>";
|
||||||
|
print "<p><input type='submit' class='button' onclick='return submit_add();'
|
||||||
|
value='Valider' name='valider' tabindex='" .$tab++. "' /></p>\n";
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
print "</table>\n";
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete account
|
||||||
|
*/
|
||||||
|
} elseif ( isset($_GET['del']) ) {
|
||||||
|
|
||||||
|
$uid = Html::clean($_GET['del']);
|
||||||
|
|
||||||
|
if ( (isset($_GET['modif'])) && ($_GET['modif'] == 'yes')) {
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
|
||||||
|
print "<center>";
|
||||||
|
|
||||||
|
print "<p>Suppression $uid en cours...</p>";
|
||||||
|
|
||||||
|
// Verify if person exists...
|
||||||
|
// TODO : /!\ il faudrait verifier le DN plutot que le uid
|
||||||
|
if (!Ldap::is_uid($uid)) {
|
||||||
|
print "<p class='error>Erreur, compte inexistant</p>";
|
||||||
|
EvoLog::log("Delete $uid failed (user doesn't exist).");
|
||||||
|
// *Try* to verify if user is always in aliases...
|
||||||
|
} elseif (Ldap::is_what($uid,'maildrop')>1) {
|
||||||
|
print "<p class='error>Erreur, compte encore présent dans certains alias</p>";
|
||||||
|
EvoLog::log("Delete $uid failed (user always in aliases).");
|
||||||
|
// LDAP deletion
|
||||||
|
} elseif (Ldap::lda_del($ldapconn,"uid=" .$uid. "," .$rdn)) {
|
||||||
|
|
||||||
|
if (!$conf['domaines']['ldap']['virtual']) {
|
||||||
|
// script suppression systeme
|
||||||
|
unix_del($uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : suppression params HORDE
|
||||||
|
// $query = 'delete from horde_prefs where pref_uid="' .$uid. '"';
|
||||||
|
|
||||||
|
print "<p class='strong'>Suppression $uid effectuée.</p>";
|
||||||
|
|
||||||
|
EvoLog::log("Del user ".$uid);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='error>Erreur, suppression non effectuée.</p>";
|
||||||
|
EvoLog::log("Delete $uid failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<center>";
|
||||||
|
print "<p>Vous allez effacer complètement l'utilisateur <b>$uid</b><br />";
|
||||||
|
print "Tous ses messages et paramètres seront définitivement perdus.</p>";
|
||||||
|
print "<a href='compte.php?del=$uid&modif=yes'>Confirmer la suppression</a>";
|
||||||
|
print "</center>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajouter un compte
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account creation
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set account creation
|
||||||
|
*/
|
||||||
|
if ( (isset($_GET['modif'])) && ($_GET['modif'] == 'yes')) {
|
||||||
|
|
||||||
|
// Verification coherence des mots de passe
|
||||||
|
if ( $_POST['pass1'] != $_POST['pass2'] ) {
|
||||||
|
print "<p class='error>Erreur, vous avez tape deux mots de passe differents</p>";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$postuid = Html::clean($_POST['uid']);
|
||||||
|
|
||||||
|
if ( Auth::badpassword($_POST['pass1']) ) {
|
||||||
|
print "<p class='error'>Erreur, mot de passe invalide
|
||||||
|
(trop court ou avec des caracteres incorrects)</p>";
|
||||||
|
EvoLog::log("Set password failed for $postuid by $login");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cn = Html::justclean(Html::purgeaccents(utf8_decode($_POST['cn'])));
|
||||||
|
|
||||||
|
if (badname($postuid)) {
|
||||||
|
print "<p class='error>Erreur, <u>$postuid</u> est invalide.";
|
||||||
|
print "Vous devez avoir entre 2 et 30 caracteres minuscules, chiffres ou";
|
||||||
|
print " caracteres speciaux (tiret, point ou underscore).</p>";
|
||||||
|
EvoLog::log("Add $postuid failed (bad name).");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP
|
||||||
|
//if (!$conf['evoadmin']['version'] == 1) {
|
||||||
|
// mail and cn are auto-generated...
|
||||||
|
$mail = $postuid. "@" .$_SESSION['domain'];
|
||||||
|
$sn = $cn;
|
||||||
|
//} else {
|
||||||
|
// $mail = Html::clean($_POST['mail']);
|
||||||
|
// $cn = Html::clean($_POST['cn']);
|
||||||
|
//}
|
||||||
|
|
||||||
|
// On verifie que le compte n'est pas deja pris...
|
||||||
|
if (!$conf['domaines']['ldap']['virtual']) {
|
||||||
|
if (Ldap::is_what($mail,"mail")) {
|
||||||
|
print "<p class='error'>Erreur, mail deja present !</p>";
|
||||||
|
EvoLog::log("$mail already exists by $login");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
// ...sinon on le change legerement !
|
||||||
|
$tmp = 1;
|
||||||
|
$uid = $postuid;
|
||||||
|
while (Ldap::is_uid($uid)) {
|
||||||
|
$tmp++;
|
||||||
|
$uid = $postuid.$tmp;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$uid = $mail;
|
||||||
|
if (Ldap::is_uid($uid)) {
|
||||||
|
print "<p class='error'>Erreur, mail deja present !</p>";
|
||||||
|
EvoLog::log("$uid already exists by $login");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cas d'un compte Samba
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
$smbgroup = Html::clean($_POST['smbgroup']);
|
||||||
|
$tmp = getsambagroups('unix');
|
||||||
|
$gid = $tmp[$smbgroup];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$gid = getgid($_SESSION['domain']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $gid < 1 ) {
|
||||||
|
print "Erreur, groupe non detecte...";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<center>";
|
||||||
|
print "Ajout en cours...";
|
||||||
|
|
||||||
|
// TODO : generer un UID different en LDAP non-virtual !!!
|
||||||
|
$info["uid"]=$uid;
|
||||||
|
// recuperer un uid number valide
|
||||||
|
// TODO : erreur si uid non compris entre 1000 et 29999
|
||||||
|
$info["uidNumber"]= getfreeuid();
|
||||||
|
$info["gidNumber"]= $gid;
|
||||||
|
$info["objectclass"][0] = "posixAccount";
|
||||||
|
|
||||||
|
if (!$conf['domaines']['ldap']['virtual']) {
|
||||||
|
$info["objectclass"][1] = "shadowAccount";
|
||||||
|
$info["objectclass"][2] = "inetorgperson";
|
||||||
|
|
||||||
|
// Choose what objects you want...
|
||||||
|
if (($conf['admin']['what'] == 1) || ($conf['admin']['what'] == 3)) {
|
||||||
|
$info["objectclass"][3] = "mailAccount";
|
||||||
|
} elseif ($conf['admin']['what'] == 2) {
|
||||||
|
$info["objectclass"][3] = "sambaSamAccount";
|
||||||
|
}
|
||||||
|
if ($conf['admin']['what'] == 3) {
|
||||||
|
$info["objectclass"][4] = "sambaSamAccount";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$info["objectclass"][1] = "organizationalRole";
|
||||||
|
$info["objectclass"][2] = "mailAccount";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP
|
||||||
|
if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
$info["objectclass"][4] = "mailAlias";
|
||||||
|
//$info["onlyAlias"] = "FALSE";
|
||||||
|
$info["spamassassin"][0] = "whitelist_from dupont@seulement-cet-expediteur.com";
|
||||||
|
$info["spamassassin"][1] = "whitelist_from *@tous-les-mails-de-ce-domaine.com";
|
||||||
|
}
|
||||||
|
|
||||||
|
$info["isActive"] = (isset($_POST['isactive'])) ? "TRUE" : "FALSE";
|
||||||
|
$info["isAdmin"] = (isset($_POST['isadmin'])) ? "TRUE" : "FALSE";
|
||||||
|
|
||||||
|
$info["cn"] = $cn;
|
||||||
|
if (!$conf['domaines']['ldap']['virtual']) {
|
||||||
|
$info["loginShell"] = "/bin/bash";
|
||||||
|
$info["sn"] = $sn;
|
||||||
|
$info["homeDirectory"] = "/home/" .$uid;
|
||||||
|
|
||||||
|
// TODO: rajouter un isset pour verifier la presence de ce champ optionnel
|
||||||
|
if ( $mail != '') {
|
||||||
|
$info["mail"] = $mail;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$info["homeDirectory"] = "/home/vmail/" .$_SESSION['domain']. "/" .$postuid. "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cas d'un compte mail
|
||||||
|
if (($conf['admin']['what'] == 1) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
// Aliases
|
||||||
|
$aliases = $_POST['alias'];
|
||||||
|
|
||||||
|
// Compatibilite anciens schemas LDAP et mode "virtuel"
|
||||||
|
if (($conf['evoadmin']['version'] == 1) || ($conf['domaines']['ldap']['virtual'])) {
|
||||||
|
// add @domain for each element
|
||||||
|
array_walk($aliases,'adddomain');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
array_push($aliases,$postuid."@".$_SESSION['domain']);
|
||||||
|
} else {
|
||||||
|
array_push($aliases,$uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: if ($conf['domaines']['onlyone'] != true) {
|
||||||
|
// verifier que le domaine des aliases est correct !!
|
||||||
|
|
||||||
|
// on vire les valeurs nulles
|
||||||
|
sort($aliases);
|
||||||
|
while ( $aliases[0] == NULL ) {
|
||||||
|
array_shift($aliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
$info["mailacceptinggeneralid"] = $aliases;
|
||||||
|
if (!$conf['domaines']['ldap']['virtual']) {
|
||||||
|
$info["maildrop"] = $uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
$info["accountActive"] = (isset($_POST['accountactive'])) ? "TRUE" : "FALSE";
|
||||||
|
$info["courierActive"] = (isset($_POST['courieractive'])) ? "TRUE" : "FALSE";
|
||||||
|
$info["webmailActive"] = (isset($_POST['webmailactive'])) ? "TRUE" : "FALSE";
|
||||||
|
$info["authsmtpActive"] = (isset($_POST['authsmtpactive'])) ? "TRUE" : "FALSE";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cas d'un compte Samba
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
|
||||||
|
$userRid = 2 * $info["uidNumber"] + 1000;
|
||||||
|
|
||||||
|
$info["sambaSID"] = $conf['samba']['sid'].'-'.$userRid;
|
||||||
|
if(!empty($_POST['displayname'])) {
|
||||||
|
$info["displayName"] = Html::clean($_POST['displayname']);
|
||||||
|
}
|
||||||
|
$info["smbActive"] = (isset($_POST['smbactive'])) ? "TRUE" : "FALSE";
|
||||||
|
$info["sambaDomainName"] = $conf['samba']['dn'];
|
||||||
|
|
||||||
|
$tmp = getsambagroups('smb');
|
||||||
|
$info["sambaPrimaryGroupSID"] = $conf['samba']['sid'] . $tmp[$smbgroup];
|
||||||
|
$info["sambaPwdLastSet"] = strtotime("now");
|
||||||
|
$info["sambaLMPassword"] = Ldap::sambalm($_POST['pass1']);
|
||||||
|
$info["sambaNTPassword"] = Ldap::sambant($_POST['pass1']);
|
||||||
|
$info["shadowLastChange"] = floor(strtotime("now")/(3600*24));
|
||||||
|
|
||||||
|
$info["sambaPwdCanChange"] = "-2";
|
||||||
|
$info["sambaPwdMustChange"] = "2147483647";
|
||||||
|
$info["sambaKickoffTime"] = "2147483647";
|
||||||
|
$info["sambaAcctFlags"] = "[XU ]";
|
||||||
|
|
||||||
|
$info["shadowExpire"] = "-1";
|
||||||
|
$info["shadowInactive"] = "-1";
|
||||||
|
$info["shadowMax"] = "200";
|
||||||
|
$info["shadowMin"] = "0";
|
||||||
|
$info["shadowWarning"] = "30";
|
||||||
|
$info["shadowFlag"] = "-1";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$info["userPassword"] = "{SSHA}" .Ldap::ssha($_POST['pass1']);
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
// We use uid attribute for DN
|
||||||
|
$sr=ldap_add($ldapconn,"uid=" .$uid. "," .$rdn, $info);
|
||||||
|
|
||||||
|
// test if ldap connection is successful
|
||||||
|
if ( $sr ) {
|
||||||
|
|
||||||
|
if (!$conf['domaines']['ldap']['virtual']) {
|
||||||
|
// script creation systeme
|
||||||
|
unix_add($uid,getgid($_SESSION['domain']));
|
||||||
|
} else {
|
||||||
|
mail($uid, 'Premier message',"Mail d'initialisation du compte.");
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<p class='strong'>Ajout effectué.</p>";
|
||||||
|
print "<a href='compte.php?view=$uid'>Voir le compte créé</a>";
|
||||||
|
EvoLog::log("Add user ".$uid);
|
||||||
|
|
||||||
|
// notification par mail
|
||||||
|
mailnotify($info,$_SESSION['domain'],$_POST['pass1']);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='error'>Erreur, envoyez le message d'erreur
|
||||||
|
suivant à votre administrateur :</p>";
|
||||||
|
var_dump($info);
|
||||||
|
EvoLog::log("Add $uid failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<center>
|
||||||
|
|
||||||
|
<h4>Ajout d'un compte</h4>
|
||||||
|
|
||||||
|
<form name="add"
|
||||||
|
action="compte.php?modif=yes"
|
||||||
|
method="post">
|
||||||
|
|
||||||
|
<p class="italic">Remplissez lez champs, ceux contenant [*] sont obligatoires.</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
|
||||||
|
<tr><td align="right">Login [*] :</td>
|
||||||
|
<td align="left"><input type="text" name="uid" tabindex='1' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Compatibilite anciens schemas LDAP ou mode "virtuel"
|
||||||
|
if (($conf['evoadmin']['version'] != 1) && (!$conf['domaines']['ldap']['virtual'])) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr><td align="right">Nom [*] :</td>
|
||||||
|
<td align="left"><input type='text' name='sn' tabindex='3' /></td></tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr><td align="right">Nom Complet [*] :</td>
|
||||||
|
<td align="left"><input type='text' name='cn' tabindex='2' /></td></tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr><td align="right">Mot de passe [*] :</td>
|
||||||
|
<td align="left"><input type="password" name="pass1" tabindex='4' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Confirmation du mot de passe [*] :</td>
|
||||||
|
<td align="left"><input type="password" name="pass2" tabindex='5' /></td></tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Compatibilite anciens schemas LDAP
|
||||||
|
if (!$conf['evoadmin']['version'] == 1) {
|
||||||
|
?>
|
||||||
|
<tr><td align="right">Mail annoncé dans l'annuaire :</td>
|
||||||
|
<td align="left"><input type='text' name='mail' /tabindex='6' ></td></tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// only for samba mode
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr><td colspan="2">
|
||||||
|
<p class="italic">Gestion des parametres Samba</p>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Nom dans Samba :</td>
|
||||||
|
<td align="left"><input type='text' name='displayname' tabindex='10' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Groupe Samba :</td>
|
||||||
|
<td align="left"><select name="smbgroup">
|
||||||
|
<option value="" disabled selected>Choisir un groupe</option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach (getsambagroups('smb') as $key=>$value) {
|
||||||
|
print "<option value='" . $key . "'> $key </option>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// only for mail mode
|
||||||
|
if (($conf['admin']['what'] == 1) || ($conf['admin']['what'] == 3)) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr><td colspan="2">
|
||||||
|
<p class="italic">En plus du mail utilisant le login, vous pouvez ajouter des alias.</p>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias :</td>
|
||||||
|
<td align="left"><input type='text' name='alias[0]' tabindex='7' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias :</td>
|
||||||
|
<td align="left"><input type='text' name='alias[1]' tabindex='8' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Alias :</td>
|
||||||
|
<td align="left"><input type='text' name='alias[2]' tabindex='9' />
|
||||||
|
<?php
|
||||||
|
if (!$conf['domaines']['onlyone']) {
|
||||||
|
print "@" .$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr><td colspan="2">
|
||||||
|
<p class="italic">Cochez les cases pour choisir les autorisations du compte.</p>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Activation globale :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='11'
|
||||||
|
name='isactive' checked /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Compte admin :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='14'
|
||||||
|
name='isadmin' /></td></tr>
|
||||||
|
|
||||||
|
<?php // only for samba mode
|
||||||
|
if (($conf['admin']['what'] == 2) || ($conf['admin']['what'] == 3)) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr><td align="right">Compte Samba actif :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='13'
|
||||||
|
name='smbactive' checked /></td></tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
// only for mail mode
|
||||||
|
if (($conf['admin']['what'] == 1) || ($conf['admin']['what'] == 3)) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr><td align="right">Compte mail actif :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='12'
|
||||||
|
name='accountactive' checked /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Utilisation POP/IMAP :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='15'
|
||||||
|
name='courieractive' checked /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Webmail actif :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='16'
|
||||||
|
name='webmailactive' checked /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Authentification SMTP :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='17'
|
||||||
|
name='authsmtpactive' <?php if ($conf['evoadmin']['useauthsmtp']) print "checked" ?> /></td></tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr><td> </td><td align="left">
|
||||||
|
<p><input type="submit" class="button" tabindex='18'
|
||||||
|
value="Valider" name="valider" onclick='return submit_add();' /></p>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} //if (isset($_SESSION['login']))
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("location: auth.php\n\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'fin.php';
|
||||||
|
|
||||||
|
?>
|
1
evoadmin/htdocs/config/.svnignore
Normal file
1
evoadmin/htdocs/config/.svnignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
conf.php
|
42
evoadmin/htdocs/config/conf-dist.php
Executable file
42
evoadmin/htdocs/config/conf-dist.php
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Email pour les notifications
|
||||||
|
$conf['admin']['mail'] = 'admin@example.com';
|
||||||
|
// login des superadmins
|
||||||
|
// Note: utile uniquement si domaines/driver=ldap, laisser vide sinon...
|
||||||
|
$conf['admin']['logins'] = array('foo');
|
||||||
|
// What do you want?
|
||||||
|
// 0 = nothing...
|
||||||
|
// 1 = only mail accounts
|
||||||
|
// 2 = only samba accounts
|
||||||
|
// 3 = mail and samba accounts
|
||||||
|
$conf['admin']['what'] = 3;
|
||||||
|
// use hook.php instead of hook-dist.php
|
||||||
|
$conf['admin']['use_hook'] = false;
|
||||||
|
|
||||||
|
// compatibilite LDAP
|
||||||
|
$conf['evoadmin']['version'] = 3;
|
||||||
|
$conf['url']['webroot'] = '/evoadmin';
|
||||||
|
|
||||||
|
$conf['domaines']['onlyone'] = true;
|
||||||
|
$conf['domaines']['driver'] = 'file';
|
||||||
|
$conf['domaines']['file']['all'] = array('example.com');
|
||||||
|
$conf['domaines']['file']['gid'] = 1000;
|
||||||
|
// Pack Mail "virtuel"... attention
|
||||||
|
// uniquement possible si $conf['admin']['what']=1 !!
|
||||||
|
//$conf['domaines']['ldap']['virtual'] = false;
|
||||||
|
|
||||||
|
// auth SMTP by default ?
|
||||||
|
$conf['evoadmin']['useauthsmtp'] = false;
|
||||||
|
|
||||||
|
$conf['unix']['minuid'] = 1000;
|
||||||
|
$conf['unix']['mingid'] = 1000;
|
||||||
|
|
||||||
|
$conf['html']['title'] = "Interface d'administration XXX";
|
||||||
|
|
||||||
|
// gestion des logs
|
||||||
|
$conf['log']['priority'] = PEAR_LOG_DEBUG;
|
||||||
|
$conf['log']['name'] = '/var/log/evoXXX.log';
|
||||||
|
$conf['log']['software'] = 'evoXXX';
|
||||||
|
$conf['log']['enabled'] = true;
|
||||||
|
|
29
evoadmin/htdocs/connect-dist.php
Executable file
29
evoadmin/htdocs/connect-dist.php
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Secrete parameters
|
||||||
|
*
|
||||||
|
* $Id: connect-dist.php,v 1.3 2007-05-22 21:12:23 reg Exp $
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
define("LDAP_URI","ldap://127.0.0.1");
|
||||||
|
define("LDAP_BASE","dc=example,dc=com");
|
||||||
|
define("LDAP_ADMIN_DN","cn=admin,dc=example,dc=com");
|
||||||
|
define("LDAP_ADMIN_PASS","xxxxx");
|
||||||
|
|
||||||
|
define("SUDOBIN","/usr/bin/sudo");
|
||||||
|
define("SUDOSCRIPT","/usr/share/scripts/evoadmin.sh");
|
||||||
|
define("SUDOPASS","xxxxxx");
|
||||||
|
|
||||||
|
define ('SERVEUR', "localhost");
|
||||||
|
|
||||||
|
define('SERVEUR','localhost');
|
||||||
|
define('SERVEURPORT',3306);
|
||||||
|
define('BASE','horde');
|
||||||
|
define('NOM', 'horde');
|
||||||
|
define('PASSE', 'xxxx');
|
||||||
|
|
||||||
|
?>
|
25
evoadmin/htdocs/debut.php
Executable file
25
evoadmin/htdocs/debut.php
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
print '<a href="superadmin.php"><img src="inc/home.png" /></a>';
|
||||||
|
//print '<a href="admin.php"><img src="inc/home.png" /></a>';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<a href="help.php"><img src="inc/help.png" /></a>
|
||||||
|
|
||||||
|
<a href="<?php print $conf['url']['webroot']; ?>">
|
||||||
|
<img src="inc/exit.png" /></a>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
print "<p class='login'>Vous êtes <b>$login</b>.<br>";
|
||||||
|
|
||||||
|
if (isset($_SESSION['domain']))
|
||||||
|
{
|
||||||
|
print "Vous administrez le domaine <a href='admin.php'>"
|
||||||
|
.$_SESSION['domain']. "</a></h5>";
|
||||||
|
|
||||||
|
}
|
||||||
|
print '</p>';
|
||||||
|
?>
|
||||||
|
|
220
evoadmin/htdocs/domaine.php
Executable file
220
evoadmin/htdocs/domaine.php
Executable file
|
@ -0,0 +1,220 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add/delete a domain
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: domaine.php,v 1.2 2009-09-02 21:21:24 gcolpart Exp $
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path
|
||||||
|
*/
|
||||||
|
define('EVOADMIN_BASE','./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP cookies session
|
||||||
|
*/
|
||||||
|
session_name('EVOADMIN_SESS');
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (isset($_SESSION['login'])) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires
|
||||||
|
*/
|
||||||
|
require_once EVOADMIN_BASE . 'common.php';
|
||||||
|
|
||||||
|
// $login var need for debut.php
|
||||||
|
$login = $_SESSION['login'];
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'haut.php';
|
||||||
|
include EVOADMIN_BASE . 'inc/add.js';
|
||||||
|
include EVOADMIN_BASE . 'debut.php';
|
||||||
|
|
||||||
|
if ( (!superadmin($login)) || ($conf['domaines']['driver'] != 'ldap') ) {
|
||||||
|
|
||||||
|
print "<p class='error'>Vous n'avez pas les droits pour cette page</p>";
|
||||||
|
EvoLog::log("Access denied on domaine.php");
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'fin.php';
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supprimer un domaine
|
||||||
|
if ( isset($_GET['del']) ) {
|
||||||
|
|
||||||
|
$domain = Html::clean($_GET['del']);
|
||||||
|
|
||||||
|
if ( (isset($_GET['modif'])) && ($_GET['modif'] == 'yes')) {
|
||||||
|
|
||||||
|
print "<center>";
|
||||||
|
|
||||||
|
print "<p>Suppression $domain en cours...</p>";
|
||||||
|
|
||||||
|
// TODO : Verifier que l'objet existe avant sa suppression
|
||||||
|
//$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
//$sr = Ldap::lda_del($ldapconn,"domain=" .$domain. "," .$rdn);
|
||||||
|
|
||||||
|
if ( $sr ) {
|
||||||
|
// script suppression systeme
|
||||||
|
//unix_del_dom($domain);
|
||||||
|
|
||||||
|
// TODO : suppression comptes associes
|
||||||
|
|
||||||
|
print "<p class='strong'>Suppression $domain effectuée.</p>";
|
||||||
|
|
||||||
|
EvoLog::log("Del domain ".$domain);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='error>Erreur, suppression non effectuée.</p>";
|
||||||
|
EvoLog::log("Delete $domain failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<center>";
|
||||||
|
print "<p>Vous souhaitez effacer complètement le domaine <b>$domain</b>...<br />";
|
||||||
|
print "Mais cette option n'est pas disponible par l'interface web.<br />";
|
||||||
|
print "Veuillez prendre contact avec l'administrateur pour faire cela.</p>";
|
||||||
|
//print "Tous les messages et paramètres seront définitivement perdus.</p>";
|
||||||
|
//print "<a href='compte.php?del=$uid&modif=yes'>Confirmer la suppression</a>";
|
||||||
|
print "</center>";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Ajouter un domaine
|
||||||
|
if ( (isset($_GET['modif'])) && ($_GET['modif'] == 'yes')) {
|
||||||
|
|
||||||
|
$domain = Html::clean($_POST['domain']);
|
||||||
|
|
||||||
|
print "<center>";
|
||||||
|
print "Ajout en cours...";
|
||||||
|
|
||||||
|
if (!$conf['domaines']['ldap']['virtual']) {
|
||||||
|
|
||||||
|
if ( $conf['evoadmin']['version'] == 1) {
|
||||||
|
|
||||||
|
$info["domain"]=$domain;
|
||||||
|
$info["objectclass"][0] = "ldapDomain";
|
||||||
|
$info["postfixTransport"] = "local:";
|
||||||
|
$info["accountActive"] = (isset($_POST['isactive'])) ? "TRUE" : "FALSE";
|
||||||
|
|
||||||
|
$info2["cn"] = $domain;
|
||||||
|
$info2["objectclass"]="posixGroup";
|
||||||
|
// recuperer un uid number valide
|
||||||
|
// TODO : erreur si uid non compris entre 1000 et 29999
|
||||||
|
$info2["gidNumber"]= getfreegid();
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
|
||||||
|
// on teste si LDAP est content
|
||||||
|
if ( ldap_add($ldapconn,"domain=" .$domain. "," .LDAP_BASE, $info)
|
||||||
|
&& ldap_add($ldapconn,"cn=" .$domain. ",ou=group," .LDAP_BASE, $info2) ) {
|
||||||
|
|
||||||
|
// script ajout systeme (TODO : quota)
|
||||||
|
//unix_add($uid,getgid($_SESSION['domain']));
|
||||||
|
print "<p class='strong'>Ajout effectué.</p>";
|
||||||
|
EvoLog::log("Add domain ".$domain);
|
||||||
|
|
||||||
|
// notification par mail
|
||||||
|
domainnotify($domain);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='error'>Erreur, envoyez le message d'erreur
|
||||||
|
suivant à votre administrateur :</p>";
|
||||||
|
var_dump($info);
|
||||||
|
var_dump($info2);
|
||||||
|
EvoLog::log("Add $domain failed");
|
||||||
|
}
|
||||||
|
} elseif ( $conf['evoadmin']['version'] == 2) {
|
||||||
|
// TODO : cf worldsat, etc.
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Ajout d'un domaine virtuel
|
||||||
|
|
||||||
|
$info["cn"]=$domain;
|
||||||
|
$info["objectclass"][0] = "postfixDomain";
|
||||||
|
$info["objectclass"][1] = "posixGroup";
|
||||||
|
$info["postfixTransport"] = "virtual:";
|
||||||
|
$info["isActive"] = (isset($_POST['isactive'])) ? "TRUE" : "FALSE";
|
||||||
|
|
||||||
|
// recuperer un uid number valide
|
||||||
|
// TODO : erreur si uid non compris entre 1000 et 29999
|
||||||
|
$info["gidNumber"]= getfreegid();
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
|
||||||
|
// on teste si LDAP est content
|
||||||
|
if (ldap_add($ldapconn,"cn=" .$domain. "," .LDAP_BASE, $info)) {
|
||||||
|
|
||||||
|
print "<p class='strong'>Ajout effectué.</p>";
|
||||||
|
EvoLog::log("Add domain ".$domain);
|
||||||
|
|
||||||
|
// notification par mail
|
||||||
|
domainnotify($domain);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='error'>Erreur, envoyez le message d'erreur
|
||||||
|
suivant à votre administrateur :</p>";
|
||||||
|
var_dump($info);
|
||||||
|
EvoLog::log("Add $domain failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
// Formulaire d'ajout d'un domaine
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<center>
|
||||||
|
|
||||||
|
<h4>Ajout d'un domaine</h4>
|
||||||
|
|
||||||
|
<form name="add"
|
||||||
|
action="domaine.php?modif=yes"
|
||||||
|
method="post">
|
||||||
|
|
||||||
|
<p class="italic">Remplissez lez champs, ceux contenant [*] sont obligatoires.</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
|
||||||
|
<tr><td align="right">Domaine [*] :</td>
|
||||||
|
<td align="left"><input type="text" name="domain" tabindex='1' /></td></tr>
|
||||||
|
|
||||||
|
<tr><td align="right">Activation globale :</td>
|
||||||
|
<td align="left"><input type='checkbox' tabindex='2'
|
||||||
|
name='isactive' checked /></td></tr>
|
||||||
|
|
||||||
|
<tr><td> </td><td align="left">
|
||||||
|
<p><input type="submit" class="button" tabindex='3'
|
||||||
|
value="Valider" name="valider" /></p>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (isset($_SESSION['login']))
|
||||||
|
} else {
|
||||||
|
header("location: auth.php\n\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'fin.php';
|
||||||
|
|
||||||
|
?>
|
56
evoadmin/htdocs/evolibs/Auth.php
Normal file
56
evoadmin/htdocs/evolibs/Auth.php
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2004-2005 Evolix - Tous droits reserves
|
||||||
|
* $Id: Auth.php,v 1.1 2009-09-02 16:22:45 gcolpart Exp $
|
||||||
|
*
|
||||||
|
* Fonctions utiles pour authentification
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class Auth
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifie qu'un login est incorrect
|
||||||
|
* entre 3 et 30 caractères
|
||||||
|
* en lettres minuscule, chiffres, '-', '.' ou '_'
|
||||||
|
* pour le premier et dernier caractères : seuls lettres et minuscules
|
||||||
|
* et chiffres sont possibles
|
||||||
|
*/
|
||||||
|
|
||||||
|
function badname($login)
|
||||||
|
{
|
||||||
|
return (!preg_match('`^([a-z0-9][a-z0-9\-\.\_]{1,28}[a-z0-9])$`',$login));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* verifie qu'un mot de passe est incorrect
|
||||||
|
* entre 5 et 12 caractères
|
||||||
|
* caractères imprimables
|
||||||
|
*/
|
||||||
|
|
||||||
|
function badpassword($pass)
|
||||||
|
{
|
||||||
|
return ( (strlen($pass) > 12) ||
|
||||||
|
(strlen($pass) < 5) ||
|
||||||
|
(!ereg('^([[:graph:]]*)$',$pass)) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* verifie qu'un FQDN semble correct
|
||||||
|
*/
|
||||||
|
|
||||||
|
function badfqdn($domain)
|
||||||
|
{
|
||||||
|
return (!ereg('^([[:alnum:]\.\-]{2,70}.[[:alpha:]]{2,5})$',$domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
56
evoadmin/htdocs/evolibs/EvoLog.php
Executable file
56
evoadmin/htdocs/evolibs/EvoLog.php
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gestion des Logs
|
||||||
|
* inspire de Horde
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class EvoLog
|
||||||
|
{
|
||||||
|
|
||||||
|
function log($message, $priority = PEAR_LOG_INFO)
|
||||||
|
{
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
if (!$conf['log']['enabled'])
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$logger = &Log::singleton('file', $conf['log']['name'] ,'evoadmin');
|
||||||
|
$logger->log($message, $priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
function debug()
|
||||||
|
{
|
||||||
|
if (DEBUG > 2)
|
||||||
|
{
|
||||||
|
echo "<hr /><hr /> SESSION DEBUG : <br />";
|
||||||
|
print_r($_SESSION);
|
||||||
|
echo "<br />";
|
||||||
|
echo 'session_name() : ' . session_name() . "<br>\n" ;
|
||||||
|
echo 'session_id() : ' . session_id() . "<br>\n" ;
|
||||||
|
echo 'session_cache_expire() : ' . session_cache_expire() . "<br>\n" ;
|
||||||
|
echo 'session_cache_limiter() : ' . session_cache_limiter() . "<br>\n" ;
|
||||||
|
echo 'session_get_cookie_params() : ';
|
||||||
|
print_r(array_values(session_get_cookie_params()));
|
||||||
|
echo "<br>\n";
|
||||||
|
echo 'session_module_name() : ' . session_module_name() . "<br>\n" ;
|
||||||
|
echo 'session_save_path() : ' . session_save_path() . "<br>\n" ;
|
||||||
|
|
||||||
|
echo "<hr /><hr /> POST DEBUG : <br />";
|
||||||
|
print_r($_POST);
|
||||||
|
echo "<hr /><hr /> GET DEBUG : <br />";
|
||||||
|
print_r($_GET);
|
||||||
|
echo "<hr /><hr />";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
100
evoadmin/htdocs/evolibs/Html.php
Executable file
100
evoadmin/htdocs/evolibs/Html.php
Executable file
|
@ -0,0 +1,100 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: Html.php,v 1.1.1.1 2006-11-03 14:56:45 reg Exp $
|
||||||
|
*
|
||||||
|
* Evolib HTML (PHP4)
|
||||||
|
* Fonctions utiles pour utilisation avec champs FORM
|
||||||
|
* Fonctions diverses sur manipulation de caractères
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Html
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nettoie un texte
|
||||||
|
* Supprime toutes les balises HTML
|
||||||
|
*/
|
||||||
|
|
||||||
|
function justclean($texte)
|
||||||
|
{
|
||||||
|
return strip_tags($texte);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nettoie un texte
|
||||||
|
* Supprime toutes les balises HTML
|
||||||
|
* convertit en caracteres HTML
|
||||||
|
* TODO : ENT_NOQUOTES ou ENT_QUOTES ??
|
||||||
|
*/
|
||||||
|
|
||||||
|
function clean($texte)
|
||||||
|
{
|
||||||
|
return htmlentities(strip_tags($texte),ENT_NOQUOTES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nettoie un texte en permettant l'utilisation de liens A HREF
|
||||||
|
* Supprime toutes les balises HTML
|
||||||
|
* convertit en caracteres HTML
|
||||||
|
* permet l'utilisation de liens [Evolixn=http://www.evolix.fr]
|
||||||
|
* convertion automatique (inspire des liens SPIP, http://www.spip.net)
|
||||||
|
*/
|
||||||
|
|
||||||
|
function clean2($texte)
|
||||||
|
{
|
||||||
|
$texte = htmlentities(strip_tags($texte),ENT_NOQUOTES);
|
||||||
|
$texte = ereg_replace('\[([^"^=]+)=(http://[^"^[:space:]]+)\]',
|
||||||
|
'<a href="\\2">\\1</a>',$texte);
|
||||||
|
return addslashes($texte);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nettoie une requete SQL
|
||||||
|
* Ajoute des antislashes devant : guillements simples, doubles, antislashes
|
||||||
|
* caractere NULL
|
||||||
|
* Cette fonction n'agit que si la directive magic_quotes_gpc est sur Off
|
||||||
|
*/
|
||||||
|
|
||||||
|
function sqlclean($texte)
|
||||||
|
{
|
||||||
|
return (get_magic_quotes_gpc()) ? $texte : addslashes($texte);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function purgeaccents($texte)
|
||||||
|
{
|
||||||
|
|
||||||
|
// liste des caracteres accentuees
|
||||||
|
$couple["é"] = "e"; $couple["è"] = "e"; $couple["ê"] = "e"; $couple["ë"] = "e";
|
||||||
|
$couple["È"] = "e"; $couple["É"] = "e"; $couple["Ê"] = "e"; $couple["Ë"] = "e";
|
||||||
|
$couple["à"] = "a"; $couple["ä"] = "a"; $couple["â"] = "a"; $couple["å"] = "a";
|
||||||
|
$couple["á"] = "a"; $couple["ã"] = "a"; $couple["æ"] = "a";
|
||||||
|
$couple["À"] = "a"; $couple["Á"] = "a"; $couple["Â"] = "a"; $couple["Ã"] = "a";
|
||||||
|
$couple["Ä"] = "a"; $couple["Å"] = "a"; $couple["Æ"] = "a";
|
||||||
|
$couple["ù"] = "u"; $couple["ü"] = "u"; $couple["û"] = "u"; $couple["ú"] = "u";
|
||||||
|
$couple["ô"] = "o"; $couple["ö"] = "o"; $couple["ò"] = "o"; $couple["ó"] = "o"; $couple["õ"] = "o";
|
||||||
|
$couple["î"] = "i"; $couple["ï"] = "i"; $couple["ì"] = "i"; $couple["í"] = "i";
|
||||||
|
$couple["ç"] = "c"; $couple["Ç"] = "c";
|
||||||
|
$couple["ÿ"] = "y"; $couple["ý"] = "y"; $couple["ñ"] = "n";
|
||||||
|
|
||||||
|
while(list($car,$val) = each($couple))
|
||||||
|
{
|
||||||
|
$texte = ereg_replace($car,$val,$texte);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $texte;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* renvoie un entier
|
||||||
|
*/
|
||||||
|
|
||||||
|
function toint($var)
|
||||||
|
{
|
||||||
|
return number_format($var, 0, '', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
189
evoadmin/htdocs/evolibs/Ldap.php
Executable file
189
evoadmin/htdocs/evolibs/Ldap.php
Executable file
|
@ -0,0 +1,189 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bibliotheques LDAP (PHP4 et PHP5)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2008 Evolix - Tous droits reserves
|
||||||
|
* $Id: Ldap.php,v 1.2 2008-09-29 11:04:52 tmartin Exp $
|
||||||
|
*
|
||||||
|
* Fonctions utiles pour utilisation PHP et OpenLDAP
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class Ldap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connexion a une base OpenLDAP
|
||||||
|
* les constantes LDAP_URI devront etre definies
|
||||||
|
* il convient de les definir dans un fichier connect.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
function lda_connect($binddn="none",$pass="") {
|
||||||
|
|
||||||
|
$ldapconn = @ldap_connect(LDAP_URI)
|
||||||
|
or die( "Impossible de se connecter au serveur LDAP {$ldaphost}" );
|
||||||
|
if (!ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3)) {
|
||||||
|
echo 'Impossible de modifier la version du protocole à 3';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($binddn != "none") {
|
||||||
|
if (!ldap_bind($ldapconn, $binddn, $pass)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ldapconn;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* suppression d'entrees OpenLDAP
|
||||||
|
* recursivite possible
|
||||||
|
*/
|
||||||
|
|
||||||
|
function lda_del($ldapconn, $dn , $recursive=FALSE) {
|
||||||
|
if($recursive == FALSE) {
|
||||||
|
return(ldap_delete($ldapconn, $dn));
|
||||||
|
} else {
|
||||||
|
$sr=ldap_list($ldapconn, $dn, "ObjectClass=*");
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
for($i=0;$i<$info['count'];$i++) {
|
||||||
|
$result= lda_del($ldapconn, $info[$i]['dn'],$recursive);
|
||||||
|
if(!$result) {
|
||||||
|
return($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(ldap_delete($ldapconn, $dn));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getfreegid()
|
||||||
|
* obtenir le plus petit GID disponible
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getfreegid() {
|
||||||
|
$gid = exec("sudo /usr/share/scripts/script.sh -g");
|
||||||
|
return $gid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getfreeuid()
|
||||||
|
* obtenir le plus petit UID disponible
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getfreeuid() {
|
||||||
|
$gid = exec("sudo /usr/share/scripts/script.sh -u");
|
||||||
|
return $gid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getgid($group)
|
||||||
|
* obtenir GID en fonction du nom du groupe
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getgid($group) {
|
||||||
|
$ldapconngetgid = lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$filter="(cn=" .$group. ")";
|
||||||
|
$sr=ldap_search($ldapconngetgid, "ou=group," .LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconngetgid, $sr);
|
||||||
|
if ($info['count']) {
|
||||||
|
return (int) $info[0]["gidnumber"][0];
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getgroup($login)
|
||||||
|
* obtenir le nom du groupe en fonction du login
|
||||||
|
* particulier au l'organisation du serveur JPS
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getgroup($login) {
|
||||||
|
$ldapconngetgroup = lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$filter="(uid=" .$login. ")";
|
||||||
|
$sr=ldap_search($ldapconngetgroup, LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconngetgroup, $sr);
|
||||||
|
if ($info['count']) {
|
||||||
|
$result = $info[0]['dn'];
|
||||||
|
list ($foo,$mydomain,$foo2) = split(',',$result);
|
||||||
|
list ($foo,$group) = split('=',$mydomain);
|
||||||
|
return $group;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_uid($login) {
|
||||||
|
$ldapconnisuid = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$filter="(uid=" .$login. ")";
|
||||||
|
$sr=ldap_search($ldapconnisuid, LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconnisuid, $sr);
|
||||||
|
if (($info['count']) && ($info[0]['uid'][0] == $login )) {
|
||||||
|
ldap_unbind($ldapconnisuid);
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
ldap_unbind($ldapconnisuid);
|
||||||
|
$stack = array ("root","nobody","news","daemon","bin","sys","sync","postmaster","mailer-daemon",
|
||||||
|
"games","man","lp","mail","uucp","proxy","www-data","backup","list","irc","gnats","abuse",
|
||||||
|
"postfix","sshd","forquota","amavis","clamav","mysql","gcolpart","aanriot","log2mail");
|
||||||
|
while (count($stack)) {
|
||||||
|
$unixuid = array_shift($stack);
|
||||||
|
if ( $login == $unixuid ) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function is_what($login,$what) {
|
||||||
|
$ldapconnisuid = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$filter="(" .$what. "=" .$login. ")";
|
||||||
|
$sr=ldap_search($ldapconnisuid, LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconnisuid, $sr);
|
||||||
|
if ($info['count']) {
|
||||||
|
ldap_unbind($ldapconnisuid);
|
||||||
|
return $info['count'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ldap_unbind($ldapconnisuid);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sha($pass) {
|
||||||
|
return base64_encode(pack("H*", sha1($pass)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// necessite php(4|5)-mhash
|
||||||
|
function ssha($pass) {
|
||||||
|
mt_srand((double)microtime()*1000000);
|
||||||
|
$salt = mhash_keygen_s2k(MHASH_SHA1, $pass, substr(pack('h*', md5(mt_rand())), 0, 8), 4);
|
||||||
|
return base64_encode(mhash(MHASH_SHA1, $pass.$salt).$salt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// necessite Crypt/CHAP -> http://gcolpart.evolix.net/debian/php-crypt-chap/
|
||||||
|
// inspire de lib/Driver/smbldap.php (Horde Password)
|
||||||
|
function sambalm($pass) {
|
||||||
|
$hash = &new Crypt_CHAP_MSv2();
|
||||||
|
$hash->password = $pass;
|
||||||
|
return strtoupper(bin2hex($hash->lmPasswordHash()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// necessite Crypt/CHAP -> http://gcolpart.evolix.net/debian/php-crypt-chap/
|
||||||
|
// inspire de lib/Driver/smbldap.php (Horde Password)
|
||||||
|
function sambant($pass) {
|
||||||
|
$hash = &new Crypt_CHAP_MSv2();
|
||||||
|
$hash->password = $pass;
|
||||||
|
return strtoupper(bin2hex($hash->ntPasswordHash()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
38
evoadmin/htdocs/evolibs/Math.php
Executable file
38
evoadmin/htdocs/evolibs/Math.php
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: Math.php,v 1.1 2008-09-29 09:02:52 tmartin Exp $
|
||||||
|
*
|
||||||
|
* Fonctions mathematiques
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class Math
|
||||||
|
{
|
||||||
|
|
||||||
|
function EvoFormat($param)
|
||||||
|
{
|
||||||
|
// Pour eviter -0.00
|
||||||
|
if ( number_format($param, 2, '.', ' ') == -0.00 ) $param = 0.00;
|
||||||
|
|
||||||
|
return ereg_replace('x',' ',number_format($param, 2, '.', 'x'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function LongCode($param)
|
||||||
|
{
|
||||||
|
return sprintf("%03s", $param);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LongId($param)
|
||||||
|
{
|
||||||
|
return sprintf("%08s", $param);
|
||||||
|
}
|
||||||
|
|
||||||
|
function arrondi($num) {
|
||||||
|
//return number_format($num, 0, ',', '.');
|
||||||
|
return number_format($num, 0, '', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
5
evoadmin/htdocs/fin.php
Normal file
5
evoadmin/htdocs/fin.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<hr />
|
||||||
|
<p class="mini">Powered by EvoAdmin</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
19
evoadmin/htdocs/haut.php
Executable file
19
evoadmin/htdocs/haut.php
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
print '<?xml version="1.0" encoding="utf8" ?>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html
|
||||||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//FR"
|
||||||
|
"DTD/xhtml1-strict.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
|
||||||
|
<head>
|
||||||
|
<title><?php print $conf['html']['title']; ?></title>
|
||||||
|
<link href="inc/style.css" rel="stylesheet" type="text/css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1 align="center"><?php print $conf['html']['title']; ?></h1>
|
98
evoadmin/htdocs/help.php
Executable file
98
evoadmin/htdocs/help.php
Executable file
|
@ -0,0 +1,98 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* French HTML help file
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: help.php,v 1.4 2009-09-06 01:12:07 gcolpart Exp $
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path
|
||||||
|
*/
|
||||||
|
define('EVOADMIN_BASE','./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP cookies session
|
||||||
|
*/
|
||||||
|
session_name('EVOADMIN_SESS');
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (isset($_SESSION['login']))
|
||||||
|
{
|
||||||
|
|
||||||
|
$rep = './';
|
||||||
|
require_once($rep. 'common.php');
|
||||||
|
|
||||||
|
include($rep. 'haut.php');
|
||||||
|
|
||||||
|
$login = $_SESSION['login'];
|
||||||
|
|
||||||
|
include($rep. 'debut.php');
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
Cette page devrait être lue attentivement avant d'utiliser cette interface.
|
||||||
|
|
||||||
|
<h2>Aide</h2>
|
||||||
|
|
||||||
|
Cette aide devrait vous permettre de comprendre le fonctionnement de cette interface.
|
||||||
|
|
||||||
|
<h3>Créer un compte mail</h3>
|
||||||
|
|
||||||
|
<p>Vous devez choisir un mot de passe et éventuellement des alias. Veillez à entrer des alias avec une syntaxe valide et un mot de passe valide et assez complexe. Vous pouvez également choisir de donner les droits "Admin" en cochant la case <i>Admin</i>, c'est-à-dire permettre à l'utilisateur de se connecter à cette interface pour pouvoir ajouter/supprimer des mails/alias.<br>
|
||||||
|
<b>Vous devez également choisir un Login qui ne sera plus modifiable par la suite.</b> Ce login et le mot de passe serviront à se connecter au Webmail, serveur SMTP, serveur POP et serveur IMAP et éventuellement à cette interface (si l'utilisateur a les droits "Admin").
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>Créer un alias</h3>
|
||||||
|
|
||||||
|
<p>Vous devez choisir un alias et un mail valide pour rediriger les mails. Prenez bien garde à entrer un mail valide sinon les mails ne vous parviendront jamais.</p>
|
||||||
|
|
||||||
|
<h2>FAQ</h2>
|
||||||
|
|
||||||
|
Cette Foire-Aux-Questions (FAQ) devrait répondre à vos questions. Au fil du temps, de nouvelles questions/réponses seront ajoutées. Posez vos questions à <a href="mailto:<?php print $conf['admin']['mail'];?>"><?php print $conf['admin']['mail'];?></a>.
|
||||||
|
|
||||||
|
<p>Qu'est-ce qu'une syntaxe valide pour un compte mail ?</p>
|
||||||
|
|
||||||
|
<i>Le début du mail (avant le @), doit respecter les règles suivantes :
|
||||||
|
<ul>
|
||||||
|
<li>être compris entre 3 et 30 caractères</li>
|
||||||
|
<li>n'avoir que des caractères de types lettre minuscules ou chiffres</li>
|
||||||
|
<li>les caractères tiret (-), point (.) et underscore (_) sont permis sauf en début et fin</li>
|
||||||
|
</ul>
|
||||||
|
</i>
|
||||||
|
|
||||||
|
<p>Qu'est-ce qu'un mot de passe valide ?</p>
|
||||||
|
|
||||||
|
<i>Votre mot de passe doit répondre aux règles suivantes :
|
||||||
|
<ul>
|
||||||
|
<li>avoir entre 5 et 12 caractères</li>
|
||||||
|
<li>N'utiliser ques des caractères imprimables c'est-à-dire des lettres (majuscules, minuscules ou accentuées), des chiffres ou les caractères suivants :
|
||||||
|
<pre>[]!"#$%&'()*+,-./:;<=>?@\^_`{|}~</pre>
|
||||||
|
</ul>
|
||||||
|
</i>
|
||||||
|
|
||||||
|
<p>Qu'est-ce qu'un mot de passe assez complexe ?</p>
|
||||||
|
|
||||||
|
<i>Outre d'avoir un mot de passe assez long (voir question précédente), il est fortement conseillé d'utilisé au moins un chiffre, au moins une lettre minuscule, au moins une lettre majuscule et au moins un caractères "spécial". De plus, l'utilisation de suites de caractères "connues" (mots, dates, noms, etc.) est fortement déconseillée.</i>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} //if (isset($_SESSION['login']))
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("location: auth.php\n\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'fin.php';
|
||||||
|
|
||||||
|
?>
|
1
evoadmin/htdocs/inc/.svnignore
Executable file
1
evoadmin/htdocs/inc/.svnignore
Executable file
|
@ -0,0 +1 @@
|
||||||
|
hook.php
|
33
evoadmin/htdocs/inc/add.js
Executable file
33
evoadmin/htdocs/inc/add.js
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
<script language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
|
||||||
|
function submit_add()
|
||||||
|
{
|
||||||
|
if ((typeof(document.add.uid) != "undefined" ) && (document.add.uid.value == "")) {
|
||||||
|
alert('Veuillez entre un Login.');
|
||||||
|
document.add.uid.focus();
|
||||||
|
return false;
|
||||||
|
} else if (document.add.cn.value == "") {
|
||||||
|
alert('Veuillez entrer le Prenom Nom.');
|
||||||
|
document.add.cn.focus();
|
||||||
|
return false;
|
||||||
|
} else if (document.add.sn.value == "") {
|
||||||
|
alert('Veuillez entrer un Nom.');
|
||||||
|
document.add.sn.focus();
|
||||||
|
return false;
|
||||||
|
} else if (document.add.pass1.value != document.add.pass2.value) {
|
||||||
|
alert('Erreur, dans la vérification du mot de passe.');
|
||||||
|
document.add.pass1.focus();
|
||||||
|
return false;
|
||||||
|
} else if (document.add.smbgroup.value == "") {
|
||||||
|
alert('Veuillez selectionner le groupe.');
|
||||||
|
document.add.smbgroup.focus();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
BIN
evoadmin/htdocs/inc/exit.png
Executable file
BIN
evoadmin/htdocs/inc/exit.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
252
evoadmin/htdocs/inc/functions.php
Executable file
252
evoadmin/htdocs/inc/functions.php
Executable file
|
@ -0,0 +1,252 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function display($msg)
|
||||||
|
{
|
||||||
|
echo "<p class='display'>" . $msg . "</p>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// teste si l'utilisateur est superadmin
|
||||||
|
function superadmin($login) {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
foreach ($conf['admin']['logins'] as $admin) {
|
||||||
|
if ( Html::clean($login) == $admin ) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// execution du script shell associe
|
||||||
|
function evoexec($cmd) {
|
||||||
|
//exec(SUBIN . " " . SUUSER . " -c " . SUDOBIN . " '$cmd'");
|
||||||
|
return exec(SUDOBIN . " " . SUDOSCRIPT . " -p " . SUDOPASS . " $cmd");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// retourne le quota d'un utilisateur ou d'un groupe
|
||||||
|
function getquota($who,$what) {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
if ( $what == 'user') {
|
||||||
|
$quota = evoexec("-qu $who");
|
||||||
|
} elseif ( $what == 'group') {
|
||||||
|
if ( $conf['domaines']['driver'] == 'file' ) {
|
||||||
|
$quota = evoexec("-s");
|
||||||
|
} elseif ( $conf['domaines']['driver'] == 'ldap' ) {
|
||||||
|
$quota = evoexec("-qg $who");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list ($now,$limit) = split("/",$quota);
|
||||||
|
$now = $now / 1024;
|
||||||
|
$limit = $limit / 1024;
|
||||||
|
$quota = "<b>" . Math::arrondi($now). "M</b>/" .Math::arrondi($limit). "M";
|
||||||
|
|
||||||
|
return $quota;
|
||||||
|
}
|
||||||
|
|
||||||
|
// commande shell a lancer pour creer un utilisateur
|
||||||
|
function unix_add($user,$group=NULL) {
|
||||||
|
|
||||||
|
if ( $group == NULL) {
|
||||||
|
$group = getgid();
|
||||||
|
}
|
||||||
|
evoexec("-a -u $user -g $group");
|
||||||
|
}
|
||||||
|
|
||||||
|
// commande shell a lancer pour supprimer un utilisateur
|
||||||
|
function unix_del($user) {
|
||||||
|
|
||||||
|
evoexec("-d -u $user");
|
||||||
|
}
|
||||||
|
|
||||||
|
// renvoie le gidNumber associe a un domaine
|
||||||
|
function getgid($domain=NULL) {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
if ( $conf['domaines']['driver'] == 'file' ) {
|
||||||
|
return $conf['domaines']['file']['gid'];
|
||||||
|
} elseif ( $conf['domaines']['driver'] == 'ldap' ) {
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$filter="(&(cn=" .$domain. ")(gidnumber=*))";
|
||||||
|
$sr=ldap_search($ldapconn, LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
ldap_unbind($ldapconn);
|
||||||
|
|
||||||
|
if ($info['count']) {
|
||||||
|
return (int) $info[0]["gidnumber"][0];
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// renvoie le 1er uidNumber disponible
|
||||||
|
function getfreeuid() {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$filter="(uidNumber=*)";
|
||||||
|
$sr=ldap_search($ldapconn, LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
ldap_unbind($ldapconn);
|
||||||
|
|
||||||
|
$uids = array();
|
||||||
|
|
||||||
|
foreach ($info as $entry) {
|
||||||
|
array_push($uids,$entry['uidnumber'][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sort($uids);
|
||||||
|
$uid = max(array_pop($uids)+1,$conf['unix']['minuid']);
|
||||||
|
|
||||||
|
return (int) $uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// renvoie le 1er uidNumber disponible
|
||||||
|
function getfreegid() {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$filter="(gidNumber=*)";
|
||||||
|
$sr=ldap_search($ldapconn, LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
ldap_unbind($ldapconn);
|
||||||
|
|
||||||
|
$gids = array();
|
||||||
|
|
||||||
|
foreach ($info as $entry) {
|
||||||
|
array_push($gids,$entry['gidnumber'][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sort($gids);
|
||||||
|
$gid = max(array_pop($gids)+1,$conf['unix']['mingid']);
|
||||||
|
|
||||||
|
return (int) $gid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get number of account or aliases for a domain
|
||||||
|
function getnumber($domain,$type) {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
if ( $type == 'compte' ) {
|
||||||
|
$filter="(objectClass=posixAccount)";
|
||||||
|
|
||||||
|
} elseif ( $type == 'mail' ) {
|
||||||
|
$filter="(objectClass=mailAccount)";
|
||||||
|
|
||||||
|
} elseif ( $type == 'alias' ) {
|
||||||
|
$filter="(objectClass=mailAlias)";
|
||||||
|
|
||||||
|
// compatibilite anciens schemas
|
||||||
|
if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
$filter="(&(objectClass=mailAlias)(onlyAlias=TRUE))";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif ( $type == 'smb' ) {
|
||||||
|
$filter="(objectClass=sambaSamAccount)";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $conf['domaines']['onlyone']) {
|
||||||
|
|
||||||
|
// compatibilite anciens schemas
|
||||||
|
if ($conf['evoadmin']['version'] <= 2) {
|
||||||
|
$rdn= "domain=" .$domain. "," .LDAP_BASE;
|
||||||
|
} else {
|
||||||
|
$rdn= "cn=" .$domain. "," .LDAP_BASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//$rdn= "ou=people," .LDAP_BASE;
|
||||||
|
$rdn= LDAP_BASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sr=ldap_search($ldapconn, $rdn, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
ldap_unbind($ldapconn);
|
||||||
|
|
||||||
|
return $info['count'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getsambagroups($type) {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
// Si la liste des groupes est defini dans la config on l'utilise
|
||||||
|
|
||||||
|
if($type == "unix" && isset($conf['samba']['unixgroups'])) {
|
||||||
|
return $conf['samba']['unixgroups'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == "smb" && isset($conf['samba']['smbgroups'])) {
|
||||||
|
return $conf['samba']['smbgroups'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// sinon on interroge LDAP
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
$filter = "(objectClass=sambaGroupMapping)";
|
||||||
|
$rdn = LDAP_BASE;
|
||||||
|
$sr=ldap_search($ldapconn, $rdn, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
ldap_unbind($ldapconn);
|
||||||
|
|
||||||
|
$ret = array();
|
||||||
|
for($i=0; $i<$info['count']; $i++) {
|
||||||
|
|
||||||
|
$entry = $info[$i];
|
||||||
|
$cn = $entry['cn'][0];
|
||||||
|
|
||||||
|
if($type == "unix") {
|
||||||
|
$ret[$cn] = $entry['gidnumber'][0];
|
||||||
|
} elseif($type == "smb") {
|
||||||
|
$tmp = explode('-', $entry['sambasid'][0]);
|
||||||
|
$ret[$cn] = "-".array_pop($tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifie qu'un login est incorrect
|
||||||
|
* entre 2 et 30 caracteres
|
||||||
|
* en lettres minuscule, chiffres, '-', '.' ou '_'
|
||||||
|
* pour le premier et dernier caracteres : seuls lettres et minuscules
|
||||||
|
* et chiffres sont possibles
|
||||||
|
*/
|
||||||
|
function badname($login)
|
||||||
|
{
|
||||||
|
return (!preg_match('`^([a-z0-9][a-z0-9\-\.\_]{0,28}[a-z0-9])$`',$login));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajouter la composante @domaine
|
||||||
|
*/
|
||||||
|
function adddomain(&$item,$key)
|
||||||
|
{
|
||||||
|
if (preg_match('`@`',$item)) {
|
||||||
|
print "<p class='error'>Ne pas inclure de @ dans les mails acceptes !</p>";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($item)) {
|
||||||
|
$item = "$item". "@".$_SESSION['domain'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
BIN
evoadmin/htdocs/inc/help.png
Executable file
BIN
evoadmin/htdocs/inc/help.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
evoadmin/htdocs/inc/home.png
Executable file
BIN
evoadmin/htdocs/inc/home.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
54
evoadmin/htdocs/inc/hook-dist.php
Normal file
54
evoadmin/htdocs/inc/hook-dist.php
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// classic mail notification
|
||||||
|
// (you can customize it in hook.php)
|
||||||
|
function mailnotify($info,$domain,$pass) {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$gecos = $info["cn"];
|
||||||
|
$unixlogin = $info["uid"];
|
||||||
|
|
||||||
|
//mail de notification
|
||||||
|
$sujet = "Creation du compte $unixlogin" ;
|
||||||
|
$to = $conf['admin']['mail'];
|
||||||
|
|
||||||
|
$entete = "From: ".$conf['admin']['mail']."\n";
|
||||||
|
$entete .= "MIME-Version: 1.0\n";
|
||||||
|
$entete .= "Content-type: text/plain; charset=utf-8\n";
|
||||||
|
$entete .= "Content-Transfer-Encoding: quoted-printable\n";
|
||||||
|
|
||||||
|
$contenu = "Bonjour $gecos,\n\n";
|
||||||
|
$contenu .= "Un nouveau compte vient d'être créé pour vous.\n";
|
||||||
|
$contenu .= "Votre identifiant est : $unixlogin\n";
|
||||||
|
$contenu .= "Votre mot de passe : " .$pass. "\n\n";
|
||||||
|
$contenu .= "Cordialement,\n";
|
||||||
|
$contenu .= "--\nL'équipe informatique";
|
||||||
|
mail($to,$sujet,$contenu,$entete);
|
||||||
|
}
|
||||||
|
|
||||||
|
// classic domain notification
|
||||||
|
// (you can customize it in hook.php)
|
||||||
|
function domainnotify($domain) {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
//mail de notification
|
||||||
|
$sujet = "Creation du domaine $domain" ;
|
||||||
|
$to = $conf['admin']['mail'];
|
||||||
|
|
||||||
|
$entete = "From: ".$conf['admin']['mail']."\n";
|
||||||
|
$entete .= "MIME-Version: 1.0\n";
|
||||||
|
$entete .= "Content-type: text/plain; charset=utf-8\n";
|
||||||
|
$entete .= "Content-Transfer-Encoding: quoted-printable\n";
|
||||||
|
|
||||||
|
$contenu = "Bonjour,\n\n";
|
||||||
|
$contenu .= "Un nouveau domaine vient d'être créé : $domain\n";
|
||||||
|
$contenu .= "Assurez vous bien que la configuration DNS et MX\n";
|
||||||
|
$contenu .= "soit bien en place.\n\n";
|
||||||
|
$contenu .= "Cordialement,\n";
|
||||||
|
$contenu .= "--\nL'équipe informatique";
|
||||||
|
mail($to,$sujet,$contenu,$entete);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
21
evoadmin/htdocs/inc/login.js
Executable file
21
evoadmin/htdocs/inc/login.js
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
<script language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
|
||||||
|
function submit_login()
|
||||||
|
{
|
||||||
|
if (document.auth.login.value == "") {
|
||||||
|
alert('Veuillez entrer votre nom de connexion et votre mot de passe');
|
||||||
|
document.auth.login.focus();
|
||||||
|
return false;
|
||||||
|
} else if (document.auth.password.value == "") {
|
||||||
|
alert('Veuillez entrer votre nom de connexion et votre mot de passe');
|
||||||
|
document.auth.password.focus();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
76
evoadmin/htdocs/inc/style.css
Executable file
76
evoadmin/htdocs/inc/style.css
Executable file
|
@ -0,0 +1,76 @@
|
||||||
|
body {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Form styles. */
|
||||||
|
/* from Horde3 */
|
||||||
|
input, select, textarea {
|
||||||
|
font-family: Geneva, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #000;
|
||||||
|
background-color: #f3f3f9;
|
||||||
|
border: 1px solid #669;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus, textarea:focus {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #99f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button, .button:focus {
|
||||||
|
background-color: #339;
|
||||||
|
border-bottom: 1px solid #333;
|
||||||
|
border-right: 1px solid #000;
|
||||||
|
border-left: 1px solid #C4C4B8;
|
||||||
|
border-top: 1px solid #C4C4B8;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
background-color: #66a;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.login {
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
color: #666;
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
background-color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.display {
|
||||||
|
background-color: #ddd;
|
||||||
|
text-align: center;
|
||||||
|
color: red;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.error {
|
||||||
|
background-color: #999;
|
||||||
|
color: red;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.italic {
|
||||||
|
font-style: italic
|
||||||
|
}
|
||||||
|
|
||||||
|
.strong {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
BIN
evoadmin/htdocs/inc/suppr.png
Executable file
BIN
evoadmin/htdocs/inc/suppr.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 917 B |
19
evoadmin/htdocs/index.php
Executable file
19
evoadmin/htdocs/index.php
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* common DirectoryIndex page
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: index.php,v 1.2 2006-11-14 15:21:54 reg Exp $
|
||||||
|
*
|
||||||
|
* Use HTTP 'Location:' header to forward to auth.php
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
header("Location: auth.php\n\n");
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
/* Copyright (c) 2004-2006 Evolix - Tous droits reserves */
|
||||||
|
?>
|
179
evoadmin/htdocs/superadmin.php
Executable file
179
evoadmin/htdocs/superadmin.php
Executable file
|
@ -0,0 +1,179 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listing of all domains
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2006 Evolix - Tous droits reserves
|
||||||
|
* $Id: superadmin.php,v 1.12 2009-09-02 17:22:13 gcolpart Exp $
|
||||||
|
*
|
||||||
|
* @author Gregory Colpart <reg@evolix.fr>
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show domain details
|
||||||
|
* @param string $domain
|
||||||
|
* @return NULL
|
||||||
|
*/
|
||||||
|
function show_domaine_details($domain) {
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
print '<tr><td><a href="admin.php?domain='
|
||||||
|
.$domain. '">' .$domain. '</a></td>';
|
||||||
|
|
||||||
|
// TODO : synchronization OpenLDAP<-Active Directory
|
||||||
|
print '<td>N/A</td>';
|
||||||
|
print '<td><b>' .getnumber($domain,'compte'). '</b></td>';
|
||||||
|
print '<td><b>' .getnumber($domain,'mail'). '</b></td>';
|
||||||
|
print '<td><b>' .getnumber($domain,'smb'). '</b></td>';
|
||||||
|
print '<td><b>' .getnumber($domain,'alias'). '</b></td>';
|
||||||
|
print '<td>' .getquota($domain,'group'). '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
|
||||||
|
// suppression possible que si utilisation de LDAP
|
||||||
|
if ( $conf['domaines']['driver'] == 'ldap' ) {
|
||||||
|
print '<a href="domaine.php?del=' .$domain. '">
|
||||||
|
<img src="inc/suppr.png" /></a>';
|
||||||
|
} else {
|
||||||
|
print "Impossible";
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path
|
||||||
|
*/
|
||||||
|
define('EVOADMIN_BASE','./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP cookies session
|
||||||
|
*/
|
||||||
|
session_name('EVOADMIN_SESS');
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (isset($_SESSION['login'])) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires
|
||||||
|
*/
|
||||||
|
require_once EVOADMIN_BASE . 'common.php';
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'haut.php';
|
||||||
|
|
||||||
|
$login = $_SESSION['login'];
|
||||||
|
|
||||||
|
// pas de domaine/variable domaine sur superadmin.php
|
||||||
|
unset($_SESSION['domain']);
|
||||||
|
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
// array with all domains with rights on
|
||||||
|
$domaines = array();
|
||||||
|
|
||||||
|
// If you are superadmin, you view all domains
|
||||||
|
if (superadmin($login)) {
|
||||||
|
|
||||||
|
// driver 'ldap'
|
||||||
|
if ( $conf['domaines']['driver'] == 'ldap' ) {
|
||||||
|
|
||||||
|
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN,LDAP_ADMIN_PASS);
|
||||||
|
|
||||||
|
if ($ldapconn) {
|
||||||
|
|
||||||
|
// compatibilite anciens schemas
|
||||||
|
if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
$filter="(objectClass=ldapDomain)";
|
||||||
|
} else {
|
||||||
|
$filter="(objectClass=postfixDomain)";
|
||||||
|
}
|
||||||
|
$sr=ldap_search($ldapconn, LDAP_BASE, $filter);
|
||||||
|
$info = ldap_get_entries($ldapconn, $sr);
|
||||||
|
|
||||||
|
for ($i=0;$i<$info["count"];$i++) {
|
||||||
|
// compatibilite anciens schemas
|
||||||
|
if ($conf['evoadmin']['version'] == 1) {
|
||||||
|
array_push($domaines,$info[$i]["domain"][0]);
|
||||||
|
} else {
|
||||||
|
array_push($domaines,$info[$i]["cn"][0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ldap_unbind($ldapconn);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "<p class='error'>Erreur de connexion : $ldapconn</p>";
|
||||||
|
EvoLog::log("LDAP connection failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// driver 'file'
|
||||||
|
} elseif ( $conf['domaines']['driver'] == 'file' ) {
|
||||||
|
|
||||||
|
$domaines = $conf['domaines']['file']['all'];
|
||||||
|
}
|
||||||
|
// If you are not superadmin...
|
||||||
|
} elseif ( $conf['domaines']['driver'] == 'file' ) {
|
||||||
|
// you view all if using driver 'file'
|
||||||
|
$domaines = $conf['domaines']['file']['all'];
|
||||||
|
} elseif ( $conf['domaines']['driver'] == 'ldap' ) {
|
||||||
|
// you view only your domain if using driver 'ldap'
|
||||||
|
// we select domain in your DN
|
||||||
|
// thanks to http://www.physiol.ox.ac.uk/~trp/regexp.html
|
||||||
|
$mydomain = preg_replace("/uid=" .$login. ",domain=((?:(?:[0-9a-zA-Z_\-]+)\.){1,}(?:[0-9a-zA-Z_\-]+)),"
|
||||||
|
. LDAP_BASE ."/","$1",$_SESSION['dn']);
|
||||||
|
array_push($domaines,$mydomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
// alphanumerique sort before displaying domains
|
||||||
|
sort($domaines);
|
||||||
|
|
||||||
|
include EVOADMIN_BASE . 'debut.php';
|
||||||
|
|
||||||
|
// with driver 'ldap', we can add a domain
|
||||||
|
// TODO : retrict to superadmin guys
|
||||||
|
if ( $conf['domaines']['driver'] == 'ldap' ) {
|
||||||
|
print '<p><a href="domaine.php">
|
||||||
|
Ajouter un domaine...</a></p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<center>
|
||||||
|
<h4>Liste des domaines administrables :</h4>
|
||||||
|
|
||||||
|
<table width="500px" bgcolor="#ddd" border="1">
|
||||||
|
<tr>
|
||||||
|
<td><strong>Nom du domaine</strong></td>
|
||||||
|
<td>Synchro AD/LDAP</td>
|
||||||
|
<td>Nombre de comptes</td>
|
||||||
|
<td>dont comptes mail</td>
|
||||||
|
<td>dont comptes Samba</td>
|
||||||
|
<td>Nombre d'alias mail</td>
|
||||||
|
<td>Taille/Quota</td>
|
||||||
|
<td>Suppression du domaine</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// lignes avec les details sur les domaines
|
||||||
|
foreach ($domaines as $domaine) {
|
||||||
|
show_domaine_details($domaine);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table></center>';
|
||||||
|
print '<br />';
|
||||||
|
|
||||||
|
//if (isset($_SESSION['login']))
|
||||||
|
} else {
|
||||||
|
|
||||||
|
header("location: auth.php\n\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
include(EVOADMIN_BASE . 'fin.php');
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in a new issue