<?php 
include_once 'header.php';
?>
</head>

<body>
    <section id="head-bar">
        <?php 
include_once 'navbar.php';
?>
    </section>
    <div class="container">
        <?php 
if (isset($_SESSION['authenticated_user'])) {
    require_once 'mediapost.php';
    $post = new MediaPost();
    $user_object = new User();
    $recommendations = $post->getRecommendationsForUser($_SESSION['authenticated_user']);
    if ($recommendations && $recommendations->num_rows > 0) {
        while ($recommendation = $recommendations->fetch_object()) {
            $full_user_name = $user_object->getFullNameById($recommendation->from_user);
            $url_link = "conversation.php?friend_id=" . $recommendation->from_user;
            $media = $post->getMediaById($recommendation->media);
            $user = $post->getUserById($recommendation->from_user);
            ?>

                    <div class="well">
                        <div class="page-header">
                            <div class="row">
                                <div class="col-md-8">
                                <h3><?php 
?>
</head>

<body>
    <section id="head-bar">
        <?php 
include_once 'navbar.php';
?>
    </section>

    <div class="container">
        <?php 
require_once 'mediapost.php';
require_once 'user.php';
$user_object = new User();
$post = new MediaPost();
$reviews = $post->getAllReviews();
while ($review = $reviews->fetch_object()) {
    $media = $post->getMediaById($review->media);
    $user = $post->getUserById($review->user);
    $full_user_name = $user_object->getFullNameById($review->user);
    $url_link = "conversation.php?friend_id=" . $review->user;
    ?>
                <div class="well">
                    <div class="page-header">
                        <h3><?php 
    echo $media->title;
    ?>
</h3>
                        <h5><a href="<?php 
    echo $url_link;
</head>

<body>
    <section id="head-bar">
        <?php 
include_once 'navbar.php';
?>
    </section>
    <div class="container">
        <h1>My Watchlist</h1>
        <?php 
if (isset($_SESSION['authenticated_user'])) {
    require_once 'watchlist.php';
    require_once 'mediapost.php';
    $watchlist = new Watchlist();
    $post = new MediaPost();
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        if (!empty($_POST['title'])) {
            $media_id = $post->getMediaIdByTitle($_POST['title']);
            $watchlist->storeListMedia($_SESSION['authenticated_user'], $media_id);
        }
    } else {
        if ($_SERVER['REQUEST_METHOD'] === 'GET') {
            if (!empty($_GET['remove_media'])) {
                $media_id = $_GET['remove_media'];
                $watchlist->removeMediaFromWatchlist($_SESSION['authenticated_user'], $media_id);
            }
        }
    }
    $list_items = $watchlist->getWatchlistForUser($_SESSION['authenticated_user']);
    if ($list_items) {
<body>
    <section id="head-bar">
        <?php 
include_once 'navbar.php';
?>
    </section>
<?php 
if (isset($_SESSION['authenticated_user'])) {
    require_once 'mediapost.php';
    require_once 'user.php';
    $error = "";
    $new_media = false;
    if (!empty($_POST['title']) && !empty($_POST['rating'])) {
        $user = new User();
        $post = new MediaPost();
        $from_user = $_SESSION['authenticated_user'];
        $title = $_POST['title'];
        $rating = $_POST['rating'];
        $comment = $_POST['comment'];
        $date_created = date("Y-m-d H:i:s");
        $media = $post->getMediaIdByTitle($title);
        if (!$media) {
            $media = $post->storeMedia($title);
            $new_media = true;
        }
        if ($_POST['review_type'] == 'private') {
            $email = $_POST['username'];
            $to_user = $user->getIdByEmail($email);
            if ($to_user) {
                $post->storeRecommendation($from_user, $to_user, $media, $rating, $comment, $date_created);
    <section id="head-bar">
        <?php 
include_once 'navbar.php';
?>
 
    </section>
    <div class="container">

        <?php 
if (isset($_SESSION['authenticated_user'])) {
    require_once 'message.php';
    require_once 'user.php';
    require_once 'mediapost.php';
    $user = new User();
    $message_object = new Message();
    $mediapost = new MediaPost();
    $this_user = $_SESSION['authenticated_user'];
    $other_user = 0;
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        $other_user = $_POST['friend_id'];
        if (!empty($_POST['new_message'])) {
            $new_message = $_POST['new_message'];
            $date_created = date("Y-m-d H:i:s");
            $message_object->storeMessage($other_user, $this_user, $date_created, $new_message);
            header("Location: http://" . $_SERVER['HTTP_HOST'] . $_SERVER[REQUEST_URI] . "?friend_id=" . $other_user);
            /* Redirect browser */
            exit;
        }
    } else {
        $other_user = $_GET['friend_id'];
    }
Exemple #6
0
</head>

<body>
    <section id="head-bar">
        <?php 
include_once 'navbar.php';
?>
    </section>
    <div class="container">
        <?php 
if (isset($_SESSION['authenticated_user'])) {
    require_once 'watchlist.php';
    require_once 'mediapost.php';
    require_once 'user.php';
    $watchlist = new Watchlist();
    $post = new MediaPost();
    $user = new User();
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        if (!empty($_POST['friend_email'])) {
            $new_friend_id = $user->getIdByEmail($_POST['friend_email']);
            if (!$new_friend_id) {
                echo "<h2 style='color: white; background-color: #d61616;'>User not found with email address " . $_POST['friend_email'] . ". Try again.</h2>";
            } else {
                $date_created = date("Y-m-d H:i:s");
                $watchlist->addNewBoy($_SESSION['authenticated_user'], $new_friend_id, $date_created);
            }
        }
    }
    $this_user = $_SESSION['authenticated_user'];
    $friends = $watchlist->getMyBoys($this_user);
    if ($friends) {