Esempio n. 1
0
    return;
}
if ($action == "Deactivate profile") {
    $result = deactivateProfile($_SESSION['loggedInUser']['u_id']);
    print json_encode($result);
    return;
}
if ($action == "Activate profile") {
    $result = activateProfile($_SESSION['loggedInUser']['u_id']);
    print json_encode($result);
    return;
}
if ($action == "Accept") {
    $props = array('u_id' => $_POST['u_id'], 'r_id' => $_POST['r_id']);
    $acceptedUser = acceptFriendship($props);
    $result = array('u_about_myself' => $acceptedUser['u_about_myself'], 'u_id' => $acceptedUser['u_id'], 'days' => calculateDaysTillTheDate($acceptedUser['u_birthdate']));
    print json_encode($result);
    return;
}
if ($action == "Add Friend") {
    $props = array('u_id1' => $_SESSION['loggedInUser']['u_id'], 'u_id2' => $_POST['u_id'], 'r_status' => 'REQUEST_SENT', 'r_updated_at' => date('Y-m-d H:i:s'));
    $addedFriend = addFriend($props);
    print json_encode($addedFriend);
    return;
}
if ($action == "Decline") {
    $props = array('u_id' => $_POST['u_id'], 'r_id' => $_POST['r_id'], 'r_updated_at' => date('Y-m-d H:i:s'));
    declineFriendship($props);
    print json_encode($_POST['u_id']);
    return;
}
Esempio n. 2
0
</p>

                        <p><span class="bold">Email:</span><?php 
echo $user['u_email'];
?>
</p>
                    </div>
                </div>

                <!--secret data. Friends only-->
                <div class="secret">

                    <?php 
if ($mineProfile || $relationship == FRIENDS) {
    //calculate days till user birthday
    $days = calculateDaysTillTheDate($user['u_birthdate']);
    ?>

                        <img src="/userpic.php?u_id=<?php 
    echo $user['u_id'];
    ?>
&type=private" width="170" height="235"
                             alt="secret-picture">
                        <div>
                            <p><span class="bold">About: </span> <?php 
    echo $user['u_about_myself'];
    ?>
</p>

                            <p><span class="bold">Your birthday in <?php 
    echo $days;