/** * @param Rest_Token $token * @return PFUser or null if the user is not found * @throws Rest_Exception_InvalidTokenException */ public function checkToken(Rest_Token $token) { if ($this->token_factory->doesTokenExist($token->getUserId(), $token->getTokenValue())) { return $this->user_manager->getUserById($token->getUserId()); } throw new Rest_Exception_InvalidTokenException(); }
private function getUserFromParameters() { $user = $this->user_manager->getUserById($this->getUserIdFromParameters()); if ($user == null) { throw new UserNotExistException(); } return $user; }
public function updateWithUserId($user_id) { $user = $this->user_manager->getUserById($user_id); if ($user && $user->isAlive()) { $this->updateWithUser($user); } else { $this->logger->warn('Do not write LDAP info about non existant or suspended users ' . $user_id); } }
/** * * @param int $group_id * @return GenericUser|null */ public function fetch($group_id) { if ($row = $this->dao->fetch($group_id)->getRow()) { $pfuser = $this->user_manager->getUserById($row['user_id']); $generic_user = $this->generateGenericUser($group_id, $pfuser); return $generic_user; } return null; }
/** * Retrieve users who are assigned to a given artifact * * @param Tracker_Artifact $artifact * @return PFUser[] */ public function getAssignees(Tracker_Artifact $artifact) { $user_collection = array(); foreach ($this->getAssigneeIds($artifact) as $user_id) { $user = $this->user_manager->getUserById($user_id); if ($user) { $user_collection[$user_id] = $user; } } return $user_collection; }
/** * Get the field data for artifact submission * @throws Tracker_Artifact_Attachment_FileNotFoundException * @throws Tracker_Artifact_Attachment_AlreadyLinkedToAnotherArtifactException */ public function buildFieldDataForREST($rest_value, Tracker_Artifact $artifact = null) { $field_data = array(); $already_attached_file_ids = array(); if ($artifact) { $already_attached_file_ids = $this->getAlreadyAttachedFileIds($artifact); } $given_rest_file_ids = $rest_value->value; // Ids given in REST foreach ($given_rest_file_ids as $file_id) { $linked_artifact = $this->file_info_factory->getArtifactByFileInfoIdInLastChangeset($file_id); // Temporary => link if (!$linked_artifact && $this->isFileIdTemporary($file_id)) { $temporary_file = $this->getFile($file_id); $user = $this->user_manager->getUserById($temporary_file->getCreatorId()); if (!$this->exists($user, $temporary_file->getTemporaryName())) { throw new Tracker_Artifact_Attachment_FileNotFoundException('Temporary file #' . $file_id . ' not found'); } $field_data[] = $this->file_info_factory->buildFileInfoData($temporary_file, $this->getPath($user, $temporary_file->getTemporaryName())); } elseif (!$linked_artifact && !$this->isFileIdTemporary($file_id)) { throw new Tracker_Artifact_Attachment_FileNotFoundException('Temporary file #' . $file_id . ' not found'); // Already attached to another artifact => error } elseif ($artifact && $artifact->getId() != $linked_artifact->getId() || !$artifact && $linked_artifact) { throw new Tracker_Artifact_Attachment_AlreadyLinkedToAnotherArtifactException('File #' . $file_id . ' is already linked to artifact #' . $linked_artifact->getId()); } } // Already attached file ids foreach ($already_attached_file_ids as $file_id) { // Not in given ids => unlink if (!in_array($file_id, $given_rest_file_ids)) { $field_data['delete'][] = $file_id; } } return $field_data; }
/** * Fonction faisant devenir premium le membre connecté. */ function Premium() { $udm = new User_DroitManager(connexionDb()); $udm->modifDroit($_SESSION['User']->getId(), 3); $um = new UserManager(connexionDb()); $user = $um->getUserById($_SESSION['User']->getId()); $_SESSION['User'] = $user; }
private function getUser($user_id) { $user = $this->user_manager->getUserById($user_id); if (!$user) { throw new Tracker_Artifact_MailGateway_RecipientUserDoesNotExistException(); } return $user; }
/** * Return the addtionnal value * * @return Tracker_FormElement_Field_List_Bind_UsersValue */ protected function getAdditionnalValue($value_id) { if (!isset($this->additionnal_values[$value_id])) { $this->additionnal_values[$value_id] = null; if ($user = $this->userManager->getUserById($value_id)) { $this->additionnal_values[$value_id] = new Tracker_FormElement_Field_List_Bind_UsersValue($user->getId()); } } return $this->additionnal_values[$value_id]; }
/** * Fonction servant à vérifier l'existence d'un membre à l'aide de l'ID contenu dans l'url. * @return bool : true si il existe, false si il n'existe pas. */ function membreExistant() { $id = $_GET['membre']; $um = new UserManager(connexionDb()); $user = $um->getUserById($id); if ($user->getUserName() == NULL) { return false; } else { return true; } }
public static function getFriendByFid($_fid) { $arr = array(); require "opendb.php"; require "history.php"; require "account.php"; require "user.php"; array_push($arr, array("user" => UserManager::getUserById($_fid), "lastlocation" => HistoryManager::getLastUserHistory($_fid), "state" => UserManager::getAvailable($_fid), "numberlist" => AccountManager::getNumbersById($_fid), "share" => "-1")); //require("closedb.php"); return $arr[0]; }
/** * Authenticate user but doesn't verify if they are valid * * @param String $name * @param String $password * @return PFUser * @throws User_InvalidPasswordWithUserException * @throws User_InvalidPasswordException * @throws User_PasswordExpiredException */ public function authenticate($name, $password) { $auth_success = false; $auth_user_id = null; $auth_user_status = null; $this->event_manager->processEvent(Event::SESSION_BEFORE_LOGIN, array('loginname' => $name, 'passwd' => $password, 'auth_success' => &$auth_success, 'auth_user_id' => &$auth_user_id, 'auth_user_status' => &$auth_user_status)); if ($auth_success) { $user = $this->user_manager->getUserById($auth_user_id); } else { $user = $this->user_manager->getUserByUserName($name); if (!is_null($user)) { $auth_success = $this->authenticateFromDatabase($user, $password); } } if (!$user) { throw new User_InvalidPasswordException(); } else { if (!$auth_success) { throw new User_InvalidPasswordWithUserException($user); } } return $user; }
private function appendDocuments(DOMElement $parent_node, PFUser $admin_user, $doc_group_id) { foreach ($this->dao->searchAllDocs($doc_group_id) as $row) { $creator_name = $admin_user->getUserName(); $creator = $this->user_manager->getUserById($row['created_by']); if ($creator !== null && ($creator->isActive() || $creator->isRestricted())) { $creator_name = $creator->getUnixName(); } $document = $this->createDocument($row['title'], $row['description'], $row['createdate'], $row['updatedate'], $creator_name); $this->appendPermissions($document, $row['docid'], self::DOCUMENT_PERMISSION_TYPE); $this->appendFile($document, $row, $creator_name); $parent_node->appendChild($document); } }
private function userHavePermissionOnTracker(PFUser $user, Tracker_Artifact $artifact) { $permissions = $artifact->getTracker()->getAuthorizedUgroupsByPermissionType(); foreach ($permissions as $permission_type => $ugroups) { switch ($permission_type) { case Tracker::PERMISSION_FULL: foreach ($ugroups as $ugroup) { if ($this->userBelongsToGroup($user, $artifact, $ugroup)) { return true; } } break; case Tracker::PERMISSION_SUBMITTER: foreach ($ugroups as $ugroup) { if ($this->userBelongsToGroup($user, $artifact, $ugroup)) { // check that submitter is also a member $submitter = $this->user_manager->getUserById($artifact->getSubmittedBy()); if ($this->userBelongsToGroup($submitter, $artifact, $ugroup)) { return true; } } } break; case Tracker::PERMISSION_ASSIGNEE: foreach ($ugroups as $ugroup) { if ($this->userBelongsToGroup($user, $artifact, $ugroup)) { // check that one of the assignees is also a member $permission_assignee = new Tracker_Permission_PermissionRetrieveAssignee($this->user_manager); foreach ($permission_assignee->getAssignees($artifact) as $assignee) { if ($this->userBelongsToGroup($assignee, $artifact, $ugroup)) { return true; } } } } break; case Tracker::PERMISSION_SUBMITTER_ONLY: foreach ($ugroups as $ugroup) { if ($this->userBelongsToGroup($user, $artifact, $ugroup)) { if ($user->getId() == $artifact->getSubmittedBy()) { return true; } } } break; } } return false; }
public function getUserById($userId, $initObjects = self::INIT_ALL, $cacheMinutes = 0, $cacheTag = null) { if ($this->memcache != null) { $key = $this->memcache->getNamespacedKey(self::USER_TAG . $userId); $cache = $this->memcache->get($key); if ($cache !== false and !empty($cache) and is_a($cache, "User") and isset($cache->id) and !empty($cache->id)) { return $cache; } $user = parent::getUserById($userId, self::INIT_ALL); $this->memcache->set($key, $user, 0); return $user; } else { return parent::getUserById($userId, $initObjects); } }
/** * Remove User from User Group * * * Error codes: * * 3000, Invalid project id * * 3201, Permission denied: need to be project admin * * 3203, Invalid user id * * 3301, User Group doesn't exist * * @param String $sessionKey The project admin session hash * @param Integer $groupId The Project id where the User Group is defined * @param Integer $ugroupId The User Group where the user should be removed * @param Integer $userId The user id to remove * * @return Boolean */ public function removeUserFromUGroup($sessionKey, $groupId, $ugroupId, $userId) { $this->getProjectIfUserIsAdmin($groupId, $sessionKey); if ($user = $this->userManager->getUserById($userId)) { try { $ugroup = new ProjectUGroup(array('ugroup_id' => $ugroupId, 'group_id' => $groupId)); $ugroup->removeUser($user); } catch (Exception $e) { throw new SoapFault((string) $e->getCode(), $e->getMessage()); } $this->feedbackToSoapFault(); return true; } else { throw new SoapFault('3203', "Invalid user id {$userId}"); } }
/** * @return Tracker_Artifact_PriorityHistoryChange */ public function getInstanceFromRow($row) { return new Tracker_Artifact_PriorityHistoryChange($this->tracker_artifact_factory, $row['id'], $this->tracker_artifact_factory->getArtifactById($row['moved_artifact_id']), $this->tracker_artifact_factory->getArtifactById($row['artifact_id_higher']), $this->tracker_artifact_factory->getArtifactById($row['artifact_id_lower']), $row['context'], ProjectManager::instance()->getProject($row['project_id']), (bool) $row['has_been_raised'], $this->user_manager->getUserById($row['prioritized_by']), $row['prioritized_on']); }
/** * Fonction faisant quitter le groupe d'activité que l'user possédait si il essaye de changer d'activité. Si il était chef * de groupe, il passe le lead à un autre membre du groupe ou le supprimer si il était le seul membre de ce groupe. */ function leaveGroupe() { require "../Manager/Groupe_InvitationManager.manager.php"; $ugm = new User_GroupeManager(connexionDb()); $gmm = new Groupe_MessageManager(connexionDb()); $gim = new Groupe_InvitationManager(connexionDb()); $idGr = $ugm->getGroupeIdByUserId($_SESSION['User']); if (isset($idGr[0]['id_groupe'])) { $groupe = new Groupe(array("id_groupe" => $idGr[0]['id_groupe'])); if (hasGroupe()) { $nom = $_SESSION['User']->getUserName(); $desc = "L'utilisateur {$nom} a quitté le groupe suite à un changement d'activité."; $gmm->addMess($groupe, $_SESSION['User'], $desc); $ugm->deleteUserGroupe($_SESSION['User']); } if (isLeader()) { $autreMembre = false; $gm = new GroupeManager(connexionDb()); $tabUser = $ugm->getUserIdByGroupeId($groupe); foreach ($tabUser as $elem) { if ($elem['id_user'] != $_SESSION['User']->getId()) { if (isset($elem['id_user']) && $elem['id_user'] != 0) { $autreMembre = true; $idNewLeader = $elem['id_user']; $nom = $_SESSION['User']->getUserName(); $um = new UserManager(connexionDb()); $newLead = $um->getUserById($idNewLeader); $userName = $newLead->getUserName(); $desc = "L'utilisateur {$nom} a quitté le groupe suite à un changement d'activité. {$userName} est dorénavant votre nouveau chef de groupe."; $gmm->addMess($groupe, $_SESSION['User'], $desc); } } } if ($autreMembre) { $gm->updateLeader($groupe, $idNewLeader); } else { $ugm->deleteGroupe($groupe); $gmm->deleteMessByGroupe($groupe); $gim->deleteInvitByGroupeId($groupe); $gm->deleteGroupe($_SESSION['User']->getId()); } } } }
/** * Fonction permettant de vérifier si le formulaire de modification de profil est correct et si il ne contient pas d'erreurs. * @param User $user : l'utilisateur qui a fait la demande de changement de profil. * @return array : un tableau contenant tous les messages d'erreur liés au formulaire de changement de profil ou un booleen * si le formulaire est correct. */ function isValidForm(User $user) { $config = getConfigFile()['CONSTANTE']; $UserName = $_POST['userName']; $Email = $_POST['email']; $Mdp = $_POST['Mdp']; $MdpBis = $_POST['MdpBis']; $tel = $_POST['Tel']; $MdpActuel = $_POST['MdpActuel']; if ($Mdp == '') { $Mdp = NULL; $MdpBis = NULL; } $userTest = new User(array("UserName" => $UserName, "email" => $Email, "Mdp" => $Mdp, "tel" => $tel)); $tab = array("RETURN" => false, "ERROR" => array()); $nameValable = false; $emailValable = false; $mdpValable = false; $nameExistant = false; $mailExistant = false; $goodMdp = false; $boolean_name = false; $boolean_mdp = false; $mdpIdentique = false; $noMdp = false; $um = new UserManager(connexionDb()); $nameVerif = $um->getUserByUserName($userTest->getUserName()); if ($nameVerif->getUserName() != NULL && $user->getUserName() != $UserName) { $nameExistant = true; $tab['ERROR']['Name'] = "Nom déjà existant "; } if (champsEmailValable($Email)) { $emailValable = true; } else { $tab['ERROR']['EmailValable'] = "Votre email contient des caractères indésirables"; } if (champsEmailValable($UserName)) { $nameValable = true; } else { $tab['ERROR']['NameValable'] = "Votre nom d'utilisateur contient des caractères indésirables"; } $mailVerif = $um->getUserByEmail($userTest->getEmail()); if ($mailVerif->getUserName() != NULL && $user->getEmail() != $Email) { $mailExistant = true; $tab['ERROR']['Email'] = "Email déjà existant"; } if ($user->getMdp() == hash("sha256", $MdpActuel . $user->getSalt())) { $goodMdp = true; } else { $tab['ERROR']['MdpActuel'] = "Mauvais mot de passe actuel ! Annulation de la modification"; } if (isset($UserName) and strlen($UserName) >= $config['size_user_name']) { $boolean_name = true; } else { $tab['ERROR']['UserName'] = "******" . $config['size_user_name'] . ")"; } if (isset($Mdp) and isset($MdpBis) and $Mdp == $MdpBis and $Mdp != NULL) { if (strlen($Mdp) >= $config['size_user_mdp']) { $boolean_mdp = true; } else { $tab['ERROR']['Mdp'] = "Mots de passe trop court (min: " . $config['size_user_mdp'] . ")"; } if (champsMdpValable($Mdp)) { $mdpValable = true; } else { $tab['ERROR']['mdpValable'] = "Votre mot de passe contient des caractères indésirables"; } } else { $noMdp = true; } if (isset($Mdp) and isset($MdpBis) and $Mdp != $MdpBis) { $tab['ERROR']['Mdp'] = "Le mot de passe et le mot de passe de vérification sont différents"; } else { $mdpIdentique = true; } $tab['RETURN'] = ($boolean_mdp && $mdpValable || $noMdp and $boolean_name and !$nameExistant and !$mailExistant and $goodMdp && $mdpIdentique && $nameValable && $emailValable); if ($tab['RETURN']) { if (isset($UserName) and $userTest->getUserName() != $user->getUserName()) { $user->setUserName($UserName); } if (isset($Email) and $userTest->getEmail() != $user->getEmail()) { $user->setEmail($Email); } if (isset($Mdp) and strlen($Mdp) > 4 and hash("sha256", $userTest->getMdp() . $userTest->getSalt()) != $user->getMdp()) { $user->setMdp($Mdp); $user->setHashMdp(); } if (isset($tel) and $tel != $user->getTel()) { $user->setTel($tel); } $um->updateUserProfil($user); $userToReconnect = $um->getUserById($user->getId()); setSessionUser($userToReconnect); } return $tab; }
/** * Display the list of people monitoring the package with the delete form * * @param Integer $fileModuleId Id of the package * @param UserManager $um UserManager instance * @param UserHelper $userHelper UserHelper instance * * @return String */ public function getMonitoringListHTML($fileModuleId, $um, $userHelper) { $editContent = '<h3>' . $GLOBALS['Language']->getText('file_filemodule_monitor', 'monitoring_people_title') . '</h3>'; $list = $this->whoIsPubliclyMonitoringPackage($fileModuleId); $totalCount = count($this->getFilesModuleMonitorFromDb($fileModuleId)); $count = $totalCount - count($this->whoIsPubliclyMonitoringPackage($fileModuleId)); if ($list->rowCount() == 0) { $editContent .= $GLOBALS['Language']->getText('file_filemodule_monitor', 'users_monitor', $count) . '<br />'; $editContent .= $GLOBALS['Language']->getText('file_filemodule_monitor', 'no_list'); } else { $editContent .= '<form id="filemodule_monitor_form_delete" method="post" >'; $editContent .= '<input type="hidden" name="action" value="delete_monitoring">'; $editContent .= html_build_list_table_top(array($GLOBALS['Language']->getText('file_filemodule_monitor', 'user'), $GLOBALS['Language']->getText('global', 'delete') . '?'), false, false, false); $rowBgColor = 0; foreach ($list as $entry) { $user = $um->getUserById($entry['user_id']); $editContent .= '<tr class="' . html_get_alt_row_color(++$rowBgColor) . '"><td>' . $userHelper->getDisplayName($user->getName(), $user->getRealName()) . '</td><td><input type="checkbox" name="delete_user[]" value="' . $entry['user_id'] . '" /></td></tr>'; } $editContent .= '<tr class="' . html_get_alt_row_color(++$rowBgColor) . '"><td>' . $GLOBALS['Language']->getText('file_filemodule_monitor', 'users_monitor', $count) . '</td><td></td></tr>'; $editContent .= '<tr class="' . html_get_alt_row_color(++$rowBgColor) . '"><td>' . $GLOBALS['Language']->getText('global', 'total') . ': ' . $totalCount . '</td><td><input id="filemodule_monitor_submit" type="submit" value="' . $GLOBALS['Language']->getText('global', 'delete') . '" /></td></tr>'; $editContent .= '</table>'; $editContent .= '</form>'; } return $editContent; }
public function exportUserByUserId($user_id, SimpleXMLElement $members_node, $child_name) { $user = $this->user_manager->getUserById($user_id); $this->exportUser($user, $members_node, $child_name); }
/** * Fonction vérifiant l'identité du membre et le connectant si il possède la bonne identité. * @return array : tableau de message d'erreur dans le cas où ses informations sont fausses, si il est banni ou encore * si il ne s'est pas activé. */ function doConnect() { $tabRetour = array(); $mdp = $_POST['mdp']; $userName = $_POST['userName']; $manager = new UserManager(connexionDb()); $tabUser = $manager->getAllUser(); $userToConnect = new User(array("UserName" => $userName, "Mdp" => $mdp)); $userFound = $manager->getUserByUserName($userName); /** * Je vérifie sur le user est dans la base de donnée et existe bel et bien */ $echec = false; if ($userFound->getId() != NULL) { foreach ($tabUser as $elem) { //$mdp == hash("sha256", $elem->getMdp()); //password_verify($mdp, $elem->getMdp()) if ($userName == $elem->getUserName() && hash("sha256", $userToConnect->getMdp() . $userFound->getSalt()) == $elem->getMdp()) { $echec = false; $userToConnect = $elem; $id = $elem->getId(); break; } else { $echec = true; } } } else { $echec = true; } /** * Je vérifie que le user n'a pas besoin de s'activer avant de se connecter, l'user pouvant avoir * deux code (inscription et mdp oublié), je vérifie que c'est bien le code d'inscription */ $needActi = false; $banni = false; if (isset($id)) { $acManager = new ActivationManager(connexionDb()); $act = $acManager->getActivationByLibelleAndId("Inscription", $id); if (isset($act) && $act->getCode() != NULL) { $needActi = true; } else { $needActi = false; } } $userToConnect = $manager->getUserById($userToConnect->getId()); if ($echec == true) { $tabRetour['Error'] = "<div class='alert alert-danger' role='alert'>Erreur lors de la connexion, veuillez rééssayer avec le bon login ou mot de passe !</div>"; } else { if ($userToConnect->getDroit()[0]->getId() == 6) { $tabRetour['Error'] = "<div class='alert alert-danger' role='alert'>Vous êtes banni, impossible de vous connecter !</div>"; $banni = true; } else { if ($needActi == true) { $tabRetour['Activation'] = "<div class='alert alert-danger' role='alert'>Vous devez activer votre compte avant la connexion !</div>"; } else { $user = $manager->getUserById($id); $manager->updateUserConnect($user); //$_SESSION['User'] = $user; setSessionUser($user); echo "Bienvenue sur EveryDayIdea !"; } } } $tabRetour['Retour'] = !$echec; $tabRetour['Valide'] = !$needActi; $tabRetour['Banni'] = !$banni; return $tabRetour; }
/** * Fonction vérifiant si un membre concerné est premium. * @return bool : true si il est premium, false sinon. */ function isPremium() { $id = $_GET['membre']; $um = new UserManager(connexionDb()); $userDroit = $um->getUserById($id); if ($userDroit->getDroit()[0]->getLibelle() == 'Premium' || $userDroit->getDroit()[0]->getLibelle() == 'Administrateur' || $userDroit->getDroit()[0]->getLibelle() == 'Moderateur') { return true; } else { return false; } }
echo json_encode(array('users' => UserManager::getAllUsersByWorkplace($_REQUEST['id'], $_REQUEST['workplace']))); break; case 'GET_USER_LIST_BY_GENDER': echo json_encode(array('users' => UserManager::getAllUsersByGender($_REQUEST['id'], $_REQUEST['gender']))); break; case 'GET_USER_LIST_BY_YEARS': echo json_encode(array('users' => UserManager::getAllUsersByYears($_REQUEST['id'], $_REQUEST['from'], $_REQUEST['to']))); break; case 'GET_USER_LIST_BY_STHG': echo json_encode(array('users' => UserManager::getAllUsersBySthg($_REQUEST['id'], $_REQUEST['sthg']))); break; case 'GET_USER_LIST_BY_ADVANCE': echo json_encode(array('users' => UserManager::getAllUsersByAdvance($_REQUEST['id'], $_REQUEST['name'], $_REQUEST['gender'], $_REQUEST['address'], $_REQUEST['from'], $_REQUEST['to'], $_REQUEST['school'], $_REQUEST['workplace']))); break; case 'GET_USER_BY_ID': echo json_encode(UserManager::getUserById($_REQUEST['id'])); break; case 'GET_PROFILE': echo json_encode(UserManager::getMyProfile($_REQUEST['id'])); break; case 'GET_USER_STATE': echo UserManager::getAvailable($_REQUEST['id']); break; case 'CHANGE_PASSWORD': echo UserManager::changePassword($_REQUEST['id'], md5($_REQUEST['oldpass']), md5($_REQUEST['newpass'])); break; case 'CHANGE_AVATAR': echo UserManager::changeUserAvatar($_REQUEST['id'], $_REQUEST['avatar']); break; case 'UPDATE_GCMID': echo UserManager::updateGcmId($_REQUEST['id'], $_REQUEST['gcmid']);
/** * Si le user a rempli le formulaire de changement de mdp, la fonction regarde si le login correspond au user * possédant ce code d'activation et si cela est vrai, il change son mdp en bdd et delete son code d'activation en BDD */ function changementMdp() { if (isset($_POST['userName']) && isset($_POST['mdp']) && $_POST['mdp'] == $_POST['verifmdp'] && goodCode()) { $code = $_GET['code']; $mdp = $_POST['mdp']; $userName = $_POST['userName']; $am = new ActivationManager(connexionDb()); $ac = $am->getActivationByCodeAndLibelle("Récupération", $code); $userId = $ac->getIdUser(); $um = new UserManager(connexionDb()); /** * Je récupère cet user grâce à l'id du user possédant le code d'acti */ $userRecup = $um->getUserById($userId); /** * Je récupère l'autre user grâce au login qu'il a encodé dans le formulaire */ $userTest = $um->getUserByUserName($userName); /** * Je compare les deux users pour voir si ce sont les mêmes */ if ($userTest->getUserName() != $userRecup->getUserName()) { echo "<section class='row'>"; echo "<br><br><br><br><br><br><br><br><br><br><br><br><div class='alert alert-danger' role='alert'>Votre nom d'utilisateur ne correspond pas à l'utilisateur possédant ce code d'activation !</div>"; echo "</section>"; } else { $userRecup->setMdp($mdp); $am->deleteActivation($ac); $um->updateUserMdp($userRecup); echo "<br><br><br><br><br><br><br><br><br><br><br><br><div class='alert alert-success' role='success'>Votre mot de passe a bien été modifié, vous pouvez vous connecter !</div>"; echo "<meta http-equiv='refresh' content='2; URL=connexion.page.php'>"; } } }
private function getRequester() { $user_id = (int) $this->getParameter(3); return $this->user_manager->getUserById($user_id); }
require "./Entity/User.class.php"; require "./Entity/Droit.class.php"; require "Manager/ActivityManager.manager.php"; require "Manager/User_ActivityManager.manager.php"; require "Entity/Activity.class.php"; require "Library/database.lib.php"; require "Library/config.lib.php"; require "Library/Fonctions/Fonctions.php"; require "Manager/UserManager.manager.php"; require "Manager/DroitManager.manager.php"; startSession(); $isConnect = isConnect(); $configIni = getConfigFile(); if (isConnect()) { $um = new UserManager(connexionDb()); $user = $um->getUserById($_SESSION['User']->getId()); $_SESSION['User'] = $user; } ?> <!doctype html> <html lang="fr"> <head> <meta charset="UTF-8"> <title>Accueil</title> <link rel="icon" type="image/png" href="Images/favicon.png" /> <link rel="stylesheet" type="text/css" href="./vendor/twitter/bootstrap/dist/css/bootstrap.css"> <link rel="stylesheet" type="text/css" href="./Style/general.css"> <link rel="stylesheet" type="text/css" href="./personalisation.css"> </head> <body>
/** * Fonction envoyant un message à l'adresse mail de l'utilisateur concerné. * @return string : le message de succès. */ function envoiMessage() { if (isset($_POST['formulaireEnvoi'])) { $id = $_POST['idUserMess']; $um = new UserManager(connexionDb()); $userToSend = $um->getUserById($id); $adresseAdmin = "*****@*****.**"; $to = $userToSend->getEmail(); $sujet = $_POST['titre']; $entete = "From:" . $adresseAdmin . "\r\n"; $entete .= "Content-Type: text/html; charset=utf-8\r\n"; $message = $_POST['description']; mail($to, $sujet, $message, $entete); return "<div class='alert alert-success' role='alert'> Message envoyé à l'utilisateur concerné ! </div>"; } }