Kevin prototype #133
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);
|
||||||
16
website/public/API/loadFriends.php
Normal file
16
website/public/API/loadFriends.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
if (isset($_POST["limit"])) {
|
||||||
|
echo selectLimitedFriends($_SESSION["userID"], (int) test_input($_POST["limit"]));
|
||||||
|
} else if (isset($_GET["limit"])) {
|
||||||
|
echo selectLimitedFriends($_SESSION["userID"], (int) test_input($_GET["limit"]));
|
||||||
|
} else {
|
||||||
|
echo selectFriends($_SESSION["userID"]);
|
||||||
|
}
|
||||||
|
|
||||||
14
website/public/API/loadGroups.php
Normal file
14
website/public/API/loadGroups.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/group_member.php");
|
||||||
|
|
||||||
|
if (isset($_POST["limit"])) {
|
||||||
|
echo selectLimitedGroupsFromUser($_SESSION["userID"], (int) test_input($_POST["limit"]));
|
||||||
|
} else {
|
||||||
|
echo selectAllGroupsFromUser($_SESSION["userID"]);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -8,9 +8,9 @@ require_once("../../queries/checkInput.php");
|
|||||||
require_once("../../queries/friendship.php");
|
require_once("../../queries/friendship.php");
|
||||||
|
|
||||||
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
|
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
|
||||||
|
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"]));
|
||||||
setLastVisited(test_input($_POST["destination"]));
|
|
||||||
} else {
|
} else {
|
||||||
echo getOldChatMessages(test_input($_POST["destination"]));
|
|
||||||
setLastVisited(test_input($_POST["destination"]));
|
setLastVisited(test_input($_POST["destination"]));
|
||||||
|
echo getOldChatMessages(test_input($_POST["destination"]));
|
||||||
}
|
}
|
||||||
12
website/public/API/loadPost.php
Normal file
12
website/public/API/loadPost.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once("../../queries/connect.php");
|
||||||
|
require_once("../../queries/post.php");
|
||||||
|
require_once("../../queries/checkInput.php");
|
||||||
|
require_once("../../queries/nicetime.php");
|
||||||
|
|
||||||
|
if(isset($_GET['postID'])) {
|
||||||
|
include("../../views/post-view.php");
|
||||||
|
} else {
|
||||||
|
echo "Failed to load";
|
||||||
|
}
|
||||||
102
website/public/bits/friend-item.php
Normal file
102
website/public/bits/friend-item.php
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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 {
|
||||||
|
$action = "profile.php";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST["actionType"])) {
|
||||||
|
$actionType = $_POST["actionType"];
|
||||||
|
} else {
|
||||||
|
$actionType = "GET";
|
||||||
|
}
|
||||||
|
|
||||||
|
$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 ?>'>
|
||||||
|
<button type='submit'
|
||||||
|
name='username'
|
||||||
|
value='<?php
|
||||||
|
if (isset($friend->username)) {
|
||||||
|
echo $friend->username;
|
||||||
|
} else if (isset($friend->content)) {
|
||||||
|
echo $friend->userID;
|
||||||
|
}
|
||||||
|
?>'>
|
||||||
|
<div class='friend'>
|
||||||
|
<img alt='PF' class='profile-picture' src='<?= $friend->profilepicture ?>'/>
|
||||||
|
<div class='friend-name'>
|
||||||
|
<?= $friend->fullname ?><br/>
|
||||||
|
<span style='color: #666'><?php
|
||||||
|
if (isset($friend->username)) {
|
||||||
|
echo $friend->username;
|
||||||
|
} else if (isset($friend->content)) {
|
||||||
|
echo $friend->content;
|
||||||
|
}
|
||||||
|
?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
if ($friendshipStatus > 1) {
|
||||||
|
?>
|
||||||
|
<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) {
|
||||||
|
?>
|
||||||
|
<button name='accept'
|
||||||
|
onclick="editFriendship('<?= $friend->userID ?>', 'accept')"
|
||||||
|
class='accept-notification'
|
||||||
|
value='1'>
|
||||||
|
<i class='fa fa-check'></i>
|
||||||
|
</button>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof($friends) > $limit) {
|
||||||
|
?>
|
||||||
|
<li class='more-item'>
|
||||||
|
Meer vrienden...
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
38
website/public/bits/group-item.php
Normal file
38
website/public/bits/group-item.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
include_once ("../../queries/group_member.php");
|
||||||
|
|
||||||
|
$groups = json_decode($_POST["groups"]);
|
||||||
|
|
||||||
|
foreach($groups as $i => $group) {
|
||||||
|
?>
|
||||||
|
<li class='group-item'>
|
||||||
|
<form action='group.php' method='get'>
|
||||||
|
<button type='submit'
|
||||||
|
name='groupname'
|
||||||
|
value='<?= $group->name ?>'>
|
||||||
|
<div class='group'>
|
||||||
|
<img alt='PF' class='group-picture' src='<?= $group->picture ?>'/>
|
||||||
|
<?= $group->name ?>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</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>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once("../queries/connect.php");
|
include_once("../queries/connect.php");
|
||||||
|
include_once("../views/messagepage.php");
|
||||||
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||||
$checkHash = $GLOBALS["db"]->prepare("
|
$checkHash = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -18,11 +19,11 @@ if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
|||||||
if ($role == "unconfirmed") {
|
if ($role == "unconfirmed") {
|
||||||
doActivate($email);
|
doActivate($email);
|
||||||
} else {
|
} else {
|
||||||
echo "Ongeldige link.";
|
messagePage("Ongeldige link.");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "Ongeldige link.";
|
messagePage("Ongeldige link.");
|
||||||
}
|
}
|
||||||
|
|
||||||
function doActivate(string $email) {
|
function doActivate(string $email) {
|
||||||
@@ -39,11 +40,10 @@ function doActivate(string $email) {
|
|||||||
$confirmUser->bindParam(":userID", $_GET["u"]);
|
$confirmUser->bindParam(":userID", $_GET["u"]);
|
||||||
$confirmUser->execute();
|
$confirmUser->execute();
|
||||||
if ($confirmUser->rowCount()) {
|
if ($confirmUser->rowCount()) {
|
||||||
echo "Email bevestigd <br />
|
messagePage("Email bevestigd <br />
|
||||||
<a href='index.php'>U wordt automatisch doorgestuurd naar de login pagina over 5 seconden.</a> ";
|
<a href='index.php'>Klik hier om terug te gaan naar de login pagina.</a>");
|
||||||
header("refresh:5;url=login.php");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "Ongeldige link.";
|
messagePage("Ongeldige link.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
<html>
|
<?php
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0; url=login.php" />
|
session_start();
|
||||||
</head>
|
|
||||||
</html>
|
if (isset($_SESSION["userID"])) {
|
||||||
|
header("Location: profile.php");
|
||||||
|
} else {
|
||||||
|
header("Location: login.php");
|
||||||
|
}
|
||||||
@@ -54,7 +54,7 @@ function switchUser(userID) {
|
|||||||
$("#chat-history").html("");
|
$("#chat-history").html("");
|
||||||
$("#lastID").val("");
|
$("#lastID").val("");
|
||||||
$("#chat-recent-panel .friend-item").removeClass("active-friend-chat");
|
$("#chat-recent-panel .friend-item").removeClass("active-friend-chat");
|
||||||
$("#chat-left #friend-item-" + userID).addClass("active-friend-chat");
|
$("#friend-item-" + userID).addClass("active-friend-chat");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sayEmpty() {
|
function sayEmpty() {
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ function placeFriendButtons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$buttonContainer.children().click(function() {
|
$buttonContainer.children().click(function() {
|
||||||
$.post("API/editFriendship.php", { usr: userID, action: this.value })
|
editFriendship(userID, this.value);
|
||||||
.done(function() {
|
|
||||||
placeFriendButtons();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
45
website/public/js/main.js
Normal file
45
website/public/js/main.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
function editFriendship(userID, value) {
|
||||||
|
$.post("API/editFriendship.php", { usr: userID, action: value })
|
||||||
|
.done(function() {
|
||||||
|
placeFriendButtons();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFriends(friends, list) {
|
||||||
|
if(friends && friends != "[]") {
|
||||||
|
$(list).load("bits/friend-item.php", {
|
||||||
|
"friends": friends
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFriendsPlus(friends, list, limit, action, actionType) {
|
||||||
|
if(friends && friends != "[]") {
|
||||||
|
$(list).load("bits/friend-item.php", {
|
||||||
|
"friends": friends,
|
||||||
|
"limit": limit,
|
||||||
|
"action": action,
|
||||||
|
"actionType": actionType
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showGroups(groups, list) {
|
||||||
|
if(groups && groups != "[]") {
|
||||||
|
$(list).load("bits/group-item.php", {
|
||||||
|
"groups": groups
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,50 @@
|
|||||||
margin = 20;
|
margin = 20;
|
||||||
|
|
||||||
|
// scrolling modal taken from http://stackoverflow.com/questions/10476632/how-to-scroll-the-page-when-a-modal-dialog-is-longer-than-the-screen
|
||||||
|
function scrollbarMargin(width, overflow) {
|
||||||
|
$('body').css({
|
||||||
|
marginRight: width,
|
||||||
|
overflow: overflow
|
||||||
|
});
|
||||||
|
$('.profile-menu').css({
|
||||||
|
marginRight: width
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestPost(postID) {
|
||||||
|
$(".modal").show();
|
||||||
|
|
||||||
|
$.get("API/loadPost.php", { postID : postID }).done(function(data) {
|
||||||
|
$('.modal-default').hide();
|
||||||
|
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
||||||
|
scrollbarMargin(scrollBarWidth, 'hidden');
|
||||||
|
$('#modal-response').show();
|
||||||
|
$('#modal-response').html(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(window).on("load", function() {
|
||||||
|
$(".modal-close").click(function () {
|
||||||
|
$(".modal").hide();
|
||||||
|
scrollbarMargin(0, 'auto');
|
||||||
|
$('#modal-response').hide();
|
||||||
|
$('.modal-default').show();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var masonryMode = 0;
|
||||||
|
|
||||||
$(window).resize(function() {
|
$(window).resize(function() {
|
||||||
clearTimeout(window.resizedFinished);
|
clearTimeout(window.resizedFinished);
|
||||||
window.resizeFinished = setTimeout(function() {
|
window.resizeFinished = setTimeout(function() {
|
||||||
masonry();
|
masonry(masonryMode);
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
});
|
||||||
|
|
||||||
var $container = $(".posts");
|
var $container = $(".posts");
|
||||||
|
|
||||||
function masonry() {
|
function masonry(mode) {
|
||||||
|
masonryMode = mode;
|
||||||
$container.children().remove();
|
$container.children().remove();
|
||||||
columnCount = Math.floor($(".posts").width() / 250);
|
columnCount = Math.floor($(".posts").width() / 250);
|
||||||
|
|
||||||
@@ -25,6 +60,20 @@ function masonry() {
|
|||||||
columns[i] = [0, $column];
|
columns[i] = [0, $column];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mode == 1) {
|
||||||
|
$postInput = $("<div class=\"post platform\">");
|
||||||
|
$form = $postInput.append($("<form>"));
|
||||||
|
|
||||||
|
$form.append($("<input class=\"newpost\" placeholder=\"Titel\" type=\"text\">"));
|
||||||
|
$form.append($("<textarea class=\"newpost\" 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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function will find the column with the shortest height.
|
* Function will find the column with the shortest height.
|
||||||
*/
|
*/
|
||||||
@@ -50,9 +99,10 @@ function masonry() {
|
|||||||
* Rearange the objects.
|
* Rearange the objects.
|
||||||
*/
|
*/
|
||||||
jQuery.each(posts, function() {
|
jQuery.each(posts, function() {
|
||||||
$post = $("<div class=\"post platform\" onclick=\"requestPost(this)\">");
|
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
|
||||||
$post.append($("<h2>").text(this["title"]));
|
$post.append($("<h2>").text(this["title"]));
|
||||||
$post.append($("<p>").html(this["content"]));
|
$post.append($("<p>").html(this["content"]));
|
||||||
|
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
|
||||||
|
|
||||||
shortestColumn = getShortestColumn(columns);
|
shortestColumn = getShortestColumn(columns);
|
||||||
shortestColumn[1].append($post);
|
shortestColumn[1].append($post);
|
||||||
@@ -60,3 +110,4 @@ function masonry() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,108 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(".extra-menu-items").hide();
|
// Show more friends/users
|
||||||
$("#menu-back").hide();
|
|
||||||
|
|
||||||
// Show more friends
|
// Show more friends
|
||||||
$("#more-friends-click").click(function() {
|
// $("#more-friends-click").click(function() {
|
||||||
// Show only friends
|
// // Show only friends
|
||||||
$("#groups-menu-section").slideUp();
|
// $("#groups-menu-section").slideUp();
|
||||||
$("#friends-menu-section li").show();
|
// $("#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();
|
||||||
|
// });
|
||||||
|
|
||||||
// Change buttons
|
// // Go back
|
||||||
$("#more-friends-click").hide();
|
// $("#menu-back").click(function() {
|
||||||
$("#menu-back").show();
|
// // 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();
|
||||||
|
// });
|
||||||
|
|
||||||
// Show more groups
|
loadMenuFriends(5);
|
||||||
$("#more-groups-click").click(function() {
|
loadNotificationFriends();
|
||||||
// Show only groups
|
loadUnreadMessages();
|
||||||
$("#friends-menu-section").slideUp();
|
loadMenuGroups();
|
||||||
$("#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();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function loadMenuFriends(limit) {
|
||||||
|
$.post(
|
||||||
|
"API/loadFriends.php",
|
||||||
|
{
|
||||||
|
limit: 5
|
||||||
|
}
|
||||||
|
).done(function(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadMenuGroups() {
|
||||||
|
$.post(
|
||||||
|
"API/loadGroups.php",
|
||||||
|
{
|
||||||
|
limit: 5
|
||||||
|
}
|
||||||
|
).done(function(data) {
|
||||||
|
if (showGroups(data, "#menu-groups-list")) {
|
||||||
|
$("#groups-menu-section").show();
|
||||||
|
} else {
|
||||||
|
$("#groups-menu-section").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(loadMenuGroups, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadNotificationFriends() {
|
||||||
|
$.post(
|
||||||
|
"API/loadFriendRequest.php"
|
||||||
|
).done(function(data) {
|
||||||
|
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
|
||||||
|
$("#friend-request-section").show();
|
||||||
|
} else {
|
||||||
|
$("#friend-request-section").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(loadNotificationFriends, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadUnreadMessages() {
|
||||||
|
$.post(
|
||||||
|
"API/loadChatNotifications.php"
|
||||||
|
).done(function(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);
|
||||||
|
}
|
||||||
@@ -1,89 +1,43 @@
|
|||||||
function showFriendNotifications(notifications) {
|
// function showChatNotifications(notifications) {
|
||||||
$("#friendrequestslist").html("");
|
// $("#unreadChatlist").html("");
|
||||||
for (i in notifications) {
|
// for (i in notifications) {
|
||||||
var outgoing = "";
|
// $("#unreadChatlist").append(" \
|
||||||
if (notifications[i].friend_state == "3") {
|
// <li class='friend-item'> \
|
||||||
outgoing = "<button\
|
// <form action='chat.php' method='get'> \
|
||||||
name='accept' \
|
// <button type='submit' \
|
||||||
class='accept-notification' \
|
// name='chatID' \
|
||||||
value='"+ notifications[i].userID +"'> \
|
// value='"+ notifications[i].userID +"'> \
|
||||||
<i class='fa fa-check'></i> \
|
// <div class='friend'> \
|
||||||
</button>";
|
// <img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
||||||
}
|
// <div class='friend-name'> \
|
||||||
|
// "+ notifications[i].name +"<br/> \
|
||||||
$("#friendrequestslist").append(" \
|
// <span style='color: #666'>"+ notifications[i].content +"</span> \
|
||||||
<li class='friend-item'> \
|
// </div> \
|
||||||
<form action='profile.php' method='get'> \
|
// </div> \
|
||||||
<button type='submit' \
|
// </button> \
|
||||||
name='username' \
|
// </form> \
|
||||||
value='"+ notifications[i].username +"'> \
|
// </li> \
|
||||||
<div class='friend'> \
|
// ");
|
||||||
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
// }
|
||||||
"+ notifications[i].username +" \
|
// }
|
||||||
</div> \
|
//
|
||||||
</button> \
|
// function loadNotifications() {
|
||||||
</form> \
|
// $.post(
|
||||||
<div class='notification-options'>\
|
// "API/loadChatNotifications.php"
|
||||||
<form action='API/edit_friendship.php' method='post'> \
|
// ).done(function(data) {
|
||||||
<input type='hidden' name='userID' value='"+ notifications[i].userID +"' /> \
|
// if (data && data != "[]") {
|
||||||
"+ outgoing +" \
|
// $("#unread-messages-section").show();
|
||||||
<button type='submit' \
|
// showChatNotifications(JSON.parse(data));
|
||||||
name='delete' \
|
// } else {
|
||||||
class='deny-notification' \
|
// $("#unread-messages-section").hide();
|
||||||
value='"+ notifications[i].userID +"'> \
|
// }
|
||||||
<i class='fa fa-times'></i> \
|
// });
|
||||||
</button>\
|
//
|
||||||
<form>\
|
// setTimeout(loadNotifications, 10000);
|
||||||
</div> \
|
// }
|
||||||
</li> \
|
// $(document).ready(function() {
|
||||||
");
|
// loadNotifications();
|
||||||
}
|
// });
|
||||||
}
|
|
||||||
|
|
||||||
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/loadFriendRequestNotifications.php"
|
|
||||||
).done(function(data) {
|
|
||||||
if (data && data != "[]") {
|
|
||||||
showFriendNotifications(JSON.parse(data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.post(
|
|
||||||
"API/loadChatNotifications.php"
|
|
||||||
).done(function(data) {
|
|
||||||
if (data && data != "[]") {
|
|
||||||
showChatNotifications(JSON.parse(data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(loadNotifications, 10000);
|
|
||||||
}
|
|
||||||
$(document).ready(function() {
|
|
||||||
loadNotifications();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
8
website/public/js/profile.js
Normal file
8
website/public/js/profile.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
function loadPost(postID) {
|
||||||
|
$.get(
|
||||||
|
"API/loadPost.php",
|
||||||
|
$(postID).serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
$('#modal-response').innerHTML= JSON.parse(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
include_once("../queries/login.php");
|
include_once("../queries/login.php");
|
||||||
include_once("../queries/checkInput.php");
|
include_once("../queries/checkInput.php");
|
||||||
include_once("../queries/emailconfirm.php");
|
include_once("../queries/emailconfirm.php");
|
||||||
|
include_once("../queries/requestpassword.php");
|
||||||
|
include_once("../queries/register.php");
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
@@ -19,17 +21,43 @@
|
|||||||
|
|
||||||
// Define variables and set to empty values
|
// Define variables and set to empty values
|
||||||
$uname = $psw ="";
|
$uname = $psw ="";
|
||||||
$loginErr ="";
|
$loginErr = $resetErr ="";
|
||||||
|
|
||||||
// Trying to login
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
try{
|
switch ($_POST["submit"]) {
|
||||||
$uname = ($_POST["uname"]);
|
case "login":
|
||||||
validateLogin($_POST["uname"], $_POST["psw"]);
|
try {
|
||||||
} catch(loginException $e) {
|
$uname = ($_POST["uname"]);
|
||||||
$loginErr = $e->getMessage();
|
validateLogin($_POST["uname"], $_POST["psw"]);
|
||||||
|
} catch(loginException $e) {
|
||||||
|
$loginErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "reset":
|
||||||
|
try {
|
||||||
|
resetEmail($_POST["forgotEmail"]);
|
||||||
|
sendPasswordRecovery($_POST["forgotEmail"]);
|
||||||
|
} catch (emailException $e){
|
||||||
|
$resetErr = $e->getMessage();
|
||||||
|
echo "<script>
|
||||||
|
window.onload = function() {
|
||||||
|
$('#myModal').show();
|
||||||
|
}
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// // Trying to login
|
||||||
|
// if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
// try{
|
||||||
|
// $uname = ($_POST["uname"]);
|
||||||
|
// validateLogin($_POST["uname"], $_POST["psw"]);
|
||||||
|
// } catch(loginException $e) {
|
||||||
|
// $loginErr = $e->getMessage();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/* This view adds login view */
|
/* This view adds login view */
|
||||||
include("../views/login-view.php");
|
include("../views/login-view.php");
|
||||||
|
|||||||
@@ -2,8 +2,12 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<?php include("../views/head.php"); ?>
|
<?php include("../views/head.php"); ?>
|
||||||
|
|
||||||
|
<script src="js/masonry.js"></script>
|
||||||
|
<!-- <script src="js/profile.js"></script>-->
|
||||||
<style>
|
<style>
|
||||||
@import url("styles/profile.css");
|
@import url("styles/profile.css");
|
||||||
|
@import url("styles/post-popup.css");
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -11,6 +15,7 @@
|
|||||||
include("../queries/user.php");
|
include("../queries/user.php");
|
||||||
include("../queries/friendship.php");
|
include("../queries/friendship.php");
|
||||||
include("../queries/nicetime.php");
|
include("../queries/nicetime.php");
|
||||||
|
include("../queries/post.php");
|
||||||
|
|
||||||
if(empty($_GET["username"])) {
|
if(empty($_GET["username"])) {
|
||||||
$userID = $_SESSION["userID"];
|
$userID = $_SESSION["userID"];
|
||||||
@@ -26,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -52,7 +59,7 @@ include("../views/footer.php");
|
|||||||
userID = <?= $userID ?>;
|
userID = <?= $userID ?>;
|
||||||
placeFriendButtons();
|
placeFriendButtons();
|
||||||
|
|
||||||
masonry();
|
masonry(<?= $masonry_mode ?>);
|
||||||
// alert("blap");
|
// alert("blap");
|
||||||
// $.post("API/getPosts.php", { usr : userID }, "json")
|
// $.post("API/getPosts.php", { usr : userID }, "json")
|
||||||
// .done(function(data) {
|
// .done(function(data) {
|
||||||
|
|||||||
57
website/public/resetpassword.php
Normal file
57
website/public/resetpassword.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
include_once("../queries/connect.php");
|
||||||
|
include_once("../views/messagepage.php");
|
||||||
|
include_once("../views/resetpassword.php");
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||||
|
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||||
|
if (verifyLink($_GET["u"], $_GET["h"])) {
|
||||||
|
messagePage(passwordResetFields());
|
||||||
|
} else {
|
||||||
|
messagePage("Wachtwoorden komen niet overeen.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige links");
|
||||||
|
}
|
||||||
|
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
if (verifyLink($_POST["u"], $_POST["h"])) {
|
||||||
|
if ($_POST["password"] == $_POST["password-confirm"]) {
|
||||||
|
changePassword();
|
||||||
|
messagePage("Wachtwoord gewijzigd");
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige link");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige link");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function changePassword() {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`password` = :password
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindValue(":password", password_hash($_POST["password"], PASSWORD_DEFAULT));
|
||||||
|
$stmt->bindParam(":userID", $_POST["u"]);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyLink(int $userID, string $hash) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`password`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->execute();
|
||||||
|
$password = $stmt->fetch()["password"];
|
||||||
|
return password_verify($password, $hash);
|
||||||
|
}
|
||||||
@@ -3,11 +3,11 @@ a.button {
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
color: black;
|
color: black;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 50%;
|
|
||||||
padding: 8px 20px;
|
padding: 8px 20px;
|
||||||
width: 50%;
|
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 20px;
|
font-size: 22px;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Body */
|
/* Body */
|
||||||
@@ -28,12 +28,13 @@ body {
|
|||||||
form {
|
form {
|
||||||
/*background-color: #a87a87;*/
|
/*background-color: #a87a87;*/
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
height: 75%;
|
height: 85%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
overflow-y:auto;
|
overflow-y:auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* inlog titel */
|
/* inlog titel */
|
||||||
h1 {
|
h1 {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
@@ -48,6 +49,11 @@ h2 {
|
|||||||
font-size: 2.0em;
|
font-size: 2.0em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
padding: 16px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -60,14 +66,22 @@ input[type=text], input[type=password], input[type=email], input[type="date"] {
|
|||||||
width: 55%;
|
width: 55%;
|
||||||
}
|
}
|
||||||
|
|
||||||
button[type=submit] {
|
.center{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
background-color: #C8CABD;
|
background-color: #C8CABD;
|
||||||
|
border-radius: 5px;
|
||||||
color: black;
|
color: black;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
height: 50%;
|
||||||
|
padding: 8px 20px;
|
||||||
|
margin: 10px;
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
height: 30px;
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
width: 120px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
@@ -80,31 +94,6 @@ label {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left-arrow {
|
|
||||||
display: inline-block;
|
|
||||||
position: relative;
|
|
||||||
background-color: #C8CABD;
|
|
||||||
height: 25px;
|
|
||||||
width: 120px;
|
|
||||||
padding: 3px 3px 3px 3px;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 0px 5px 5px 0px;
|
|
||||||
font-size: 22px;
|
|
||||||
|
|
||||||
}
|
|
||||||
.left-arrow:after {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
right: 100%;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
border-top: 12px solid transparent;
|
|
||||||
border-right: 20px solid #C8CABD;
|
|
||||||
border-bottom: 12px solid transparent;
|
|
||||||
border-left: 0px solid transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* padding voor registreer container */
|
/* padding voor registreer container */
|
||||||
.login_containerregister {
|
.login_containerregister {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
@@ -137,24 +126,84 @@ label {
|
|||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
background-attachment: fixed;*/
|
background-attachment: fixed;*/
|
||||||
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);
|
||||||
height: 500px;
|
height: 400px;
|
||||||
margin: 34px auto;
|
margin: 34px auto;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
width: 45%;
|
width: 45%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.platform {
|
|
||||||
width: 40%;
|
|
||||||
margin: 34px auto;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@-webkit-keyframes animatezoom {
|
|
||||||
from {-webkit-transform: scale(0)}
|
|
||||||
to {-webkit-transform: scale(1)}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The Modal (background) */
|
||||||
|
.modal {
|
||||||
|
display: none; /* Hidden by default */
|
||||||
|
position: fixed; /* Stay in place */
|
||||||
|
z-index: 1; /* Sit on top */
|
||||||
|
padding-top: 100px; /* Location of the box */
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%; /* Full width */
|
||||||
|
height: 100%; /* Full height */
|
||||||
|
overflow: auto; /* Enable scroll if needed */
|
||||||
|
background-color: rgb(0,0,0); /* Fallback color */
|
||||||
|
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Content */
|
||||||
|
.modal-content {
|
||||||
|
position: relative;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
margin: auto;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid #888;
|
||||||
|
width: 500px;
|
||||||
|
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
||||||
|
-webkit-animation-name: animatetop;
|
||||||
|
-webkit-animation-duration: 0.4s;
|
||||||
|
animation-name: animatetop;
|
||||||
|
animation-duration: 0.4s
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add Animation */
|
||||||
|
@-webkit-keyframes animatetop {
|
||||||
|
from {top:-300px; opacity:0}
|
||||||
|
to {top:0; opacity:1}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes animatetop {
|
||||||
|
from {top:-300px; opacity:0}
|
||||||
|
to {top:0; opacity:1}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The Close Button */
|
||||||
|
.close {
|
||||||
|
color: white;
|
||||||
|
float: right;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close:hover,
|
||||||
|
.close:focus {
|
||||||
|
color: #000;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
padding: 2px 16px;
|
||||||
|
background-color: #FBC02D;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {padding: 2px 16px;}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
padding: 2px 16px;
|
||||||
|
background-color: #FBC02D;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
72
website/public/styles/post-popup.css
Normal file
72
website/public/styles/post-popup.css
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/* modal based on: http://www.w3schools.com/howto/howto_css_modals.asp */
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 80px;
|
||||||
|
left: 256px;
|
||||||
|
width: calc(100% - 256px); /* Full width */
|
||||||
|
height: calc(100% - 80px); /* Full height */
|
||||||
|
background-color: rgb(0,0,0); /* Fallback color */
|
||||||
|
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Content/Box */
|
||||||
|
.modal-content {
|
||||||
|
margin: 5% auto;
|
||||||
|
width: 70%; /* Could be more or less, depending on screen size */
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close {
|
||||||
|
color: #aaa;
|
||||||
|
float: right;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close:hover,
|
||||||
|
.modal-close:focus {
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content img {
|
||||||
|
max-height: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-header h4 {
|
||||||
|
font-size: 20pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content {
|
||||||
|
margin: 30px auto;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentfield {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentfield textarea {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment {
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-top: 1px solid #4CAF50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentinfo {
|
||||||
|
font-size: 10pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentcontent {
|
||||||
|
margin: 5px auto;
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
17
website/public/styles/resetpassword.css
Normal file
17
website/public/styles/resetpassword.css
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
.password-change {
|
||||||
|
height: 100%;
|
||||||
|
background-color: #FBC02D;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-logo {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-box {
|
||||||
|
margin: 30px auto auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.password-change img {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
@@ -25,5 +25,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
li.search-item:hover{
|
li.search-item:hover{
|
||||||
background-color: #EEE;
|
background-color: #FBC02D;
|
||||||
}
|
}
|
||||||
@@ -97,6 +97,18 @@ function validateEmail($variable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* checks if an input is a valid email. */
|
||||||
|
function resetEmail($variable){
|
||||||
|
if (empty($variable)) {
|
||||||
|
throw new emailException("Verplicht!");
|
||||||
|
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
throw new emailException("Geldige email invullen");
|
||||||
|
} else if (getResetEmail() == 0){
|
||||||
|
throw new emailException("Email bestaat niet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* checks if two passwords matches. */
|
/* checks if two passwords matches. */
|
||||||
function matchPassword(){
|
function matchPassword(){
|
||||||
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
||||||
|
|||||||
@@ -1,13 +1,51 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("connect.php");
|
require_once ("connect.php");
|
||||||
|
|
||||||
|
function selectFriends($userID) {
|
||||||
|
return selectLimitedFriends($userID, 9999);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectLimitedFriends($userID, $limit) {
|
||||||
|
$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'
|
||||||
|
LIMIT :limitCount
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':limitCount', $limit, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
return json_encode($stmt->fetchAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function selectAllFriends($userID) {
|
function selectAllFriends($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
@@ -39,22 +77,7 @@ function selectAllFriendRequests() {
|
|||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
CASE `status` IS NULL
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||||
WHEN TRUE THEN 0
|
|
||||||
WHEN FALSE THEN
|
|
||||||
CASE `status` = 'confirmed'
|
|
||||||
WHEN TRUE THEN
|
|
||||||
1
|
|
||||||
WHEN FALSE THEN
|
|
||||||
CASE `user1ID` = :userID
|
|
||||||
WHEN TRUE THEN
|
|
||||||
2
|
|
||||||
WHEN FALSE THEN
|
|
||||||
3
|
|
||||||
END
|
|
||||||
END
|
|
||||||
END AS `friend_state`,
|
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectAllGroupsFromUser($userID) {
|
function selectAllGroupsFromUser($userID) {
|
||||||
|
selectLimitedGroupsFromUser($userID, 9999);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectLimitedGroupsFromUser($userID, $limit) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -13,10 +17,13 @@ function selectAllGroupsFromUser($userID) {
|
|||||||
`group_member`.`userID` = :userID AND
|
`group_member`.`userID` = :userID AND
|
||||||
`group_member`.`groupID` = `group_page`.`groupID` AND
|
`group_member`.`groupID` = `group_page`.`groupID` AND
|
||||||
`group_page`.`status` != 'hidden'
|
`group_page`.`status` != 'hidden'
|
||||||
|
LIMIT :limitCount
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':limitCount', $limit, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return $stmt;
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
97
website/queries/post.php
Normal file
97
website/queries/post.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function selectPostById($postID) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`user`.`fname`,
|
||||||
|
`user`.`lname`,
|
||||||
|
`user`.`username`,
|
||||||
|
`post`.`groupID`,
|
||||||
|
`post`.`title`,
|
||||||
|
`post`.`content`,
|
||||||
|
`post`.`creationdate`
|
||||||
|
FROM
|
||||||
|
`post`
|
||||||
|
INNER JOIN
|
||||||
|
`user`
|
||||||
|
ON
|
||||||
|
`post`.`author` = `user`. `userID`
|
||||||
|
WHERE
|
||||||
|
`post`.`postID` = :postID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':postID', $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectCommentsByPostId($postID) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`comment`.`commentID`,
|
||||||
|
`comment`.`postID`,
|
||||||
|
`comment`.`author`,
|
||||||
|
`comment`.`content`,
|
||||||
|
`comment`.`creationdate`,
|
||||||
|
`user`.`fname`,
|
||||||
|
`user`.`lname`,
|
||||||
|
`user`.`username`
|
||||||
|
FROM
|
||||||
|
`comment`
|
||||||
|
INNER JOIN
|
||||||
|
`user`
|
||||||
|
ON
|
||||||
|
`comment`.`author` = `user`.`userID`
|
||||||
|
WHERE
|
||||||
|
`comment`.`postID` = :postID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':postID', $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makePost($userID, $groupID, $title, $content) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
INSERT INTO
|
||||||
|
`post` (
|
||||||
|
`author`,
|
||||||
|
`groupID`,
|
||||||
|
`title`,
|
||||||
|
`content`
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
:userID,
|
||||||
|
:groupID,
|
||||||
|
:title,
|
||||||
|
:content
|
||||||
|
)
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':userID', $userID);
|
||||||
|
$stmt->bindParam(':groupID', $groupID);
|
||||||
|
$stmt->bindParam(':title', $title);
|
||||||
|
$stmt->bindParam(':content', $content);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeComment($postID, $userID, $content) {
|
||||||
|
$stmt = $_GLOBAL["db"]->prepare("
|
||||||
|
INSERT INTO
|
||||||
|
`comment` (
|
||||||
|
`postID`,
|
||||||
|
`author`,
|
||||||
|
`content`
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
:postID,
|
||||||
|
:userID,
|
||||||
|
:content
|
||||||
|
)
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':postID', $postID);
|
||||||
|
$stmt->bindParam(':userID', $userID);
|
||||||
|
$stmt->bindParam(':content', $content);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
@@ -79,11 +79,11 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
function selectAllUnreadChat() {
|
function selectAllUnreadChat() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||||
`user`.`userID`,
|
`user`.`userID`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/notbad.jpg'
|
'../img/notbad.jpg'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
LEFT(`private_message`.`content`, 15) as `content`
|
LEFT(`private_message`.`content`, 15) as `content`
|
||||||
FROM
|
FROM
|
||||||
@@ -93,15 +93,18 @@ function selectAllUnreadChat() {
|
|||||||
WHERE
|
WHERE
|
||||||
(`friendship`.user2ID = `private_message`.`origin` AND
|
(`friendship`.user2ID = `private_message`.`origin` AND
|
||||||
`friendship`.user1ID = `private_message`.`destination` AND
|
`friendship`.user1ID = `private_message`.`destination` AND
|
||||||
`friendship`.chatLastVisted1 < `private_message`.`creationdate` OR
|
(`friendship`.chatLastVisted1 < `private_message`.`creationdate` OR
|
||||||
|
`friendship`.chatLastVisted1 IS NULL) OR
|
||||||
`friendship`.user1ID = `private_message`.`origin` AND
|
`friendship`.user1ID = `private_message`.`origin` AND
|
||||||
`friendship`.user2ID = `private_message`.`destination` AND
|
`friendship`.user2ID = `private_message`.`destination` AND
|
||||||
`friendship`.chatLastVisted2 < `private_message`.`creationdate`) AND
|
(`friendship`.chatLastVisted2 < `private_message`.`creationdate` OR
|
||||||
|
`friendship`.chatLastVisted2 IS NULL)) AND
|
||||||
`private_message`.`origin` = `user`.`userID` AND
|
`private_message`.`origin` = `user`.`userID` AND
|
||||||
`private_message`.`destination` = :userID AND
|
`private_message`.`destination` = :userID AND
|
||||||
`user`.`role` != 'banned'
|
`user`.`role` != 'banned'
|
||||||
|
|
||||||
GROUP BY `user`.`userID`
|
GROUP BY `user`.`userID`
|
||||||
|
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $_SESSION["userID"]);
|
$stmt->bindParam(':userID', $_SESSION["userID"]);
|
||||||
|
|||||||
@@ -32,6 +32,22 @@ function getExistingEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getResetEmail() {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`email`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`email` LIKE :email
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(":email", $_POST["forgotEmail"]);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function registerAccount() {
|
function registerAccount() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
|
|||||||
54
website/queries/requestpassword.php
Normal file
54
website/queries/requestpassword.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
include_once "../queries/connect.php";
|
||||||
|
|
||||||
|
function sendPasswordRecovery(string $email) {
|
||||||
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`userID`,
|
||||||
|
`username`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`email` = :email
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":email", $email);
|
||||||
|
$stmt->execute();
|
||||||
|
if (!$stmt->rowCount()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$result = $stmt->fetch();
|
||||||
|
$userID = $result["userID"];
|
||||||
|
$username = $result["username"];
|
||||||
|
$hash = md5(random_int(0, 1000000));
|
||||||
|
$hashedHash = password_hash($hash, PASSWORD_DEFAULT);
|
||||||
|
setHashToDatabase($userID, $hash);
|
||||||
|
doSendPasswordRecovery($userID, $email, $username, $hashedHash);
|
||||||
|
} else {
|
||||||
|
// TODO: Be angry!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doSendPasswordRecovery(int $userID, string $email, string $username, string $hash) {
|
||||||
|
$resetLink = "https://myhyvesbookplus.nl/resetpassword.php?u=$userID&h=$hash";
|
||||||
|
|
||||||
|
$subject = "Reset uw wachtwoord";
|
||||||
|
$body = "Hallo $username,\r\n\r\nKlik op de onderstaande link om uw wachtwoord te resetten.\r\n\r\n$resetLink\r\n\r\nGroeten MyHyvesbook+";
|
||||||
|
$header = "From: MyHyvesbook+ <noreply@myhyvesbookplus.nl>";
|
||||||
|
mail($email, $subject, $body, $header);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHashToDatabase(int $userID, string $hash) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`password` = :hash
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":hash", $hash);
|
||||||
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
}
|
||||||
@@ -323,7 +323,10 @@ function searchSomeUsers($n, $m, $search)
|
|||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`username`,
|
`username`,
|
||||||
`profilepicture`,
|
IFNULL(
|
||||||
|
`profilepicture`,
|
||||||
|
'../img/notbad.jpg'
|
||||||
|
) AS profilepicture,
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`
|
`lname`
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
// Set default values of a friend.
|
// Set default values of a friend.
|
||||||
$username = $friend["username"];
|
$username = $friend["username"];
|
||||||
$name = $friend["name"];
|
$name = $friend["fullname"];
|
||||||
$userID = $friend["userID"];
|
$userID = $friend["userID"];
|
||||||
$pf = "img/avatar-standard.png";
|
$pf = "img/avatar-standard.png";
|
||||||
|
|
||||||
@@ -37,9 +37,8 @@
|
|||||||
</li>
|
</li>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
if (isset($_GET["username"]) && $_GET["username"] != "") {
|
||||||
$chatID = $_GET["chatID"];
|
$chatID = $_GET["username"];
|
||||||
if (isset($chatID) && $chatID != "") {
|
|
||||||
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
|
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<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>
|
||||||
|
<script src="js/main.js"></script>
|
||||||
<script src="js/header.js"></script>
|
<script src="js/header.js"></script>
|
||||||
<script src="js/menu.js"></script>
|
<script src="js/menu.js"></script>
|
||||||
<script src="js/notifications.js"></script>
|
<script src="js/notifications.js"></script>
|
||||||
|
|||||||
@@ -7,8 +7,9 @@
|
|||||||
<h1>Welkom bij MyHyvesbook+</h1>
|
<h1>Welkom bij MyHyvesbook+</h1>
|
||||||
<!-- Login content -->
|
<!-- Login content -->
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
return= $correct
|
return=$correct
|
||||||
method="post">
|
method="post"
|
||||||
|
name="login">
|
||||||
|
|
||||||
<!-- Login name -->
|
<!-- Login name -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
@@ -37,15 +38,79 @@
|
|||||||
<!-- Button for logging in -->
|
<!-- Button for logging in -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
value="Login"
|
value="login"
|
||||||
name="submit"
|
name="submit"
|
||||||
id="frm1_submit">
|
id="frm1_submit">
|
||||||
Login
|
Inloggen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Button for going to the register screen -->
|
<!-- Button for going to the register screen -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
|
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
|
||||||
|
|
||||||
|
<!-- Trigger/Open The Modal -->
|
||||||
|
<button id="myBtn" class="button">Wachtwoord vergeten</button>
|
||||||
|
|
||||||
|
<!-- The Modal -->
|
||||||
|
<div id="myModal" class="modal">
|
||||||
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
|
return= $correct
|
||||||
|
method="post"
|
||||||
|
name="forgotPassword">
|
||||||
|
|
||||||
|
<!-- Modal content -->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<span class="close">×</span>
|
||||||
|
<h3>Voer uw emailadres in</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Voer uw email in"
|
||||||
|
name="forgotEmail"
|
||||||
|
title="Voer een email in">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
||||||
|
<button type="submit"
|
||||||
|
value="reset"
|
||||||
|
name="submit"
|
||||||
|
id="frm1_submit">
|
||||||
|
Reset password
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<script>
|
||||||
|
// Get the modal
|
||||||
|
var modal = document.getElementById('myModal');
|
||||||
|
|
||||||
|
// Get the button that opens the modal
|
||||||
|
var btn = document.getElementById("myBtn");
|
||||||
|
|
||||||
|
// Get the <span> element that closes the modal
|
||||||
|
var span = document.getElementsByClassName("close")[0];
|
||||||
|
|
||||||
|
// When the user clicks the button, open the modal
|
||||||
|
btn.onclick = function() {
|
||||||
|
modal.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the user clicks on <span> (x), close the modal
|
||||||
|
span.onclick = function() {
|
||||||
|
modal.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the user clicks anywhere outside of the modal, close it
|
||||||
|
window.onclick = function(event) {
|
||||||
|
if (event.target == modal) {
|
||||||
|
modal.style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
type="text/css"
|
type="text/css"
|
||||||
href="styles/index.css">
|
href="styles/index.css">
|
||||||
<script src="js/jqeury.js"></script>
|
<script src="js/jquery.js"></script>
|
||||||
<script src="js/registerAndLogin.js"></script>
|
<script src="js/registerAndLogin.js"></script>
|
||||||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,134 +1,25 @@
|
|||||||
<nav class="menu">
|
<nav class="menu">
|
||||||
<section id="friends-menu-section">
|
<section id="friends-menu-section">
|
||||||
<?php
|
<h4>
|
||||||
|
Vrienden
|
||||||
// Load file.
|
</h4>
|
||||||
require_once("../queries/friendship.php");
|
<ul id="menu-friends-list" class="nav-list">
|
||||||
require_once("../queries/user.php");
|
</ul>
|
||||||
|
<h4><form action="search.php">
|
||||||
// Get confirmed friends of the user and a random non-friend.
|
<input type="hidden"
|
||||||
$friends = selectAllFriends($_SESSION["userID"])->fetchAll();
|
value="friends"
|
||||||
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
|
name="filter" />
|
||||||
$i = 0;
|
<button value=""
|
||||||
|
name="search">
|
||||||
if (sizeof($friends) == 0) {
|
Alle vrienden...
|
||||||
echo "
|
</button>
|
||||||
<ul class=\"nav-list\"><li class='friend-item'>
|
</form></h4>
|
||||||
<form action='profile.php' method='get'>
|
|
||||||
<button type='submit'
|
|
||||||
name='username'
|
|
||||||
value='$randomUser'>
|
|
||||||
<div class='friend'>
|
|
||||||
Maak nieuwe vrienden :)
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</li><ul class=\"nav-list\">
|
|
||||||
";
|
|
||||||
} else {
|
|
||||||
echo "
|
|
||||||
<h4>
|
|
||||||
Vrienden
|
|
||||||
</h4>
|
|
||||||
<ul class=\"nav-list\">
|
|
||||||
";
|
|
||||||
|
|
||||||
foreach ($friends as $i => $friend) {
|
|
||||||
$username = $friend["username"];
|
|
||||||
$name = $friend["name"];
|
|
||||||
$extraItem = "";
|
|
||||||
$pf = $friend["profilepicture"];
|
|
||||||
|
|
||||||
if ($i >= 5)
|
|
||||||
$extraItem = "extra-menu-items";
|
|
||||||
|
|
||||||
echo "
|
|
||||||
<li class='friend-item $extraItem'>
|
|
||||||
<form action='profile.php' method='get'>
|
|
||||||
<button type='submit'
|
|
||||||
name='username'
|
|
||||||
value='$username'>
|
|
||||||
<div class='friend'>
|
|
||||||
<img alt='PF' class='profile-picture' src='$pf'/>
|
|
||||||
<div class='friend-name'>
|
|
||||||
$name<br/>
|
|
||||||
<span style='color: #666'>$username</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof($friends) > 5) {
|
|
||||||
echo "
|
|
||||||
<li class='more-item' id='more-friends-click'>
|
|
||||||
Meer vrienden..
|
|
||||||
</li>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</section>
|
</section>
|
||||||
<section id="groups-menu-section">
|
<section id="groups-menu-section">
|
||||||
<?php
|
<h4>
|
||||||
|
Groepen
|
||||||
// Load file.
|
</h4>
|
||||||
require_once("../queries/group_member.php");
|
<ul id="menu-groups-list" class="nav-list">
|
||||||
|
|
||||||
// Get all the friends of a user.
|
|
||||||
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
|
|
||||||
|
|
||||||
if (sizeof($groups) > 0) {
|
|
||||||
echo "
|
|
||||||
<h4>
|
|
||||||
Groepen
|
|
||||||
</h4>
|
|
||||||
<ul class=\"nav-list\">
|
|
||||||
";
|
|
||||||
|
|
||||||
foreach ($groups as $i => $group) {
|
|
||||||
// Set default values of a friend.
|
|
||||||
$name = $group["name"];
|
|
||||||
$extraItem = "";
|
|
||||||
$picture = $group["picture"];
|
|
||||||
|
|
||||||
// Change values if needed.
|
|
||||||
if ($i > 3)
|
|
||||||
$extraItem = "extra-menu-items";
|
|
||||||
|
|
||||||
echo "
|
|
||||||
<li class='group-item $extraItem'>
|
|
||||||
<form action='group.php' method='get'>
|
|
||||||
<button type='submit'
|
|
||||||
name='groupname'
|
|
||||||
value='$name'>
|
|
||||||
<div class='group'>
|
|
||||||
<img alt='PF' class='group-picture' src='$picture'/>
|
|
||||||
$name
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof($groups) > 3) {
|
|
||||||
echo "
|
|
||||||
<li class='more-item' id='more-groups-click'>
|
|
||||||
Meer groepen..
|
|
||||||
</li>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<ul>
|
|
||||||
<li class="more-item" id="menu-back">
|
|
||||||
Terug naar het overzicht
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</nav>
|
</nav>
|
||||||
23
website/views/messagepage.php
Normal file
23
website/views/messagepage.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
function messagePage(string $content) {
|
||||||
|
$webpage = ("
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
@import url(styles/main.css);
|
||||||
|
@import url(styles/settings.css);
|
||||||
|
@import url(styles/resetpassword.css);
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class='password-change'>
|
||||||
|
<div class='top-logo'><a href='login.php'><img src='img/top-logo.png' alt='MyHyvesbook+'/></a></div>
|
||||||
|
<div class='item-box platform'>$content</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
");
|
||||||
|
|
||||||
|
echo $webpage;
|
||||||
|
}
|
||||||
@@ -5,19 +5,19 @@
|
|||||||
<a href="profile.php"><i class="fa fa-user" data-title="Profiel"></i></a>
|
<a href="profile.php"><i class="fa fa-user" data-title="Profiel"></i></a>
|
||||||
<a href="logout.php"><i class="fa fa-sign-out" data-title="Uitloggen"></i></a>
|
<a href="logout.php"><i class="fa fa-sign-out" data-title="Uitloggen"></i></a>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section id="friend-request-section">
|
||||||
<h4>
|
<h4>
|
||||||
Vriendchapsverzoeken
|
Vriendchapsverzoeken
|
||||||
</h4>
|
</h4>
|
||||||
<ul class="nav-list" id="friendrequestslist">
|
<ul class="nav-list" id="friend-requests-list">
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section id="unread-messages-section">
|
||||||
<h4>
|
<h4>
|
||||||
Nieuwe berichten
|
Nieuwe berichten
|
||||||
</h4>
|
</h4>
|
||||||
<ul class="nav-list" id="unreadChatlist">
|
<ul class="nav-list" id="unread-chat-list">
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
52
website/views/post-view.php
Normal file
52
website/views/post-view.php
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
$postID = $_GET['postID'];
|
||||||
|
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
|
||||||
|
|
||||||
|
echo("
|
||||||
|
<div class='post-header header'>
|
||||||
|
<h4>" . $post['title'] . "</h4>
|
||||||
|
<span class='postinfo'>
|
||||||
|
gepost door $fullname,
|
||||||
|
<span class='posttime' title='" . $post['creationdate'] . "'>
|
||||||
|
" . nicetime($post['creationdate']) . "
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='post-content'>
|
||||||
|
<p>" . $post['content'] . "</p>
|
||||||
|
</div>
|
||||||
|
"); ?>
|
||||||
|
|
||||||
|
<div class='post-comments'>
|
||||||
|
<div class="commentfield">
|
||||||
|
<form name="newcomment" method="post">
|
||||||
|
<textarea placeholder="Laat een reactie achter..."></textarea> <br>
|
||||||
|
<input type="submit" value="Reageer!">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$q = selectCommentsByPostId($postID);
|
||||||
|
while($comment = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$commentauthor = $comment['fname'] . " " . $comment['lname'] . " (" . $comment['username'] . ")";
|
||||||
|
$commentdate = $comment['creationdate'];
|
||||||
|
$commentnicetime = nicetime($commentdate);
|
||||||
|
$commentcontent = $comment['content'];
|
||||||
|
|
||||||
|
echo("
|
||||||
|
<div class='comment'>
|
||||||
|
<div class='commentinfo'>
|
||||||
|
$commentauthor
|
||||||
|
<span class='commentdate', title='$commentdate'>
|
||||||
|
$commentnicetime
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class='commentcontent'>
|
||||||
|
$commentcontent
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
");
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
|
|
||||||
<!-- --><?php
|
<!-- --><?php
|
||||||
// if ($_SESSION["userID"] === $userID) {
|
// if ($_SESSION["userID"] === $userID) {
|
||||||
// ?>
|
// ?>
|
||||||
@@ -67,5 +68,47 @@
|
|||||||
// ";
|
// ";
|
||||||
// }
|
// }
|
||||||
// ?>
|
// ?>
|
||||||
|
<!-- --><?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">
|
||||||
|
<div class="modal-content platform">
|
||||||
|
<div class="modal-close">
|
||||||
|
×
|
||||||
|
</div>
|
||||||
|
<div class="modal-response" id="modal-response">
|
||||||
|
<span class="modal-default">Aan het laden...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
<!-- Button for registering -->
|
<!-- Button for registering -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<!-- Button for going back to login screen -->
|
<!-- Button for going back to login screen -->
|
||||||
<a href="https://myhyvesbookplus.nl/login.php" class="left-arrow">Login</a>
|
<a href="https://myhyvesbookplus.nl/login.php" class="button">Annuleren</a>
|
||||||
|
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
value="Registreer uw account"
|
value="Registreer uw account"
|
||||||
|
|||||||
38
website/views/resetpassword.php
Normal file
38
website/views/resetpassword.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
function passwordResetFields() {
|
||||||
|
$username = $_GET['u'];
|
||||||
|
$hash = $_GET['h'];
|
||||||
|
$content ="
|
||||||
|
<form class='settings' method = 'post' >
|
||||||
|
<h5 > Voer een nieuw wachtwoord in </h5 >
|
||||||
|
<input type = 'hidden'
|
||||||
|
name = 'u'
|
||||||
|
value = '$username'
|
||||||
|
>
|
||||||
|
<input type = 'hidden'
|
||||||
|
name = 'h'
|
||||||
|
value = '$hash'
|
||||||
|
>
|
||||||
|
<ul >
|
||||||
|
<li >
|
||||||
|
<label > Nieuw wachtwoord </label >
|
||||||
|
<input type = 'password'
|
||||||
|
name = 'password'
|
||||||
|
placeholder = 'Nieuw wachtwoord'
|
||||||
|
>
|
||||||
|
</li >
|
||||||
|
<li >
|
||||||
|
<label > Bevestig wachtwoord </label >
|
||||||
|
<input type = 'password'
|
||||||
|
name = 'password-confirm'
|
||||||
|
placeholder = 'Bevestig wachtwoord'
|
||||||
|
>
|
||||||
|
</li >
|
||||||
|
<li >
|
||||||
|
<label ></label >
|
||||||
|
<button type = 'submit' > Verander wachtwoord </button >
|
||||||
|
</li >
|
||||||
|
</ul >
|
||||||
|
</form >";
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
@@ -38,7 +38,7 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
</label>
|
</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
name="search"
|
name="search"
|
||||||
placeholder="zoek"
|
placeholder="Zoek"
|
||||||
value=<?php echo "$search";?>
|
value=<?php echo "$search";?>
|
||||||
>
|
>
|
||||||
<label for="filter">
|
<label for="filter">
|
||||||
|
|||||||
Reference in New Issue
Block a user