Compare commits
55 Commits
revert-50e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
490d39ba47 | ||
|
|
1193078e8f | ||
|
|
bcb01e3296 | ||
|
|
7cc6450e6a | ||
|
|
4643dfcddb | ||
|
|
833bfd3292 | ||
|
|
1ac6a7da87 | ||
|
|
52ce787241 | ||
|
|
fb5f76c499 | ||
|
|
f3aebddfea | ||
|
|
3aae884bb5 | ||
|
|
b07d0712aa | ||
|
|
05d6bf8aa6 | ||
|
|
1e60941a3f | ||
|
|
e3f4fa0b3c | ||
|
|
1fd984cc02 | ||
|
|
6d5de98c1d | ||
|
|
16f83d93ce | ||
|
|
306fd3090f | ||
|
|
771567660c | ||
|
|
4eae09dfc7 | ||
|
|
53e1d7fef3 | ||
|
|
c29be662bc | ||
|
|
000d1f4072 | ||
|
|
d260bf04bc | ||
|
|
a0ef234b79 | ||
|
|
da061de226 | ||
|
|
f18088d8d2 | ||
|
|
ac2ce3d07b | ||
|
|
ba6f86e70e | ||
|
|
c69b5d8ed3 | ||
|
|
5de3a84683 | ||
|
|
b8d6136a9d | ||
|
|
1862369013 | ||
|
|
8d70804155 | ||
|
|
0ac12f5110 | ||
|
|
5e8fa6791f | ||
|
|
28e9269b52 | ||
|
|
bb352c7a7a | ||
|
|
fe190975d5 | ||
|
|
0f202088a1 | ||
|
|
87b0ab5892 | ||
|
|
c8dbdfe70e | ||
|
|
8949d14a5e | ||
|
|
fde736b8c5 | ||
|
|
02349dbe28 | ||
|
|
da01729b61 | ||
|
|
6d739a4480 | ||
|
|
ab21226925 | ||
|
|
7e4107ac8b | ||
|
|
e9468b0ec8 | ||
|
|
b206d243b9 | ||
|
|
4f731e12fe | ||
|
|
f8c9454b85 | ||
|
|
afb45d6709 |
@@ -3,9 +3,9 @@ session_start();
|
|||||||
|
|
||||||
require_once "../../queries/post.php";
|
require_once "../../queries/post.php";
|
||||||
require_once "../../queries/user.php";
|
require_once "../../queries/user.php";
|
||||||
|
if (!isset($_SESSION["userID"])) {
|
||||||
if (isset($_SESSION["userID"]) and
|
echo "logged out";
|
||||||
getRoleByID($_SESSION["userID"]) != 'frozen' and
|
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' and
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
|
|
||||||
if (empty($_POST["postID"]) or empty($_SESSION["userID"])) {
|
if (empty($_POST["postID"]) or empty($_SESSION["userID"])) {
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ require_once("../../queries/connect.php");
|
|||||||
require_once("../../queries/checkInput.php");
|
require_once("../../queries/checkInput.php");
|
||||||
require_once("../../queries/user.php");
|
require_once("../../queries/user.php");
|
||||||
|
|
||||||
|
if (!isset($_SESSION["userID"])) {
|
||||||
if (isset($_SESSION["userID"]) &&
|
echo "logged out";
|
||||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
if ($_POST['button'] == 'reaction') {
|
if ($_POST['button'] == 'reaction') {
|
||||||
if (empty($_POST['newcomment-content'])) {
|
if (empty($_POST['newcomment-content'])) {
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ require_once("../../queries/connect.php");
|
|||||||
require_once("../../queries/checkInput.php");
|
require_once("../../queries/checkInput.php");
|
||||||
require_once("../../queries/user.php");
|
require_once("../../queries/user.php");
|
||||||
|
|
||||||
if (isset($_SESSION["userID"]) &&
|
if (!isset($_SESSION["userID"])) {
|
||||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
echo "logged out";
|
||||||
|
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
|
|
||||||
if (empty($_SESSION["userID"])) {
|
if (empty($_SESSION["userID"])) {
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ require_once("../../queries/checkInput.php");
|
|||||||
require_once("../../queries/user.php");
|
require_once("../../queries/user.php");
|
||||||
|
|
||||||
// Check if the user is allowed to send a message.
|
// Check if the user is allowed to send a message.
|
||||||
if (isset($_SESSION["userID"]) &&
|
if (!isset($_SESSION["userID"])) {
|
||||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
echo "logged out";
|
||||||
|
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
if (!empty(test_input($_POST["destination"])) &&
|
if (!empty(test_input($_POST["destination"])) &&
|
||||||
!empty(test_input($_POST["content"]))
|
!empty(test_input($_POST["content"]))
|
||||||
|
|||||||
BIN
website/public/apple-touch-icon-114x114-precomposed.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
website/public/apple-touch-icon-120x120-precomposed.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
website/public/apple-touch-icon-144x144-precomposed.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
website/public/apple-touch-icon-152x152-precomposed.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
website/public/apple-touch-icon-180x180-precomposed.png
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
website/public/apple-touch-icon-57x57-precomposed.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
website/public/apple-touch-icon-60x60-precomposed.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
website/public/apple-touch-icon-72x72-precomposed.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
website/public/apple-touch-icon-76x76-precomposed.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
website/public/apple-touch-icon-precomposed.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
12
website/public/browserconfig.xml
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<browserconfig>
|
||||||
|
<msapplication>
|
||||||
|
<tile>
|
||||||
|
<square70x70logo src="tiny.png"/>
|
||||||
|
<square150x150logo src="square.jpg"/>
|
||||||
|
<wide310x150logo src="wide.jpg"/>
|
||||||
|
<square310x310logo src="large.jpg"/>
|
||||||
|
<TileColor>#000000</TileColor>
|
||||||
|
</tile>
|
||||||
|
</msapplication>
|
||||||
|
</browserconfig>
|
||||||
BIN
website/public/favicon-1.png
Normal file
|
After Width: | Height: | Size: 492 B |
BIN
website/public/favicon-2.png
Normal file
|
After Width: | Height: | Size: 782 B |
BIN
website/public/favicon-3.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
website/public/favicon-4.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
website/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 97 KiB |
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
include_once("../queries/group_page.php");
|
include_once("../queries/group_page.php");
|
||||||
|
|
||||||
if(!$group = selectGroupByName($_GET["groupname"])) {
|
if(isset($_SESSION["userID"]) and !$group = selectGroupByName($_GET["groupname"])) {
|
||||||
header("HTTP/1.0 404 Not Found");
|
header("HTTP/1.0 404 Not Found");
|
||||||
header("Location: error/404.php");
|
header("Location: error/404.php");
|
||||||
die();
|
die();
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ require_once "../queries/alerts.php";
|
|||||||
include("../views/main.php");
|
include("../views/main.php");
|
||||||
$alertClass;
|
$alertClass;
|
||||||
$alertMessage;
|
$alertMessage;
|
||||||
|
|
||||||
|
// Select which button has been pressed.
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
try {
|
try {
|
||||||
switch ($_POST["form"]) {
|
switch ($_POST["form"]) {
|
||||||
@@ -44,6 +46,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
}
|
}
|
||||||
upgradeUser($_POST["groupID"], $_POST["userID"], "admin");
|
upgradeUser($_POST["groupID"], $_POST["userID"], "admin");
|
||||||
break;
|
break;
|
||||||
|
case "deadmin":
|
||||||
|
if (!array_key_exists("userID", $_POST)) {
|
||||||
|
throw new AngryAlert("Geen gebruiker geselecteerd.");
|
||||||
|
}
|
||||||
|
upgradeUser($_POST["groupID"], $_POST["userID"], "member");
|
||||||
|
break;
|
||||||
|
case "delete":
|
||||||
|
deleteGroup();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (AlertMessage $w) {
|
} catch (AlertMessage $w) {
|
||||||
$alertClass = $w->getClass();
|
$alertClass = $w->getClass();
|
||||||
|
|||||||
@@ -24,12 +24,14 @@ $(window).on("load", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Toggles all checkboxes based on one.
|
||||||
function checkAll() {
|
function checkAll() {
|
||||||
$('.checkbox-list').each(function () {
|
$('.checkbox-list').each(function () {
|
||||||
$(this).prop('checked', $('#checkall').prop('checked'));
|
$(this).prop('checked', $('#checkall').prop('checked'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simple function that checks if checkall should stay checked.
|
||||||
function checkCheckAll() {
|
function checkCheckAll() {
|
||||||
var checked = true;
|
var checked = true;
|
||||||
|
|
||||||
@@ -43,6 +45,7 @@ function checkCheckAll() {
|
|||||||
$('#checkall').prop('checked', checked);
|
$('#checkall').prop('checked', checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Toggle of filter options.
|
||||||
function changeFilter() {
|
function changeFilter() {
|
||||||
if ($('#pagetype').find(":selected").val() == "group") {
|
if ($('#pagetype').find(":selected").val() == "group") {
|
||||||
document.getElementById('admin-filter').style.display = 'none';
|
document.getElementById('admin-filter').style.display = 'none';
|
||||||
@@ -59,11 +62,13 @@ function changeFilter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets the search page to one, relevant when changing filter or search.
|
||||||
function searchFromOne() {
|
function searchFromOne() {
|
||||||
$('#currentpage').prop('value', 1);
|
$('#currentpage').prop('value', 1);
|
||||||
adminSearch();
|
adminSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AJAX live search.
|
||||||
function adminSearch() {
|
function adminSearch() {
|
||||||
$.post(
|
$.post(
|
||||||
"API/adminSearchUsers.php",
|
"API/adminSearchUsers.php",
|
||||||
@@ -74,6 +79,7 @@ function adminSearch() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AJAX live update.
|
||||||
function adminUpdate(form) {
|
function adminUpdate(form) {
|
||||||
$.post(
|
$.post(
|
||||||
"API/adminChangeUser.php",
|
"API/adminChangeUser.php",
|
||||||
@@ -83,6 +89,7 @@ function adminUpdate(form) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AJAX pagenumber functionality.
|
||||||
function updatePageN() {
|
function updatePageN() {
|
||||||
$.post(
|
$.post(
|
||||||
"API/adminPageNumber.php",
|
"API/adminPageNumber.php",
|
||||||
@@ -92,11 +99,13 @@ function updatePageN() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Intended for the edit button to show a form.
|
||||||
function toggleBancomment(button) {
|
function toggleBancomment(button) {
|
||||||
$(button).siblings("div").toggle();
|
$(button).siblings("div").toggle();
|
||||||
$(button).toggle();
|
$(button).toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AJAX value editing.
|
||||||
function editComment(form) {
|
function editComment(form) {
|
||||||
$.post(
|
$.post(
|
||||||
"API/adminChangeUser.php",
|
"API/adminChangeUser.php",
|
||||||
|
|||||||
@@ -43,12 +43,15 @@ function sendMessage() {
|
|||||||
).done(function(response) {
|
).done(function(response) {
|
||||||
if (response == "frozen") {
|
if (response == "frozen") {
|
||||||
alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
|
alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||||
|
} else if (response == "logged out") {
|
||||||
|
window.location.href = "login.php?url=" + window.location.pathname;
|
||||||
}
|
}
|
||||||
// Load messages if the message has been send, so it shows in the chat.
|
// Load messages if the message has been send, so it shows in the chat.
|
||||||
loadMessages();
|
loadMessages();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#newContent").val("");
|
$("#newContent").val("");
|
||||||
|
$("#newContent").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add messages to the chat.
|
// Add messages to the chat.
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
// Show the right friendship buttonsto the user.
|
||||||
function placeFriendButtons() {
|
function placeFriendButtons() {
|
||||||
$.post("API/getFriendshipStatus.php", { usr: userID })
|
$.post("API/getFriendshipStatus.php", { usr: userID })
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
|
//save the friendship status
|
||||||
var friendshipStatus = data;
|
var friendshipStatus = data;
|
||||||
var $buttonContainer = $("div.friend-button-container");
|
var $buttonContainer = $("div.friend-button-container");
|
||||||
$("#start-profile-chat").hide();
|
$("#start-profile-chat").hide();
|
||||||
@@ -19,25 +21,28 @@ function placeFriendButtons() {
|
|||||||
case "0":
|
case "0":
|
||||||
value1 = "request";
|
value1 = "request";
|
||||||
class1 = "green";
|
class1 = "green";
|
||||||
text1 = "Bevriend";
|
text1 = "Word vrienden";
|
||||||
icon1 = "fa-handshake-o";
|
icon1 = "fa-user-plus";
|
||||||
break;
|
break;
|
||||||
|
// Users are friends.
|
||||||
case "1":
|
case "1":
|
||||||
value1 = userID;
|
value1 = userID;
|
||||||
class1 = "green";
|
class1 = "green";
|
||||||
text1 = "Chat";
|
text1 = "Chat";
|
||||||
icon1 = "fa-comment-o";
|
icon1 = "fa-comment";
|
||||||
value2 = "delete";
|
value2 = "delete";
|
||||||
class2 = "red";
|
class2 = "red";
|
||||||
text2 = "Verwijder";
|
text2 = "Ontvriend";
|
||||||
icon2 = "fa-times";
|
icon2 = "fa-user-times";
|
||||||
break;
|
break;
|
||||||
|
// This user sent request.
|
||||||
case "2":
|
case "2":
|
||||||
value1 = "delete";
|
value1 = "delete";
|
||||||
class1 = "red";
|
class1 = "red";
|
||||||
text1 = "Trek verzoek in";
|
text1 = "Trek verzoek in";
|
||||||
icon1 = "fa-cross";
|
icon1 = "fa-times";
|
||||||
break;
|
break;
|
||||||
|
// Other user sent request.
|
||||||
case "3":
|
case "3":
|
||||||
value1 = "accept";
|
value1 = "accept";
|
||||||
class1 = "green";
|
class1 = "green";
|
||||||
@@ -50,17 +55,20 @@ function placeFriendButtons() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Append buttons to the container.
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='"+ class1 +" friend-button' value='"+ value1 +"'>" +
|
"<div><button class='"+ class1 +" fancy-button friend-button' value='"+ value1 +"'>" +
|
||||||
"<i class='fa "+ icon1 +"'></i> " + text1 +
|
"<span>"+ text1 +"</span>" +
|
||||||
"</button>");
|
"<i class='fa fa-fw "+ icon1 +"'></i> " +
|
||||||
|
"</button></div>");
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='"+ class2 +" friend-button' value='"+ value2 +"'>" +
|
"<div><button class='"+ class2 +" fancy-button friend-button' value='"+ value2 +"'>" +
|
||||||
"<i class='fa "+ icon2 +"'></i> " + text2 +
|
"<span>"+ text2 +"</span>" +
|
||||||
"</button>");
|
"<i class='fa fa-fw "+ icon2 +"'></i> " +
|
||||||
|
"</button></div>");
|
||||||
|
|
||||||
|
// Gets triggered when a friend button is triggered.
|
||||||
$buttonContainer.children().click(function() {
|
$buttonContainer.find("button").click(function() {
|
||||||
if (isNaN(this.value))
|
if (isNaN(this.value))
|
||||||
editFriendship(userID, this.value);
|
editFriendship(userID, this.value);
|
||||||
else if (this.value != "")
|
else if (this.value != "")
|
||||||
|
|||||||
@@ -3,29 +3,36 @@ function placeGroupButtons() {
|
|||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
var $buttonContainer = $("div.group-button-container");
|
var $buttonContainer = $("div.group-button-container");
|
||||||
|
|
||||||
if (data == 'none') {
|
// Append the right group button to the button container.
|
||||||
|
// When user is not a member
|
||||||
|
if(data == 'none') {
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='green group-button group-button-fixed' value='request'>" +
|
"<button class='green group-button fancy-button' value='request'>" +
|
||||||
"<i class='fa fa-plus'></i> Voeg toe" +
|
"<span>Treed toe</span><i class='fa fa-plus'></i>" +
|
||||||
"</button>");
|
"</button>");
|
||||||
} else if (data == 'request') {
|
|
||||||
|
// when user sent a request to become a member.
|
||||||
|
} else if(data == 'request') {
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='red group-button group-button-fixed' value='none'>" +
|
"<button class='red group-button fancy-button' value='none'>" +
|
||||||
"<i class='fa fa-times'></i> Trek verzoek in" +
|
"<span>Trek verzoek in</span><i class='fa fa-times'></i>" +
|
||||||
"</button>");
|
"</button>");
|
||||||
|
// When user is a member of the group.
|
||||||
} else if (data == 'admin') {
|
} else if (data == 'admin') {
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='group-button group-button-fancy' value='admin'>" +
|
"<button class='group-button fancy-button' value='admin'>" +
|
||||||
"<span>Instellingen</span><i class='fa fa-cogs'></i>" +
|
"<span>Instellingen</span><i class='fa fa-cogs'></i>" +
|
||||||
"</button>"
|
"</button>"
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='red group-button group-button-fancy' value='none'>" +
|
"<button class='red group-button fancy-button' value='none'>" +
|
||||||
"<span>Verlaat groep</span><i class='fa fa-sign-out'></i>" +
|
"<span>Verlaat groep</span><i class='fa fa-sign-out'></i>" +
|
||||||
"</button>");
|
"</button>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gets triggered when a group button is clicked.
|
||||||
$buttonContainer.children().click(function() {
|
$buttonContainer.children().click(function() {
|
||||||
if (this.value == 'admin') {
|
if (this.value == 'admin') {
|
||||||
window.location.href='groupAdmin.php?groupID=' + groupID;
|
window.location.href='groupAdmin.php?groupID=' + groupID;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ var facebookModal = document.getElementById("fbModal");
|
|||||||
// Get the button that opens the modal
|
// Get the button that opens the modal
|
||||||
var registerBtn = document.getElementById("registerBtn");
|
var registerBtn = document.getElementById("registerBtn");
|
||||||
var btn = document.getElementById("myBtn");
|
var btn = document.getElementById("myBtn");
|
||||||
|
var fbBtn = document.getElementById("fbBtn");
|
||||||
|
|
||||||
// Get the <span> element that closes the modal
|
// Get the <span> element that closes the modal
|
||||||
var span = document.getElementsByClassName("close")[0];
|
var span = document.getElementsByClassName("close")[0];
|
||||||
@@ -24,6 +24,9 @@ btn.onclick = function () {
|
|||||||
registerBtn.onclick = function () {
|
registerBtn.onclick = function () {
|
||||||
registerModal.style.display = "block";
|
registerModal.style.display = "block";
|
||||||
}
|
}
|
||||||
|
fbBtn.onclick = function () {
|
||||||
|
facebookModal.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WHen the user clicks on (X), close the modal
|
* WHen the user clicks on (X), close the modal
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "a
|
|||||||
|
|
||||||
function fancyText(text) {
|
function fancyText(text) {
|
||||||
// Add links, images, gifs and (youtube) video's.
|
// Add links, images, gifs and (youtube) video's.
|
||||||
var regex = /(https?:\/\/.[^ <>"]*)/ig;
|
text = text.replace(/(https?:\/\/.[^ \n<>"]*)/ig, function(link) {
|
||||||
text = text.replace(regex, function(link) {
|
|
||||||
// Add images
|
// Add images
|
||||||
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
|
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
|
||||||
return "<img alt='" + link + "' src='" + link + "' />";
|
return "<img alt='" + link + "' src='" + link + "' />";
|
||||||
@@ -39,7 +38,7 @@ function fancyText(text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This function gets the value of a cookie when given a key.
|
// This function gets the value of a cookie when given a key.
|
||||||
// If didn´t find any compatible cookie, it returns false.
|
// If it didn´t find any compatible cookie, it returns false.
|
||||||
function getCookie(key) {
|
function getCookie(key) {
|
||||||
cookies = document.cookie.split("; ");
|
cookies = document.cookie.split("; ");
|
||||||
for (var i in cookies) {
|
for (var i in cookies) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Vertical margin between two posts.
|
||||||
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
|
// scrolling modal taken from http://stackoverflow.com/questions/10476632/how-to-scroll-the-page-when-a-modal-dialog-is-longer-than-the-screen
|
||||||
@@ -11,9 +12,12 @@ function scrollbarMargin(width, overflow) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get post from the server.
|
||||||
function requestPost(postID) {
|
function requestPost(postID) {
|
||||||
|
// Make the modal view visible.
|
||||||
$(".modal").show();
|
$(".modal").show();
|
||||||
|
|
||||||
|
// Send get request to the server to load the post.
|
||||||
$.get("API/loadPost.php", { postID : postID }).done(function(data) {
|
$.get("API/loadPost.php", { postID : postID }).done(function(data) {
|
||||||
$('.modal-default').hide();
|
$('.modal-default').hide();
|
||||||
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
||||||
@@ -23,11 +27,14 @@ function requestPost(postID) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a new post.
|
||||||
function postPost() {
|
function postPost() {
|
||||||
title = $("input.newpost[name='title']").val();
|
title = $("input.newpost[name='title']").val();
|
||||||
content = $("textarea.newpost[name='content']").val();
|
content = $("textarea.newpost[name='content']").val();
|
||||||
|
|
||||||
|
// Masonrymode 2: when on group page and user is an admin.
|
||||||
if (masonryMode == 2) {
|
if (masonryMode == 2) {
|
||||||
|
// Create the new group post.
|
||||||
$.post("API/postPost.php", { title: title,
|
$.post("API/postPost.php", { title: title,
|
||||||
content : content,
|
content : content,
|
||||||
group : groupID })
|
group : groupID })
|
||||||
@@ -36,12 +43,17 @@ function postPost() {
|
|||||||
$('#alertbox').show();
|
$('#alertbox').show();
|
||||||
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
||||||
window.scrollTo(0,0);
|
window.scrollTo(0,0);
|
||||||
|
} else if (data == "logged out") {
|
||||||
|
window.location.href = "login.php?url=" + window.location.pathname;
|
||||||
|
} else if (data == "frozen") {
|
||||||
|
alert("Je account is bevroren, dus je kan geen posts plaatsen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||||
} else {
|
} else {
|
||||||
$('#alertbox').hide();
|
$('#alertbox').hide();
|
||||||
masonry(masonryMode);
|
masonry(masonryMode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// Create the new user post.
|
||||||
$.post("API/postPost.php", { title: title,
|
$.post("API/postPost.php", { title: title,
|
||||||
content : content })
|
content : content })
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
@@ -49,6 +61,10 @@ function postPost() {
|
|||||||
$('#alertbox').show();
|
$('#alertbox').show();
|
||||||
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
||||||
window.scrollTo(0,0);
|
window.scrollTo(0,0);
|
||||||
|
} else if (data == "logged out") {
|
||||||
|
window.location.href = "login.php?url=" + window.location.pathname;
|
||||||
|
} else if (data == "frozen") {
|
||||||
|
alert("Je account is bevroren, dus je kan geen posts plaatsen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||||
} else {
|
} else {
|
||||||
$('#alertbox').hide();
|
$('#alertbox').hide();
|
||||||
masonry(masonryMode);
|
masonry(masonryMode);
|
||||||
@@ -68,6 +84,7 @@ var postAmount = 0;
|
|||||||
var noposts = false;
|
var noposts = false;
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
// Initialise variables for masonry.
|
||||||
windowWidth = $(window).width();
|
windowWidth = $(window).width();
|
||||||
columnCount = Math.floor($(".posts").width() / 250);
|
columnCount = Math.floor($(".posts").width() / 250);
|
||||||
columns = new Array(columnCount);
|
columns = new Array(columnCount);
|
||||||
@@ -78,13 +95,30 @@ $(window).on("load", function() {
|
|||||||
$(".modal-close").click(function (){closeModal()});
|
$(".modal-close").click(function (){closeModal()});
|
||||||
|
|
||||||
// http://stackoverflow.com/questions/9439725/javascript-how-to-detect-if-browser-window-is-scrolled-to-bottom
|
// http://stackoverflow.com/questions/9439725/javascript-how-to-detect-if-browser-window-is-scrolled-to-bottom
|
||||||
|
// Infinite scroll.
|
||||||
window.onscroll = function(ev) {
|
window.onscroll = function(ev) {
|
||||||
if($(window).scrollTop() + $(window).height() == $(document).height() ) {
|
if($(window).scrollTop() + $(window).height() == $(document).height() ) {
|
||||||
loadMorePosts(userID, groupID, postAmount, postLimit);
|
loadMorePosts(userID, groupID, postAmount, postLimit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$(document).keyup(function(e) {
|
||||||
|
if (e.keyCode == 27) {
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.modal').click(function() {
|
||||||
|
closeModal();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.modal-content').click(function(event){
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Hide modal view from the screen.
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
$(".modal").hide();
|
$(".modal").hide();
|
||||||
scrollbarMargin(0, 'auto');
|
scrollbarMargin(0, 'auto');
|
||||||
@@ -92,23 +126,30 @@ function closeModal() {
|
|||||||
$('.modal-default').show();
|
$('.modal-default').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Will fire when user resizes the window.
|
||||||
$(window).resize(function() {
|
$(window).resize(function() {
|
||||||
clearTimeout(window.resizedFinished);
|
clearTimeout(window.resizedFinished);
|
||||||
window.resizeFinished = setTimeout(function() {
|
window.resizeFinished = setTimeout(function() {
|
||||||
|
// Check if the width of the screen changed.
|
||||||
if ($(window).width() != windowWidth) {
|
if ($(window).width() != windowWidth) {
|
||||||
|
// Save width.
|
||||||
windowWidth = $(window).width();
|
windowWidth = $(window).width();
|
||||||
|
// Check if there fit more or less columns in the new width.
|
||||||
if (columnCount != Math.floor($(".posts").width() / 250)) {
|
if (columnCount != Math.floor($(".posts").width() / 250)) {
|
||||||
columnCount = Math.floor($(".posts").width() / 250);
|
columnCount = Math.floor($(".posts").width() / 250);
|
||||||
|
// Respawn the masonry grid.
|
||||||
masonry(masonryMode);
|
masonry(masonryMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Select the container for masonry.
|
||||||
var $container = $(".posts");
|
var $container = $(".posts");
|
||||||
|
|
||||||
|
// Spawn the masonry grid.
|
||||||
function masonry(mode) {
|
function masonry(mode) {
|
||||||
|
// save the masonry mode.
|
||||||
masonryMode = mode;
|
masonryMode = mode;
|
||||||
$container.children().remove();
|
$container.children().remove();
|
||||||
|
|
||||||
@@ -116,10 +157,7 @@ function masonry(mode) {
|
|||||||
noposts = false;
|
noposts = false;
|
||||||
postAmount = 0;
|
postAmount = 0;
|
||||||
|
|
||||||
/*
|
// Initialise columns.
|
||||||
* Initialise columns.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (i = 0; i < columnCount; i++) {
|
for (i = 0; i < columnCount; i++) {
|
||||||
$column = $("<div class=\"column\">");
|
$column = $("<div class=\"column\">");
|
||||||
$column.width(100/columnCount + "%");
|
$column.width(100/columnCount + "%");
|
||||||
@@ -127,11 +165,13 @@ function masonry(mode) {
|
|||||||
columns[i] = [0, $column];
|
columns[i] = [0, $column];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Place the form for new posts.
|
||||||
if(mode > 0) {
|
if(mode > 0) {
|
||||||
$postInput = $("<div class=\"post platform\">");
|
$postInput = $("<div class=\"post platform\">");
|
||||||
$form = $("<form class=\"newpost\" action=\"API/postPost.php\" method=\"post\" onsubmit=\"postPost(); return false;\">");
|
$form = $("<form class=\"newpost\" action=\"API/postPost.php\" method=\"post\" onsubmit=\"postPost(); return false;\">");
|
||||||
$postInput.append($form);
|
$postInput.append($form);
|
||||||
|
|
||||||
|
//Add extra input for group posts.
|
||||||
if(mode == 2) {
|
if(mode == 2) {
|
||||||
$form.append($("<input class=\"newpost\" type=\"hidden\" name=\"group\" value=\"" + groupID + "\">"));
|
$form.append($("<input class=\"newpost\" type=\"hidden\" name=\"group\" value=\"" + groupID + "\">"));
|
||||||
}
|
}
|
||||||
@@ -144,17 +184,11 @@ function masonry(mode) {
|
|||||||
columns[0][0] = $postInput.height() + margin;
|
columns[0][0] = $postInput.height() + margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Get the posts from the server.
|
||||||
* Function will find the column with the shortest height.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the posts from the server.
|
|
||||||
*/
|
|
||||||
loadMorePosts(userID, groupID, 0, postLimit);
|
loadMorePosts(userID, groupID, 0, postLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find the column with the shortest hight.
|
||||||
function getShortestColumn(columns) {
|
function getShortestColumn(columns) {
|
||||||
column = columns[0];
|
column = columns[0];
|
||||||
|
|
||||||
@@ -166,17 +200,20 @@ function getShortestColumn(columns) {
|
|||||||
return column;
|
return column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load certain range of posts.
|
||||||
function loadMorePosts(uID, gID, offset, limit) {
|
function loadMorePosts(uID, gID, offset, limit) {
|
||||||
if (noposts) {
|
if (noposts) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get a list of posts from the server.
|
||||||
$.post("API/getPosts.php", { usr : uID,
|
$.post("API/getPosts.php", { usr : uID,
|
||||||
grp : gID,
|
grp : gID,
|
||||||
offset : offset,
|
offset : offset,
|
||||||
limit : limit})
|
limit : limit})
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
// No posts were found, show noposts bar to user.
|
||||||
$('.noposts').show();
|
$('.noposts').show();
|
||||||
noposts = true;
|
noposts = true;
|
||||||
return;
|
return;
|
||||||
@@ -184,9 +221,7 @@ function loadMorePosts(uID, gID, offset, limit) {
|
|||||||
|
|
||||||
posts = JSON.parse(data);
|
posts = JSON.parse(data);
|
||||||
|
|
||||||
/*
|
// Rearange the objects.
|
||||||
* Rearange the objects.
|
|
||||||
*/
|
|
||||||
$.each(posts, function() {
|
$.each(posts, function() {
|
||||||
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
|
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
|
||||||
$post.append($("<h2>").html(this["title"]));
|
$post.append($("<h2>").html(this["title"]));
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ function postComment(buttonValue) {
|
|||||||
).done(function (response) {
|
).done(function (response) {
|
||||||
if (response == "frozen") {
|
if (response == "frozen") {
|
||||||
alert("Je account is bevroren, dus je kan geen comments plaatsen of \"niet slechten\". Contacteer een admin als je denkt dat dit onjuist is.");
|
alert("Je account is bevroren, dus je kan geen comments plaatsen of \"niet slechten\". Contacteer een admin als je denkt dat dit onjuist is.");
|
||||||
|
} else if (response == "logged out") {
|
||||||
|
window.location.href = "login.php?url=" + window.location.pathname;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -30,6 +32,8 @@ function deletePost(postID) {
|
|||||||
).done(function (response) {
|
).done(function (response) {
|
||||||
if (response == "frozen") {
|
if (response == "frozen") {
|
||||||
alert("Je account is bevroren, dus je kan geen posts verwijderen. Contacteer een admin als je denkt dat dit onjuist is.");
|
alert("Je account is bevroren, dus je kan geen posts verwijderen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||||
|
} else if (response == "logged out") {
|
||||||
|
window.location.href = "login.php?url=" + window.location.pathname;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
closeModal();
|
closeModal();
|
||||||
|
|||||||
BIN
website/public/large.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
website/public/launcher-icon-0-75x.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
website/public/launcher-icon-1-5x.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
website/public/launcher-icon-1x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
website/public/launcher-icon-2x.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
website/public/launcher-icon-3x.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
website/public/launcher-icon-4x.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
44
website/public/manifest.json
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"name": "Web Application Manifest Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "launcher-icon-0-75x.png",
|
||||||
|
"sizes": "36x36",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "0.75"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "launcher-icon-1x.png",
|
||||||
|
"sizes": "48x48",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "1.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "launcher-icon-1-5x.png",
|
||||||
|
"sizes": "72x72",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "1.5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "launcher-icon-2x.png",
|
||||||
|
"sizes": "96x96",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "2.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "launcher-icon-3x.png",
|
||||||
|
"sizes": "144x144",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "3.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "launcher-icon-4x.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "4.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": "index.html",
|
||||||
|
"display": "standalone",
|
||||||
|
"orientation": "portrait"
|
||||||
|
}
|
||||||
@@ -25,7 +25,8 @@ if(empty($_GET["username"])) {
|
|||||||
$userID = getUserID($_GET["username"]);
|
$userID = getUserID($_GET["username"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$user = selectUser($_SESSION["userID"], $userID)) {
|
|
||||||
|
if (isset($_SESSION["userID"]) and !$user = selectUser($_SESSION["userID"], $userID)) {
|
||||||
header("HTTP/1.0 404 Not Found");
|
header("HTTP/1.0 404 Not Found");
|
||||||
header("Location: error/404.php");
|
header("Location: error/404.php");
|
||||||
die();
|
die();
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
<?php
|
<?php
|
||||||
$alertClass;
|
$alertClass;
|
||||||
$alertMessage;
|
$alertMessage;
|
||||||
|
|
||||||
|
// Select which button has been pressed.
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
try {
|
try {
|
||||||
switch ($_POST["form"]) {
|
switch ($_POST["form"]) {
|
||||||
@@ -29,7 +31,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
case "picture":
|
case "picture":
|
||||||
updateAvatar();
|
updateAvatar();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (AlertMessage $w) {
|
} catch (AlertMessage $w) {
|
||||||
$alertClass = $w->getClass();
|
$alertClass = $w->getClass();
|
||||||
|
|||||||
BIN
website/public/square.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
@@ -1,11 +1,13 @@
|
|||||||
.admin-panel {
|
|
||||||
min-width: 800px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-panel input[type="radio"], input[type="checkbox"] {
|
.admin-panel input[type="radio"], input[type="checkbox"] {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height: 28px;
|
height: 14px;
|
||||||
margin: 2px;
|
width: 14px;
|
||||||
|
margin: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox {
|
||||||
|
width: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-searchform {
|
.admin-searchform {
|
||||||
@@ -34,13 +36,15 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usertable .table-username {width: 150px}
|
.table-checkbox {width: 20px}
|
||||||
.usertable .table-status {width: 100px}
|
.table-username {width: 150px}
|
||||||
.usertable .table-action {width: 200px}
|
.table-status {width: 100px}
|
||||||
|
.table-action {width: 200px}
|
||||||
|
|
||||||
.usertable th, td {
|
.usertable th, td {
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usertable th, tr {
|
.usertable th, tr {
|
||||||
@@ -51,6 +55,10 @@
|
|||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bancomment {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
.bancommentedit {
|
.bancommentedit {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,8 +256,6 @@ div[data-title]:hover:after {
|
|||||||
top: 150%;
|
top: 150%;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
-moz-border-radius: 3px;
|
|
||||||
-webkit-border-radius: 3px;
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
|
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
|
|||||||
@@ -91,16 +91,5 @@
|
|||||||
|
|
||||||
.deleteButton {
|
.deleteButton {
|
||||||
background-color: firebrick;
|
background-color: firebrick;
|
||||||
}
|
float: right;
|
||||||
|
|
||||||
.deleteButton i {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deleteButton:hover span {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deleteButton span {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
@@ -27,16 +27,21 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.friend-button-container div, .status-buttons-container div {
|
||||||
|
width: 200px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
.friend-button-container button, .status-buttons-container button, .group-button-container button {
|
.friend-button-container button, .status-buttons-container button, .group-button-container button {
|
||||||
display: block;
|
display: block;
|
||||||
|
float: right;
|
||||||
|
|
||||||
margin: 7px 0;
|
margin: 7px 0;
|
||||||
|
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
.status-buttons-container button {
|
||||||
.friend-button-container button, .status-buttons-container button, .group-button-fixed {
|
float: left;
|
||||||
width: 200px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-container button {
|
.group-button-container button {
|
||||||
@@ -74,22 +79,21 @@
|
|||||||
|
|
||||||
.group-picture {
|
.group-picture {
|
||||||
border: none;
|
border: none;
|
||||||
margin-right: 15px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-fancy span {
|
.fancy-button span {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-fancy:hover {
|
.fancy-button:hover {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-fancy i {
|
.fancy-button i {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-fancy:hover span {
|
.fancy-button:hover span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
website/public/tiny.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
website/public/wide.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
@@ -41,7 +41,11 @@ function checkInputChoice($variable, $option){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks for only letters and spaces. */
|
/**
|
||||||
|
* Checks for only letters and spaces.
|
||||||
|
* @param $variable
|
||||||
|
* @throws lettersAndSpacesException
|
||||||
|
*/
|
||||||
function checkName($variable){
|
function checkName($variable){
|
||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
throw new lettersAndSpacesException("Verplicht!");
|
throw new lettersAndSpacesException("Verplicht!");
|
||||||
@@ -52,7 +56,11 @@ function checkName($variable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks for bday */
|
/**
|
||||||
|
* Checks for bday
|
||||||
|
* @param $variable
|
||||||
|
* @throws bdayException
|
||||||
|
*/
|
||||||
function validateBday($variable){
|
function validateBday($variable){
|
||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
throw new bdayException("Verplicht!");
|
throw new bdayException("Verplicht!");
|
||||||
@@ -216,9 +224,13 @@ function test_input($data) {
|
|||||||
$data = trim($data);
|
$data = trim($data);
|
||||||
$data = stripslashes($data);
|
$data = stripslashes($data);
|
||||||
$data = htmlspecialchars($data);
|
$data = htmlspecialchars($data);
|
||||||
|
$data = trim($data);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class lettersAndSpacesException
|
||||||
|
*/
|
||||||
class lettersAndSpacesException extends Exception
|
class lettersAndSpacesException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -227,7 +239,9 @@ class lettersAndSpacesException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class bdayException
|
||||||
|
*/
|
||||||
class bdayException extends Exception
|
class bdayException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -236,6 +250,9 @@ class bdayException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class usernameException
|
||||||
|
*/
|
||||||
class usernameException extends Exception
|
class usernameException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -244,6 +261,9 @@ class usernameException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class passwordException
|
||||||
|
*/
|
||||||
class passwordException extends Exception
|
class passwordException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -252,6 +272,9 @@ class passwordException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class confirmPasswordException
|
||||||
|
*/
|
||||||
class confirmPasswordException extends Exception
|
class confirmPasswordException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -260,6 +283,9 @@ class confirmPasswordException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class fbConfirmPasswordException
|
||||||
|
*/
|
||||||
class fbConfirmPasswordException extends Exception
|
class fbConfirmPasswordException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -268,6 +294,9 @@ class fbConfirmPasswordException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class emailException
|
||||||
|
*/
|
||||||
class emailException extends Exception
|
class emailException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -276,6 +305,9 @@ class emailException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class confirmEmailException
|
||||||
|
*/
|
||||||
class confirmEmailException extends Exception
|
class confirmEmailException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -284,6 +316,9 @@ class confirmEmailException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class captchaException
|
||||||
|
*/
|
||||||
class captchaException extends Exception
|
class captchaException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -292,6 +327,9 @@ class captchaException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class registerException
|
||||||
|
*/
|
||||||
class registerException extends Exception
|
class registerException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ else {
|
|||||||
or die('Error connecting to mysql server');
|
or die('Error connecting to mysql server');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helperfunction to create a database query.
|
||||||
|
* @param string $query
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function prepareQuery(string $query) : PDOStatement {
|
function prepareQuery(string $query) : PDOStatement {
|
||||||
return $GLOBALS["db"]->prepare($query);
|
return $GLOBALS["db"]->prepare($query);
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,13 @@
|
|||||||
require_once "../queries/checkInput.php";
|
require_once "../queries/checkInput.php";
|
||||||
require_once "../queries/picture.php";
|
require_once "../queries/picture.php";
|
||||||
require_once "../queries/alerts.php";
|
require_once "../queries/alerts.php";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a group.
|
||||||
|
*/
|
||||||
function createGroup()
|
function createGroup()
|
||||||
{
|
{
|
||||||
|
// Creates the group.
|
||||||
$createGroup = prepareQuery("
|
$createGroup = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`group_page` (`name`, `description`)
|
`group_page` (`name`, `description`)
|
||||||
@@ -13,6 +18,7 @@ function createGroup()
|
|||||||
$createGroup->bindValue(':description', test_input($_POST["bio"]));
|
$createGroup->bindValue(':description', test_input($_POST["bio"]));
|
||||||
$createGroup->execute();
|
$createGroup->execute();
|
||||||
|
|
||||||
|
// Gets the groupID just created.
|
||||||
$getGroupID = prepareQuery("
|
$getGroupID = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`groupID`
|
`groupID`
|
||||||
@@ -24,6 +30,7 @@ function createGroup()
|
|||||||
$getGroupID->execute();
|
$getGroupID->execute();
|
||||||
$groupID = $getGroupID->fetch()["groupID"];
|
$groupID = $getGroupID->fetch()["groupID"];
|
||||||
|
|
||||||
|
// Adds the user as an admin.
|
||||||
$makeUserAdmin = prepareQuery("
|
$makeUserAdmin = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`group_member` (userID, groupID, role)
|
`group_member` (userID, groupID, role)
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Sends a confirm email if you know the username.
|
||||||
|
* @param string $username
|
||||||
|
*/
|
||||||
function sendConfirmEmailUsername(string $username) {
|
function sendConfirmEmailUsername(string $username) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -15,6 +18,10 @@ function sendConfirmEmailUsername(string $username) {
|
|||||||
sendConfirmEmail($userID);
|
sendConfirmEmail($userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a confirm email if you know the userID.
|
||||||
|
* @param int $userID
|
||||||
|
*/
|
||||||
function sendConfirmEmail(int $userID) {
|
function sendConfirmEmail(int $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -2,10 +2,21 @@
|
|||||||
|
|
||||||
require_once ("connect.php");
|
require_once ("connect.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects all friends of a user.
|
||||||
|
* @param $userID
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function selectFriends($userID) {
|
function selectFriends($userID) {
|
||||||
return selectLimitedFriends($userID, 9999);
|
return selectLimitedFriends($userID, 9999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a limited amount of friends of a user.
|
||||||
|
* @param $userID
|
||||||
|
* @param $limit
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function selectLimitedFriends($userID, $limit) {
|
function selectLimitedFriends($userID, $limit) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -46,7 +57,11 @@ function selectLimitedFriends($userID, $limit) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects all friends of a user.
|
||||||
|
* @param $userID
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function selectAllFriends($userID) {
|
function selectAllFriends($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -83,6 +98,10 @@ function selectAllFriends($userID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all friend requests of the current user.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function selectAllFriendRequests() {
|
function selectAllFriendRequests() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -119,6 +138,11 @@ function selectAllFriendRequests() {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the friendship status from current user and userID.
|
||||||
|
* @param $userID
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function getFriendshipStatus($userID) {
|
function getFriendshipStatus($userID) {
|
||||||
# -2: Query failed.
|
# -2: Query failed.
|
||||||
# -1: user1 and 2 are the same user
|
# -1: user1 and 2 are the same user
|
||||||
@@ -162,6 +186,11 @@ function getFriendshipStatus($userID) {
|
|||||||
return intval($stmt->fetch()["friend_state"]);
|
return intval($stmt->fetch()["friend_state"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request friendship from current user to target user.
|
||||||
|
* @param $userID
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function requestFriendship($userID) {
|
function requestFriendship($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO `friendship` (user1ID, user2ID)
|
INSERT INTO `friendship` (user1ID, user2ID)
|
||||||
@@ -173,6 +202,11 @@ function requestFriendship($userID) {
|
|||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes friendship between current and target user.
|
||||||
|
* @param $userID
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function removeFriendship($userID) {
|
function removeFriendship($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
DELETE FROM `friendship`
|
DELETE FROM `friendship`
|
||||||
@@ -189,6 +223,11 @@ function removeFriendship($userID) {
|
|||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the friendship between current and target user to accepted.
|
||||||
|
* @param $userID
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function acceptFriendship($userID) {
|
function acceptFriendship($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
UPDATE `friendship`
|
UPDATE `friendship`
|
||||||
@@ -204,6 +243,11 @@ function acceptFriendship($userID) {
|
|||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the last time the user visited the chat with specified friend.
|
||||||
|
* @param $friend
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function setLastVisited($friend) {
|
function setLastVisited($friend) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -234,6 +278,13 @@ function setLastVisited($friend) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches m friends from n filtered by search.
|
||||||
|
* @param $n
|
||||||
|
* @param $m
|
||||||
|
* @param $search
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function searchSomeFriends($n, $m, $search) {
|
function searchSomeFriends($n, $m, $search) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -281,6 +332,11 @@ function searchSomeFriends($n, $m, $search) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counts all friends of current user filtered by search.
|
||||||
|
* @param $search
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function countSomeFriends($search) {
|
function countSomeFriends($search) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Gets the current settings for a group.
|
||||||
|
* @param int $groupID
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
function getGroupSettings(int $groupID) {
|
function getGroupSettings(int $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -15,6 +20,12 @@ function getGroupSettings(int $groupID) {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the settings for a group.
|
||||||
|
* @param int $groupID
|
||||||
|
* @throws AngryAlert
|
||||||
|
* @throws HappyAlert
|
||||||
|
*/
|
||||||
function updateGroupSettings(int $groupID)
|
function updateGroupSettings(int $groupID)
|
||||||
{
|
{
|
||||||
if (!checkGroupAdmin($groupID, $_SESSION["userID"])) {
|
if (!checkGroupAdmin($groupID, $_SESSION["userID"])) {
|
||||||
@@ -40,6 +51,12 @@ function updateGroupSettings(int $groupID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a user is an admin for a page.
|
||||||
|
* @param int $groupID
|
||||||
|
* @param int $userID
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function checkGroupAdmin(int $groupID, int $userID) : bool {
|
function checkGroupAdmin(int $groupID, int $userID) : bool {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -60,7 +77,40 @@ function checkGroupAdmin(int $groupID, int $userID) : bool {
|
|||||||
return ($role == "admin");
|
return ($role == "admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllGroupMembers(int $groupID) {
|
/**
|
||||||
|
* Returns all normal members for a group.
|
||||||
|
* @param int $groupID
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
function getAllGroupUsers(int $groupID) {
|
||||||
|
return getAllGroupMembers($groupID, 'member');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all admin for a group.
|
||||||
|
* @param int $groupID
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
function getAllGroupAdmins(int $groupID) {
|
||||||
|
return getAllGroupMembers($groupID, 'admin');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all Moderators for a group.
|
||||||
|
* @param int $groupID
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
function getAllGroupMods(int $groupID) {
|
||||||
|
return getAllGroupMembers($groupID, 'mod');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all members for a group specified by a string.
|
||||||
|
* @param int $groupID
|
||||||
|
* @param string $role
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
function getAllGroupMembers(int $groupID, string $role) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`username`,
|
`username`,
|
||||||
@@ -74,16 +124,25 @@ function getAllGroupMembers(int $groupID) {
|
|||||||
ON
|
ON
|
||||||
`group_member`.`userID` = `user`.`userID`
|
`group_member`.`userID` = `user`.`userID`
|
||||||
WHERE
|
WHERE
|
||||||
`groupID` = :groupID AND `group_member`.`role` = 'member'
|
`groupID` = :groupID AND `group_member`.`role` = :role
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':groupID', $groupID);
|
$stmt->bindParam(':groupID', $groupID);
|
||||||
|
$stmt->bindParam(":role", $role);
|
||||||
if (!$stmt->execute()) {
|
if (!$stmt->execute()) {
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
return $stmt->fetchAll();
|
return $stmt->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upgrades or downgrades a groupmember to a different role.
|
||||||
|
* @param int $groupID
|
||||||
|
* @param int $userID
|
||||||
|
* @param string $role
|
||||||
|
* @throws AngryAlert
|
||||||
|
* @throws HappyAlert
|
||||||
|
*/
|
||||||
function upgradeUser(int $groupID, int $userID, string $role) {
|
function upgradeUser(int $groupID, int $userID, string $role) {
|
||||||
if (!checkGroupAdmin($groupID, $_SESSION["userID"])) {
|
if (!checkGroupAdmin($groupID, $_SESSION["userID"])) {
|
||||||
throw new AngryAlert("Geen toestemming om te wijzigen");
|
throw new AngryAlert("Geen toestemming om te wijzigen");
|
||||||
@@ -107,3 +166,27 @@ function upgradeUser(int $groupID, int $userID, string $role) {
|
|||||||
throw new AngryAlert("Er is iets mis gegaan");
|
throw new AngryAlert("Er is iets mis gegaan");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a group form the database.
|
||||||
|
* @throws AngryAlert
|
||||||
|
* @throws HappyAlert
|
||||||
|
*/
|
||||||
|
function deleteGroup() {
|
||||||
|
if (!checkGroupAdmin($_POST["groupID"], $_SESSION["userID"])) {
|
||||||
|
throw new AngryAlert("Geen toestemming om de groep te verwijderen!");
|
||||||
|
}
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
DELETE FROM
|
||||||
|
`group_page`
|
||||||
|
WHERE
|
||||||
|
`groupID` = :groupID
|
||||||
|
");
|
||||||
|
$stmt->bindValue(":groupID", $_POST["groupID"]);
|
||||||
|
$stmt->execute();
|
||||||
|
if ($stmt->rowCount()) {
|
||||||
|
throw new HappyAlert("Group verwijderd!");
|
||||||
|
} else {
|
||||||
|
throw new AngryAlert("Er is iets mis gegaan");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all groups a user is member of.
|
||||||
|
* @param $userID
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function selectAllGroupsFromUser($userID) {
|
function selectAllGroupsFromUser($userID) {
|
||||||
return selectLimitedGroupsFromUser($userID, 9999);
|
return selectLimitedGroupsFromUser($userID, 9999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects number of groups that a user is member of.
|
||||||
|
* @param $userID
|
||||||
|
* @param $limit
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function selectLimitedGroupsFromUser($userID, $limit) {
|
function selectLimitedGroupsFromUser($userID, $limit) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -27,6 +38,13 @@ function selectLimitedGroupsFromUser($userID, $limit) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns m groups offset by n filtered by search that the current user is part of.
|
||||||
|
* @param $n
|
||||||
|
* @param $m
|
||||||
|
* @param $search
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function searchSomeOwnGroups($n, $m, $search) {
|
function searchSomeOwnGroups($n, $m, $search) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -55,6 +73,11 @@ function searchSomeOwnGroups($n, $m, $search) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counts all groups filtered by search that the current user is member of.
|
||||||
|
* @param $search
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function countSomeOwnGroups($search) {
|
function countSomeOwnGroups($search) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -78,6 +101,13 @@ function countSomeOwnGroups($search) {
|
|||||||
return $stmt->fetchColumn();
|
return $stmt->fetchColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a user by userID to a group by groupID with a specified role.
|
||||||
|
* @param $groupID
|
||||||
|
* @param $userID
|
||||||
|
* @param $role
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function addMember($groupID, $userID, $role) {
|
function addMember($groupID, $userID, $role) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -92,6 +122,13 @@ function addMember($groupID, $userID, $role) {
|
|||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes te role of a user within a group to the specified one.
|
||||||
|
* @param $groupID
|
||||||
|
* @param $userID
|
||||||
|
* @param $role
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function changeMember($groupID, $userID, $role) {
|
function changeMember($groupID, $userID, $role) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -109,6 +146,12 @@ function changeMember($groupID, $userID, $role) {
|
|||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a user from a group.
|
||||||
|
* @param $groupID
|
||||||
|
* @param $userID
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function deleteMember($groupID, $userID) {
|
function deleteMember($groupID, $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
require_once("connect.php");
|
require_once("connect.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects some info from a group by name.
|
||||||
|
* @return bool|mixed
|
||||||
|
*/
|
||||||
function selectGroupByName($name) {
|
function selectGroupByName($name) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -41,6 +45,11 @@ function selectGroupByName($name) {
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the current user's role within a group by the group's ID.
|
||||||
|
* @param int $groupID
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
function selectGroupRole(int $groupID) {
|
function selectGroupRole(int $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -63,6 +72,11 @@ function selectGroupRole(int $groupID) {
|
|||||||
return $stmt->fetch()["role"];
|
return $stmt->fetch()["role"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the status of a group by it's ID.
|
||||||
|
* @param int $groupID
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function selectGroupStatus(int $groupID) {
|
function selectGroupStatus(int $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -80,6 +94,11 @@ function selectGroupStatus(int $groupID) {
|
|||||||
return $stmt->fetch()["status"];
|
return $stmt->fetch()["status"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns some info of all group members.
|
||||||
|
* @param int $groupID
|
||||||
|
* @return bool|PDOStatement
|
||||||
|
*/
|
||||||
function selectGroupMembers(int $groupID) {
|
function selectGroupMembers(int $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -105,9 +124,14 @@ function selectGroupMembers(int $groupID) {
|
|||||||
if (!$stmt->execute()) {
|
if (!$stmt->execute()) {
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
return $stmt->fetchAll();
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns group info by it's ID.
|
||||||
|
* @param $groupID
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function selectGroupById($groupID) {
|
function selectGroupById($groupID) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -127,6 +151,11 @@ function selectGroupById($groupID) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns some info of 20 groups offset by n.
|
||||||
|
* @param $n
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function select20GroupsFromN($n) {
|
function select20GroupsFromN($n) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -149,6 +178,12 @@ function select20GroupsFromN($n) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns info of 20 groups offset by n, filtered by status.
|
||||||
|
* @param $n
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function select20GroupsByStatusFromN($n, $status) {
|
function select20GroupsByStatusFromN($n, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -174,6 +209,13 @@ function select20GroupsByStatusFromN($n, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns info of 20 groups offset by n, filtered by status, filtered by search.
|
||||||
|
* @param $n
|
||||||
|
* @param $keyword
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function search20GroupsFromNByStatus($n, $keyword, $status) {
|
function search20GroupsFromNByStatus($n, $keyword, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -201,6 +243,14 @@ function search20GroupsFromNByStatus($n, $keyword, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns info of n groups offset by m, filtered by status and search.
|
||||||
|
* @param $n
|
||||||
|
* @param $m
|
||||||
|
* @param $search
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function searchSomeGroupsByStatus($n, $m, $search, $status) {
|
function searchSomeGroupsByStatus($n, $m, $search, $status) {
|
||||||
// parentheses not needed in where clause, for clarity as
|
// parentheses not needed in where clause, for clarity as
|
||||||
// role search should override status filter.
|
// role search should override status filter.
|
||||||
@@ -233,6 +283,12 @@ function searchSomeGroupsByStatus($n, $m, $search, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count all groups filtered by status and search.
|
||||||
|
* @param $search
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function countSomeGroupsByStatus($search, $status) {
|
function countSomeGroupsByStatus($search, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -256,6 +312,12 @@ function countSomeGroupsByStatus($search, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the status of a group with the given ID.
|
||||||
|
* @param $id
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function changeGroupStatusByID($id, $status) {
|
function changeGroupStatusByID($id, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -272,6 +334,12 @@ function changeGroupStatusByID($id, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the status of multiple groups to 1 status by an array of IDs.
|
||||||
|
* @param $ids
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function changeMultipleGroupStatusByID($ids, $status) {
|
function changeMultipleGroupStatusByID($ids, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -289,6 +357,13 @@ function changeMultipleGroupStatusByID($ids, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns m groups offset by n, filtered by search.
|
||||||
|
* @param $n
|
||||||
|
* @param $m
|
||||||
|
* @param $search
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function searchSomeGroups($n, $m, $search) {
|
function searchSomeGroups($n, $m, $search) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -312,6 +387,11 @@ function searchSomeGroups($n, $m, $search) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counts all group filtered by search.
|
||||||
|
* @param $search
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function countSomeGroups($search) {
|
function countSomeGroups($search) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
//Find matching password with the inputted username/emailadress.
|
/**
|
||||||
|
* Find matching password with the inputted username/emailadress.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
function getUser() {
|
function getUser() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -35,7 +38,6 @@ function getUserID() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validateLogin($username, $password, $url){
|
function validateLogin($username, $password, $url){
|
||||||
echo $url;
|
|
||||||
// Empty username or password field
|
// Empty username or password field
|
||||||
if (empty($username) || empty($password)) {
|
if (empty($username) || empty($password)) {
|
||||||
throw new loginException("Inloggegevens zijn niet ingevuld");
|
throw new loginException("Inloggegevens zijn niet ingevuld");
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a relative dutch and readable text when given a datetime.
|
||||||
|
* @param $date
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function nicetime($date) {
|
function nicetime($date) {
|
||||||
if(empty($date)) {
|
if(empty($date)) {
|
||||||
return "No date provided";
|
return "No date provided";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create dutch arrays so it has dutch words.
|
||||||
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
|
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
|
||||||
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
|
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
|
||||||
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
|
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
|
||||||
@@ -15,7 +22,8 @@ function nicetime($date) {
|
|||||||
return "Bad date";
|
return "Bad date";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($now > $unix_date) {
|
// Check if it is in the future or not.
|
||||||
|
if($now >= $unix_date) {
|
||||||
$difference = $now - $unix_date;
|
$difference = $now - $unix_date;
|
||||||
$tense = "geleden";
|
$tense = "geleden";
|
||||||
} else {
|
} else {
|
||||||
@@ -23,6 +31,7 @@ function nicetime($date) {
|
|||||||
$tense = "vanaf nu";
|
$tense = "vanaf nu";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the nice time.
|
||||||
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
|
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
|
||||||
$difference /= $lengths[$i];
|
$difference /= $lengths[$i];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
require_once("connect.php");
|
require_once("connect.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select all posts on a user.
|
||||||
|
* @param $userID
|
||||||
|
* @param $groupID
|
||||||
|
* @return bool|PDOStatement
|
||||||
|
*/
|
||||||
function selectAllPosts($userID, $groupID) {
|
function selectAllPosts($userID, $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -46,6 +52,14 @@ function selectAllPosts($userID, $groupID) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select $limit posts from $offset from a user or group.
|
||||||
|
* @param $userID
|
||||||
|
* @param $groupID
|
||||||
|
* @param $offset
|
||||||
|
* @param $limit
|
||||||
|
* @return bool|PDOStatement
|
||||||
|
*/
|
||||||
function selectSomePosts($userID, $groupID, $offset, $limit) {
|
function selectSomePosts($userID, $groupID, $offset, $limit) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -94,9 +108,13 @@ function selectSomePosts($userID, $groupID, $offset, $limit) {
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
return $stmt;
|
return $stmt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select all the post information from an postID.
|
||||||
|
* @param $postID
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function selectPostById($postID) {
|
function selectPostById($postID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -122,6 +140,11 @@ function selectPostById($postID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the comments from a post.
|
||||||
|
* @param $postID
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function selectCommentsByPostId($postID) {
|
function selectCommentsByPostId($postID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -148,6 +171,13 @@ function selectCommentsByPostId($postID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a post to a group or user
|
||||||
|
* @param $userID
|
||||||
|
* @param $groupID
|
||||||
|
* @param $title
|
||||||
|
* @param $content
|
||||||
|
*/
|
||||||
function makePost($userID, $groupID, $title, $content) {
|
function makePost($userID, $groupID, $title, $content) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -172,6 +202,13 @@ function makePost($userID, $groupID, $title, $content) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a comment by a post.
|
||||||
|
* @param $postID
|
||||||
|
* @param $userID
|
||||||
|
* @param $content
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function makeComment($postID, $userID, $content) : int {
|
function makeComment($postID, $userID, $content) : int {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -194,6 +231,12 @@ function makeComment($postID, $userID, $content) : int {
|
|||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a post already is niet slechted.
|
||||||
|
* @param int $postID
|
||||||
|
* @param int $userID
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function makeNietSlecht(int $postID, int $userID) : int {
|
function makeNietSlecht(int $postID, int $userID) : int {
|
||||||
if (checkNietSlecht($postID, $userID)) {
|
if (checkNietSlecht($postID, $userID)) {
|
||||||
return deleteNietSlecht($postID, $userID);
|
return deleteNietSlecht($postID, $userID);
|
||||||
@@ -202,6 +245,12 @@ function makeNietSlecht(int $postID, int $userID) : int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle a niet slecht of a post.
|
||||||
|
* @param int $postID
|
||||||
|
* @param int $userID
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function checkNietSlecht(int $postID, int $userID) {
|
function checkNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -218,6 +267,12 @@ function checkNietSlecht(int $postID, int $userID) {
|
|||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a niet slecht to a post.
|
||||||
|
* @param int $postID
|
||||||
|
* @param int $userID
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function addNietSlecht(int $postID, int $userID) {
|
function addNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -230,6 +285,12 @@ function addNietSlecht(int $postID, int $userID) {
|
|||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a niet slecht.
|
||||||
|
* @param int $postID
|
||||||
|
* @param int $userID
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function deleteNietSlecht(int $postID, int $userID) {
|
function deleteNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
@@ -244,6 +305,11 @@ function deleteNietSlecht(int $postID, int $userID) {
|
|||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a post
|
||||||
|
* @param int $postID
|
||||||
|
* @param int $userID
|
||||||
|
*/
|
||||||
function deletePost(int $postID, int $userID) {
|
function deletePost(int $postID, int $userID) {
|
||||||
if (checkPermissionOnPost($postID, $userID)) {
|
if (checkPermissionOnPost($postID, $userID)) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
@@ -257,6 +323,12 @@ function deletePost(int $postID, int $userID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a user has premissions to delete a post.
|
||||||
|
* @param int $postID
|
||||||
|
* @param int $userID
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function checkPermissionOnPost(int $postID, int $userID) : bool {
|
function checkPermissionOnPost(int $postID, int $userID) : bool {
|
||||||
$getGroupID = prepareQuery("
|
$getGroupID = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -281,6 +353,12 @@ function checkPermissionOnPost(int $postID, int $userID) : bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns role of a user.
|
||||||
|
* @param int $userID
|
||||||
|
* @param int $groupID
|
||||||
|
* @return mixed role of a user.
|
||||||
|
*/
|
||||||
function getRoleInGroup(int $userID, int $groupID) {
|
function getRoleInGroup(int $userID, int $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the the last 100 chat messages.
|
||||||
|
* @param $user2ID
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function getOldChatMessages($user2ID) {
|
function getOldChatMessages($user2ID) {
|
||||||
require_once ("friendship.php");
|
require_once ("friendship.php");
|
||||||
$user1ID = $_SESSION["userID"];
|
$user1ID = $_SESSION["userID"];
|
||||||
@@ -7,6 +12,9 @@ function getOldChatMessages($user2ID) {
|
|||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
|
FROM
|
||||||
|
(SELECT
|
||||||
|
*
|
||||||
FROM
|
FROM
|
||||||
`private_message`
|
`private_message`
|
||||||
WHERE
|
WHERE
|
||||||
@@ -15,9 +23,11 @@ function getOldChatMessages($user2ID) {
|
|||||||
`origin` = :user2 AND
|
`origin` = :user2 AND
|
||||||
`destination` = :user1
|
`destination` = :user1
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`creationdate` ASC
|
`messageID` DESC
|
||||||
LIMIT
|
LIMIT
|
||||||
100
|
100) sub
|
||||||
|
ORDER BY
|
||||||
|
`messageID` ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":user1", $user1ID);
|
$stmt->bindParam(":user1", $user1ID);
|
||||||
@@ -31,6 +41,12 @@ function getOldChatMessages($user2ID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a chat message.
|
||||||
|
* @param $destination
|
||||||
|
* @param $content
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function sendMessage($destination, $content) {
|
function sendMessage($destination, $content) {
|
||||||
require_once("friendship.php");
|
require_once("friendship.php");
|
||||||
if (getFriendshipStatus($destination) == 1) {
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
@@ -60,6 +76,12 @@ function sendMessage($destination, $content) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the chat messages after an messageID ($lastID).
|
||||||
|
* @param $lastID
|
||||||
|
* @param $destination
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function getNewChatMessages($lastID, $destination) {
|
function getNewChatMessages($lastID, $destination) {
|
||||||
require_once("friendship.php");
|
require_once("friendship.php");
|
||||||
if (getFriendshipStatus($destination) == 1) {
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
@@ -76,7 +98,7 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
`destination` = :user1) AND
|
`destination` = :user1) AND
|
||||||
`messageID` > :lastID
|
`messageID` > :lastID
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`creationdate` ASC
|
`messageID` ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
||||||
@@ -91,7 +113,10 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get of every friend the first unread chat message.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function selectAllUnreadChat() {
|
function selectAllUnreadChat() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 1 if an username exists with the filled in username.
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function getExistingUsername() {
|
function getExistingUsername() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -16,6 +20,10 @@ function getExistingUsername() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 1 if an username exists with facebooklogin
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function getExistingFBUsername() {
|
function getExistingFBUsername() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -32,6 +40,10 @@ function getExistingFBUsername() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 1 if an email exists with the filled in email.
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function getExistingEmail() {
|
function getExistingEmail() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -48,6 +60,10 @@ function getExistingEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 1 if an email exists with facebook register
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function getExistingFBEmail() {
|
function getExistingFBEmail() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -65,6 +81,10 @@ function getExistingFBEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 1 if an email exists with the forgot email input
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
function getResetEmail() {
|
function getResetEmail() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -81,6 +101,9 @@ function getResetEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a new account in the database
|
||||||
|
*/
|
||||||
function registerAccount() {
|
function registerAccount() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -119,6 +142,9 @@ function registerAccount() {
|
|||||||
$stmt->rowCount();
|
$stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a new account with facebook register
|
||||||
|
*/
|
||||||
function fbRegisterAccount() {
|
function fbRegisterAccount() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -158,6 +184,11 @@ function fbRegisterAccount() {
|
|||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks which dates need to be selected when there is an invalid registration.
|
||||||
|
* @param $date
|
||||||
|
* @param $value
|
||||||
|
*/
|
||||||
function submitselect($date, $value){
|
function submitselect($date, $value){
|
||||||
if ($date == $value){
|
if ($date == $value){
|
||||||
echo "selected";
|
echo "selected";
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once "../queries/connect.php";
|
include_once "../queries/connect.php";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a link to an email to change the password of an account
|
||||||
|
* @param string $email
|
||||||
|
*/
|
||||||
function sendPasswordRecovery(string $email) {
|
function sendPasswordRecovery(string $email) {
|
||||||
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
@@ -24,11 +28,16 @@ function sendPasswordRecovery(string $email) {
|
|||||||
$hashedHash = password_hash($hash, PASSWORD_DEFAULT);
|
$hashedHash = password_hash($hash, PASSWORD_DEFAULT);
|
||||||
setHashToDatabase($userID, $hash);
|
setHashToDatabase($userID, $hash);
|
||||||
doSendPasswordRecovery($userID, $email, $username, $hashedHash);
|
doSendPasswordRecovery($userID, $email, $username, $hashedHash);
|
||||||
} else {
|
|
||||||
// TODO: Be angry!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the message in the email to reset a password of an account.
|
||||||
|
* @param int $userID
|
||||||
|
* @param string $email
|
||||||
|
* @param string $username
|
||||||
|
* @param string $hash
|
||||||
|
*/
|
||||||
function doSendPasswordRecovery(int $userID, string $email, string $username, string $hash) {
|
function doSendPasswordRecovery(int $userID, string $email, string $username, string $hash) {
|
||||||
$resetLink = "https://myhyvesbookplus.nl/resetpassword.php?u=$userID&h=$hash";
|
$resetLink = "https://myhyvesbookplus.nl/resetpassword.php?u=$userID&h=$hash";
|
||||||
|
|
||||||
@@ -38,6 +47,11 @@ function doSendPasswordRecovery(int $userID, string $email, string $username, st
|
|||||||
mail($email, $subject, $body, $header);
|
mail($email, $subject, $body, $header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the previous password invalid.
|
||||||
|
* @param int $userID
|
||||||
|
* @param string $hash
|
||||||
|
*/
|
||||||
function setHashToDatabase(int $userID, string $hash) {
|
function setHashToDatabase(int $userID, string $hash) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ function getSettings() {
|
|||||||
`location`,
|
`location`,
|
||||||
`birthdate`,
|
`birthdate`,
|
||||||
`bio`,
|
`bio`,
|
||||||
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
|
'../img/avatar-standard.png'
|
||||||
|
) AS profilepicture,
|
||||||
`showBday`,
|
`showBday`,
|
||||||
`showEmail`,
|
`showEmail`,
|
||||||
`showProfile`
|
`showProfile`
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
require_once ("connect.php");
|
require_once ("connect.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This sets the last activity of the session user to now.
|
||||||
|
* @return bool, true is it ran correctly
|
||||||
|
*/
|
||||||
function updateLastActivity() {
|
function updateLastActivity() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -15,6 +19,11 @@ function updateLastActivity() {
|
|||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This gets the userID from a username
|
||||||
|
* @param $username
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
function getUserID($username) {
|
function getUserID($username) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -30,6 +39,11 @@ function getUserID($username) {
|
|||||||
return $stmt->fetch()["userID"];
|
return $stmt->fetch()["userID"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This gets the username from a userID
|
||||||
|
* @param $userID
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
function getUsername($userID) {
|
function getUsername($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -45,6 +59,12 @@ function getUsername($userID) {
|
|||||||
return $stmt->fetch()["username"];
|
return $stmt->fetch()["username"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This selects the information about the other user and the connection between the two.
|
||||||
|
* @param $me
|
||||||
|
* @param $other
|
||||||
|
* @return bool|mixed
|
||||||
|
*/
|
||||||
function selectUser($me, $other) {
|
function selectUser($me, $other) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -107,6 +127,11 @@ function selectUser($me, $other) {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select all the users from a group.
|
||||||
|
* @param $userID
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function selectAllUserGroups($userID) {
|
function selectAllUserGroups($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -130,6 +155,11 @@ function selectAllUserGroups($userID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects 20 users from a given point in the table, ordered by role and name
|
||||||
|
* @param $n
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function select20UsersFromN($n) {
|
function select20UsersFromN($n) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -155,6 +185,12 @@ function select20UsersFromN($n) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search 20 users from a given point in the table, ordered by role and name
|
||||||
|
* @param $n
|
||||||
|
* @param $keyword
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function search20UsersFromN($n, $keyword) {
|
function search20UsersFromN($n, $keyword) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -183,6 +219,13 @@ function search20UsersFromN($n, $keyword) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search 20 users from a given point in the database where the status @param $status
|
||||||
|
* @param $n
|
||||||
|
* @param $keyword
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function search20UsersFromNByStatus($n, $keyword, $status) {
|
function search20UsersFromNByStatus($n, $keyword, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -215,6 +258,14 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search users from a given point in the database where the status @param $status
|
||||||
|
* @param $n
|
||||||
|
* @param $m
|
||||||
|
* @param $search
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function searchSomeUsersByStatus($n, $m, $search, $status) {
|
function searchSomeUsersByStatus($n, $m, $search, $status) {
|
||||||
// parentheses not needed in where clause, for clarity as
|
// parentheses not needed in where clause, for clarity as
|
||||||
// role search should override status filter.
|
// role search should override status filter.
|
||||||
@@ -252,6 +303,12 @@ function searchSomeUsersByStatus($n, $m, $search, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the users with a name like $search and a $status
|
||||||
|
* @param $search
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function countSomeUsersByStatus($search, $status) {
|
function countSomeUsersByStatus($search, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -276,7 +333,12 @@ function countSomeUsersByStatus($search, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the user status
|
||||||
|
* @param $id
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function changeUserStatusByID($id, $status) {
|
function changeUserStatusByID($id, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -293,6 +355,12 @@ function changeUserStatusByID($id, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change multiple user statuses by an id array.
|
||||||
|
* @param $ids
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function changeMultipleUserStatusByID($ids, $status) {
|
function changeMultipleUserStatusByID($ids, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -310,6 +378,13 @@ function changeMultipleUserStatusByID($ids, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change multiple user statuses by an id array.
|
||||||
|
* This excludes that admins and owners statuses can be changed.
|
||||||
|
* @param $ids
|
||||||
|
* @param $status
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function changeMultipleUserStatusByIDAdmin($ids, $status) {
|
function changeMultipleUserStatusByIDAdmin($ids, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -329,6 +404,11 @@ function changeMultipleUserStatusByIDAdmin($ids, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select a random user that is nog your friend.
|
||||||
|
* @param $userID
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
function selectRandomNotFriendUser($userID) {
|
function selectRandomNotFriendUser($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -357,6 +437,13 @@ function selectRandomNotFriendUser($userID) {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search users.
|
||||||
|
* @param $n
|
||||||
|
* @param $m
|
||||||
|
* @param $search
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function searchSomeUsers($n, $m, $search) {
|
function searchSomeUsers($n, $m, $search) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -397,6 +484,11 @@ function searchSomeUsers($n, $m, $search) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the users that you get searching for a user with a keyword.
|
||||||
|
* @param $search
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
function countSomeUsers($search) {
|
function countSomeUsers($search) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -420,6 +512,11 @@ function countSomeUsers($search) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the role of a user by userID.
|
||||||
|
* @param $userID
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
function getRoleByID($userID) {
|
function getRoleByID($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -435,6 +532,11 @@ function getRoleByID($userID) {
|
|||||||
return $stmt->fetch()["role"];
|
return $stmt->fetch()["role"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit the ban comment.
|
||||||
|
* @param $userID
|
||||||
|
* @param $comment
|
||||||
|
*/
|
||||||
function editBanCommentByID($userID, $comment) {
|
function editBanCommentByID($userID, $comment) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<th class="table-username">Groepsnaam</th>
|
<th class="table-username">Groepsnaam</th>
|
||||||
<th class="table-status">Status</th>
|
<th class="table-status">Status</th>
|
||||||
<th class="table-comment">Beschrijving</th>
|
<th class="table-comment">Beschrijving</th>
|
||||||
<th class="table-action">Actie</th>
|
<th class="table-action">Zichtbaarheid</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Pagina:
|
|||||||
id="currentpage"
|
id="currentpage"
|
||||||
form="admin-searchform"
|
form="admin-searchform"
|
||||||
onchange="adminSearch();">
|
onchange="adminSearch();">
|
||||||
|
<!-- Construct the options. -->
|
||||||
<?php
|
<?php
|
||||||
for ($i=1; $i <= ceil($countresults / $entries); $i++) {
|
for ($i=1; $i <= ceil($countresults / $entries); $i++) {
|
||||||
if ($currentpage == $i) {
|
if ($currentpage == $i) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll()"></th>
|
<th class="table-checkbox"><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll()"></th>
|
||||||
<th class="table-username">Gebruikersnaam</th>
|
<th class="table-username">Gebruikersnaam</th>
|
||||||
<th class="table-status">Status</th>
|
<th class="table-status">Status</th>
|
||||||
<th class="table-comment">Aantekening</th>
|
<th class="table-comment">Aantekening</th>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
<!-- Form value holding. -->
|
||||||
<!-- function test_input taken from http://www.w3schools.com/php/php_form_validation.asp -->
|
|
||||||
<?php
|
<?php
|
||||||
$search = "";
|
$search = "";
|
||||||
$status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner");
|
$status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner");
|
||||||
@@ -127,11 +126,11 @@ if (isset($_GET["groupstatus"])) {
|
|||||||
if ($userinfo == 'owner') {
|
if ($userinfo == 'owner') {
|
||||||
echo "<button type=\"submit\"
|
echo "<button type=\"submit\"
|
||||||
name=\"batchactions\"
|
name=\"batchactions\"
|
||||||
id=\"admin\"
|
id=\"batch-admin\"
|
||||||
value=\"admin\">Maak Admin</button>
|
value=\"admin\">Maak Admin</button>
|
||||||
<button type=\"submit\"
|
<button type=\"submit\"
|
||||||
name=\"batchactions\"
|
name=\"batchactions\"
|
||||||
id=\"owner\"
|
id=\"batch-owner\"
|
||||||
value=\"owner\">Maak Eigenaar</button>";
|
value=\"owner\">Maak Eigenaar</button>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -140,9 +139,9 @@ if (isset($_GET["groupstatus"])) {
|
|||||||
onsubmit="adminUpdate(this); return false;">
|
onsubmit="adminUpdate(this); return false;">
|
||||||
|
|
||||||
<input type="hidden" name="groupbatchactions" id="groupbatchinput">
|
<input type="hidden" name="groupbatchactions" id="groupbatchinput">
|
||||||
<button type="submit" name="batchactions" id="hide" value="hidden">Verborgen</button>
|
<button type="submit" name="batchactions" id="batch-hide" value="hidden">Verborgen</button>
|
||||||
<button type="submit" name="batchactions" id="ban" value="public">Publiek</button>
|
<button type="submit" name="batchactions" id="batch-public" value="public">Publiek</button>
|
||||||
<button type="submit" name="batchactions" id="members" value="membersonly">Alleen Leden</button>
|
<button type="submit" name="batchactions" id="batch-members" value="membersonly">Alleen Leden</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -152,5 +151,3 @@ if (isset($_GET["groupstatus"])) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,3 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($acces_token)) {
|
||||||
|
echo '<button id="fbBtn" class="button">Facebook registreer</button>';
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div id="fbModal" class="modal">
|
<div id="fbModal" class="modal">
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="user-box">
|
<div class="user-box">
|
||||||
<img class="group-picture main-picture" src="<?= $group["picture"] ?>"><br />
|
<img alt="<?= $group["name"] ?>" class="group-picture main-picture" src="<?= $group["picture"] ?>"><br />
|
||||||
<div class="platform">
|
<div class="platform">
|
||||||
<div class="status-buttons-container">
|
<div class="status-buttons-container">
|
||||||
<button disabled class="gray"><?= $group["status"] ?></button>
|
<button disabled class="gray"><?= $group["status"] ?></button>
|
||||||
@@ -16,9 +16,18 @@
|
|||||||
<h2>Leden (<?= $group['members'] ?>)</h2>
|
<h2>Leden (<?= $group['members'] ?>)</h2>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
foreach($members as $member) {
|
$membercount = $members->rowCount();
|
||||||
|
$memberdif = $membercount - 7;
|
||||||
|
|
||||||
|
for ($i = 0; $i < min($membercount, 7); $i += 1) {
|
||||||
|
$member = $members->fetch();
|
||||||
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>";
|
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>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($memberdif > 0) {
|
||||||
|
echo $memberdif === 1 ? "en nog 1 andere." : "...en nog $memberdif anderen.";
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
|
|||||||
<li>
|
<li>
|
||||||
<label></label>
|
<label></label>
|
||||||
<a href="group.php?groupname=<?=$groupinfo["name"]?>">
|
<a href="group.php?groupname=<?=$groupinfo["name"]?>">
|
||||||
<button class="fa fa-chevron-left"> Terug naar de groep</button>
|
<button><i class="fa fa-chevron-left"></i> Terug naar de groep</button>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -51,8 +51,7 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
|
|||||||
<button type="submit"
|
<button type="submit"
|
||||||
name="form"
|
name="form"
|
||||||
value="group"
|
value="group"
|
||||||
class="fa fa-save"
|
><i class="fa fa-save"></i> Opslaan</button>
|
||||||
> Opslaan</button>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
@@ -80,8 +79,7 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
|
|||||||
<button type="submit"
|
<button type="submit"
|
||||||
name="form"
|
name="form"
|
||||||
value="picture"
|
value="picture"
|
||||||
class="fa fa-picture-o"
|
><i class="fa fa-picture-o"></i> Verander profielfoto</button>
|
||||||
> Verander profielfoto</button>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
@@ -94,7 +92,7 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
|
|||||||
<select name="userID">
|
<select name="userID">
|
||||||
<option disabled selected>Geen gebruiker geselecteerd:</option>
|
<option disabled selected>Geen gebruiker geselecteerd:</option>
|
||||||
<?php
|
<?php
|
||||||
$groupMembers = getAllGroupMembers($_GET["groupID"]);
|
$groupMembers = getAllGroupUsers($_GET["groupID"]);
|
||||||
foreach ($groupMembers as $groupMember) {?>
|
foreach ($groupMembers as $groupMember) {?>
|
||||||
<option value="<?=$groupMember["userID"]?>">
|
<option value="<?=$groupMember["userID"]?>">
|
||||||
<?=$groupMember["fullname"]?> (<?=$groupMember["username"]?>)
|
<?=$groupMember["fullname"]?> (<?=$groupMember["username"]?>)
|
||||||
@@ -114,11 +112,55 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
|
|||||||
</il>
|
</il>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
|
<form class="platform" method="post">
|
||||||
|
<h5>Verwijder een admin/mod</h5>
|
||||||
|
<ul>
|
||||||
|
<il>
|
||||||
|
<input name="groupID" value="<?=$_GET["groupID"]?>" type="hidden">
|
||||||
|
<label>Selecteer gebruiker</label>
|
||||||
|
<select name="userID">
|
||||||
|
<option disabled selected>Geen gebruiker geselecteerd:</option>
|
||||||
|
<?php
|
||||||
|
$groupAdmins = getAllGroupAdmins($_GET["groupID"]);
|
||||||
|
foreach ($groupAdmins as $groupAdmin) {?>
|
||||||
|
<option value="<?=$groupAdmin["userID"]?>">
|
||||||
|
<?=$groupAdmin["fullname"]?> (<?=$groupAdmin["username"]?>) (<?=$groupAdmin["role"]?>)
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
<?php
|
||||||
|
$groupMods = getAllGroupMods($_GET["groupID"]);
|
||||||
|
foreach ($groupMods as $groupMod) {?>
|
||||||
|
<option value="<?=$groupMod["userID"]?>">
|
||||||
|
<?=$groupMod["fullname"]?> (<?=$groupMod["username"]?>) (<?=$groupMod["role"]?>)
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
<button name="form"
|
||||||
|
value="deadmin"
|
||||||
|
>
|
||||||
|
Verwijder
|
||||||
|
</button>
|
||||||
|
</il>
|
||||||
|
</ul>
|
||||||
|
</form>
|
||||||
|
<form class="platform" method="post">
|
||||||
|
<ul>
|
||||||
|
<h5>Verwijder groep</h5>
|
||||||
|
<li>
|
||||||
|
<label></label>
|
||||||
|
<input name="groupID" value="<?=$_GET["groupID"]?>" type="hidden">
|
||||||
|
<button class="red"
|
||||||
|
name="form"
|
||||||
|
value="delete"
|
||||||
|
><i class="fa fa-trash"></i> Verwijder groep</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</form>
|
||||||
<div class="platform">
|
<div class="platform">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<label></label>
|
<label></label>
|
||||||
<a href="group.php?groupname=<?=$groupinfo["name"]?>"><button class="fa fa-chevron-left"> Terug naar de groep</button></a>
|
<a href="group.php?groupname=<?=$groupinfo["name"]?>"><button><i class="fa fa-chevron-left"></i> Terug naar de groep</button></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,41 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="description" content="MyHyvesbook+ is het sociaal media voor alle coole mensen.">
|
<meta name="description" content="MyHyvesbook+ is het sociaal medium voor alle coole mensen. Stap nu over van facebook op het gloednieuwe en betere sociaal medium.">
|
||||||
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
|
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
|
||||||
<meta name="author" content="MyHyvesbookplus corporation">
|
<meta name="author" content="MyHyvesbookplus corporation">
|
||||||
|
<!--Favicon-->
|
||||||
|
<!-- Desktop Browsers -->
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||||
|
|
||||||
|
<!-- Android: Chrome M39 and up-->
|
||||||
|
<link rel="manifest" href="manifest.json">
|
||||||
|
<!-- Android: Chrome M31 and up, ignored if manifest is present-->
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<link rel="icon" sizes="192x192" href="icon-192x192.png">
|
||||||
|
<!-- iOS -->
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-title" content="My Awesome Web App">
|
||||||
|
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon-180x180-precomposed.png">
|
||||||
|
<link href="apple-touch-icon-152x152-precomposed.png" sizes="152x152" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-144x144-precomposed.png" sizes="144x144" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-120x120-precomposed.png" sizes="120x120" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-114x114-precomposed.png" sizes="114x114" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-76x76-precomposed.png" sizes="76x76" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-72x72-precomposed.png" sizes="72x72" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-60x60-precomposed.png" sizes="60x60" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-57x57-precomposed.png" sizes="57x57" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-precomposed.png" rel="apple-touch-icon">
|
||||||
|
|
||||||
|
<!-- Windows 8 and IE 11 -->
|
||||||
|
<meta name="msapplication-config" content="browserconfig.xml" />
|
||||||
|
|
||||||
|
<!-- Windows -->
|
||||||
|
<meta name="application-name" content="My Awesome Web App" />
|
||||||
|
<meta name="msapplication-tooltip" content="Get the latest updates!" />
|
||||||
|
<meta name="msapplication-window" content="width=1024;height=768" />
|
||||||
|
<meta name="msapplication-navbutton-color" content="#FF3300" />
|
||||||
|
<meta name="msapplication-starturl" content="./" />
|
||||||
|
|
||||||
<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>
|
||||||
@@ -26,8 +60,8 @@ require_once ("../queries/user.php");
|
|||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
if(!isset($_SESSION["userID"])){
|
if(!isset($_SESSION["userID"])) {
|
||||||
header("location:login.php");
|
header("location:login.php?url=" . "$_SERVER[REQUEST_URI]");
|
||||||
} else {
|
} else {
|
||||||
updateLastActivity();
|
updateLastActivity();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ $userinfo = getHeaderInfo();
|
|||||||
<div id="hello-loop">
|
<div id="hello-loop">
|
||||||
Hallo
|
Hallo
|
||||||
</div>
|
</div>
|
||||||
<?=$userinfo["fname"]?>
|
<?= $userinfo["fname"] ?>
|
||||||
</div>
|
</div>
|
||||||
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/><i id="open-notifications" class="fa fa-bars"></i>
|
<img alt="<?= $userinfo["lname"] ?>" id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/><i id="open-notifications" class="fa fa-bars"></i>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<?php include("notification-center.php"); ?>
|
<?php include("notification-center.php"); ?>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
// Checks if there's an user already logged in
|
// Checks if there's a user already logged in
|
||||||
if(isset($_SESSION["userID"])){
|
if(isset($_SESSION["userID"])){
|
||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload=checkLoggedIn();
|
window.onload=checkLoggedIn();
|
||||||
@@ -29,13 +29,12 @@ $user = $psw = $remember ="";
|
|||||||
$loginErr = $resetErr = $fbRegisterErr ="";
|
$loginErr = $resetErr = $fbRegisterErr ="";
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
$url = $_POST["url"];
|
|
||||||
// Checks for which button is pressed
|
// Checks for which button is pressed
|
||||||
switch ($_POST["submit"]) {
|
switch ($_POST["submit"]) {
|
||||||
case "login":
|
case "login":
|
||||||
try {
|
try {
|
||||||
$user = ($_POST["user"]);
|
$user = ($_POST["user"]);
|
||||||
validateLogin($_POST["user"], $_POST["psw"], $url);
|
validateLogin($_POST["user"], $_POST["psw"], $_POST["url"]);
|
||||||
} catch(loginException $e) {
|
} catch(loginException $e) {
|
||||||
$loginErr = $e->getMessage();
|
$loginErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,42 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="description" content="MyHyvesbook+ is het sociaal media voor alle coole mensen.">
|
<meta name="description" content="MyHyvesbook+ is het sociaal medium voor alle coole mensen. Stap nu over van facebook op het gloednieuwe en betere sociaal medium.">
|
||||||
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
|
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
|
||||||
<meta name="author" content="MyHyvesbookplus corporation">
|
<meta name="author" content="MyHyvesbookplus corporation">
|
||||||
|
<!-- Favicon-->
|
||||||
|
<!-- Desktop Browsers -->
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||||
|
|
||||||
|
<!-- Android: Chrome M39 and up-->
|
||||||
|
<link rel="manifest" href="manifest.json">
|
||||||
|
<!-- Android: Chrome M31 and up, ignored if manifest is present-->
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<link rel="icon" sizes="192x192" href="icon-192x192.png">
|
||||||
|
<!-- iOS -->
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-title" content="My Awesome Web App">
|
||||||
|
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon-180x180-precomposed.png">
|
||||||
|
<link href="apple-touch-icon-152x152-precomposed.png" sizes="152x152" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-144x144-precomposed.png" sizes="144x144" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-120x120-precomposed.png" sizes="120x120" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-114x114-precomposed.png" sizes="114x114" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-76x76-precomposed.png" sizes="76x76" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-72x72-precomposed.png" sizes="72x72" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-60x60-precomposed.png" sizes="60x60" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-57x57-precomposed.png" sizes="57x57" rel="apple-touch-icon">
|
||||||
|
<link href="apple-touch-icon-precomposed.png" rel="apple-touch-icon">
|
||||||
|
|
||||||
|
<!-- Windows 8 and IE 11 -->
|
||||||
|
<meta name="msapplication-config" content="browserconfig.xml" />
|
||||||
|
|
||||||
|
<!-- Windows -->
|
||||||
|
<meta name="application-name" content="My Awesome Web App" />
|
||||||
|
<meta name="msapplication-tooltip" content="Get the latest updates!" />
|
||||||
|
<meta name="msapplication-window" content="width=1024;height=768" />
|
||||||
|
<meta name="msapplication-navbutton-color" content="#FF3300" />
|
||||||
|
<meta name="msapplication-starturl" content="./" />
|
||||||
|
|
||||||
<title>MyHyvesbook+</title>
|
<title>MyHyvesbook+</title>
|
||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
type="text/css"
|
type="text/css"
|
||||||
|
|||||||
@@ -5,14 +5,6 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
|
|||||||
?>
|
?>
|
||||||
<div class='post-header header'>
|
<div class='post-header header'>
|
||||||
<h4><?=$post['title']?></h4>
|
<h4><?=$post['title']?></h4>
|
||||||
<?php if (checkPermissionOnPost($postID, $_SESSION["userID"])) {?>
|
|
||||||
<button class="deleteButton"
|
|
||||||
onclick="deletePost('<?=$postID?>')"
|
|
||||||
type="submit">
|
|
||||||
<i class="fa fa-trash"></i>
|
|
||||||
<span>Verwijder post</span>
|
|
||||||
</button><br />
|
|
||||||
<?php } ?>
|
|
||||||
<span class='postinfo'>
|
<span class='postinfo'>
|
||||||
gepost door <?=$fullname?>,
|
gepost door <?=$fullname?>,
|
||||||
<span class='posttime' title='<?=$post['creationdate']?>'>
|
<span class='posttime' title='<?=$post['creationdate']?>'>
|
||||||
@@ -20,7 +12,14 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if (checkPermissionOnPost($postID, $_SESSION["userID"])) {?>
|
||||||
|
<button class="deleteButton fancy-button"
|
||||||
|
onclick="deletePost('<?=$postID?>')"
|
||||||
|
type="submit">
|
||||||
|
<span>Verwijder post</span>
|
||||||
|
<i class="fa fa-trash"></i>
|
||||||
|
</button><br />
|
||||||
|
<?php } ?>
|
||||||
<div class='post-content'>
|
<div class='post-content'>
|
||||||
<p><?=$post['content']?></p>
|
<p><?=$post['content']?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,13 +4,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="user-box">
|
<div class="user-box">
|
||||||
<img class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br />
|
<img alt="<?= $user["fname"] ?>" class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br />
|
||||||
<div class="platform">
|
<div class="platform">
|
||||||
<div class="status-buttons-container">
|
<div class="status-buttons-container">
|
||||||
|
<div>
|
||||||
<button disabled class="gray">
|
<button disabled class="gray">
|
||||||
<?= $user["onlinestatus"] ?>
|
<?= $user["onlinestatus"] ?>
|
||||||
</button>
|
</button>
|
||||||
<button disabled class="gray"><?= $user["role"] ?></button>
|
</div>
|
||||||
|
<div>
|
||||||
|
<button disabled class="gray">
|
||||||
|
<?= $user["role"] ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="friend-button-container">
|
<div class="friend-button-container">
|
||||||
<p>:)</p>
|
<p>:)</p>
|
||||||
@@ -33,7 +39,6 @@
|
|||||||
<?php if($showProfile) { ?>
|
<?php if($showProfile) { ?>
|
||||||
<div class="item-box platform">
|
<div class="item-box platform">
|
||||||
<h3>Informatie</h3>
|
<h3>Informatie</h3>
|
||||||
<p>
|
|
||||||
<ul>
|
<ul>
|
||||||
<?php if ($user["showBday"]) { ?>
|
<?php if ($user["showBday"]) { ?>
|
||||||
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
|
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
|
||||||
@@ -44,17 +49,23 @@
|
|||||||
<li>Locatie: <?= $user["location"] ?></li>
|
<li>Locatie: <?= $user["location"] ?></li>
|
||||||
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
|
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item-box platform">
|
<div class="item-box platform">
|
||||||
<h3>Vrienden</h3>
|
<h3>Vrienden</h3>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
while($friend = $profile_friends->fetch()) {
|
$friendcount = $profile_friends->rowCount();
|
||||||
echo "<a href='profile.php?username=${friend["username"]}' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
|
$frienddif = $friendcount - 7;
|
||||||
|
|
||||||
|
for ($i = 0; $i < min($friendcount, 7); $i += 1) {
|
||||||
|
$friend = $profile_friends->fetch();
|
||||||
|
echo "<a href='profile.php?username=${friend["username"]}' data-title='${friend["username"]}'><img class='profile-picture' height='42' width='42' src='${friend["profilepicture"]}' alt='${friend["username"]}' /></a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($frienddif > 0) {
|
||||||
|
echo $frienddif === 1 ? "en nog 1 andere." : "...en nog $frienddif anderen.";
|
||||||
|
}
|
||||||
|
|
||||||
if($profile_friends->rowCount() === 0) {
|
if($profile_friends->rowCount() === 0) {
|
||||||
echo "<p>Deze gebruiker heeft nog geen vrienden gemaakt.</p>";
|
echo "<p>Deze gebruiker heeft nog geen vrienden gemaakt.</p>";
|
||||||
@@ -67,10 +78,18 @@
|
|||||||
<h3>Groepen</h3>
|
<h3>Groepen</h3>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
while($group = $profile_groups->fetch()) {
|
$groupcount = $profile_groups->rowCount();
|
||||||
|
$groupdif = $groupcount - 7;
|
||||||
|
|
||||||
|
for ($i = 0; $i < min($groupcount, 7); $i += 1) {
|
||||||
|
$group = $profile_groups->fetch();
|
||||||
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>";
|
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 ($groupdif > 0) {
|
||||||
|
echo $groupdif === 1 ? "en nog 1 andere." : "...en nog $groupdif anderen.";
|
||||||
|
}
|
||||||
|
|
||||||
if($profile_groups->rowCount() === 0) {
|
if($profile_groups->rowCount() === 0) {
|
||||||
echo "<p>Deze gebruiker is nog geen lid van een groep.</p>";
|
echo "<p>Deze gebruiker is nog geen lid van een groep.</p>";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ $settings = getSettings();
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?php $currentbday = new DateTime($settings["birthdate"]); ?>
|
<?php $currentbday = new DateTime($settings["birthdate"]); ?>
|
||||||
<label for="bday">Geboortedatum</label>
|
<label>Geboortedatum</label>
|
||||||
<select name='day' id="bday">
|
<select name='day'>
|
||||||
<?php for ($day = 1; $day <= 31; $day++): ?>
|
<?php for ($day = 1; $day <= 31; $day++): ?>
|
||||||
<option value='<?=$day?>'
|
<option value='<?=$day?>'
|
||||||
<?=($day == $currentbday->format("d")) ? "selected" : ""?>
|
<?=($day == $currentbday->format("d")) ? "selected" : ""?>
|
||||||
@@ -55,7 +55,7 @@ $settings = getSettings();
|
|||||||
</option>
|
</option>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
</select>
|
</select>
|
||||||
<select name='month' id="bday">
|
<select name='month'>
|
||||||
<?php
|
<?php
|
||||||
$months = array ("januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus",
|
$months = array ("januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus",
|
||||||
"september", "oktober", "november", "december");
|
"september", "oktober", "november", "december");
|
||||||
@@ -68,7 +68,7 @@ $settings = getSettings();
|
|||||||
</option>
|
</option>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
</select>
|
</select>
|
||||||
<select name='year' id="bday">
|
<select name='year'>
|
||||||
<?php
|
<?php
|
||||||
$now = (new DateTime)->format("Y");
|
$now = (new DateTime)->format("Y");
|
||||||
for ($year = $now; $year >= 1900; $year--): ?>
|
for ($year = $now; $year >= 1900; $year--): ?>
|
||||||
|
|||||||