diff --git a/website/public/API/deletePost.php b/website/public/API/deletePost.php index fffadf5..37f89a1 100644 --- a/website/public/API/deletePost.php +++ b/website/public/API/deletePost.php @@ -3,10 +3,10 @@ session_start(); require_once "../../queries/post.php"; require_once "../../queries/user.php"; - -if (isset($_SESSION["userID"]) and - getRoleByID($_SESSION["userID"]) != 'frozen' and - getRoleByID($_SESSION["userID"]) != 'banned') { +if (!isset($_SESSION["userID"])) { + echo "logged out"; +} else if (getRoleByID($_SESSION["userID"]) != 'frozen' and + getRoleByID($_SESSION["userID"]) != 'banned') { if (empty($_POST["postID"]) or empty($_SESSION["userID"])) { header('HTTP/1.1 500 Non enough arguments'); diff --git a/website/public/API/postComment.php b/website/public/API/postComment.php index 3864cc8..c9f8a53 100644 --- a/website/public/API/postComment.php +++ b/website/public/API/postComment.php @@ -7,10 +7,10 @@ require_once("../../queries/connect.php"); require_once("../../queries/checkInput.php"); require_once("../../queries/user.php"); - -if (isset($_SESSION["userID"]) && - getRoleByID($_SESSION["userID"]) != 'frozen' && - getRoleByID($_SESSION["userID"]) != 'banned') { +if (!isset($_SESSION["userID"])) { + echo "logged out"; +} else if (getRoleByID($_SESSION["userID"]) != 'frozen' && + getRoleByID($_SESSION["userID"]) != 'banned') { if ($_POST['button'] == 'reaction') { if (empty($_POST['newcomment-content'])) { echo 0; diff --git a/website/public/API/postPost.php b/website/public/API/postPost.php index 241bda6..2d703d3 100644 --- a/website/public/API/postPost.php +++ b/website/public/API/postPost.php @@ -8,9 +8,10 @@ require_once("../../queries/connect.php"); require_once("../../queries/checkInput.php"); require_once("../../queries/user.php"); -if (isset($_SESSION["userID"]) && - getRoleByID($_SESSION["userID"]) != 'frozen' && - getRoleByID($_SESSION["userID"]) != 'banned') { +if (!isset($_SESSION["userID"])) { + echo "logged out"; +} else if (getRoleByID($_SESSION["userID"]) != 'frozen' && + getRoleByID($_SESSION["userID"]) != 'banned') { if (empty($_SESSION["userID"])) { header('HTTP/1.1 500 Non enough arguments'); diff --git a/website/public/API/sendMessage.php b/website/public/API/sendMessage.php index c6e3231..a2d411b 100644 --- a/website/public/API/sendMessage.php +++ b/website/public/API/sendMessage.php @@ -7,9 +7,10 @@ require_once("../../queries/checkInput.php"); require_once("../../queries/user.php"); // Check if the user is allowed to send a message. -if (isset($_SESSION["userID"]) && - getRoleByID($_SESSION["userID"]) != 'frozen' && - getRoleByID($_SESSION["userID"]) != 'banned') { +if (!isset($_SESSION["userID"])) { + echo "logged out"; +} else if (getRoleByID($_SESSION["userID"]) != 'frozen' && + getRoleByID($_SESSION["userID"]) != 'banned') { if (!empty(test_input($_POST["destination"])) && !empty(test_input($_POST["content"])) ) { diff --git a/website/public/js/chat.js b/website/public/js/chat.js index a3ff430..f431b91 100644 --- a/website/public/js/chat.js +++ b/website/public/js/chat.js @@ -43,6 +43,8 @@ function sendMessage() { ).done(function(response) { if (response == "frozen") { alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is."); + } else if (response == "logged out") { + window.location.href = "login.php?url=" + window.location.pathname; } // Load messages if the message has been send, so it shows in the chat. loadMessages(); diff --git a/website/public/js/friendButtons.js b/website/public/js/friendButtons.js index 47c476a..87222e9 100644 --- a/website/public/js/friendButtons.js +++ b/website/public/js/friendButtons.js @@ -19,24 +19,24 @@ function placeFriendButtons() { case "0": value1 = "request"; class1 = "green"; - text1 = "Bevriend"; - icon1 = "fa-handshake-o"; + text1 = "Word vrienden"; + icon1 = "fa-user-plus"; break; case "1": value1 = userID; class1 = "green"; text1 = "Chat"; - icon1 = "fa-comment-o"; + icon1 = "fa-comment"; value2 = "delete"; class2 = "red"; - text2 = "Verwijder"; - icon2 = "fa-times"; + text2 = "Ontvriend"; + icon2 = "fa-user-times"; break; case "2": value1 = "delete"; class1 = "red"; text1 = "Trek verzoek in"; - icon1 = "fa-cross"; + icon1 = "fa-times"; break; case "3": value1 = "accept"; @@ -51,16 +51,18 @@ function placeFriendButtons() { } $buttonContainer.append( - ""); + "
"); $buttonContainer.append( - ""); + "
"); - $buttonContainer.children().click(function() { + $buttonContainer.find("button").click(function() { if (isNaN(this.value)) editFriendship(userID, this.value); else if (this.value != "") diff --git a/website/public/js/groupButtons.js b/website/public/js/groupButtons.js index 549277d..caf3ab8 100644 --- a/website/public/js/groupButtons.js +++ b/website/public/js/groupButtons.js @@ -5,23 +5,23 @@ function placeGroupButtons() { if (data == 'none') { $buttonContainer.append( - ""); } else if (data == 'request') { $buttonContainer.append( - ""); } else if (data == 'admin') { $buttonContainer.append( - "" ); } else { $buttonContainer.append( - ""); } diff --git a/website/public/js/main.js b/website/public/js/main.js index 30cd3ed..2ce58e4 100644 --- a/website/public/js/main.js +++ b/website/public/js/main.js @@ -3,8 +3,7 @@ var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "a function fancyText(text) { // Add links, images, gifs and (youtube) video's. - var regex = /(https?:\/\/.[^ <>"]*)/ig; - text = text.replace(regex, function(link) { + text = text.replace(/(https?:\/\/.[^ \n<>"]*)/ig, function(link) { // Add images if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) { return "" + link + ""; @@ -39,7 +38,7 @@ function fancyText(text) { } // This function gets the value of a cookie when given a key. -// If didn´t find any compatible cookie, it returns false. +// If it didn´t find any compatible cookie, it returns false. function getCookie(key) { cookies = document.cookie.split("; "); for (var i in cookies) { diff --git a/website/public/js/masonry.js b/website/public/js/masonry.js index a628e96..d43577b 100644 --- a/website/public/js/masonry.js +++ b/website/public/js/masonry.js @@ -26,7 +26,7 @@ function requestPost(postID) { function postPost() { title = $("input.newpost[name='title']").val(); content = $("textarea.newpost[name='content']").val(); - + console.log(masonryMode); if (masonryMode == 2) { $.post("API/postPost.php", { title: title, content : content, @@ -36,6 +36,10 @@ function postPost() { $('#alertbox').show(); $('#alerttext').html("Geen titel of inhoud; vul a.u.b. in."); window.scrollTo(0,0); + } else if (data == "logged out") { + window.location.href = "login.php?url=" + window.location.pathname; + } else if (data == "frozen") { + alert("Je account is bevroren, dus je kan geen posts plaatsen. Contacteer een admin als je denkt dat dit onjuist is."); } else { $('#alertbox').hide(); masonry(masonryMode); @@ -49,6 +53,10 @@ function postPost() { $('#alertbox').show(); $('#alerttext').html("Geen titel of inhoud; vul a.u.b. in."); window.scrollTo(0,0); + } else if (data == "logged out") { + window.location.href = "login.php?url=" + window.location.pathname; + } else if (data == "frozen") { + alert("Je account is bevroren, dus je kan geen posts plaatsen. Contacteer een admin als je denkt dat dit onjuist is."); } else { $('#alertbox').hide(); masonry(masonryMode); diff --git a/website/public/js/post.js b/website/public/js/post.js index 4009023..4f77d4d 100644 --- a/website/public/js/post.js +++ b/website/public/js/post.js @@ -8,6 +8,8 @@ function postComment(buttonValue) { ).done(function (response) { if (response == "frozen") { alert("Je account is bevroren, dus je kan geen comments plaatsen of \"niet slechten\". Contacteer een admin als je denkt dat dit onjuist is."); + } else if (response == "logged out") { + window.location.href = "login.php?url=" + window.location.pathname; } }); @@ -30,6 +32,8 @@ function deletePost(postID) { ).done(function (response) { if (response == "frozen") { alert("Je account is bevroren, dus je kan geen posts verwijderen. Contacteer een admin als je denkt dat dit onjuist is."); + } else if (response == "logged out") { + window.location.href = "login.php?url=" + window.location.pathname; } }); closeModal(); diff --git a/website/public/styles/main.css b/website/public/styles/main.css index 650a30f..5bb7b1d 100644 --- a/website/public/styles/main.css +++ b/website/public/styles/main.css @@ -256,8 +256,6 @@ div[data-title]:hover:after { top: 150%; z-index: 200; white-space: nowrap; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; border-radius: 3px; box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22); background-color: #333; diff --git a/website/public/styles/post-popup.css b/website/public/styles/post-popup.css index 541b52c..e82129b 100644 --- a/website/public/styles/post-popup.css +++ b/website/public/styles/post-popup.css @@ -91,16 +91,5 @@ .deleteButton { background-color: firebrick; -} - -.deleteButton i { - display: inline-block; -} - -.deleteButton:hover span { - display: inline-block; -} - -.deleteButton span { - display: none; + float: right; } \ No newline at end of file diff --git a/website/public/styles/profile.css b/website/public/styles/profile.css index f6e545e..8a93d12 100644 --- a/website/public/styles/profile.css +++ b/website/public/styles/profile.css @@ -27,16 +27,21 @@ display: inline-block; } +.friend-button-container div, .status-buttons-container div { + width: 200px; + display: inline-block; +} + .friend-button-container button, .status-buttons-container button, .group-button-container button { display: block; + float: right; margin: 7px 0; font-size: 18px; } - -.friend-button-container button, .status-buttons-container button, .group-button-fixed { - width: 200px; +.status-buttons-container button { + float: left; } .group-button-container button { @@ -74,22 +79,21 @@ .group-picture { border: none; - margin-right: 15px; } -.group-button-fancy span { +.fancy-button span { display: none; } -.group-button-fancy:hover { +.fancy-button:hover { text-align: right; } -.group-button-fancy i { +.fancy-button i { display: inline-block; } -.group-button-fancy:hover span { +.fancy-button:hover span { display: inline-block; margin-right: 5px; } diff --git a/website/queries/private_message.php b/website/queries/private_message.php index 3b88563..f2df887 100644 --- a/website/queries/private_message.php +++ b/website/queries/private_message.php @@ -6,18 +6,23 @@ function getOldChatMessages($user2ID) { if (getFriendshipStatus($user2ID) == 1) { $stmt = prepareQuery(" SELECT - * + * FROM - `private_message` - WHERE - `origin` = :user1 AND - `destination` = :user2 OR - `origin` = :user2 AND - `destination` = :user1 + (SELECT + * + FROM + `private_message` + WHERE + `origin` = :user1 AND + `destination` = :user2 OR + `origin` = :user2 AND + `destination` = :user1 + ORDER BY + `messageID` DESC + LIMIT + 100) sub ORDER BY - `creationdate` ASC - LIMIT - 100 + `messageID` ASC "); $stmt->bindParam(":user1", $user1ID); @@ -76,7 +81,7 @@ function getNewChatMessages($lastID, $destination) { `destination` = :user1) AND `messageID` > :lastID ORDER BY - `creationdate` ASC + `messageID` ASC "); $stmt->bindParam(':user1', $_SESSION["userID"]); diff --git a/website/views/group.php b/website/views/group.php index b27f18c..250fc9f 100644 --- a/website/views/group.php +++ b/website/views/group.php @@ -1,6 +1,6 @@
- ">
+ <?= $group[" class="group-picture main-picture" src="">
diff --git a/website/views/head.php b/website/views/head.php index f831f5d..3ec8a79 100644 --- a/website/views/head.php +++ b/website/views/head.php @@ -1,5 +1,5 @@ - + MyHyvesbook+ @@ -26,8 +26,8 @@ require_once ("../queries/user.php"); session_start(); -if(!isset($_SESSION["userID"])){ - header("location:login.php"); +if(!isset($_SESSION["userID"])) { + header("location:login.php?url=" . "$_SERVER[REQUEST_URI]"); } else { updateLastActivity(); } diff --git a/website/views/header.php b/website/views/header.php index c1379fc..e13eca6 100644 --- a/website/views/header.php +++ b/website/views/header.php @@ -23,9 +23,9 @@ $userinfo = getHeaderInfo();
Hallo
- +
- "/> + <?= $userinfo[" id="own-profile-picture" class="profile-picture" src=""/>
diff --git a/website/views/login_head.php b/website/views/login_head.php index b4b2724..9e580df 100644 --- a/website/views/login_head.php +++ b/website/views/login_head.php @@ -1,6 +1,6 @@ - + MyHyvesbook+ diff --git a/website/views/post-view.php b/website/views/post-view.php index f8fe902..fadc791 100644 --- a/website/views/post-view.php +++ b/website/views/post-view.php @@ -5,14 +5,6 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . " ?>

- -
- gepost door , '> @@ -20,7 +12,14 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
- + +
+

diff --git a/website/views/profile.php b/website/views/profile.php index 4139099..0cb5cc2 100644 --- a/website/views/profile.php +++ b/website/views/profile.php @@ -4,13 +4,19 @@
- " src="">
+ <?= $user[" class="profile-picture main-picture " src="">
- - +
+ +
+
+ +

:)

@@ -33,18 +39,16 @@

Informatie

-

-

    - -
  • Leeftijd: jaar
  • - - -
  • Email:
  • - -
  • Locatie:
  • -
  • Lid sinds:
  • -
-

+
    + +
  • Leeftijd: jaar
  • + + +
  • Email:
  • + +
  • Locatie:
  • +
  • Lid sinds:
  • +
@@ -52,7 +56,7 @@

fetch()) { - echo "${friend["username"]}"; + echo "${friend["username"]}"; } diff --git a/website/views/settings-view.php b/website/views/settings-view.php index cf5317f..0800cc8 100644 --- a/website/views/settings-view.php +++ b/website/views/settings-view.php @@ -45,8 +45,8 @@ $settings = getSettings();

  • - - - - format("Y"); for ($year = $now; $year >= 1900; $year--): ?>