public function pendingRequestsForCurrentUser() { $response['requests'] = array(); $response['signed'] = false; $response['succeeded'] = false; if (isset($_SESSION["user_id"]) && strlen(trim($_SESSION["user_id"])) > 0) { $response['signed'] = true; $response['requests'] = getPendingRequests($_SESSION["user_id"]); $response['succeeded'] = true; } echo json_encode($response); }
// echo '<div class="gadget_container">TODO: GADGETS/Applications</div>'; // echo '</div>'; ?> </div> <div class="my-contacts"> <?php //if friends array is not empty. if (!empty($friends)) { $savant->assign('friends', $friends); } else { $savant->assign('friends', getFriends($_SESSION['member_id'], SOCIAL_FRIEND_HOMEPAGE_MAX)); } $savant->assign('group_invitations', getGroupInvitations()); $savant->assign('group_requests', getGroupRequests()); $savant->assign('pending_requests', getPendingRequests()); $savant->display('social/friend_list.tmpl.php'); ?> </div> <?php $people_you_may_know = getPeopleYouMayKnow(); if (!empty($people_you_may_know)) { ?> <!-- people you may know --> <div class="people-you-may-know"> <div class="headingbox"> <h3><?php echo _AT('people_you_may_know');
/** * Given an array list of friends, this function will add an attribute 'added' into the array if this person is already connected to the user. * @param int the user id * @param array the given array of friends * @return marked array */ function markFriends($id, $connections){ //get all friends $my_friends = getFriends($id); $pending_requests = getPendingRequests(true); foreach($my_friends as $friends){ //if it is in the connection, set the attribute if($connections[$friends] != null){ $connections[$friends]['added'] = 1; } } foreach ($pending_requests as $friends=>$garbage){ //if it is already added, set pending =1 if ($connections[$friends] != null){ $connections[$friends]['pending'] = 1; } } return $connections; }