diff --git a/website/public/API/editFriendship.php b/website/public/API/editFriendship.php new file mode 100644 index 0000000..0518733 --- /dev/null +++ b/website/public/API/editFriendship.php @@ -0,0 +1,27 @@ +fetchAll(PDO::FETCH_ASSOC); + +for($i = 0; $i < sizeof($results); $i++) { + $results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]); +} + +//$results[0]["niceTime"] = nicetime($results[0]["creationdate"]); + +echo json_encode($results); \ No newline at end of file diff --git a/website/public/API/loadFriendRequestNotifications.php b/website/public/API/loadFriendRequest.php similarity index 100% rename from website/public/API/loadFriendRequestNotifications.php rename to website/public/API/loadFriendRequest.php diff --git a/website/public/API/loadFriends.php b/website/public/API/loadFriends.php new file mode 100644 index 0000000..38158c9 --- /dev/null +++ b/website/public/API/loadFriends.php @@ -0,0 +1,16 @@ + $friend) { + $friendshipStatus = getFriendshipStatus($friend->userID); + + if ($limit != 0 && $i >= $limit) + $extra = "extra-friend-item"; + else + $extra = ""; + ?> +
  • +
    + +
    + 1) { + ?> +
    + + + + + +
    + +
  • + $limit) { + ?> +
  • + Meer vrienden... +
  • + + + diff --git a/website/public/bits/group-item.php b/website/public/bits/group-item.php new file mode 100644 index 0000000..0a5831c --- /dev/null +++ b/website/public/bits/group-item.php @@ -0,0 +1,38 @@ + $group) { + ?> +
  • +
    + +
    +
  • + +
  • +
    + + + +
    +
  • diff --git a/website/public/emailconfirm.php b/website/public/emailconfirm.php index 97eb2f6..2812eaa 100644 --- a/website/public/emailconfirm.php +++ b/website/public/emailconfirm.php @@ -1,5 +1,6 @@ prepare(" SELECT @@ -18,11 +19,11 @@ if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) { if ($role == "unconfirmed") { doActivate($email); } else { - echo "Ongeldige link."; + messagePage("Ongeldige link."); } } else { - echo "Ongeldige link."; + messagePage("Ongeldige link."); } function doActivate(string $email) { @@ -39,11 +40,10 @@ function doActivate(string $email) { $confirmUser->bindParam(":userID", $_GET["u"]); $confirmUser->execute(); if ($confirmUser->rowCount()) { - echo "Email bevestigd
    - U wordt automatisch doorgestuurd naar de login pagina over 5 seconden. "; - header("refresh:5;url=login.php"); + messagePage("Email bevestigd
    + Klik hier om terug te gaan naar de login pagina."); } } else { - echo "Ongeldige link."; + messagePage("Ongeldige link."); } } \ No newline at end of file diff --git a/website/public/index.php b/website/public/index.php index 914192b..7ad8b59 100644 --- a/website/public/index.php +++ b/website/public/index.php @@ -1,5 +1,9 @@ - - - - - \ No newline at end of file + Bevriend")); + } else if(friendshipStatus == 1) { + $buttonContainer.append($("")); + } else if(friendshipStatus == 2) { + $buttonContainer.append($("")); + } else if(friendshipStatus == 3) { + $buttonContainer.append($("")); + $buttonContainer.append($("")); + } + + $buttonContainer.children().click(function() { + editFriendship(userID, this.value); + }); + }); +} \ No newline at end of file diff --git a/website/public/js/main.js b/website/public/js/main.js new file mode 100644 index 0000000..8a52797 --- /dev/null +++ b/website/public/js/main.js @@ -0,0 +1,45 @@ +function editFriendship(userID, value) { + $.post("API/editFriendship.php", { usr: userID, action: value }) + .done(function() { + placeFriendButtons(); + }); +} + +function showFriends(friends, list) { + if(friends && friends != "[]") { + $(list).load("bits/friend-item.php", { + "friends": friends + }); + + return true; + } else { + return false; + } +} + +function showFriendsPlus(friends, list, limit, action, actionType) { + if(friends && friends != "[]") { + $(list).load("bits/friend-item.php", { + "friends": friends, + "limit": limit, + "action": action, + "actionType": actionType + }); + + return true; + } else { + return false; + } +} + +function showGroups(groups, list) { + if(groups && groups != "[]") { + $(list).load("bits/group-item.php", { + "groups": groups + }); + + return true; + } else { + return false; + } +} \ No newline at end of file diff --git a/website/public/js/masonry.js b/website/public/js/masonry.js index 3b872ba..7f6423e 100644 --- a/website/public/js/masonry.js +++ b/website/public/js/masonry.js @@ -11,12 +11,10 @@ function scrollbarMargin(width, overflow) { }); } -function requestPost(post) { +function requestPost(postID) { $(".modal").show(); - $.get( - "API/loadPost.php", - $(post).children("form").serialize() - ).done(function (data) { + + $.get("API/loadPost.php", { postID : postID }).done(function(data) { $('.modal-default').hide(); var scrollBarWidth = window.innerWidth - document.body.offsetWidth; scrollbarMargin(scrollBarWidth, 'hidden'); @@ -26,37 +24,55 @@ function requestPost(post) { } $(window).on("load", function() { - console.log("LOADED"); - container = $("div.posts"); - posts = container.children(); - posts.remove(); - - column = $('
    ').append(posts); - container.append(column); - - mansonry(); - mansonry(); + $(".modal-close").click(function () { + $(".modal").hide(); + scrollbarMargin(0, 'auto'); + $('#modal-response').hide(); + $('.modal-default').show(); + }); }); +var masonryMode = 0; + $(window).resize(function() { clearTimeout(window.resizedFinished); window.resizeFinished = setTimeout(function() { - mansonry(); + masonry(masonryMode); }, 250); }); -function mansonry() { +var $container = $(".posts"); +function masonry(mode) { + masonryMode = mode; + $container.children().remove(); columnCount = Math.floor($(".posts").width() / 250); - console.log("columns: " + columnCount); /* * Initialise columns. */ var columns = new Array(columnCount); + var $columns = new Array(columnCount); for (i = 0; i < columnCount; i++) { - columns[i] = [0, []]; - console.log(columns[i]); + $column = $("
    "); + $column.width(100/columnCount + "%"); + $container.append($column); + columns[i] = [0, $column]; + } + + if(mode == 1) { + $postInput = $("
    "); + $form = $("
    "); + $postInput.append($form); + + $form.append($("")); + $form.append($(" - -
    -
    - fetch()) { - $nicetime = nicetime($post["creationdate"]); - $postID = $post["postID"]; - echo " -
    -

    ${post["title"]}

    -

    ${post["content"]}

    -

    ${nicetime} geplaatst.

    -
    - -
    -
    - "; - } - ?>