} else {
                                buckys_redirect($return, $db->getLastError(), MSG_TYPE_ERROR);
                            }
                        }
                    }
                }
            }
        }
    }
    exit;
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($userID);
$page = isset($_GET['page']) ? $_GET['page'] : 1;
if ($type == 'all') {
    $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 {
<?php

/**
 * Profile Left Sidebar
 */
if (!isset($TNB_GLOBALS)) {
    die("Invalid Request!");
}
global $userData, $profileID, $canViewPrivate, $userID;
$totalFriendsCount = BuckysFriend::getNumberOfFriends($profileID);
?>
<aside id="main_aside" style="overflow:visible;"> <!-- 241px -->
    <span class="titles"><?php 
echo $userData['firstName'] . " " . $userData['lastName'];
?>
</span> <br/>
    <?php 
render_profile_link($userData, 'mainProfilePic');
?>
    <br/> <a
        href="/photos.php?user=<?php 
echo $userData['userID'];
?>
">View All Photos (<?php 
echo BuckysPost::getNumberOfPhotosByUserID($userData['userID']);
?>
)</a>
    <br/>

    <!-- Friend Links -->
    <?php