Merge branch 'master' into hendrik-testing

This commit is contained in:
Hendrik
2017-01-30 16:34:40 +01:00
42 changed files with 583 additions and 376 deletions

View File

@@ -1,7 +1,7 @@
Options +FollowSymLinks
RewriteEngine On
ErrorDocument 404 /error404.jpg
ErrorDocument 404 /error/404.php
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

View File

@@ -1,13 +1,17 @@
<?php
if(empty($_POST["usr"])) {
if(empty($_POST["usr"]) and empty($_POST["grp"])) {
header('HTTP/1.1 500 Non enough arguments');
}
require_once ("../../queries/user.php");
require_once ("../../queries/post.php");
require_once ("../../queries/nicetime.php");
$posts = selectAllUserPosts($_POST["usr"]);
if(empty($_POST["usr"])) {
$posts = selectAllPosts(0, $_POST["grp"]);
} else {
$posts = selectAllPosts($_POST["usr"], 0);
}
if(!$posts) {
header('HTTP/1.1 500 Query failed');
@@ -19,6 +23,4 @@ for($i = 0; $i < sizeof($results); $i++) {
$results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]);
}
//$results[0]["niceTime"] = nicetime($results[0]["creationdate"]);
echo json_encode($results);

View File

@@ -5,7 +5,7 @@ require_once ("../queries/connect.php");
require_once ("../queries/checkInput.php");
function getNietSlechtCountForPost(int $postID) : int {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`
FROM
@@ -19,7 +19,7 @@ function getNietSlechtCountForPost(int $postID) : int {
}
function getNietSlechtUsersForPost(int $postID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`fname`,
`lname`,

View File

@@ -3,7 +3,7 @@
session_start();
require("../../queries/post.php");
require("../../queries/connect.php");
require_once("../../queries/connect.php");
require("../../queries/checkInput.php");
print_r($_POST);
if ($_POST['button'] == 'reaction') {

View File

@@ -2,7 +2,7 @@
include_once("../queries/connect.php");
include_once("../views/messagepage.php");
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
$checkHash = $GLOBALS["db"]->prepare("
$checkHash = prepareQuery("
SELECT
`email`,
`role`
@@ -28,7 +28,7 @@ if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
function doActivate(string $email) {
if (password_verify($email, $_GET["h"])) {
$confirmUser = $GLOBALS["db"]->prepare("
$confirmUser = prepareQuery("
UPDATE
`user`
SET

View File

@@ -0,0 +1,9 @@
<?php
require_once "../../views/messagepage.php";
messagePage("
<div class='error-page'>
<h1>404</h1>
<h4>Verkeerde link...</h4><br />
<img height='25%' width='25%' src='../img/zelda.png'>
</div>");

View File

@@ -4,6 +4,8 @@
<?php include("../views/head.php"); ?>
<style>
@import url("styles/profile.css");
@import url("styles/post-popup.css");
@import url('https://fonts.googleapis.com/css?family=Anton');
</style>
</head>
<body>
@@ -30,6 +32,20 @@ include("../views/group.php");
/* This adds the footer. */
include("../views/footer.php");
$masonry_mode = 0;
?>
<script src="js/masonry.js"></script>
<script src="js/post.js"></script>
<script>
$(document).ready(function() {
userID = 0;
groupID = <?= $group["groupID"] ?>;
masonry(<?= $masonry_mode ?>);
});
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

View File

@@ -1,25 +1,31 @@
var previousDate = new Date("1970-01-01 00:00:00");
var previousTime = "00:00";
var gettingMessages = false;
var previousType = "robot";
$(document).ready(function() {
loadMessages();
setInterval(loadMessages, 1000);
sayEmpty();
$(".chat-field").hide();
});
function loadMessages() {
$.post(
"API/loadMessages.php",
$("#lastIDForm").serialize()
).done(function(data) {
if (data && data != "[]") {
messages = JSON.parse(data);
addMessages(messages);
$("#lastID").val(messages[messages.length - 1].messageID);
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight);
}
});
setTimeout(loadMessages, 1000);
if (!gettingMessages) {
gettingMessages = true;
$.post(
"API/loadMessages.php",
$("#lastIDForm").serialize()
).done(function (data) {
if (data && data != "[]") {
messages = JSON.parse(data);
addMessages(messages);
$("#lastID").val(messages[messages.length - 1].messageID);
}
gettingMessages = false;
});
} else {
setTimeout(loadMessages, 500);
}
}
@@ -30,35 +36,55 @@ function sendMessage() {
);
$("#newContent").val("");
loadMessages();
}
function addMessages(messages) {
var messagesText = "";
for(var i in messages) {
thisDate = new Date(messages[i].creationdate);
// Initialize message variables
var thisDate = new Date(messages[i].creationdate);
var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes();
var type;
thisDate.setHours(0,0,0,0);
if (messages[i].destination == $(".destinationID").val()) {
type = "chat-message-self";
} else {
type = "chat-message-other";
}
if (thisDate > previousDate) {
if (i == 0) {
messagesText += '<div class="chat-message"><div class="' + type + '">';
} else if (type != previousType || thisTime != previousTime || thisDate > previousDate) {
messagesText += '<div class="chat-time">\
' + thisTime + '\
</div></div></div>';
previousDate = thisDate;
$("#chat-history").append('\
<div class="day-message"> \
<div class="day-message-content">\
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div> \
</div>\
');
previousTime = thisTime;
previousType = type;
if (thisDate > previousDate) {
messagesText += '\
<div class="day-message"> \
<div class="day-message-content">\
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div> \
</div>';
}
messagesText += '<div class="chat-message"><div class="' + type + '">';
}
$("#chat-history").append('\
<div class="chat-message"> \
<div class="' + type + '">\
' + fancyText(messages[i].content) + '\
</div> \
</div>\
');
messagesText += fancyText(messages[i].content) + "<br />";
}
// Close the last message
messagesText += '<div class="chat-time">\
' + thisTime + '\
</div></div></div>';
$("#chat-history").append(messagesText);
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight - $('#chat-history')[0].clientHeight);
}
function switchUser(userID) {
@@ -72,5 +98,5 @@ function switchUser(userID) {
}
function sayEmpty() {
$("#chat-history").html("Begin nu met chatten!");
$("#chat-history").html("Probeer ook eens foto's en video's te sturen");
}

View File

@@ -1,26 +1,73 @@
function placeFriendButtons() {
$.post("API/getFriendshipStatus.php", { usr: userID })
.done(function(data) {
friendshipStatus = data;
$buttonContainer = $("div.friend-button-container");
$buttonContainer.children().remove();
$("#start-profile-chat-form").hide();
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>"));
$("#start-profile-chat-form").show();
} 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>"));
}
var friendshipStatus = data;
var $buttonContainer = $("div.friend-button-container");
$("#start-profile-chat").hide();
$buttonContainer.html("");
var value1 = "";
var class1 = "empty-button";
var icon1 = "";
var text1 = "";
var value2 = "";
var class2 = "empty-button";
var icon2 = "";
var text2 = "";
switch (friendshipStatus) {
case "0":
value1 = "request";
class1 = "green";
text1 = "Bevriend";
icon1 = "fa-handshake-o";
break;
case "1":
value1 = userID;
class1 = "green";
text1 = "Chat";
icon1 = "fa-comment-o";
value2 = "delete";
class2 = "red";
text2 = "Verwijder";
icon2 = "fa-times";
break;
case "2":
value1 = "delete";
class1 = "red";
text1 = "Trek verzoek in";
icon1 = "fa-cross";
break;
case "3":
value1 = "accept";
class1 = "green";
text1 = "Accepteer";
icon1 = "fa-check";
value2 = "delete";
class2 = "red";
text2 = "Weiger";
icon2 = "fa-times";
break;
default:
console.log(friendshipStatus);
break;
}
$buttonContainer.append(
"<button class='"+ class1 +" friend-button' value='"+ value1 +"'>" +
"<i class='fa "+ icon1 +"'></i> " + text1 +
"</button>");
$buttonContainer.append(
"<button class='"+ class2 +" friend-button' value='"+ value2 +"'>" +
"<i class='fa "+ icon2 +"'></i> " + text2 +
"</button>");
$buttonContainer.children().click(function() {
editFriendship(userID, this.value);
if (isNaN(this.value))
editFriendship(userID, this.value);
else if (this.value != "")
window.location.href = "chat.php?username=" + this.value;
});
});
}

View File

@@ -2,19 +2,39 @@ var days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag",
var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"]
function fancyText(text) {
// Add images and gifs.
var regex = /(https:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig;
text = text.replace(regex, function(img) {
return "<img src='" + img + "' />";
// Add links, images, gifs and (youtube) video's.
var regex = /(https?:\/\/.[^ ]*)/ig;
text = text.replace(regex, function(link) {
// Add images
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
return "<img alt='" + link + "' src='" + link + "' />";
}
// Add mp4 video's
else if (link.match(/(https?:\/\/.[^ ]*\.(?:mp4))/ig)) {
return "<video width='100%'>" +
"<source src='"+ link +"' type='video/mp4'>" +
"<b>Je browser ondersteund geen video</b>" +
"</video><button class='gray' onclick='$(this).prev().get(0).play();'>Speel af</button>";
}
// Add ogg video's
else if (link.match(/(https?:\/\/.[^ ]*\.(?:ogg))/ig)) {
return "<video width='100%'>" +
"<source src='"+ link +"' type='video/ogg'>" +
"<b>Je browser ondersteund geen video</b>" +
"</video><button onclick='$(this).prev().get(0).play();'>Speel af</button>";
}
// Add youtube video's
else if (link.match(/(https?:\/\/.(www.)?youtube|youtu.be)*watch/ig)) {
return '<iframe width="100%"' +
' src="https://www.youtube.com/embed/' + link.substr(link.length - 11) +
'" frameborder="0" allowfullscreen></iframe>';
}
// Add links
else {
return "<a href='" + link + "'>" + link + "</a>";
}
});
// Add links.
// regex = /(https:\/\/.[^ ]*\.(?:net|com|nl))/ig;
// text = text.replace(regex, function(link) {
// return "<a href='" + link + "'>LINK</a>";
// });
return text;
}

View File

@@ -90,7 +90,7 @@ function masonry(mode) {
/*
* Get the posts from the server.
*/
$.post("API/getPosts.php", { usr : userID })
$.post("API/getPosts.php", { usr : userID, grp : groupID })
.done(function(data) {
posts = JSON.parse(data);

View File

@@ -4,7 +4,9 @@ function postComment(buttonValue) {
$.post(
"API/postComment.php",
formData
);
).done(function(data) {
console.log(data);
});
$("#newcomment").val("");

View File

@@ -27,7 +27,6 @@ if(empty($_GET["username"])) {
$user = selectUser($_SESSION["userID"], $userID);
$profile_friends = selectAllFriends($userID);
$profile_groups = selectAllUserGroups($userID);
$posts = selectAllUserPosts($userID);
if ($userID == $_SESSION["userID"]) {
@@ -54,23 +53,12 @@ include("../views/footer.php");
<script src="js/friendButtons.js"></script>
<script src="js/masonry.js"></script>
<script>
var posts;
$(document).ready(function() {
userID = <?= $userID ?>;
groupID = 0;
placeFriendButtons();
masonry(<?= $masonry_mode ?>);
// alert("blap");
// $.post("API/getPosts.php", { usr : userID }, "json")
// .done(function(data) {
// posts = JSON.parse(data);
// alert(posts[0]["content"]);
// }).fail(function() {
// alert("failure...");
// });
});
</script>
</body>

View File

@@ -28,7 +28,7 @@ if ($_SERVER["REQUEST_METHOD"] == "GET") {
}
function changePassword() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET
@@ -42,7 +42,7 @@ function changePassword() {
}
function verifyLink(int $userID, string $hash) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`password`
FROM

View File

@@ -0,0 +1,3 @@
#quick-links i {
font-size: 32px;
}

View File

@@ -131,3 +131,17 @@ body {
.chat-message img {
max-width: 100%;
}
.chat-message a {
text-decoration: underline;
}
.chat-time {
color: #666666;
font-size: 12px;
margin-bottom: -3px;
}
.chat-message-other .chat-time {
text-align: right;
}

View File

@@ -97,16 +97,16 @@ p {
}
.item-box, .item-box-full-width {
margin: 20px 0 0 0;
padding: 25px;
background-color: #FFFFFF;
}
.item-box {
width: calc(50% - 60px);
width: calc(33% - 50px);
display: inline-table;
}
@media only screen and (max-width: 900px) {
@media only screen and (max-width: 1400px) {
.item-box {
width: calc(100% - 50px);
}
@@ -183,6 +183,10 @@ button.green {
background-color: forestgreen;
}
button.gray{
background-color: #FFF;
color: #333;
}
button,
input[type="submit"],
@@ -224,6 +228,7 @@ td {
/* Custom title box, appears instantaneously */
a[data-title]:hover,
i[data-title]:hover,
img[data-title]:hover,
span[data-title]:hover,
div[data-title]:hover {
@@ -231,6 +236,7 @@ div[data-title]:hover {
}
a[data-title]:hover:after,
i[data-title]:hover:after,
img[data-title]:hover:after,
span[data-title]:hover:after,
div[data-title]:hover:after {

View File

@@ -1,6 +1,9 @@
body {
background-color: #FBC02D;
}
.password-change {
height: 100%;
background-color: #FBC02D;
margin: auto;
}
@@ -12,6 +15,14 @@
margin: 30px auto auto;
display: block;
}
.password-change img {
.top-logo img {
width: 50%;
}
.error-page {
text-align: center;
}
.error-page img {
vertical-align: middle;
}

View File

@@ -71,7 +71,16 @@
width: 95%;
}
.nietslecht {
.nietslecht-text {
font-family: Impact, Anton, sans-serif;
text-shadow: -1.5px 0 1px black, 0 1.5px 1px black, 1px 0 1.5px black, 0 -1.5px 1px black;
text-shadow: -1px 0 1px black, 0 1px 1px black, 1px 0 1px black, 0 -1px 1px black;
}
.nietslecht {
}
.nietslecht img {
vertical-align: middle;
height: 24px;
width: 24px;
}

View File

@@ -1,15 +1,60 @@
.profile-box {
min-height: 150px;
padding: 25px;
background-color: #FFFFFF;
/* New */
.user-box {
text-align: center;
}
.profile-box .profile-picture, .profile-box .group-picture {
.status-buttons-container {
position: relative;
float: left;
width: 200px;
display: inline-block;
}
.friend-button-container {
position: relative;
float: right;
width: 200px;
display: inline-block;
}
.friend-button-container button, .status-buttons-container button {
display: block;
margin: 7px 0;
width: 200px;
font-size: 18px;
}
.empty-button {
background: none;
cursor: auto;
}
.empty-button:active {
box-shadow: none;
}
.profile-info {
display: inline-block;
min-width: 250px;
width: auto;
padding-top: 30px;
}
.main-picture {
position: relative;
border: #4CAF50 solid 5px;
display: inline-block;
width: 150px;
height: 150px;
margin: 0 20px 20px 0;
margin-bottom: -45px;
}
/* Old */
.profile-box h1.profile-username {
padding-top: 50px;
}
@@ -18,14 +63,12 @@
}
div.posts {
padding-top: 20px;
width: calc(100% + 20px);
display: inline-flex;
}
div.posts div.post {
display: block;
margin: 20px 0 0 0;
padding: 10px;
width: calc(100% - 40px);
cursor: pointer;
@@ -60,6 +103,12 @@ div.posts .post form textarea.newpost {
height: 100px;
}
.post .post-date {
float: right;
color: #aaaaaa;
font-size: 0.8em;
}
@media only screen and (max-width: 1500px) {
.post-box {
width: calc(50% - 68px);
@@ -72,23 +121,3 @@ div.posts .post form textarea.newpost {
width: calc(100% - 65px);
}
}
.post .post-date {
float: right;
color: #aaaaaa;
font-size: 0.8em;
}
button.friend-button {
float: right;
height: auto;
padding: 10px;
margin-left: 10px;
border-radius: 5px;
transition-duration: 250ms;
cursor: pointer;
}
button.friend-button:hover {
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
}

View File

@@ -9,3 +9,7 @@ else {
"$dbconf->mysql_username", "$dbconf->mysql_password")
or die('Error connecting to mysql server');
}
function prepareQuery(string $query) : PDOStatement {
return $GLOBALS["db"]->prepare($query);
}

View File

@@ -1,7 +1,7 @@
<?php
function sendConfirmEmailUsername(string $username) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`
FROM
@@ -16,7 +16,7 @@ function sendConfirmEmailUsername(string $username) {
}
function sendConfirmEmail(int $userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`email`,
`fname`

View File

@@ -7,7 +7,7 @@ function selectFriends($userID) {
}
function selectLimitedFriends($userID, $limit) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
@@ -29,6 +29,12 @@ function selectLimitedFriends($userID, $limit) {
`friendship`.`user1ID` = `user`.`userID`) AND
`user`.`role` != 'banned' AND
`friendship`.`status` = 'confirmed'
ORDER BY
CASE
WHEN `friendship`.`user2ID` = `user`.`userID` THEN `friendship`.`chatLastVisted1`
WHEN `friendship`.`user1ID` = `user`.`userID` THEN `friendship`.`chatLastVisted2`
END
DESC
LIMIT :limitCount
");
@@ -41,7 +47,7 @@ function selectLimitedFriends($userID, $limit) {
function selectAllFriends($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
@@ -73,7 +79,7 @@ function selectAllFriends($userID) {
}
function selectAllFriendRequests() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
@@ -115,7 +121,7 @@ function getFriendshipStatus($userID) {
return -1;
}
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
CASE `status` IS NULL
WHEN TRUE THEN 0
@@ -148,7 +154,7 @@ function getFriendshipStatus($userID) {
}
function requestFriendship($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
INSERT INTO `friendship` (user1ID, user2ID)
VALUES (:user1, :user2)
");
@@ -159,7 +165,7 @@ function requestFriendship($userID) {
}
function removeFriendship($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
DELETE FROM `friendship`
WHERE
`user1ID` = :user1 AND
@@ -175,7 +181,7 @@ function removeFriendship($userID) {
}
function acceptFriendship($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE `friendship`
SET `status`='confirmed'
WHERE
@@ -190,7 +196,7 @@ function acceptFriendship($userID) {
}
function setLastVisited($friend) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`friendship`
SET `friendship`.chatLastVisted1=(
@@ -220,7 +226,7 @@ function setLastVisited($friend) {
}
function searchSomeFriends($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`,

View File

@@ -5,7 +5,7 @@ function selectAllGroupsFromUser($userID) {
}
function selectLimitedGroupsFromUser($userID, $limit) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`group_page`.`name`,
`group_page`.`picture`
@@ -28,7 +28,7 @@ function selectLimitedGroupsFromUser($userID, $limit) {
}
function searchSomeOwnGroups($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`group_page`.`name`,
`group_page`.`picture`

View File

@@ -1,10 +1,11 @@
<?php
require("connect.php");
require_once("connect.php");
function selectGroupByName($name) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`group_page`.`groupID`,
`group_page`.`groupID`,
`name`,
`description`,
@@ -29,7 +30,7 @@ function selectGroupByName($name) {
}
function selectGroupMembers(int $groupID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`username`,
`fname`,
@@ -54,7 +55,7 @@ function selectGroupMembers(int $groupID) {
}
function selectGroupById($groupID) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`group_page`.`name`,
`group_page`.`picture`,
@@ -73,7 +74,7 @@ function selectGroupById($groupID) {
}
function select20GroupsFromN($n) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`group_page`.`groupID`,
`group_page`.`name`,
@@ -95,7 +96,7 @@ function select20GroupsFromN($n) {
}
function select20GroupsByStatusFromN($n, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`group_page`.`groupID`,
`group_page`.`name`,
@@ -120,7 +121,7 @@ function select20GroupsByStatusFromN($n, $status) {
}
function search20GroupsFromNByStatus($n, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`groupID`,
`name`,
@@ -147,7 +148,7 @@ function search20GroupsFromNByStatus($n, $keyword, $status) {
}
function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
$q = $GLOBALS['db']->prepare("
$q = prepareQuery("
SELECT
`groupID`,
`name`,
@@ -175,7 +176,7 @@ function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
}
function countSomeGroupsByStatus($keyword, $status) {
$q = $GLOBALS['db']->prepare("
$q = prepareQuery("
SELECT
COUNT(*)
FROM
@@ -196,7 +197,7 @@ function countSomeGroupsByStatus($keyword, $status) {
}
function changeGroupStatusByID($id, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
UPDATE
`group_page`
SET
@@ -212,7 +213,7 @@ function changeGroupStatusByID($id, $status) {
}
function changeMultipleGroupStatusByID($ids, $status) {
$q = $GLOBALS['db']->prepare("
$q = prepareQuery("
UPDATE
`group_page`
SET
@@ -229,7 +230,7 @@ function changeMultipleGroupStatusByID($ids, $status) {
}
function searchSomeGroups($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`name`,
`picture`
@@ -252,7 +253,7 @@ function searchSomeGroups($n, $m, $search) {
}
function countSomeGroups($search) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
COUNT(*)
FROM
@@ -268,4 +269,3 @@ function countSomeGroups($search) {
$stmt->execute();
return $stmt;
}
?>

View File

@@ -1,6 +1,6 @@
<?php
function getHeaderInfo() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`fname`,
`lname`,

View File

@@ -1,7 +1,7 @@
<?php
function getUser() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`password`,
`userID`,
@@ -61,5 +61,4 @@ class loginException extends Exception
parent::__construct($message, $code, $previous);
}
}
?>

View File

@@ -1,39 +1,39 @@
<?php
function nicetime($date) {
if(empty($date)) {
return "No date provided";
}
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
$now = time();
$unix_date = strtotime($date);
if(empty($unix_date)) {
return "Bad date";
}
if($now > $unix_date) {
$difference = $now - $unix_date;
$tense = "geleden";
} else {
$difference = $unix_date - $now;
$tense = "vanaf nu";
}
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
$difference /= $lengths[$i];
}
$difference = round($difference);
if($difference != 1) {
$period = $multiple_periods[$i];
} else {
$period = $single_periods[$i];
}
return "$difference $period $tense";
if(empty($date)) {
return "No date provided";
}
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
$now = time();
$unix_date = strtotime($date);
if(empty($unix_date)) {
return "Bad date";
}
if($now > $unix_date) {
$difference = $now - $unix_date;
$tense = "geleden";
} else {
$difference = $unix_date - $now;
$tense = "vanaf nu";
}
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
$difference /= $lengths[$i];
}
$difference = round($difference);
if($difference != 1) {
$period = $multiple_periods[$i];
} else {
$period = $single_periods[$i];
}
return "$difference $period $tense";
}

View File

@@ -1,7 +1,53 @@
<?php
require_once("connect.php");
function selectAllPosts($userID, $groupID) {
$stmt = prepareQuery("
SELECT
`post`.`postID`,
`post`.`author`,
`title`,
CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
WHEN TRUE THEN
CONCAT(LEFT(`post`.`content`, 150), '...')
WHEN FALSE THEN
`post`.`content`
END
AS `content`,
`post`.`creationdate`,
COUNT(DISTINCT `commentID`) AS `comments`,
COUNT(DISTINCT `niet_slecht`.`postID`) AS `niet_slechts`
FROM
`post`
LEFT JOIN
`niet_slecht`
ON
`post`.`postID` = `niet_slecht`.`postID`
LEFT JOIN
`comment`
ON
`post`.`postID` = `comment`.`postID`
WHERE
`post`.`author` = :userID AND
`groupID` IS NULL OR
`groupID` = :groupID
GROUP BY
`post`.`postID`
ORDER BY
`post`.`creationdate` DESC
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->bindParam(':groupID', $groupID , PDO::PARAM_INT);
if(!$stmt->execute()) {
return False;
}
return $stmt;
}
function selectPostById($postID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`user`.`fname`,
`user`.`lname`,
@@ -26,7 +72,7 @@ function selectPostById($postID) {
}
function selectCommentsByPostId($postID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`comment`.`commentID`,
`comment`.`postID`,
@@ -52,7 +98,7 @@ function selectCommentsByPostId($postID) {
}
function makePost($userID, $groupID, $title, $content) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
INSERT INTO
`post` (
`author`,
@@ -76,7 +122,7 @@ function makePost($userID, $groupID, $title, $content) {
}
function makeComment($postID, $userID, $content) : int {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
INSERT INTO
`comment` (
`postID`,
@@ -106,7 +152,7 @@ function makeNietSlecht(int $postID, int $userID) : int {
}
function checkNietSlecht(int $postID, int $userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
*
FROM
@@ -122,7 +168,7 @@ function checkNietSlecht(int $postID, int $userID) {
}
function addNietSlecht(int $postID, int $userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
INSERT INTO
`niet_slecht` (`userID`, `postID`)
VALUES (:userID, :postID)
@@ -134,7 +180,7 @@ function addNietSlecht(int $postID, int $userID) {
}
function deleteNietSlecht(int $postID, int $userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
DELETE FROM
`niet_slecht`
WHERE

View File

@@ -4,7 +4,7 @@ function getOldChatMessages($user2ID) {
require_once ("friendship.php");
$user1ID = $_SESSION["userID"];
if (getFriendshipStatus($user2ID) == 1) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
*
FROM
@@ -15,7 +15,7 @@ function getOldChatMessages($user2ID) {
`origin` = :user2 AND
`destination` = :user1
ORDER BY
`messageID` ASC
`creationdate` ASC
");
$stmt->bindParam(":user1", $user1ID);
@@ -32,7 +32,7 @@ function getOldChatMessages($user2ID) {
function sendMessage($destination, $content) {
require_once("friendship.php");
if (getFriendshipStatus($destination) == 1) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
INSERT INTO
`private_message`
(
@@ -61,7 +61,7 @@ function sendMessage($destination, $content) {
function getNewChatMessages($lastID, $destination) {
require_once("friendship.php");
if (getFriendshipStatus($destination) == 1) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
*
FROM
@@ -74,7 +74,7 @@ function getNewChatMessages($lastID, $destination) {
`destination` = :user1) AND
`messageID` > :lastID
ORDER BY
`messageID` ASC
`creationdate` ASC
");
$stmt->bindParam(':user1', $_SESSION["userID"]);
@@ -91,7 +91,7 @@ function getNewChatMessages($lastID, $destination) {
function selectAllUnreadChat() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
`user`.`userID`,

View File

@@ -1,7 +1,7 @@
<?php
function getExistingUsername() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`username`
FROM
@@ -17,7 +17,7 @@ function getExistingUsername() {
}
function getExistingEmail() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`email`
FROM
@@ -33,7 +33,7 @@ function getExistingEmail() {
}
function getResetEmail() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`email`
FROM
@@ -49,7 +49,7 @@ function getResetEmail() {
}
function registerAccount() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
INSERT INTO
`user`(fname,
lname,

View File

@@ -3,7 +3,7 @@ include_once "../queries/connect.php";
function sendPasswordRecovery(string $email) {
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`
@@ -39,7 +39,7 @@ function doSendPasswordRecovery(int $userID, string $email, string $username, st
}
function setHashToDatabase(int $userID, string $hash) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET

View File

@@ -50,7 +50,7 @@ class AngryAlert extends AlertMessage {
* @return mixed Setting as an array.
*/
function getSettings() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`fname`,
`lname`,
@@ -77,7 +77,7 @@ function getSettings() {
* @return mixed passwordhash
*/
function getPasswordHash() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`password`,
`username`
@@ -96,7 +96,7 @@ function getPasswordHash() {
* @throws HappyAlert
*/
function updateSettings() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET
@@ -146,7 +146,7 @@ function changePassword() {
* @throws HappyAlert
*/
function doChangePassword() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET
@@ -184,7 +184,7 @@ function changeEmail() {
}
function emailIsAvailableInDatabase($email) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`email`
FROM
@@ -201,7 +201,7 @@ function emailIsAvailableInDatabase($email) {
}
function doChangeEmail($email) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET
@@ -245,7 +245,7 @@ function updateAvatar() {
}
function removeOldAvatar() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`profilepicture`
FROM
@@ -262,7 +262,7 @@ function removeOldAvatar() {
}
function setAvatarToDatabase(string $url) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET

View File

@@ -1,9 +1,9 @@
<?php
require("connect.php");
require_once ("connect.php");
function getUserID($username) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`
FROM
@@ -18,7 +18,7 @@ function getUserID($username) {
}
function getUsername($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`username`
FROM
@@ -33,7 +33,7 @@ function getUsername($userID) {
}
function selectUser($me, $other) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
@@ -46,6 +46,7 @@ function selectUser($me, $other) {
`bio`,
`user`.`creationdate`,
`onlinestatus`,
`role`,
`fname`,
`lname`,
CASE `status` IS NULL
@@ -81,7 +82,7 @@ function selectUser($me, $other) {
}
function selectAllUserGroups($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`group_page`.`groupID`,
`name`,
@@ -103,50 +104,50 @@ function selectAllUserGroups($userID) {
return $stmt;
}
function selectAllUserPosts($userID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`post`.`postID`,
`post`.`author`,
`title`,
CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
WHEN TRUE THEN
CONCAT(LEFT(`post`.`content`, 150), '...')
WHEN FALSE THEN
`post`.`content`
END
AS `content`,
`post`.`creationdate`,
COUNT(`commentID`) AS `comments`,
COUNT(`niet_slecht`.`postID`) AS `niet_slechts`
FROM
`post`
LEFT JOIN
`niet_slecht`
ON
`post`.`postID` = `niet_slecht`.`postID`
LEFT JOIN
`comment`
ON
`post`.`postID` = `comment`.`postID`
WHERE
`post`.`author` = :userID AND
`groupID` IS NULL
GROUP BY
`post`.`postID`
ORDER BY
`post`.`creationdate` DESC
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
if(!$stmt->execute()) {
return False;
}
return $stmt;
}
//function selectAllUserPosts($userID) {
// $stmt = prepareQuery("
// SELECT
// `post`.`postID`,
// `post`.`author`,
// `title`,
// CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
// WHEN TRUE THEN
// CONCAT(LEFT(`post`.`content`, 150), '...')
// WHEN FALSE THEN
// `post`.`content`
// END
// AS `content`,
// `post`.`creationdate`,
// COUNT(`commentID`) AS `comments`,
// COUNT(`niet_slecht`.`postID`) AS `niet_slechts`
// FROM
// `post`
// LEFT JOIN
// `niet_slecht`
// ON
// `post`.`postID` = `niet_slecht`.`postID`
// LEFT JOIN
// `comment`
// ON
// `post`.`postID` = `comment`.`postID`
// WHERE
// `post`.`author` = :userID AND
// `groupID` IS NULL
// GROUP BY
// `post`.`postID`
// ORDER BY
// `post`.`creationdate` DESC
// ");
//
// $stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
// if(!$stmt->execute()) {
// return False;
// }
// return $stmt;
//}
function select20UsersFromN($n) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`userID`,
`username`,
@@ -167,7 +168,7 @@ function select20UsersFromN($n) {
}
function search20UsersFromN($n, $keyword) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`userID`,
`username`,
@@ -191,7 +192,7 @@ function search20UsersFromN($n, $keyword) {
}
function search20UsersFromNByStatus($n, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`userID`,
`username`,
@@ -219,7 +220,7 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
}
function searchSomeUsersByStatus($n, $m, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`userID`,
`username`,
@@ -248,7 +249,7 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
}
function countSomeUsersByStatus($keyword, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
COUNT(*)
FROM
@@ -271,7 +272,7 @@ function countSomeUsersByStatus($keyword, $status) {
function changeUserStatusByID($id, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
UPDATE
`user`
SET
@@ -287,7 +288,7 @@ function changeUserStatusByID($id, $status) {
}
function changeMultipleUserStatusByID($ids, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
UPDATE
`user`
SET
@@ -304,7 +305,7 @@ function changeMultipleUserStatusByID($ids, $status) {
}
function selectRandomNotFriendUser($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`user`.`username`
FROM
@@ -332,7 +333,7 @@ function selectRandomNotFriendUser($userID) {
}
function searchSomeUsers($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
@@ -367,7 +368,7 @@ function searchSomeUsers($n, $m, $search) {
}
function countSomeUsers($search) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
COUNT(*)
FROM
@@ -389,7 +390,7 @@ function countSomeUsers($search) {
}
function getRoleByID($userID) {
$stmt = $GLOBALS['db']->prepare("
$stmt = prepareQuery("
SELECT
`role`
FROM

View File

@@ -13,88 +13,24 @@
<p>
<?php
foreach($members as $member) {
echo "<a href=\"profile.php?username=" . $member["username"] . "\" data-title=\"" . $member["username"] . "\"><img class=\"profile-picture\" src=\"" . $member["profilepicture"] . "\" alt=\"" . $member["username"] . "'s profielfoto\">";
echo "<a href=\"profile.php?username=" . $member["username"] . "\" data-title=\"" . $member["username"] . "\"><img class=\"profile-picture\" src=\"" . $member["profilepicture"] . "\" alt=\"" . $member["username"] . "'s profielfoto\"></a>";
}
?>
</p>
</div>
<div class="posts">
<div class="post platform">
<h2>Lorem</h2>
<p>Lorem ipsum dolor sit amet, consectetur.</p>
<p class="subscript">Enkele minuten geleden geplaatst</p>
</div>
<div class="post platform">
<h2>Image</h2>
<img src="http://i.imgur.com/ypIQKjE.jpg" alt="Olympic Mountains, Washington">
<p class="subscript">Gisteren geplaatst</p>
</div>
<div class="post platform">
<h2>Ipsum</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem nihil alias amet dolores fuga totam sequi a cupiditate ipsa voluptas id facilis nobis.</p>
<p class="subscript">Maandag geplaatst</p>
</div>
<div class="post platform">
<h2>Dolor</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Sit</h2>
<p>Lorem ipsum dolor sit.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Image</h2>
<img src="https://i.redditmedia.com/EBWWiEojgkRrdn89R7qF7tBZjJszJaIqgkWUH23s11A.jpg?w=576&s=ba4fe1f02485cb2327305924ef869a66" alt="Nunobiki Falls, Kobe Japan">
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Amet</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima asperiores eveniet vero velit eligendi aliquid in.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Consectetur</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error aliquid reprehenderit expedita odio beatae est.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Adipisicing</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat architecto quis tenetur fugiat veniam iste molestiae fuga labore!</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Elit</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem ut debitis dolorum earum expedita eveniet voluptatem quibusdam facere eos numquam commodi ad iusto laboriosam rerum aliquam.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Geen error</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus dolorem maxime minima animi cum.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Image</h2>
<img src="https://i.reddituploads.com/82c1c4dd0cfb4a4aa1cfa16f93f5dbfa?fit=max&h=1536&w=1536&s=dd629d407f3646ee6e3adb4da78c93f2" alt="Oregon cliffs are no joke.">
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Aliquid</h2>
<p>Lorem ipsum dolor sit amet, consectetur.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Odit</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit accusamus tempore at porro officia rerum est impedit ea ipsa tenetur. Labore libero hic error sunt laborum expedita.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Accusamus</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nobis quaerat suscipit ad.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
</div>
<div class="modal">
<div class="modal-content platform">
<div class="modal-close">
&times;
</div>
<div class="modal-response" id="modal-response">
<span class="modal-default">Aan het laden...</span>
</div>
</div>
</div>
</div>

View File

@@ -5,7 +5,6 @@
<script src="js/main.js"></script>
<script src="js/header.js"></script>
<script src="js/menu.js"></script>
<script src="js/notifications.js"></script>
<style>
/* Add your css files here. */
@import url("styles/main.css");

View File

@@ -1,7 +1,7 @@
<nav class="menu">
<section id="friends-menu-section">
<h4>
Top vrienden
Recente vrienden
</h4>
<ul id="menu-friends-list" class="nav-list">
</ul>
@@ -12,6 +12,13 @@
</h4>
<ul id="menu-groups-list" class="nav-list">
</ul>
<ul class="nav-list">
<li>
<a href="#">
Maak een groep aan
</a>
</li>
</ul>
</section>
<section>
<ul class="nav-list">

View File

@@ -5,14 +5,14 @@ function messagePage(string $content) {
<html>
<head>
<style>
@import url(styles/main.css);
@import url(styles/settings.css);
@import url(styles/resetpassword.css);
@import url(../styles/main.css);
@import url(../styles/settings.css);
@import url(../styles/message-page.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='top-logo'><a href='../index.php'><img src='../img/top-logo.png' alt='MyHyvesbook+'/></a></div>
<div class='item-box platform'>$content</div>
</div>
</body>

View File

@@ -1,9 +1,20 @@
<nav class="menu" id="notification-center">
<section id="quick-links">
<a href="chat.php"><i class="fa fa-comments-o" data-title="Prive chats"></i></a>
<a href="settings.php"><i class="fa fa-cog" data-title="Instellingen"></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="chat.php" data-title="Prive chats"><i class="fa fa-comments-o"></i></a>
<a href="settings.php" data-title="Instellingen"><i class="fa fa-cog"></i></a>
<a href="profile.php" data-title="Profiel"><i class="fa fa-user"></i></a>
<?php
include_once ("../queries/user.php");
// auth
$userinfo = getRoleByID($_SESSION['userID'])->fetch(PDO::FETCH_ASSOC);
if ($userinfo['role'] == 'admin' OR $userinfo['role'] == 'owner') {
echo "<a href=\"admin.php\" data-title=\"Admin\"><i class=\"fa fa-lock\"></i></a>";
echo "<style>@import url('styles/adminbutton.css'); </style>";
}
?>
<a href="logout.php" data-title="Admin"><i class="fa fa-sign-out"></i></a>
</section>
<section id="friend-request-section">
<h4>

View File

@@ -26,13 +26,12 @@ echo("
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..."></textarea> <br>
<button onclick="postComment('reaction')" name="button" value="reaction">Reageer!</button>
<!-- TODO: if/else op "niet slecht." button voor like/unlike-->
<button onclick="postComment('nietslecht')" name="button" value="nietslecht">
<button onclick="postComment('nietslecht')" name="button" value="nietslecht" class="nietslecht">
<?php
if (checkNietSlecht($postID, $_SESSION["userID"])) {
echo 'Trek <span class="nietslecht">"Niet slecht."</span> terug';
echo 'Trek <span class="nietslecht-text">"Niet slecht."</span> terug';
} else {
echo 'Vind ik <span class="nietslecht">"Niet slecht."</span>';
echo '<img src="img/nietslecht_small.png" /> <span class="nietslecht-text">"Niet slecht."</span>';
}
?>
</button>
@@ -51,7 +50,7 @@ echo("
<div class='comment'>
<div class='commentinfo'>
$commentauthor
<span class='commentdate', title='$commentdate'>
<span class='commentdate' title='$commentdate'>
$commentnicetime
</span>
</div>

View File

@@ -1,24 +1,41 @@
<div class="content">
<div class="profile-box platform">
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
<form id="start-profile-chat-form" class="right" action="chat.php" method="get">
<button name="username"
class="friend-button green"
value="<?php echo $user["userID"] ?>">
<i class="fa fa-comment-o"></i> Chat
</button>
</form>
<div class="friend-button-container">
<div class="user-box">
<img class="profile-picture main-picture" src="<?= $user["profilepicture"] ?>"><br />
<div class="platform">
<div class="status-buttons-container">
<button disabled class="gray"><?= $user["onlinestatus"] ?></button>
<button disabled class="gray"><?= $user["role"] ?></button>
</div>
<div class="friend-button-container">
<p>:)</p>
<p>Je ziet er goed uit vandaag</p>
</div>
<div class="profile-info">
<h2><?= $user["fname"]?> <?=$user["lname"]?></h2>
<h5><?=$user["username"]?></h5>
<?php if (strlen($user["bio"]) <= 50) {
echo "<p>" . $user["bio"] . "</p>";
} ?>
</div>
</div>
</div>
<?php if (strlen($user["bio"]) > 50) {
echo "<div class='platform'><h3>Bio:</h3><p>" . $user["bio"] . "</p></div>";
} ?>
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h1>
<h5 class="profile-username"><?=$user["username"]?></h5>
<p><?=$user["bio"]?></p>
<div class="item-box platform">
<h3>Informatie</h3>
<p>
<ul>
<li>Geboren op: <?= $user["birthdate"] ?></li>
<li>Locatie: <?= $user["location"] ?></li>
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
</ul>
</p>
</div>
<div class="item-box left platform">
<h2>Vrienden</h2>
<div class="item-box platform">
<h3>Vrienden</h3>
<p>
<?php
while($friend = $profile_friends->fetch()) {
@@ -33,12 +50,12 @@
</p>
</div>
<div class="item-box right platform">
<h2>Groepen</h2>
<div class="item-box platform">
<h3>Groepen</h3>
<p>
<?php
while($group = $profile_groups->fetch()) {
echo "<a href='/group/${group["name"]}/' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
echo "<a href='group.php?groupname=${group['name']}' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
}
if($profile_groups->rowCount() === 0) {