Merge branch 'master' into lars
This commit is contained in:
27
website/public/API/editFriendship.php
Normal file
27
website/public/API/editFriendship.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
if(empty($_POST["usr"]) OR empty($_POST["action"]) OR !in_array($_POST["action"], array("request", "accept", "delete"))) {
|
||||||
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
}
|
||||||
|
|
||||||
|
$friendship_status = getFriendshipStatus($_POST["usr"]);
|
||||||
|
|
||||||
|
if($_POST["action"] == "request" AND $friendship_status == 0) {
|
||||||
|
if (!requestFriendship($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Query (request) failed');
|
||||||
|
}
|
||||||
|
} else if($_POST["action"] == "delete" AND in_array($friendship_status, array(1, 2, 3))) {
|
||||||
|
if (!removeFriendship($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Query (delete) failed');
|
||||||
|
}
|
||||||
|
} else if ($_POST["action"] == "accept" AND $friendship_status == 3) {
|
||||||
|
if (!acceptFriendship($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Query (accept) failed');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('HTTP/1.1 500 Not the right friendship status');
|
||||||
|
}
|
||||||
24
website/public/API/getFriendshipStatus.php
Normal file
24
website/public/API/getFriendshipStatus.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
# -2: Query failed.
|
||||||
|
# -1: user1 and 2 are the same user
|
||||||
|
# 0 : no record found
|
||||||
|
# 1 : confirmed
|
||||||
|
# 2 : user1 sent request (you)
|
||||||
|
# 3 : user2 sent request (other)
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
if(empty($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
}
|
||||||
|
|
||||||
|
$friendship_status = getFriendshipStatus($_POST["usr"]);
|
||||||
|
|
||||||
|
if($friendship_status == -2) {
|
||||||
|
header('HTTP/1.1 500 Query failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $friendship_status;
|
||||||
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";
|
||||||
|
}
|
||||||
27
website/public/js/friendButtons.js
Normal file
27
website/public/js/friendButtons.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
function placeFriendButtons() {
|
||||||
|
$.post("API/getFriendshipStatus.php", { usr: userID })
|
||||||
|
.done(function(data) {
|
||||||
|
friendshipStatus = data;
|
||||||
|
$buttonContainer = $("div.friend-button-container");
|
||||||
|
$buttonContainer.children().remove();
|
||||||
|
if (friendshipStatus == -1) {
|
||||||
|
return;
|
||||||
|
} else if(friendshipStatus == 0) {
|
||||||
|
$buttonContainer.append($("<button class=\"green friend-button\" value=\"request\"><i class=\"fa fa-handshake-o\"></i> Bevriend</button>"));
|
||||||
|
} else if(friendshipStatus == 1) {
|
||||||
|
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Verwijder</button>"));
|
||||||
|
} else if(friendshipStatus == 2) {
|
||||||
|
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Trek verzoek in</button>"));
|
||||||
|
} else if(friendshipStatus == 3) {
|
||||||
|
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Weiger</button>"));
|
||||||
|
$buttonContainer.append($("<button class=\"green friend-button\" value=\"accept\"><i class=\"fa fa-check\"></i> Accepteer</button>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$buttonContainer.children().click(function() {
|
||||||
|
$.post("API/editFriendship.php", { usr: userID, action: this.value })
|
||||||
|
.done(function() {
|
||||||
|
placeFriendButtons();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,5 +1,30 @@
|
|||||||
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(post) {
|
||||||
|
$(".modal").show();
|
||||||
|
$.get(
|
||||||
|
"API/loadPost.php",
|
||||||
|
$(post).children("form").serialize()
|
||||||
|
).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() {
|
$(window).on("load", function() {
|
||||||
console.log("LOADED");
|
console.log("LOADED");
|
||||||
container = $("div.posts");
|
container = $("div.posts");
|
||||||
@@ -69,8 +94,14 @@ function mansonry() {
|
|||||||
column = $('<div class="column"></div>').append(columns[i][1]);
|
column = $('<div class="column"></div>').append(columns[i][1]);
|
||||||
console.log(column);
|
console.log(column);
|
||||||
container.append(column);
|
container.append(column);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div.posts div.column").width(100/columnCount + "%");
|
$("div.posts div.column").width(100/columnCount + "%");
|
||||||
|
|
||||||
|
$(".modal-close").click(function () {
|
||||||
|
$(".modal").hide();
|
||||||
|
scrollbarMargin(0, 'auto');
|
||||||
|
$('#modal-response').hide();
|
||||||
|
$('.modal-default').show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
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") {
|
||||||
|
switch ($_POST["submit"]) {
|
||||||
|
case "login":
|
||||||
try {
|
try {
|
||||||
$uname = ($_POST["uname"]);
|
$uname = ($_POST["uname"]);
|
||||||
validateLogin($_POST["uname"], $_POST["psw"]);
|
validateLogin($_POST["uname"], $_POST["psw"]);
|
||||||
} catch(loginException $e) {
|
} catch(loginException $e) {
|
||||||
$loginErr = $e->getMessage();
|
$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,9 +2,11 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<?php include("../views/head.php"); ?>
|
<?php include("../views/head.php"); ?>
|
||||||
<script src="/js/masonry.js"></script>
|
<script src="js/masonry.js"></script>
|
||||||
|
<!-- <script src="js/profile.js"></script>-->
|
||||||
<style>
|
<style>
|
||||||
@import url("styles/profile.css");
|
@import url("styles/profile.css");
|
||||||
|
@import url("styles/post-popup.css");
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -12,6 +14,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"];
|
||||||
@@ -24,6 +27,13 @@ $profile_friends = selectAllFriends($userID);
|
|||||||
$profile_groups = selectAllUserGroups($userID);
|
$profile_groups = selectAllUserGroups($userID);
|
||||||
$posts = selectAllUserPosts($userID);
|
$posts = selectAllUserPosts($userID);
|
||||||
|
|
||||||
|
|
||||||
|
if ($userID == $_SESSION["userID"]) {
|
||||||
|
$friendship_status = -1;
|
||||||
|
} else {
|
||||||
|
$friendship_status = $user["friend_status"];
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This view adds the main layout over the screen.
|
* This view adds the main layout over the screen.
|
||||||
* Header, menu, footer.
|
* Header, menu, footer.
|
||||||
@@ -36,5 +46,13 @@ include("../views/profile.php");
|
|||||||
/* This adds the footer. */
|
/* This adds the footer. */
|
||||||
include("../views/footer.php");
|
include("../views/footer.php");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<script src="js/friendButtons.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
userID = <?= $userID ?>;
|
||||||
|
placeFriendButtons();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
49
website/public/resetpassword.php
Normal file
49
website/public/resetpassword.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
include_once("../queries/connect.php");
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||||
|
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||||
|
if (verifyLink($_GET["u"], $_GET["h"])) {
|
||||||
|
include "../views/resetpassword.php";
|
||||||
|
} else {
|
||||||
|
echo "Ongeldige link.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Ongeldige link";
|
||||||
|
}
|
||||||
|
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
if (verifyLink($_POST["u"], $_POST["h"])) {
|
||||||
|
if ($_POST["password"] == $_POST["password-confirm"]) {
|
||||||
|
changePassword();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Ongeldige link";
|
||||||
|
}
|
||||||
|
|
||||||
|
function changePassword() {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`password` = :password
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":password", $_POST["password"]);
|
||||||
|
$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);
|
||||||
|
$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;
|
||||||
|
}
|
||||||
@@ -175,6 +175,15 @@ textarea:focus, input:focus, select:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* All buttons */
|
/* All buttons */
|
||||||
|
button.red {
|
||||||
|
background-color: firebrick;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.green {
|
||||||
|
background-color: forestgreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
button,
|
button,
|
||||||
input[type="submit"],
|
input[type="submit"],
|
||||||
input[type="reset"] {
|
input[type="reset"] {
|
||||||
|
|||||||
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%;
|
||||||
|
}
|
||||||
@@ -78,17 +78,16 @@ div.posts .post form textarea.newpost {
|
|||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input.profile-button {
|
button.friend-button {
|
||||||
float: right;
|
float: right;
|
||||||
height: auto;
|
height: auto;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
background-color: #4CAF50;
|
|
||||||
color: #FFFFFF;
|
|
||||||
transition-duration: 250ms;
|
transition-duration: 250ms;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-button:hover {
|
button.friend-button:hover {
|
||||||
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
|
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
|
||||||
}
|
}
|
||||||
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"]) {
|
||||||
|
|||||||
@@ -105,6 +105,16 @@ function selectAllFriendRequests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getFriendshipStatus($userID) {
|
function getFriendshipStatus($userID) {
|
||||||
|
# -2: Query failed.
|
||||||
|
# -1: user1 and 2 are the same user
|
||||||
|
# 0 : no record found
|
||||||
|
# 1 : confirmed
|
||||||
|
# 2 : user1 sent request (you)
|
||||||
|
# 3 : user2 sent request (other)
|
||||||
|
if($_SESSION["userID"] == $userID) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
CASE `status` IS NULL
|
CASE `status` IS NULL
|
||||||
@@ -131,8 +141,10 @@ function getFriendshipStatus($userID) {
|
|||||||
|
|
||||||
$stmt->bindParam(':me', $_SESSION["userID"], PDO::PARAM_INT);
|
$stmt->bindParam(':me', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
$stmt->bindParam(':other', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':other', $userID, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
if(!$stmt->execute()) {
|
||||||
return $stmt->fetch()["friend_state"];
|
return -2;
|
||||||
|
}
|
||||||
|
return intval($stmt->fetch()["friend_state"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestFriendship($userID) {
|
function requestFriendship($userID) {
|
||||||
@@ -143,7 +155,7 @@ function requestFriendship($userID) {
|
|||||||
|
|
||||||
$stmt->bindParam(':user1', $_SESSION["userID"], PDO::PARAM_INT);
|
$stmt->bindParam(':user1', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
$stmt->bindParam(':user2', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':user2', $userID, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeFriendship($userID) {
|
function removeFriendship($userID) {
|
||||||
@@ -154,11 +166,12 @@ function removeFriendship($userID) {
|
|||||||
`user2ID` = :user2 OR
|
`user2ID` = :user2 OR
|
||||||
`user1ID` = :user2 AND
|
`user1ID` = :user2 AND
|
||||||
`user2ID` = :user1
|
`user2ID` = :user1
|
||||||
|
LIMIT 1
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':user1', $_SESSION["userID"], PDO::PARAM_INT);
|
$stmt->bindParam(':user1', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
$stmt->bindParam(':user2', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':user2', $userID, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
function acceptFriendship($userID) {
|
function acceptFriendship($userID) {
|
||||||
@@ -173,7 +186,7 @@ function acceptFriendship($userID) {
|
|||||||
|
|
||||||
$stmt->bindParam(':user1', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':user1', $userID, PDO::PARAM_INT);
|
||||||
$stmt->bindParam(':user2', $_SESSION["userID"], PDO::PARAM_INT);
|
$stmt->bindParam(':user2', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLastVisited($friend) {
|
function setLastVisited($friend) {
|
||||||
|
|||||||
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();
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
55
website/queries/requestpassword.php
Normal file
55
website/queries/requestpassword.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?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()) {
|
||||||
|
// TODO: Just stop.
|
||||||
|
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->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
}
|
||||||
@@ -108,7 +108,7 @@ function selectAllUserPosts($userID) {
|
|||||||
`postID`,
|
`postID`,
|
||||||
`author`,
|
`author`,
|
||||||
`title`,
|
`title`,
|
||||||
CASE LENGTH(`content`) >= 150
|
CASE LENGTH(`content`) >= 150 AND `content` NOT LIKE '<img%'
|
||||||
WHEN TRUE THEN
|
WHEN TRUE THEN
|
||||||
CONCAT(LEFT(`content`, 150), '...')
|
CONCAT(LEFT(`content`, 150), '...')
|
||||||
WHEN FALSE THEN
|
WHEN FALSE THEN
|
||||||
@@ -321,7 +321,10 @@ function searchSomeUsers($n, $m, $search)
|
|||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`username`,
|
`username`,
|
||||||
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
|
'../img/notbad.jpg'
|
||||||
|
) AS profilepicture,
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`
|
`lname`
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
<!-- 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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</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>
|
||||||
|
|||||||
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>
|
||||||
@@ -2,21 +2,10 @@
|
|||||||
<div class="profile-box platform">
|
<div class="profile-box platform">
|
||||||
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
|
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
|
||||||
|
|
||||||
<form action="API/edit_friendship.php" method="post">
|
<div class="friend-button-container">
|
||||||
<input type="hidden" name="userID" value="<?= $userID ?>">
|
|
||||||
<?php
|
</div>
|
||||||
if($userID != $_SESSION["userID"] AND $user["friend_status"] == 0) {
|
|
||||||
echo "<input class='profile-button' type='submit' name='request' value='Stuur vriendschapsverzoek!'>";
|
|
||||||
} else if($user["friend_status"] == 1) {
|
|
||||||
echo "<input class='profile-button' type='submit' name='delete' value='Verwijder vriend!'>";
|
|
||||||
} else if($user["friend_status"] == 2) {
|
|
||||||
echo "<input class='profile-button' type='submit' name='accept' value='Accepteer vriendschapsverzoek!'>";
|
|
||||||
echo "<input class='profile-button' type='submit' name='delete' value='Weiger vriendschapsverzoek!'>";
|
|
||||||
} else if($user["friend_status"] == 3) {
|
|
||||||
echo "<input class='profile-button' type='submit' name='delete' value='Trek vriendschapsverzoek in!'>";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</form>
|
|
||||||
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h1>
|
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h1>
|
||||||
<h5 class="profile-username"><?=$user["username"]?></h5>
|
<h5 class="profile-username"><?=$user["username"]?></h5>
|
||||||
<p><?=$user["bio"]?></p>
|
<p><?=$user["bio"]?></p>
|
||||||
@@ -69,14 +58,32 @@
|
|||||||
|
|
||||||
while($post = $posts->fetch()) {
|
while($post = $posts->fetch()) {
|
||||||
$nicetime = nicetime($post["creationdate"]);
|
$nicetime = nicetime($post["creationdate"]);
|
||||||
|
$postID = $post["postID"];
|
||||||
echo "
|
echo "
|
||||||
<div class='post platform'>
|
<div class='post platform' onclick='requestPost(this)'>
|
||||||
<h2>${post["title"]}</h2>
|
<h2>${post["title"]}</h2>
|
||||||
<p>${post["content"]}</p>
|
<p>${post["content"]}</p>
|
||||||
<p class=\"subscript\">${nicetime} geplaatst.</p>
|
<p class=\"subscript\" title='" . $post["creationdate"] ."'>${nicetime} geplaatst.</p>
|
||||||
|
<form>
|
||||||
|
<input type='hidden'
|
||||||
|
name='postID'
|
||||||
|
value='$postID'
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</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>
|
||||||
@@ -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"
|
||||||
|
|||||||
47
website/views/resetpassword.php
Normal file
47
website/views/resetpassword.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<!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"><img src="img/top-logo.png" alt="MyHyvesbook+"/></div>
|
||||||
|
|
||||||
|
<form class='settings platform item-box' method='post'>
|
||||||
|
<h5>Voer een nieuw wachtwoord in</h5>
|
||||||
|
<input type="hidden"
|
||||||
|
name="u"
|
||||||
|
value="<?=$_GET["u"]?>"
|
||||||
|
>
|
||||||
|
<input type="hidden"
|
||||||
|
name="h"
|
||||||
|
value="<?=$_GET["h"]?>"
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -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