public static function voirProfil($request, $context) { try { // Au cas où, on controle la validité de if (!key_exists("id", $request) || !is_numeric($request["id"])) { throw new Exception("L'utilisateur que tu cherches n'existe pas."); } else { // On cherche le profil et les tweets dans la base, on les mets dans la session $u = utilisateurTable::getUserById($request["id"]); if (is_null($u)) { throw new Exception("L'utilisateur que tu cherches n'existe pas."); } $tweets = tweetTable::getTweetsPostedBy($request["id"], 10); mainController::marquerTweetsVotes($tweets); context::setSessionAttribute("utilisateurProfil", $u); context::setSessionAttribute("tweetsProfil", $tweets); return context::SUCCESS; } } catch (Exception $e) { context::setSessionAttribute("erreur", $e); return context::ERROR; } }