diff --git a/html/do.php b/html/do.php index b61b689bc..2f5260074 100644 --- a/html/do.php +++ b/html/do.php @@ -144,6 +144,8 @@ if ( isset ($_POST['set_preference'])) { $_SESSION['g_theme']=$style_user; $_SESSION['g_pagesize']=$p_size; $_SESSION['g_lang']=$lang; + $g_user->email=$p_email; + $g_user->save(); } /* diff --git a/html/user_login.php b/html/user_login.php index 1df419344..a76aa5441 100644 --- a/html/user_login.php +++ b/html/user_login.php @@ -110,6 +110,8 @@ if ( isset ($_POST['set_preference'])) { $User->save_global_preference('LANG', $lang); $_SESSION['g_theme']=$style_user; $_SESSION['g_lang']=$lang; + $User->load(); + $User->save_email($p_email); } echo '
'; /** diff --git a/include/ajax_preference.php b/include/ajax_preference.php index 3e1beabf6..ffa6b562e 100644 --- a/include/ajax_preference.php +++ b/include/ajax_preference.php @@ -20,7 +20,6 @@ /**\file * \brief this file is always included and then executed * it permits to change the user preferences - * \see user_pref.php */ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); require_once('class_user.php'); @@ -69,6 +68,14 @@ if (isset($_REQUEST['gDossier']) && $_REQUEST['gDossier']<>0)
+ + + + diff --git a/include/class_user.php b/include/class_user.php index 9874df1c5..cc8e7ffa3 100644 --- a/include/class_user.php +++ b/include/class_user.php @@ -120,6 +120,7 @@ class User $row = Database::fetch_array($Res, 0); $this->id = $row['use_id']; $this->first_name = $row['use_first_name']; + $this->last_name = $row['use_name']; $this->name = $row['use_name']; $this->active = $row['use_active']; $this->login = $row['use_login']; @@ -1169,7 +1170,11 @@ class User alert(_("Les mots de passe ne correspondent pas. Mot de passe inchangé")); } } - + function save_email($p_email) + { + $repo=new Database(); + $repo->exec_sql("update ac_users set use_email=$1 where use_login=$2", array($p_email, $_SESSION['g_user'])); + } } ?> diff --git a/include/user_detail.inc.php b/include/user_detail.inc.php index d4a457bf0..c3aa149f1 100644 --- a/include/user_detail.inc.php +++ b/include/user_detail.inc.php @@ -42,7 +42,9 @@ if ($UserChange->id == false) html_page_stop(); } -/* Save the changes */ +/* + * Update user changes + */ if (isset($_POST['SAVE'])) { $uid = $_POST['UID']; @@ -50,29 +52,42 @@ if (isset($_POST['SAVE'])) // Update User $cn = new Database(); $UserChange = new User($cn, $uid); + if ($UserChange->load() == -1) { alert("Cet utilisateur n'existe pas"); } else { - $UserChange->first_name = $_POST['fname']; - $UserChange->last_name = $_POST['lname']; - $UserChange->active = $_POST['Actif']; - $UserChange->admin = $_POST['Admin']; - if ( trim($_POST['password'])<>'') + $UserChange->first_name =HtmlInput::default_value_post('fname',null); + $UserChange->last_name = HtmlInput::default_value_post('lname',null); + $UserChange->active = HtmlInput::default_value_post('Actif',-1); + $UserChange->admin = HtmlInput::default_value_post('Admin',-1); + $UserChange->email = HtmlInput::default_value_post('email',null); + if ($UserChange->active ==-1 || $UserChange->admin ==-1) { - $UserChange->pass = md5($_POST['password']); - } else - { - $UserChange->pass=$UserChange->password; - } - $UserChange->save(); + var_dump($_POST); + var_dump($UserChange); + die ('Missing data'); + } + else if ( trim($_POST['password'])<>'') + { + $UserChange->pass = md5($_POST['password']); + $UserChange->save(); + } + else + { + $UserChange->pass=$UserChange->password; + $UserChange->save(); + } } } else { + // + // Delete the user + // if (isset($_POST["DELETE"])) { $cn = new Database(); @@ -109,6 +124,16 @@ $it_pass->value=""; ?> + + + + + + + + + + + +
+ + + +
Mot de passe :
+ + + +
Mot de passe :Laisser à VIDE pour ne PAS le changer @@ -117,48 +142,40 @@ $it_pass->value=""; input();?>
+ + + value=array( + array('value'=>0,'label'=>_('Non')), + array('value'=>1,'label'=>_('Oui')) + ); + $select_actif->selected=$UserChange->active; + echo $select_actif->input(); + ?> +
+ + + value=array( + array('value'=>0,'label'=>_('Utilisateur normal')), + array('value'=>1,'label'=>_('Administrateur')) + ); + $select_admin->selected=$UserChange->admin; + echo $select_admin->input(); + ?> +
- -active == 1) -{ - $ACT = "CHECKED"; - $NACT = "UNCHECKED"; -} -else -{ - $ACT = "UNCHECKED"; - $NACT = "CHECKED"; -} -echo ""; -?> -
"; -printf(' Actif', $ACT); -echo ""; -printf(' Non Actif', $NACT); -echo "
- - - -admin == 1) -{ - $ACT = "CHECKED"; - $NACT = "UNCHECKED"; -} -else -{ - $ACT = "UNCHECKED"; - $NACT = "CHECKED"; -} -echo ""; -?> -
"; -printf(' Administrateur global', $ACT); -echo ""; -printf(' Pas administrateur global ', $NACT); -echo "