21if ( !defined (
'ALLOWED')) die(
'Forbidden');
30echo
'<div class="content" >';
35if ( isset (
$_POST[
"ADD"]) )
39 $pass5=md5(
$_POST[
'PASS']);
40 $new_user=
new Noalyss_user(
$cn,0);
41 $new_user->first_name=
$http->post(
'FNAME');
42 $new_user->last_name=
$http->post(
'LNAME');
43 $new_user->setAdmin(0);
44 $login=
$http->post(
'LOGIN');
45 $login=str_replace(
"'",
"",$login);
46 $login=str_replace(
'"',
"",$login);
47 $login=str_replace(
" ",
"",$login);
48 $login=strtolower($login);
49 $new_user->login=$login;
51 $new_user->email=
$http->post(
'EMAIL',
"string",
'');
52 if ( trim($login)==
"" || strlen($login)<5)
54 alert(
_(
"Le login ne peut pas être vide et avoir au moins 5 lettres"));
55 }
elseif (count($a_result[
'msg']) > 0){
57 $msg=
'<span class="warning">'._(
"Mot de passe inchangé").
'</span>';
58 foreach ($a_result[
'msg'] as
$result ) {
59 $msg.=
"$result <br/>";
65 $exist_user=
$cn->get_value(
"select count(*) from ac_users where use_login=lower($1)",[$login]);
66 if ( $exist_user == 0 ) {
67 $new_user->setPassword($pass5);
70 put_global(array([
'key'=>
'use_id',
"value"=>$new_user->id]));
71 Noalyss_user::audit_admin(sprintf(
'ADD USER %s %s',$new_user->id,$login));
74 $uid=
$cn->get_value(
"select use_id from ac_users where use_login=lower($1)",[$login]);
75 $new_user->setId($uid);
76 put_global(array([
'key'=>
'use_id',
"value"=>$new_user->id]));
80 require_once NOALYSS_INCLUDE.
'/user_detail.inc.php';
91 $uid =
$http->post(
"UID");
99 alert(
_(
"Cet utilisateur n'existe pas"));
111 die (
'Missing data');
113 if ( trim(
$_POST[
'password'])<>
'')
116 if (count($a_result[
'msg']) > 0){
118 $msg=
'<span class="warning">'._(
"Mot de passe inchangé").
'</span>';
119 foreach ($a_result[
'msg'] as
$result ) {
120 $msg.=
"$result <br/>";
123 require_once NOALYSS_INCLUDE.
'/user_detail.inc.php';
131 if (
$http->post(
"generate_otp",
"number",0)==1){
138 if (
$UserChange->authent_method !=0 && filter_var(
$UserChange->email, FILTER_VALIDATE_EMAIL) ===
false ) {
140 require_once NOALYSS_INCLUDE.
'/user_detail.inc.php';
145 && filter_var(
$UserChange->email, FILTER_VALIDATE_EMAIL) ==
true
146 &&
$http->post(
'email_otp',
'number',0) == 1
149 $cn->exec_sql(
'delete from otp_send_secret where use_id=$1',[
$UserChange->getId()]);
164 $ctl_code=
$http->post(
'ctlcode');
165 $uid =
$http->request(
'use_id');
166 }
catch (Exception
$ex) {
170 if ( DEBUGNOALYSS > 1) {
171 echo
"code [$code] code control [$ctl_code]";
173 if (
$code != $ctl_code) {
175 require_once NOALYSS_INCLUDE.
'/user_detail.inc.php';
180 require_once NOALYSS_INCLUDE.
'/user_detail.inc.php';
184 $auser=
$cn->get_row(
'select use_login from ac_users where use_id = $1',[$uid]);
185 if ( $auser ==
null)
return;
186 $Res =
$cn->exec_sql(
"delete from jnt_use_dos where use_id=$1", array($uid));
187 $Res =
$cn->exec_sql(
"delete from ac_users where use_id=$1", array($uid));
191 $a_dossier=
$cn->get_array(
'select dos_id from ac_dossier');
192 if ( is_array($a_dossier) ) {
193 $nb=count($a_dossier);
195 Noalyss_user::remove_inexistant_user($a_dossier[
$i][
'dos_id']);
197 Noalyss_user::audit_admin(sprintf(
'DELETE USER %s %s',$uid,$auser[
'use_login']));
198 echo
"<H2 class=\"notice\">";
199 printf (
_(
"Utilisateur %s %s est effacé"),
$http->post(
'fname'),
$http->post(
'lname')) ;
205 require_once NOALYSS_INCLUDE.
'/user_detail.inc.php';
211<div
id=
"create_user" style=
"display:none;margin-right: 20%;position:float;" class=
"inner_box2">
213 <form action=
"admin-noalyss.php?action=user_mgt" method=
"POST" onsubmit=
"return check_form()">
214 <div
style=
"text-align: center">
216<TABLE
class=
"result" >
217 <TR><TD
style=
"text-align: right"> <?php echo
_(
'login')?></TD><TD><INPUT
id=
"input_login" class=
"input_text" TYPE=
"TEXT" NAME=
"LOGIN" autocomplete=“off” required></TD></
tr>
218 <TR><TD
style=
"text-align: right"> <?php echo
_(
'Prénom')?></TD><TD><INPUT
class=
"input_text" TYPE=
"TEXT" NAME=
"FNAME" autocomplete=“off”></TD></
tr>
219 <TR><TD
style=
"text-align: right"> <?php echo
_(
'Nom')?></TD><TD><INPUT
class=
"input_text" TYPE=
"TEXT" NAME=
"LNAME" autocomplete=“off” required></TD></TR>
221 <TD
style=
"text-align: right"> <?php echo
_(
'Mot de passe')?>
222 <?=
\Icon_Action::tips(
"Mot de passe : longueur minimale = 8 dont au moins 1 majuscule, 1 minuscule,1 chiffre et 1 car.spécial")?>
225 <TD> <INPUT
id=
"input_password" class=
"input_text" TYPE=
"TEXT" NAME=
"PASS"
226 onkeyup=
"check_password_strength('input_password','info_passid',true)"
232 <TR><TD
style=
"text-align: right"> <?php echo
_(
'Email')?></TD><TD> <INPUT
class=
"input_text" TYPE=
"TEXT" NAME=
"EMAIL"></TD></TR>
247 function check_form() {
248 if ($F(
'input_login') ==
"") {
249 smoke.alert(
'<?php echo _('Le login ne peut être vide
') ?>');
250 $(
'input_login').setStyle({border:
"red solid 2px"});
253 if ($F(
'input_password') ==
"") {
254 smoke.alert(
'<?php echo _('Le mot de passe ne peut être vide
') ?>');
255 $(
'input_password').setStyle({border:
"red solid 2px"});
258 if ($F(
'input_login').length < 5) {
259 smoke.alert(
'<?php echo _('Le login doit avoir au moins 5 lettres
') ?>');
260 $(
'input_password').setStyle({border:
"red solid 2px"});
283$url=basename($_SERVER[
'PHP_SELF']).
"?action=".
$_REQUEST[
'action'];
284$header->add(
_(
"Login"),
$url,
" order by use_login asc",
"order by use_login desc",
"la",
"ld");
285$header->add(
_(
"Nom"),
$url,
" order by use_name asc,use_first_name asc",
"order by use_name desc,use_first_name desc",
"na",
"nd");
286$header->add(
_(
"Authentification"),
$url,
" order by use_auth_method asc,use_login asc",
"order by use_auth_method desc ,use_login asc",
"auth",
"nauth");
287$header->add(
_(
'Dossier'),
$url,
' order by ag_dossier asc',
'order by ag_dossier desc',
289$header->add(
_(
"Actif"),
$url,
" order by use_active asc",
"order by use_active desc",
"aa",
"ad");
290$header->add(
_(
"Email"),
$url,
" order by use_email asc,use_name asc,use_first_name asc",
"order by use_email desc,use_name desc,use_first_name desc",
"na",
"nd");
295if ( !empty ($a_user) )
297 echo
'<span style="display:block">';
298 echo
_(
'Cherche').Icon_Action::infobulle(22);
301 echo
'<table id="user" class="result">';
303 echo
'<th>'.$header->get_header(0).
'</th>';
304 echo
'<th>'.$header->get_header(1).
'</th>';
305 echo
th(
_(
"Prénom"));
306 echo
'<th>'.$header->get_header(5).
'</th>';
307 echo
'<th>'.$header->get_header(2).
'</th>';
308 echo
'<th>'.$header->get_header(4).
'</th>';
309 echo
"<th>"._(
'Type').
"</th>";
310 echo
'<th>'.$header->get_header(3).
'</th>';
312 $a_auth=[0=>
_(
"Mot de passe"),1=>
'Email et OTP',2=>
'OTP'];
314 foreach ( $a_user as $r_user)
317 $class=($compteur%2==0)?
"odd":
"even";
319 echo
"<tr class=\"$class\">";
320 if ( $r_user[
'use_active'] == 0 )
328 $det_url=
$url.
"&det&use_id=".$r_user[
'use_id'];
333 echo
td($r_user[
'use_name']);
334 echo
td($r_user[
'use_first_name']);
335 echo
td($r_user[
'use_email']);
337 echo
td($a_auth[$r_user[
'use_auth_method']]);
339 $type=($r_user[
'use_admin']==1)?
_(
"Administrateur"):
_(
"Utilisateur");
340 echo
"<td>".$type.
"</td>";
341 if ( $r_user[
'use_admin'] == 0)
342 echo
td($r_user[
'ag_dossier']);
th($p_string, $p_extra='', $raw='')
put_global($array)
Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter)
span($p_string, $p_extra='')
echo_warning($p_string)
warns
check_password_strength($password)
returns an double array with the error found and code , if the count is 0 then the password is very s...
echo_error($p_log, $p_line="", $p_message="")
log error into the /tmp/noalyss_error.log it doesn't work on windows
tr($p_string, $p_extra='')
td($p_string='', $p_extra='')
surround the string with td
alert($p_msg, $buffer=false)
alert in javascript
if(isset($_REQUEST['gDossier']) && $http->request("gDossier","number", 0) !=0) $repo
_("actif, passif,charge,...")
$class
Display the Plugin and for each profile were it is installed or not.
contains the class for connecting to Noalyss
static tips($p_comment)
Display a info in a bubble, text is given as parameter.
static echo_file($msg, $print=true)
display the file
Description of class_syn_sort_table.
if(count($a_accounting)==0) $header
if( $delta< 0) elseif( $delta==0)
if(isset($_POST["ADD"])) $sbaction
catch(Exception $ex) $UserChange