} if (isAdmin($_SESSION['username']) == 1) { $smarty->assign('state', 'logged_in_admin'); } else { if (isAdmin($_SESSION['username']) == 0) { $smarty->assign('state', 'logged_in'); } } $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']));
} 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) { foreach ($users_username as $username) { $users_info[$username['username']] = getUserProfileInfo($username['username']); $users_info[$username['username']]['isrequester'] = isrequester(getUserId($_SESSION['username']), getUserId($username['username'])); $users_info[$username['username']]['friendship_status'] = getFriendshipState(getUserId($_SESSION['username']), getUserId($username['username'])); $users_info[$username['username']]['n_friends_prf'] = countFriends(getUserId($username['username'])); } } else { $users_info = array(); } //PAGINATION!!! if (!$_GET['page']) { $current_page = 0; $filter = $_GET['filter']; $filterSearch = $_GET['filterSearch']; } else { $current_page = $_GET['page']; $filter = $_GET['filter']; $filterSearch = $_GET['filterSearch']; }