Merge branch 'master' into hendrik-testing

This commit is contained in:
Hendrik
2017-01-26 15:33:08 +01:00
32 changed files with 472 additions and 391 deletions

View File

@@ -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");

View 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);

View 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;
}
}

View 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");

View 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);
}

View 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);
}

View File

@@ -4,12 +4,6 @@ session_start();
include_once ("../../queries/friendship.php");
if (isset($_POST["limit"])) {
$limit = $_POST["limit"];
} else {
$limit = 5;
}
if (isset($_POST["action"])) {
$action = $_POST["action"];
} else {
@@ -26,11 +20,6 @@ $friends = json_decode($_POST["friends"]);
foreach($friends as $i => $friend) {
$friendshipStatus = getFriendshipStatus($friend->userID);
if ($limit != 0 && $i >= $limit)
$extra = "extra-friend-item";
else
$extra = "";
?>
<li class='friend-item <?= $extra ?>'>
<form action='<?= $action ?>' method='<?= $actionType ?>'>
@@ -60,15 +49,13 @@ foreach($friends as $i => $friend) {
</form>
<?php
if ($friendshipStatus > 1) {
if ($friendshipStatus == 2) {
$denyName = "Annuleer";
} else {
$denyName = "Weiger";
}
?>
<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
if ($friendshipStatus == 3) {
?>
@@ -76,11 +63,19 @@ foreach($friends as $i => $friend) {
onclick="editFriendship('<?= $friend->userID ?>', 'accept')"
class='accept-notification'
value='1'>
<i class='fa fa-check'></i>
<i class='fa fa-check'></i>Accepteer
</button>
<?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>
<?php
}
@@ -89,13 +84,6 @@ foreach($friends as $i => $friend) {
<?php
}
if (sizeof($friends) > $limit) {
?>
<li class='more-item'>
Meer vrienden...
</li>
<?php
}
?>

View File

@@ -22,17 +22,3 @@ foreach($groups as $i => $group) {
</li>
<?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>

View File

@@ -1,25 +1,19 @@
$(document).ready(function() {
$("#own-profile-picture").click(function() {
// Toggle menu
$("#own-profile-picture, #open-notifications").click(function() {
if ($("#notification-center").css('right') == "-256px") {
$(".content").animate({
marginRight: "256px"
}, 500);
$(".chat-right").animate({
width: $(".chat-right").width() - 266
}, 500);
$("#notification-center").animate({
right: "0px"
}, 500);
// Make the menu visible and move the content to the left.
$("#chat-history").width("calc(100% - 587px)");
$(".modal").width("calc(100% - 512px)");
$(".content").css("margin-right", "256px");
$("#notification-center").css("right", "0px");
} else {
$(".chat-right").animate({
width: $(".chat-right").width() + 266
}, 500);
$(".content").animate({
marginRight: "0px"
}, 500);
$("#notification-center").animate({
right: "-256px"
}, 500);
// Make the menu invisible and move the content to the right.
$("#chat-history").width("calc(100% - 331px)");
$(".modal").width("calc(100% - 256px)");
$(".content").css("margin-right", "0px");
$("#notification-center").css("right", "-256px");
}
});
});

View File

@@ -11,12 +11,10 @@ function scrollbarMargin(width, overflow) {
});
}
function requestPost(post) {
function requestPost(postID) {
$(".modal").show();
$.get(
"API/loadPost.php",
$(post).children("form").serialize()
).done(function (data) {
$.get("API/loadPost.php", { postID : postID }).done(function(data) {
$('.modal-default').hide();
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
scrollbarMargin(scrollBarWidth, 'hidden');
@@ -26,37 +24,55 @@ function requestPost(post) {
}
$(window).on("load", function() {
console.log("LOADED");
container = $("div.posts");
posts = container.children();
posts.remove();
column = $('<div class="column"></div>').append(posts);
container.append(column);
mansonry();
mansonry();
$(".modal-close").click(function () {
$(".modal").hide();
scrollbarMargin(0, 'auto');
$('#modal-response').hide();
$('.modal-default').show();
});
});
var masonryMode = 0;
$(window).resize(function() {
clearTimeout(window.resizedFinished);
window.resizeFinished = setTimeout(function() {
mansonry();
masonry(masonryMode);
}, 250);
});
function mansonry() {
var $container = $(".posts");
function masonry(mode) {
masonryMode = mode;
$container.children().remove();
columnCount = Math.floor($(".posts").width() / 250);
console.log("columns: " + columnCount);
/*
* Initialise columns.
*/
var columns = new Array(columnCount);
var $columns = new Array(columnCount);
for (i = 0; i < columnCount; i++) {
columns[i] = [0, []];
console.log(columns[i]);
$column = $("<div class=\"column\">");
$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];
}
}
return column;
}
/*
* Get the posts from the server.
*/
$.post("API/getPosts.php", { usr : userID })
.done(function(data) {
posts = JSON.parse(data);
/*
* Rearange the objects.
*/
j = 0;
posts.each(function(i) {
post = posts[i];
jQuery.each(posts, function() {
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
$post.append($("<h2>").text(this["title"]));
$post.append($("<p>").html(this["content"]));
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
shortestColumn = getShortestColumn(columns);
shortestColumn[0] = shortestColumn[0] + $(post).height() + margin;
shortestColumn[1].push(post);
shortestColumn[1].append($post);
shortestColumn[0] = shortestColumn[0] + $post.height() + margin;
});
container.children().remove();
/*
* Display the objects again in the correct order.
*/
for (i = 0; i < columnCount; i++) {
column = $('<div class="column"></div>').append(columns[i][1]);
console.log(column);
container.append(column);
}
$("div.posts div.column").width(100/columnCount + "%");
$(".modal-close").click(function () {
$(".modal").hide();
scrollbarMargin(0, 'auto');
$('#modal-response').hide();
$('.modal-default').show();
});
}

View File

@@ -1,49 +1,28 @@
var menuFriendsData;
var menuGroupsData;
var notificationMessagesData;
var notificationRequestsData;
$(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);
loadNotificationFriends();
loadUnreadMessages();
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) {
$.post(
"API/loadFriends.php",
@@ -51,16 +30,18 @@ function loadMenuFriends(limit) {
limit: 5
}
).done(function(data) {
if (menuFriendsData != data) {
menuFriendsData = data;
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
$("#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() {
$.post(
"API/loadGroups.php",
@@ -68,41 +49,45 @@ function loadMenuGroups() {
limit: 5
}
).done(function(data) {
if (menuGroupsData != data) {
menuGroupsData = data;
if (showGroups(data, "#menu-groups-list")) {
$("#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() {
$.post(
"API/loadFriendRequest.php"
).done(function(data) {
if (notificationRequestsData != data) {
notificationRequestsData = data;
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
$("#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() {
$.post(
"API/loadChatNotifications.php"
).done(function(data) {
if (notificationMessagesData != data) {
notificationMessagesData = data;
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
console.log(data);
$("#unread-messages-section").show();
} else {
$("#unread-messages-section").hide();
}
});
setTimeout(loadUnreadMessages, 3000);
}
});
}

View File

@@ -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
View 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);
});
}

View File

@@ -1,8 +0,0 @@
function loadPost(postID) {
$.get(
"API/loadPost.php",
$(postID).serialize()
).done(function (data) {
$('#modal-response').innerHTML= JSON.parse(data);
});
}

View 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");
}
});
}

View File

@@ -2,8 +2,9 @@
<html>
<head>
<?php include("../views/head.php"); ?>
<script src="js/masonry.js"></script>
<!-- <script src="js/profile.js"></script>-->
<script src="js/post.js"></script>
<style>
@import url("styles/profile.css");
@import url("styles/post-popup.css");
@@ -30,8 +31,10 @@ $posts = selectAllUserPosts($userID);
if ($userID == $_SESSION["userID"]) {
$friendship_status = -1;
$masonry_mode = 1;
} else {
$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/masonry.js"></script>
<script>
var posts;
$(document).ready(function() {
userID = <?= $userID ?>;
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>
</body>

View File

@@ -9,6 +9,8 @@
<style>
@import url("styles/search.css");
</style>
<script src="js/search.js"></script>
</head>
<body>
<?php

View File

@@ -43,6 +43,10 @@ header div {
width: 64px;
}
#own-profile-picture {
#own-profile-picture, #open-notifications {
cursor: pointer;
}
#open-notifications {
padding: 5px 20px 5px 0px;
}

View File

@@ -252,16 +252,20 @@ div[data-title]:hover:after {
font-family: Arial, sans-serif;
}
.friend {
}
.friend-item, .group-item {
cursor: pointer;
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 {
background: #FBC02D;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);

View File

@@ -34,15 +34,6 @@
cursor: pointer;
}
.menu button {
background: none;
color: inherit;
width: 100%;
height: 100%;
padding: 0;
text-align: left;
}
#notification-center {
left: auto;
width: 236px;
@@ -66,13 +57,8 @@
}
.notification-options {
width: 100%;
display: none;
width: 100%;
}
.notification-options form {
width: 100%;
text-align: center;
}
.notification-options button {
@@ -92,3 +78,12 @@
.friend-item:hover .notification-options {
display: inline-block;
}
.menu button {
background: none;
color: inherit;
width: 100%;
height: 100%;
padding: 0;
text-align: left;
}

View File

@@ -94,7 +94,7 @@ function selectAllFriendRequests() {
`friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND
`user`.`role` != 5 AND
`user`.`role` != 'banned' AND
`friendship`.`status` = 'requested'
");
@@ -218,3 +218,46 @@ function setLastVisited($friend) {
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());
}

View File

@@ -27,3 +27,30 @@ function selectLimitedGroupsFromUser($userID, $limit) {
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());
}

View File

@@ -192,7 +192,7 @@ function searchSomeGroups($n, $m, $search) {
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
return json_encode($stmt->fetchAll());
}
function countSomeGroups($search) {

View File

@@ -76,7 +76,7 @@ function makePost($userID, $groupID, $title, $content) {
}
function makeComment($postID, $userID, $content) {
$stmt = $_GLOBAL["db"]->prepare("
$stmt = $GLOBALS["db"]->prepare("
INSERT INTO
`comment` (
`postID`,

View File

@@ -83,7 +83,7 @@ function selectAllUnreadChat() {
`user`.`userID`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'
'../img/avatar-standard.png'
) AS profilepicture,
LEFT(`private_message`.`content`, 15) as `content`
FROM

View File

@@ -126,7 +126,9 @@ function selectAllUserPosts($userID) {
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
if(!$stmt->execute()) {
return False;
}
return $stmt;
}
@@ -316,17 +318,16 @@ function selectRandomNotFriendUser($userID) {
return $stmt->fetch();
}
function searchSomeUsers($n, $m, $search)
{
function searchSomeUsers($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`userID`,
`username`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'
'../img/avatar-standard.png'
) AS profilepicture,
`fname`,
`lname`
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`
FROM
`user`
WHERE
@@ -345,8 +346,10 @@ function searchSomeUsers($n, $m, $search)
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
return json_encode($stmt->fetchAll());
}
function countSomeUsers($search) {

View File

@@ -12,7 +12,6 @@ $userinfo = getHeaderInfo();
<input name="search"
type="text"
placeholder="Zoek naar wat je wil"
required
/>
<button type="submit">
<i class="fa fa-search"></i>
@@ -27,6 +26,7 @@ $userinfo = getHeaderInfo();
<?=$userinfo["fname"]?>
</div>
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
<i id="open-notifications" class="fa fa-bars"></i>
</div>
</header>
<?php include("notification-center.php"); ?>

View File

@@ -1,25 +1,33 @@
<nav class="menu">
<section id="friends-menu-section">
<h4>
Vrienden
Top vrienden
</h4>
<ul id="menu-friends-list" class="nav-list">
</ul>
<h4><form action="search.php">
<input type="hidden"
value="friends"
name="filter" />
<button value=""
name="search">
Alle vrienden...
</button>
</form></h4>
</section>
<section id="groups-menu-section">
<h4>
Groepen
Top groepen
</h4>
<ul id="menu-groups-list" class="nav-list">
</ul>
</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>

View File

@@ -7,7 +7,7 @@
</section>
<section id="friend-request-section">
<h4>
Vriendchapsverzoeken
Verzoeken
</h4>
<ul class="nav-list" id="friend-requests-list">

View File

@@ -21,8 +21,9 @@ echo("
<div class='post-comments'>
<div class="commentfield">
<form name="newcomment" method="post">
<textarea placeholder="Laat een reactie achter..."></textarea> <br>
<form id="newcommentform" action="javascript:postComment();">
<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!">
</form>
</div>

View File

@@ -43,37 +43,7 @@
</div>
<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 class="modal">

View File

@@ -5,11 +5,11 @@ $user_perpage = $group_perpage = 20;
$user_currentpage = $group_currentpage = 1;
if (isset($_GET['user-pageselect'])) {
$user_currentpage = $_GET['user-pageselect'];
$user_currentpage = test_input($_GET['user-pageselect']);
}
if (isset($_GET['group-pageselect'])) {
$group_currentpage = $_GET['group-pageselect'];
$group_currentpage = test_input($_GET['group-pageselect']);
}
if (isset($_GET['search'])) {
@@ -17,7 +17,7 @@ if (isset($_GET['search'])) {
}
if (isset($_GET['filter'])) {
$filter = $_GET['filter'];
$filter = test_input($_GET['filter']);
}
$user_n = ($user_currentpage - 1) * $user_perpage;
@@ -37,26 +37,24 @@ $group_count = countSomeGroups($search)->fetchColumn();
Zoek:
</label>
<input type="text"
id="search-input"
name="search"
onkeyup="
searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);"
placeholder="Zoek"
value=<?php echo "$search";?>
>
<label for="filter">
Filter:
</label>
<select name="filter">
<select name="filter" id="search-filter">
<option value="personal"
<?php if ($filter == "personal") echo "selected";?>>
Persoonlijk</option>
<option value="all"
<?php if ($filter == "all") echo "selected";?>>
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>
<input onclick="document.getElementById('user-pageselect').value = 1;
document.getElementById('group-pageselect').value = 1"
@@ -84,31 +82,12 @@ $group_count = countSomeGroups($search)->fetchColumn();
?>
</select>
<ul class='nav-list'>
<?php
$q = searchSomeUsers($user_n, $user_perpage, $search);
while ($user = $q->fetch(PDO::FETCH_ASSOC)) {
$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 id='search-users-list' class='nav-list'>
<script>
$(document).ready(function(){
searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
});
</script>
</ul>
</div>
@@ -131,28 +110,12 @@ $group_count = countSomeGroups($search)->fetchColumn();
?>
</select>
<ul class="nav-list">
<?php
$q = searchSomeGroups($group_n, $user_perpage, $search);
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
$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 id="search-groups-list" class="nav-list">
<script>
$(document).ready(function(){
searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);
});
</script>
</ul>
</div>
</div>