Пример #1
0
 private function displayActive()
 {
     if (!isset($this->displayActive)) {
         $this->displayActive = Model_User::getLoggedUser() === false ? false : true;
     }
     return $this->displayActive;
 }
Пример #2
0
 public function configureData()
 {
     if (!Tool::isOk($_POST['id']) || !($user = Model_User::getLoggedUser()) || $user->getId() != $_POST['id'] || !Tool::isOk($_POST['zip']) || !isset($_POST['gender']) || !Tool::isOk($_POST['login'])) {
         header('Location: ' . Conf::get('ROOT_PATH'));
         exit;
     }
     DB::update('UPDATE `user` SET
         `zip`="' . $_POST['zip'] . '",
         `male`="' . $_POST['gender'] . '"
         WHERE `id`="' . $_POST['id'] . '"');
     if (isset($_FILES) && isset($_FILES['avatar']) && $_FILES['avatar']['error'] != 4) {
         $size = filesize($_FILES['avatar']['tmp_name']);
         $stat = stat($_FILES['avatar']['tmp_name']);
         if ($size[0] <= 1680 && $size[1] <= 1680 && $stat['size'] <= 450 * 1024) {
             $extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['avatar']['name']));
             $original = Conf::get('MEDIA_DIR') . 'avatar/original/' . $_POST['id'] . '.' . $extention;
             move_uploaded_file($_FILES['avatar']['tmp_name'], $original);
             $sizeSmall = explode('x', Conf::get('AVATAR_SMALL_SIZE'));
             $sizeMedium = explode('x', Conf::get('AVATAR_MEDIUM_SIZE'));
             $sizeLarge = explode('x', Conf::get('AVATAR_LARGE_SIZE'));
             Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_LARGE_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeLarge[0], isset($sizeLarge[1]) ? $sizeLarge[1] : false, true);
             Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_MEDIUM_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeMedium[0], isset($sizeMedium[1]) ? $sizeMedium[1] : false, true);
             Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_SMALL_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeSmall[0], isset($sizeSmall[1]) ? $sizeSmall[1] : false, true);
         }
     }
     $_SESSION['feedback'] = 'Your informations has been updated';
     header('Location: ' . Conf::get('ROOT_PATH') . $_POST['login']);
 }
Пример #3
0
 public function configure()
 {
     // If no user is logged or this page's user is not logged
     if (!($user = Model_User::getLoggedUser()) || strtolower($user->getId()) == strtolower($this->user->getId())) {
         // TODO : 500
     }
     Globals::$tpl->assignSection('private');
     Globals::$tpl->assignVar(array('profile_id' => $user->getId(), 'profile_login' => $user->getLogin(), 'profile_male' => $user->getGender(), 'profile_zip' => $user->getZip(), 'profile_edit_zip_' . $user->getZip() => ' selected="selected"', 'profile_edit_gender_' . $user->getGender() => ' selected="selected"'));
 }
Пример #4
0
 public function configure()
 {
     // If some user are connected
     if ($user = Model_User::getLoggedUser()) {
         Globals::$tpl->assignSection('noLogin');
     } else {
         Globals::$tpl->assignSection('login');
     }
 }
Пример #5
0
 public function configure()
 {
     // Init category
     $category = new Model_Category(Conf::get('MAIN_CATEGORY'));
     if ($category->getQuestionsTotal(true) == 0) {
         return;
     }
     // Get logged user if there is one
     $user = Model_User::getLoggedUser();
     // Get questions
     $questions = $category->getQuestions('latest', $this->page, 1);
     // Loop through all questions
     foreach ($questions as $question) {
         Globals::$tpl->assignLoopVar('question', array('id' => $question->getId(), 'label' => $question->getLabel(), 'image' => $question->getImageURL('medium'), 'label_urlencoded' => urlencode($question->getLabel()), 'time' => Tool::timeWarp($question->getEndDate())));
         // Get answers
         $answers = $question->getAnswers();
         $friendsVotedId = array();
         if ($user) {
             $userResult = $user->getResult($question);
             $userGuess = $user->getGuess($question);
         }
         // Loop through all answers
         foreach ($answers as $answer) {
             Globals::$tpl->assignLoopVar('question.answer', array('id' => $answer->getId(), 'label' => $answer->getLabel()));
             if ($user && $userResult && $answer->getId() == $userResult->getAnswer()->getId()) {
                 Globals::$tpl->assignLoopVar('question.answer.user', array('class' => 'vote', 'label' => 'Mon opinion', 'id' => $user->getId(), 'login' => $user->getLogin(), 'image' => $user->getAvatarURL('small')));
             }
             if ($user && $userGuess && $answer->getId() == $userGuess->getAnswer()->getId()) {
                 Globals::$tpl->assignLoopVar('question.answer.user', array('class' => 'guess', 'label' => 'Mon pronostic', 'id' => $user->getId(), 'login' => $user->getLogin(), 'image' => 'media/layout/icon24x24/map_mini.png'));
             }
             if ($user) {
                 foreach ($user->getFriendGuesses($question) as $friendGuess) {
                     if ($answer->getId() == $friendGuess->getAnswer()->getId()) {
                         Globals::$tpl->assignLoopVar('question.answer.friend', array('class' => 'friend', 'userId' => $user->getId(), 'id' => $friendGuess->getFriend()->getId(), 'login' => $friendGuess->getFriend()->getLogin(), 'avatar' => $friendGuess->getFriend()->getAvatarURL('small')));
                         $friendsVotedId[] = $friendGuess->getFriend()->getId();
                     }
                 }
             }
         }
         if ($user && !$userResult) {
             Globals::$tpl->assignLoopVar('question.pendingUser', array('class' => 'vote', 'label' => 'Mon opinion', 'id' => $user->getId(), 'login' => $user->getLogin(), 'avatar' => $user->getAvatarURL('small')));
         }
         if ($user && !$userGuess) {
             Globals::$tpl->assignLoopVar('question.pendingUser', array('class' => 'guess', 'label' => 'Mon pronostic', 'id' => $user->getId(), 'login' => $user->getLogin(), 'avatar' => $user->getAvatarURL('small')));
         }
         if ($user) {
             // Construct unvoted friends list
             foreach ($user->getFriends() as $friend) {
                 if (!in_array($friend->getId(), $friendsVotedId)) {
                     Globals::$tpl->assignLoopVar('question.pendingFriend', array('class' => 'friend', 'userId' => $user->getId(), 'id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar' => $friend->getAvatarURL('small')));
                 }
             }
         }
     }
 }
Пример #6
0
 public function configureData()
 {
     $top = new Block_Top($this->tpl);
     $top->configure();
     // If some user are connected
     if ($user = Model_User::getLoggedUser()) {
         $this->tpl->assignSection('noLogin');
     } else {
         $this->tpl->assignSection('login');
     }
 }
Пример #7
0
 public function configureData()
 {
     // Configure top block
     $top = new Block_Top($this->tpl);
     $top->configure();
     // If no user is logged or this page's user is not logged
     if (($user = Model_User::getLoggedUser()) == false || strtolower($user->getLogin()) != strtolower($this->getParameter('login'))) {
         // TODO : 500
     }
     $this->tpl->assignSection('private');
     $this->tpl->assignVar(array('profile_id' => $user->getId(), 'profile_login' => $user->getLogin(), 'profile_avatar' => $user->getAvatarUri('large')));
 }
Пример #8
0
 public function configureData()
 {
     header("Cache-Control: no-cache");
     if (!($user = Model_User::getLoggedUser())) {
         $_SESSION['warning'] = 'You need to be logged to vote';
         echo 'register';
         exit;
     }
     if (Tool::isOk($_POST['question'])) {
         $question = new Model_Question($_POST['question']);
         if (isset($_POST['answer'])) {
             if ($_POST['answer'] == 0) {
                 if (Tool::isOk($_POST['vote']) && $_POST['vote'] == $user->getId()) {
                     // vote
                     $user->removeVote($question);
                 } else {
                     if (Tool::isOk($_POST['guess']) && $_POST['guess'] == $user->getId()) {
                         // guess
                         $user->removeGuess($question);
                     } else {
                         if (Tool::isOk($_POST['user']) && Tool::isOk($_POST['friend']) && $_POST['user'] == $user->getId()) {
                             // guess for friend
                             $user->removeGuessAboutFriend($question, new Model_User($_POST['friend']));
                         }
                     }
                 }
             } else {
                 $answer = new Model_Answer($_POST['answer'], $_POST['question']);
                 if (Tool::isOk($_POST['vote']) && $_POST['vote'] == $user->getId()) {
                     // vote
                     $user->removeVote($question);
                     $user->vote($question, $answer);
                 } else {
                     if (Tool::isOk($_POST['guess']) && $_POST['guess'] == $user->getId()) {
                         // guess
                         $user->removeGuess($question);
                         $user->guess($question, $answer);
                     } else {
                         if (Tool::isOk($_POST['user']) && Tool::isOk($_POST['friend']) && $_POST['user'] == $user->getId()) {
                             // guess for friend
                             $friend = new Model_User($_POST['friend']);
                             $user->removeGuessAboutFriend($question, $friend);
                             $user->guessAboutFriend($question, $friend, $answer);
                         }
                     }
                 }
             }
         }
     }
 }
Пример #9
0
 public function configureData()
 {
     // Configure top block
     $top = new Block_Top($this->tpl);
     $top->configure();
     $profile = new Model_User($this->getParameter('login'));
     $this->tpl->assignVar(array('profile_id' => $profile->getId(), 'profile_login' => $profile->getLogin(), 'profile_avatar' => $profile->getAvatarUri('large')));
     // If a user is logged
     if ($user = Model_User::getLoggedUser()) {
         // If I'm on my profile
         if ($user->getId() == $profile->getId()) {
             $this->tpl->assignSection('private');
         }
     }
 }
Пример #10
0
 public function configureData()
 {
     if (!Tool::isOk($_POST['id']) || !($user = Model_User::getLoggedUser()) || $user->getId() != $_POST['id'] || !Tool::isOk($_POST['old_password']) || !Tool::isOk($_POST['new_password'])) {
         header('Location: ' . Conf::get('ROOT_PATH'));
         exit;
     }
     $rs = DB::select('SELECT `id` FROM `user` WHERE `password`="' . md5($_POST['old_password']) . '"');
     if ($rs['total'] == 0) {
         $_SESSION['feedback'] = 'Your current password is not correct !';
     } else {
         $_SESSION['feedback'] = 'Password changed';
         DB::update('UPDATE `user` SET
             `password`="' . md5($_POST['new_password']) . '"
             WHERE `id`="' . $_POST['id'] . '"');
     }
     header('Location: ' . Conf::get('ROOT_PATH') . $_POST['login']);
 }
Пример #11
0
 public function configureData()
 {
     if (!($user = Model_User::getLoggedUser())) {
         $_SESSION['warning'] = 'You need to be logged to add users to your friends';
         echo 'register';
         exit;
     }
     $userId = $user->getId();
     $friendId = $_POST['friendId'];
     if ($userId == $friendId) {
         $_SESSION['warning'] = 'You are allready friend with this persone';
         echo 'reload';
         exit;
     }
     if ($_POST['action'] == 'add' || $_POST['action'] == 'ask') {
         $rs_friend = DB::select('
             SELECT `valided`
             FROM `friend`
             WHERE (`user_id_1`="' . $friendId . '" AND `user_id_2`="' . $userId . '")
             OR (`user_id_1`="' . $userId . '" AND `user_id_2`="' . $friendId . '")
         ');
         if ($rs_friend['total'] == 0) {
             DB::insert('INSERT INTO `friend` (`user_id_1`, `user_id_2`, `date`) VALUES
             (
                 "' . $userId . '",
                 "' . $friendId . '",
                 "' . time() . '"
             )');
         }
     } else {
         if ($_POST['action'] == 'accept') {
             DB::update('UPDATE `friend` SET `valided`="1" WHERE `user_id_1`="' . $friendId . '" AND `user_id_2`="' . $userId . '"');
         } else {
             DB::delete('DELETE FROM `friend`
             WHERE (`user_id_1`="' . $friendId . '" AND `user_id_2`="' . $userId . '")
             OR (`user_id_1`="' . $userId . '" AND `user_id_2`="' . $friendId . '")
         ');
             echo 'reload';
             exit;
         }
     }
     echo json_encode(array('friendId' => $friendId, 'userId' => $userId, 'action' => $_POST['action']));
 }
Пример #12
0
 public function configureData()
 {
     if (!($reader = Model_User::getLoggedUser())) {
         $_SESSION['warning'] = 'You need to be logged to add users to your friends';
         echo 'register';
         exit;
     }
     header('Content-Type: application/json; charset=utf-8');
     header("Cache-Control: no-cache");
     $result = array();
     if (isset($_POST['query']) && !empty($_POST['query'])) {
         $users = Model_User::search($_POST['query']);
         foreach ($users as $user) {
             if ($user->getId() != $reader->getId()) {
                 $result[] = array('id' => $user->getId(), 'login' => $user->getLogin(), 'avatar' => $user->getAvatarURL('small'));
             }
         }
     }
     echo json_encode($result);
 }
Пример #13
0
 public function configure()
 {
     if ($user = Model_User::getLoggedUser()) {
         $this->tpl->assignVar(array('user_login' => $user->getLogin(), 'user_id' => $user->getId()));
         $this->tpl->assignSection('logged');
     } else {
         $this->tpl->assignSection('notLogged');
     }
     // If a feedback should be displayed
     if (Tool::isOk($_SESSION['feedback'])) {
         $this->tpl->assignSection('feedback');
         $this->tpl->assignVar('feedback', $_SESSION['feedback']);
         unset($_SESSION['feedback']);
     }
     // If a warning should be displayed
     if (Tool::isOk($_SESSION['warning'])) {
         $this->tpl->assignSection('warning');
         $this->tpl->assignVar('warning', $_SESSION['warning']);
         unset($_SESSION['warning']);
     }
 }
Пример #14
0
 public function configureData()
 {
     // Configure top block
     $top = new Block_Top();
     $top->configure();
     $profile = Model_User::getInstanceByLogin($_GET['login']);
     Globals::$tpl->assignVar(array('profile_id' => $profile->getId(), 'profile_login' => $profile->getLogin(), 'profile_sex' => $profile->getGender(), 'profile_avatar' => $profile->getAvatarURL('large'), 'profile_region' => $profile->getZipName(), 'profile_gender' => $profile->getGender()));
     // If a user is logged
     if ($user = Model_User::getLoggedUser()) {
         // If I'm on my profile
         if ($user->getId() == $profile->getId()) {
             Globals::$tpl->assignSection('private');
             // Assign friends infos
             foreach ($user->getFriends('latest', false) as $friend) {
                 Globals::$tpl->assignLoopVar('request', array('id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar' => $friend->getAvatarURL('medium')));
             }
         }
     }
     Globals::$tpl->assignVar(array('profile_totalVote' => number_format($profile->getTotalResults(), 0, ',', ' '), 'profile_totalPredictionWon' => number_format($profile->getTotalCommonGuesses(), 0, ',', ' '), 'profile_totalPredictionLost' => number_format($profile->getTotalUnusualGuesses(), 0, ',', ' '), 'profile_predictionAccuracy' => number_format(round($profile->getPercentCommonGuesses()), 0, ',', ' '), 'profile_global_distance' => round($profile->getDistanceGlobal()), 'profile_friend_distance' => round($profile->getDistanceFriend())));
     // List all friends
     $friends = $profile->getFriends('latest', true);
     foreach ($friends as $friend) {
         Globals::$tpl->assignLoopVar('friend', array('id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar_medium' => $friend->getAvatarURL('medium'), 'avatar_small' => $friend->getAvatarURL('small'), 'predictionAccuracy_his' => round($friend->getPercentGuessesGood()), 'predictionAccuracy_my' => round($friend->getPercentFriendGuessesGood())));
     }
     // Compute user's feelings
     $profileFeelings = $profile->getFeelings();
     $colors = Conf::get('GRAPH_COLORS');
     $data[] = array('value' => $profileFeelings->getPercentPersonality() / 100 * 0.95 + 0.05, 'label' => 'Personalité', 'color' => $colors[0]);
     $data[] = array('value' => $profileFeelings->getPercentSurrounding() / 100 * 0.95 + 0.05, 'label' => 'Environement', 'color' => $colors[1]);
     $data[] = array('value' => $profileFeelings->getPercentKnowledge() / 100 * 0.95 + 0.05, 'label' => 'Savoir', 'color' => $colors[2]);
     $data[] = array('value' => $profileFeelings->getPercentExperience() / 100 * 0.95 + 0.05, 'label' => 'Experience', 'color' => $colors[3]);
     $data[] = array('value' => $profileFeelings->getPercentThoughts() / 100 * 0.95 + 0.05, 'label' => 'Pensées', 'color' => $colors[4]);
     $data[] = array('value' => $profileFeelings->getPercentSensitivity() / 100 * 0.95 + 0.05, 'label' => 'Sensibilité', 'color' => $colors[5]);
     Globals::$tpl->assignVar('feeling_data', json_encode($data));
     // No friends ?
     if ($profile->getFriendsTotal() == 0) {
         Globals::$tpl->assignSection('noFriends');
     }
 }
Пример #15
0
 public function configureData()
 {
     $top = new Block_Top($this->tpl);
     $top->configure();
     $id = $this->getParameter('u');
     $key = $this->getParameter('k');
     if (Tool::isOk($id) && Tool::isOk($key)) {
         // If some user are connected
         if ($user = Model_User::getLoggedUser()) {
             $this->tpl->assignSection('confirm_ok');
         } else {
             if (Model_User::isKeyValid($id, $key)) {
                 Model_User::validateRegistration($id);
                 Model_User::login($id);
                 $this->tpl->assignSection('confirm_ok');
             } else {
                 $this->tpl->assignSection('confirm_error');
             }
         }
     } else {
         $this->tpl->assignSection('confirm_wait');
     }
 }
Пример #16
0
 public function configure()
 {
     if ($user = Model_User::getLoggedUser()) {
         Globals::$tpl->assignVar(array('user_login' => $user->getLogin(), 'user_id' => $user->getId(), 'user_avatarURL' => $user->getAvatarURL('medium')));
         Globals::$tpl->assignSection('logged');
     } else {
         Globals::$tpl->assignVar(array('user_login' => '', 'user_id' => 0));
         Globals::$tpl->assignSection('notLogged');
     }
     // If a feedback should be displayed
     if (Tool::isOk($_SESSION['feedback'])) {
         Globals::$tpl->assignSection('feedback');
         Globals::$tpl->assignVar('feedback', $_SESSION['feedback']);
         unset($_SESSION['feedback']);
     }
     // If a warning should be displayed
     if (Tool::isOk($_SESSION['warning'])) {
         Globals::$tpl->assignSection('warning');
         Globals::$tpl->assignVar('warning', $_SESSION['warning']);
         unset($_SESSION['warning']);
     }
     // Did you know ?
     //$question   = Model_Question::getRandomQuestion(); // USE THE METHOD FROM MODEL CATEGORY !
     //$answers    = $question->getAnswers();
     //$didyouknow = $question->getDidyouknow();
     //foreach ($answers as $key => $answer)
     //{
     //$didyouknow = str_replace('{PERCENT_' . ($key + 1) . '}', number_format($answer->getPercentResultsMatching($question->getId()), 1, ',', ' '), $didyouknow);
     //}
     //$tpl->assignVar(array
     //(
     //'didyouknow_label' => $didyouknow,
     //'didyouknow_id'    => $question->getId(),
     //'didyouknow_guid'  => Tool::makeGuid($question->getLabel()),
     //));
 }
Пример #17
0
 public function configureData()
 {
     // Configure top block
     $top = new Block_Top();
     $top->configure();
     $profile = new Model_User($_GET['login']);
     Globals::$tpl->assignVar(array('profile_id' => $profile->getId(), 'profile_login' => $profile->getLogin(), 'profile_sex' => $profile->getGender(false), 'profile_avatar' => $profile->getAvatarURL('large'), 'profile_region' => $profile->getZipName(), 'profile_gender' => $profile->getGender()));
     // Get stats on friends
     $profileFriendsStats = $profile->getGuessFriendsStats();
     // If a user is logged
     if ($user = Model_User::getLoggedUser()) {
         // If I'm on my profile
         if ($user->getId() == $profile->getId()) {
             Globals::$tpl->assignSection('private');
             // Get pending friend requests
             $pendingFriends = $user->getPendingFriends();
             // Assign friends infos
             foreach ($pendingFriends as $friend) {
                 Globals::$tpl->assignLoopVar('request', array('id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar' => $friend->getAvatarURL('medium')));
             }
         }
     }
     $profileTotalVotes = $profile->getTotalVotes();
     Globals::$tpl->assignVar(array('profile_totalVote' => $profileTotalVotes, 'profile_totalPredictionWon' => 0, 'profile_totalPredictionLost' => 0, 'profile_predictionAccuracy' => 0, 'profile_global_distance' => 0, 'profile_friend_distance' => 0));
     // Get stats on profil's user guesses according to global votes
     $profileGGS = $profile->getGuessGlobalStats();
     if ($profileGGS['guesses'] != 0) {
         Globals::$tpl->assignVar(array('profile_totalPredictionWon' => $profileGGS['goodGuesses'], 'profile_totalPredictionLost' => $profileGGS['badGuesses'], 'profile_predictionAccuracy' => round($profileGGS['goodGuesses'] / $profileGGS['guesses'] * 100)));
     }
     // List all friends
     $friends = $profile->getFriends();
     foreach ($friends as $friend) {
         Globals::$tpl->assignLoopVar('friend', array('id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar_medium' => $friend->getAvatarURL('medium'), 'avatar_small' => $friend->getAvatarURL('small')));
         foreach ($profileFriendsStats as $stat) {
             // Get stats on profil's user gusses
             if ($friend->getId() == $stat['user']->getId()) {
                 Globals::$tpl->assignLoopVar('friend.stat', array('predictionAccuracy_his' => round($stat['his_guesses'] == 0 ? 0 : $stat['his_goodGuesses'] / $stat['his_guesses'] * 100), 'predictionAccuracy_my' => round($stat['my_guesses'] == 0 ? 0 : $stat['my_goodGuesses'] / $stat['my_guesses'] * 100)));
             }
         }
     }
     // If profile's user already voted
     if ($profileTotalVotes != 0) {
         $totalQuestions = Model_Question::getTotalQuestions();
         // Get stats on profil's user votes according to global votes
         $profileAGS = $profile->getAnswerGlobalStats();
         if ($profileAGS['votes'] != 0) {
             Globals::$tpl->assignVar(array('profile_global_distance' => round(($profileAGS['votes'] - $profileAGS['goodVotes']) / $profileAGS['votes'] * $totalQuestions)));
         }
         // Get stats on profil's user votes according to his friends votes
         $profileAFS = $profile->getAnswerFriendStats();
         if ($profileAFS['votes'] != 0) {
             Globals::$tpl->assignVar(array('profile_friend_distance' => round(($profileAFS['votes'] - $profileAFS['goodVotes']) / $profileAFS['votes'] * $totalQuestions)));
         }
     }
     // Compute user's feelings
     $profileFeelings = $profile->getFeelings();
     $maxFeelingScore = 0;
     foreach ($profileFeelings as $total) {
         $maxFeelingScore = $maxFeelingScore < $total ? $total : $maxFeelingScore;
     }
     $feelings = array('Personalité', 'Environement', 'Savoir', 'Experience', 'Réflexion', 'Sensibilité');
     $colors = Conf::get('GRAPH_COLORS');
     $data = array();
     foreach ($feelings as $id => $label) {
         Globals::$tpl->assignLoopVar('feeling', array('label' => $label, 'percent' => round($maxFeelingScore == 0 ? 0 : $profileFeelings[$id + 1] / $maxFeelingScore * 100)));
         $data[] = array('value' => ($maxFeelingScore ? 1 - $profileFeelings[$id + 1] / $maxFeelingScore : 0) * 0.95 + 0.05, 'label' => $label, 'color' => $colors[$id]);
     }
     Globals::$tpl->assignVar('feeling_data', json_encode($data));
     // No friends ?
     if (count($friends) == 0 && (!isset($pendingFriends) || count($pendingFriends) == 0)) {
         Globals::$tpl->assignSection('noFriends');
     }
 }