$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) { 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'];
$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; $posts_profile[$post['idpost']]['profile'] = getUserProfileInfo(getUsername($post['idauthenticated'])['username']); } } else { $posts_profile[$post['idpost']]['date'] = getDatee(extractRegDate($post['idpost'])); $posts_profile[$post['idpost']]['post'] = $post; $posts_profile[$post['idpost']]['profile'] = getUserProfileInfo(getUsername($post['idauthenticated'])['username']); } } $smarty->assign('posts', $posts_profile); if (isAdmin($_SESSION['username']) == 1) { $smarty->assign('state', 'logged_in_admin'); } else { if (isAdmin($_SESSION['username']) == 0) { $smarty->assign('state', 'logged_in'); } } $smarty->assign('session', $_SESSION['username']); $smarty->assign('session_info', getUserProfileInfo($_SESSION['username'])); $smarty->assign('content', 'users/show.tpl'); $smarty->display('application.tpl');
<?php 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'])); $friendsID = getFriendsId($_SESSION['username']); foreach ($friendsID as $friendID) { $friends[$friendID['idauthenticated2']]['username'] = getUsername($friendID['idauthenticated2']); $friends[$friendID['idauthenticated2']]['photo'] = getUserProfileInfo($_SESSION['username']); } $smarty->assign('allfriends', $friends); $smarty->assign('content', 'chat/messages.tpl'); $smarty->display('application.tpl');