FIXED VISIBILITY ON PROFILE #187

Merged
11319801 merged 27 commits from kevin-prototype into master 2017-02-02 13:57:45 +01:00
36 changed files with 408 additions and 125 deletions

View File

@@ -0,0 +1,20 @@
<?php
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 (empty($_POST["postID"]) or empty($_SESSION["userID"])) {
header('HTTP/1.1 500 Non enough arguments');
}
deletePost($_POST["postID"], $_SESSION["userID"]);
return;
} else {
echo "frozen";
}

View File

@@ -6,6 +6,7 @@ require_once ("../../queries/connect.php");
require_once ("../../queries/private_message.php"); require_once ("../../queries/private_message.php");
require_once("../../queries/user.php"); require_once("../../queries/user.php");
// Check if the user is allowed to load them.
if (isset($_SESSION["userID"]) && if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'banned') { getRoleByID($_SESSION["userID"]) != 'banned') {
echo selectAllUnreadChat(); echo selectAllUnreadChat();

View File

@@ -6,6 +6,7 @@ require_once ("../../queries/connect.php");
require_once ("../../queries/friendship.php"); require_once ("../../queries/friendship.php");
require_once ("../../queries/user.php"); require_once ("../../queries/user.php");
// Check if the user is allowed to load them.
if (isset($_SESSION["userID"]) && if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' && getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') { getRoleByID($_SESSION["userID"]) != 'banned') {

View File

@@ -7,9 +7,11 @@ require_once ("../../queries/checkInput.php");
require_once ("../../queries/friendship.php"); require_once ("../../queries/friendship.php");
require_once("../../queries/user.php"); require_once("../../queries/user.php");
// Check if the user is allowed to load them.
if (isset($_SESSION["userID"]) && if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'banned') { getRoleByID($_SESSION["userID"]) != 'banned') {
if (isset($_SESSION["userID"])) { if (isset($_SESSION["userID"])) {
// Echo the limited or unlimited users.
if (isset($_POST["limit"])) { if (isset($_POST["limit"])) {
echo selectLimitedFriends($_SESSION["userID"], (int)test_input($_POST["limit"])); echo selectLimitedFriends($_SESSION["userID"], (int)test_input($_POST["limit"]));
} else if (isset($_GET["limit"])) { } else if (isset($_GET["limit"])) {

View File

@@ -8,8 +8,10 @@ require_once ("../../queries/group_member.php");
require_once("../../queries/user.php"); require_once("../../queries/user.php");
// Check if the user is allowed to load them.
if (isset($_SESSION["userID"]) && if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'banned') { getRoleByID($_SESSION["userID"]) != 'banned') {
// Echo the limited or unlimited groups.
if (isset($_POST["limit"])) { if (isset($_POST["limit"])) {
echo selectLimitedGroupsFromUser($_SESSION["userID"], (int)test_input($_POST["limit"])); echo selectLimitedGroupsFromUser($_SESSION["userID"], (int)test_input($_POST["limit"]));
} else { } else {

View File

@@ -8,8 +8,10 @@ require_once("../../queries/checkInput.php");
require_once("../../queries/friendship.php"); require_once("../../queries/friendship.php");
require_once("../../queries/user.php"); require_once("../../queries/user.php");
// Check if the user is allowed to get the messages.
if (isset($_SESSION["userID"]) && if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'banned') { getRoleByID($_SESSION["userID"]) != 'banned') {
// Check if the users wants new messages or old ones, and give the right one back.
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") { if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
setLastVisited(test_input($_POST["destination"])); setLastVisited(test_input($_POST["destination"]));
echo getNewChatMessages(test_input($_POST["lastID"]), test_input($_POST["destination"])); echo getNewChatMessages(test_input($_POST["lastID"]), test_input($_POST["destination"]));

View File

@@ -6,11 +6,11 @@ require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php"); require_once ("../../queries/checkInput.php");
require_once ("../../queries/user.php"); require_once ("../../queries/user.php");
require_once ("../../queries/group_page.php"); require_once ("../../queries/group_page.php");
require_once ("../../queries/friendship.php");
require_once ("../../queries/group_member.php");
if (isset($_SESSION["userID"]) && if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'banned') { getRoleByID($_SESSION["userID"]) != 'banned') {$user_perpage = $group_perpage = 20;
$user_perpage = $group_perpage = 20;
$user_currentpage = $group_currentpage = 1; $user_currentpage = $group_currentpage = 1;
if (isset($_POST['user-pageselect'])) { if (isset($_POST['user-pageselect'])) {
@@ -28,20 +28,26 @@ if (isset($_SESSION["userID"]) &&
$search = test_input($_POST['search']); $search = test_input($_POST['search']);
} }
$user_count = countSomeUsers($search)->fetchColumn();
$group_count = countSomeGroups($search)->fetchColumn();
$filter = "all"; $filter = "all";
if (isset($_POST['filter'])) { if (isset($_POST['filter'])) {
$filter = test_input($_POST['filter']); $filter = test_input($_POST['filter']);
} }
if ($filter == "all") {
$user_count = countSomeUsers($search)->fetchColumn();
$group_count = countSomeGroups($search)->fetchColumn();
} else {
$user_count = countSomeFriends($search);
$group_count = countSomeOwnGroups($search);
}
$option = "user"; $option = "user";
if (isset($_POST['option'])) { if (isset($_POST['option'])) {
$option = test_input($_POST['option']); $option = test_input($_POST['option']);
} }
include("../../views/searchPageNumber.php"); include ("../../views/searchPageNumber.php");
} else { } else {
header('HTTP/1.0 403 Forbidden'); header('HTTP/1.0 403 Forbidden');
} }

View File

@@ -6,12 +6,15 @@ require_once("../../queries/private_message.php");
require_once("../../queries/checkInput.php"); require_once("../../queries/checkInput.php");
require_once("../../queries/user.php"); require_once("../../queries/user.php");
// Check if the user is allowed to send a message.
if (isset($_SESSION["userID"]) && if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' && getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') { getRoleByID($_SESSION["userID"]) != 'banned') {
if (!empty(test_input($_POST["destination"])) && if (!empty(test_input($_POST["destination"])) &&
!empty(test_input($_POST["content"])) !empty(test_input($_POST["content"]))
) { ) {
// Send the message.
// Returns false when it didn't succeed sending the message.
if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) { if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
echo 1; echo 1;
} else { } else {

View File

@@ -4,6 +4,7 @@ session_start();
include_once ("../../queries/friendship.php"); include_once ("../../queries/friendship.php");
// Initialize variables to given or default values.
if (isset($_POST["action"])) { if (isset($_POST["action"])) {
$action = $_POST["action"]; $action = $_POST["action"];
} else { } else {
@@ -18,6 +19,8 @@ if (isset($_POST["actionType"])) {
$friends = json_decode($_POST["friends"]); $friends = json_decode($_POST["friends"]);
// Foreach friend, return them as list item.
foreach($friends as $i => $friend) { foreach($friends as $i => $friend) {
$friendshipStatus = getFriendshipStatus($friend->userID); $friendshipStatus = getFriendshipStatus($friend->userID);
?> ?>
@@ -38,7 +41,7 @@ foreach($friends as $i => $friend) {
<?= $friend->fullname ?><br/> <?= $friend->fullname ?><br/>
<span style='color: #666'><?php <span style='color: #666'><?php
if (isset($friend->username)) { if (isset($friend->username)) {
echo $friend->username; echo $friend->usernameshort;
} else if (isset($friend->content)) { } else if (isset($friend->content)) {
echo $friend->content; echo $friend->content;
} }
@@ -48,6 +51,7 @@ foreach($friends as $i => $friend) {
</button> </button>
</form> </form>
<?php <?php
// Add friendship options if possible.
if ($friendshipStatus > 1) { if ($friendshipStatus > 1) {
if ($friendshipStatus == 2) { if ($friendshipStatus == 2) {
$denyName = "Annuleer"; $denyName = "Annuleer";

View File

@@ -6,6 +6,7 @@ include_once ("../../queries/group_member.php");
$groups = json_decode($_POST["groups"]); $groups = json_decode($_POST["groups"]);
// Add each group as list item.
foreach($groups as $i => $group) { foreach($groups as $i => $group) {
?> ?>
<li class='group-item'> <li class='group-item'>

View File

@@ -9,13 +9,17 @@ $(document).ready(function() {
$(".chat-field").hide(); $(".chat-field").hide();
}); });
// This function loads the new messages and runs the addMessages function to show them.
function loadMessages() { function loadMessages() {
// If the function is not running elsewhere, run it here.
if (!gettingMessages) { if (!gettingMessages) {
gettingMessages = true; gettingMessages = true;
// Get the messages.
$.post( $.post(
"API/loadMessages.php", "API/loadMessages.php",
$("#lastIDForm").serialize() $("#lastIDForm").serialize()
).done(function (data) { ).done(function (data) {
// Post the messages in the chat.
if (data && data != "[]") { if (data && data != "[]") {
messages = JSON.parse(data); messages = JSON.parse(data);
addMessages(messages); addMessages(messages);
@@ -28,7 +32,7 @@ function loadMessages() {
} }
} }
// Send a message to a friend of the user.
function sendMessage() { function sendMessage() {
$.post( $.post(
"API/sendMessage.php", "API/sendMessage.php",
@@ -37,42 +41,54 @@ function sendMessage() {
if (response == "frozen") { 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."); alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
} }
// Load messages if the message has been send, so it shows in the chat.
loadMessages();
}); });
$("#newContent").val(""); $("#newContent").val("");
loadMessages();
} }
// Add messages to the chat.
function addMessages(messages) { function addMessages(messages) {
var messagesText = ""; var messagesText = "";
// Loop over all the messages.
for(var i in messages) { for(var i in messages) {
// Initialize message variables // Initialize message variables.
var thisDate = new Date(messages[i].creationdate.replace(/ /,"T")); var thisDate = new Date(messages[i].creationdate.replace(/ /,"T"));
var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes(); var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes();
var type; var type;
thisDate.setHours(0,0,0,0); thisDate.setHours(0,0,0,0);
// See where the message has been send from, so it shows on the right side.
if (messages[i].destination == $(".destinationID").val()) { if (messages[i].destination == $(".destinationID").val()) {
type = "chat-message-self"; type = "chat-message-self";
} else { } else {
type = "chat-message-other"; type = "chat-message-other";
} }
// If it is the first message, open the message box and maybe add a year.
if (i == 0) { if (i == 0) {
if (thisDate.getTime() > previousDate.getTime()) {
messagesText += '\
<div class="day-message"> \
<div class="day-message-content">\
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div> \
</div>';
}
previousDate = thisDate; previousDate = thisDate;
messagesText += '\
<div class="day-message"> \
<div class="day-message-content">\
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div> \
</div>';
messagesText += '<div class="chat-message"><div class="' + type + '">'; messagesText += '<div class="chat-message"><div class="' + type + '">';
// If it is not the first message, and has a different date/time/type then the previous message,
} else if (type != previousType || thisTime != previousTime || thisDate.getTime() > previousDate.getTime()) { } else if (type != previousType || thisTime != previousTime || thisDate.getTime() > previousDate.getTime()) {
// Close the previous message.
messagesText += '<div class="chat-time">\ messagesText += '<div class="chat-time">\
' + thisTime + '\ ' + thisTime + '\
</div></div></div>'; </div></div></div>';
previousTime = thisTime; previousTime = thisTime;
previousType = type; previousType = type;
// If the date is different, add a new date.
if (thisDate > previousDate) { if (thisDate > previousDate) {
previousDate = thisDate; previousDate = thisDate;
messagesText += '\ messagesText += '\
@@ -83,8 +99,11 @@ function addMessages(messages) {
</div>'; </div>';
} }
// Open the new message.
messagesText += '<div class="chat-message"><div class="' + type + '">'; messagesText += '<div class="chat-message"><div class="' + type + '">';
} }
// Add the content of the message in the new box.
messagesText += fancyText(messages[i].content) + "<br />"; messagesText += fancyText(messages[i].content) + "<br />";
} }
@@ -93,11 +112,14 @@ function addMessages(messages) {
' + thisTime + '\ ' + thisTime + '\
</div></div></div>'; </div></div></div>';
// Add all the new created messaged to the chat.
$("#chat-history").append(messagesText); $("#chat-history").append(messagesText);
// Scroll down, so the user can see the new messages.
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight - $('#chat-history')[0].clientHeight); $("#chat-history").scrollTop($("#chat-history")[0].scrollHeight - $('#chat-history')[0].clientHeight);
} }
// Switch to a different user.
function switchUser(userID) { function switchUser(userID) {
previousDate = new Date("1970-01-01 00:00:00"); previousDate = new Date("1970-01-01 00:00:00");
$(".chat-field").show(); $(".chat-field").show();
@@ -108,6 +130,7 @@ function switchUser(userID) {
$("#friend-item-" + userID).addClass("active-friend-chat"); $("#friend-item-" + userID).addClass("active-friend-chat");
} }
// Insert a message in the chat, this is used when it is empty.
function sayEmpty() { function sayEmpty() {
$("#chat-history").html("Probeer ook eens foto's en video's te sturen"); $("#chat-history").html("Probeer ook eens foto's en video's te sturen");
} }

View File

@@ -11,7 +11,8 @@ $(document).ready(function() {
// Add cookie so the menu stays open on other pages // Add cookie so the menu stays open on other pages
if (window.innerWidth > 1080) { if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 587px)"); $("#chat-history").css("margin-right", "266px");
$("#chat-history").css("width", "calc(100% - 512px - 75px)");
document.cookie = "menu=open; path=/"; document.cookie = "menu=open; path=/";
} else { } else {
document.cookie = "menu=closed; path=/"; document.cookie = "menu=closed; path=/";
@@ -22,7 +23,8 @@ $(document).ready(function() {
$("#notification-center").css("display", "none"); $("#notification-center").css("display", "none");
if (window.innerWidth > 1080) { if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 331px)"); $("#chat-history").css("margin-right", "10px");
$("#chat-history").css("width", "calc(100% - 256px - 85px)");
} else { } else {
// Make the menu invisible and move the content to the right. // Make the menu invisible and move the content to the right.
$("#contact-menu").css("display", "none"); $("#contact-menu").css("display", "none");
@@ -43,6 +45,7 @@ $(document).ready(function() {
// Add cookie so the menu stays open on other pages // Add cookie so the menu stays open on other pages
if (window.innerWidth > 1080) { if (window.innerWidth > 1080) {
$("#chat-history").css("margin-right", "266px");
$("#chat-history").width("calc(100% - 587px)"); $("#chat-history").width("calc(100% - 587px)");
document.cookie = "menu=open; path=/"; document.cookie = "menu=open; path=/";
} else { } else {

View File

@@ -14,14 +14,14 @@ function fancyText(text) {
return "<video width='100%'>" + return "<video width='100%'>" +
"<source src='"+ link +"' type='video/mp4'>" + "<source src='"+ link +"' type='video/mp4'>" +
"<b>Je browser ondersteund geen video</b>" + "<b>Je browser ondersteund geen video</b>" +
"</video><button class='gray' onclick='$(this).prev().get(0).play();'>Speel af</button>"; "</video><button class='gray' onclick='$(this).prev().get(0).play();'><i class='fa fa-play'></i></button>";
} }
// Add ogg video's // Add ogg video's
else if (link.match(/(https?:\/\/.[^ ]*\.(?:ogg))/ig)) { else if (link.match(/(https?:\/\/.[^ ]*\.(?:ogg))/ig)) {
return "<video width='100%'>" + return "<video width='100%'>" +
"<source src='"+ link +"' type='video/ogg'>" + "<source src='"+ link +"' type='video/ogg'>" +
"<b>Je browser ondersteund geen video</b>" + "<b>Je browser ondersteund geen video</b>" +
"</video><button onclick='$(this).prev().get(0).play();'>Speel af</button>"; "</video><button class='gray' onclick='$(this).prev().get(0).play();'><i class='fa fa-play'></i></button>";
} }
// Add youtube video's // Add youtube video's
else if (link.match(/(https?:\/\/.(www.)?youtube|youtu.be)*watch/ig)) { else if (link.match(/(https?:\/\/.(www.)?youtube|youtu.be)*watch/ig)) {
@@ -38,6 +38,8 @@ function fancyText(text) {
return text; return text;
} }
// This function gets the value of a cookie when given a key.
// If didn´t find any compatible cookie, it returns false.
function getCookie(key) { function getCookie(key) {
cookies = document.cookie.split("; "); cookies = document.cookie.split("; ");
for (var i in cookies) { for (var i in cookies) {
@@ -49,6 +51,7 @@ function getCookie(key) {
return false; return false;
} }
// Edit the friendship status of two users.
function editFriendship(userID, value) { function editFriendship(userID, value) {
$.post("API/editFriendship.php", { usr: userID, action: value }) $.post("API/editFriendship.php", { usr: userID, action: value })
.done(function() { .done(function() {
@@ -57,6 +60,8 @@ function editFriendship(userID, value) {
}); });
} }
// Show the given friends in the given list.
// The friends are giving in JSON, and the list is giving with a hashtag.
function showFriends(friends, list) { function showFriends(friends, list) {
if(friends && friends != "[]") { if(friends && friends != "[]") {
$(list).load("bits/friend-item.php", { $(list).load("bits/friend-item.php", {
@@ -69,6 +74,8 @@ function showFriends(friends, list) {
} }
} }
// Show the given friends in the given list.
// This function supports more options given as parameters. This adds extra functionality.
function showFriendsPlus(friends, list, limit, action, actionType) { function showFriendsPlus(friends, list, limit, action, actionType) {
if(friends && friends != "[]") { if(friends && friends != "[]") {
$(list).load("bits/friend-item.php", { $(list).load("bits/friend-item.php", {
@@ -84,6 +91,7 @@ function showFriendsPlus(friends, list, limit, action, actionType) {
} }
} }
// Show the given groups in the given list.
function showGroups(groups, list) { function showGroups(groups, list) {
if(groups && groups != "[]") { if(groups && groups != "[]") {
$(list).load("bits/group-item.php", { $(list).load("bits/group-item.php", {
@@ -94,14 +102,4 @@ function showGroups(groups, list) {
} else { } else {
return false; 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("");
}
});
});

View File

@@ -61,19 +61,9 @@ $(document).ready(function () {
}); });
$(window).on("load", function() { $(window).on("load", function() {
$(".modal-close").click(function () { $(".modal-close").click(function (){closeModal()});
$(".modal").hide();
scrollbarMargin(0, 'auto');
$('#modal-response').hide();
$('.modal-default').show();
});
// http://stackoverflow.com/questions/9439725/javascript-how-to-detect-if-browser-window-is-scrolled-to-bottom // http://stackoverflow.com/questions/9439725/javascript-how-to-detect-if-browser-window-is-scrolled-to-bottom
// $(window).on("scroll", function () {
// if ((window.innerHeight + window.pageYOffset) >= document.body.offsetHeight) {
// loadMorePosts(userID, groupID, postAmount, postLimit);
// }
// });
window.onscroll = function(ev) { window.onscroll = function(ev) {
if($(window).scrollTop() + $(window).height() == $(document).height() ) { if($(window).scrollTop() + $(window).height() == $(document).height() ) {
loadMorePosts(userID, groupID, postAmount, postLimit); loadMorePosts(userID, groupID, postAmount, postLimit);
@@ -81,6 +71,13 @@ $(window).on("load", function() {
}; };
}); });
function closeModal() {
$(".modal").hide();
scrollbarMargin(0, 'auto');
$('#modal-response').hide();
$('.modal-default').show();
}
$(window).resize(function() { $(window).resize(function() {
clearTimeout(window.resizedFinished); clearTimeout(window.resizedFinished);
window.resizeFinished = setTimeout(function() { window.resizeFinished = setTimeout(function() {
@@ -123,7 +120,7 @@ function masonry(mode) {
$form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">")); $form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">"));
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\" maxlength='1000'></textarea><span></span>")); $form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\" maxlength='1000'></textarea><span></span>"));
$form.append($("<input value=\"Plaats!\" type=\"submit\">")); $form.append($("<button type=\"submit\"><i class='fa fa-sticky-note-o'></i> Plaats!</button>"));
columns[0][1].append($postInput); columns[0][1].append($postInput);
columns[0][0] = $postInput.height() + margin; columns[0][0] = $postInput.height() + margin;

View File

@@ -6,11 +6,7 @@ var updatingMenus = 0;
// On document load, load menus and loops loading menus every 10 seconds. // On document load, load menus and loops loading menus every 10 seconds.
$(document).ready(function() { $(document).ready(function() {
updatingMenus = 4; updateMenus();
loadMenuFriends(5);
loadNotificationFriends();
loadUnreadMessages();
loadMenuGroups();
setInterval(updateMenus, 10000); setInterval(updateMenus, 10000);
}); });
@@ -18,7 +14,6 @@ $(document).ready(function() {
// Update the menu and notification items. // Update the menu and notification items.
function updateMenus() { function updateMenus() {
if (updatingMenus <= 0) { if (updatingMenus <= 0) {
updatingMenus = 4;
loadMenuFriends(5); loadMenuFriends(5);
loadNotificationFriends(); loadNotificationFriends();
loadUnreadMessages(); loadUnreadMessages();
@@ -27,76 +22,105 @@ function updateMenus() {
} }
// Get, every 3 seconds, the friends and insert them in the menu. // Get the friends and insert them in the menu.
function loadMenuFriends(limit) { function loadMenuFriends(limit) {
updatingMenus ++;
$.post( $.post(
"API/loadFriends.php", "API/loadFriends.php",
{ {
limit: 5 limit: 5
} }
).done(function(data) { ).done(function(data) {
if (data == "" || data == "[]") {
$("#friends-menu-section").hide();
} else {
$("#friends-menu-section").show();
}
if (menuFriendsData != data) { if (menuFriendsData != data) {
menuFriendsData = data; menuFriendsData = data;
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) { if (!showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
$("#friends-menu-section").show();
} else {
$("#friends-menu-section").hide(); $("#friends-menu-section").hide();
} }
} }
}).fail(function() {
$("#friends-menu-section").hide();
}).always(function() {
updatingMenus --; updatingMenus --;
}); });
} }
// Get, every 3 seconds, the groups and insert them in the menu. // Get the groups and insert them in the menu.
function loadMenuGroups() { function loadMenuGroups() {
updatingMenus ++;
$.post( $.post(
"API/loadGroups.php", "API/loadGroups.php",
{ {
limit: 5 limit: 5
} }
).done(function(data) { ).done(function(data) {
if (data == "" || data == "[]") {
$("#groups-menu-section").hide();
} else {
$("#groups-menu-section").show();
}
if (menuGroupsData != data) { if (menuGroupsData != data) {
menuGroupsData = data; menuGroupsData = data;
if (showGroups(data, "#menu-groups-list")) { if (!showGroups(data, "#menu-groups-list")) {
$("#groups-menu-section").show();
} else {
$("#groups-menu-section").hide(); $("#groups-menu-section").hide();
} }
} }
}).fail(function() {
$("#groups-menu-section").hide();
}).always(function() {
updatingMenus --; 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() { function loadNotificationFriends() {
updatingMenus ++;
$.post( $.post(
"API/loadFriendRequest.php" "API/loadFriendRequest.php"
).done(function(data) { ).done(function(data) {
if (data == "" || data == "[]") {
$("#friend-request-section").hide();
} else {
$("#friend-request-section").show();
}
if (notificationRequestsData != data) { if (notificationRequestsData != data) {
notificationRequestsData = data; notificationRequestsData = data;
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) { if (!showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
$("#friend-request-section").show();
} else {
$("#friend-request-section").hide(); $("#friend-request-section").hide();
} }
} }
}).fail(function() {
$("#friend-request-section").hide();
}).always(function() {
updatingMenus --; 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() { function loadUnreadMessages() {
updatingMenus ++;
$.post( $.post(
"API/loadChatNotifications.php" "API/loadChatNotifications.php"
).done(function(data) { ).done(function(data) {
if (data == "" || data == "[]") {
$("#unread-messages-section").hide();
} else {
$("#unread-messages-section").show();
}
if (notificationMessagesData != data) { if (notificationMessagesData != data) {
notificationMessagesData = data; notificationMessagesData = data;
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) { if (!showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
$("#unread-messages-section").show();
} else {
$("#unread-messages-section").hide(); $("#unread-messages-section").hide();
} }
} }
}).fail(function() {
$("#unread-messages-section").hide();
}).always(function() {
updatingMenus --; updatingMenus --;
}); });
} }

View File

@@ -1,3 +1,4 @@
function postComment(buttonValue) { function postComment(buttonValue) {
formData = $("#newcommentform").serializeArray(); formData = $("#newcommentform").serializeArray();
formData.push({name: "button", value: buttonValue}); formData.push({name: "button", value: buttonValue});
@@ -19,4 +20,18 @@ function postComment(buttonValue) {
).done(function (data) { ).done(function (data) {
$('#modal-response').html(fancyText(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);
} }

View File

@@ -2,6 +2,7 @@ $(window).on('load', function () {
pageNumber(); pageNumber();
}); });
// Search for the users and put them in the user list.
function searchUsers() { function searchUsers() {
$.post( $.post(
"API/searchUsers.php", "API/searchUsers.php",
@@ -13,6 +14,7 @@ function searchUsers() {
}); });
} }
// Search for the groups and put them in the group list.
function searchGroups() { function searchGroups() {
$.post( $.post(
"API/searchGroups.php", "API/searchGroups.php",
@@ -24,6 +26,7 @@ function searchGroups() {
}); });
} }
// Get the page numbers and return them in the select.
function pageNumber() { function pageNumber() {
var input = input2 = $('#search-form').serialize(); var input = input2 = $('#search-form').serialize();
$.post( $.post(

View File

@@ -56,5 +56,5 @@
} }
.bancommentform input[type="text"] { .bancommentform input[type="text"] {
width: 100%; width: 80%;
} }

View File

@@ -102,7 +102,6 @@ p {
.group-picture { .group-picture {
border-radius: 5px; border-radius: 5px;
border: none;
} }
.item-box, .item-box-full-width { .item-box, .item-box-full-width {
@@ -117,7 +116,7 @@ p {
@media only screen and (max-width: 1400px) { @media only screen and (max-width: 1400px) {
.item-box { .item-box {
width: calc(100% - 50px); width: calc(100% - 50px)!important;
} }
} }
@@ -291,19 +290,6 @@ div[data-title]:hover:after {
vertical-align: middle; vertical-align: middle;
} }
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-track {
background: none;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 20px;
border-radius: 20px;
background: #4CAF50;
}
@media only screen and (max-width: 1080px) { @media only screen and (max-width: 1080px) {
body { body {
font-size: 28px!important; font-size: 28px!important;

View File

@@ -83,4 +83,21 @@
vertical-align: middle; vertical-align: middle;
height: 24px; height: 24px;
width: 24px; width: 24px;
}
.deleteButton {
background-color: firebrick;
}
.deleteButton i {
display: inline-block;
}
.deleteButton:hover span {
display: inline-block;
}
.deleteButton span {
display: none;
} }

View File

@@ -11,7 +11,7 @@
display: inline-block; display: inline-block;
} }
.friend-button-container { .friend-button-container, .group-button-container {
position: relative; position: relative;
float: right; float: right;
width: 200px; width: 200px;
@@ -62,7 +62,6 @@
.group-picture { .group-picture {
border: none; border: none;
margin-bottom: 0;
margin-right: 15px; margin-right: 15px;
} }
@@ -108,7 +107,7 @@ div.posts .post form input, div.posts .post form textarea {
width: calc(100% - 15px); width: calc(100% - 15px);
} }
div.posts .post form input[type="submit"] { div.posts .post form input[type="submit"], .post button{
width: 100%; width: 100%;
} }

View File

@@ -32,6 +32,11 @@
text-align: right; text-align: right;
} }
.settings-password, .settings-email {
width: calc(50% - 60px);
display: inline-flex;
}
.settings-password label, .settings-email label { .settings-password label, .settings-email label {
text-align: left; text-align: left;
} }

View File

@@ -10,8 +10,9 @@ function selectLimitedFriends($userID, $limit) {
$stmt = prepareQuery(" $stmt = prepareQuery("
SELECT SELECT
`userID`, `userID`,
LEFT(`username`, 12) as `usernameshort`,
`username`, `username`,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`, LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 12) as `fullname`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,
'../img/avatar-standard.png' '../img/avatar-standard.png'
@@ -50,8 +51,9 @@ function selectAllFriends($userID) {
$stmt = prepareQuery(" $stmt = prepareQuery("
SELECT SELECT
`userID`, `userID`,
LEFT(`username`, 12) as `usernameshort`,
`username`, `username`,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`, LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 12) as `fullname`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,
'../img/avatar-standard.png' '../img/avatar-standard.png'
@@ -85,8 +87,9 @@ function selectAllFriendRequests() {
$stmt = prepareQuery(" $stmt = prepareQuery("
SELECT SELECT
`userID`, `userID`,
LEFT(`username`, 12) as `usernameshort`,
`username`, `username`,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`, LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 12) as `fullname`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,
'../img/avatar-standard.png' '../img/avatar-standard.png'
@@ -235,8 +238,9 @@ function searchSomeFriends($n, $m, $search) {
$stmt = prepareQuery(" $stmt = prepareQuery("
SELECT SELECT
`userID`, `userID`,
LEFT(`username`, 12) as `usernameshort`,
`username`, `username`,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`, LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 12) as `fullname`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,
'../img/avatar-standard.png' '../img/avatar-standard.png'
@@ -275,4 +279,35 @@ function searchSomeFriends($n, $m, $search) {
$stmt->bindParam(':m', $m, PDO::PARAM_INT); $stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute(); $stmt->execute();
return json_encode($stmt->fetchAll()); return json_encode($stmt->fetchAll());
}
function countSomeFriends($search) {
$stmt = prepareQuery("
SELECT
COUNT(*)
FROM
`user`
INNER JOIN
`friendship`
WHERE
((`friendship`.`user1ID` = :userID AND
`friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND
`user`.`role` != 'banned' AND
`friendship`.`status` = 'confirmed') AND
(`username` LIKE :keyword OR
`fname` LIKE :keyword OR
`lname` LIKE :keyword)
ORDER BY
`fname`,
`lname`,
`username`
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetchColumn();
} }

View File

@@ -55,6 +55,29 @@ function searchSomeOwnGroups($n, $m, $search) {
return json_encode($stmt->fetchAll()); return json_encode($stmt->fetchAll());
} }
function countSomeOwnGroups($search) {
$stmt = prepareQuery("
SELECT
COUNT(*)
FROM
`group_page`
INNER JOIN
`group_member`
WHERE
`group_member`.`userID` = :userID AND
`group_member`.`groupID` = `group_page`.`groupID` AND
`group_page`.`status` != 'hidden' AND
`name` LIKE :keyword
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetchColumn();
}
function addMember($groupID, $userID, $role) { function addMember($groupID, $userID, $role) {
$stmt = prepareQuery(" $stmt = prepareQuery("
INSERT INTO INSERT INTO

View File

@@ -196,7 +196,9 @@ function search20GroupsFromNByStatus($n, $keyword, $status) {
return $q; 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(" $q = prepareQuery("
SELECT SELECT
`groupID`, `groupID`,
@@ -206,16 +208,18 @@ function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
FROM FROM
`group_page` `group_page`
WHERE WHERE
`name` LIKE :keyword AND (`name` LIKE :keyword AND
FIND_IN_SET (`status`, :statuses) FIND_IN_SET (`status`, :statuses)) OR
`status` = :search
ORDER BY ORDER BY
`name` `name`
LIMIT LIMIT
:n, :m :n, :m
"); ");
$keyword = "%$keyword%"; $keyword = "%$search%";
$q->bindParam(':keyword', $keyword); $q->bindParam(':keyword', $keyword);
$q->bindParam(':search', $search);
$q->bindParam(':n', $n, PDO::PARAM_INT); $q->bindParam(':n', $n, PDO::PARAM_INT);
$q->bindParam(':m', $m, PDO::PARAM_INT); $q->bindParam(':m', $m, PDO::PARAM_INT);
$statuses = implode(',', $status); $statuses = implode(',', $status);
@@ -224,21 +228,23 @@ function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
return $q; return $q;
} }
function countSomeGroupsByStatus($keyword, $status) { function countSomeGroupsByStatus($search, $status) {
$q = prepareQuery(" $q = prepareQuery("
SELECT SELECT
COUNT(*) COUNT(*)
FROM FROM
`group_page` `group_page`
WHERE WHERE
`name` LIKE :keyword AND (`name` LIKE :keyword AND
FIND_IN_SET (`status`, :statuses) FIND_IN_SET (`status`, :statuses)) OR
`status` = :search
ORDER BY ORDER BY
`name` `name`
"); ");
$keyword = "%$keyword%"; $keyword = "%$search%";
$q->bindParam(':keyword', $keyword); $q->bindParam(':keyword', $keyword);
$q->bindParam(':search', $search);
$statuses = implode(',', $status); $statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses); $q->bindParam(':statuses', $statuses);
$q->execute(); $q->execute();

View File

@@ -243,3 +243,56 @@ function deleteNietSlecht(int $postID, int $userID) {
$stmt->execute(); $stmt->execute();
return $stmt->rowCount(); 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"];
}

View File

@@ -95,7 +95,7 @@ function getNewChatMessages($lastID, $destination) {
function selectAllUnreadChat() { function selectAllUnreadChat() {
$stmt = prepareQuery(" $stmt = prepareQuery("
SELECT SELECT
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`, LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 12) as `fullname`,
`user`.`userID`, `user`.`userID`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,

View File

@@ -18,7 +18,8 @@ function getSettings() {
`bio`, `bio`,
`profilepicture`, `profilepicture`,
`showBday`, `showBday`,
`showEmail` `showEmail`,
`showProfile`
FROM FROM
`user` `user`
WHERE WHERE
@@ -64,7 +65,8 @@ function updateSettings() {
`birthdate` = :bday, `birthdate` = :bday,
`bio` = :bio, `bio` = :bio,
`showEmail` = :showEmail, `showEmail` = :showEmail,
`showBday` = :showBday `showBday` = :showBday,
`showProfile` = :showProfile
WHERE WHERE
`userID` = :userID `userID` = :userID
"); ");
@@ -79,6 +81,7 @@ function updateSettings() {
$stmt->bindValue(":bio", test_input($_POST["bio"])); $stmt->bindValue(":bio", test_input($_POST["bio"]));
$stmt->bindValue(":showEmail", (array_key_exists("showEmail", $_POST) ? "1" : "0")); $stmt->bindValue(":showEmail", (array_key_exists("showEmail", $_POST) ? "1" : "0"));
$stmt->bindValue(":showBday", (array_key_exists("showBday", $_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->bindValue(":userID", $_SESSION["userID"]);
$stmt->execute(); $stmt->execute();

View File

@@ -52,6 +52,10 @@ function selectUser($me, $other) {
`username`, `username`,
`birthdate`, `birthdate`,
`location`, `location`,
`showBday`,
`showEmail`,
`showProfile`,
`email`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,
'../img/avatar-standard.png' '../img/avatar-standard.png'
@@ -209,7 +213,9 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
return $q; 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(" $q = prepareQuery("
SELECT SELECT
`userID`, `userID`,
@@ -223,8 +229,9 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
FROM FROM
`user` `user`
WHERE WHERE
`username` LIKE :keyword AND (`username` LIKE :keyword AND
FIND_IN_SET (`role`, :statuses) FIND_IN_SET (`role`, :statuses)) OR
`role` = :search
ORDER BY ORDER BY
`role`, `role`,
`username` `username`
@@ -232,8 +239,9 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
:n, :m :n, :m
"); ");
$keyword = "%$keyword%"; $keyword = "%$search%";
$q->bindParam(':keyword', $keyword); $q->bindParam(':keyword', $keyword);
$q->bindParam(':search', $search);
$q->bindParam(':n', $n, PDO::PARAM_INT); $q->bindParam(':n', $n, PDO::PARAM_INT);
$q->bindParam(':m', $m, PDO::PARAM_INT); $q->bindParam(':m', $m, PDO::PARAM_INT);
$statuses = implode(',', $status); $statuses = implode(',', $status);
@@ -242,22 +250,24 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
return $q; return $q;
} }
function countSomeUsersByStatus($keyword, $status) { function countSomeUsersByStatus($search, $status) {
$q = prepareQuery(" $q = prepareQuery("
SELECT SELECT
COUNT(*) COUNT(*)
FROM FROM
`user` `user`
WHERE WHERE
`username` LIKE :keyword AND (`username` LIKE :keyword AND
FIND_IN_SET (`role`, :statuses) FIND_IN_SET (`role`, :statuses)) OR
`role` = :search
ORDER BY ORDER BY
`role`, `role`,
`username` `username`
"); ");
$keyword = "%$keyword%"; $keyword = "%$search%";
$q->bindParam(':keyword', $keyword); $q->bindParam(':keyword', $keyword);
$q->bindParam(':search', $search);
$statuses = implode(',', $status); $statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses); $q->bindParam(':statuses', $statuses);
$q->execute(); $q->execute();
@@ -349,12 +359,13 @@ function searchSomeUsers($n, $m, $search) {
$stmt = prepareQuery(" $stmt = prepareQuery("
SELECT SELECT
`userID`, `userID`,
LEFT(`username`, 12) as `usernameshort`,
`username`, `username`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,
'../img/avatar-standard.png' '../img/avatar-standard.png'
) AS profilepicture, ) AS profilepicture,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`, LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 12) as `fullname`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE) CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online' WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline' WHEN FALSE THEN 'offline'

View File

@@ -1,12 +1,17 @@
<div class="content"> <div class="content">
<div class="profile-box platform"> <div class="user-box">
<img class="left main-picture group-picture" src="<?= $group['picture'] ?>"> <img class="group-picture main-picture" src="<?= $group["picture"] ?>"><br />
<div class="group-button-container"></div> <div class="platform">
<h1 class="profile-username"><?= $group['name'] ?></h1> <div class="status-buttons-container">
<p><?= $group['description'] ?></p> <button disabled class="gray"><?= $group["status"] ?></button>
</div>
<div class="group-button-container"></div>
<div class="profile-info">
<h2><?= $group["name"]?></h2>
<?= $group["description"] ?>
</div>
</div>
</div> </div>
<div class="item-box-full-width platform"> <div class="item-box-full-width platform">
<h2>Leden (<?= $group['members'] ?>)</h2> <h2>Leden (<?= $group['members'] ?>)</h2>
<p> <p>

View File

@@ -1,4 +1,8 @@
<meta charset="utf-8"> <meta charset="UTF-8">
<meta name="description" content="MyHyvesbook+ is het sociaal media voor alle coole mensen.">
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
<meta name="author" content="MyHyvesbookplus corporation">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MyHyvesbook+</title> <title>MyHyvesbook+</title>
<!-- Add your javascript files here. --> <!-- Add your javascript files here. -->
<script src="js/jquery.js"></script> <script src="js/jquery.js"></script>

View File

@@ -14,7 +14,7 @@
echo "<style>@import url('styles/adminbutton.css'); </style>"; echo "<style>@import url('styles/adminbutton.css'); </style>";
} }
?> ?>
<a href="logout.php" data-title="Admin"><i class="fa fa-sign-out"></i></a> <a href="logout.php" data-title="Uitloggen"><i class="fa fa-sign-out"></i></a>
</section> </section>
<section id="friend-request-section"> <section id="friend-request-section">
<h4> <h4>

View File

@@ -2,11 +2,17 @@
$postID = $_GET['postID']; $postID = $_GET['postID'];
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC); $post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")"; $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
session_start();
?> ?>
<div class='post-header header'> <div class='post-header header'>
<h4><?=$post['title']?></h4> <h4><?=$post['title']?></h4>
<form method="post" onclick=""><span class="delete-post">verwijder post</span><br /></form> <?php if (checkPermissionOnPost($postID, $_SESSION["userID"])) {?>
<button class="deleteButton"
onclick="deletePost('<?=$postID?>')"
type="submit">
<i class="fa fa-trash"></i>
<span>Verwijder post</span>
</button><br />
<?php } ?>
<span class='postinfo'> <span class='postinfo'>
gepost door <?=$fullname?>, gepost door <?=$fullname?>,
<span class='posttime' title='<?=$post['creationdate']?>'> <span class='posttime' title='<?=$post['creationdate']?>'>
@@ -24,7 +30,7 @@ session_start();
<form id="newcommentform" onsubmit="return false;"> <form id="newcommentform" onsubmit="return false;">
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>"> <input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..." maxlength="1000"></textarea><span></span> <br> <textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..." maxlength="1000"></textarea><span></span> <br>
<button onclick="postComment('reaction')" name="button" value="reaction">Reageer!</button> <button onclick="postComment('reaction')" name="button" value="reaction" class="green"><i class="fa fa-comment"></i> Reageer!</button>
<button onclick="postComment('nietslecht')" name="button" value="nietslecht" class="nietslecht"> <button onclick="postComment('nietslecht')" name="button" value="nietslecht" class="nietslecht">
<?php <?php
if (checkNietSlecht($postID, $_SESSION["userID"])) { if (checkNietSlecht($postID, $_SESSION["userID"])) {

View File

@@ -31,7 +31,12 @@
<h3>Informatie</h3> <h3>Informatie</h3>
<p> <p>
<ul> <ul>
<?php if ($user["showBday"]) { ?>
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li> <li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
<?php } ?>
<?php if ($user["showEmail"]) { ?>
<li>Email: <?= $user["email"] ?></li>
<?php } ?>
<li>Locatie: <?= $user["location"] ?></li> <li>Locatie: <?= $user["location"] ?></li>
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li> <li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
</ul> </ul>

View File

@@ -48,7 +48,12 @@ $group_n = ($group_currentpage - 1) * $group_perpage;
<label for="filter"> <label for="filter">
Filter: Filter:
</label> </label>
<select name="filter" id="search-filter"> <select name="filter"
id="search-filter"
onchange="$('#user-pagenumber, #group-pagenumber').prop('value', 1);
searchUsers();
searchGroups();
pageNumber();">
<option value="personal" <option value="personal"
<?php if ($filter == "personal") echo "selected";?>> <?php if ($filter == "personal") echo "selected";?>>
Persoonlijk</option> Persoonlijk</option>

View File

@@ -17,6 +17,7 @@ $settings = getSettings();
<input type="text" <input type="text"
name="fname" name="fname"
id="fname" id="fname"
maxlength="63"
placeholder="Voornaam" placeholder="Voornaam"
title="Voornaam" title="Voornaam"
value="<?=$settings["fname"]?>" value="<?=$settings["fname"]?>"
@@ -27,6 +28,7 @@ $settings = getSettings();
<input type="text" <input type="text"
name="lname" name="lname"
id="lname" id="lname"
maxlength="63"
placeholder="Achternaam" placeholder="Achternaam"
value="<?=$settings["lname"]?>" value="<?=$settings["lname"]?>"
> >
@@ -36,6 +38,7 @@ $settings = getSettings();
<input type="text" <input type="text"
name="location" name="location"
id="location" id="location"
maxlength="50"
placeholder="Locatie" placeholder="Locatie"
value="<?=$settings["location"]?>" value="<?=$settings["location"]?>"
> >
@@ -96,6 +99,14 @@ $settings = getSettings();
<?=($settings["showEmail"] ? "checked" : "")?> <?=($settings["showEmail"] ? "checked" : "")?>
> >
</li> </li>
<li>
<label for="showProfile">Publiek profiel</label>
<input type="checkbox"
name="showProfile"
id="showProfile"
<?=($settings["showProfile"] ? "checked" : "")?>
>
</li>
<li> <li>
<label for="bio">Bio</label> <label for="bio">Bio</label>
<textarea name="bio" <textarea name="bio"
@@ -186,6 +197,7 @@ $settings = getSettings();
<label for="email-old">Huidig Email </label> <label for="email-old">Huidig Email </label>
<input type="email" <input type="email"
id="email-old" id="email-old"
maxlength="255"
value="<?=$settings["email"]?>" value="<?=$settings["email"]?>"
disabled disabled
> >
@@ -194,6 +206,7 @@ $settings = getSettings();
<label for="email">Nieuw Email</label> <label for="email">Nieuw Email</label>
<input type="email" <input type="email"
name="email" name="email"
maxlength="255"
id="email" id="email"
placeholder="Nieuw Email" placeholder="Nieuw Email"
> >
@@ -203,14 +216,16 @@ $settings = getSettings();
<input type="email" <input type="email"
name="email-confirm" name="email-confirm"
id="email-confirm" id="email-confirm"
maxlength="255"
placeholder="Bevestig Email" placeholder="Bevestig Email"
> >
</li> </li>
<li> <li>
<button type="submit" <button type="submit"
name="form" name="form"
value="email" value="email">
>Verander Email</button> Verander Email
</button>
</li> </li>
</ul> </ul>
</form> </form>