".$msg["es_user_username"]." ".$msg["es_user_fullname"]." "; $parity=1; foreach($esusers->users as &$aesuser) { $pair_impair = $parity++ % 2 ? 'even' : 'odd'; $tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onmousedown=\"document.location='./admin.php?categ=external_services&sub=esusers&action=edit&id=$aesuser->esuser_id';\" "; print ""; print "".htmlentities($aesuser->esuser_username ,ENT_QUOTES, $charset).""; print "".htmlentities($aesuser->esuser_fullname ,ENT_QUOTES, $charset).""; print ""; } if (!count($esusers->users)) { print ''.$msg["es_users_noesusers"].''; } print " "; } function show_esuser_form($id=0, $esu_username='', $esu_fullname='', $esu_password='', $esu_groupid=0) { global $msg, $charset; print '
'; if (!$id) print '

'.$msg['es_users_add'].'

'; else print '

'.$msg['es_users_edit'].'

'; print '
'; //id print ''; //username print '

'; print '
'; //fullname print '

'; print '
'; //password print '

'; print '
'; //group $esgroups = new es_esgroups(); $groupselect = ''; print '

'; print $groupselect; print '
'; //buttons print "
"; print " "; print ''; print "
"; if ($id) { print confirmation_delete("./admin.php?categ=external_services&sub=esusers&action=del&id="); print ""; } print "


"; print ''; } function update_esuser_from_form() { global $msg, $charset,$dbh,$id; global $esuser_username, $esuser_fullname, $esuser_password, $esuser_esgroup; if ($esuser_esgroup) { //Vérifions que le groupe existe if (!es_esgroup::id_exists($esuser_esgroup)) { print $msg['es_user_error_unknowngroup']; show_esuser_form(0, stripslashes($esuser_username), stripslashes($esuser_fullname), stripslashes($esuser_password), stripslashes($esuser_esgroup)); return false; } } if (!$id) { //Ajout d'un nouvel utilisateur if (!$esuser_username) { print $msg['es_user_error_emptyfield']; show_esuser_form(0, stripslashes($esuser_username), stripslashes($esuser_fullname), stripslashes($esuser_password), stripslashes($esuser_esgroup)); return false; } if (es_esuser::username_exists($esuser_username)) { print $msg['es_user_error_usernamealreadyexists']; show_esuser_form(0, stripslashes($esuser_username), stripslashes($esuser_fullname), stripslashes($esuser_password), stripslashes($esuser_esgroup)); return false; } $new_esuser = es_esuser::add_new(); $new_esuser->esuser_username = $esuser_username; $new_esuser->esuser_fullname = $esuser_fullname; $new_esuser->esuser_password = $esuser_password; $new_esuser->esuser_group = $esuser_esgroup; $new_esuser->commit_to_db(); } else { $theuser = new es_esuser($id); if ($the_user->error) { return false; } $theuser->esuser_username = $esuser_username; $theuser->esuser_fullname = $esuser_fullname; $theuser->esuser_password = $esuser_password; $theuser->esuser_group = $esuser_esgroup; $theuser->commit_to_db(); } return true; } switch ($action) { case "add": show_esuser_form(0, '', '', ''); break; case "edit": $esu_username=''; $esu_fullname=''; $esu_password=''; $esu_group=0; if ($id) { $the_user = new es_esuser($id); if ($the_user->error) { $id = 0; } else { $esu_username=$the_user->esuser_username; $esu_fullname=$the_user->esuser_fullname; $esu_password=$the_user->esuser_password; $esu_group=$the_user->esuser_group; } } show_esuser_form($id, $esu_username, $esu_fullname, $esu_password, $esu_group); break; case "update": if (update_esuser_from_form()) list_users(); break; case "del": if ($id) { $the_user = new es_esuser($id); $the_user->delete(); } list_users(); break; default: list_users(); break; } ?>