" . $post['content'] . "
+=$post['content']?>
diff --git a/website/public/API/deletePost.php b/website/public/API/deletePost.php new file mode 100644 index 0000000..fffadf5 --- /dev/null +++ b/website/public/API/deletePost.php @@ -0,0 +1,20 @@ +fetchAll(PDO::FETCH_ASSOC); + + for($i = 0; $i < sizeof($results); $i++) { + $results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]); + } + + echo json_encode($results); } - - $results = $posts->fetchAll(PDO::FETCH_ASSOC); - - for ($i = 0; $i < sizeof($results); $i++) { - $results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]); - } - - echo json_encode($results); } else { header('HTTP/1.0 403 Forbidden'); -} \ No newline at end of file +} diff --git a/website/public/API/loadPost.php b/website/public/API/loadPost.php index 257a282..13a2f54 100644 --- a/website/public/API/loadPost.php +++ b/website/public/API/loadPost.php @@ -1,5 +1,7 @@ button').click(function () { $('#batchinput').prop('value', $(this).prop('value')); - console.log($('#batchinput').prop('value')); }); $('#admin-groupbatchform > button').click(function () { $('#groupbatchinput').prop('value', $(this).prop('value')); - console.log($('#batchinput').prop('value')); }); }); @@ -67,7 +65,6 @@ function searchFromOne() { } function adminSearch() { - console.log($("#admin-searchform").serialize()); $.post( "API/adminSearchUsers.php", $("#admin-searchform").serialize() diff --git a/website/public/js/chat.js b/website/public/js/chat.js index e332324..6a027c8 100644 --- a/website/public/js/chat.js +++ b/website/public/js/chat.js @@ -49,7 +49,6 @@ function addMessages(messages) { // Initialize message variables var thisDate = new Date(messages[i].creationdate.replace(/ /,"T")); var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes(); - console.log(thisDate); var type; thisDate.setHours(0,0,0,0); diff --git a/website/public/js/groupButtons.js b/website/public/js/groupButtons.js index 0f1b6bf..e6ada67 100644 --- a/website/public/js/groupButtons.js +++ b/website/public/js/groupButtons.js @@ -25,6 +25,7 @@ function placeGroupButtons() { .done(function() { $buttonContainer.children().remove(); placeGroupButtons(); + updateMenus(); }).fail(function() { }); }); diff --git a/website/public/js/header.js b/website/public/js/header.js index 13e3e12..e4408cc 100644 --- a/website/public/js/header.js +++ b/website/public/js/header.js @@ -1,40 +1,55 @@ $(document).ready(function() { // Toggle menu $("#own-profile-picture, #open-notifications").click(function() { - if ($("#notification-center").css('display') == "none") { - // Make the menu visible and move the content to the left. - $(".modal").width("calc(100% - 512px)"); - $(".content").css("margin-right", "256px"); - $("#notification-center").css("right", "0px"); - $("#notification-center").css("display", "block"); - $("#contact-menu").css("display", "block"); + if ($("#notification-center").css('display') == "none") { + // Make the menu visible and move the content to the left. + $(".modal").width("calc(100% - 512px)"); + $(".content").css("margin-right", "256px"); + $("#notification-center").css("right", "0px"); + $("#notification-center").css("display", "block"); + $("#contact-menu").css("display", "block"); - // Add cookie so the menu stays open on other pages - if (window.innerWidth > 1080) { - $("#chat-history").width("calc(100% - 587px)"); - document.cookie = "menu=open; path=/"; - } else { - document.cookie = "menu=closed; path=/"; - } + // Add cookie so the menu stays open on other pages + if (window.innerWidth > 1080) { + $("#chat-history").css("margin-right", "266px"); + $("#chat-history").css("width", "calc(100% - 512px - 75px)"); + document.cookie = "menu=open; path=/"; } else { - $(".modal").width("calc(100% - 256px)"); - $(".content").css("margin-right", "0px"); - $("#notification-center").css("display", "none"); - - if (window.innerWidth > 1080) { - $("#chat-history").width("calc(100% - 331px)"); - } else { - // Make the menu invisible and move the content to the right. - $("#contact-menu").css("display", "none"); - } - - // Change menu cookie to close document.cookie = "menu=closed; path=/"; - } + } else { + $(".modal").width("calc(100% - 256px)"); + $(".content").css("margin-right", "0px"); + $("#notification-center").css("display", "none"); + + if (window.innerWidth > 1080) { + $("#chat-history").css("margin-right", "10px"); + $("#chat-history").css("width", "calc(100% - 256px - 85px)"); + } else { + // Make the menu invisible and move the content to the right. + $("#contact-menu").css("display", "none"); + } + + // Change menu cookie to close + document.cookie = "menu=closed; path=/"; + } }); if (getCookie("menu") == "open") { - $("#own-profile-picture").click(); + // Make the menu visible and move the content to the left. + $(".modal").width("calc(100% - 512px)"); + $(".content").css("margin-right", "256px"); + $("#notification-center").css("right", "0px"); + $("#notification-center").css("display", "block"); + $("#contact-menu").css("display", "block"); + + // Add cookie so the menu stays open on other pages + if (window.innerWidth > 1080) { + $("#chat-history").css("margin-right", "266px"); + $("#chat-history").width("calc(100% - 587px)"); + document.cookie = "menu=open; path=/"; + } else { + document.cookie = "menu=closed; path=/"; + } } }); diff --git a/website/public/js/main.js b/website/public/js/main.js index 2983fdb..7741406 100644 --- a/website/public/js/main.js +++ b/website/public/js/main.js @@ -53,6 +53,7 @@ function editFriendship(userID, value) { $.post("API/editFriendship.php", { usr: userID, action: value }) .done(function() { placeFriendButtons(); + updateMenus(); }); } @@ -93,14 +94,4 @@ function showGroups(groups, list) { } else { return false; } -} - -$(document).ready(function() { - $("body").delegate("textarea[maxlength]", "keydown", function() { - if ($(this).val().length / .9 >= $(this).attr("maxlength")) { - $(this).next().text($(this).val().length + "/" + $(this).attr("maxlength")); - } else { - $(this).next().text(""); - } - }); -}); \ No newline at end of file +} \ No newline at end of file diff --git a/website/public/js/masonry.js b/website/public/js/masonry.js index b4370b7..4f638c2 100644 --- a/website/public/js/masonry.js +++ b/website/public/js/masonry.js @@ -45,24 +45,49 @@ function postPost() { } -$(window).on("load", function() { - $(".modal-close").click(function () { - $(".modal").hide(); - scrollbarMargin(0, 'auto'); - $('#modal-response').hide(); - $('.modal-default').show(); - }); +var masonryMode = 0; +var windowWidth; +var columnCount; +var columns; +var postLimit; +var postAmount = 0; +var noposts = false; + +$(document).ready(function () { + windowWidth = $(window).width(); + columnCount = Math.floor($(".posts").width() / 250); + columns = new Array(columnCount); + postLimit = columnCount * 7; }); -var masonryMode = 0; -var windowWidth = $(window).width(); +$(window).on("load", function() { + $(".modal-close").click(function (){closeModal()}); + + // http://stackoverflow.com/questions/9439725/javascript-how-to-detect-if-browser-window-is-scrolled-to-bottom + window.onscroll = function(ev) { + if($(window).scrollTop() + $(window).height() == $(document).height() ) { + loadMorePosts(userID, groupID, postAmount, postLimit); + } + }; +}); + +function closeModal() { + $(".modal").hide(); + scrollbarMargin(0, 'auto'); + $('#modal-response').hide(); + $('.modal-default').show(); +} $(window).resize(function() { clearTimeout(window.resizedFinished); window.resizeFinished = setTimeout(function() { if ($(window).width() != windowWidth) { windowWidth = $(window).width(); - masonry(masonryMode); + + if (columnCount != Math.floor($(".posts").width() / 250)) { + columnCount = Math.floor($(".posts").width() / 250); + masonry(masonryMode); + } } }, 250); }); @@ -72,12 +97,10 @@ var $container = $(".posts"); function masonry(mode) { masonryMode = mode; $container.children().remove(); - columnCount = Math.floor($(".posts").width() / 250); /* * Initialise columns. */ - var columns = new Array(columnCount); for (i = 0; i < columnCount; i++) { $column = $("
").html(fancyText(this["content"]))); - $post.append($("
").text(this["nicetime"])); - $post.append($("
").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"])); - - shortestColumn = getShortestColumn(columns); - shortestColumn[1].append($post); - shortestColumn[0] = shortestColumn[0] + $post.height() + margin; - }); - }); + loadMorePosts(userID, groupID, 0, postLimit); } +function getShortestColumn(columns) { + column = columns[0]; + + for (i = 1; i < columnCount; i++) { + if (column[0] > columns[i][0]) { + column = columns[i]; + } + } + return column; +} + +function loadMorePosts(uID, gID, offset, limit) { + if (noposts) { + return; + } + + console.log(uID, gID, offset, limit); + + + $.post("API/getPosts.php", { usr : uID, + grp : gID, + offset : offset, + limit : limit}) + .done(function(data) { + if (!data) { + $('.noposts').show(); + noposts = true; + return; + } + + posts = JSON.parse(data); + + /* + * Rearange the objects. + */ + $.each(posts, function() { + $post = $("
").html(fancyText(this["content"]))); + $post.append($("
").text(this["nicetime"])); + $post.append($("
").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"]));
+
+ shortestColumn = getShortestColumn(columns);
+ shortestColumn[1].append($post);
+ shortestColumn[0] = shortestColumn[0] + $post.height() + margin;
+ });
+ });
+
+ postAmount += limit;
+}
\ No newline at end of file
diff --git a/website/public/js/menu.js b/website/public/js/menu.js
index d15d678..c575ecd 100644
--- a/website/public/js/menu.js
+++ b/website/public/js/menu.js
@@ -2,92 +2,125 @@ var menuFriendsData;
var menuGroupsData;
var notificationMessagesData;
var notificationRequestsData;
+var updatingMenus = 0;
-
+// On document load, load menus and loops loading menus every 10 seconds.
$(document).ready(function() {
- loadMenuFriends(5);
- loadNotificationFriends();
- loadUnreadMessages();
- loadMenuGroups();
- setInterval(updateMenus, 3000);
+ updateMenus();
+ setInterval(updateMenus, 10000);
});
// Update the menu and notification items.
function updateMenus() {
- loadMenuFriends(5);
- loadNotificationFriends();
- loadUnreadMessages();
- loadMenuGroups();
+ if (updatingMenus <= 0) {
+ loadMenuFriends(5);
+ loadNotificationFriends();
+ loadUnreadMessages();
+ loadMenuGroups();
+ }
}
-// Get, every 3 seconds, the friends and insert them in the menu.
+// Get the friends and insert them in the menu.
function loadMenuFriends(limit) {
+ updatingMenus ++;
$.post(
"API/loadFriends.php",
{
limit: 5
}
).done(function(data) {
+ if (data == "" || data == "[]") {
+ $("#friends-menu-section").hide();
+ } else {
+ $("#friends-menu-section").show();
+ }
if (menuFriendsData != data) {
menuFriendsData = data;
- if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
- $("#friends-menu-section").show();
- } else {
+ if (!showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
$("#friends-menu-section").hide();
}
}
+ }).fail(function() {
+ $("#friends-menu-section").hide();
+ }).always(function() {
+ updatingMenus --;
});
}
-// Get, every 3 seconds, the groups and insert them in the menu.
+// Get the groups and insert them in the menu.
function loadMenuGroups() {
+ updatingMenus ++;
$.post(
"API/loadGroups.php",
{
limit: 5
}
).done(function(data) {
+
+ if (data == "" || data == "[]") {
+ $("#groups-menu-section").hide();
+ } else {
+ $("#groups-menu-section").show();
+ }
if (menuGroupsData != data) {
menuGroupsData = data;
- if (showGroups(data, "#menu-groups-list")) {
- $("#groups-menu-section").show();
- } else {
+ if (!showGroups(data, "#menu-groups-list")) {
$("#groups-menu-section").hide();
}
}
+ }).fail(function() {
+ $("#groups-menu-section").hide();
+ }).always(function() {
+ updatingMenus --;
});
}
-// Get, every 3 seconds, the friends requests and insert them in the notification center.
+// Get the friends requests and insert them in the notification center.
function loadNotificationFriends() {
+ updatingMenus ++;
$.post(
"API/loadFriendRequest.php"
).done(function(data) {
+ if (data == "" || data == "[]") {
+ $("#friend-request-section").hide();
+ } else {
+ $("#friend-request-section").show();
+ }
if (notificationRequestsData != data) {
notificationRequestsData = data;
- if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
- $("#friend-request-section").show();
- } else {
+ if (!showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
$("#friend-request-section").hide();
}
}
+ }).fail(function() {
+ $("#friend-request-section").hide();
+ }).always(function() {
+ updatingMenus --;
});
}
-// Get, every 3 seconds, the unread messages and insert them in the notification center.
+// Get the unread messages and insert them in the notification center.
function loadUnreadMessages() {
+ updatingMenus ++;
$.post(
"API/loadChatNotifications.php"
).done(function(data) {
+ if (data == "" || data == "[]") {
+ $("#unread-messages-section").hide();
+ } else {
+ $("#unread-messages-section").show();
+ }
if (notificationMessagesData != data) {
notificationMessagesData = data;
- if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
- $("#unread-messages-section").show();
- } else {
+ if (!showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
$("#unread-messages-section").hide();
}
}
+ }).fail(function() {
+ $("#unread-messages-section").hide();
+ }).always(function() {
+ updatingMenus --;
});
}
\ No newline at end of file
diff --git a/website/public/js/post.js b/website/public/js/post.js
index 27bc34e..4009023 100644
--- a/website/public/js/post.js
+++ b/website/public/js/post.js
@@ -1,3 +1,4 @@
+
function postComment(buttonValue) {
formData = $("#newcommentform").serializeArray();
formData.push({name: "button", value: buttonValue});
@@ -19,4 +20,18 @@ function postComment(buttonValue) {
).done(function (data) {
$('#modal-response').html(fancyText(data));
});
+}
+
+function deletePost(postID) {
+ var formData = [{name: "postID", value: postID}];
+ $.post(
+ "API/deletePost.php",
+ formData
+ ).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.");
+ }
+ });
+ closeModal();
+ masonry(masonryMode);
}
\ No newline at end of file
diff --git a/website/public/styles/adminpanel.css b/website/public/styles/adminpanel.css
index 0648118..39d823f 100644
--- a/website/public/styles/adminpanel.css
+++ b/website/public/styles/adminpanel.css
@@ -56,5 +56,5 @@
}
.bancommentform input[type="text"] {
- width: 100%;
+ width: 80%;
}
\ No newline at end of file
diff --git a/website/public/styles/post-popup.css b/website/public/styles/post-popup.css
index 7bbeb48..3f37ffd 100644
--- a/website/public/styles/post-popup.css
+++ b/website/public/styles/post-popup.css
@@ -14,7 +14,7 @@
/* Modal Content/Box */
.modal-content {
- margin: 5% auto;
+ margin: 50px auto;
width: 70%; /* Could be more or less, depending on screen size */
overflow-y: auto;
}
@@ -83,4 +83,21 @@
vertical-align: middle;
height: 24px;
width: 24px;
+}
+
+.deleteButton {
+ background-color: firebrick;
+
+}
+
+.deleteButton i {
+ display: inline-block;
+}
+
+.deleteButton:hover span {
+ display: inline-block;
+}
+
+.deleteButton span {
+ display: none;
}
\ No newline at end of file
diff --git a/website/public/styles/profile.css b/website/public/styles/profile.css
index d2bdab4..1bacafa 100644
--- a/website/public/styles/profile.css
+++ b/website/public/styles/profile.css
@@ -123,6 +123,11 @@ div.posts .post form textarea.newpost {
font-size: 0.8em;
}
+.noposts {
+ display: none;
+ text-align: center;
+}
+
@media only screen and (max-width: 1500px) {
.post-box {
width: calc(50% - 68px);
diff --git a/website/queries/group_page.php b/website/queries/group_page.php
index 511ff4d..588e2fd 100644
--- a/website/queries/group_page.php
+++ b/website/queries/group_page.php
@@ -193,7 +193,9 @@ function search20GroupsFromNByStatus($n, $keyword, $status) {
return $q;
}
-function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
+function searchSomeGroupsByStatus($n, $m, $search, $status) {
+// parentheses not needed in where clause, for clarity as
+// role search should override status filter.
$q = prepareQuery("
SELECT
`groupID`,
@@ -203,16 +205,18 @@ function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
FROM
`group_page`
WHERE
- `name` LIKE :keyword AND
- FIND_IN_SET (`status`, :statuses)
+ (`name` LIKE :keyword AND
+ FIND_IN_SET (`status`, :statuses)) OR
+ `status` = :search
ORDER BY
`name`
LIMIT
:n, :m
");
- $keyword = "%$keyword%";
+ $keyword = "%$search%";
$q->bindParam(':keyword', $keyword);
+ $q->bindParam(':search', $search);
$q->bindParam(':n', $n, PDO::PARAM_INT);
$q->bindParam(':m', $m, PDO::PARAM_INT);
$statuses = implode(',', $status);
@@ -221,21 +225,23 @@ function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
return $q;
}
-function countSomeGroupsByStatus($keyword, $status) {
+function countSomeGroupsByStatus($search, $status) {
$q = prepareQuery("
SELECT
COUNT(*)
FROM
`group_page`
WHERE
- `name` LIKE :keyword AND
- FIND_IN_SET (`status`, :statuses)
+ (`name` LIKE :keyword AND
+ FIND_IN_SET (`status`, :statuses)) OR
+ `status` = :search
ORDER BY
`name`
");
- $keyword = "%$keyword%";
+ $keyword = "%$search%";
$q->bindParam(':keyword', $keyword);
+ $q->bindParam(':search', $search);
$statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses);
$q->execute();
diff --git a/website/queries/post.php b/website/queries/post.php
index a175cda..ecc5c48 100644
--- a/website/queries/post.php
+++ b/website/queries/post.php
@@ -46,6 +46,57 @@ function selectAllPosts($userID, $groupID) {
}
+function selectSomePosts($userID, $groupID, $offset, $limit) {
+ $stmt = prepareQuery("
+ SELECT
+ `post`.`postID`,
+ `post`.`author`,
+ `title`,
+ CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE 'bindParam(':userID', $userID, PDO::PARAM_INT);
+ $stmt->bindParam(':groupID', $groupID , PDO::PARAM_INT);
+ $stmt->bindParam(':offset', intval($offset), PDO::PARAM_INT);
+ $stmt->bindParam(':limit', intval($limit), PDO::PARAM_INT);
+ if(!$stmt->execute()) {
+ return False;
+ }
+ if($stmt->rowCount() == 0) {
+ return False;
+ }
+ return $stmt;
+
+}
+
function selectPostById($postID) {
$stmt = prepareQuery("
SELECT
@@ -192,3 +243,56 @@ function deleteNietSlecht(int $postID, int $userID) {
$stmt->execute();
return $stmt->rowCount();
}
+
+function deletePost(int $postID, int $userID) {
+ if (checkPermissionOnPost($postID, $userID)) {
+ $stmt = prepareQuery("
+ DELETE FROM
+ `post`
+ WHERE
+ `postID` = :postID
+ ");
+ $stmt->bindParam(":postID", $postID);
+ $stmt->execute();
+ }
+}
+
+function checkPermissionOnPost(int $postID, int $userID) : bool {
+ $getGroupID = prepareQuery("
+ SELECT
+ `author`,
+ `groupID`
+ FROM
+ `post`
+ WHERE
+ `postID` = :postID
+ ");
+ $getGroupID->bindParam(":postID", $postID);
+ $getGroupID->execute();
+ $postinfo = $getGroupID->fetch();
+
+ if ($postinfo["groupID"] == null) {
+ // User post
+ return ($userID == $postinfo["author"]);
+ } else {
+ // Group post
+ $roleInGroup = getRoleInGroup($userID, $postinfo["groupID"]);
+ return ($roleInGroup == "mod" or $roleInGroup == "admin");
+ }
+}
+
+function getRoleInGroup(int $userID, int $groupID) {
+ $stmt = prepareQuery("
+ SELECT
+ `role`
+ FROM
+ `group_member`
+ WHERE
+ `userID` = :userID AND
+ `groupID` = :groupID
+ ");
+ $stmt->bindParam(":userID", $userID);
+ $stmt->bindParam(":groupID", $groupID);
+ $stmt->execute();
+ return $stmt->fetch()["role"];
+}
diff --git a/website/queries/settings.php b/website/queries/settings.php
index 03f794f..dfd65a0 100644
--- a/website/queries/settings.php
+++ b/website/queries/settings.php
@@ -18,7 +18,8 @@ function getSettings() {
`bio`,
`profilepicture`,
`showBday`,
- `showEmail`
+ `showEmail`,
+ `showProfile`
FROM
`user`
WHERE
@@ -64,7 +65,8 @@ function updateSettings() {
`birthdate` = :bday,
`bio` = :bio,
`showEmail` = :showEmail,
- `showBday` = :showBday
+ `showBday` = :showBday,
+ `showProfile` = :showProfile
WHERE
`userID` = :userID
");
@@ -79,6 +81,7 @@ function updateSettings() {
$stmt->bindValue(":bio", test_input($_POST["bio"]));
$stmt->bindValue(":showEmail", (array_key_exists("showEmail", $_POST) ? "1" : "0"));
$stmt->bindValue(":showBday", (array_key_exists("showBday", $_POST) ? "1" : "0"));
+ $stmt->bindValue(":showProfile", (array_key_exists("showProfile", $_POST) ? "1" : "0"));
$stmt->bindValue(":userID", $_SESSION["userID"]);
$stmt->execute();
diff --git a/website/queries/user.php b/website/queries/user.php
index 33a85a1..f7d8abe 100644
--- a/website/queries/user.php
+++ b/website/queries/user.php
@@ -205,7 +205,9 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
return $q;
}
-function searchSomeUsersByStatus($n, $m, $keyword, $status) {
+function searchSomeUsersByStatus($n, $m, $search, $status) {
+// parentheses not needed in where clause, for clarity as
+// role search should override status filter.
$q = prepareQuery("
SELECT
`userID`,
@@ -219,8 +221,9 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
FROM
`user`
WHERE
- `username` LIKE :keyword AND
- FIND_IN_SET (`role`, :statuses)
+ (`username` LIKE :keyword AND
+ FIND_IN_SET (`role`, :statuses)) OR
+ `role` = :search
ORDER BY
`role`,
`username`
@@ -228,8 +231,9 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
:n, :m
");
- $keyword = "%$keyword%";
+ $keyword = "%$search%";
$q->bindParam(':keyword', $keyword);
+ $q->bindParam(':search', $search);
$q->bindParam(':n', $n, PDO::PARAM_INT);
$q->bindParam(':m', $m, PDO::PARAM_INT);
$statuses = implode(',', $status);
@@ -238,22 +242,24 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
return $q;
}
-function countSomeUsersByStatus($keyword, $status) {
+function countSomeUsersByStatus($search, $status) {
$q = prepareQuery("
SELECT
COUNT(*)
FROM
`user`
WHERE
- `username` LIKE :keyword AND
- FIND_IN_SET (`role`, :statuses)
+ (`username` LIKE :keyword AND
+ FIND_IN_SET (`role`, :statuses)) OR
+ `role` = :search
ORDER BY
`role`,
`username`
");
- $keyword = "%$keyword%";
+ $keyword = "%$search%";
$q->bindParam(':keyword', $keyword);
+ $q->bindParam(':search', $search);
$statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses);
$q->execute();
diff --git a/website/views/post-view.php b/website/views/post-view.php
index d961334..da1c86f 100644
--- a/website/views/post-view.php
+++ b/website/views/post-view.php
@@ -2,23 +2,28 @@
$postID = $_GET['postID'];
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
-session_start();
-
-echo("
+?>
" . $post['content'] . "
+=$post['content']?>
Geen posts meer!
+