示例#1
0
}
$smarty->assign('admin_status', isAdmin($_SESSION['username']));
$smarty->assign('session', $_SESSION['username']);
$smarty->assign('session_info', getUserProfileInfo($_SESSION['username']));
if (!$_GET['username']) {
    $profile_username = $_SESSION['username'];
} else {
    $profile_username = $_GET['username'];
    $smarty->assign('friendship_status', getFriendshipState(getUserId($_SESSION['username']), getUserId($profile_username)));
    $smarty->assign('isrequester', isrequester(getUserId($_SESSION['username']), getUserId($profile_username)));
}
$smarty->assign('profile_info', getUserProfileInfo($profile_username));
$smarty->assign('n_friends_usr', countFriends(getUserId($_SESSION['username'])));
$smarty->assign('n_friends_prf', countFriends(getUserId($profile_username)));
$smarty->assign('n_circles', getNumberOfCircles(getUserId($_SESSION['username'])));
$friendsID = getFriendsId($profile_username);
foreach ($friendsID as $friendID) {
    $friends[$friendID['idauthenticated2']] = getUsername($friendID['idauthenticated2']);
    $friends[$friendID['idauthenticated2']]['info'] = getUserProfileInfo(getUsername($friendID['idauthenticated2'])['username']);
}
$smarty->assign('friends', $friends);
$data = getCurrentDate();
$smarty->assign('data', $data);
$circles = getCirclesByUser(getUserId($_SESSION['username']));
$smarty->assign('circles', $circles);
$posts = getUserPosts($profile_username, getUserId($profile_username));
foreach ($posts as $post) {
    if (postInCircle($post['idpost'])) {
        if (postFromCorrectCircle(getUserId($_SESSION['username']), $post['idpost'])) {
            $posts_profile[$post['idpost']]['date'] = getDatee(extractRegDate($post['idpost']));
            $posts_profile[$post['idpost']]['post'] = $post;
示例#2
0
include_once '../../config/init.php';
include_once '../../database/users.php';
include_once '../../database/friendship.php';
if (is_null($_SESSION['username'])) {
    header('Location: ' . $BASE_URL . 'pages/session/login.php');
    exit;
}
$smarty->assign('state', 'logged_in');
$smarty->assign('session', $_SESSION['username']);
$smarty->assign('session_info', getUserProfileInfo($_SESSION['username']));
if ($_GET['filter'] == 'all') {
    $users_username = getUsersNotBaned();
} else {
    if ($_GET['filter'] == 'friends') {
        $friendsID = getFriendsId($_SESSION['username']);
        foreach ($friendsID as $friendID) {
            $users_username[$friendID['idauthenticated2']] = getUsername($friendID['idauthenticated2']);
        }
    } else {
        if ($_GET['filterSearch']) {
            $pieces = explode(" ", $_GET['filterSearch']);
            $first_name = $pieces[0];
            $second_name = $pieces[1];
            $users_username = getUsernameByCompleteName($first_name, $second_name);
        } else {
            $users_username = array();
        }
    }
}
if (count($users_username) != 0) {