public function getReceivedAction()
 {
     $request = $_GET;
     $token = isset($request['TOKEN']) ? trim($request['TOKEN']) : null;
     if (!$token) {
         return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')];
     }
     if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) {
         return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')];
     }
     $friends = BuckysFriend::getReceivedRequests($userID);
     $results = [];
     foreach ($friends as $row) {
         $item = [];
         $item['id'] = $row['userID'];
         $item['name'] = $row['fullName'];
         $item['thumbnail'] = THENEWBOSTON_SITE_URL . BuckysUser::getProfileIcon($row['userID']);
         $item['description'] = $row['city'];
         $item['friendType'] = $row['status'];
         $results[] = $item;
     }
     return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ["STATUS" => "SUCCESS", "RESULT" => $results]];
 }
    $totalCount = BuckysFriend::getNumberOfFriends($userID);
} else {
    if ($type == 'pending') {
        $totalCount = BuckysFriend::getNumberOfPendingRequests($userID);
    } else {
        if ($type == 'requested') {
            $totalCount = BuckysFriend::getNumberOfReceivedRequests($userID);
        }
    }
}
//Init Pagination Class
$pagination = new Pagination($totalCount, BuckysFriend::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
if ($type == 'all') {
    $friends = BuckysFriend::getAllFriends($userID, $page, BuckysFriend::$COUNT_PER_PAGE);
} else {
    if ($type == 'pending') {
        $friends = BuckysFriend::getPendingRequests($userID, $page, BuckysFriend::$COUNT_PER_PAGE);
    } else {
        if ($type == 'requested') {
            $friends = BuckysFriend::getReceivedRequests($userID, $page, BuckysFriend::$COUNT_PER_PAGE);
        }
    }
}
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('friends.css');
buckys_enqueue_javascript('friends.js');
$TNB_GLOBALS['content'] = 'myfriends';
$TNB_GLOBALS['title'] = "My Friends - " . TNB_SITE_NAME;
//if logged user can see all resources of the current user
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
        render_footer_link_content('my', $notificationsList);
        ?>
                        </span>
                    </span>
                <?php 
    } else {
        echo '<span class="notificationLinks inactive-notify no-data" id="my-notifications-icon"><span class="notification-count">0</span><span class="dropDownNotificationList"><span class="nodata">Nothing to see here</span></span></span>';
    }
    ?>

                <!-- Start Friend Request Notification -->
                <?php 
    $objFriend = new BuckysFriend();
    $friendRequestsNum = $objFriend->getNewFriendRequests($userID);
    if ($friendRequestsNum > 0) {
        $friendRequests = $objFriend->getReceivedRequests($userID);
        ?>
                    <span class="notificationLinks" id="friend-notifications-icon">
                        <span class="dropDownNotificationList">                    
                            <?php 
        render_footer_link_content('friend', $friendRequests);
        ?>
                        </span>
                    </span>
                <?php 
    } else {
        echo '<span class="notificationLinks inactive-notify no-data" id="friend-notifications-icon"><span class="dropDownNotificationList"><a href="/myfriends.php?type=requested" class="nodata">No one wants to be your friend</a></span></span>';
    }
    ?>
                <!-- End Friend Request Notification -->
        ?>
                        <a class="view-detail-links" href="/account.php">                        
                            View All Notifications
                        </a>       
                    </span>
            </span>
            <?php 
    }
    ?>
            
            <!-- Start Friend Request Notification -->
            <?php 
    $objFriend = new BuckysFriend();
    $friendRequestsNum = $objFriend->getNewFriendRequests($BUCKYS_GLOBALS['user']['userID']);
    if ($friendRequestsNum > 0) {
        $friendRequests = $objFriend->getReceivedRequests($BUCKYS_GLOBALS['user']['userID']);
        ?>
            <span class="notificationLinks" id="friend-notifications-icon">
                <span class="dropDownNotificationList">                    
                    <?php 
        foreach ($friendRequests as $row) {
            ?>
                    <span class="singleNotificationListItem">
                        <img src="<?php 
            echo BuckysUser::getProfileIcon($row);
            ?>
" class="dropDownNotificationImages" />
                        <span class="redBold"><?php 
            echo $row['fullName'];
            ?>
</span> sent you new friend request.