* Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2005 Lionel Cousteix * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/user/fiche.php * \brief Tab of user card * \version $Id: fiche.php,v 1.274 2011/07/08 18:49:17 eldy Exp $ */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php"); require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/images.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php"); if ($conf->ldap->enabled) require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php"); if ($conf->adherent->enabled) require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); // Define value to know what current user can do on users $canadduser=($user->admin || $user->rights->user->user->creer); $canreaduser=($user->admin || $user->rights->user->user->lire); $canedituser=($user->admin || $user->rights->user->user->creer); $candisableuser=($user->admin || $user->rights->user->user->supprimer); $canreadgroup=$canreaduser; $caneditgroup=$canedituser; if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $canreadgroup=($user->admin || $user->rights->user->group_advance->read); $caneditgroup=($user->admin || $user->rights->user->group_advance->write); } // Define value to know what current user can do on properties of edited user if ($_GET["id"]) { // $user est le user qui edite, $_GET["id"] est l'id de l'utilisateur edite $caneditfield=( (($user->id == $_GET["id"]) && $user->rights->user->self->creer) || (($user->id != $_GET["id"]) && $user->rights->user->user->creer) ); $caneditpassword=( (($user->id == $_GET["id"]) && $user->rights->user->self->password) || (($user->id != $_GET["id"]) && $user->rights->user->user->password) ); } $action=GETPOST("action"); $group=GETPOST("group","int",3); $confirm=GETPOST("confirm"); // Security check $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2='user'; if ($user->id == $_GET["id"]) { $feature2=''; $canreaduser=1; } // A user can always read its own card $result = restrictedArea($user, 'user', $_GET["id"], '', $feature2); if ($user->id <> $_GET["id"] && ! $canreaduser) accessforbidden(); $langs->load("users"); $langs->load("companies"); $langs->load("ldap"); $form = new Form($db); /** * Actions */ if ($_GET["subaction"] == 'addrights' && $canedituser) { $edituser = new User($db); $edituser->fetch($_GET["id"]); $edituser->addrights($_GET["rights"]); } if ($_GET["subaction"] == 'delrights' && $canedituser) { $edituser = new User($db); $edituser->fetch($_GET["id"]); $edituser->delrights($_GET["rights"]); } if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) { if ($_GET["id"] <> $user->id) { $edituser = new User($db); $edituser->fetch($_GET["id"]); $edituser->setstatus(0); Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]); exit; } } if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) { if ($_GET["id"] <> $user->id) { $message=''; $edituser = new User($db); $edituser->fetch($_GET["id"]); if (!empty($conf->file->main_limit_users)) { $nb = $edituser->getNbOfUsers("active"); if ($nb >= $conf->file->main_limit_users) { $message='
'.$langs->trans("YourQuotaOfUsersIsReached").'
'; } } if (! $message) { $edituser->setstatus(1); Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]); exit; } } } if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) { if ($_GET["id"] <> $user->id) { $edituser = new User($db); $edituser->id=$_GET["id"]; $result = $edituser->delete(); if ($result < 0) { $langs->load("errors"); $message='
'.$langs->trans("ErrorUserCannotBeDelete").'
'; } else { Header("Location: index.php"); exit; } } } // Action ajout user if ($_POST["action"] == 'add' && $canadduser) { $message=""; if (! $_POST["nom"]) { $message='
'.$langs->trans("NameNotDefined").'
'; $action="create"; // Go back to create page } if (! $_POST["login"]) { $message='
'.$langs->trans("LoginNotDefined").'
'; $action="create"; // Go back to create page } $edituser = new User($db); if (!empty($conf->file->main_limit_users)) // If option to limit users is set { $nb = $edituser->getNbOfUsers("active"); if ($nb >= $conf->file->main_limit_users) { $message='
'.$langs->trans("YourQuotaOfUsersIsReached").'
'; $action="create"; // Go back to create page } } if (! $message) { $edituser->nom = $_POST["nom"]; $edituser->prenom = $_POST["prenom"]; $edituser->login = $_POST["login"]; $edituser->admin = $_POST["admin"]; $edituser->office_phone = $_POST["office_phone"]; $edituser->office_fax = $_POST["office_fax"]; $edituser->user_mobile = $_POST["user_mobile"]; $edituser->email = $_POST["email"]; $edituser->webcal_login = $_POST["webcal_login"]; $edituser->signature = $_POST["signature"]; $edituser->phenix_login = $_POST["phenix_login"]; $edituser->phenix_pass = $_POST["phenix_pass"]; $edituser->note = $_POST["note"]; $edituser->ldap_sid = $_POST["ldap_sid"]; // If multicompany is off, admin users must all be on entity 0. $edituser->entity = ( ! empty($_POST["admin"]) && (! empty($_POST["superadmin"]) || empty($conf->multicompany->enabled)) ? 0 : $_POST["entity"]); $db->begin(); $id = $edituser->create($user); if ($id > 0) { if (isset($_POST['password']) && trim($_POST['password'])) { $edituser->setPassword($user,trim($_POST['password'])); } $db->commit(); Header("Location: fiche.php?id=$id"); exit; } else { $langs->load("errors"); $db->rollback(); if (is_array($edituser->errors) && count($edituser->errors)) $message='
'.join('
',$langs->trans($edituser->errors)).'
'; else $message='
'.$langs->trans($edituser->error).'
'; $action="create"; // Go back to create page } } } // Action ajout groupe utilisateur if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) { if ($group) { $editgroup = new UserGroup($db); $editgroup->fetch($group); $editgroup->oldcopy=dol_clone($editgroup); $edituser = new User($db); $edituser->fetch($_GET["id"]); if ($action == 'addgroup') $edituser->SetInGroup($group,GETPOST('entity')); if ($action == 'removegroup') $edituser->RemoveFromGroup($group,GETPOST('entity')); if ($result > 0) { header("Location: fiche.php?id=".$_GET["id"]); exit; } else { $message.=$edituser->error; } } } if ($action == 'update' && ! $_POST["cancel"]) { require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); if ($caneditfield) // Case we can edit all field { $message=""; if (! $_POST["nom"]) { $message='
'.$langs->trans("NameNotDefined").'
'; $action="edit"; // Go back to create page } if (! $_POST["login"]) { $message='
'.$langs->trans("LoginNotDefined").'
'; $action="edit"; // Go back to create page } if (! $message) { $db->begin(); $edituser = new User($db); $edituser->fetch($_GET["id"]); $edituser->oldcopy=dol_clone($edituser); $edituser->nom = $_POST["nom"]; $edituser->prenom = $_POST["prenom"]; $edituser->login = $_POST["login"]; $edituser->pass = $_POST["password"]; $edituser->admin = $_POST["admin"]; $edituser->office_phone = $_POST["office_phone"]; $edituser->office_fax = $_POST["office_fax"]; $edituser->user_mobile = $_POST["user_mobile"]; $edituser->email = $_POST["email"]; $edituser->signature = $_POST["signature"]; $edituser->openid = $_POST["openid"]; $edituser->webcal_login = $_POST["webcal_login"]; $edituser->phenix_login = $_POST["phenix_login"]; $edituser->phenix_pass = $_POST["phenix_pass"]; $edituser->entity = ( (! empty($_POST["superadmin"]) && ! empty($_POST["admin"])) ? 0 : $_POST["entity"]); if (GETPOST('deletephoto')) $edituser->photo=''; if (! empty($_FILES['photo']['name'])) $edituser->photo = dol_sanitizeFileName($_FILES['photo']['name']); $ret=$edituser->update($user); if ($ret < 0) { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $message.='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; } else { $message.='
'.$edituser->error.'
'; } } if ($ret >=0 && ! count($edituser->errors)) { if (GETPOST('deletephoto') && $edituser->photo) { $fileimg=$conf->user->dir_output.'/'.get_exdir($edituser->id,2,0,1).'/logos/'.$edituser->photo; $dirthumbs=$conf->user->dir_output.'/'.get_exdir($edituser->id,2,0,1).'/logos/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) { $dir= $conf->user->dir_output . '/' . get_exdir($edituser->id,2,0,1); create_exdir($dir); if (@is_dir($dir)) { $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result=dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']); if (! $result > 0) { $message .= '
'.$langs->trans("ErrorFailedToSaveFile").'
'; } else { // Create small thumbs for company (Ratio is near 16/9) // Used on logon for example $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); // Create mini thumbs for company (Ratio is near 16/9) // Used on menu or for setup page for example $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); } } } } if ($ret >= 0 && ! count($edituser->errors)) { $message.='
'.$langs->trans("UserModified").'
'; $db->commit(); } else { $db->rollback(); } } } else if ($caneditpassword) // Case we can edit only password { $edituser = new User($db); $edituser->fetch($_GET["id"]); $ret=$edituser->setPassword($user,$_POST["password"]); if ($ret < 0) { $message.='
'.$edituser->error.'
'; } } } // Change password with a new generated one if ((($action == 'confirm_password' && $confirm == 'yes') || ($action == 'confirm_passwordsend' && $confirm == 'yes')) && $caneditpassword) { $edituser = new User($db); $edituser->fetch($_GET["id"]); $newpassword=$edituser->setPassword($user,''); if ($newpassword < 0) { // Echec $message = '
'.$langs->trans("ErrorFailedToSetNewPassword").'
'; } else { // Succes if ($action == 'confirm_passwordsend' && $confirm == 'yes') { if ($edituser->send_password($user,$newpassword) > 0) { $message = '
'.$langs->trans("PasswordChangedAndSentTo",$edituser->email).'
'; //$message.=$newpassword; } else { $message = '
'.$langs->trans("PasswordChangedTo",$newpassword).'
'; $message.= '
'.$edituser->error.'
'; } } else { $message = '
'.$langs->trans("PasswordChangedTo",$newpassword).'
'; } } } // Action initialisation donnees depuis record LDAP if ($_POST["action"] == 'adduserldap') { $selecteduser = $_POST['users']; $required_fields = array( $conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_LOGIN, $conf->global->LDAP_FIELD_LOGIN_SAMBA, $conf->global->LDAP_FIELD_PASSWORD, $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, $conf->global->LDAP_FIELD_PHONE, $conf->global->LDAP_FIELD_FAX, $conf->global->LDAP_FIELD_MOBILE, $conf->global->LDAP_FIELD_MAIL, $conf->global->LDAP_FIELD_SID); $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result >= 0) { // Remove from required_fields all entries not configured in LDAP (empty) and duplicated $required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElement"))); $ldapusers = $ldap->getRecords($selecteduser, $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields); //print_r($ldapusers); if (is_array($ldapusers)) { foreach ($ldapusers as $key => $attribute) { $ldap_nom = $attribute[$conf->global->LDAP_FIELD_NAME]; $ldap_prenom = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME]; $ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN]; $ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA]; $ldap_pass = $attribute[$conf->global->LDAP_FIELD_PASSWORD]; $ldap_pass_crypted = $attribute[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED]; $ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE]; $ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX]; $ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE]; $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL]; $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID]; } } } else { $message='
'.$ldap->error.'
'; } } /* * Affichage page */ llxHeader('',$langs->trans("UserCard")); $html = new Form($db); if (($action == 'create') || ($action == 'adduserldap')) { /* ************************************************************************** */ /* */ /* Affichage fiche en mode creation */ /* */ /* ************************************************************************** */ print_fiche_titre($langs->trans("NewUser")); print $langs->trans("CreateInternalUserDesc"); print "
"; print "
"; if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') { /* * Affiche formulaire d'ajout d'un compte depuis LDAP * si on est en synchro LDAP vers Dolibarr */ $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result >= 0) { $required_fields=array($conf->global->LDAP_KEY_USERS, $conf->global->LDAP_FIELD_FULLNAME, $conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_LOGIN, $conf->global->LDAP_FIELD_LOGIN_SAMBA); // Remove from required_fields all entries not configured in LDAP (empty) and duplicated $required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElement"))); // Get from LDAP database an array of results $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1); if (is_array($ldapusers)) { $liste=array(); foreach ($ldapusers as $key => $ldapuser) { // Define the label string for this user $label=''; foreach ($required_fields as $value) { if ($value) { $label.=$value."=".$ldapuser[$value]." "; } } $liste[$key] = $label; } } else { $message='
'.$ldap->error.'
'; } } else { $message='
'.$ldap->error.'
'; } } dol_htmloutput_errors($message); if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') { // Si la liste des users est rempli, on affiche la liste deroulante if (is_array($liste)) { print "\n\n\n"; print '
'; print ''; print ''; print ''; print '
'; print $langs->trans("LDAPUsers"); print ''; print ''; print $html->selectarray('users', $liste, '', 1); print ''; print ''; print '
'; print '
'; print "\n\n\n"; print '
'; } } print '
'; print ''; print ''; if ($ldap_sid) print ''; print ''; print ''; print ''; // Nom print ''; print ''; // Prenom print ''; print ''; // Login print ''; print ''; $generated_password=''; if (! $ldap_sid) { include_once(DOL_DOCUMENT_ROOT.'/lib/security.lib.php'); $generated_password=getRandomPassword(''); } $password=$generated_password; // Mot de passe print ''; print ''; // Administrateur if ($user->admin) { print ''; print '\n"; } // Type print ''; print ''; // Tel print ''; print ''; // Tel portable print ''; print ''; // Fax print ''; print ''; // EMail print ''; print ''; // Signature print ''; print ''; // Note print '\n"; // Autres caracteristiques issus des autres modules // Module Webcalendar if ($conf->webcalendar->enabled) { print "".''; print ''; } // Module Phenix if ($conf->phenix->enabled) { print "".''; print ''; print "".''; print ''; } print "".''; print "
'.$langs->trans("Lastname").''; if ($ldap_nom) { print ''; print $ldap_nom; } else { print ''; } print '
'.$langs->trans("Firstname").''; if ($ldap_prenom) { print ''; print $ldap_prenom; } else { print ''; } print '
'.$langs->trans("Login").''; if ($ldap_login) { print ''; print $ldap_login; } elseif ($ldap_loginsmb) { print ''; print $ldap_loginsmb; } else { print ''; } print '
'.$langs->trans("Password").''; if ($ldap_sid) { print 'Mot de passe du domaine'; } else { if ($ldap_pass) { print ''; print preg_replace('/./i','*',$ldap_pass); } else { // We do not use a field password but a field text to show new password to use. print ''; } } print '
'.$langs->trans("Administrator").''; print $form->selectyesno('admin',$_POST["admin"],1); if (! empty($conf->multicompany->enabled) && ! $user->entity) { if ($conf->use_javascript_ajax) { print ''; } $checked=($_POST["superadmin"]?' checked':''); $disabled=($_POST["superadmin"]?'':' disabled'); print ' '.$langs->trans("SuperAdministrator"); } print "
'.$langs->trans("Type").''; print $html->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc")); print '
'.$langs->trans("PhonePro").''; if ($ldap_phone) { print ''; print $ldap_phone; } else { print ''; } print '
'.$langs->trans("PhoneMobile").''; if ($ldap_mobile) { print ''; print $ldap_mobile; } else { print ''; } print '
'.$langs->trans("Fax").''; if ($ldap_fax) { print ''; print $ldap_fax; } else { print ''; } print '
global->USER_MAIL_REQUIRED?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; if ($ldap_mail) { print ''; print $ldap_mail; } else { print ''; } print '
'.$langs->trans("Signature").''; print ''; print '
'; print $langs->trans("Note"); print ''; if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('note','','',180,'dolibarr_notes','',false); $doleditor->Create(); } else { print ''; } print "
'.$langs->trans("LoginWebcal").'
'.$langs->trans("LoginPenix").'
'.$langs->trans("PassPenix").'
\n"; print "
"; } else { /* ************************************************************************** */ /* */ /* Visu et edition */ /* */ /* ************************************************************************** */ if ($_GET["id"]) { $fuser = new User($db); $fuser->fetch($_GET["id"]); // Connexion ldap // pour recuperer passDoNotExpire et userChangePassNextLogon if ($conf->ldap->enabled && $fuser->ldap_sid) { $ldap = new Ldap(); $result=$ldap->connect_bind(); if ($result > 0) { $userSearchFilter = '('.$conf->global->LDAP_FILTER_CONNECTION.'('.$this->getUserIdentifier().'='.$fuser->login.'))'; $entries = $ldap->fetch($fuser->login,$userSearchFilter); if (! $entries) { $message .= $ldap->error; } $passDoNotExpire = 0; $userChangePassNextLogon = 0; $userDisabled = 0; $statutUACF = ''; //On verifie les options du compte if (count($ldap->uacf) > 0) { foreach ($ldap->uacf as $key => $statut) { if ($key == 65536) { $passDoNotExpire = 1; $statutUACF = $statut; } } } else { $userDisabled = 1; $statutUACF = "ACCOUNTDISABLE"; } if ($ldap->pwdlastset == 0) { $userChangePassNextLogon = 1; } } } /* * Affichage onglets */ $head = user_prepare_head($fuser); $title = $langs->trans("User"); dol_fiche_head($head, 'user', $title, 0, 'user'); /* * Confirmation reinitialisation mot de passe */ if ($action == 'password') { $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password", '', 0, 1); if ($ret == 'html') print '
'; } /* * Confirmation envoi mot de passe */ if ($action == 'passwordsend') { $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend", '', 0, 1); if ($ret == 'html') print '
'; } /* * Confirmation desactivation */ if ($action == 'disable') { $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable", '', 0, 1); if ($ret == 'html') print '
'; } /* * Confirmation activation */ if ($action == 'enable') { $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable", '', 0, 1); if ($ret == 'html') print '
'; } /* * Confirmation suppression */ if ($action == 'delete') { $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete", '', 0, 1); if ($ret == 'html') print '
'; } dol_htmloutput_mesg($message); /* * Fiche en mode visu */ if ($_GET["action"] != 'edit') { print ''; // Ref print ''; print ''; print ''."\n"; $rowspan=14; if ($conf->societe->enabled) $rowspan++; if ($conf->adherent->enabled) $rowspan++; if ($conf->webcalendar->enabled) $rowspan++; if ($conf->phenix->enabled) $rowspan+=2; // Lastname print ''; print ''; // Photo print ''; print ''."\n"; // Firstname print ''; print ''; print ''."\n"; // Login print ''; if ($fuser->ldap_sid && $fuser->statut==0) { print ''; } else { print ''; } print ''."\n"; // Password print ''; if ($fuser->ldap_sid) { if ($passDoNotExpire) { print ''; } else if($userChangePassNextLogon) { print ''; } else if($userDisabled) { print ''; } else { print ''; } } else { print '"; } print ''."\n"; // Administrator print ''."\n"; // Type print ''."\n"; // Tel pro print ''; print ''; print ''."\n"; // Tel mobile print ''; print ''; print ''."\n"; // Fax print ''; print ''; print ''."\n"; // EMail print ''; print ''; print "\n"; // Signature print ''; print ''; print "\n"; // Statut print ''; print ''; print ''."\n"; print ''; print ''; print "\n"; print ''; print ''; print "\n"; if (preg_match('/myopenid/',$conf->authmode)) { print ''; print ''; print "\n"; } // Autres caracteristiques issus des autres modules // Module Webcalendar if ($conf->webcalendar->enabled) { $langs->load("other"); print ''; print ''; print ''."\n"; } // Module Phenix if ($conf->phenix->enabled) { $langs->load("other"); print ''; print ''; print "\n"; print ''; print ''; print ''."\n"; } // Company / Contact if ($conf->societe->enabled) { print ''; print ''; print ''."\n"; } // Module Adherent if ($conf->adherent->enabled) { $langs->load("members"); print ''; print ''; print ''."\n"; } print "
'.$langs->trans("Ref").''; print $html->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin); print '
'.$langs->trans("Lastname").''.$fuser->nom.''; print $html->showphoto('userphoto',$fuser,100); print '
'.$langs->trans("Firstname").''.$fuser->prenom.'
'.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''.$fuser->login.'
'.$langs->trans("Password").''.$langs->trans("LdapUacf_".$statutUACF).''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).''.$langs->trans("DomainPassword").''; if ($fuser->pass) print preg_replace('/./i','*',$fuser->pass); else { if ($user->admin) print $langs->trans("Crypted").': '.$fuser->pass_indatabase_crypted; else print $langs->trans("Hidden"); } print "
'.$langs->trans("Administrator").''; if (! empty($conf->multicompany->enabled) && $fuser->admin && ! $fuser->entity) { print $html->textwithpicto(yn($fuser->admin),$langs->trans("SuperAdministratorDesc"),1,"superadmin"); } else if ($fuser->admin) { print $html->textwithpicto(yn($fuser->admin),$langs->trans("AdministratorDesc"),1,"admin"); } else { print yn($fuser->admin); } print '
'.$langs->trans("Type").''; if ($fuser->societe_id) { print $html->textwithpicto($langs->trans("External"),$langs->trans("InternalExternalDesc")); } else if ($fuser->ldap_sid) { print $langs->trans("DomainUser",$ldap->domainFQDN); } else { print $html->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc")); } print '
'.$langs->trans("PhonePro").''.dol_print_phone($fuser->office_phone,'',0,0,1).'
'.$langs->trans("PhoneMobile").''.dol_print_phone($fuser->user_mobile,'',0,0,1).'
'.$langs->trans("Fax").''.dol_print_phone($fuser->office_fax,'',0,0,1).'
'.$langs->trans("EMail").''.dol_print_email($fuser->email,0,0,1).'
'.$langs->trans('Signature').''.$fuser->signature.'
'.$langs->trans("Status").''; print $fuser->getLibStatut(4); print '
'.$langs->trans("LastConnexion").''.dol_print_date($fuser->datelastlogin,"dayhour").'
'.$langs->trans("PreviousConnexion").''.dol_print_date($fuser->datepreviouslogin,"dayhour").'
'.$langs->trans("url_openid").''.$fuser->openid.'
'.$langs->trans("LoginWebcal").''.$fuser->webcal_login.' 
'.$langs->trans("LoginPhenix").''.$fuser->phenix_login.' 
'.$langs->trans("PassPhenix").''.preg_replace('/./i','*',$fuser->phenix_pass_crypted).' 
'.$langs->trans("LinkToCompanyContact").''; if ($fuser->societe_id > 0) { $societe = new Societe($db); $societe->fetch($fuser->societe_id); print $societe->getNomUrl(1,''); } else { print $langs->trans("ThisUserIsNot"); } if ($fuser->contact_id) { $contact = new Contact($db); $contact->fetch($fuser->contact_id); if ($fuser->societe_id > 0) print ' / '; else print '
'; print ''.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; } print '
'.$langs->trans("LinkedToDolibarrMember").''; if ($fuser->fk_member) { $adh=new Adherent($db); $adh->fetch($fuser->fk_member); $adh->ref=$adh->getFullname($langs); // Force to show login instead of id print $adh->getNomUrl(1); } else { print $langs->trans("UserNotLinkedToMember"); } print '
\n"; print "\n"; /* * Barre d'actions */ print '
'; if ($caneditfield && (empty($conf->multicompany->enabled) || (($fuser->entity == $conf->entity) || $fuser->entity == $user->entity)) ) { if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { print ''.$langs->trans("Modify").''; } else { print ''.$langs->trans("Modify").''; } } elseif ($caneditpassword && ! $fuser->ldap_sid && (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity)) ) { print ''.$langs->trans("EditPassword").''; } // Si on a un gestionnaire de generation de mot de passe actif if ($conf->global->USER_PASSWORD_GENERATED != 'none') { if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->login && !$fuser->ldap_sid && (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity))) { print ''.$langs->trans("ReinitPassword").''; } if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->login && !$fuser->ldap_sid && (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity)) ) { if ($fuser->email) print ''.$langs->trans("SendNewPassword").''; else print ''.$langs->trans("SendNewPassword").''; } } // Activer if ($user->id <> $_GET["id"] && $candisableuser && $fuser->statut == 0 && (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity)) ) { print ''.$langs->trans("Reactivate").''; } // Desactiver if ($user->id <> $_GET["id"] && $candisableuser && $fuser->statut == 1 && (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity)) ) { print ''.$langs->trans("DisableUser").''; } // Delete if ($user->id <> $_GET["id"] && $candisableuser && (empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity)) ) { print ''.$langs->trans("DeleteUser").''; } print "
\n"; print "
\n"; /* * Liste des groupes dans lequel est l'utilisateur */ if ($canreadgroup) { print_fiche_titre($langs->trans("ListOfGroupsForUser"),'',''); // On selectionne les groupes auquel fait parti le user $exclude = array(); $usergroup=new UserGroup($db); $groupslist = $usergroup->listGroupsForUser($fuser->id); if (! empty($groupslist)) { foreach($groupslist as $groupforuser) { $exclude[]=$groupforuser->id; } } if ($caneditgroup) { $form = new Form($db); print '
'."\n"; print ''; print ''; print ''; print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$langs->trans("GroupsToAdd").''; print $form->select_dolgroups('','group',1,$exclude); print '   '; print ''; print '
'."\n"; print '
'; } /* * Groupes affectes */ print ''; print ''; print ''; print "\n"; if (! empty($groupslist)) { $var=true; foreach($groupslist as $group) { $var=!$var; print ""; print ''; print '\n"; } } else { print ''; } print "
'.$langs->trans("Groups").' 
'; if ($caneditgroup) { print ''.img_object($langs->trans("ShowGroup"),"group").' '.$group->nom.''; } else { print img_object($langs->trans("ShowGroup"),"group").' '.$group->nom; } print ''; if ($caneditgroup) { print ''; print img_delete($langs->trans("RemoveFromGroup")); } else { print " "; } print "
'.$langs->trans("None").'
"; print "
"; } } /* * Fiche en mode edition */ if ($_GET["action"] == 'edit' && ($canedituser || ($user->id == $fuser->id))) { print '
'; print ''; print ''; print ''; print ''; $rowspan=12; if ($conf->societe->enabled) $rowspan++; if ($conf->adherent->enabled) $rowspan++; if ($conf->webcalendar->enabled) $rowspan++; if ($conf->phenix->enabled) $rowspan+=2; print ''; print ''; print ''; // Lastname print ""; print ''; print ''; // Photo print ''; print ''; // Firstname print "".''; print ''; // Login print "".''; print ''; print ''; // Pass print ''; print '\n"; // Administrator print "".''; if ($fuser->societe_id > 0) { print ''; } else { print ''; } // Type print ''; print ''; // Tel pro print "".''; print ''; // Tel mobile print "".''; print ''; // Fax print "".''; print ''; // EMail print "".''; print ''; // Signature print "".''; print ''; // openid if (preg_match('/myopenid/',$conf->authmode)) { print "".''; print ''; } // Statut print ''; print ''; // Autres caracteristiques issus des autres modules // Module Webcalendar if ($conf->webcalendar->enabled) { $langs->load("other"); print "".''; print ''; } // Module Phenix if ($conf->phenix->enabled) { $langs->load("other"); print "".''; print ''; print "".''; print ''; } // Company / Contact if ($conf->societe->enabled) { print ''; print ''; print "\n"; } // Module Adherent if ($conf->adherent->enabled) { $langs->load("members"); print ''; print ''; print "\n"; } print '
'.$langs->trans("Ref").''; print $fuser->id; print '
'.$langs->trans("Lastname").''; if ($caneditfield && !$fuser->ldap_sid) { print ''; } else { print ''; print $fuser->nom; } print ''; print $html->showphoto('userphoto',$fuser); if ($caneditfield) { if ($fuser->photo) print "
\n"; print ''; if ($fuser->photo) print ''; print ''; print ''; print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; } print '
'.$langs->trans("Firstname").''; if ($caneditfield && !$fuser->ldap_sid) { print ''; } else { print ''; print $fuser->prenom; } print '
'.$langs->trans("Login").''; if ($user->admin && !$fuser->ldap_sid) { print ''; } else { print ''; print $fuser->login; } print '
'.$langs->trans("Password").''; if ($fuser->ldap_sid) { $text=$langs->trans("DomainPassword"); } else if ($caneditpassword) { $text=''; if ($dolibarr_main_authentication && $dolibarr_main_authentication == 'http') { $text=$html->textwithpicto($text,$langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless",$dolibarr_main_authentication),1,'warning'); } } else { $text=preg_replace('/./i','*',$fuser->pass); } print $text; print "
'.$langs->trans("Administrator").''; print ''.yn($fuser->admin); print ' ('.$langs->trans("ExternalUser").')'; print '
'; $nbSuperAdmin = $user->getNbOfUsers('superadmin'); if ($user->admin && ($user->id != $fuser->id) // Don't downgrade ourself && ($fuser->entity > 0 || $nbSuperAdmin > 1) // Don't downgrade a superadmin if alone ) { print $form->selectyesno('admin',$fuser->admin,1); if (! empty($conf->multicompany->enabled) && ! $user->entity) { if ($conf->use_javascript_ajax) { print ''; } $checked=(($fuser->admin && ! $fuser->entity) ? ' checked' : ''); print ' '.$langs->trans("SuperAdministrator"); } } else { $yn = yn($fuser->admin); print ''; if (! empty($conf->multicompany->enabled) && ! $fuser->entity) print $html->textwithpicto($yn,$langs->trans("DontDowngradeSuperAdmin"),1,'warning'); else print $yn; } print '
'.$langs->trans("Type").''; if ($fuser->societe_id) { print $langs->trans("External"); } else if ($fuser->ldap_sid) { print $langs->trans("DomainUser"); } else { print $langs->trans("Internal"); } print '
'.$langs->trans("PhonePro").''; if ($caneditfield && !$fuser->ldap_sid) { print ''; } else { print ''; print $fuser->office_phone; } print '
'.$langs->trans("PhoneMobile").''; if ($caneditfield && !$fuser->ldap_sid) { print ''; } else { print ''; print $fuser->user_mobile; } print '
'.$langs->trans("Fax").''; if ($caneditfield && !$fuser->ldap_sid) { print ''; } else { print ''; print $fuser->office_fax; } print '
global->USER_MAIL_REQUIRED?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; if ($caneditfield && !$fuser->ldap_sid) { print ''; } else { print ''; print $fuser->email; } print '
'.$langs->trans("Signature").''; print ''; print '
'.$langs->trans("url_openid").''; if ($caneditfield && !$fuser->ldap_sid) { print ''; } else { print ''; print $fuser->openid; } print '
'.$langs->trans("Status").''; print $fuser->getLibStatut(4); print '
'.$langs->trans("LoginWebcal").''; if ($caneditfield) print ''; else print $fuser->webcal_login; print '
'.$langs->trans("LoginPhenix").''; if ($caneditfield) print ''; else print $fuser->phenix_login; print '
'.$langs->trans("PassPhenix").''; if ($caneditfield) print ''; else print preg_replace('/./i','*',$fuser->phenix_pass_crypted); print '
'.$langs->trans("LinkToCompanyContact").''; if ($fuser->societe_id > 0) { $societe = new Societe($db); $societe->fetch($fuser->societe_id); print $societe->getNomUrl(1,''); if ($fuser->contact_id) { $contact = new Contact($db); $contact->fetch($fuser->contact_id); print ' / '.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).''; } } else { print $langs->trans("ThisUserIsNot"); } print '
'.$langs->trans("LinkedToDolibarrMember").''; if ($fuser->fk_member) { $adh=new Adherent($db); $adh->fetch($fuser->fk_member); $adh->ref=$adh->login; // Force to show login instead of id print $adh->getNomUrl(1); } else { print $langs->trans("UserNotLinkedToMember"); } print '
'; print '
'; print ''; print '   '; print ''; print '
'; print '
'; print ''; } $ldap->close; } } $db->close(); llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.274 $'); /** * Return if var element is ok * @param string $element Variable to check * @return boolean Return true of variable is not empty */ function dolValidElement($element) { return (trim($element) != ''); } ?>