1 |
<?php /* |
<?php /* |
2 |
LuDAP : Lightweight Users Directory Administration Protocol |
LuDAP : Lightweight Users Directory Administration Protocol |
3 |
$Id$ |
$Header$ |
4 |
------------------------------------------------------------------------ |
------------------------------------------------------------------------ |
5 |
copyright (C) 2003 mose . mose@ludap.org |
copyright (C) 2003 mose . mose@ludap.org |
6 |
copyright (C) 2001, 2002 mose, makina corpus . mose@makina-corpus.org |
copyright (C) 2001, 2002 mose, makina corpus . mose@makina-corpus.org |
19 |
the Free Software Foundation, Inc., |
the Free Software Foundation, Inc., |
20 |
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
------------------------------------------------------------------------ |
------------------------------------------------------------------------ |
|
file: index.php |
|
|
description: main processing file for LuDAP |
|
22 |
*/ |
*/ |
23 |
|
|
24 |
|
/** |
25 |
|
* \brief main LuDAP page |
26 |
|
* That file is the only that can be used by the web server |
27 |
|
* directly, all the others are included. |
28 |
|
* \file index.php |
29 |
|
* \author mose@ludap.org |
30 |
|
*/ |
31 |
|
|
32 |
if (!function_exists("ldap_connect")) { |
require('setup.php'); |
33 |
if (!extension_loaded('ldap')) { |
require('auth.php'); |
|
if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) { |
|
|
$dllso = "ldap.dll"; |
|
|
} else { |
|
|
$dllso = "ldap.so"; |
|
|
} |
|
|
if (!dl($dllso)) die("LDAP support not compiled in PHP, and dynamic LDAP module $ddlso unable to load."); |
|
|
} else { |
|
|
die("LDAP module found, but not working."); |
|
|
} |
|
|
} |
|
34 |
|
|
35 |
include 'ludap.lib.php'; |
$conn = ldap_connect($conf['ludap']['host']) or die("Impossible to connect LDAP server at ".$conf['ludap']['host']); |
36 |
$ludap_version = "0.5"; |
ldap_bind($conn,$conf['ludap']['baseattr']."=".utf8_encode($_SESSION['me']).", ".$conf['ludap']['basedn'],$_SESSION['pass']); |
|
$ludap_conf = '/etc/ludap.conf'; |
|
|
$conf = readconf($ludap_conf); |
|
|
|
|
|
include './auth.php'; |
|
37 |
|
|
38 |
/* variables setup */ |
/* variables setup */ |
39 |
if (!$sort and !$rsort) $sort = $conf['ludap']['baseattr']; |
if (!$sort and !$rsort) $sort = $conf['ludap']['baseattr']; |
54 |
$search = "(".$conf['ludap']['baseattr']."=*)"; |
$search = "(".$conf['ludap']['baseattr']."=*)"; |
55 |
$mquery = ''; |
$mquery = ''; |
56 |
} |
} |
|
|
|
|
|
|
|
$conn = ldap_connect($conf['ludap']['host']) or die("Impossible to connect LDAP server at ".$conf['ludap']['host']); |
|
|
$r = ldap_bind($conn,$conf['ludap']['baseattr']."=".utf8_encode($me).", ".$conf['ludap']['basedn'],$pass); |
|
|
|
|
57 |
$in = $info = $output = $outgood = ''; |
$in = $info = $output = $outgood = ''; |
58 |
|
|
59 |
if ($uid) { |
if ($id) { |
60 |
if ($action == 'save') { |
if ($action == 'save') { |
61 |
$inst = write_uid($fes); |
$inst = $ludap->write_id($fes); |
62 |
if (is_array($inst)) { |
if (is_array($inst)) { |
63 |
$view = 'form'; |
$view = 'form'; |
64 |
$uid = ''; |
$id = ''; |
65 |
$output = $inst; |
$output = $inst; |
66 |
} elseif ($inst) { |
} elseif ($inst) { |
67 |
$uid = $fes[uid]; |
$id = $fes[id]; |
68 |
$outgood[] = $inst; |
$outgood[] = $inst; |
69 |
$action = 'modify'; |
$action = 'modify'; |
70 |
} |
} |
71 |
} |
} |
72 |
|
|
73 |
if ($action == 'modify') { |
if ($action == 'modify') { |
74 |
$prov = get_uid($uid); |
$prov = $ludap->get_id($id); |
75 |
$minst = write_all($fes); |
$minst = $ludap->write_all($fes); |
76 |
if (is_array($minst)) { |
if (is_array($minst)) { |
77 |
$view = 'form'; |
$view = 'form'; |
78 |
$output = $minst; |
$output = $minst; |
80 |
$outgood[] = $minst; |
$outgood[] = $minst; |
81 |
} |
} |
82 |
} elseif ($delgp) { |
} elseif ($delgp) { |
83 |
$delit = array( $conf['ludap']['groupattr'] => $conf['ludap']['baseattr']."=".$uid.",".$conf['ludap']['basedn']); |
$delit = array( $conf['ludap']['groupattr'] => $conf['ludap']['baseattr']."=".$id.",".$conf['ludap']['basedn']); |
84 |
$groupdn = "{$conf['ludap']['membattr']}=$delgp,{$conf['ludap']['groupdn']}"; |
$groupdn = "{$conf['ludap']['membattr']}=$delgp,{$conf['ludap']['groupdn']}"; |
85 |
if (ldap_mod_del($conn,$groupdn,$delit)) { |
if (ldap_mod_del($conn,$groupdn,$delit)) { |
86 |
$outgood[] = "$uid effacé du groupe $delgp."; |
$outgood[] = "$id effacé du groupe $delgp."; |
87 |
} else { |
} else { |
88 |
$output[] = "Effacement de $uid du groupe $delgp impossible.<br>$groupdn<br>".print_r($delit); |
$output[] = "Effacement de $id du groupe $delgp impossible.<br>$groupdn<br>".print_r($delit); |
89 |
} |
} |
90 |
// ROU 20030303 Suppression d'une adresse email |
// ROU 20030303 Suppression d'une adresse email |
91 |
} elseif ($delmail) { |
} elseif ($delmail) { |
92 |
$delit = array( $conf['ludap']['mailattr'] => $delmail); |
$delit = array( $conf['ludap']['mailattr'] => $delmail); |
93 |
$maildn = "{$conf['ludap']['membattr']}=$uid,{$conf['ludap']['maildn']}"; |
$maildn = "{$conf['ludap']['membattr']}=$id,{$conf['ludap']['maildn']}"; |
94 |
if (ldap_mod_del($conn,$maildn,$delit)) { |
if (ldap_mod_del($conn,$maildn,$delit)) { |
95 |
$outgood[] = "Adresse email $delmail effacé pour l'utilisateur $uid."; |
$outgood[] = "Adresse email $delmail effacé pour l'utilisateur $id."; |
96 |
} else { |
} else { |
97 |
$output[] = "Effacement de l'adresse email $delmail pour l'utilisateur $uid impossible.<br>$maildn<br>".print_r($delit); |
$output[] = "Effacement de l'adresse email $delmail pour l'utilisateur $id impossible.<br>$maildn<br>".print_r($delit); |
98 |
} |
} |
99 |
// ROU 20030303 |
// ROU 20030303 |
100 |
} elseif ($action == 'newgroup') { |
} elseif ($action == 'newgroup') { |
101 |
if ($addgp and ($addgp != 'new')) { |
if ($addgp and ($addgp != 'new')) { |
102 |
$groupdn = "{$conf['ludap']['membattr']}=".utf8_encode($addgp).",{$conf['ludap']['groupdn']}"; |
$groupdn = "{$conf['ludap']['membattr']}=".utf8_encode($addgp).",{$conf['ludap']['groupdn']}"; |
103 |
$addit = array( $conf['ludap']['groupattr'] => $conf['ludap']['baseattr']."=".$uid.",".$conf['ludap']['basedn']); |
$addit = array( $conf['ludap']['groupattr'] => $conf['ludap']['baseattr']."=".$id.",".$conf['ludap']['basedn']); |
104 |
if (ldap_mod_add($conn,$groupdn,$addit)) { |
if (ldap_mod_add($conn,$groupdn,$addit)) { |
105 |
$outgood[] = "$uid ajouté au groupe $addgp."; |
$outgood[] = "$id ajouté au groupe $addgp."; |
106 |
} else { |
} else { |
107 |
$output[] = "Ajout de $uid dans le groupe $addgp impossible."; |
$output[] = "Ajout de $id dans le groupe $addgp impossible."; |
108 |
} |
} |
109 |
} |
} |
110 |
// ROU 20030303 Ajout d'une adresse mail |
// ROU 20030303 Ajout d'une adresse mail |
111 |
} elseif (($action == 'addmail') and $addmail) { |
} elseif (($action == 'addmail') and $addmail) { |
112 |
$i = ldap_search($conn,$conf['ludap']['maildn'],"cn=$uid"); |
$i = ldap_search($conn,$conf['ludap']['maildn'],"cn=$id"); |
113 |
$info = ldap_get_entries($conn,$i); |
$info = ldap_get_entries($conn,$i); |
114 |
if ($info['count'] < 1) { |
if ($info['count'] < 1) { |
115 |
$entrydn = "{$conf['ludap']['membattr']}=".utf8_encode($uid).",{$conf['ludap']['maildn']}"; |
$entrydn = "{$conf['ludap']['membattr']}=".utf8_encode($id).",{$conf['ludap']['maildn']}"; |
116 |
$objClasses = split(',',$conf['ludap']['mailobj']); |
$objClasses = split(',',$conf['ludap']['mailobj']); |
117 |
foreach ($objClasses as $objClass) { |
foreach ($objClasses as $objClass) { |
118 |
$entry["objectclass"][] = $objClass; |
$entry["objectclass"][] = $objClass; |
119 |
} |
} |
120 |
$entry["{$conf['ludap']['membattr']}"] = utf8_encode($uid); |
$entry["{$conf['ludap']['membattr']}"] = utf8_encode($id); |
121 |
$entry["{$conf['ludap']['mailattr']}"] = utf8_encode($addmail); |
$entry["{$conf['ludap']['mailattr']}"] = utf8_encode($addmail); |
122 |
if (ldap_add($conn,$entrydn,$entry)) { |
if (ldap_add($conn,$entrydn,$entry)) { |
123 |
$outgood[] = "Adresse email $addmail ajoutée."; |
$outgood[] = "Adresse email $addmail ajoutée."; |
125 |
$output[] = "Ajout de l'adresse email $addmail impossible.$maildn".print_r($addit); |
$output[] = "Ajout de l'adresse email $addmail impossible.$maildn".print_r($addit); |
126 |
} |
} |
127 |
} else { |
} else { |
128 |
$maildn = "{$conf['ludap']['membattr']}=".$uid.",{$conf['ludap']['maildn']}"; |
$maildn = "{$conf['ludap']['membattr']}=".$id.",{$conf['ludap']['maildn']}"; |
129 |
$addit["{$conf['ludap']['mailattr']}"] = utf8_encode($addmail); |
$addit["{$conf['ludap']['mailattr']}"] = utf8_encode($addmail); |
130 |
if (ldap_mod_add($conn,$maildn,$addit)) { |
if (ldap_mod_add($conn,$maildn,$addit)) { |
131 |
$outgood[] = "Adresse email $addmail ajoutée."; |
$outgood[] = "Adresse email $addmail ajoutée."; |
141 |
$addit["objectclass"][] = $ps; |
$addit["objectclass"][] = $ps; |
142 |
} |
} |
143 |
$addit["{$conf['ludap']['membattr']}"] = utf8_encode($addgroup); |
$addit["{$conf['ludap']['membattr']}"] = utf8_encode($addgroup); |
144 |
$addit["{$conf['ludap']['groupattr']}"] = $conf['ludap']['baseattr']."=".$uid.",".$conf['ludap']['basedn']; |
$addit["{$conf['ludap']['groupattr']}"] = $conf['ludap']['baseattr']."=".$id.",".$conf['ludap']['basedn']; |
145 |
if (ldap_add($conn,$groupdn,$addit)) { |
if (ldap_add($conn,$groupdn,$addit)) { |
146 |
$outgood[] = "Groupe $addgroup créé."; |
$outgood[] = "Groupe $addgroup créé."; |
147 |
} else { |
} else { |
149 |
} |
} |
150 |
} |
} |
151 |
|
|
152 |
$fres = get_uid($uid); |
$fres = $ludap->get_id($id); |
153 |
$f_gps = get_groups($uid); |
$f_gps = $ludap->get_groups($id); |
154 |
$f_mails = get_mails($uid); |
$f_mails = $ludap->get_mails($id); |
155 |
} else { |
} else { |
156 |
if ($action == 'del') { |
if ($action == 'del') { |
157 |
if ($confirm_action == 'yes') { |
if ($confirm_action == 'yes') { |
158 |
if (ldap_delete($conn,$conf['ludap']['baseattr']."=".$deluid.",".$conf['ludap']['basedn'])) { |
if (ldap_delete($conn,$conf['ludap']['baseattr']."=".$delid.",".$conf['ludap']['basedn'])) { |
159 |
$outgood[] = "$deluid deleted."; |
$outgood[] = "$delid deleted."; |
160 |
} else { |
} else { |
161 |
$output[] = "Effacement $deluid Impossible."; |
$output[] = "Effacement $delid Impossible."; |
162 |
} |
} |
163 |
} else { |
} else { |
164 |
$output[] =<<<_END_ |
$output[] =<<<_END_ |
165 |
<form action=$PHP_SELF method=post> |
<form action=$PHP_SELF method=post> |
166 |
Etes-vous sur/e de vouloir effacer $deluid ? |
Etes-vous sur/e de vouloir effacer $delid ? |
167 |
<input type=hidden name=deluid value='$deluid'> |
<input type=hidden name=delid value='$delid'> |
168 |
<input type=hidden name=action value='del'> |
<input type=hidden name=action value='del'> |
169 |
<input type=submit name=confirm_action value=yes class=act><br></form> |
<input type=submit name=confirm_action value=yes class=act><br></form> |
170 |
_END_; |
_END_; |
189 |
_END_; |
_END_; |
190 |
} |
} |
191 |
} |
} |
192 |
// ROU 20030303 |
|
193 |
// ROU 20030303 Création d'une boite cyrus - Confirmation obligatoire |
// ROU 20030303 Création d'une boite cyrus - Confirmation obligatoire |
194 |
elseif ($action == 'cyrusadd') { |
elseif ($action == 'cyrusadd') { |
195 |
system("/usr/local/bin/cyrusadd $cyruid"); |
system("/usr/local/bin/cyrusadd $cyruid"); |
199 |
$output[] = "Création du compte cyrus pour $cyruid Impossible."; |
$output[] = "Création du compte cyrus pour $cyruid Impossible."; |
200 |
} |
} |
201 |
} |
} |
202 |
// ROU 20030303 |
|
203 |
$sr = ldap_search($conn,$conf['ludap']['basedn'],$search,split(",",$conf["ludap"]["listattr"])); |
$sr = ldap_search($conn,$conf['ludap']['basedn'],$search,split(",",$conf["ludap"]["listattr"])); |
204 |
$info = ldap_get_entries($conn,$sr); |
$info = ldap_get_entries($conn,$sr); |
205 |
if ($info[count] == 1) { |
if ($info[count] == 1) { |
206 |
$uid = $info[0]["uid"][0]; |
$id = $info[0]["id"][0]; |
207 |
$fres = get_uid($uid); |
$fres = $ludap->get_id($id); |
208 |
$f_gps = get_groups($uid); |
$f_gps = $ludap->get_groups($id); |
209 |
#$mquery = ''; |
#$mquery = ''; |
210 |
$outgood[] = "Une réponse unique correspond à votre recherche."; |
$outgood[] = "Une réponse unique correspond à votre recherche."; |
211 |
} |
} |
237 |
<? if ($admin) { ?> |
<? if ($admin) { ?> |
238 |
<? if ($am) { ?> |
<? if ($am) { ?> |
239 |
<a href="<?=$PHP_SELF?>?view=form" class="act">NOUVEAU</a> |
<a href="<?=$PHP_SELF?>?view=form" class="act">NOUVEAU</a> |
240 |
<a href="<?=$PHP_SELF?>?<?=($uid)?"uid=$uid&":"";?>amode=off<?=$mquery?>" class="act">NON-ADMIN</a> |
<a href="<?=$PHP_SELF?>?<?=($id)?"id=$id&":"";?>amode=off<?=$mquery?>" class="act">NON-ADMIN</a> |
241 |
<? } else { ?> |
<? } else { ?> |
242 |
<a href="<?=$PHP_SELF?>?<?=($uid)?"uid=$uid&":"";?>amode=on<?=$mquery?>" class="act">ADMIN</a> |
<a href="<?=$PHP_SELF?>?<?=($id)?"id=$id&":"";?>amode=on<?=$mquery?>" class="act">ADMIN</a> |
243 |
<? } } ?> |
<? } } ?> |
244 |
<a href="<?=$PHP_SELF?>?view=xml<?=$mquery?>" class="act">XML</a> |
<a href="<?=$PHP_SELF?>?view=xml<?=$mquery?>" class="act">XML</a> |
245 |
<a href="<?="$PHP_SELF?uid=$me".$mquery;?>" class="act"><?=strtoupper($me)?></a> |
<a href="<?="$PHP_SELF?id=$me".$mquery;?>" class="act"><?=strtoupper($me)?></a> |
246 |
<a href="index.php?logout=1" class="act">LOGOUT</a> |
<a href="index.php?logout=1" class="act">LOGOUT</a> |
247 |
</div> |
</div> |
248 |
<form name="search" id="search" action="<?=$PHP_SELF?>" method="get"> |
<form name="search" id="search" action="<?=$PHP_SELF?>" method="get"> |
262 |
if ($view == "form") { |
if ($view == "form") { |
263 |
echo '<div><form class="area" action="index.php" ENCTYPE="multipart/form-data" method="post">'; |
echo '<div><form class="area" action="index.php" ENCTYPE="multipart/form-data" method="post">'; |
264 |
echo '<input type="hidden" name="action" value="save">'; |
echo '<input type="hidden" name="action" value="save">'; |
265 |
if ($uid) { |
if ($id) { |
266 |
echo '<input type="hidden" name="action" value="modify">'; |
echo '<input type="hidden" name="action" value="modify">'; |
267 |
echo '<input type="hidden" name="uid" value="'.$fres[uid].'">'; |
echo '<input type="hidden" name="id" value="'.$fres['id'].'">'; |
268 |
} else { |
} else { |
269 |
echo '<input type="hidden" name="action" value="save">'; |
echo '<input type="hidden" name="action" value="save">'; |
270 |
$fres = $fes; |
$fres = $fes; |
271 |
} |
} |
272 |
echo '<table border="0" cellpadding="2" cellspacing="0" class="tabled">'; |
echo '<table border="0" cellpadding="2" cellspacing="0" class="tabled">'; |
273 |
echo "<tr><td class=firstline><a href=index.php?uid=$uid class=act>RETOUR</a></td>"; |
echo "<tr><td class=firstline><a href=index.php?id=".$fres['id']." class=act>RETOUR</a></td>"; |
274 |
echo "<td class=firstline><input type=submit name=ac value='Enregistrer' class=act style=float:right;>"; |
echo "<td class=firstline><input type=submit name=ac value='Enregistrer' class=act style=float:right;>"; |
275 |
echo "<input type=reset name=re value='Recommencer' class=act>"; |
echo "<input type=reset name=re value='Recommencer' class=act>"; |
276 |
echo "</td></tr>\n"; |
echo "</td></tr>\n"; |
289 |
echo "<td class=clabel$ncl><input type=password size='$size' name='fes[$clabel][1]' value='' class=acto></td></tr>"; |
echo "<td class=clabel$ncl><input type=password size='$size' name='fes[$clabel][1]' value='' class=acto></td></tr>"; |
290 |
echo "<tr><td class=clabel$ncl>Confirmation</td>"; |
echo "<tr><td class=clabel$ncl>Confirmation</td>"; |
291 |
echo "<td class=clabel$ncl><input type=password size='$size' name='fes[$clabel][2]' value='' class=acto></td></tr>"; |
echo "<td class=clabel$ncl><input type=password size='$size' name='fes[$clabel][2]' value='' class=acto></td></tr>"; |
292 |
} elseif ((($ntype == "noedit") or ($ntype == "primary")) and $uid) { |
} elseif ((($ntype == "noedit") or ($ntype == "primary")) and $id) { |
293 |
echo "<td class=clabel$ncl><div class=actno>$fres[$clabel]</div></td></tr>"; |
echo "<td class=clabel$ncl><div class=actno>$fres[$clabel]</div></td></tr>"; |
294 |
if ($ntype == "primary") { |
if ($ntype == "primary") { |
295 |
echo "<input type=hidden name='fes[$clabel]' value='".$fres[$clabel]."'>"; |
echo "<input type=hidden name='fes[$clabel]' value='".$fres[$clabel]."'>"; |
375 |
} |
} |
376 |
/* |
/* |
377 |
$buffer.= "<Contact FullName=\"$info[$n][$clabel]name\" Company=\"$f_company\" HomePhone=\"$f_homephone\" "; |
$buffer.= "<Contact FullName=\"$info[$n][$clabel]name\" Company=\"$f_company\" HomePhone=\"$f_homephone\" "; |
378 |
$buffer.= "FirstName=\"$f_firstname\" BusinessPhone=\"$f_workphone\" FileAs=\"$f_uid\" "; |
$buffer.= "FirstName=\"$f_firstname\" BusinessPhone=\"$f_workphone\" FileAs=\"$f_id\" "; |
379 |
$buffer.= "LastName=\"$f_lastname\" BusinessStreet=\"$f_where\" DefaultEmail=\"$f_mail\" />\n"; |
$buffer.= "LastName=\"$f_lastname\" BusinessStreet=\"$f_where\" DefaultEmail=\"$f_mail\" />\n"; |
380 |
*/ |
*/ |
381 |
$buffer.= "</liste>\n\n</ldaplist>\n"; |
$buffer.= "</liste>\n\n</ldaplist>\n"; |
390 |
$buffer.= 'HomePhone="'.utf8_decode($info[$n][homephone][0]).'" '; |
$buffer.= 'HomePhone="'.utf8_decode($info[$n][homephone][0]).'" '; |
391 |
$buffer.= 'FirstName="'.utf8_decode($info[$n][givenname][0]).'" '; |
$buffer.= 'FirstName="'.utf8_decode($info[$n][givenname][0]).'" '; |
392 |
$buffer.= 'BusinessPhone="'.utf8_decode($info[$n][telephonenumber][0]).'" '; |
$buffer.= 'BusinessPhone="'.utf8_decode($info[$n][telephonenumber][0]).'" '; |
393 |
$buffer.= 'FileAs="'.utf8_decode($info[$n][uid][0]).'" '; |
$buffer.= 'FileAs="'.utf8_decode($info[$n][id][0]).'" '; |
394 |
$buffer.= 'LastName="'.utf8_decode($info[$n][sn][0]).'" '; |
$buffer.= 'LastName="'.utf8_decode($info[$n][sn][0]).'" '; |
395 |
$buffer.= 'BusinessStreet="'.utf8_decode($info[$n][postaladdress][0]).' - '.$info[$n][l][0].'" '; |
$buffer.= 'BusinessStreet="'.utf8_decode($info[$n][postaladdress][0]).' - '.$info[$n][l][0].'" '; |
396 |
$buffer.= 'DefaultEmail="'.utf8_decode($info[$n][mail][0]).'" />'."\n"; |
$buffer.= 'DefaultEmail="'.utf8_decode($info[$n][mail][0]).'" />'."\n"; |
402 |
echo "</div>"; |
echo "</div>"; |
403 |
} else { |
} else { |
404 |
|
|
405 |
if ($uid) { |
if ($id) { |
406 |
echo '<div class="area">'; |
echo '<div class="area">'; |
407 |
echo "<div class=area2 style=float:right;>"; |
echo "<div class=area2 style=float:right;>"; |
408 |
echo "<div class=note>Groupes</div>"; |
echo "<div class=note>Groupes</div>"; |
409 |
if (($admin) && ($am)) { |
if (($admin) && ($am)) { |
410 |
echo "<form>"; |
echo "<form>"; |
411 |
echo "<input type=hidden name=uid value='$uid'>"; |
echo "<input type=hidden name=id value='$id'>"; |
412 |
echo "<input type=hidden name=searchx value='$searchx'>"; |
echo "<input type=hidden name=searchx value='$searchx'>"; |
413 |
if ($action == 'newgroup') { |
if ($action == 'newgroup') { |
414 |
echo "<input type=hidden name=action value='addgroup'>"; |
echo "<input type=hidden name=action value='addgroup'>"; |
417 |
echo "<input type=hidden name=action value='newgroup'>"; |
echo "<input type=hidden name=action value='newgroup'>"; |
418 |
echo "<select name=addgp class=acto style=padding:0;>"; |
echo "<select name=addgp class=acto style=padding:0;>"; |
419 |
echo "<option value='' style=background-color:#aaaaaa;font-style:italic;>Choisir un groupe</option>\n"; |
echo "<option value='' style=background-color:#aaaaaa;font-style:italic;>Choisir un groupe</option>\n"; |
420 |
$allgps = get_groups(); |
$allgps = $ludap->get_groups(); |
421 |
if (is_array($allgps)) { |
if (is_array($allgps)) { |
422 |
foreach ($allgps as $gp) { |
foreach ($allgps as $gp) { |
423 |
if (!is_array($f_gps) or !in_array($gp,$f_gps)) { |
if (!is_array($f_gps) or !in_array($gp,$f_gps)) { |
436 |
if (is_array($f_gps)) { |
if (is_array($f_gps)) { |
437 |
foreach ($f_gps as $gp) { |
foreach ($f_gps as $gp) { |
438 |
echo "<div style='margin:0px;padding:2px;'>"; |
echo "<div style='margin:0px;padding:2px;'>"; |
439 |
if (($uid == $me) || (($admin) && ($am))) { |
if (($id == $me) || (($admin) && ($am))) { |
440 |
echo "<a href='$PHP_SELF?uid=$uid&delgp=".urlencode($gp)."$mquery' style='font-weight:bold;color:#429262;margin-right:7px;float:left;clear:all;'>x</a>"; |
echo "<a href='$PHP_SELF?id=$id&delgp=".urlencode($gp)."$mquery' style='font-weight:bold;color:#429262;margin-right:7px;float:left;clear:all;'>x</a>"; |
441 |
} |
} |
442 |
echo "<a href='$PHP_SELF?uid=$uid&showgp=".urlencode($gp)."$mquery' class='act'"; |
echo "<a href='$PHP_SELF?id=$id&showgp=".urlencode($gp)."$mquery' class='act'"; |
443 |
if ($showgp == $gp) { |
if ($showgp == $gp) { |
444 |
echo " style='background-color:#ffffff;color:#002244'"; |
echo " style='background-color:#ffffff;color:#002244'"; |
445 |
} |
} |
450 |
if ($showgp) { |
if ($showgp) { |
451 |
echo "<div class=area2 style=float:right;margin-right:3px;width:120px;>"; |
echo "<div class=area2 style=float:right;margin-right:3px;width:120px;>"; |
452 |
echo "<div class=bar>Groupe $showgp</div>"; |
echo "<div class=bar>Groupe $showgp</div>"; |
453 |
$gpvar = get_gid($showgp); |
$gpvar = $ludap->get_gid($showgp); |
454 |
foreach ($gpvar as $inti=>$labe) { |
foreach ($gpvar as $inti=>$labe) { |
455 |
if (is_array($labe)) { |
if (is_array($labe)) { |
456 |
echo "<div class=headgp>$inti</div>"; |
echo "<div class=headgp>$inti</div>"; |
457 |
foreach ($labe as $la) { |
foreach ($labe as $la) { |
458 |
if (is_array($la)) { |
if (is_array($la)) { |
459 |
echo "<div class=listgp><a href=$PHP_SELF?uid=$la[2]$mquery>$la[2]</a></div>"; |
echo "<div class=listgp><a href=$PHP_SELF?id=$la[2]$mquery>$la[2]</a></div>"; |
460 |
} else { |
} else { |
461 |
echo "<div class=listgp>$la</div>"; |
echo "<div class=listgp>$la</div>"; |
462 |
} |
} |
472 |
echo "<div class=note>Mails</div>"; |
echo "<div class=note>Mails</div>"; |
473 |
if (($admin) && ($am)) { |
if (($admin) && ($am)) { |
474 |
echo "<form>"; |
echo "<form>"; |
475 |
echo "<input type=hidden name=uid value='$uid'>"; |
echo "<input type=hidden name=id value='$id'>"; |
476 |
echo "<input type=hidden name=searchx value='$searchx'>"; |
echo "<input type=hidden name=searchx value='$searchx'>"; |
477 |
echo "<input type=hidden name=action value='addmail'>"; |
echo "<input type=hidden name=action value='addmail'>"; |
478 |
echo "<input type=text name=addmail value='' size=12 class=acto><br/>"; |
echo "<input type=text name=addmail value='' size=12 class=acto><br/>"; |
482 |
if (is_array($f_mails)) { |
if (is_array($f_mails)) { |
483 |
foreach ($f_mails as $mail) { |
foreach ($f_mails as $mail) { |
484 |
echo "<div style='margin:0px;padding:2px;'>"; |
echo "<div style='margin:0px;padding:2px;'>"; |
485 |
if (($uid == $me) || (($admin) && ($am))) { |
if (($id == $me) || (($admin) && ($am))) { |
486 |
echo "<a href='$PHP_SELF?uid=$uid&delmail=".urlencode($mail)."$mquery' style='font-weight:bold;color:#429262;margin-right:7px;float:left;clear:all;'>x</a>"; |
echo "<a href='$PHP_SELF?id=$id&delmail=".urlencode($mail)."$mquery' style='font-weight:bold;color:#429262;margin-right:7px;float:left;clear:all;'>x</a>"; |
487 |
} |
} |
488 |
echo "$mail</div>\n"; |
echo "$mail</div>\n"; |
489 |
} |
} |
493 |
echo "<table border=0 cellspacing=0 cellpadding=2 class=tabled>"; |
echo "<table border=0 cellspacing=0 cellpadding=2 class=tabled>"; |
494 |
echo '<tr><td class="firstline">'; |
echo '<tr><td class="firstline">'; |
495 |
echo "<a href=$PHP_SELF?$mquery class=act>RETOUR</a></td><td class='firstline' align=right>"; |
echo "<a href=$PHP_SELF?$mquery class=act>RETOUR</a></td><td class='firstline' align=right>"; |
496 |
if (($uid == $me) || (($admin) and ($am))) { |
if (($id == $me) || (($admin) and ($am))) { |
497 |
if ($uid == $me) $a = ''; |
if ($id == $me) $a = ''; |
498 |
echo "<a href=$PHP_SELF?view=form&uid=$fres[uid] class=act>EDITER</a>"; |
echo "<a href=$PHP_SELF?view=form&id=$fres[id] class=act>EDITER</a>"; |
499 |
} |
} |
500 |
echo " </td></tr>"; |
echo " </td></tr>"; |
501 |
$n = 0; |
$n = 0; |
518 |
} |
} |
519 |
echo '<tr><td class="lastline">'; |
echo '<tr><td class="lastline">'; |
520 |
echo "<a href=$PHP_SELF?$mquery class=act>RETOUR</a></td><td class='lastline' align=right>"; |
echo "<a href=$PHP_SELF?$mquery class=act>RETOUR</a></td><td class='lastline' align=right>"; |
521 |
if (($uid == $me) || (($admin) && ($am))) { |
if (($id == $me) || (($admin) && ($am))) { |
522 |
if ($uid == $me) $a = ''; |
if ($id == $me) $a = ''; |
523 |
echo "<a href=$PHP_SELF?view=form&uid=$fres[uid] class=act>EDITER</a>"; |
echo "<a href=$PHP_SELF?view=form&id=$fres[id] class=act>EDITER</a>"; |
524 |
} |
} |
525 |
echo " </td></tr></table>"; |
echo " </td></tr></table>"; |
526 |
} else { |
} else { |
568 |
$count = 0; |
$count = 0; |
569 |
for ($n = 0; $n < $info[count]; $n++) { |
for ($n = 0; $n < $info[count]; $n++) { |
570 |
// ROU 20030303 hack bidon pour ne pas afficher les listes |
// ROU 20030303 hack bidon pour ne pas afficher les listes |
571 |
if (strstr($inf[$n][uid],"anoncvs")) |
if (strstr($inf[$n][id],"anoncvs")) |
572 |
continue; |
continue; |
573 |
// ROU 20030303 |
// ROU 20030303 |
574 |
$ncl = $n%2; |
$ncl = $n%2; |
575 |
echo '<tR><td class="clabel'.$ncl.'" style="font-size:80%;padding-top:1px;"><div style="margin:2px;">'; |
echo '<tR><td class="clabel'.$ncl.'" style="font-size:80%;padding-top:1px;"><div style="margin:2px;">'; |
576 |
echo '<a href="index.php?uid='.$inf[$n][uid].$mquery.'" class="act">Afficher</a>'; |
echo '<a href="index.php?id='.$inf["$n"]['id'].$mquery.'" class="act">Afficher</a>'; |
577 |
if (($inf[$n][uid] == $me) or (($admin) && ($am))) { |
if (($inf["$n"]['id'] == $me) or (($admin) && ($am))) { |
578 |
if ($inf[$n][uid] == $me) $a = ''; |
if ($inf["$n"]['id'] == $me) $a = ''; |
579 |
else $a = 'a'; |
else $a = 'a'; |
580 |
if (($admin) && ($am)) { |
if (($admin) && ($am)) { |
581 |
echo '<a href="index.php?action=del&deluid='.urlencode($inf[$n][uid]).$mquery.'" class="act">Effacer</a>'; |
echo '<a href="index.php?action=del&delid='.urlencode($inf["$n"]['id']).$mquery.'" class="act">Effacer</a>'; |
582 |
} |
} |
583 |
echo '<a href="index.php?view=form&uid='.$inf[$n][uid].$mquery.'" class="act">Modifier</a>'; |
echo '<a href="index.php?view=form&id='.$inf["$n"]['id'].$mquery.'" class="act">Modifier</a>'; |
584 |
} |
} |
585 |
echo '</div></td>'; |
echo '</div></td>'; |
586 |
// ROU 20030303 Une colonne de plus pour gérer les opérations sur les comptes cyrus |
// ROU 20030303 Une colonne de plus pour gérer les opérations sur les comptes cyrus |
587 |
if (($admin) && ($am)) { |
if (($admin) && ($am)) { |
588 |
$fd = popen("/usr/local/bin/cyruschk ".$inf[$n][uid], "r"); |
$fd = popen("/usr/local/bin/cyruschk ".$inf["$n"]["id"], "r"); |
589 |
$result = fread($fd,1); |
$result = fread($fd,1); |
590 |
if ($result == "1") { |
if ($result == "1") { |
591 |
echo '<td class="clabel'.$ncl.'" style="border-left: solid 1px #999999;font-size:80%;padding-top:1px;"><div style="margin:2px;"><a href="index.php?action=cyrusdel&cyruid='.$inf[$n][uid].$mquery.'" class="act">Supprimer</a></div></td>'; |
echo '<td class="clabel'.$ncl.'" style="border-left: solid 1px #999999;font-size:80%;padding-top:1px;"><div style="margin:2px;"><a href="index.php?action=cyrusdel&cyruid='.$inf["$n"]["id"].$mquery.'" class="act">Supprimer</a></div></td>'; |
592 |
} else { |
} else { |
593 |
echo '<td class="clabel'.$ncl.'" style="border-left: solid 1px #999999;font-size:80%;padding-top:1px;"><div style="margin:2px;"><a href="index.php?action=cyrusadd&cyruid='.$inf[$n][uid].$mquery.'" class="act">Créer</a></div></td>'; |
echo '<td class="clabel'.$ncl.'" style="border-left: solid 1px #999999;font-size:80%;padding-top:1px;"><div style="margin:2px;"><a href="index.php?action=cyrusadd&cyruid='.$inf["$n"]["id"].$mquery.'" class="act">Créer</a></div></td>'; |
594 |
} |
} |
595 |
pclose($fd); |
pclose($fd); |
596 |
} |
} |
616 |
sur le serveur <b><? echo $conf[ludap][host]; ?></b> |
sur le serveur <b><? echo $conf[ludap][host]; ?></b> |
617 |
</div> |
</div> |
618 |
<div class="bottom"> |
<div class="bottom"> |
619 |
<span style="color:#ffffff;">LuDAP</span> (Lightweight users Directory Access Protocol) |
<a href="http://ludap.org" style="color:#ffffff;">LuDAP</a> (Lightweight users Directory Access Protocol) |
620 |
is a Free Software made by <a href="mailto:mose@mose.com" style="color:#aaccee;">mose</a> - 2001, 2002 |
is a Free Software made by <a href="mailto:mose@mose.com" style="color:#aaccee;">mose</a> - 2001, 2002 |
621 |
</div> |
</div> |
622 |
|
|
623 |
</body> |
</body> |
624 |
</html> |
</html> |
625 |
<? |
<? |
|
/* |
|
626 |
echo'<pre>';print_r(get_defined_vars());echo'</pre>'; |
echo'<pre>';print_r(get_defined_vars());echo'</pre>'; |
627 |
|
/* |
628 |
*/ |
*/ |
629 |
?> |
?> |