";
for($j = 0; $j";
if ($j==0){ // after uid , lang
$ret .= "$v|".LDAP_LANG."|";
// }elseif ($fields[$j]=="gecos" || $fields[$j]=="displayname"){
//
// $v=ucwords(strtolower($v));
// $cn=explode(' ',$v);
// $c=$n="";
// for ($i=0;$i".$msg["ldap_error"]."";
print "".$msg["ldap_erro2"]."
";
}
} else {
print "".$msg["ldap_noserver"]."
";
}
return $ret;
}
// phase1 = choice of ldap group
function choice_ldap_group() {
global $msg;
global $charset;
global $current_module ;
global $form_ldap_groups;
if (ldap_ok()){
$lista_grp=explode(',',LDAP_GROUPS);
$opz_grp='';
foreach($lista_grp as $dummykey=>$v) {
$opz_grp .= "";
}
$form_ldap_groups=str_replace('!!opz_grp!!',$opz_grp,$form_ldap_groups);
print $form_ldap_groups;
}
}
// phase2 = show of ldap users for import
// phase3 = by import_empr.inc.php
function show_users_ldap($uu,$pag,$npp) {
global $msg;
global $charset;
global $current_module ;
global $form_show_ldap_users;
$auu=explode(';',$uu);
$nuu=count($auu);
if (!$npp) $npp=10;
$npag = ceil($nuu/$npp);
$nextp = $pag+1;
$precp = $pag-1;
$npp_ctrl="
";
if($precp > 0){
//$nav_bar .= "";
$nav_barL = "";
}else{
//$nav_bar .= "";
$nav_barL = "";
}
$nav_barC = "$pag/$npag";
if($nextp<=$npag) {
$nav_barR .= "";
}else{
$nav_barR = " ";
}
if(!$pag) $pag=1;
$iniz=($pag-1)*$npp;
$fine=min($nuu,$iniz+$npp);
$r=1;
for ($k=$iniz;$k<$fine;$k++){
$cc=explode('|',$auu[$k]);
if ($cc[0]){
$usr_entry="
|
$cc[0]
| ";
for ($j=2;$j
";
$form_show_ldap_users=str_replace('!!npp_ctrl!!',$npp_ctrl,$form_show_ldap_users);
$form_show_ldap_users=str_replace('!!nav_barL!!',$nav_barL,$form_show_ldap_users);
$form_show_ldap_users=str_replace('!!nav_barC!!',$nav_barC,$form_show_ldap_users);
$form_show_ldap_users=str_replace('!!nav_barR!!',$nav_barR,$form_show_ldap_users);
$form_show_ldap_users=str_replace('!!usr_list!!',$usr_list,$form_show_ldap_users);
$form_show_ldap_users=str_replace('!!hid_vars!!',$hid_vars,$form_show_ldap_users);
print $form_show_ldap_users;
}
//
//
// affichage du lien pr?c?dent si n?c?ssaire
// if($precp > 0){
// $nav_bar .= "
// ";
// }
// for($i = 1; $i <= $npag; $i++) {
// if($i==$pag){
// $nav_bar .= "pag. $i/$npag";
// }
// }
// if($nextp<=$npag) {
// $nav_bar .= "
// ";
// }
//------------------- main -------------------
$op=$_POST['btsubmit'];
switch($action)
{
case 'ldapOK':
switch($op){
case '=':
//$pag=$_POST['pag'];
$npp=$_POST['npp'];
show_users_ldap($uu,1,$npp);
break;
case '<':
$pag=max(1,$_POST['pag']-1);
$npp=$_POST['npp'];
show_users_ldap($uu,$pag,$npp);
break;
case '>':
$pag=$_POST['pag']+1;
show_users_ldap($uu,$pag,$npp);
break;
case $msg['del_ldap_usr']:
$xx=$_POST['usrdel'];
$uu=$_POST['uu'];
$pag=$_POST['pag'];
$npp=$_POST['npp'];
foreach ($xx as $dummykey=>$x){
$u="/$x"."[^;]+;/";
$uu=preg_replace($u,'',$uu,1);
}
show_users_ldap($uu,$pag,$npp);
break;
case $msg['import_ldap_exe']:
$uu=$_POST['uu'];
$uu=str_replace(';',"\n",$uu);
# $uu=str_replace('|',',',$uu);
$fp=fopen("./temp/ldap_users.txt","w");
fwrite($fp,$uu);
fclose($fp);
$action="";
$from_ldap='1';
require_once("./admin/empr/import_empr.inc.php");
break;
default:
$uu=users_ldap(gid_ldap($_POST['ldap_grp']));
$pag=$_POST['pag'];
$npp=$_POST['npp'];
if (!$pag) $pag=1;
show_users_ldap($uu,$pag,$npp);
break;
}
break;
default:
choice_ldap_group();
break;
}