function photos_showByUser($id) { require MODELS . "photo.php"; require MODELS . "users.php"; $cur_user = users_getCurrentUser(); $user = users_getById($id); $photo = photos_getByUser($id); require VIEWS . 'show_photos_by_user.php'; }
function users_getCurrentUser() { $db = get_db_connection(); if (isset($_SESSION['user'])) { $user = users_getById($_SESSION['user']); } else { $user = ['name' => 'Guest', 'id' => -1]; } return $user; }
function albums_showByUser($id) { require MODELS . 'users.php'; require MODELS . 'albums.php'; $cur_user = users_getById($id); if ($cur_user === false) { header('location:' . WEB); } else { $albums = albums_getByUser($cur_user); require VIEWS . 'show_albums.php'; } }