Merge branch 'master' into marijn-nietslecht
This commit is contained in:
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
require("../../queries/friendship.php");
|
|
||||||
require("../../queries/user.php");
|
|
||||||
|
|
||||||
if(empty($_POST["userID"]) OR empty($_POST["delete"]) AND empty($_POST["accept"]) AND empty($_POST["request"])) {
|
|
||||||
echo "Not enough arguments.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$friendship_status = getFriendshipStatus($_POST["userID"]);
|
|
||||||
echo "\nfriendshipstatus: $friendship_status";
|
|
||||||
echo "You: " . $_SESSION["userID"];
|
|
||||||
echo "other user: " . $_POST["userID"];
|
|
||||||
|
|
||||||
|
|
||||||
if(!empty($_POST["request"]) AND $friendship_status == 0) {
|
|
||||||
echo "request";
|
|
||||||
requestFriendship($_POST["userID"]);
|
|
||||||
} else if(!empty($_POST["delete"]) AND in_array($friendship_status, array(1, 2, 3))) {
|
|
||||||
echo "delete";
|
|
||||||
removeFriendship($_POST["userID"]);
|
|
||||||
} else if (!empty($_POST["accept"]) AND $friendship_status == 3) {
|
|
||||||
echo "accept";
|
|
||||||
acceptFriendship($_POST["userID"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$username = getUsername($_POST["userID"]);
|
|
||||||
|
|
||||||
header("Location: ../profile.php?username=$username");
|
|
||||||
24
website/public/API/getPosts.php
Normal file
24
website/public/API/getPosts.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if(empty($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
require_once ("../../queries/nicetime.php");
|
||||||
|
|
||||||
|
$posts = selectAllUserPosts($_POST["usr"]);
|
||||||
|
|
||||||
|
if(!$posts) {
|
||||||
|
header('HTTP/1.1 500 Query failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = $posts->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);
|
||||||
18
website/public/API/postComment.php
Normal file
18
website/public/API/postComment.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require("../../queries/post.php");
|
||||||
|
require("../../queries/connect.php");
|
||||||
|
require("../../queries/checkInput.php");
|
||||||
|
if (empty($_POST['newcomment-content'])) {
|
||||||
|
echo 0;
|
||||||
|
} else {
|
||||||
|
if(makeComment($_POST['postID'],
|
||||||
|
$_SESSION['userID'],
|
||||||
|
test_input($_POST['newcomment-content']))) {
|
||||||
|
echo 1;
|
||||||
|
} else {
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
17
website/public/API/postPost.php
Normal file
17
website/public/API/postPost.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require("../../queries/post.php");
|
||||||
|
require("../../queries/connect.php");
|
||||||
|
require("../../queries/checkInput.php");
|
||||||
|
|
||||||
|
if (empty($_POST['newpost-title'])) {
|
||||||
|
} else {
|
||||||
|
makePost($_SESSION['userID'],
|
||||||
|
null,
|
||||||
|
test_input($_POST['newpost-title']),
|
||||||
|
test_input($_POST['newpost-content']));
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: ../profile.php");
|
||||||
28
website/public/API/searchGroups.php
Normal file
28
website/public/API/searchGroups.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/group_member.php");
|
||||||
|
require_once ("../../queries/group_page.php");
|
||||||
|
|
||||||
|
$n = 0;
|
||||||
|
if (isset($_POST["n"])) {
|
||||||
|
$n = (int) test_input($_POST["n"]);
|
||||||
|
}
|
||||||
|
$m = 20;
|
||||||
|
if (isset($_POST["m"])) {
|
||||||
|
$m = (int) test_input($_POST["m"]);
|
||||||
|
}
|
||||||
|
$search = "";
|
||||||
|
if (isset($_POST["search"])) {
|
||||||
|
$search = test_input($_POST["search"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST["filter"]) && $_POST["filter"] == "personal") {
|
||||||
|
echo searchSomeOwnGroups($n, $m, $search);
|
||||||
|
} else {
|
||||||
|
echo searchSomeGroups($n, $m, $search);
|
||||||
|
}
|
||||||
27
website/public/API/searchUsers.php
Normal file
27
website/public/API/searchUsers.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
|
||||||
|
$n = 0;
|
||||||
|
if (isset($_POST["n"])) {
|
||||||
|
$n = (int) test_input($_POST["n"]);
|
||||||
|
}
|
||||||
|
$m = 20;
|
||||||
|
if (isset($_POST["m"])) {
|
||||||
|
$m = (int) test_input($_POST["m"]);
|
||||||
|
}
|
||||||
|
$search = "";
|
||||||
|
if (isset($_POST["search"])) {
|
||||||
|
$search = test_input($_POST["search"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST["filter"]) && $_POST["filter"] == "personal") {
|
||||||
|
echo searchSomeFriends($n, $m, $search);
|
||||||
|
} else {
|
||||||
|
echo searchSomeUsers($n, $m, $search);
|
||||||
|
}
|
||||||
@@ -4,12 +4,6 @@ session_start();
|
|||||||
|
|
||||||
include_once ("../../queries/friendship.php");
|
include_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
if (isset($_POST["limit"])) {
|
|
||||||
$limit = $_POST["limit"];
|
|
||||||
} else {
|
|
||||||
$limit = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["action"])) {
|
if (isset($_POST["action"])) {
|
||||||
$action = $_POST["action"];
|
$action = $_POST["action"];
|
||||||
} else {
|
} else {
|
||||||
@@ -26,11 +20,6 @@ $friends = json_decode($_POST["friends"]);
|
|||||||
|
|
||||||
foreach($friends as $i => $friend) {
|
foreach($friends as $i => $friend) {
|
||||||
$friendshipStatus = getFriendshipStatus($friend->userID);
|
$friendshipStatus = getFriendshipStatus($friend->userID);
|
||||||
|
|
||||||
if ($limit != 0 && $i >= $limit)
|
|
||||||
$extra = "extra-friend-item";
|
|
||||||
else
|
|
||||||
$extra = "";
|
|
||||||
?>
|
?>
|
||||||
<li class='friend-item <?= $extra ?>'>
|
<li class='friend-item <?= $extra ?>'>
|
||||||
<form action='<?= $action ?>' method='<?= $actionType ?>'>
|
<form action='<?= $action ?>' method='<?= $actionType ?>'>
|
||||||
@@ -60,15 +49,13 @@ foreach($friends as $i => $friend) {
|
|||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
if ($friendshipStatus > 1) {
|
if ($friendshipStatus > 1) {
|
||||||
|
if ($friendshipStatus == 2) {
|
||||||
|
$denyName = "Annuleer";
|
||||||
|
} else {
|
||||||
|
$denyName = "Weiger";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class='notification-options'>
|
<div class='notification-options'>
|
||||||
<input type='hidden' name='userID' value='' />
|
|
||||||
<button name='delete'
|
|
||||||
onclick="editFriendship('<?= $friend->userID ?>', 'delete')"
|
|
||||||
class='deny-notification'
|
|
||||||
value='1'>
|
|
||||||
<i class='fa fa-times'></i>
|
|
||||||
</button>
|
|
||||||
<?php
|
<?php
|
||||||
if ($friendshipStatus == 3) {
|
if ($friendshipStatus == 3) {
|
||||||
?>
|
?>
|
||||||
@@ -76,11 +63,19 @@ foreach($friends as $i => $friend) {
|
|||||||
onclick="editFriendship('<?= $friend->userID ?>', 'accept')"
|
onclick="editFriendship('<?= $friend->userID ?>', 'accept')"
|
||||||
class='accept-notification'
|
class='accept-notification'
|
||||||
value='1'>
|
value='1'>
|
||||||
<i class='fa fa-check'></i>
|
<i class='fa fa-check'></i>Accepteer
|
||||||
</button>
|
</button>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<input type='hidden' name='userID' value='' />
|
||||||
|
<button name='delete'
|
||||||
|
onclick="editFriendship('<?= $friend->userID ?>', 'delete')"
|
||||||
|
class='deny-notification'
|
||||||
|
value='1'>
|
||||||
|
<i class='fa fa-times'></i> <?= $denyName ?>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -89,13 +84,6 @@ foreach($friends as $i => $friend) {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizeof($friends) > $limit) {
|
|
||||||
?>
|
|
||||||
<li class='more-item'>
|
|
||||||
Meer vrienden...
|
|
||||||
</li>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -22,17 +22,3 @@ foreach($groups as $i => $group) {
|
|||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<li>
|
|
||||||
<form action="search.php" method="get">
|
|
||||||
<input type="hidden"
|
|
||||||
name="search"
|
|
||||||
value="" />
|
|
||||||
<input type="hidden"
|
|
||||||
name="filter"
|
|
||||||
value="groups" />
|
|
||||||
<button type="submit">
|
|
||||||
Alle groepen...
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#own-profile-picture").click(function() {
|
|
||||||
if($("#notification-center").css('right') == "-256px") {
|
// Toggle menu
|
||||||
$(".content").animate({
|
$("#own-profile-picture, #open-notifications").click(function() {
|
||||||
marginRight: "256px"
|
if ($("#notification-center").css('right') == "-256px") {
|
||||||
}, 500);
|
// Make the menu visible and move the content to the left.
|
||||||
$(".chat-right").animate({
|
$("#chat-history").width("calc(100% - 587px)");
|
||||||
width: $(".chat-right").width() - 266
|
$(".modal").width("calc(100% - 512px)");
|
||||||
}, 500);
|
$(".content").css("margin-right", "256px");
|
||||||
$("#notification-center").animate({
|
$("#notification-center").css("right", "0px");
|
||||||
right: "0px"
|
|
||||||
}, 500);
|
|
||||||
} else {
|
} else {
|
||||||
$(".chat-right").animate({
|
// Make the menu invisible and move the content to the right.
|
||||||
width: $(".chat-right").width() + 266
|
$("#chat-history").width("calc(100% - 331px)");
|
||||||
}, 500);
|
$(".modal").width("calc(100% - 256px)");
|
||||||
$(".content").animate({
|
$(".content").css("margin-right", "0px");
|
||||||
marginRight: "0px"
|
$("#notification-center").css("right", "-256px");
|
||||||
}, 500);
|
|
||||||
$("#notification-center").animate({
|
|
||||||
right: "-256px"
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ function scrollbarMargin(width, overflow) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestPost(post) {
|
function requestPost(postID) {
|
||||||
$(".modal").show();
|
$(".modal").show();
|
||||||
$.get(
|
|
||||||
"API/loadPost.php",
|
$.get("API/loadPost.php", { postID : postID }).done(function(data) {
|
||||||
$(post).children("form").serialize()
|
|
||||||
).done(function (data) {
|
|
||||||
$('.modal-default').hide();
|
$('.modal-default').hide();
|
||||||
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
||||||
scrollbarMargin(scrollBarWidth, 'hidden');
|
scrollbarMargin(scrollBarWidth, 'hidden');
|
||||||
@@ -26,37 +24,55 @@ function requestPost(post) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
console.log("LOADED");
|
$(".modal-close").click(function () {
|
||||||
container = $("div.posts");
|
$(".modal").hide();
|
||||||
posts = container.children();
|
scrollbarMargin(0, 'auto');
|
||||||
posts.remove();
|
$('#modal-response').hide();
|
||||||
|
$('.modal-default').show();
|
||||||
column = $('<div class="column"></div>').append(posts);
|
});
|
||||||
container.append(column);
|
|
||||||
|
|
||||||
mansonry();
|
|
||||||
mansonry();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var masonryMode = 0;
|
||||||
|
|
||||||
$(window).resize(function() {
|
$(window).resize(function() {
|
||||||
clearTimeout(window.resizedFinished);
|
clearTimeout(window.resizedFinished);
|
||||||
window.resizeFinished = setTimeout(function() {
|
window.resizeFinished = setTimeout(function() {
|
||||||
mansonry();
|
masonry(masonryMode);
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
});
|
||||||
|
|
||||||
function mansonry() {
|
var $container = $(".posts");
|
||||||
|
|
||||||
|
function masonry(mode) {
|
||||||
|
masonryMode = mode;
|
||||||
|
$container.children().remove();
|
||||||
columnCount = Math.floor($(".posts").width() / 250);
|
columnCount = Math.floor($(".posts").width() / 250);
|
||||||
console.log("columns: " + columnCount);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialise columns.
|
* Initialise columns.
|
||||||
*/
|
*/
|
||||||
var columns = new Array(columnCount);
|
var columns = new Array(columnCount);
|
||||||
|
var $columns = new Array(columnCount);
|
||||||
for (i = 0; i < columnCount; i++) {
|
for (i = 0; i < columnCount; i++) {
|
||||||
columns[i] = [0, []];
|
$column = $("<div class=\"column\">");
|
||||||
console.log(columns[i]);
|
$column.width(100/columnCount + "%");
|
||||||
|
$container.append($column);
|
||||||
|
columns[i] = [0, $column];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode == 1) {
|
||||||
|
$postInput = $("<div class=\"post platform\">");
|
||||||
|
$form = $("<form action=\"API/postPost.php\" method=\"post\">");
|
||||||
|
$postInput.append($form);
|
||||||
|
|
||||||
|
$form.append($("<input class=\"newpost\" name=\"newpost-title\" placeholder=\"Titel\" type=\"text\">"));
|
||||||
|
$form.append($("<textarea class=\"newpost\" name=\"newpost-content\" placeholder=\"Schrijf een berichtje...\">"));
|
||||||
|
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
||||||
|
columns[0][1].append($postInput);
|
||||||
|
|
||||||
|
$postInput.on("load", function() {
|
||||||
|
columns[0][0] = $postInput.height() + margin;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -70,38 +86,29 @@ function mansonry() {
|
|||||||
column = columns[i];
|
column = columns[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return column;
|
return column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rearange the objects.
|
* Get the posts from the server.
|
||||||
*/
|
*/
|
||||||
j = 0;
|
$.post("API/getPosts.php", { usr : userID })
|
||||||
posts.each(function(i) {
|
.done(function(data) {
|
||||||
post = posts[i];
|
posts = JSON.parse(data);
|
||||||
shortestColumn = getShortestColumn(columns);
|
|
||||||
shortestColumn[0] = shortestColumn[0] + $(post).height() + margin;
|
|
||||||
shortestColumn[1].push(post);
|
|
||||||
|
|
||||||
});
|
/*
|
||||||
|
* Rearange the objects.
|
||||||
container.children().remove();
|
*/
|
||||||
/*
|
jQuery.each(posts, function() {
|
||||||
* Display the objects again in the correct order.
|
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
|
||||||
*/
|
$post.append($("<h2>").text(this["title"]));
|
||||||
for (i = 0; i < columnCount; i++) {
|
$post.append($("<p>").html(this["content"]));
|
||||||
column = $('<div class="column"></div>').append(columns[i][1]);
|
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
|
||||||
console.log(column);
|
|
||||||
container.append(column);
|
|
||||||
}
|
|
||||||
|
|
||||||
$("div.posts div.column").width(100/columnCount + "%");
|
shortestColumn = getShortestColumn(columns);
|
||||||
|
shortestColumn[1].append($post);
|
||||||
|
shortestColumn[0] = shortestColumn[0] + $post.height() + margin;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(".modal-close").click(function () {
|
|
||||||
$(".modal").hide();
|
|
||||||
scrollbarMargin(0, 'auto');
|
|
||||||
$('#modal-response').hide();
|
|
||||||
$('.modal-default').show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,49 +1,28 @@
|
|||||||
|
var menuFriendsData;
|
||||||
|
var menuGroupsData;
|
||||||
|
var notificationMessagesData;
|
||||||
|
var notificationRequestsData;
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Show more friends/users
|
|
||||||
|
|
||||||
// Show more friends
|
|
||||||
// $("#more-friends-click").click(function() {
|
|
||||||
// // Show only friends
|
|
||||||
// $("#groups-menu-section").slideUp();
|
|
||||||
// $("#friends-menu-section li").show();
|
|
||||||
//
|
|
||||||
// // Change buttons
|
|
||||||
// $("#more-friends-click").hide();
|
|
||||||
// $("#menu-back").show();
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // Show more groups
|
|
||||||
// $("#more-groups-click").click(function() {
|
|
||||||
// // Show only groups
|
|
||||||
// $("#friends-menu-section").slideUp();
|
|
||||||
// $("#groups-menu-section li").show();
|
|
||||||
//
|
|
||||||
// // Change buttons
|
|
||||||
// $("#more-groups-click").hide();
|
|
||||||
// $("#menu-back").show();
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // Go back
|
|
||||||
// $("#menu-back").click(function() {
|
|
||||||
// // Show overview of friends and groups
|
|
||||||
// $("#friends-menu-section").slideDown();
|
|
||||||
// $("#groups-menu-section").slideDown();
|
|
||||||
// $(".extra-menu-items").hide();
|
|
||||||
//
|
|
||||||
// // Change buttons
|
|
||||||
// $("#menu-back").hide();
|
|
||||||
// $("#more-groups-click").show();
|
|
||||||
// $("#more-friends-click").show();
|
|
||||||
// });
|
|
||||||
|
|
||||||
loadMenuFriends(5);
|
loadMenuFriends(5);
|
||||||
loadNotificationFriends();
|
loadNotificationFriends();
|
||||||
loadUnreadMessages();
|
loadUnreadMessages();
|
||||||
loadMenuGroups();
|
loadMenuGroups();
|
||||||
|
setInterval(updateMenus, 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Update the menu and notification items.
|
||||||
|
function updateMenus() {
|
||||||
|
loadMenuFriends(5);
|
||||||
|
loadNotificationFriends();
|
||||||
|
loadUnreadMessages();
|
||||||
|
loadMenuGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get, every 3 seconds, the friends and insert them in the menu.
|
||||||
function loadMenuFriends(limit) {
|
function loadMenuFriends(limit) {
|
||||||
$.post(
|
$.post(
|
||||||
"API/loadFriends.php",
|
"API/loadFriends.php",
|
||||||
@@ -51,16 +30,18 @@ function loadMenuFriends(limit) {
|
|||||||
limit: 5
|
limit: 5
|
||||||
}
|
}
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
|
if (menuFriendsData != data) {
|
||||||
$("#friends-menu-section").show();
|
menuFriendsData = data;
|
||||||
} else {
|
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
|
||||||
$("#friends-menu-section").hide();
|
$("#friends-menu-section").show();
|
||||||
|
} else {
|
||||||
|
$("#friends-menu-section").hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(loadMenuFriends, 3000, limit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get, every 3 seconds, the groups and insert them in the menu.
|
||||||
function loadMenuGroups() {
|
function loadMenuGroups() {
|
||||||
$.post(
|
$.post(
|
||||||
"API/loadGroups.php",
|
"API/loadGroups.php",
|
||||||
@@ -68,41 +49,45 @@ function loadMenuGroups() {
|
|||||||
limit: 5
|
limit: 5
|
||||||
}
|
}
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
if (showGroups(data, "#menu-groups-list")) {
|
if (menuGroupsData != data) {
|
||||||
$("#groups-menu-section").show();
|
menuGroupsData = data;
|
||||||
} else {
|
if (showGroups(data, "#menu-groups-list")) {
|
||||||
$("#groups-menu-section").hide();
|
$("#groups-menu-section").show();
|
||||||
|
} else {
|
||||||
|
$("#groups-menu-section").hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(loadMenuGroups, 3000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get, every 3 seconds, the friends requests and insert them in the notification center.
|
||||||
function loadNotificationFriends() {
|
function loadNotificationFriends() {
|
||||||
$.post(
|
$.post(
|
||||||
"API/loadFriendRequest.php"
|
"API/loadFriendRequest.php"
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
|
if (notificationRequestsData != data) {
|
||||||
$("#friend-request-section").show();
|
notificationRequestsData = data;
|
||||||
} else {
|
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
|
||||||
$("#friend-request-section").hide();
|
$("#friend-request-section").show();
|
||||||
|
} else {
|
||||||
|
$("#friend-request-section").hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(loadNotificationFriends, 3000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get, every 3 seconds, the unread messages and insert them in the notification center.
|
||||||
function loadUnreadMessages() {
|
function loadUnreadMessages() {
|
||||||
$.post(
|
$.post(
|
||||||
"API/loadChatNotifications.php"
|
"API/loadChatNotifications.php"
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
|
if (notificationMessagesData != data) {
|
||||||
console.log(data);
|
notificationMessagesData = data;
|
||||||
$("#unread-messages-section").show();
|
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
|
||||||
} else {
|
$("#unread-messages-section").show();
|
||||||
$("#unread-messages-section").hide();
|
} else {
|
||||||
|
$("#unread-messages-section").hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(loadUnreadMessages, 3000);
|
|
||||||
}
|
}
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// function showChatNotifications(notifications) {
|
|
||||||
// $("#unreadChatlist").html("");
|
|
||||||
// for (i in notifications) {
|
|
||||||
// $("#unreadChatlist").append(" \
|
|
||||||
// <li class='friend-item'> \
|
|
||||||
// <form action='chat.php' method='get'> \
|
|
||||||
// <button type='submit' \
|
|
||||||
// name='chatID' \
|
|
||||||
// value='"+ notifications[i].userID +"'> \
|
|
||||||
// <div class='friend'> \
|
|
||||||
// <img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
|
||||||
// <div class='friend-name'> \
|
|
||||||
// "+ notifications[i].name +"<br/> \
|
|
||||||
// <span style='color: #666'>"+ notifications[i].content +"</span> \
|
|
||||||
// </div> \
|
|
||||||
// </div> \
|
|
||||||
// </button> \
|
|
||||||
// </form> \
|
|
||||||
// </li> \
|
|
||||||
// ");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// function loadNotifications() {
|
|
||||||
// $.post(
|
|
||||||
// "API/loadChatNotifications.php"
|
|
||||||
// ).done(function(data) {
|
|
||||||
// if (data && data != "[]") {
|
|
||||||
// $("#unread-messages-section").show();
|
|
||||||
// showChatNotifications(JSON.parse(data));
|
|
||||||
// } else {
|
|
||||||
// $("#unread-messages-section").hide();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// setTimeout(loadNotifications, 10000);
|
|
||||||
// }
|
|
||||||
// $(document).ready(function() {
|
|
||||||
// loadNotifications();
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
18
website/public/js/post.js
Normal file
18
website/public/js/post.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
function postComment() {
|
||||||
|
$.post(
|
||||||
|
"API/postComment.php",
|
||||||
|
$("#newcommentform").serialize()
|
||||||
|
);
|
||||||
|
|
||||||
|
$("#newcomment").val("");
|
||||||
|
|
||||||
|
//reload post
|
||||||
|
$.get(
|
||||||
|
"API/loadPost.php",
|
||||||
|
$("#newcommentform").serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
$('#modal-response').html(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
function loadPost(postID) {
|
|
||||||
$.get(
|
|
||||||
"API/loadPost.php",
|
|
||||||
$(postID).serialize()
|
|
||||||
).done(function (data) {
|
|
||||||
$('#modal-response').innerHTML= JSON.parse(data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
33
website/public/js/search.js
Normal file
33
website/public/js/search.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
function searchUsers(n, m) {
|
||||||
|
$.post(
|
||||||
|
"API/searchUsers.php",
|
||||||
|
{
|
||||||
|
n: n,
|
||||||
|
m: m,
|
||||||
|
search: $("#search-input").val(),
|
||||||
|
filter: $("#search-filter").val()
|
||||||
|
}
|
||||||
|
).done(function(data) {
|
||||||
|
console.log(data);
|
||||||
|
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
|
||||||
|
$("#search-users-list").text("Niemand gevonden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchGroups(n, m) {
|
||||||
|
$.post(
|
||||||
|
"API/searchGroups.php",
|
||||||
|
{
|
||||||
|
n: n,
|
||||||
|
m: m,
|
||||||
|
search: $("#search-input").val(),
|
||||||
|
filter: $("#search-filter").val()
|
||||||
|
}
|
||||||
|
).done(function(data) {
|
||||||
|
console.log(data);
|
||||||
|
if (!showGroups(data, "#search-groups-list")) {
|
||||||
|
$("#search-groups-list").text("Geen groepen gevonden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<?php include("../views/head.php"); ?>
|
<?php include("../views/head.php"); ?>
|
||||||
|
|
||||||
<script src="js/masonry.js"></script>
|
<script src="js/masonry.js"></script>
|
||||||
<!-- <script src="js/profile.js"></script>-->
|
<script src="js/post.js"></script>
|
||||||
<style>
|
<style>
|
||||||
@import url("styles/profile.css");
|
@import url("styles/profile.css");
|
||||||
@import url("styles/post-popup.css");
|
@import url("styles/post-popup.css");
|
||||||
@@ -30,8 +31,10 @@ $posts = selectAllUserPosts($userID);
|
|||||||
|
|
||||||
if ($userID == $_SESSION["userID"]) {
|
if ($userID == $_SESSION["userID"]) {
|
||||||
$friendship_status = -1;
|
$friendship_status = -1;
|
||||||
|
$masonry_mode = 1;
|
||||||
} else {
|
} else {
|
||||||
$friendship_status = $user["friend_status"];
|
$friendship_status = $user["friend_status"];
|
||||||
|
$masonry_mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -48,10 +51,25 @@ include("../views/footer.php");
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<script src="js/friendButtons.js"></script>
|
<script src="js/friendButtons.js"></script>
|
||||||
|
<script src="js/masonry.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
var posts;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
userID = <?= $userID ?>;
|
userID = <?= $userID ?>;
|
||||||
placeFriendButtons();
|
placeFriendButtons();
|
||||||
|
|
||||||
|
masonry(<?= $masonry_mode ?>);
|
||||||
|
// alert("blap");
|
||||||
|
// $.post("API/getPosts.php", { usr : userID }, "json")
|
||||||
|
// .done(function(data) {
|
||||||
|
// posts = JSON.parse(data);
|
||||||
|
// alert(posts[0]["content"]);
|
||||||
|
// }).fail(function() {
|
||||||
|
// alert("failure...");
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<style>
|
<style>
|
||||||
@import url("styles/search.css");
|
@import url("styles/search.css");
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script src="js/search.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ header div {
|
|||||||
width: 64px;
|
width: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#own-profile-picture {
|
#own-profile-picture, #open-notifications {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#open-notifications {
|
||||||
|
padding: 5px 20px 5px 0px;
|
||||||
|
}
|
||||||
@@ -252,16 +252,20 @@ div[data-title]:hover:after {
|
|||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.friend {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.friend-item, .group-item {
|
.friend-item, .group-item {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition-duration: 250ms;
|
transition-duration: 250ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.friend-item button, .group-item button {
|
||||||
|
background: none;
|
||||||
|
color: inherit;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
.friend-item:hover, .group-item:hover {
|
.friend-item:hover, .group-item:hover {
|
||||||
background: #FBC02D;
|
background: #FBC02D;
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
|
|||||||
@@ -34,15 +34,6 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu button {
|
|
||||||
background: none;
|
|
||||||
color: inherit;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 0;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#notification-center {
|
#notification-center {
|
||||||
left: auto;
|
left: auto;
|
||||||
width: 236px;
|
width: 236px;
|
||||||
@@ -66,13 +57,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.notification-options {
|
.notification-options {
|
||||||
|
width: 100%;
|
||||||
display: none;
|
display: none;
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.notification-options form {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.notification-options button {
|
.notification-options button {
|
||||||
@@ -91,4 +77,13 @@
|
|||||||
|
|
||||||
.friend-item:hover .notification-options {
|
.friend-item:hover .notification-options {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu button {
|
||||||
|
background: none;
|
||||||
|
color: inherit;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ function selectAllFriendRequests() {
|
|||||||
`friendship`.`user2ID` = `user`.`userID` OR
|
`friendship`.`user2ID` = `user`.`userID` OR
|
||||||
`friendship`.`user2ID` = :userID AND
|
`friendship`.`user2ID` = :userID AND
|
||||||
`friendship`.`user1ID` = `user`.`userID`) AND
|
`friendship`.`user1ID` = `user`.`userID`) AND
|
||||||
`user`.`role` != 5 AND
|
`user`.`role` != 'banned' AND
|
||||||
`friendship`.`status` = 'requested'
|
`friendship`.`status` = 'requested'
|
||||||
");
|
");
|
||||||
|
|
||||||
@@ -217,4 +217,47 @@ function setLastVisited($friend) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return $stmt;
|
return $stmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchSomeFriends($n, $m, $search) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`userID`,
|
||||||
|
`username`,
|
||||||
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||||
|
IFNULL(
|
||||||
|
`profilepicture`,
|
||||||
|
'../img/avatar-standard.png'
|
||||||
|
) AS profilepicture,
|
||||||
|
`onlinestatus`,
|
||||||
|
`role`
|
||||||
|
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`
|
||||||
|
LIMIT
|
||||||
|
:n, :m
|
||||||
|
");
|
||||||
|
|
||||||
|
$search = "%$search%";
|
||||||
|
$stmt->bindParam(':keyword', $search);
|
||||||
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
@@ -27,3 +27,30 @@ function selectLimitedGroupsFromUser($userID, $limit) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function searchSomeOwnGroups($n, $m, $search) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`group_page`.`name`,
|
||||||
|
`group_page`.`picture`
|
||||||
|
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
|
||||||
|
LIMIT
|
||||||
|
:n, :m
|
||||||
|
");
|
||||||
|
|
||||||
|
$search = "%$search%";
|
||||||
|
$stmt->bindParam(':keyword', $search);
|
||||||
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
return json_encode($stmt->fetchAll());
|
||||||
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ function searchSomeGroups($n, $m, $search) {
|
|||||||
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt;
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
function countSomeGroups($search) {
|
function countSomeGroups($search) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function makePost($userID, $groupID, $title, $content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeComment($postID, $userID, $content) {
|
function makeComment($postID, $userID, $content) {
|
||||||
$stmt = $_GLOBAL["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`comment` (
|
`comment` (
|
||||||
`postID`,
|
`postID`,
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function selectAllUnreadChat() {
|
|||||||
`user`.`userID`,
|
`user`.`userID`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/notbad.jpg'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
LEFT(`private_message`.`content`, 15) as `content`
|
LEFT(`private_message`.`content`, 15) as `content`
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
@@ -126,7 +126,9 @@ function selectAllUserPosts($userID) {
|
|||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
if(!$stmt->execute()) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,17 +318,16 @@ function selectRandomNotFriendUser($userID) {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeUsers($n, $m, $search)
|
function searchSomeUsers($n, $m, $search) {
|
||||||
{
|
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/notbad.jpg'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
`fname`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`
|
||||||
`lname`
|
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
@@ -345,8 +346,10 @@ function searchSomeUsers($n, $m, $search)
|
|||||||
$stmt->bindParam(':keyword', $search);
|
$stmt->bindParam(':keyword', $search);
|
||||||
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt;
|
|
||||||
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
function countSomeUsers($search) {
|
function countSomeUsers($search) {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ $userinfo = getHeaderInfo();
|
|||||||
<input name="search"
|
<input name="search"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Zoek naar wat je wil"
|
placeholder="Zoek naar wat je wil"
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
@@ -27,6 +26,7 @@ $userinfo = getHeaderInfo();
|
|||||||
<?=$userinfo["fname"]?>
|
<?=$userinfo["fname"]?>
|
||||||
</div>
|
</div>
|
||||||
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
|
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
|
||||||
|
<i id="open-notifications" class="fa fa-bars"></i>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<?php include("notification-center.php"); ?>
|
<?php include("notification-center.php"); ?>
|
||||||
|
|||||||
@@ -1,25 +1,33 @@
|
|||||||
<nav class="menu">
|
<nav class="menu">
|
||||||
<section id="friends-menu-section">
|
<section id="friends-menu-section">
|
||||||
<h4>
|
<h4>
|
||||||
Vrienden
|
Top vrienden
|
||||||
</h4>
|
</h4>
|
||||||
<ul id="menu-friends-list" class="nav-list">
|
<ul id="menu-friends-list" class="nav-list">
|
||||||
</ul>
|
</ul>
|
||||||
<h4><form action="search.php">
|
|
||||||
<input type="hidden"
|
|
||||||
value="friends"
|
|
||||||
name="filter" />
|
|
||||||
<button value=""
|
|
||||||
name="search">
|
|
||||||
Alle vrienden...
|
|
||||||
</button>
|
|
||||||
</form></h4>
|
|
||||||
</section>
|
</section>
|
||||||
<section id="groups-menu-section">
|
<section id="groups-menu-section">
|
||||||
<h4>
|
<h4>
|
||||||
Groepen
|
Top groepen
|
||||||
</h4>
|
</h4>
|
||||||
<ul id="menu-groups-list" class="nav-list">
|
<ul id="menu-groups-list" class="nav-list">
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<ul class="nav-list">
|
||||||
|
<li>
|
||||||
|
<form action="search.php" method="get">
|
||||||
|
<input type="hidden"
|
||||||
|
name="search"
|
||||||
|
value="" />
|
||||||
|
<input type="hidden"
|
||||||
|
name="filter"
|
||||||
|
value="personal" />
|
||||||
|
<button type="submit">
|
||||||
|
Klik voor al je groepen en vrienden...
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
</section>
|
</section>
|
||||||
<section id="friend-request-section">
|
<section id="friend-request-section">
|
||||||
<h4>
|
<h4>
|
||||||
Vriendchapsverzoeken
|
Verzoeken
|
||||||
</h4>
|
</h4>
|
||||||
<ul class="nav-list" id="friend-requests-list">
|
<ul class="nav-list" id="friend-requests-list">
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ echo("
|
|||||||
|
|
||||||
<div class='post-comments'>
|
<div class='post-comments'>
|
||||||
<div class="commentfield">
|
<div class="commentfield">
|
||||||
<form name="newcomment" method="post">
|
<form id="newcommentform" action="javascript:postComment();">
|
||||||
<textarea placeholder="Laat een reactie achter..."></textarea> <br>
|
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
||||||
|
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..."></textarea> <br>
|
||||||
<input type="submit" value="Reageer!">
|
<input type="submit" value="Reageer!">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class="friend-button-container">
|
<div class="friend-button-container">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h1>
|
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h1>
|
||||||
<h5 class="profile-username"><?=$user["username"]?></h5>
|
<h5 class="profile-username"><?=$user["username"]?></h5>
|
||||||
<p><?=$user["bio"]?></p>
|
<p><?=$user["bio"]?></p>
|
||||||
@@ -43,37 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
<?php
|
|
||||||
if ($_SESSION["userID"] === $userID) {
|
|
||||||
?>
|
|
||||||
<div class="post platform">
|
|
||||||
<form>
|
|
||||||
<input type="text" class="newpost" placeholder="Titel">
|
|
||||||
<textarea class="newpost" placeholder="Schrijf een berichtje..."></textarea>
|
|
||||||
<input type="submit" value="Plaats!">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
while($post = $posts->fetch()) {
|
|
||||||
$nicetime = nicetime($post["creationdate"]);
|
|
||||||
$postID = $post["postID"];
|
|
||||||
echo "
|
|
||||||
<div class='post platform' onclick='requestPost(this)'>
|
|
||||||
<h2>${post["title"]}</h2>
|
|
||||||
<p>${post["content"]}</p>
|
|
||||||
<p class=\"subscript\" title='" . $post["creationdate"] ."'>${nicetime} geplaatst.</p>
|
|
||||||
<form>
|
|
||||||
<input type='hidden'
|
|
||||||
name='postID'
|
|
||||||
value='$postID'
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ $user_perpage = $group_perpage = 20;
|
|||||||
$user_currentpage = $group_currentpage = 1;
|
$user_currentpage = $group_currentpage = 1;
|
||||||
|
|
||||||
if (isset($_GET['user-pageselect'])) {
|
if (isset($_GET['user-pageselect'])) {
|
||||||
$user_currentpage = $_GET['user-pageselect'];
|
$user_currentpage = test_input($_GET['user-pageselect']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['group-pageselect'])) {
|
if (isset($_GET['group-pageselect'])) {
|
||||||
$group_currentpage = $_GET['group-pageselect'];
|
$group_currentpage = test_input($_GET['group-pageselect']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['search'])) {
|
if (isset($_GET['search'])) {
|
||||||
@@ -17,7 +17,7 @@ if (isset($_GET['search'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['filter'])) {
|
if (isset($_GET['filter'])) {
|
||||||
$filter = $_GET['filter'];
|
$filter = test_input($_GET['filter']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_n = ($user_currentpage - 1) * $user_perpage;
|
$user_n = ($user_currentpage - 1) * $user_perpage;
|
||||||
@@ -37,26 +37,24 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
Zoek:
|
Zoek:
|
||||||
</label>
|
</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
id="search-input"
|
||||||
name="search"
|
name="search"
|
||||||
|
onkeyup="
|
||||||
|
searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
|
||||||
|
searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);"
|
||||||
placeholder="Zoek"
|
placeholder="Zoek"
|
||||||
value=<?php echo "$search";?>
|
value=<?php echo "$search";?>
|
||||||
>
|
>
|
||||||
<label for="filter">
|
<label for="filter">
|
||||||
Filter:
|
Filter:
|
||||||
</label>
|
</label>
|
||||||
<select name="filter">
|
<select name="filter" id="search-filter">
|
||||||
|
<option value="personal"
|
||||||
|
<?php if ($filter == "personal") echo "selected";?>>
|
||||||
|
Persoonlijk</option>
|
||||||
<option value="all"
|
<option value="all"
|
||||||
<?php if ($filter == "all") echo "selected";?>>
|
<?php if ($filter == "all") echo "selected";?>>
|
||||||
Alles</option>
|
Alles</option>
|
||||||
<option value="users"
|
|
||||||
<?php if ($filter == "users") echo "selected";?>>
|
|
||||||
Gebruikers</option>
|
|
||||||
<option value="groups"
|
|
||||||
<?php if ($filter == "groups") echo "selected";?>>
|
|
||||||
Groepen</option>
|
|
||||||
<option value="friends"
|
|
||||||
<?php if ($filter == "friends") echo "selected";?>>
|
|
||||||
Vrienden</option>
|
|
||||||
</select>
|
</select>
|
||||||
<input onclick="document.getElementById('user-pageselect').value = 1;
|
<input onclick="document.getElementById('user-pageselect').value = 1;
|
||||||
document.getElementById('group-pageselect').value = 1"
|
document.getElementById('group-pageselect').value = 1"
|
||||||
@@ -84,31 +82,12 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<ul class='nav-list'>
|
<ul id='search-users-list' class='nav-list'>
|
||||||
|
<script>
|
||||||
<?php
|
$(document).ready(function(){
|
||||||
$q = searchSomeUsers($user_n, $user_perpage, $search);
|
searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
|
||||||
|
});
|
||||||
while ($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
</script>
|
||||||
$username = $user['username'];
|
|
||||||
$profilepic = $user['profilepicture'];
|
|
||||||
$fname = $user['fname'];
|
|
||||||
$lname = $user['lname'];
|
|
||||||
|
|
||||||
echo("
|
|
||||||
<a href='https://myhyvesbookplus.nl/profile?username=$username'>
|
|
||||||
<li class='search-item'>
|
|
||||||
<div class='friend'>
|
|
||||||
<img class='profile-picture'
|
|
||||||
src='$profilepic'>
|
|
||||||
$fname $lname ($username)
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</a>
|
|
||||||
");
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -131,28 +110,12 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<ul class="nav-list">
|
<ul id="search-groups-list" class="nav-list">
|
||||||
|
<script>
|
||||||
<?php
|
$(document).ready(function(){
|
||||||
$q = searchSomeGroups($group_n, $user_perpage, $search);
|
searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);
|
||||||
|
});
|
||||||
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
</script>
|
||||||
$groupname = $group['name'];
|
|
||||||
$grouppic = $group['picture'];
|
|
||||||
|
|
||||||
echo("
|
|
||||||
<a href='https://myhyvesbookplus.nl/group?groupName=$groupname'>
|
|
||||||
<li class='search-item'>
|
|
||||||
<div class='group'>
|
|
||||||
<img class='group-picture'
|
|
||||||
src='$grouppic'>
|
|
||||||
$groupname
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</a>
|
|
||||||
");
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user