Merge branch 'master' into hendrik-post
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
Options +FollowSymLinks
|
Options +FollowSymLinks
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
ErrorDocument 404 /error404.jpg
|
ErrorDocument 404 /error/404.php
|
||||||
|
|
||||||
RewriteCond %{SCRIPT_FILENAME} !-d
|
RewriteCond %{SCRIPT_FILENAME} !-d
|
||||||
RewriteCond %{SCRIPT_FILENAME} !-f
|
RewriteCond %{SCRIPT_FILENAME} !-f
|
||||||
|
|||||||
25
website/public/API/adminChangeUser.php
Normal file
25
website/public/API/adminChangeUser.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
require_once ("../../queries/group_page.php");
|
||||||
|
|
||||||
|
$userinfo = getRoleByID($_SESSION['userID']);
|
||||||
|
|
||||||
|
if (isset($_POST["actions"]) && isset($_POST["userID"])) {
|
||||||
|
changeUserStatusByID($_POST["userID"], $_POST["actions"]);
|
||||||
|
} else if (isset($_POST["actions"]) && isset($_POST["groupID"])) {
|
||||||
|
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
|
||||||
|
} else if (isset($_POST["batchactions"]) && isset($_POST["checkbox-user"])) {
|
||||||
|
if ($userinfo == 'owner') {
|
||||||
|
changeMultipleUserStatusByID($_POST["checkbox-user"], $_POST["batchactions"]);
|
||||||
|
} else {
|
||||||
|
changeMultipleUserStatusByIDAdmin($_POST["checkbox-user"], $_POST["batchactions"]);
|
||||||
|
}
|
||||||
|
} else if (isset($_POST["groupbatchactions"]) && isset($_POST["checkbox-group"])) {
|
||||||
|
changeMultipleGroupStatusByID($_POST["checkbox-group"], $_POST["groupbatchactions"]);
|
||||||
|
} else if (isset($_POST['bancommentuserID']) && isset($_POST['bancommenttext'])) {
|
||||||
|
editBanCommentByID($_POST['bancommentuserID'], $_POST['bancommenttext']);
|
||||||
|
}
|
||||||
38
website/public/API/adminPageNumber.php
Normal file
38
website/public/API/adminPageNumber.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
require_once ("../../queries/group_page.php");
|
||||||
|
|
||||||
|
$search = "";
|
||||||
|
if (isset($_POST["search"])) {
|
||||||
|
$search = test_input($_POST["search"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pagetype = "user";
|
||||||
|
if (isset($_POST['pagetype'])) {
|
||||||
|
$pagetype = test_input($_POST['pagetype']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = array();
|
||||||
|
if (isset($_POST['status'])) {
|
||||||
|
$status = $_POST["status"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$groupstatus = array();
|
||||||
|
if (isset($_POST['groupstatus'])) {
|
||||||
|
$groupstatus = $_POST["groupstatus"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$entries = 20;
|
||||||
|
$currentpage = 1;
|
||||||
|
if (isset($_POST['currentpage'])) {
|
||||||
|
$currentpage = (int) test_input($_POST["currentpage"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$offset = (int) $currentpage * $entries - $entries;
|
||||||
|
|
||||||
|
include ("../../views/adminpanel-page.php");
|
||||||
44
website/public/API/adminSearchUsers.php
Normal file
44
website/public/API/adminSearchUsers.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
require_once ("../../queries/group_page.php");
|
||||||
|
|
||||||
|
$offset = 0;
|
||||||
|
$entries = 20;
|
||||||
|
if (isset($_POST["currentpage"])) {
|
||||||
|
$offset = (int) test_input($_POST["currentpage"]) * $entries - $entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
$search = "";
|
||||||
|
if (isset($_POST["search"])) {
|
||||||
|
$search = test_input($_POST["search"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pagetype = "user";
|
||||||
|
if (isset($_POST['pagetype'])) {
|
||||||
|
$pagetype = test_input($_POST['pagetype']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = array();
|
||||||
|
if (isset($_POST['status'])) {
|
||||||
|
$status = $_POST["status"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$groupstatus = array();
|
||||||
|
if (isset($_POST['groupstatus'])) {
|
||||||
|
$groupstatus = $_POST["groupstatus"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$userinfo = getRoleByID($_SESSION['userID']);
|
||||||
|
|
||||||
|
if ($pagetype == "user") {
|
||||||
|
include ("../../views/adminpanel-table.php");
|
||||||
|
} else if ($pagetype == "group") {
|
||||||
|
include ("../../views/adminpanel-grouptable.php");
|
||||||
|
} else {
|
||||||
|
echo "Search failed!";
|
||||||
|
}
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(empty($_POST["usr"])) {
|
if(empty($_POST["usr"]) and empty($_POST["grp"])) {
|
||||||
header('HTTP/1.1 500 Non enough arguments');
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once ("../../queries/user.php");
|
require_once ("../../queries/post.php");
|
||||||
require_once ("../../queries/nicetime.php");
|
require_once ("../../queries/nicetime.php");
|
||||||
|
|
||||||
$posts = selectAllUserPosts($_POST["usr"]);
|
if(empty($_POST["usr"])) {
|
||||||
|
$posts = selectAllPosts(0, $_POST["grp"]);
|
||||||
|
} else {
|
||||||
|
$posts = selectAllPosts($_POST["usr"], 0);
|
||||||
|
}
|
||||||
|
|
||||||
if(!$posts) {
|
if(!$posts) {
|
||||||
header('HTTP/1.1 500 Query failed');
|
header('HTTP/1.1 500 Query failed');
|
||||||
@@ -19,6 +23,4 @@ for($i = 0; $i < sizeof($results); $i++) {
|
|||||||
$results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]);
|
$results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$results[0]["niceTime"] = nicetime($results[0]["creationdate"]);
|
|
||||||
|
|
||||||
echo json_encode($results);
|
echo json_encode($results);
|
||||||
@@ -4,5 +4,12 @@ session_start();
|
|||||||
|
|
||||||
require_once ("../../queries/connect.php");
|
require_once ("../../queries/connect.php");
|
||||||
require_once ("../../queries/friendship.php");
|
require_once ("../../queries/friendship.php");
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
|
||||||
|
if (isset($_SESSION["userID"]) &&
|
||||||
|
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
echo selectAllFriendRequests();
|
echo selectAllFriendRequests();
|
||||||
|
} else {
|
||||||
|
echo "[]";
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ require_once ("../../queries/connect.php");
|
|||||||
require_once ("../../queries/checkInput.php");
|
require_once ("../../queries/checkInput.php");
|
||||||
require_once ("../../queries/friendship.php");
|
require_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
if (isset($_SESSION["userID"])) {
|
||||||
if (isset($_POST["limit"])) {
|
if (isset($_POST["limit"])) {
|
||||||
echo selectLimitedFriends($_SESSION["userID"], (int)test_input($_POST["limit"]));
|
echo selectLimitedFriends($_SESSION["userID"], (int)test_input($_POST["limit"]));
|
||||||
} else if (isset($_GET["limit"])) {
|
} else if (isset($_GET["limit"])) {
|
||||||
@@ -13,4 +14,7 @@ if (isset($_POST["limit"])) {
|
|||||||
} else {
|
} else {
|
||||||
echo selectFriends($_SESSION["userID"]);
|
echo selectFriends($_SESSION["userID"]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
echo "[]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
41
website/public/API/nietSlecht.php
Normal file
41
website/public/API/nietSlecht.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
require_once ("../queries/connect.php");
|
||||||
|
require_once ("../queries/checkInput.php");
|
||||||
|
|
||||||
|
function getNietSlechtCountForPost(int $postID) : int {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`userID`
|
||||||
|
FROM
|
||||||
|
`niet_slecht`
|
||||||
|
WHERE
|
||||||
|
`postID` = :postID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":postID", $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNietSlechtUsersForPost(int $postID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`fname`,
|
||||||
|
`lname`,
|
||||||
|
CONCAT(`user`.`fname`, ' ', `user`.`lname`) as `fullname`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
INNER JOIN
|
||||||
|
`niet_slecht`
|
||||||
|
WHERE
|
||||||
|
`user`.`userID` = `niet_slecht`.`userID` AND
|
||||||
|
`niet_slecht`.`postID` = :postID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":postID", $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
$rows = $stmt->fetchAll();
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
print($row["fullname"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,13 +2,20 @@
|
|||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
require("../../queries/post.php");
|
require_once("../../queries/post.php");
|
||||||
require("../../queries/connect.php");
|
require_once("../../queries/connect.php");
|
||||||
require("../../queries/checkInput.php");
|
require_once("../../queries/checkInput.php");
|
||||||
|
require_once("../../queries/user.php");
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($_SESSION["userID"]) &&
|
||||||
|
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
|
if ($_POST['button'] == 'reaction') {
|
||||||
if (empty($_POST['newcomment-content'])) {
|
if (empty($_POST['newcomment-content'])) {
|
||||||
echo 0;
|
echo 0;
|
||||||
} else {
|
} else {
|
||||||
if(makeComment(test_input($_POST['postID']),
|
if (makeComment($_POST['postID'],
|
||||||
$_SESSION['userID'],
|
$_SESSION['userID'],
|
||||||
test_input($_POST['newcomment-content']))) {
|
test_input($_POST['newcomment-content']))) {
|
||||||
echo 1;
|
echo 1;
|
||||||
@@ -16,3 +23,15 @@ if (empty($_POST['newcomment-content'])) {
|
|||||||
echo 0;
|
echo 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if ($_POST['button'] == 'nietslecht') {
|
||||||
|
if (makeNietSlecht($_POST["postID"], $_SESSION["userID"])) {
|
||||||
|
echo 1;
|
||||||
|
} else {
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "frozen";
|
||||||
|
}
|
||||||
@@ -2,16 +2,53 @@
|
|||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
require("../../queries/post.php");
|
require_once("../../queries/post.php");
|
||||||
require("../../queries/connect.php");
|
require_once("../../queries/group_page.php");
|
||||||
require("../../queries/checkInput.php");
|
require_once("../../queries/connect.php");
|
||||||
|
require_once("../../queries/checkInput.php");
|
||||||
|
|
||||||
if (empty($_POST['newpost-title'])) {
|
if (empty($_POST["title"]) or
|
||||||
} else {
|
empty($_POST["content"]) or
|
||||||
makePost($_SESSION['userID'],
|
empty($_SESSION["userID"])) {
|
||||||
null,
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
test_input($_POST['newpost-title']),
|
|
||||||
test_input($_POST['newpost-content']));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: ../profile.php");
|
if (empty($_POST["group"])) {
|
||||||
|
// User Post
|
||||||
|
makePost(
|
||||||
|
$_SESSION["userID"],
|
||||||
|
null,
|
||||||
|
test_input($_POST["title"]),
|
||||||
|
test_input($_POST["content"])
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Group Post
|
||||||
|
|
||||||
|
// Check if the user is an admin or mod of the group.
|
||||||
|
if(!in_array(selectGroupRole($_POST["group"]), array('mod', 'admin'))) {
|
||||||
|
header('HTTP/1.1 500 Non enough rights');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
makePost(
|
||||||
|
$_SESSION["userID"],
|
||||||
|
$_POST["group"],
|
||||||
|
test_input($_POST["title"]),
|
||||||
|
test_input($_POST["content"])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//if (empty($_POST['newpost-title'])) {
|
||||||
|
//} else {
|
||||||
|
// makePost($_SESSION['userID'],
|
||||||
|
// null,
|
||||||
|
// test_input($_POST['newpost-title']),
|
||||||
|
// test_input($_POST['newpost-content']));
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//header("Location: ../profile.php");
|
||||||
41
website/public/API/searchPageNumber.php
Normal file
41
website/public/API/searchPageNumber.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
require_once ("../../queries/group_page.php");
|
||||||
|
|
||||||
|
$user_perpage = $group_perpage = 20;
|
||||||
|
|
||||||
|
$user_currentpage = $group_currentpage = 1;
|
||||||
|
if (isset($_POST['user-pageselect'])) {
|
||||||
|
$user_currentpage = test_input($_POST['user-pageselect']);
|
||||||
|
}
|
||||||
|
if (isset($_POST['group-pageselect'])) {
|
||||||
|
$group_currentpage = test_input($_POST['group-pageselect']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_n = $user_currentpage * $user_perpage - $user_perpage;
|
||||||
|
$group_n = $group_currentpage * $group_perpage - $group_perpage;
|
||||||
|
|
||||||
|
$search = "";
|
||||||
|
if (isset($_POST['search'])) {
|
||||||
|
$search = test_input($_POST['search']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_count = countSomeUsers($search)->fetchColumn();
|
||||||
|
$group_count = countSomeGroups($search)->fetchColumn();
|
||||||
|
|
||||||
|
$filter = "all";
|
||||||
|
if (isset($_POST['filter'])) {
|
||||||
|
$filter = test_input($_POST['filter']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$option = "user";
|
||||||
|
if (isset($_POST['option'])) {
|
||||||
|
$option = test_input($_POST['option']);
|
||||||
|
}
|
||||||
|
|
||||||
|
include ("../../views/searchPageNumber.php");
|
||||||
@@ -8,13 +8,15 @@ require_once ("../../queries/friendship.php");
|
|||||||
require_once ("../../queries/user.php");
|
require_once ("../../queries/user.php");
|
||||||
|
|
||||||
$n = 0;
|
$n = 0;
|
||||||
if (isset($_POST["n"])) {
|
|
||||||
$n = (int) test_input($_POST["n"]);
|
|
||||||
}
|
|
||||||
$m = 20;
|
$m = 20;
|
||||||
if (isset($_POST["m"])) {
|
|
||||||
$m = (int) test_input($_POST["m"]);
|
$page = 1;
|
||||||
|
if (isset($_POST["user-pageselect"])) {
|
||||||
|
$page = (int) test_input($_POST['user-pageselect']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$n = ($page - 1) * $m;
|
||||||
|
|
||||||
$search = "";
|
$search = "";
|
||||||
if (isset($_POST["search"])) {
|
if (isset($_POST["search"])) {
|
||||||
$search = test_input($_POST["search"]);
|
$search = test_input($_POST["search"]);
|
||||||
|
|||||||
@@ -4,9 +4,14 @@ session_start();
|
|||||||
require_once("../../queries/connect.php");
|
require_once("../../queries/connect.php");
|
||||||
require_once("../../queries/private_message.php");
|
require_once("../../queries/private_message.php");
|
||||||
require_once("../../queries/checkInput.php");
|
require_once("../../queries/checkInput.php");
|
||||||
|
require_once("../../queries/user.php");
|
||||||
|
|
||||||
|
if (isset($_SESSION["userID"]) &&
|
||||||
|
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
|
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"]))
|
||||||
|
) {
|
||||||
if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
|
if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
|
||||||
echo 1;
|
echo 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -15,3 +20,6 @@ if (!empty(test_input($_POST["destination"])) &&
|
|||||||
} else {
|
} else {
|
||||||
echo 0;
|
echo 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
echo "frozen";
|
||||||
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<?php include("../views/head.php"); ?>
|
<?php
|
||||||
|
require_once ("../queries/user.php");
|
||||||
|
require_once ("../queries/group_page.php");
|
||||||
|
require_once ("../views/head.php"); ?>
|
||||||
<style>
|
<style>
|
||||||
@import url("styles/adminpanel.css");
|
@import url("styles/adminpanel.css");
|
||||||
</style>
|
</style>
|
||||||
|
<script src="js/admin.js" charset="utf-8"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
@@ -12,6 +16,15 @@
|
|||||||
* This view adds the main layout over the screen.
|
* This view adds the main layout over the screen.
|
||||||
* Header and menu.
|
* Header and menu.
|
||||||
*/
|
*/
|
||||||
|
include_once ("../queries/user.php");
|
||||||
|
|
||||||
|
// auth
|
||||||
|
$role = getRoleByID($_SESSION['userID']);
|
||||||
|
|
||||||
|
if ($role != 'admin' AND $role != 'owner') {
|
||||||
|
header("location:profile.php");
|
||||||
|
}
|
||||||
|
|
||||||
include("../views/main.php");
|
include("../views/main.php");
|
||||||
|
|
||||||
/* Add your view files here. */
|
/* Add your view files here. */
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ $friends = json_decode($_POST["friends"]);
|
|||||||
foreach($friends as $i => $friend) {
|
foreach($friends as $i => $friend) {
|
||||||
$friendshipStatus = getFriendshipStatus($friend->userID);
|
$friendshipStatus = getFriendshipStatus($friend->userID);
|
||||||
?>
|
?>
|
||||||
<li class='friend-item <?= $extra ?>'>
|
<li class='friend-item'>
|
||||||
<form action='<?= $action ?>' method='<?= $actionType ?>'>
|
<form action='<?= $action ?>' method='<?= $actionType ?>'>
|
||||||
<button type='submit'
|
<button type='submit'
|
||||||
name='username'
|
name='username'
|
||||||
@@ -33,7 +33,7 @@ foreach($friends as $i => $friend) {
|
|||||||
}
|
}
|
||||||
?>'>
|
?>'>
|
||||||
<div class='friend'>
|
<div class='friend'>
|
||||||
<img alt='PF' class='profile-picture' src='<?= $friend->profilepicture ?>'/>
|
<img alt='PF' class='profile-picture <?= $friend->onlinestatus ?>' src='<?= $friend->profilepicture ?>'/>
|
||||||
<div class='friend-name'>
|
<div class='friend-name'>
|
||||||
<?= $friend->fullname ?><br/>
|
<?= $friend->fullname ?><br/>
|
||||||
<span style='color: #666'><?php
|
<span style='color: #666'><?php
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
include_once("../queries/connect.php");
|
include_once("../queries/connect.php");
|
||||||
include_once("../views/messagepage.php");
|
include_once("../views/messagepage.php");
|
||||||
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||||
$checkHash = $GLOBALS["db"]->prepare("
|
$checkHash = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`,
|
`email`,
|
||||||
`role`
|
`role`
|
||||||
@@ -28,7 +28,7 @@ if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
|||||||
|
|
||||||
function doActivate(string $email) {
|
function doActivate(string $email) {
|
||||||
if (password_verify($email, $_GET["h"])) {
|
if (password_verify($email, $_GET["h"])) {
|
||||||
$confirmUser = $GLOBALS["db"]->prepare("
|
$confirmUser = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
|
|||||||
9
website/public/error/404.php
Normal file
9
website/public/error/404.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
require_once "../../views/messagepage.php";
|
||||||
|
|
||||||
|
messagePage("
|
||||||
|
<div class='error-page'>
|
||||||
|
<h1>404</h1>
|
||||||
|
<h4>Verkeerde link...</h4><br />
|
||||||
|
<img height='25%' width='25%' src='../img/zelda.png'>
|
||||||
|
</div>");
|
||||||
@@ -4,10 +4,23 @@
|
|||||||
<?php include("../views/head.php"); ?>
|
<?php include("../views/head.php"); ?>
|
||||||
<style>
|
<style>
|
||||||
@import url("styles/profile.css");
|
@import url("styles/profile.css");
|
||||||
|
@import url("styles/post-popup.css");
|
||||||
|
@import url('https://fonts.googleapis.com/css?family=Anton');
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
include_once("../queries/group_page.php");
|
||||||
|
|
||||||
|
$group = selectGroupByName($_GET["groupname"]);
|
||||||
|
$members = selectGroupMembers(2);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script>alert("<?= $members[0] ?>");</script>
|
||||||
|
<script>alert("<?= $members[1] ?>");</script>
|
||||||
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This view adds the main layout over the screen.
|
* This view adds the main layout over the screen.
|
||||||
* Header, menu, footer.
|
* Header, menu, footer.
|
||||||
@@ -19,6 +32,23 @@ include("../views/group.php");
|
|||||||
|
|
||||||
/* This adds the footer. */
|
/* This adds the footer. */
|
||||||
include("../views/footer.php");
|
include("../views/footer.php");
|
||||||
|
|
||||||
|
$masonry_mode = 0;
|
||||||
|
if ($group["role"] == "mod" OR $group["role"] == "admin") {
|
||||||
|
$masonry_mode = 2;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<script src="js/masonry.js"></script>
|
||||||
|
<script src="js/post.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
userID = 0;
|
||||||
|
groupID = <?= $group["groupID"] ?>;
|
||||||
|
|
||||||
|
masonry(<?= $masonry_mode ?>);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
BIN
website/public/img/zelda.png
Normal file
BIN
website/public/img/zelda.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
@@ -1,30 +1,48 @@
|
|||||||
window.onload = function() {
|
$(window).on("load", function () {
|
||||||
changeFilter();
|
changeFilter();
|
||||||
};
|
searchFromOne();
|
||||||
|
|
||||||
function checkAll(allbox) {
|
$(".admin-searchinput").keyup(function(){
|
||||||
var checkboxes = document.getElementsByClassName('checkbox-list');
|
searchFromOne();
|
||||||
|
});
|
||||||
|
// all inputs and labels directly under admin filter and groupfilter
|
||||||
|
$("#admin-filter, #admin-groupfilter > input, label").change(function(){
|
||||||
|
searchFromOne();
|
||||||
|
});
|
||||||
|
$("#pagetype").change(function(){
|
||||||
|
searchFromOne();
|
||||||
|
});
|
||||||
|
|
||||||
for (var i = 0; i < checkboxes.length; i++) {
|
/* Update hidden input to be equal to submit pressed,
|
||||||
if (checkboxes[i].type == 'checkbox') {
|
because serialize doesn't take submit values. */
|
||||||
checkboxes[i].checked = allbox.checked;
|
$('#admin-batchform > button').click(function () {
|
||||||
}
|
$('#batchinput').prop('value', $(this).prop('value'));
|
||||||
}
|
console.log($('#batchinput').prop('value'));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#admin-groupbatchform > button').click(function () {
|
||||||
|
$('#groupbatchinput').prop('value', $(this).prop('value'));
|
||||||
|
console.log($('#batchinput').prop('value'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function checkAll() {
|
||||||
|
$('.checkbox-list').each(function () {
|
||||||
|
$(this).prop('checked', $('#checkall').prop('checked'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkCheckAll(allbox) {
|
function checkCheckAll() {
|
||||||
var checkboxes = document.getElementsByClassName('checkbox-list');
|
|
||||||
var checked = true;
|
var checked = true;
|
||||||
|
|
||||||
for (var i = 0; i < checkboxes.length; i++) {
|
$('.checkbox-list').each(function () {
|
||||||
if (checkboxes[i].type == 'checkbox') {
|
if ($(this).prop('checked') == false) {
|
||||||
if (checkboxes[i].checked == false) {
|
|
||||||
checked = false;
|
checked = false;
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
allbox.checked = checked;
|
$('#checkall').prop('checked', checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeFilter() {
|
function changeFilter() {
|
||||||
@@ -32,13 +50,61 @@ function changeFilter() {
|
|||||||
document.getElementById('admin-filter').style.display = 'none';
|
document.getElementById('admin-filter').style.display = 'none';
|
||||||
document.getElementById('admin-groupfilter').style.display = 'inline-block';
|
document.getElementById('admin-groupfilter').style.display = 'inline-block';
|
||||||
|
|
||||||
document.getElementById('admin-batchactions').style.display = 'none';
|
document.getElementById('admin-batchform').style.display = 'none';
|
||||||
document.getElementById('admin-groupbatchactions').style.display = 'inline-block';
|
document.getElementById('admin-groupbatchform').style.display = 'inline-block';
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('admin-filter').style.display = 'inline-block';
|
document.getElementById('admin-filter').style.display = 'inline-block';
|
||||||
document.getElementById('admin-groupfilter').style.display = 'none';
|
document.getElementById('admin-groupfilter').style.display = 'none';
|
||||||
|
|
||||||
document.getElementById('admin-batchactions').style.display = 'inline-block';
|
document.getElementById('admin-batchform').style.display = 'inline-block';
|
||||||
document.getElementById('admin-groupbatchactions').style.display = 'none';
|
document.getElementById('admin-groupbatchform').style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function searchFromOne() {
|
||||||
|
$('#currentpage').prop('value', 1);
|
||||||
|
adminSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
function adminSearch() {
|
||||||
|
console.log($("#admin-searchform").serialize());
|
||||||
|
$.post(
|
||||||
|
"API/adminSearchUsers.php",
|
||||||
|
$("#admin-searchform").serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
$("#usertable").html(data);
|
||||||
|
updatePageN();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function adminUpdate(form) {
|
||||||
|
$.post(
|
||||||
|
"API/adminChangeUser.php",
|
||||||
|
$(form).serialize()
|
||||||
|
).done(function () {
|
||||||
|
adminSearch();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePageN() {
|
||||||
|
$.post(
|
||||||
|
"API/adminPageNumber.php",
|
||||||
|
$("#admin-searchform").serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
$("#admin-pageinfo").html(data);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleBancomment(button) {
|
||||||
|
$(button).siblings("div").toggle();
|
||||||
|
$(button).toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editComment(form) {
|
||||||
|
$.post(
|
||||||
|
"API/adminChangeUser.php",
|
||||||
|
$(form).serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
adminSearch();
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,10 +1,17 @@
|
|||||||
|
var previousDate = new Date("1970-01-01 00:00:00");
|
||||||
|
var previousTime = "00:00";
|
||||||
|
var gettingMessages = false;
|
||||||
|
var previousType = "robot";
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
loadMessages();
|
setInterval(loadMessages, 1000);
|
||||||
sayEmpty();
|
sayEmpty();
|
||||||
$(".chat-field").hide();
|
$(".chat-field").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadMessages() {
|
function loadMessages() {
|
||||||
|
if (!gettingMessages) {
|
||||||
|
gettingMessages = true;
|
||||||
$.post(
|
$.post(
|
||||||
"API/loadMessages.php",
|
"API/loadMessages.php",
|
||||||
$("#lastIDForm").serialize()
|
$("#lastIDForm").serialize()
|
||||||
@@ -13,11 +20,12 @@ function loadMessages() {
|
|||||||
messages = JSON.parse(data);
|
messages = JSON.parse(data);
|
||||||
addMessages(messages);
|
addMessages(messages);
|
||||||
$("#lastID").val(messages[messages.length - 1].messageID);
|
$("#lastID").val(messages[messages.length - 1].messageID);
|
||||||
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight);
|
|
||||||
}
|
}
|
||||||
|
gettingMessages = false;
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
setTimeout(loadMessages, 1000);
|
setTimeout(loadMessages, 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -25,30 +33,75 @@ function sendMessage() {
|
|||||||
$.post(
|
$.post(
|
||||||
"API/sendMessage.php",
|
"API/sendMessage.php",
|
||||||
$("#sendMessageForm").serialize()
|
$("#sendMessageForm").serialize()
|
||||||
);
|
).done(function(response) {
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("#newContent").val("");
|
$("#newContent").val("");
|
||||||
|
loadMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMessages(messages) {
|
function addMessages(messages) {
|
||||||
for(i in messages) {
|
var messagesText = "";
|
||||||
|
for(var i in messages) {
|
||||||
|
// Initialize message variables
|
||||||
|
var thisDate = new Date(messages[i].creationdate);
|
||||||
|
var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes();
|
||||||
|
var type;
|
||||||
|
thisDate.setHours(0,0,0,0);
|
||||||
|
|
||||||
if (messages[i].destination == $(".destinationID").val()) {
|
if (messages[i].destination == $(".destinationID").val()) {
|
||||||
type = "chat-message-self";
|
type = "chat-message-self";
|
||||||
} else {
|
} else {
|
||||||
type = "chat-message-other";
|
type = "chat-message-other";
|
||||||
}
|
}
|
||||||
|
if (i == 0) {
|
||||||
$("#chat-history").append('\
|
if (thisDate > previousDate) {
|
||||||
<div class="chat-message"> \
|
previousDate = thisDate;
|
||||||
<div class="' + type + '">\
|
messagesText += '\
|
||||||
' + messages[i].content + '\
|
<div class="day-message"> \
|
||||||
|
<div class="day-message-content">\
|
||||||
|
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
|
||||||
</div> \
|
</div> \
|
||||||
</div>\
|
</div>';
|
||||||
');
|
|
||||||
}
|
}
|
||||||
|
messagesText += '<div class="chat-message"><div class="' + type + '">';
|
||||||
|
} else if (type != previousType || thisTime != previousTime || thisDate > previousDate) {
|
||||||
|
messagesText += '<div class="chat-time">\
|
||||||
|
' + thisTime + '\
|
||||||
|
</div></div></div>';
|
||||||
|
|
||||||
|
previousTime = thisTime;
|
||||||
|
previousType = type;
|
||||||
|
if (thisDate > previousDate) {
|
||||||
|
previousDate = thisDate;
|
||||||
|
messagesText += '\
|
||||||
|
<div class="day-message"> \
|
||||||
|
<div class="day-message-content">\
|
||||||
|
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
|
||||||
|
</div> \
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
messagesText += '<div class="chat-message"><div class="' + type + '">';
|
||||||
|
}
|
||||||
|
messagesText += fancyText(messages[i].content) + "<br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the last message
|
||||||
|
messagesText += '<div class="chat-time">\
|
||||||
|
' + thisTime + '\
|
||||||
|
</div></div></div>';
|
||||||
|
|
||||||
|
$("#chat-history").append(messagesText);
|
||||||
|
|
||||||
|
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight - $('#chat-history')[0].clientHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchUser(userID) {
|
function switchUser(userID) {
|
||||||
|
previousDate = new Date("1970-01-01 00:00:00");
|
||||||
$(".chat-field").show();
|
$(".chat-field").show();
|
||||||
$(".destinationID").val(userID);
|
$(".destinationID").val(userID);
|
||||||
$("#chat-history").html("");
|
$("#chat-history").html("");
|
||||||
@@ -58,5 +111,5 @@ function switchUser(userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sayEmpty() {
|
function sayEmpty() {
|
||||||
$("#chat-history").html("Begin nu met chatten!");
|
$("#chat-history").html("Probeer ook eens foto's en video's te sturen");
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,70 @@
|
|||||||
function placeFriendButtons() {
|
function placeFriendButtons() {
|
||||||
$.post("API/getFriendshipStatus.php", { usr: userID })
|
$.post("API/getFriendshipStatus.php", { usr: userID })
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
friendshipStatus = data;
|
var friendshipStatus = data;
|
||||||
$buttonContainer = $("div.friend-button-container");
|
var $buttonContainer = $("div.friend-button-container");
|
||||||
$buttonContainer.children().remove();
|
$("#start-profile-chat").hide();
|
||||||
if (friendshipStatus == -1) {
|
$buttonContainer.html("");
|
||||||
return;
|
var value1 = "";
|
||||||
} else if(friendshipStatus == 0) {
|
var class1 = "empty-button";
|
||||||
$buttonContainer.append($("<button class=\"green friend-button\" value=\"request\"><i class=\"fa fa-handshake-o\"></i> Bevriend</button>"));
|
var icon1 = "";
|
||||||
} else if(friendshipStatus == 1) {
|
var text1 = "";
|
||||||
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Verwijder</button>"));
|
|
||||||
} else if(friendshipStatus == 2) {
|
var value2 = "";
|
||||||
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Trek verzoek in</button>"));
|
var class2 = "empty-button";
|
||||||
} else if(friendshipStatus == 3) {
|
var icon2 = "";
|
||||||
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Weiger</button>"));
|
var text2 = "";
|
||||||
$buttonContainer.append($("<button class=\"green friend-button\" value=\"accept\"><i class=\"fa fa-check\"></i> Accepteer</button>"));
|
|
||||||
|
switch (friendshipStatus) {
|
||||||
|
case "0":
|
||||||
|
value1 = "request";
|
||||||
|
class1 = "green";
|
||||||
|
text1 = "Bevriend";
|
||||||
|
icon1 = "fa-handshake-o";
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
value1 = userID;
|
||||||
|
class1 = "green";
|
||||||
|
text1 = "Chat";
|
||||||
|
icon1 = "fa-comment-o";
|
||||||
|
value2 = "delete";
|
||||||
|
class2 = "red";
|
||||||
|
text2 = "Verwijder";
|
||||||
|
icon2 = "fa-times";
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
value1 = "delete";
|
||||||
|
class1 = "red";
|
||||||
|
text1 = "Trek verzoek in";
|
||||||
|
icon1 = "fa-cross";
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
value1 = "accept";
|
||||||
|
class1 = "green";
|
||||||
|
text1 = "Accepteer";
|
||||||
|
icon1 = "fa-check";
|
||||||
|
value2 = "delete";
|
||||||
|
class2 = "red";
|
||||||
|
text2 = "Weiger";
|
||||||
|
icon2 = "fa-times";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$buttonContainer.append(
|
||||||
|
"<button class='"+ class1 +" friend-button' value='"+ value1 +"'>" +
|
||||||
|
"<i class='fa "+ icon1 +"'></i> " + text1 +
|
||||||
|
"</button>");
|
||||||
|
$buttonContainer.append(
|
||||||
|
"<button class='"+ class2 +" friend-button' value='"+ value2 +"'>" +
|
||||||
|
"<i class='fa "+ icon2 +"'></i> " + text2 +
|
||||||
|
"</button>");
|
||||||
|
|
||||||
|
|
||||||
$buttonContainer.children().click(function() {
|
$buttonContainer.children().click(function() {
|
||||||
|
if (isNaN(this.value))
|
||||||
editFriendship(userID, this.value);
|
editFriendship(userID, this.value);
|
||||||
|
else if (this.value != "")
|
||||||
|
window.location.href = "chat.php?username=" + this.value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,40 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// Toggle menu
|
// Toggle menu
|
||||||
$("#own-profile-picture, #open-notifications").click(function() {
|
$("#own-profile-picture, #open-notifications").click(function() {
|
||||||
if ($("#notification-center").css('right') == "-256px") {
|
if ($("#notification-center").css('display') == "none") {
|
||||||
// Make the menu visible and move the content to the left.
|
// Make the menu visible and move the content to the left.
|
||||||
$("#chat-history").width("calc(100% - 587px)");
|
|
||||||
$(".modal").width("calc(100% - 512px)");
|
$(".modal").width("calc(100% - 512px)");
|
||||||
$(".content").css("margin-right", "256px");
|
$(".content").css("margin-right", "256px");
|
||||||
$("#notification-center").css("right", "0px");
|
$("#notification-center").css("right", "0px");
|
||||||
|
$("#notification-center").css("display", "block");
|
||||||
|
$("#contact-menu").css("display", "block");
|
||||||
|
|
||||||
|
// Add cookie so the menu stays open on other pages
|
||||||
|
if (window.innerWidth > 1080) {
|
||||||
|
$("#chat-history").width("calc(100% - 587px)");
|
||||||
|
document.cookie = "menu=open; path=/";
|
||||||
|
} else {
|
||||||
|
document.cookie = "menu=closed; path=/";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Make the menu invisible and move the content to the right.
|
|
||||||
$("#chat-history").width("calc(100% - 331px)");
|
|
||||||
$(".modal").width("calc(100% - 256px)");
|
$(".modal").width("calc(100% - 256px)");
|
||||||
$(".content").css("margin-right", "0px");
|
$(".content").css("margin-right", "0px");
|
||||||
$("#notification-center").css("right", "-256px");
|
$("#notification-center").css("display", "none");
|
||||||
|
|
||||||
|
if (window.innerWidth > 1080) {
|
||||||
|
$("#chat-history").width("calc(100% - 331px)");
|
||||||
|
} else {
|
||||||
|
// Make the menu invisible and move the content to the right.
|
||||||
|
$("#contact-menu").css("display", "none");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change menu cookie to close
|
||||||
|
document.cookie = "menu=closed; path=/";
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (getCookie("menu") == "open") {
|
||||||
|
$("#own-profile-picture").click();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,54 @@
|
|||||||
|
var days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];
|
||||||
|
var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"]
|
||||||
|
|
||||||
|
function fancyText(text) {
|
||||||
|
// Add links, images, gifs and (youtube) video's.
|
||||||
|
var regex = /(https?:\/\/.[^ <>"]*)/ig;
|
||||||
|
text = text.replace(regex, function(link) {
|
||||||
|
// Add images
|
||||||
|
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
|
||||||
|
return "<img alt='" + link + "' src='" + link + "' />";
|
||||||
|
}
|
||||||
|
// Add mp4 video's
|
||||||
|
else if (link.match(/(https?:\/\/.[^ ]*\.(?:mp4))/ig)) {
|
||||||
|
return "<video width='100%'>" +
|
||||||
|
"<source src='"+ link +"' type='video/mp4'>" +
|
||||||
|
"<b>Je browser ondersteund geen video</b>" +
|
||||||
|
"</video><button class='gray' onclick='$(this).prev().get(0).play();'>Speel af</button>";
|
||||||
|
}
|
||||||
|
// Add ogg video's
|
||||||
|
else if (link.match(/(https?:\/\/.[^ ]*\.(?:ogg))/ig)) {
|
||||||
|
return "<video width='100%'>" +
|
||||||
|
"<source src='"+ link +"' type='video/ogg'>" +
|
||||||
|
"<b>Je browser ondersteund geen video</b>" +
|
||||||
|
"</video><button onclick='$(this).prev().get(0).play();'>Speel af</button>";
|
||||||
|
}
|
||||||
|
// Add youtube video's
|
||||||
|
else if (link.match(/(https?:\/\/.(www.)?youtube|youtu.be)*watch/ig)) {
|
||||||
|
return '<iframe width="100%"' +
|
||||||
|
' src="https://www.youtube.com/embed/' + link.substr(link.length - 11) +
|
||||||
|
'" frameborder="0" allowfullscreen></iframe>';
|
||||||
|
}
|
||||||
|
// Add links
|
||||||
|
else {
|
||||||
|
return "<a href='" + link + "'>" + link + "</a>";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookie(key) {
|
||||||
|
cookies = document.cookie.split("; ");
|
||||||
|
for (var i in cookies) {
|
||||||
|
cookie = cookies[i].split("=");
|
||||||
|
if (cookie[0] == key) {
|
||||||
|
return cookie[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function editFriendship(userID, value) {
|
function editFriendship(userID, value) {
|
||||||
$.post("API/editFriendship.php", { usr: userID, action: value })
|
$.post("API/editFriendship.php", { usr: userID, action: value })
|
||||||
.done(function() {
|
.done(function() {
|
||||||
@@ -43,3 +94,13 @@ function showGroups(groups, list) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("body").delegate("textarea[maxlength]", "keydown", function() {
|
||||||
|
if ($(this).val().length / .9 >= $(this).attr("maxlength")) {
|
||||||
|
$(this).next().text($(this).val().length + "/" + $(this).attr("maxlength"));
|
||||||
|
} else {
|
||||||
|
$(this).next().text("");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -19,10 +19,32 @@ function requestPost(postID) {
|
|||||||
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
||||||
scrollbarMargin(scrollBarWidth, 'hidden');
|
scrollbarMargin(scrollBarWidth, 'hidden');
|
||||||
$('#modal-response').show();
|
$('#modal-response').show();
|
||||||
$('#modal-response').html(data);
|
$('#modal-response').html(fancyText(data));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function postPost() {
|
||||||
|
title = $("input.newpost[name='title']").val();
|
||||||
|
content = $("textarea.newpost[name='content']").val();
|
||||||
|
|
||||||
|
if (masonryMode == 2) {
|
||||||
|
$.post("API/postPost.php", { title: title,
|
||||||
|
content : content,
|
||||||
|
group : groupID })
|
||||||
|
.done(function() {
|
||||||
|
masonry(masonryMode);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.post("API/postPost.php", { title: title,
|
||||||
|
content : content })
|
||||||
|
.done(function() {
|
||||||
|
masonry(masonryMode);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
$(".modal-close").click(function () {
|
$(".modal-close").click(function () {
|
||||||
$(".modal").hide();
|
$(".modal").hide();
|
||||||
@@ -33,11 +55,15 @@ $(window).on("load", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var masonryMode = 0;
|
var masonryMode = 0;
|
||||||
|
var windowWidth = $(window).width();
|
||||||
|
|
||||||
$(window).resize(function() {
|
$(window).resize(function() {
|
||||||
clearTimeout(window.resizedFinished);
|
clearTimeout(window.resizedFinished);
|
||||||
window.resizeFinished = setTimeout(function() {
|
window.resizeFinished = setTimeout(function() {
|
||||||
|
if ($(window).width() != windowWidth) {
|
||||||
|
windowWidth = $(window).width();
|
||||||
masonry(masonryMode);
|
masonry(masonryMode);
|
||||||
|
}
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -52,7 +78,7 @@ function masonry(mode) {
|
|||||||
* Initialise columns.
|
* Initialise columns.
|
||||||
*/
|
*/
|
||||||
var columns = new Array(columnCount);
|
var columns = new Array(columnCount);
|
||||||
var $columns = new Array(columnCount);
|
|
||||||
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 + "%");
|
||||||
@@ -60,19 +86,21 @@ function masonry(mode) {
|
|||||||
columns[i] = [0, $column];
|
columns[i] = [0, $column];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode == 1) {
|
if(mode > 0) {
|
||||||
$postInput = $("<div class=\"post platform\">");
|
$postInput = $("<div class=\"post platform\">");
|
||||||
$form = $("<form action=\"API/postPost.php\" method=\"post\">");
|
$form = $("<form class=\"newpost\" action=\"API/postPost.php\" method=\"post\" onsubmit=\"postPost(); return false;\">");
|
||||||
$postInput.append($form);
|
$postInput.append($form);
|
||||||
|
|
||||||
$form.append($("<input class=\"newpost\" name=\"newpost-title\" placeholder=\"Titel\" type=\"text\">"));
|
if(mode == 2) {
|
||||||
$form.append($("<textarea class=\"newpost\" name=\"newpost-content\" placeholder=\"Schrijf een berichtje...\">"));
|
$form.append($("<input class=\"newpost\" type=\"hidden\" name=\"group\" value=\"" + groupID + "\">"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">"));
|
||||||
|
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\" maxlength='1000'></textarea><span></span>"));
|
||||||
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
||||||
columns[0][1].append($postInput);
|
columns[0][1].append($postInput);
|
||||||
|
|
||||||
$postInput.on("load", function() {
|
|
||||||
columns[0][0] = $postInput.height() + margin;
|
columns[0][0] = $postInput.height() + margin;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -92,18 +120,19 @@ function masonry(mode) {
|
|||||||
/*
|
/*
|
||||||
* Get the posts from the server.
|
* Get the posts from the server.
|
||||||
*/
|
*/
|
||||||
$.post("API/getPosts.php", { usr : userID })
|
$.post("API/getPosts.php", { usr : userID, grp : groupID })
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
posts = JSON.parse(data);
|
posts = JSON.parse(data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rearange the objects.
|
* Rearange the objects.
|
||||||
*/
|
*/
|
||||||
jQuery.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>").text(this["title"]));
|
$post.append($("<h2>").html(this["title"]));
|
||||||
$post.append($("<p>").html(this["content"]));
|
$post.append($("<p>").html(fancyText(this["content"])));
|
||||||
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
|
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
|
||||||
|
$post.append($("<p class=\"subscript\">").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"]));
|
||||||
|
|
||||||
shortestColumn = getShortestColumn(columns);
|
shortestColumn = getShortestColumn(columns);
|
||||||
shortestColumn[1].append($post);
|
shortestColumn[1].append($post);
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
function postComment() {
|
function postComment(buttonValue) {
|
||||||
|
formData = $("#newcommentform").serializeArray();
|
||||||
|
formData.push({name: "button", value: buttonValue});
|
||||||
$.post(
|
$.post(
|
||||||
"API/postComment.php",
|
"API/postComment.php",
|
||||||
$("#newcommentform").serialize()
|
formData
|
||||||
);
|
).done(function (response) {
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("#newcomment").val("");
|
$("#newcomment").val("");
|
||||||
|
|
||||||
@@ -11,8 +17,6 @@ function postComment() {
|
|||||||
"API/loadPost.php",
|
"API/loadPost.php",
|
||||||
$("#newcommentform").serialize()
|
$("#newcommentform").serialize()
|
||||||
).done(function (data) {
|
).done(function (data) {
|
||||||
$('#modal-response').html(data);
|
$('#modal-response').html(fancyText(data));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
function checkLoggedIn() {
|
function checkLoggedIn() {
|
||||||
if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) {
|
if (confirm("U bent al ingelogd!!\nWilt u uitloggen?\nKlik ok om uit te loggen.") == true) {
|
||||||
window.location.href = "logout.php";
|
window.location.href = "logout.php";
|
||||||
} else {
|
} else {
|
||||||
window.location.href = "profile.php";
|
window.location.href = "profile.php";
|
||||||
@@ -7,9 +7,9 @@ function checkLoggedIn() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bannedAlert(){
|
function bannedAlert(){
|
||||||
alert("Your account is banned");
|
alert("Uw account is geband!");
|
||||||
}
|
}
|
||||||
|
|
||||||
function emailNotConfirmed(){
|
function emailNotConfirmed(){
|
||||||
alert("Your account has not been verified yet!\nAnother email has been sent to you")
|
alert("Uw account is nog niet bevestigd!\nEr is een nieuwe email gestuurd om uw account te bevestigen");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,41 @@
|
|||||||
function searchUsers(n, m) {
|
$(window).on('load', function () {
|
||||||
|
pageNumber();
|
||||||
|
});
|
||||||
|
|
||||||
|
function searchUsers() {
|
||||||
$.post(
|
$.post(
|
||||||
"API/searchUsers.php",
|
"API/searchUsers.php",
|
||||||
{
|
$('#search-form').serialize()
|
||||||
n: n,
|
|
||||||
m: m,
|
|
||||||
search: $("#search-input").val(),
|
|
||||||
filter: $("#search-filter").val()
|
|
||||||
}
|
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
console.log(data);
|
|
||||||
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
|
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
|
||||||
$("#search-users-list").text("Niemand gevonden");
|
$("#search-users-list").text("Niemand gevonden");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchGroups(n, m) {
|
function searchGroups() {
|
||||||
$.post(
|
$.post(
|
||||||
"API/searchGroups.php",
|
"API/searchGroups.php",
|
||||||
{
|
$('#search-form').serialize()
|
||||||
n: n,
|
|
||||||
m: m,
|
|
||||||
search: $("#search-input").val(),
|
|
||||||
filter: $("#search-filter").val()
|
|
||||||
}
|
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
console.log(data);
|
|
||||||
if (!showGroups(data, "#search-groups-list")) {
|
if (!showGroups(data, "#search-groups-list")) {
|
||||||
$("#search-groups-list").text("Geen groepen gevonden");
|
$("#search-groups-list").text("Geen groepen gevonden");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pageNumber() {
|
||||||
|
var input = input2 = $('#search-form').serialize();
|
||||||
|
$.post(
|
||||||
|
"API/searchPageNumber.php",
|
||||||
|
input + "&option=user"
|
||||||
|
).done(function (data) {
|
||||||
|
$('#user-pageselect').html(data);
|
||||||
|
});
|
||||||
|
$.post(
|
||||||
|
"API/searchPageNumber.php",
|
||||||
|
input2 + "&option=group"
|
||||||
|
).done(function (data) {
|
||||||
|
$('#group-pageselect').html(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -19,16 +19,24 @@
|
|||||||
</script>";
|
</script>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// define variables and set to empty values
|
||||||
|
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
|
||||||
|
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
|
||||||
|
$correct = true;
|
||||||
|
$day_date = "dag";
|
||||||
|
$month_date = "maand";
|
||||||
|
$year_date = "jaar";
|
||||||
|
|
||||||
// Define variables and set to empty values
|
// Define variables and set to empty values
|
||||||
$uname = $psw ="";
|
$user = $psw = $remember ="";
|
||||||
$loginErr = $resetErr ="";
|
$loginErr = $resetErr ="";
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
switch ($_POST["submit"]) {
|
switch ($_POST["submit"]) {
|
||||||
case "login":
|
case "login":
|
||||||
try {
|
try {
|
||||||
$uname = ($_POST["uname"]);
|
$user = ($_POST["user"]);
|
||||||
validateLogin($_POST["uname"], $_POST["psw"]);
|
validateLogin($_POST["user"], $_POST["psw"]);
|
||||||
} catch(loginException $e) {
|
} catch(loginException $e) {
|
||||||
$loginErr = $e->getMessage();
|
$loginErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -46,19 +54,10 @@
|
|||||||
</script>";
|
</script>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "register":
|
||||||
|
include("register.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// // Trying to login
|
|
||||||
// if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
// try{
|
|
||||||
// $uname = ($_POST["uname"]);
|
|
||||||
// validateLogin($_POST["uname"], $_POST["psw"]);
|
|
||||||
// } catch(loginException $e) {
|
|
||||||
// $loginErr = $e->getMessage();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* This view adds login view */
|
/* This view adds login view */
|
||||||
include("../views/login-view.php");
|
include("../views/login-view.php");
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -8,14 +8,16 @@
|
|||||||
<style>
|
<style>
|
||||||
@import url("styles/profile.css");
|
@import url("styles/profile.css");
|
||||||
@import url("styles/post-popup.css");
|
@import url("styles/post-popup.css");
|
||||||
|
@import url('https://fonts.googleapis.com/css?family=Anton');
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
include("../queries/user.php");
|
include_once("../queries/user.php");
|
||||||
include("../queries/friendship.php");
|
include_once("../queries/friendship.php");
|
||||||
include("../queries/nicetime.php");
|
include_once("../queries/nicetime.php");
|
||||||
include("../queries/post.php");
|
include_once("../queries/post.php");
|
||||||
|
include_once("../queries/calcAge.php");
|
||||||
|
|
||||||
if(empty($_GET["username"])) {
|
if(empty($_GET["username"])) {
|
||||||
$userID = $_SESSION["userID"];
|
$userID = $_SESSION["userID"];
|
||||||
@@ -26,7 +28,6 @@ if(empty($_GET["username"])) {
|
|||||||
$user = selectUser($_SESSION["userID"], $userID);
|
$user = selectUser($_SESSION["userID"], $userID);
|
||||||
$profile_friends = selectAllFriends($userID);
|
$profile_friends = selectAllFriends($userID);
|
||||||
$profile_groups = selectAllUserGroups($userID);
|
$profile_groups = selectAllUserGroups($userID);
|
||||||
$posts = selectAllUserPosts($userID);
|
|
||||||
|
|
||||||
|
|
||||||
if ($userID == $_SESSION["userID"]) {
|
if ($userID == $_SESSION["userID"]) {
|
||||||
@@ -53,23 +54,12 @@ include("../views/footer.php");
|
|||||||
<script src="js/friendButtons.js"></script>
|
<script src="js/friendButtons.js"></script>
|
||||||
<script src="js/masonry.js"></script>
|
<script src="js/masonry.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var posts;
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
userID = <?= $userID ?>;
|
userID = <?= $userID ?>;
|
||||||
|
groupID = 0;
|
||||||
placeFriendButtons();
|
placeFriendButtons();
|
||||||
|
|
||||||
masonry(<?= $masonry_mode ?>);
|
masonry(<?= $masonry_mode ?>);
|
||||||
// alert("blap");
|
|
||||||
// $.post("API/getPosts.php", { usr : userID }, "json")
|
|
||||||
// .done(function(data) {
|
|
||||||
// posts = JSON.parse(data);
|
|
||||||
// alert(posts[0]["content"]);
|
|
||||||
// }).fail(function() {
|
|
||||||
// alert("failure...");
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
116
website/public/register(stash).php
Normal file
116
website/public/register(stash).php
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<?php
|
||||||
|
include("../views/login_head.php");
|
||||||
|
require_once("../queries/connect.php");
|
||||||
|
include_once("../queries/register.php");
|
||||||
|
include_once("../queries/checkInput.php");
|
||||||
|
include_once("../queries/emailconfirm.php");
|
||||||
|
?>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if(isset($_SESSION["userID"])){
|
||||||
|
header("location: login.php");
|
||||||
|
}
|
||||||
|
// define variables and set to empty values
|
||||||
|
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
|
||||||
|
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
|
||||||
|
$correct = true;
|
||||||
|
$day_date = "dag";
|
||||||
|
$month_date = "maand";
|
||||||
|
$year_date = "jaar";
|
||||||
|
|
||||||
|
// Trying to register an account
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
try {
|
||||||
|
$name = test_input(($_POST["name"]));
|
||||||
|
checkInputChoice($name, "lettersAndSpaces");
|
||||||
|
} catch(lettersAndSpacesException $e){
|
||||||
|
$correct = false;
|
||||||
|
$nameErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$surname = test_input(($_POST["surname"]));
|
||||||
|
checkInputChoice($surname, "lettersAndSpaces");
|
||||||
|
}
|
||||||
|
catch(lettersAndSpacesException $e){
|
||||||
|
$correct = false;
|
||||||
|
$surnameErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$day_date = test_input(($_POST["day_date"]));
|
||||||
|
$month_date = test_input(($_POST["month_date"]));
|
||||||
|
$year_date = test_input(($_POST["year_date"]));
|
||||||
|
$bday = $year_date . "-" . $month_date . "-" . $day_date;
|
||||||
|
checkInputChoice($bday, "bday");
|
||||||
|
} catch(bdayException $e){
|
||||||
|
$correct = false;
|
||||||
|
$bdayErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$username = str_replace(' ', '', test_input(($_POST["username"])));
|
||||||
|
checkInputChoice($username, "username");
|
||||||
|
} catch(usernameException $e){
|
||||||
|
$correct = false;
|
||||||
|
$usernameErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$password = str_replace(' ', '', test_input(($_POST["password"])));
|
||||||
|
checkInputChoice($password, "longerEight");
|
||||||
|
matchPassword();
|
||||||
|
} catch(passwordException $e){
|
||||||
|
$correct = false;
|
||||||
|
$passwordErr = $e->getMessage();
|
||||||
|
} catch(confirmPasswordException $e){
|
||||||
|
$correct = false;
|
||||||
|
$confirmPasswordErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$location = test_input(($_POST["location"]));
|
||||||
|
checkInputChoice($location, "lettersAndSpaces");
|
||||||
|
} catch(lettersAndSpacesException $e){
|
||||||
|
$correct = false;
|
||||||
|
$locationErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$email = test_input(($_POST["email"]));
|
||||||
|
checkInputChoice($email, "email");
|
||||||
|
$confirmEmail = test_input(($_POST["confirmEmail"]));
|
||||||
|
matchEmail();
|
||||||
|
} catch(emailException $e){
|
||||||
|
$correct = false;
|
||||||
|
$emailErr = $e->getMessage();
|
||||||
|
} catch(confirmEmailException $e){
|
||||||
|
$correct = false;
|
||||||
|
$confirmEmailErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$captcha = $_POST['g-recaptcha-response'];
|
||||||
|
checkCaptcha($captcha);
|
||||||
|
} catch(captchaException $e){
|
||||||
|
$correct = false;
|
||||||
|
$captchaErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
getIp();
|
||||||
|
registerCheck($correct);
|
||||||
|
sendConfirmEmailUsername($username);
|
||||||
|
} catch(registerException $e){
|
||||||
|
$genericErr = $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* This view adds register view */
|
||||||
|
include("../views/register-view.php");
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,25 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<?php
|
<?php
|
||||||
include("../views/login_head.php");
|
|
||||||
require_once("../queries/connect.php");
|
|
||||||
include_once("../queries/register.php");
|
|
||||||
include_once("../queries/checkInput.php");
|
|
||||||
include_once("../queries/emailconfirm.php");
|
|
||||||
?>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
if(isset($_SESSION["userID"])){
|
|
||||||
header("location: login.php");
|
|
||||||
}
|
|
||||||
// define variables and set to empty values
|
|
||||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $captcha = $ip = "";
|
|
||||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $captchaErr = "";
|
|
||||||
$correct = true;
|
|
||||||
|
|
||||||
// Trying to register an account
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
try {
|
try {
|
||||||
$name = test_input(($_POST["name"]));
|
$name = test_input(($_POST["name"]));
|
||||||
checkInputChoice($name, "lettersAndSpaces");
|
checkInputChoice($name, "lettersAndSpaces");
|
||||||
@@ -38,7 +18,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$bday = test_input(($_POST["bday"]));
|
$day_date = test_input(($_POST["day_date"]));
|
||||||
|
$month_date = test_input(($_POST["month_date"]));
|
||||||
|
$year_date = test_input(($_POST["year_date"]));
|
||||||
|
$bday = $year_date . "-" . $month_date . "-" . $day_date;
|
||||||
checkInputChoice($bday, "bday");
|
checkInputChoice($bday, "bday");
|
||||||
} catch(bdayException $e){
|
} catch(bdayException $e){
|
||||||
$correct = false;
|
$correct = false;
|
||||||
@@ -76,9 +59,14 @@
|
|||||||
try{
|
try{
|
||||||
$email = test_input(($_POST["email"]));
|
$email = test_input(($_POST["email"]));
|
||||||
checkInputChoice($email, "email");
|
checkInputChoice($email, "email");
|
||||||
|
$confirmEmail = test_input(($_POST["confirmEmail"]));
|
||||||
|
matchEmail();
|
||||||
} catch(emailException $e){
|
} catch(emailException $e){
|
||||||
$correct = false;
|
$correct = false;
|
||||||
$emailErr = $e->getMessage();
|
$emailErr = $e->getMessage();
|
||||||
|
} catch(confirmEmailException $e){
|
||||||
|
$correct = false;
|
||||||
|
$confirmEmailErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
@@ -94,11 +82,10 @@
|
|||||||
registerCheck($correct);
|
registerCheck($correct);
|
||||||
sendConfirmEmailUsername($username);
|
sendConfirmEmailUsername($username);
|
||||||
} catch(registerException $e){
|
} catch(registerException $e){
|
||||||
|
echo "<script>
|
||||||
|
window.onload = function() {
|
||||||
|
$('#registerModal').show();
|
||||||
|
}
|
||||||
|
</script>";
|
||||||
$genericErr = $e->getMessage();
|
$genericErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* This view adds register view */
|
|
||||||
include("../views/register-view.php");
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changePassword() {
|
function changePassword() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -42,7 +42,7 @@ function changePassword() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function verifyLink(int $userID, string $hash) {
|
function verifyLink(int $userID, string $hash) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`password`
|
`password`
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
3
website/public/styles/adminbutton.css
Normal file
3
website/public/styles/adminbutton.css
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#quick-links i {
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
.admin-panel input[type="radio"], input[type="checkbox"] {
|
.admin-panel input[type="radio"], input[type="checkbox"] {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height: auto;
|
height: 28px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usertable .table-checkbox {width: 20px}
|
|
||||||
.usertable .table-username {width: 150px}
|
.usertable .table-username {width: 150px}
|
||||||
.usertable .table-status {width: 100px}
|
.usertable .table-status {width: 100px}
|
||||||
.usertable .table-action {width: 200px}
|
.usertable .table-action {width: 200px}
|
||||||
@@ -44,10 +43,18 @@
|
|||||||
padding: 3px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usertable tr {
|
.usertable th, tr {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usertable tr:hover {
|
.usertable tr:hover {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bancommentedit {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bancommentform input[type="text"] {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
/* Overall chat-screen */
|
/* Overall chat-screen */
|
||||||
.chat {
|
.chat {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -37,6 +42,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Chat-message takes the whole width of the chat area */
|
/* Chat-message takes the whole width of the chat area */
|
||||||
|
.day-message {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 40px;
|
||||||
|
padding: 10px 0;
|
||||||
|
clear: both;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day-message-content {
|
||||||
|
width: auto;
|
||||||
|
padding: 10px;
|
||||||
|
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
.chat-message {
|
.chat-message {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
@@ -106,3 +127,39 @@
|
|||||||
background: #4CAF50;
|
background: #4CAF50;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-message img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-message a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-time {
|
||||||
|
color: #666666;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: -3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-message-other .chat-time {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1080px) {
|
||||||
|
.chat-message-self, .chat-message-other {
|
||||||
|
max-width: 75%;
|
||||||
|
}
|
||||||
|
.chat {
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#chat-recent-panel {
|
||||||
|
left: 0;
|
||||||
|
width: 320px;
|
||||||
|
}
|
||||||
|
#chat-history {
|
||||||
|
left: 50%;
|
||||||
|
width: calc(100% - 390px);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,8 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#header-search {
|
#header-search {
|
||||||
padding-left: 42px;
|
margin: 24px 0 24px 32px;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -48,5 +49,11 @@ header div {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#open-notifications {
|
#open-notifications {
|
||||||
padding: 5px 20px 5px 0px;
|
padding: 20px 20px 20px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1080px) {
|
||||||
|
#header-logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -30,8 +30,10 @@ form {
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
height: 85%;
|
height: 85%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 80%;
|
width: 600px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -44,13 +46,13 @@ h1 {
|
|||||||
|
|
||||||
/* registreer titel*/
|
/* registreer titel*/
|
||||||
h2 {
|
h2 {
|
||||||
padding: 16px;
|
padding: 8px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 2.0em;
|
font-size: 2.0em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
padding: 16px;
|
padding: 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
@@ -61,11 +63,15 @@ input[type=text], input[type=password], input[type=email], input[type="date"] {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 60%;
|
height: 60%;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 8px 20px;
|
padding: 8px 10px;
|
||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
width: 55%;
|
width: 55%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.middle{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.center{
|
.center{
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@@ -77,7 +83,7 @@ button {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 50%;
|
height: 50%;
|
||||||
padding: 8px 20px;
|
padding: 8px 20px;
|
||||||
margin: 10px;
|
margin: 5px;
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
@@ -88,6 +94,7 @@ button {
|
|||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: red;
|
color: red;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
@@ -96,19 +103,19 @@ label {
|
|||||||
|
|
||||||
/* padding voor registreer container */
|
/* padding voor registreer container */
|
||||||
.login_containerregister {
|
.login_containerregister {
|
||||||
padding: 16px;
|
padding: 8px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* padding voor login_containers */
|
/* padding voor login_containers */
|
||||||
.login_containerlogin {
|
.login_containerlogin {
|
||||||
padding:16px;
|
padding:8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* padding voor foutmelding login */
|
/* padding voor foutmelding login */
|
||||||
.login_containerfault {
|
.login_containerfault {
|
||||||
padding: 16px;
|
padding: 4px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
@@ -127,10 +134,14 @@ label {
|
|||||||
background-attachment: fixed;*/
|
background-attachment: fixed;*/
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
height: 400px;
|
height: 400px;
|
||||||
margin: 34px auto;
|
margin: 16px auto;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
width: 45%;
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
select{
|
||||||
|
width: 18%;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
@@ -143,12 +154,12 @@ ul {
|
|||||||
display: none; /* Hidden by default */
|
display: none; /* Hidden by default */
|
||||||
position: fixed; /* Stay in place */
|
position: fixed; /* Stay in place */
|
||||||
z-index: 1; /* Sit on top */
|
z-index: 1; /* Sit on top */
|
||||||
padding-top: 100px; /* Location of the box */
|
padding-top: 30px; /* Location of the box */
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%; /* Full width */
|
width: 100%; /* Full width */
|
||||||
height: 100%; /* Full height */
|
height: 100%; /* Full height */
|
||||||
overflow: auto; /* Enable scroll if needed */
|
overflow: hidden; /* Enable scroll if needed */
|
||||||
background-color: rgb(0,0,0); /* Fallback color */
|
background-color: rgb(0,0,0); /* Fallback color */
|
||||||
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||||
}
|
}
|
||||||
@@ -160,7 +171,7 @@ ul {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 1px solid #888;
|
border: 1px solid #888;
|
||||||
width: 500px;
|
width: 600px;
|
||||||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
||||||
-webkit-animation-name: animatetop;
|
-webkit-animation-name: animatetop;
|
||||||
-webkit-animation-duration: 0.4s;
|
-webkit-animation-duration: 0.4s;
|
||||||
@@ -183,7 +194,7 @@ ul {
|
|||||||
.close {
|
.close {
|
||||||
color: white;
|
color: white;
|
||||||
float: right;
|
float: right;
|
||||||
font-size: 28px;
|
font-size: 36px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,15 +206,16 @@ ul {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal-header {
|
.modal-header {
|
||||||
padding: 2px 16px;
|
padding: 4px 16px;
|
||||||
background-color: #FBC02D;
|
background-color: #FBC02D;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-body {padding: 2px 16px;}
|
.modal-body {
|
||||||
|
padding: 2px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-footer {
|
.modal-footer {
|
||||||
padding: 2px 16px;
|
|
||||||
background-color: #FBC02D;
|
background-color: #FBC02D;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
@@ -92,21 +92,29 @@ p {
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.online {
|
||||||
|
border: #4CAF50 solid 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offline {
|
||||||
|
border: #666666 solid 3px;
|
||||||
|
}
|
||||||
|
|
||||||
.group-picture {
|
.group-picture {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-box, .item-box-full-width {
|
.item-box, .item-box-full-width {
|
||||||
margin: 20px 0 0 0;
|
|
||||||
padding: 25px;
|
padding: 25px;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-box {
|
.item-box {
|
||||||
width: calc(50% - 60px);
|
width: calc(33% - 50px);
|
||||||
|
display: inline-table;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 900px) {
|
@media only screen and (max-width: 1400px) {
|
||||||
.item-box {
|
.item-box {
|
||||||
width: calc(100% - 50px);
|
width: calc(100% - 50px);
|
||||||
}
|
}
|
||||||
@@ -183,6 +191,10 @@ button.green {
|
|||||||
background-color: forestgreen;
|
background-color: forestgreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.gray{
|
||||||
|
background-color: #FFF;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
button,
|
button,
|
||||||
input[type="submit"],
|
input[type="submit"],
|
||||||
@@ -224,6 +236,7 @@ td {
|
|||||||
|
|
||||||
/* Custom title box, appears instantaneously */
|
/* Custom title box, appears instantaneously */
|
||||||
a[data-title]:hover,
|
a[data-title]:hover,
|
||||||
|
i[data-title]:hover,
|
||||||
img[data-title]:hover,
|
img[data-title]:hover,
|
||||||
span[data-title]:hover,
|
span[data-title]:hover,
|
||||||
div[data-title]:hover {
|
div[data-title]:hover {
|
||||||
@@ -231,6 +244,7 @@ div[data-title]:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a[data-title]:hover:after,
|
a[data-title]:hover:after,
|
||||||
|
i[data-title]:hover:after,
|
||||||
img[data-title]:hover:after,
|
img[data-title]:hover:after,
|
||||||
span[data-title]:hover:after,
|
span[data-title]:hover:after,
|
||||||
div[data-title]:hover:after {
|
div[data-title]:hover:after {
|
||||||
@@ -275,3 +289,34 @@ div[data-title]:hover:after {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
background: #4CAF50;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1080px) {
|
||||||
|
body {
|
||||||
|
font-size: 28px!important;
|
||||||
|
}
|
||||||
|
button, input, select {
|
||||||
|
font-size: 28px;
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
textarea {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
input[type="checkbox"], input[type="radio"] {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 80px;
|
top: 80px;
|
||||||
height: calc(100% - 80px);
|
height: calc(100% - 120px);
|
||||||
width: 236px;
|
width: 236px;
|
||||||
|
|
||||||
padding: 20px 10px;
|
padding: 20px 10px;
|
||||||
@@ -87,3 +87,17 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1080px) {
|
||||||
|
#contact-menu, #notification-center {
|
||||||
|
display: none;
|
||||||
|
background: rgba(0, 0, 0, 0.4);
|
||||||
|
width: calc(50% - 20px);
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
#quick-links i {
|
||||||
|
font-size: 48px!important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
|
body {
|
||||||
|
background-color: #FBC02D;
|
||||||
|
}
|
||||||
|
|
||||||
.password-change {
|
.password-change {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #FBC02D;
|
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,6 +15,14 @@
|
|||||||
margin: 30px auto auto;
|
margin: 30px auto auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.password-change img {
|
.top-logo img {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-page {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-page img {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
47
website/public/styles/mobilefriendly.css
Normal file
47
website/public/styles/mobilefriendly.css
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* MAIN */
|
||||||
|
body {
|
||||||
|
font-size: 28px!important;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* HEADER */
|
||||||
|
#header-logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PROFILE */
|
||||||
|
.post-box {
|
||||||
|
width: calc(100% - 65px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* MENU */
|
||||||
|
#contact-menu, #notification-center {
|
||||||
|
display: none;
|
||||||
|
background: rgba(0, 0, 0, 0.4);
|
||||||
|
width: calc(50% - 20px);
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
#quick-links i {
|
||||||
|
font-size: 48px!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CHAT */
|
||||||
|
.chat-message-self, .chat-message-other {
|
||||||
|
max-width: 75%;
|
||||||
|
}
|
||||||
|
.chat {
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#chat-recent-panel {
|
||||||
|
left: 0;
|
||||||
|
width: 320px;
|
||||||
|
}
|
||||||
|
#chat-history {
|
||||||
|
left: 50%;
|
||||||
|
width: calc(100% - 390px);
|
||||||
|
}
|
||||||
@@ -70,3 +70,17 @@
|
|||||||
margin: 5px auto;
|
margin: 5px auto;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nietslecht-text {
|
||||||
|
font-family: Impact, Anton, sans-serif;
|
||||||
|
text-shadow: -1px 0 1px black, 0 1px 1px black, 1px 0 1px black, 0 -1px 1px black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nietslecht {
|
||||||
|
}
|
||||||
|
|
||||||
|
.nietslecht img {
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
@@ -1,15 +1,60 @@
|
|||||||
.profile-box {
|
/* New */
|
||||||
min-height: 150px;
|
|
||||||
padding: 25px;
|
.user-box {
|
||||||
background-color: #FFFFFF;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-box .profile-picture, .profile-box .group-picture {
|
.status-buttons-container {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
width: 200px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.friend-button-container {
|
||||||
|
position: relative;
|
||||||
|
float: right;
|
||||||
|
width: 200px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.friend-button-container button, .status-buttons-container button {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
margin: 7px 0;
|
||||||
|
width: 200px;
|
||||||
|
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-button {
|
||||||
|
background: none;
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
.empty-button:active {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-info {
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
min-width: 250px;
|
||||||
|
width: auto;
|
||||||
|
padding-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-picture {
|
||||||
|
position: relative;
|
||||||
|
border-width: 5px;
|
||||||
|
|
||||||
|
display: inline-block;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
margin: 0 20px 20px 0;
|
margin-bottom: -45px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Old */
|
||||||
|
|
||||||
.profile-box h1.profile-username {
|
.profile-box h1.profile-username {
|
||||||
padding-top: 50px;
|
padding-top: 50px;
|
||||||
}
|
}
|
||||||
@@ -18,18 +63,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.posts {
|
div.posts {
|
||||||
padding-top: 20px;
|
|
||||||
width: calc(100% + 20px);
|
width: calc(100% + 20px);
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.posts div.post {
|
div.posts div.post {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 20px 0 0 0;
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
width: calc(100% - 40px);
|
width: calc(100% - 40px);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition-duration: 250ms;
|
transition-duration: 250ms;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.posts div.post:hover {
|
div.posts div.post:hover {
|
||||||
@@ -59,6 +103,12 @@ div.posts .post form textarea.newpost {
|
|||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post .post-date {
|
||||||
|
float: right;
|
||||||
|
color: #aaaaaa;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1500px) {
|
@media only screen and (max-width: 1500px) {
|
||||||
.post-box {
|
.post-box {
|
||||||
width: calc(50% - 68px);
|
width: calc(50% - 68px);
|
||||||
@@ -66,28 +116,12 @@ div.posts .post form textarea.newpost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* mobile */
|
/* mobile */
|
||||||
@media only screen and (max-width: 1000px) {
|
@media only screen and (max-width: 1080px) {
|
||||||
.post-box {
|
.post-box {
|
||||||
width: calc(100% - 65px);
|
width: calc(100% - 65px);
|
||||||
}
|
}
|
||||||
|
.modal {
|
||||||
|
left: 0!important;
|
||||||
|
width: 100%!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post .post-date {
|
|
||||||
float: right;
|
|
||||||
color: #aaaaaa;
|
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.friend-button {
|
|
||||||
float: right;
|
|
||||||
height: auto;
|
|
||||||
padding: 10px;
|
|
||||||
margin-left: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
transition-duration: 250ms;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.friend-button:hover {
|
|
||||||
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
|
|
||||||
}
|
}
|
||||||
44
website/queries/alerts.php
Normal file
44
website/queries/alerts.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Class AlertMessage
|
||||||
|
* abstract class for alertMessages used in
|
||||||
|
*/
|
||||||
|
abstract class AlertMessage extends Exception {
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public function getClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class HappyAlert
|
||||||
|
* class for a happy alert as an exception.
|
||||||
|
*/
|
||||||
|
class HappyAlert extends AlertMessage {
|
||||||
|
|
||||||
|
public function __construct($message = "Gelukt!", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClass() {
|
||||||
|
return "settings-message-happy";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AngryAlert
|
||||||
|
* class for an angry alert as as exception.
|
||||||
|
*/
|
||||||
|
class AngryAlert extends AlertMessage {
|
||||||
|
public function __construct($message = "Er is iets fout gegaan.", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClass() {
|
||||||
|
return "settings-message-angry";
|
||||||
|
}
|
||||||
|
}
|
||||||
12
website/queries/calcAge.php
Normal file
12
website/queries/calcAge.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* calculates the age of a user
|
||||||
|
* @param string $bdayAsString
|
||||||
|
* @return int age
|
||||||
|
*/
|
||||||
|
function getAge(string $bdayAsString) : int {
|
||||||
|
$bday = new DateTime($bdayAsString);
|
||||||
|
$today = new DateTime("now");
|
||||||
|
$interval = $bday->diff($today);
|
||||||
|
return $interval->y;
|
||||||
|
}
|
||||||
@@ -38,7 +38,6 @@ function checkName($variable){
|
|||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
throw new lettersAndSpacesException("Verplicht!");
|
throw new lettersAndSpacesException("Verplicht!");
|
||||||
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
|
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
|
||||||
|
|
||||||
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
|
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,12 +47,12 @@ function validateBday($variable){
|
|||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
throw new bdayException("Verplicht!");
|
throw new bdayException("Verplicht!");
|
||||||
} else {
|
} else {
|
||||||
if (!(validateDate($variable, "Y/m/d"))) {
|
if (!(validateDate($variable, "Y-m-d"))) {
|
||||||
throw new bdayException("Geen geldige datum");
|
throw new bdayException("Geen geldige datum");
|
||||||
} else {
|
} else {
|
||||||
$dateNow = date("Y/m/d");
|
$dateNow = date("Y-m-d");
|
||||||
if ($dateNow < $variable) {
|
if ($dateNow < $variable) {
|
||||||
throw new bdayException("Geen geldige datum");
|
throw new bdayException("Geen geldige datum!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,6 +96,12 @@ function validateEmail($variable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function matchEmail(){
|
||||||
|
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
|
||||||
|
throw new confirmEmailException("Emails matchen niet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* checks if an input is a valid email. */
|
/* checks if an input is a valid email. */
|
||||||
function resetEmail($variable){
|
function resetEmail($variable){
|
||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
@@ -119,11 +124,11 @@ function matchPassword(){
|
|||||||
/* Checks if captcha is correctly filled in */
|
/* Checks if captcha is correctly filled in */
|
||||||
function checkCaptcha($captcha){
|
function checkCaptcha($captcha){
|
||||||
if(!$captcha){
|
if(!$captcha){
|
||||||
throw new captchaException("Captcha needs to be filled in!");
|
throw new captchaException("Captcha moet ingevuld worde!");
|
||||||
} else {
|
} else {
|
||||||
$response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Lc72xIUAAAAAPizuF3nUbklCPljVCVzgYespz8o&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']));
|
$response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Lc72xIUAAAAAPizuF3nUbklCPljVCVzgYespz8o&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']));
|
||||||
if($response->success==false) {
|
if($response->success==false) {
|
||||||
throw new captchaException("You are a spammer!");
|
throw new captchaException("Je bent een spammer!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,6 +211,14 @@ class emailException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class confirmEmailException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@@ -9,3 +9,7 @@ else {
|
|||||||
"$dbconf->mysql_username", "$dbconf->mysql_password")
|
"$dbconf->mysql_username", "$dbconf->mysql_password")
|
||||||
or die('Error connecting to mysql server');
|
or die('Error connecting to mysql server');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prepareQuery(string $query) : PDOStatement {
|
||||||
|
return $GLOBALS["db"]->prepare($query);
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function sendConfirmEmailUsername(string $username) {
|
function sendConfirmEmailUsername(string $username) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`
|
`userID`
|
||||||
FROM
|
FROM
|
||||||
@@ -16,7 +16,7 @@ function sendConfirmEmailUsername(string $username) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendConfirmEmail(int $userID) {
|
function sendConfirmEmail(int $userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`,
|
`email`,
|
||||||
`fname`
|
`fname`
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function selectFriends($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectLimitedFriends($userID, $limit) {
|
function selectLimitedFriends($userID, $limit) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -16,7 +16,10 @@ function selectLimitedFriends($userID, $limit) {
|
|||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
`onlinestatus`,
|
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
|
||||||
|
WHEN TRUE THEN 'online'
|
||||||
|
WHEN FALSE THEN 'offline'
|
||||||
|
END AS `onlinestatus`,
|
||||||
`role`
|
`role`
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
@@ -29,6 +32,9 @@ function selectLimitedFriends($userID, $limit) {
|
|||||||
`friendship`.`user1ID` = `user`.`userID`) AND
|
`friendship`.`user1ID` = `user`.`userID`) AND
|
||||||
`user`.`role` != 'banned' AND
|
`user`.`role` != 'banned' AND
|
||||||
`friendship`.`status` = 'confirmed'
|
`friendship`.`status` = 'confirmed'
|
||||||
|
ORDER BY
|
||||||
|
`user`.`lastactivity`
|
||||||
|
DESC
|
||||||
LIMIT :limitCount
|
LIMIT :limitCount
|
||||||
");
|
");
|
||||||
|
|
||||||
@@ -41,7 +47,7 @@ function selectLimitedFriends($userID, $limit) {
|
|||||||
|
|
||||||
|
|
||||||
function selectAllFriends($userID) {
|
function selectAllFriends($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -50,7 +56,10 @@ function selectAllFriends($userID) {
|
|||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
`onlinestatus`,
|
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
|
||||||
|
WHEN TRUE THEN 'online'
|
||||||
|
WHEN FALSE THEN 'offline'
|
||||||
|
END AS `onlinestatus`,
|
||||||
`role`
|
`role`
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
@@ -73,7 +82,7 @@ function selectAllFriends($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectAllFriendRequests() {
|
function selectAllFriendRequests() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -82,7 +91,10 @@ function selectAllFriendRequests() {
|
|||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
`onlinestatus`,
|
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
|
||||||
|
WHEN TRUE THEN 'online'
|
||||||
|
WHEN FALSE THEN 'offline'
|
||||||
|
END AS `onlinestatus`,
|
||||||
`role`
|
`role`
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
@@ -115,7 +127,7 @@ function getFriendshipStatus($userID) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
CASE `status` IS NULL
|
CASE `status` IS NULL
|
||||||
WHEN TRUE THEN 0
|
WHEN TRUE THEN 0
|
||||||
@@ -148,7 +160,7 @@ function getFriendshipStatus($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function requestFriendship($userID) {
|
function requestFriendship($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO `friendship` (user1ID, user2ID)
|
INSERT INTO `friendship` (user1ID, user2ID)
|
||||||
VALUES (:user1, :user2)
|
VALUES (:user1, :user2)
|
||||||
");
|
");
|
||||||
@@ -159,7 +171,7 @@ function requestFriendship($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeFriendship($userID) {
|
function removeFriendship($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
DELETE FROM `friendship`
|
DELETE FROM `friendship`
|
||||||
WHERE
|
WHERE
|
||||||
`user1ID` = :user1 AND
|
`user1ID` = :user1 AND
|
||||||
@@ -175,7 +187,7 @@ function removeFriendship($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function acceptFriendship($userID) {
|
function acceptFriendship($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE `friendship`
|
UPDATE `friendship`
|
||||||
SET `status`='confirmed'
|
SET `status`='confirmed'
|
||||||
WHERE
|
WHERE
|
||||||
@@ -190,7 +202,7 @@ function acceptFriendship($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setLastVisited($friend) {
|
function setLastVisited($friend) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`friendship`
|
`friendship`
|
||||||
SET `friendship`.chatLastVisted1=(
|
SET `friendship`.chatLastVisted1=(
|
||||||
@@ -220,7 +232,7 @@ function setLastVisited($friend) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeFriends($n, $m, $search) {
|
function searchSomeFriends($n, $m, $search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -229,7 +241,10 @@ function searchSomeFriends($n, $m, $search) {
|
|||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
`onlinestatus`,
|
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
|
||||||
|
WHEN TRUE THEN 'online'
|
||||||
|
WHEN FALSE THEN 'offline'
|
||||||
|
END AS `onlinestatus`,
|
||||||
`role`
|
`role`
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ function selectAllGroupsFromUser($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectLimitedGroupsFromUser($userID, $limit) {
|
function selectLimitedGroupsFromUser($userID, $limit) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`
|
`group_page`.`picture`
|
||||||
@@ -28,7 +28,7 @@ function selectLimitedGroupsFromUser($userID, $limit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeOwnGroups($n, $m, $search) {
|
function searchSomeOwnGroups($n, $m, $search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`
|
`group_page`.`picture`
|
||||||
|
|||||||
@@ -1,7 +1,90 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require_once("connect.php");
|
||||||
|
|
||||||
|
function selectGroupByName($name) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`group_page`.`groupID`,
|
||||||
|
`group_page`.`groupID`,
|
||||||
|
`name`,
|
||||||
|
`description`,
|
||||||
|
`picture`,
|
||||||
|
`status`,
|
||||||
|
(
|
||||||
|
SELECT `role`
|
||||||
|
FROM `group_member`
|
||||||
|
WHERE `group_member`.`groupID` = `group_page`.`groupID` AND
|
||||||
|
`userID` = :userID
|
||||||
|
) AS `role`,
|
||||||
|
COUNT(`group_member`.`groupID`) as `members`
|
||||||
|
FROM
|
||||||
|
`group_page`
|
||||||
|
LEFT JOIN
|
||||||
|
`group_member`
|
||||||
|
ON
|
||||||
|
`group_page`.`groupID` = `group_member`.`groupID`
|
||||||
|
WHERE
|
||||||
|
name LIKE :name
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':name', $name, PDO::PARAM_STR);
|
||||||
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
return $stmt->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectGroupRole(int $groupID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`role`
|
||||||
|
FROM
|
||||||
|
`group_member`
|
||||||
|
WHERE
|
||||||
|
`groupID` = :groupID AND
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':groupID', $groupID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
if(!$stmt->execute()) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
if($stmt->rowCount() == 0) {
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
|
return $stmt->fetch()["role"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectGroupMembers(int $groupID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`username`,
|
||||||
|
`fname`,
|
||||||
|
`lname`,
|
||||||
|
`profilepicture`
|
||||||
|
FROM
|
||||||
|
`group_member`
|
||||||
|
LEFT JOIN
|
||||||
|
`user`
|
||||||
|
ON
|
||||||
|
`group_member`.`userID` = `user`.`userID`
|
||||||
|
WHERE
|
||||||
|
`groupID` = :groupID
|
||||||
|
LIMIT 20
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':groupID', $groupID);
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
return $stmt->fetchAll();
|
||||||
|
}
|
||||||
|
|
||||||
function selectGroupById($groupID) {
|
function selectGroupById($groupID) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`,
|
`group_page`.`picture`,
|
||||||
@@ -20,7 +103,7 @@ function selectGroupById($groupID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select20GroupsFromN($n) {
|
function select20GroupsFromN($n) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -42,7 +125,7 @@ function select20GroupsFromN($n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select20GroupsByStatusFromN($n, $status) {
|
function select20GroupsByStatusFromN($n, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -67,7 +150,7 @@ function select20GroupsByStatusFromN($n, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search20GroupsFromNByStatus($n, $keyword, $status) {
|
function search20GroupsFromNByStatus($n, $keyword, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`groupID`,
|
`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -94,7 +177,7 @@ function search20GroupsFromNByStatus($n, $keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
|
function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
|
||||||
$q = $GLOBALS['db']->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`groupID`,
|
`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -122,7 +205,7 @@ function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countSomeGroupsByStatus($keyword, $status) {
|
function countSomeGroupsByStatus($keyword, $status) {
|
||||||
$q = $GLOBALS['db']->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
@@ -143,20 +226,23 @@ function countSomeGroupsByStatus($keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeGroupStatusByID($id, $status) {
|
function changeGroupStatusByID($id, $status) {
|
||||||
$q = $GLOBALS["db"]->query("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`group_page`
|
`group_page`
|
||||||
SET
|
SET
|
||||||
`status` = $status
|
`status` = :status
|
||||||
WHERE
|
WHERE
|
||||||
`groupID` = $id
|
`groupID` = :id
|
||||||
");
|
");
|
||||||
|
|
||||||
|
$q->bindParam(':status', $status);
|
||||||
|
$q->bindParam(':id', $id);
|
||||||
|
$q->execute();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeMultipleGroupStatusByID($ids, $status) {
|
function changeMultipleGroupStatusByID($ids, $status) {
|
||||||
$q = $GLOBALS['db']->prepare("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`group_page`
|
`group_page`
|
||||||
SET
|
SET
|
||||||
@@ -173,7 +259,7 @@ function changeMultipleGroupStatusByID($ids, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeGroups($n, $m, $search) {
|
function searchSomeGroups($n, $m, $search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`name`,
|
`name`,
|
||||||
`picture`
|
`picture`
|
||||||
@@ -196,7 +282,7 @@ function searchSomeGroups($n, $m, $search) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countSomeGroups($search) {
|
function countSomeGroups($search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
@@ -212,4 +298,3 @@ function countSomeGroups($search) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
function getHeaderInfo() {
|
function getHeaderInfo() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getUser() {
|
function getUser() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`password`,
|
`password`,
|
||||||
`userID`,
|
`userID`,
|
||||||
@@ -9,10 +9,11 @@ function getUser() {
|
|||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
`username` LIKE :username
|
`username` LIKE :username OR
|
||||||
|
`email` LIKE :username
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":username", $_POST["uname"]);
|
$stmt->bindValue(":username", test_input($_POST["user"]));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->fetch(PDO::FETCH_ASSOC);
|
return $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
@@ -20,7 +21,7 @@ function getUser() {
|
|||||||
function validateLogin($username, $password){
|
function validateLogin($username, $password){
|
||||||
// Empty username or password field
|
// Empty username or password field
|
||||||
if (empty($username) || empty($password)) {
|
if (empty($username) || empty($password)) {
|
||||||
throw new loginException("Gebruikersnaam of wachtwoord is niet ingevuld");
|
throw new loginException("Inloggegevens zijn niet ingevuld");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$psw = test_input($password);
|
$psw = test_input($password);
|
||||||
@@ -41,6 +42,9 @@ function validateLogin($username, $password){
|
|||||||
</script>";
|
</script>";
|
||||||
} else {
|
} else {
|
||||||
$_SESSION["userID"] = $userID;
|
$_SESSION["userID"] = $userID;
|
||||||
|
// if($_POST[rememberMe] == 1){
|
||||||
|
// ini_set("session.gc_maxlifetime", "10");
|
||||||
|
// }
|
||||||
header("location: profile.php");
|
header("location: profile.php");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -57,5 +61,4 @@ class loginException extends Exception
|
|||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
|
|||||||
138
website/queries/picture.php
Normal file
138
website/queries/picture.php
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uploads Avatar, checks it, and removes the old one.
|
||||||
|
* @param bool $group
|
||||||
|
* @throws AngryAlert
|
||||||
|
* @throws HappyAlert
|
||||||
|
*/
|
||||||
|
function updateAvatar(bool $group = false) {
|
||||||
|
$publicDir = "/var/www/html/public/";
|
||||||
|
$tmpImg = $_FILES["pp"]["tmp_name"];
|
||||||
|
$avatarDir = $group ? "uploads/groupavatar/" : "uploads/profilepictures/";
|
||||||
|
checkAvatarSize($tmpImg);
|
||||||
|
|
||||||
|
if (getimagesize($tmpImg)["mime"] == "image/gif") {
|
||||||
|
if ($_FILES["pp"]["size"] > 4000000) {
|
||||||
|
throw new AngryAlert("Bestand is te groot, maximaal 4MB toegestaan.");
|
||||||
|
}
|
||||||
|
$relativePath = $avatarDir . $_SESSION["userID"] . "_avatar.gif";
|
||||||
|
$group ? removeOldGroupAvatar($_POST["groupID"]) : removeOldUserAvatar();
|
||||||
|
move_uploaded_file($tmpImg, $publicDir . $relativePath);
|
||||||
|
} else {
|
||||||
|
$relativePath = $avatarDir . $_SESSION["userID"] . "_avatar.png";
|
||||||
|
$scaledImg = scaleAvatar($tmpImg);
|
||||||
|
$group ? removeOldGroupAvatar($_POST["groupID"]) : removeOldUserAvatar();
|
||||||
|
imagepng($scaledImg, $publicDir . $relativePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
$group ? setGroupAvatarToDatabase("../" . $relativePath, $_POST["groupID"]) : setUserAvatarToDatabase("../" . $relativePath);
|
||||||
|
throw new HappyAlert("Profielfoto veranderd.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the old avatar from the uploads folder, for a user.
|
||||||
|
*/
|
||||||
|
function removeOldUserAvatar() {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`profilepicture`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
|
$stmt->execute();
|
||||||
|
$old_avatar = $stmt->fetch()["profilepicture"];
|
||||||
|
if ($old_avatar != NULL) {
|
||||||
|
unlink("/var/www/html/public/uploads/" . $old_avatar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Removes the old avatar from the uploads folder, for a group.
|
||||||
|
* @param int $groupID
|
||||||
|
*/
|
||||||
|
function removeOldGroupAvatar(int $groupID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`picture`
|
||||||
|
FROM
|
||||||
|
`group_page`
|
||||||
|
WHERE
|
||||||
|
groupID = :groupID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":groupID", $groupID);
|
||||||
|
$stmt->execute();
|
||||||
|
$old_avatar = $stmt->fetch()["picture"];
|
||||||
|
if ($old_avatar != NULL) {
|
||||||
|
unlink("/var/www/html/public/uploads/" . $old_avatar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts the the path to the avatar into the database, for Users.
|
||||||
|
* @param string $url path to the avatar
|
||||||
|
*/
|
||||||
|
function setUserAvatarToDatabase(string $url) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`profilepicture` = :avatar
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(":avatar", $url);
|
||||||
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts the the path to the avatar into the database, for Groups.
|
||||||
|
* @param string $url path to the avatar
|
||||||
|
* @param int $groupID
|
||||||
|
*/
|
||||||
|
function setGroupAvatarToDatabase(string $url, int $groupID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
UPDATE
|
||||||
|
`group_page`
|
||||||
|
SET
|
||||||
|
`picture` = :avatar
|
||||||
|
WHERE
|
||||||
|
`groupID` = :groupID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":avatar", $url);
|
||||||
|
$stmt->bindParam(":groupID", $groupID);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the resoluton of a picture.
|
||||||
|
* @param string $img
|
||||||
|
* @throws AngryAlert
|
||||||
|
*/
|
||||||
|
function checkAvatarSize(string $img) {
|
||||||
|
$minResolution = 200;
|
||||||
|
$imgSize = getimagesize($img);
|
||||||
|
if ($imgSize[0] < $minResolution or $imgSize[1] < $minResolution) {
|
||||||
|
throw new AngryAlert("Afbeelding te klein, minimaal 200x200 pixels.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scales a picture, standard width is 600px.
|
||||||
|
* @param string $imgLink Path to a image file
|
||||||
|
* @param int $newWidth Custom image width.
|
||||||
|
* @return bool|resource Returns the image as an Resource.
|
||||||
|
* @throws AngryAlert
|
||||||
|
*/
|
||||||
|
function scaleAvatar(string $imgLink, int $newWidth = 600) {
|
||||||
|
$img = imagecreatefromstring(file_get_contents($imgLink));
|
||||||
|
if ($img) {
|
||||||
|
return imagescale($img, $newWidth);
|
||||||
|
} else {
|
||||||
|
throw new AngryAlert("Afbeelding wordt niet ondersteund.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,53 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require_once("connect.php");
|
||||||
|
|
||||||
|
function selectAllPosts($userID, $groupID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`post`.`postID`,
|
||||||
|
`post`.`author`,
|
||||||
|
`title`,
|
||||||
|
CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
|
||||||
|
WHEN TRUE THEN
|
||||||
|
CONCAT(LEFT(`post`.`content`, 150), '...')
|
||||||
|
WHEN FALSE THEN
|
||||||
|
`post`.`content`
|
||||||
|
END
|
||||||
|
AS `content`,
|
||||||
|
`post`.`creationdate`,
|
||||||
|
COUNT(DISTINCT `commentID`) AS `comments`,
|
||||||
|
COUNT(DISTINCT `niet_slecht`.`postID`) AS `niet_slechts`
|
||||||
|
FROM
|
||||||
|
`post`
|
||||||
|
LEFT JOIN
|
||||||
|
`niet_slecht`
|
||||||
|
ON
|
||||||
|
`post`.`postID` = `niet_slecht`.`postID`
|
||||||
|
LEFT JOIN
|
||||||
|
`comment`
|
||||||
|
ON
|
||||||
|
`post`.`postID` = `comment`.`postID`
|
||||||
|
WHERE
|
||||||
|
`post`.`author` = :userID AND
|
||||||
|
`groupID` IS NULL OR
|
||||||
|
`groupID` = :groupID
|
||||||
|
GROUP BY
|
||||||
|
`post`.`postID`
|
||||||
|
ORDER BY
|
||||||
|
`post`.`creationdate` DESC
|
||||||
|
");
|
||||||
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':groupID', $groupID , PDO::PARAM_INT);
|
||||||
|
if(!$stmt->execute()) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
return $stmt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function selectPostById($postID) {
|
function selectPostById($postID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`user`.`fname`,
|
`user`.`fname`,
|
||||||
`user`.`lname`,
|
`user`.`lname`,
|
||||||
@@ -26,7 +72,7 @@ function selectPostById($postID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectCommentsByPostId($postID) {
|
function selectCommentsByPostId($postID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`comment`.`commentID`,
|
`comment`.`commentID`,
|
||||||
`comment`.`postID`,
|
`comment`.`postID`,
|
||||||
@@ -52,7 +98,7 @@ function selectCommentsByPostId($postID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makePost($userID, $groupID, $title, $content) {
|
function makePost($userID, $groupID, $title, $content) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`post` (
|
`post` (
|
||||||
`author`,
|
`author`,
|
||||||
@@ -75,8 +121,8 @@ function makePost($userID, $groupID, $title, $content) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeComment($postID, $userID, $content) {
|
function makeComment($postID, $userID, $content) : int {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`comment` (
|
`comment` (
|
||||||
`postID`,
|
`postID`,
|
||||||
@@ -94,4 +140,55 @@ function makeComment($postID, $userID, $content) {
|
|||||||
$stmt->bindParam(':userID', $userID);
|
$stmt->bindParam(':userID', $userID);
|
||||||
$stmt->bindParam(':content', $content);
|
$stmt->bindParam(':content', $content);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeNietSlecht(int $postID, int $userID) : int {
|
||||||
|
if (checkNietSlecht($postID, $userID)) {
|
||||||
|
return deleteNietSlecht($postID, $userID);
|
||||||
|
} else {
|
||||||
|
return addNietSlecht($postID, $userID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkNietSlecht(int $postID, int $userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
`niet_slecht`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID AND
|
||||||
|
`postID` = :postID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->bindParam(":postID", $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
function addNietSlecht(int $postID, int $userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
INSERT INTO
|
||||||
|
`niet_slecht` (`userID`, `postID`)
|
||||||
|
VALUES (:userID, :postID)
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->bindParam(":postID", $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteNietSlecht(int $postID, int $userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
DELETE FROM
|
||||||
|
`niet_slecht`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID AND
|
||||||
|
`postID` = :postID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->bindParam(":postID", $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getOldChatMessages($user2ID) {
|
function getOldChatMessages($user2ID) {
|
||||||
|
require_once ("friendship.php");
|
||||||
$user1ID = $_SESSION["userID"];
|
$user1ID = $_SESSION["userID"];
|
||||||
|
if (getFriendshipStatus($user2ID) == 1) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -14,7 +15,9 @@ function getOldChatMessages($user2ID) {
|
|||||||
`origin` = :user2 AND
|
`origin` = :user2 AND
|
||||||
`destination` = :user1
|
`destination` = :user1
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`messageID` ASC
|
`creationdate` ASC
|
||||||
|
LIMIT
|
||||||
|
100
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":user1", $user1ID);
|
$stmt->bindParam(":user1", $user1ID);
|
||||||
@@ -23,10 +26,15 @@ function getOldChatMessages($user2ID) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
|
} else {
|
||||||
|
return "[]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMessage($destination, $content) {
|
function sendMessage($destination, $content) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
require_once("friendship.php");
|
||||||
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`private_message`
|
`private_message`
|
||||||
(
|
(
|
||||||
@@ -47,10 +55,15 @@ function sendMessage($destination, $content) {
|
|||||||
"destination" => $destination,
|
"destination" => $destination,
|
||||||
"content" => $content
|
"content" => $content
|
||||||
));
|
));
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNewChatMessages($lastID, $destination) {
|
function getNewChatMessages($lastID, $destination) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
require_once("friendship.php");
|
||||||
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -63,7 +76,7 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
`destination` = :user1) AND
|
`destination` = :user1) AND
|
||||||
`messageID` > :lastID
|
`messageID` > :lastID
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`messageID` ASC
|
`creationdate` ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
||||||
@@ -73,19 +86,22 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
|
} else {
|
||||||
|
return "[]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function selectAllUnreadChat() {
|
function selectAllUnreadChat() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
|
||||||
`user`.`userID`,
|
`user`.`userID`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
LEFT(`private_message`.`content`, 15) as `content`
|
LEFT(`private_message`.`content`, 15) AS `content`
|
||||||
FROM
|
FROM
|
||||||
`private_message`,
|
`private_message`,
|
||||||
`friendship`,
|
`friendship`,
|
||||||
@@ -101,7 +117,8 @@ function selectAllUnreadChat() {
|
|||||||
`friendship`.chatLastVisted2 IS NULL)) AND
|
`friendship`.chatLastVisted2 IS NULL)) AND
|
||||||
`private_message`.`origin` = `user`.`userID` AND
|
`private_message`.`origin` = `user`.`userID` AND
|
||||||
`private_message`.`destination` = :userID AND
|
`private_message`.`destination` = :userID AND
|
||||||
`user`.`role` != 'banned'
|
`user`.`role` != 'banned' AND
|
||||||
|
`friendship`.`status` = 'confirmed'
|
||||||
|
|
||||||
GROUP BY `user`.`userID`
|
GROUP BY `user`.`userID`
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getExistingUsername() {
|
function getExistingUsername() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`username`
|
`username`
|
||||||
FROM
|
FROM
|
||||||
@@ -10,14 +10,14 @@ function getExistingUsername() {
|
|||||||
`username` LIKE :username
|
`username` LIKE :username
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":username", $_POST["username"]);
|
$stmt->bindValue(":username", test_input($_POST["username"]));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExistingEmail() {
|
function getExistingEmail() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`
|
`email`
|
||||||
FROM
|
FROM
|
||||||
@@ -26,14 +26,14 @@ function getExistingEmail() {
|
|||||||
`email` LIKE :email
|
`email` LIKE :email
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":email", $_POST["email"]);
|
$stmt->bindValue(":email", test_input($_POST["email"]));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getResetEmail() {
|
function getResetEmail() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`
|
`email`
|
||||||
FROM
|
FROM
|
||||||
@@ -42,14 +42,14 @@ function getResetEmail() {
|
|||||||
`email` LIKE :email
|
`email` LIKE :email
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":email", $_POST["forgotEmail"]);
|
$stmt->bindValue(":email", test_input($_POST["forgotEmail"]));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerAccount() {
|
function registerAccount() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`user`(fname,
|
`user`(fname,
|
||||||
lname,
|
lname,
|
||||||
@@ -70,15 +70,21 @@ function registerAccount() {
|
|||||||
|
|
||||||
$hash=password_hash($_POST["password"], PASSWORD_DEFAULT);
|
$hash=password_hash($_POST["password"], PASSWORD_DEFAULT);
|
||||||
|
|
||||||
$stmt->bindParam(":fname", $_POST["name"]);
|
$stmt->bindValue(":fname", test_input($_POST["name"]));
|
||||||
$stmt->bindParam(":lname", $_POST["surname"]);
|
$stmt->bindValue(":lname", test_input($_POST["surname"]));
|
||||||
$stmt->bindParam(":bday", $_POST["bday"]);
|
$stmt->bindValue(":bday", test_input($_POST["bday"]));
|
||||||
$stmt->bindParam(":username", $_POST["username"]);
|
$stmt->bindValue(":username", test_input($_POST["username"]));
|
||||||
$stmt->bindParam(":password", $hash);
|
$stmt->bindValue(":password", test_input($hash));
|
||||||
$stmt->bindParam(":location", $_POST["location"]);
|
$stmt->bindValue(":location", test_input($_POST["location"]));
|
||||||
$stmt->bindParam(":email", (strtolower($_POST["email"])));
|
$stmt->bindValue(":email", test_input(strtolower($_POST["email"])));
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->rowCount();
|
$stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submitselect($date, $value){
|
||||||
|
if ($date == $value){
|
||||||
|
echo "selected";
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ include_once "../queries/connect.php";
|
|||||||
|
|
||||||
function sendPasswordRecovery(string $email) {
|
function sendPasswordRecovery(string $email) {
|
||||||
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`
|
`username`
|
||||||
@@ -39,7 +39,7 @@ function doSendPasswordRecovery(int $userID, string $email, string $username, st
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setHashToDatabase(int $userID, string $hash) {
|
function setHashToDatabase(int $userID, string $hash) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -50,5 +50,5 @@ function setHashToDatabase(int $userID, string $hash) {
|
|||||||
$stmt->bindParam(":hash", $hash);
|
$stmt->bindParam(":hash", $hash);
|
||||||
$stmt->bindParam(":userID", $userID);
|
$stmt->bindParam(":userID", $userID);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
$stmt->rowCount();
|
||||||
}
|
}
|
||||||
@@ -1,44 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once "../queries/emailconfirm.php";
|
include_once "../queries/emailconfirm.php";
|
||||||
|
include_once "../queries/picture.php";
|
||||||
abstract class AlertMessage extends Exception {
|
include_once "../queries/alerts.php";
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, $code, $previous);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract public function getClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
class HappyAlert extends AlertMessage {
|
|
||||||
|
|
||||||
public function __construct($message = "Gelukt!", $code = 0, Exception $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, $code, $previous);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClass() {
|
|
||||||
return "settings-message-happy";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AngryAlert extends AlertMessage {
|
|
||||||
public function __construct($message = "Er is iets fout gegaan.", $code = 0, Exception $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, $code, $previous);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClass() {
|
|
||||||
return "settings-message-angry";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the settings form the database.
|
* Gets the settings form the database.
|
||||||
* @return mixed Setting as an array.
|
* @return mixed Setting as an array.
|
||||||
*/
|
*/
|
||||||
function getSettings() {
|
function getSettings() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
@@ -46,7 +16,9 @@ function getSettings() {
|
|||||||
`location`,
|
`location`,
|
||||||
`birthdate`,
|
`birthdate`,
|
||||||
`bio`,
|
`bio`,
|
||||||
`profilepicture`
|
`profilepicture`,
|
||||||
|
`showBday`,
|
||||||
|
`showEmail`
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
@@ -58,8 +30,12 @@ function getSettings() {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the passwordHas form the database
|
||||||
|
* @return mixed passwordhash
|
||||||
|
*/
|
||||||
function getPasswordHash() {
|
function getPasswordHash() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`password`,
|
`password`,
|
||||||
`username`
|
`username`
|
||||||
@@ -73,8 +49,12 @@ function getPasswordHash() {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the setting from post.
|
||||||
|
* @throws HappyAlert
|
||||||
|
*/
|
||||||
function updateSettings() {
|
function updateSettings() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -82,25 +62,45 @@ function updateSettings() {
|
|||||||
`lname` = :lname,
|
`lname` = :lname,
|
||||||
`location` = :location,
|
`location` = :location,
|
||||||
`birthdate` = :bday,
|
`birthdate` = :bday,
|
||||||
`bio` = :bio
|
`bio` = :bio,
|
||||||
|
`showEmail` = :showEmail,
|
||||||
|
`showBday` = :showBday
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
|
$bday = new DateTime();
|
||||||
|
$bday->setDate(test_input($_POST["year"]), test_input($_POST["month"]), test_input($_POST["day"]));
|
||||||
|
checkBday($bday);
|
||||||
|
|
||||||
$stmt->bindValue(":fname", test_input($_POST["fname"]));
|
$stmt->bindValue(":fname", test_input($_POST["fname"]));
|
||||||
$stmt->bindValue(":lname", test_input($_POST["lname"]));
|
$stmt->bindValue(":lname", test_input($_POST["lname"]));
|
||||||
$stmt->bindValue(":location", test_input($_POST["location"]));
|
$stmt->bindValue(":location", test_input($_POST["location"]));
|
||||||
$stmt->bindValue(":bday", test_input($_POST["bday"]));
|
$stmt->bindValue(":bday", $bday->format("Ymd"));
|
||||||
$stmt->bindValue(":bio", test_input($_POST["bio"]));
|
$stmt->bindValue(":bio", test_input($_POST["bio"]));
|
||||||
|
$stmt->bindValue(":showEmail", (array_key_exists("showEmail", $_POST) ? "1" : "0"));
|
||||||
|
$stmt->bindValue(":showBday", (array_key_exists("showBday", $_POST) ? "1" : "0"));
|
||||||
|
|
||||||
$stmt->bindValue(":userID", $_SESSION["userID"]);
|
$stmt->bindValue(":userID", $_SESSION["userID"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
throw new HappyAlert("Instellingen zijn opgeslagen.");
|
throw new HappyAlert("Instellingen zijn opgeslagen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkBday(DateTime $bday) {
|
||||||
|
$today = new DateTime();
|
||||||
|
if ($bday >= $today) {
|
||||||
|
throw new AngryAlert("Jij bent vast niet in de toekomst geboren toch? ;)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change
|
||||||
|
* @throws AngryAlert
|
||||||
|
*/
|
||||||
function changePassword() {
|
function changePassword() {
|
||||||
$user = getPasswordHash();
|
$user = getPasswordHash();
|
||||||
if (password_verify($_POST["password-old"], $user["password"])) {
|
if (password_verify($_POST["password-old"], test_input($user["password"]))) {
|
||||||
if ($_POST["password-new"] == $_POST["password-confirm"] && (strlen($_POST["password-new"]) >= 8)) {
|
if (test_input($_POST["password-new"]) == test_input($_POST["password-confirm"]) && (strlen(test_input($_POST["password-new"])) >= 8)) {
|
||||||
doChangePassword();
|
doChangePassword();
|
||||||
} else {
|
} else {
|
||||||
throw new AngryAlert("Wachtwoorden komen niet overeen.");
|
throw new AngryAlert("Wachtwoorden komen niet overeen.");
|
||||||
@@ -110,8 +110,12 @@ function changePassword() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws AngryAlert
|
||||||
|
* @throws HappyAlert
|
||||||
|
*/
|
||||||
function doChangePassword() {
|
function doChangePassword() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -134,8 +138,8 @@ function doChangePassword() {
|
|||||||
|
|
||||||
function changeEmail() {
|
function changeEmail() {
|
||||||
|
|
||||||
if ($_POST["email"] == $_POST["email-confirm"]) {
|
if (test_input($_POST["email"]) == test_input($_POST["email-confirm"])) {
|
||||||
$email = strtolower($_POST["email"]);
|
$email = strtolower(test_input($_POST["email"]));
|
||||||
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
//check if email exists
|
//check if email exists
|
||||||
emailIsAvailableInDatabase($email);
|
emailIsAvailableInDatabase($email);
|
||||||
@@ -149,7 +153,7 @@ function changeEmail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function emailIsAvailableInDatabase($email) {
|
function emailIsAvailableInDatabase($email) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`
|
`email`
|
||||||
FROM
|
FROM
|
||||||
@@ -166,7 +170,7 @@ function emailIsAvailableInDatabase($email) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doChangeEmail($email) {
|
function doChangeEmail($email) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -187,73 +191,3 @@ function doChangeEmail($email) {
|
|||||||
throw new AngryAlert();
|
throw new AngryAlert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAvatar() {
|
|
||||||
$profilePictureDir = "/var/www/html/public/";
|
|
||||||
$tmpImg = $_FILES["pp"]["tmp_name"];
|
|
||||||
|
|
||||||
checkAvatarSize($tmpImg);
|
|
||||||
removeOldAvatar();
|
|
||||||
if (getimagesize($tmpImg)["mime"] == "image/gif") {
|
|
||||||
if ($_FILES["pp"]["size"] > 4000000) {
|
|
||||||
throw new AngryAlert("Bestand is te groot, maximaal 4MB toegestaan.");
|
|
||||||
}
|
|
||||||
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_avatar.gif";
|
|
||||||
move_uploaded_file($tmpImg, $profilePictureDir . $relativePath);
|
|
||||||
} else {
|
|
||||||
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_avatar.png";
|
|
||||||
$scaledImg = scaleAvatar($tmpImg);
|
|
||||||
imagepng($scaledImg, $profilePictureDir . $relativePath);
|
|
||||||
}
|
|
||||||
setAvatarToDatabase("../" . $relativePath);
|
|
||||||
throw new HappyAlert("Profielfoto veranderd.");
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeOldAvatar() {
|
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
|
||||||
SELECT
|
|
||||||
`profilepicture`
|
|
||||||
FROM
|
|
||||||
`user`
|
|
||||||
WHERE
|
|
||||||
`userID` = :userID
|
|
||||||
");
|
|
||||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
|
||||||
$stmt->execute();
|
|
||||||
$old_avatar = $stmt->fetch()["profilepicture"];
|
|
||||||
if ($old_avatar != NULL) {
|
|
||||||
unlink("/var/www/html/public/uploads/" . $old_avatar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAvatarToDatabase(string $url) {
|
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
|
||||||
UPDATE
|
|
||||||
`user`
|
|
||||||
SET
|
|
||||||
`profilepicture` = :avatar
|
|
||||||
WHERE
|
|
||||||
`userID` = :userID
|
|
||||||
");
|
|
||||||
|
|
||||||
$stmt->bindParam(":avatar", $url);
|
|
||||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
|
||||||
$stmt->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkAvatarSize(string $img) {
|
|
||||||
$minResolution = 200;
|
|
||||||
$imgSize = getimagesize($img);
|
|
||||||
if ($imgSize[0] < $minResolution or $imgSize[1] < $minResolution) {
|
|
||||||
throw new AngryAlert("Afbeelding te klein, minimaal 200x200 pixels.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function scaleAvatar(string $imgLink, int $newWidth = 600) {
|
|
||||||
$img = imagecreatefromstring(file_get_contents($imgLink));
|
|
||||||
if ($img) {
|
|
||||||
return imagescale($img, $newWidth);
|
|
||||||
} else {
|
|
||||||
throw new AngryAlert("Afbeelding wordt niet ondersteund.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("connect.php");
|
require_once ("connect.php");
|
||||||
|
|
||||||
|
function updateLastActivity() {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`lastactivity` = NOW()
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
function getUserID($username) {
|
function getUserID($username) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`
|
`userID`
|
||||||
FROM
|
FROM
|
||||||
@@ -18,7 +31,7 @@ function getUserID($username) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getUsername($userID) {
|
function getUsername($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`username`
|
`username`
|
||||||
FROM
|
FROM
|
||||||
@@ -33,8 +46,9 @@ function getUsername($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectUser($me, $other) {
|
function selectUser($me, $other) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
`birthdate`,
|
`birthdate`,
|
||||||
`location`,
|
`location`,
|
||||||
@@ -44,7 +58,11 @@ function selectUser($me, $other) {
|
|||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
`bio`,
|
`bio`,
|
||||||
`user`.`creationdate`,
|
`user`.`creationdate`,
|
||||||
`onlinestatus`,
|
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
|
||||||
|
WHEN TRUE THEN 'online'
|
||||||
|
WHEN FALSE THEN 'offline'
|
||||||
|
END AS `onlinestatus`,
|
||||||
|
`role`,
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
CASE `status` IS NULL
|
CASE `status` IS NULL
|
||||||
@@ -80,7 +98,7 @@ function selectUser($me, $other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectAllUserGroups($userID) {
|
function selectAllUserGroups($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -94,7 +112,7 @@ function selectAllUserGroups($userID) {
|
|||||||
`group_page`.`groupID` = `group_member`.`groupID`
|
`group_page`.`groupID` = `group_member`.`groupID`
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID AND
|
`userID` = :userID AND
|
||||||
`role` = 1
|
`role` = 'member'
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
@@ -102,38 +120,8 @@ function selectAllUserGroups($userID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectAllUserPosts($userID) {
|
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
|
||||||
SELECT
|
|
||||||
`postID`,
|
|
||||||
`author`,
|
|
||||||
`title`,
|
|
||||||
CASE LENGTH(`content`) >= 150 AND `content` NOT LIKE '<img%'
|
|
||||||
WHEN TRUE THEN
|
|
||||||
CONCAT(LEFT(`content`, 150), '...')
|
|
||||||
WHEN FALSE THEN
|
|
||||||
`content`
|
|
||||||
END
|
|
||||||
AS `content`,
|
|
||||||
`creationdate`
|
|
||||||
FROM
|
|
||||||
`post`
|
|
||||||
WHERE
|
|
||||||
`author` = :userID AND
|
|
||||||
`groupID` IS NULL
|
|
||||||
ORDER BY
|
|
||||||
`creationdate` DESC
|
|
||||||
");
|
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
|
||||||
if(!$stmt->execute()) {
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
return $stmt;
|
|
||||||
}
|
|
||||||
|
|
||||||
function select20UsersFromN($n) {
|
function select20UsersFromN($n) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -154,7 +142,7 @@ function select20UsersFromN($n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromN($n, $keyword) {
|
function search20UsersFromN($n, $keyword) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -178,7 +166,7 @@ function search20UsersFromN($n, $keyword) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromNByStatus($n, $keyword, $status) {
|
function search20UsersFromNByStatus($n, $keyword, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -206,7 +194,7 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeUsersByStatus($n, $m, $keyword, $status) {
|
function searchSomeUsersByStatus($n, $m, $keyword, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -235,7 +223,7 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countSomeUsersByStatus($keyword, $status) {
|
function countSomeUsersByStatus($keyword, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
@@ -258,7 +246,7 @@ function countSomeUsersByStatus($keyword, $status) {
|
|||||||
|
|
||||||
|
|
||||||
function changeUserStatusByID($id, $status) {
|
function changeUserStatusByID($id, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -274,7 +262,7 @@ function changeUserStatusByID($id, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeMultipleUserStatusByID($ids, $status) {
|
function changeMultipleUserStatusByID($ids, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -290,8 +278,27 @@ function changeMultipleUserStatusByID($ids, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeMultipleUserStatusByIDAdmin($ids, $status) {
|
||||||
|
$q = prepareQuery("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`role` = :status
|
||||||
|
WHERE
|
||||||
|
FIND_IN_SET (`userID`, :ids)
|
||||||
|
AND NOT `role` = 'admin'
|
||||||
|
AND NOT `role` = 'owner'
|
||||||
|
");
|
||||||
|
|
||||||
|
$ids = implode(',', $ids);
|
||||||
|
$q->bindParam(':ids', $ids);
|
||||||
|
$q->bindParam(':status', $status);
|
||||||
|
$q->execute();
|
||||||
|
return $q;
|
||||||
|
}
|
||||||
|
|
||||||
function selectRandomNotFriendUser($userID) {
|
function selectRandomNotFriendUser($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`user`.`username`
|
`user`.`username`
|
||||||
FROM
|
FROM
|
||||||
@@ -319,7 +326,7 @@ function selectRandomNotFriendUser($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeUsers($n, $m, $search) {
|
function searchSomeUsers($n, $m, $search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -331,9 +338,10 @@ function searchSomeUsers($n, $m, $search) {
|
|||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
`username` LIKE :keyword OR
|
(`username` LIKE :keyword OR
|
||||||
`fname` LIKE :keyword OR
|
`fname` LIKE :keyword OR
|
||||||
`lname` LIKE :keyword
|
`lname` LIKE :keyword) AND
|
||||||
|
`role` != 'banned'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
@@ -353,15 +361,16 @@ function searchSomeUsers($n, $m, $search) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countSomeUsers($search) {
|
function countSomeUsers($search) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
`username` LIKE :keyword OR
|
(`username` LIKE :keyword OR
|
||||||
`fname` LIKE :keyword OR
|
`fname` LIKE :keyword OR
|
||||||
`lname` LIKE :keyword
|
`lname` LIKE :keyword) AND
|
||||||
|
`role` != 'banned'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
@@ -373,3 +382,33 @@ function countSomeUsers($search) {
|
|||||||
$q->execute();
|
$q->execute();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRoleByID($userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`role`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':userID', $userID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->fetch()["role"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function editBanCommentByID($userID, $comment) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`bancomment` = :comment
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':comment', $comment);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
46
website/views/adminpanel-grouptable.php
Normal file
46
website/views/adminpanel-grouptable.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<tr>
|
||||||
|
<th><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll(this)"></th>
|
||||||
|
<th class="table-username">Gebruikersnaam</th>
|
||||||
|
<th class="table-status">Status</th>
|
||||||
|
<th class="table-comment">Aantekening</th>
|
||||||
|
<th class="table-action">Actie</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
print_r($_POST);
|
||||||
|
|
||||||
|
$q = searchSomeGroupsByStatus($offset, $entries, $search, $groupstatus);
|
||||||
|
|
||||||
|
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$groupID = $group['groupID'];
|
||||||
|
$name = $group['name'];
|
||||||
|
$role = $group['status'];
|
||||||
|
$description = $group['description'];
|
||||||
|
|
||||||
|
echo("
|
||||||
|
<tr>
|
||||||
|
<td><input type='checkbox'
|
||||||
|
name='checkbox-group[]'
|
||||||
|
class='checkbox-list'
|
||||||
|
value='$groupID'
|
||||||
|
form='admin-groupbatchform'
|
||||||
|
onchange='checkCheckAll();'>
|
||||||
|
</td>
|
||||||
|
<td>$name</td>
|
||||||
|
<td>$role</td>
|
||||||
|
<td>$description</td>
|
||||||
|
<td>
|
||||||
|
<form class='admin-groupaction'
|
||||||
|
onsubmit=\"adminUpdate(this); return false;\">
|
||||||
|
<select class='action' name='actions'>
|
||||||
|
<option value='hidden'>Hidden</option>
|
||||||
|
<option value='public'>Public</option>
|
||||||
|
<option value='membersonly'>Members</option>
|
||||||
|
</select>
|
||||||
|
<input type='hidden' name='groupID' value='$groupID'>
|
||||||
|
<input type='submit' value='Confirm'>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
");
|
||||||
|
}
|
||||||
30
website/views/adminpanel-page.php
Normal file
30
website/views/adminpanel-page.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
if ($pagetype == "user") {
|
||||||
|
$pages = countSomeUsersByStatus($search, $status);
|
||||||
|
} else {
|
||||||
|
$pages = countSomeGroupsByStatus($search, $groupstatus);
|
||||||
|
}
|
||||||
|
$countresults = $pages->fetchColumn();
|
||||||
|
|
||||||
|
?>
|
||||||
|
Pagina:
|
||||||
|
<select class="admin-pageselect"
|
||||||
|
name="currentpage"
|
||||||
|
id="currentpage"
|
||||||
|
form="admin-searchform"
|
||||||
|
onchange="adminSearch();">
|
||||||
|
<?php
|
||||||
|
for ($i=1; $i <= ceil($countresults / $entries); $i++) {
|
||||||
|
if ($currentpage == $i) {
|
||||||
|
echo "<option value='$i' selected>$i</option>";
|
||||||
|
} else {
|
||||||
|
echo "<option value='$i'>$i</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?php
|
||||||
|
$n = min($offset + 1, $countresults);
|
||||||
|
$m = min($offset + $entries, $countresults);
|
||||||
|
echo " $n tot $m ($countresults totaal)";
|
||||||
|
?>
|
||||||
73
website/views/adminpanel-table.php
Normal file
73
website/views/adminpanel-table.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<tr>
|
||||||
|
<th><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll()"></th>
|
||||||
|
<th class="table-username">Gebruikersnaam</th>
|
||||||
|
<th class="table-status">Status</th>
|
||||||
|
<th class="table-comment">Aantekening</th>
|
||||||
|
<th class="table-action">Actie</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- Table construction via php PDO. -->
|
||||||
|
<?php
|
||||||
|
$q = searchSomeUsersByStatus($offset, $entries, $search, $status);
|
||||||
|
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$userID = $user['userID'];
|
||||||
|
$username = $user['username'];
|
||||||
|
$role = $user['role'];
|
||||||
|
$bancomment = $user['bancomment'];
|
||||||
|
|
||||||
|
echo("
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input type='checkbox'
|
||||||
|
name='checkbox-user[]'
|
||||||
|
class='checkbox-list'
|
||||||
|
value='$userID'
|
||||||
|
form='admin-batchform'
|
||||||
|
onchange='checkCheckAll();'>
|
||||||
|
</td>
|
||||||
|
<td>$username</td>
|
||||||
|
<td>$role</td>
|
||||||
|
<td>
|
||||||
|
<div class='bancomment'>$bancomment</div>
|
||||||
|
<div class='bancommentedit'>
|
||||||
|
<form class='bancommentform'
|
||||||
|
id='bancommentform'
|
||||||
|
onsubmit='editComment(this);
|
||||||
|
return false;'>
|
||||||
|
<input type='text'
|
||||||
|
name='bancommenttext'
|
||||||
|
placeholder='Schrijf een aantekening'
|
||||||
|
value='$bancomment'>
|
||||||
|
<input type='hidden'
|
||||||
|
name='bancommentuserID'
|
||||||
|
value='$userID'>
|
||||||
|
<button type='submit'>Update</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<button type='button' onclick='toggleBancomment(this)'>Verander</button>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<form class='admin-useraction'
|
||||||
|
onsubmit=\"adminUpdate(this); return false;\">
|
||||||
|
<select class='action' name='actions'>");
|
||||||
|
if (!($userinfo == 'admin'
|
||||||
|
AND ($user['role'] == 'admin'
|
||||||
|
OR $user['role'] == 'owner'))) {
|
||||||
|
echo "<option value='frozen'>Bevries</option>
|
||||||
|
<option value='banned'>Ban</option>
|
||||||
|
<option value='user'>Activeer</option>";
|
||||||
|
|
||||||
|
if ($userinfo == 'owner') {
|
||||||
|
echo "<option value='admin'>Admin</option>
|
||||||
|
<option value='owner'>Owner</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ("</select>
|
||||||
|
<input type='hidden' name='userID' value='$userID'>
|
||||||
|
<input type='submit' value='Confirm'>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
");
|
||||||
|
}
|
||||||
@@ -1,15 +1,11 @@
|
|||||||
<script src="js/admin.js" charset="utf-8"></script>
|
|
||||||
<?php
|
|
||||||
require_once ("../queries/user.php");
|
|
||||||
require_once ("../queries/group_page.php");
|
|
||||||
?>
|
|
||||||
<!-- function test_input taken from http://www.w3schools.com/php/php_form_validation.asp -->
|
<!-- function test_input taken from http://www.w3schools.com/php/php_form_validation.asp -->
|
||||||
<?php
|
<?php
|
||||||
$search = "";
|
$search = "";
|
||||||
$currentpage = 1;
|
$status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner");
|
||||||
$perpage = 20;
|
$groupstatus = array("hidden", "public", "membersonly");
|
||||||
$status = $groupstatus = array();
|
|
||||||
$pagetype = "user";
|
$pagetype = "user";
|
||||||
|
$userinfo = getRoleByID($_SESSION['userID']);
|
||||||
|
|
||||||
if (isset($_GET["search"])) {
|
if (isset($_GET["search"])) {
|
||||||
$search = test_input($_GET["search"]);
|
$search = test_input($_GET["search"]);
|
||||||
@@ -27,33 +23,6 @@ if (isset($_GET["groupstatus"])) {
|
|||||||
$groupstatus = $_GET["groupstatus"];
|
$groupstatus = $_GET["groupstatus"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
if (isset($_POST["actions"]) && isset($_POST["userID"])) {
|
|
||||||
changeUserStatusByID($_POST["userID"], $_POST["actions"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["actions"]) && isset($_POST["groupID"])) {
|
|
||||||
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["batchactions"]) && isset($_POST["checkbox-user"])) {
|
|
||||||
changeMultipleUserStatusByID($_POST["checkbox-user"], $_POST["batchactions"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["groupbatchactions"]) && isset($_POST["checkbox-group"])) {
|
|
||||||
changeMultipleGroupStatusByID($_POST["checkbox-group"], $_POST["groupbatchactions"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["pageselect"])) {
|
|
||||||
$currentpage = $_POST["pageselect"];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$listn = ($currentpage-1) * $perpage;
|
|
||||||
$listm = $currentpage * $perpage;
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -61,7 +30,8 @@ $listm = $currentpage * $perpage;
|
|||||||
<h5>Zoek naar gebruikers of groepen:</h5>
|
<h5>Zoek naar gebruikers of groepen:</h5>
|
||||||
<div class="admin-options">
|
<div class="admin-options">
|
||||||
<form class="admin-searchform"
|
<form class="admin-searchform"
|
||||||
action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
id="admin-searchform"
|
||||||
|
action="javascript:searchFromOne();"
|
||||||
method="get">
|
method="get">
|
||||||
|
|
||||||
<div class="admin-searchbar">
|
<div class="admin-searchbar">
|
||||||
@@ -70,10 +40,11 @@ $listm = $currentpage * $perpage;
|
|||||||
class="admin-searchinput"
|
class="admin-searchinput"
|
||||||
placeholder="Naam"
|
placeholder="Naam"
|
||||||
value="<?php echo $search;?>">
|
value="<?php echo $search;?>">
|
||||||
|
|
||||||
Op: <select name="pagetype" id="pagetype" onchange="changeFilter()">
|
Op: <select name="pagetype" id="pagetype" onchange="changeFilter()">
|
||||||
<option value="user"
|
<option value="user"
|
||||||
<?php if (isset($pagetype) && $pagetype=="user") echo "selected";?>>
|
<?php if (isset($pagetype) && $pagetype=="user") echo "selected";?>>
|
||||||
Gerbuiker
|
Gebruiker
|
||||||
</option>
|
</option>
|
||||||
<option value="group"
|
<option value="group"
|
||||||
<?php if (isset($pagetype) && $pagetype=="group") echo "selected";?>>
|
<?php if (isset($pagetype) && $pagetype=="group") echo "selected";?>>
|
||||||
@@ -82,32 +53,27 @@ $listm = $currentpage * $perpage;
|
|||||||
</select>
|
</select>
|
||||||
<button type="submit"><i class="fa fa-search"></i></button>
|
<button type="submit"><i class="fa fa-search"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="admin-filter">
|
<div id="admin-filter">
|
||||||
<h5>Type gebruiker:</h5>
|
<h5>Type gebruiker:</h5>
|
||||||
<input type="checkbox"
|
|
||||||
name="status[]"
|
|
||||||
id="all"
|
|
||||||
value="all"
|
|
||||||
<?php if (in_array("all", $status)) echo "checked";?>>
|
|
||||||
<label for="normal">Allemaal</label><br>
|
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="status[]"
|
name="status[]"
|
||||||
id="normal"
|
id="normal"
|
||||||
value="user"
|
value="user"
|
||||||
<?php if (in_array("user", $status)) echo "checked";?>>
|
<?php if (in_array("user", $status)) echo "checked";?>>
|
||||||
<label for="normal">Normal</label><br>
|
<label for="normal">Normaal</label><br>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="status[]"
|
name="status[]"
|
||||||
id="frozen"
|
id="frozen"
|
||||||
value="frozen"
|
value="frozen"
|
||||||
<?php if (in_array("frozen", $status)) echo "checked";?>>
|
<?php if (in_array("frozen", $status)) echo "checked";?>>
|
||||||
<label for="frozen">Frozen</label><br>
|
<label for="frozen">Gefrozen</label><br>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="status[]"
|
name="status[]"
|
||||||
id="banned"
|
id="banned"
|
||||||
value="banned"
|
value="banned"
|
||||||
<?php if (in_array("banned", $status)) echo "checked";?>>
|
<?php if (in_array("banned", $status)) echo "checked";?>>
|
||||||
<label for="banned">Banned</label><br>
|
<label for="banned">Gebant</label><br>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="status[]"
|
name="status[]"
|
||||||
id="admin"
|
id="admin"
|
||||||
@@ -119,7 +85,7 @@ $listm = $currentpage * $perpage;
|
|||||||
id="unvalidated"
|
id="unvalidated"
|
||||||
value="unconfirmed"
|
value="unconfirmed"
|
||||||
<?php if (in_array("unconfirmed", $status)) echo "checked";?>>
|
<?php if (in_array("unconfirmed", $status)) echo "checked";?>>
|
||||||
<label for="unvalidated">Unvalidated</label><br>
|
<label for="unvalidated">Ongevalideerd</label><br>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="status[]"
|
name="status[]"
|
||||||
id="owner"
|
id="owner"
|
||||||
@@ -130,160 +96,57 @@ $listm = $currentpage * $perpage;
|
|||||||
|
|
||||||
<div id="admin-groupfilter">
|
<div id="admin-groupfilter">
|
||||||
<h5>Type groep:</h5>
|
<h5>Type groep:</h5>
|
||||||
<input type="checkbox" name="groupstatus[]" id="all" value="all"
|
<input type="checkbox" name="groupstatus[]" id="hidden" value="hidden"
|
||||||
<?php if (in_array("all", $groupstatus)) echo "checked";?>>
|
<?php if (in_array("hidden", $groupstatus)) echo "checked";?>>
|
||||||
<label for="hidden">Allemaal</label><br>
|
<label for="hidden">Verborgen</label><br>
|
||||||
<input type="checkbox" name="groupstatus[]" id="hidden" value="0"
|
<input type="checkbox" name="groupstatus[]" id="public" value="public"
|
||||||
<?php if (in_array("0", $groupstatus)) echo "checked";?>>
|
<?php if (in_array("public", $groupstatus)) echo "checked";?>>
|
||||||
<label for="hidden">Hidden</label><br>
|
<label for="public">Publiek</label><br>
|
||||||
<input type="checkbox" name="groupstatus[]" id="public" value="1"
|
<input type="checkbox" name="groupstatus[]" id="membersonly" value="membersonly"
|
||||||
<?php if (in_array("1", $groupstatus)) echo "checked";?>>
|
<?php if (in_array("membersonly", $groupstatus)) echo "checked";?>>
|
||||||
<label for="public">Public</label><br>
|
<label for="membersonly">Alleen Leden</label><br>
|
||||||
<input type="checkbox" name="groupstatus[]" id="membersonly" value="2"
|
|
||||||
<?php if (in_array("2", $groupstatus)) echo "checked";?>>
|
|
||||||
<label for="membersonly">Members-only</label><br>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="admin-users">
|
<div class="admin-users">
|
||||||
<div class="admin-usertitle">
|
<div class="admin-usertitle">
|
||||||
<h4>Resultaat:</h4>
|
<h4>Resultaat:</h4>
|
||||||
<span style="float: right">
|
<div style="float: right" id="admin-pageinfo">
|
||||||
<?php
|
|
||||||
if ($pagetype == "user") {
|
|
||||||
$pages = countSomeUsersByStatus($search, $status);
|
|
||||||
} else {
|
|
||||||
$pages = countSomeGroupsByStatus($search, $groupstatus);
|
|
||||||
}
|
|
||||||
$countresults = $pages->fetchColumn();
|
|
||||||
$mincount = min($listm, $countresults);
|
|
||||||
$minlist = min($listn + 1, $countresults);
|
|
||||||
?>
|
|
||||||
Pagina: <form class="admin-pageselector"
|
|
||||||
action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
|
|
||||||
method="post">
|
|
||||||
<select class="admin-pageselect"
|
|
||||||
name="pageselect"
|
|
||||||
onchange="this.form.submit()"
|
|
||||||
value="">
|
|
||||||
<?php
|
|
||||||
for ($i=1; $i <= ceil($countresults / $perpage); $i++) {
|
|
||||||
if ($currentpage == $i) {
|
|
||||||
echo "<option value='$i' selected>$i</option>";
|
|
||||||
} else {
|
|
||||||
echo "<option value='$i'>$i</option>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
echo "$minlist tot $mincount ($countresults totaal)";
|
|
||||||
?>
|
|
||||||
</span>
|
|
||||||
<form
|
|
||||||
id="admin-batchform"
|
|
||||||
action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
|
|
||||||
method="post">
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<form id="admin-batchform"
|
||||||
|
onsubmit="adminUpdate(this); return false;">
|
||||||
|
|
||||||
|
<input type="hidden" name="batchactions" id="batchinput">
|
||||||
<button type="submit" name="batchactions" id="freeze" value="frozen">Bevries</button>
|
<button type="submit" name="batchactions" id="freeze" value="frozen">Bevries</button>
|
||||||
<button type="submit" name="batchactions" id="ban" value="banned">Ban</button>
|
<button type="submit" name="batchactions" id="ban" value="banned">Ban</button>
|
||||||
<button type="submit" name="batchactions" id="restore" value="user">Activeer</button>
|
<button type="submit" name="batchactions" id="restore" value="user">Activeer</button>
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<table class="usertable">
|
|
||||||
<tr>
|
|
||||||
<th><input type="checkbox" id="checkall" name="checkall" onchange="checkAll(this)"></th>
|
|
||||||
<th class="table-username">Gebruikersnaam</th>
|
|
||||||
<th class="table-status">Status</th>
|
|
||||||
<th class="table-comment">Aantekening</th>
|
|
||||||
<th class="table-action">Actie</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<!-- Table construction via php PDO. -->
|
|
||||||
<?php
|
<?php
|
||||||
$listn = ($currentpage-1) * $perpage;
|
if ($userinfo == 'owner') {
|
||||||
$listm = $currentpage * $perpage;
|
echo "<button type=\"submit\"
|
||||||
|
name=\"batchactions\"
|
||||||
if ($pagetype == 'user') {
|
id=\"admin\"
|
||||||
$q = searchSomeUsersByStatus($listn, $listm, $search, $status);
|
value=\"admin\">Maak Admin</button>
|
||||||
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
<button type=\"submit\"
|
||||||
$userID = $user['userID'];
|
name=\"batchactions\"
|
||||||
$username = $user['username'];
|
id=\"owner\"
|
||||||
$role = $user['role'];
|
value=\"owner\">Maak Owner</button>";
|
||||||
$bancomment = $user['bancomment'];
|
|
||||||
$thispage = htmlspecialchars(basename($_SERVER['REQUEST_URI']));
|
|
||||||
$function = "checkCheckAll(document.getElementById('checkall'))";
|
|
||||||
|
|
||||||
echo("
|
|
||||||
<tr>
|
|
||||||
<td><input type='checkbox'
|
|
||||||
name='checkbox-user[]'
|
|
||||||
class='checkbox-list'
|
|
||||||
value='$userID'
|
|
||||||
form='admin-batchform'
|
|
||||||
onchange=" . "$function" . ">
|
|
||||||
</td>
|
|
||||||
<td>$username</td>
|
|
||||||
<td>$role</td>
|
|
||||||
<td>$bancomment</td>
|
|
||||||
<td>
|
|
||||||
<form class='admin-useraction'
|
|
||||||
action='$thispage'
|
|
||||||
method='post'>
|
|
||||||
<select class='action' name='actions'>
|
|
||||||
<option value='frozen'>Bevries</option>
|
|
||||||
<option value='banned'>Ban</option>
|
|
||||||
<option value='user'>Activeer</option>
|
|
||||||
</select>
|
|
||||||
<input type='hidden' name='userID' value='$userID'>
|
|
||||||
<input type='submit' value='Confirm'>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$q = searchSomeGroupsByStatus($listn, $listm, $search, $groupstatus);
|
|
||||||
|
|
||||||
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
|
||||||
$groupID = $group['groupID'];
|
|
||||||
$name = $group['name'];
|
|
||||||
$role = $group['status'];
|
|
||||||
$description = $group['description'];
|
|
||||||
$thispage = htmlspecialchars(basename($_SERVER['REQUEST_URI']));
|
|
||||||
$function = "checkCheckAll(document.getElementById('checkall'))";
|
|
||||||
|
|
||||||
echo("
|
|
||||||
<tr>
|
|
||||||
<td><input type='checkbox'
|
|
||||||
name='checkbox-group[]'
|
|
||||||
class='checkbox-list'
|
|
||||||
value='$groupID'
|
|
||||||
form='admin-groupbatchform'
|
|
||||||
onchange=" . "$function" . ">
|
|
||||||
</td>
|
|
||||||
<td>$name</td>
|
|
||||||
<td>$role</td>
|
|
||||||
<td>$description</td>
|
|
||||||
<td>
|
|
||||||
<form class='admin-groupaction'
|
|
||||||
action='$thispage'
|
|
||||||
method='post'>
|
|
||||||
<select class='action' name='actions'>
|
|
||||||
<option value='0'>Hide</option>
|
|
||||||
<option value='1'>Public</option>
|
|
||||||
<option value='2'>Members</option>
|
|
||||||
</select>
|
|
||||||
<input type='hidden' name='groupID' value='$groupID'>
|
|
||||||
<input type='submit' value='Confirm'>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
</form>
|
||||||
|
<form id="admin-groupbatchform"
|
||||||
|
onsubmit="adminUpdate(this); return false;">
|
||||||
|
|
||||||
|
<input type="hidden" name="groupbatchactions" id="groupbatchinput">
|
||||||
|
<button type="submit" name="batchactions" id="hide" value="hidden">Hide</button>
|
||||||
|
<button type="submit" name="batchactions" id="ban" value="public">Public</button>
|
||||||
|
<button type="submit" name="batchactions" id="members" value="membersonly">Members</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="usertable" id="usertable">
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
37
website/views/bdayInput.php
Normal file
37
website/views/bdayInput.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<select name="day_date" >
|
||||||
|
<option>dag</option>
|
||||||
|
<?php
|
||||||
|
for($i=1; $i<32; $i++) {
|
||||||
|
$i = sprintf("%02d", $i);
|
||||||
|
?>
|
||||||
|
<option value="<?= $i ?>" <?php submitselect($day_date, $i)?>><?= $i ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<select name="month_date">
|
||||||
|
<option>Maand</option>
|
||||||
|
<option value="01" <?php submitselect($month_date, "01")?>>januari</option>
|
||||||
|
<option value="02" <?php submitselect($month_date, "02")?>>februari</option>
|
||||||
|
<option value="03" <?php submitselect($month_date, "03")?>>maart</option>
|
||||||
|
<option value="04" <?php submitselect($month_date, "04")?>>april</option>
|
||||||
|
<option value="05" <?php submitselect($month_date, "05")?>>mei</option>
|
||||||
|
<option value="06" <?php submitselect($month_date, "06")?>>juni</option>
|
||||||
|
<option value="07" <?php submitselect($month_date, "07")?>>juli</option>
|
||||||
|
<option value="08" <?php submitselect($month_date, "08")?>>augustus</option>
|
||||||
|
<option value="09" <?php submitselect($month_date, "09")?>>september</option>
|
||||||
|
<option value="10" <?php submitselect($month_date, "10")?>>oktober</option>
|
||||||
|
<option value="11" <?php submitselect($month_date, "11")?>>november</option>
|
||||||
|
<option value="12" <?php submitselect($month_date, "12")?>>december</option>
|
||||||
|
</select>
|
||||||
|
<select name="year_date">
|
||||||
|
<option>Jaar</option>
|
||||||
|
<?php
|
||||||
|
$year = (new DateTime)->format("Y");
|
||||||
|
for($i=$year; $i > $year - 100; $i--) {
|
||||||
|
?>
|
||||||
|
<option value="<?= $i ?>" <?php submitselect($year_date, $i)?>><?= $i ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
@@ -74,6 +74,7 @@
|
|||||||
name="content"
|
name="content"
|
||||||
id="newContent"
|
id="newContent"
|
||||||
placeholder="Schrijf een bericht..."
|
placeholder="Schrijf een bericht..."
|
||||||
|
autocomplete="off"
|
||||||
autofocus
|
autofocus
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|||||||
36
website/views/forgotPasswordModal.php
Normal file
36
website/views/forgotPasswordModal.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<!-- Trigger/Open The Modal -->
|
||||||
|
<button id="myBtn" class="button">Wachtwoord vergeten</button>
|
||||||
|
|
||||||
|
<!-- The Modal -->
|
||||||
|
<div id="myModal" class="modal">
|
||||||
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
|
return= $correct
|
||||||
|
method="post"
|
||||||
|
name="forgotPassword">
|
||||||
|
|
||||||
|
<!-- Modal content -->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<span class="close">×</span>
|
||||||
|
<h3>Voer uw emailadres in</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="text"
|
||||||
|
class="middle"
|
||||||
|
placeholder="Voer uw email in"
|
||||||
|
name="forgotEmail"
|
||||||
|
title="Voer een email in">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
||||||
|
<button type="submit"
|
||||||
|
value="reset"
|
||||||
|
name="submit"
|
||||||
|
id="frm1_submit">
|
||||||
|
Reset password
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -1,122 +1,36 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="profile-box platform">
|
<div class="profile-box platform">
|
||||||
<img class="left group-picture" src="http://i.imgur.com/afjEUx2.jpg">
|
<img class="left main-picture" src="<?= $group['picture'] ?>">
|
||||||
<div class="profile-button">
|
<div class="profile-button">
|
||||||
<p><img src="img/leave-group.png"> Groep verlaten</p>
|
<p><img src="img/leave-group.png"> Groep verlaten</p>
|
||||||
</div>
|
</div>
|
||||||
<h1 class="profile-username">[groepnaam]</h1>
|
<h1 class="profile-username"><?= $group['name'] ?></h1>
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dictum turpis quam, eu ultrices sapien hendrerit tincidunt. Nunc aliquam neque turpis, id porta quam iaculis id. Sed suscipit, nisl a fermentum congue, nunc augue finibus lectus, id varius nunc purus nec dolor. Integer laoreet tellus sit amet sapien auctor congue. Mauris laoreet eu elit vel rhoncus. Nam et tortor arcu. Maecenas sit amet leo quis tellus varius gravida. Sed quis fermentum odio, sed dictum nulla. Donec aliquam rutrum orci cursus tempus. Quisque sit amet ipsum eget velit aliquam facilisis ultricies quis ligula. Nunc nisi lacus, luctus non bibendum quis, sagittis sit amet odio.</p>
|
<p><?= $group['description'] ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item-box-full-width platform">
|
<div class="item-box-full-width platform">
|
||||||
<h2>Leden</h2>
|
<h2>Leden (<?= $group['members'] ?>)</h2>
|
||||||
<p>
|
<p>
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
<?php
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
foreach($members as $member) {
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'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>";
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
}
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
?>
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
|
|
||||||
|
|
||||||
<a href="#vrienden">...en nog 25 anderen!</a>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
<div class="post platform">
|
|
||||||
<h2>Lorem</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur.</p>
|
|
||||||
<p class="subscript">Enkele minuten geleden geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Image</h2>
|
|
||||||
<img src="http://i.imgur.com/ypIQKjE.jpg" alt="Olympic Mountains, Washington">
|
|
||||||
<p class="subscript">Gisteren geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Ipsum</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem nihil alias amet dolores fuga totam sequi a cupiditate ipsa voluptas id facilis nobis.</p>
|
|
||||||
<p class="subscript">Maandag geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Dolor</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Sit</h2>
|
|
||||||
<p>Lorem ipsum dolor sit.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Image</h2>
|
|
||||||
<img src="https://i.redditmedia.com/EBWWiEojgkRrdn89R7qF7tBZjJszJaIqgkWUH23s11A.jpg?w=576&s=ba4fe1f02485cb2327305924ef869a66" alt="Nunobiki Falls, Kobe Japan">
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Amet</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima asperiores eveniet vero velit eligendi aliquid in.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Consectetur</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error aliquid reprehenderit expedita odio beatae est.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Adipisicing</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat architecto quis tenetur fugiat veniam iste molestiae fuga labore!</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Elit</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem ut debitis dolorum earum expedita eveniet voluptatem quibusdam facere eos numquam commodi ad iusto laboriosam rerum aliquam.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Geen error</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus dolorem maxime minima animi cum.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Image</h2>
|
|
||||||
<img src="https://i.reddituploads.com/82c1c4dd0cfb4a4aa1cfa16f93f5dbfa?fit=max&h=1536&w=1536&s=dd629d407f3646ee6e3adb4da78c93f2" alt="Oregon cliffs are no joke.">
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Aliquid</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Odit</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit accusamus tempore at porro officia rerum est impedit ea ipsa tenetur. Labore libero hic error sunt laborum expedita.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
<div class="post platform">
|
|
||||||
<h2>Accusamus</h2>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nobis quaerat suscipit ad.</p>
|
|
||||||
<p class="subscript">4 Januari geplaatst</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal">
|
||||||
|
<div class="modal-content platform">
|
||||||
|
<div class="modal-close">
|
||||||
|
×
|
||||||
|
</div>
|
||||||
|
<div class="modal-response" id="modal-response">
|
||||||
|
<span class="modal-default">Aan het laden...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
<script src="js/main.js"></script>
|
<script src="js/main.js"></script>
|
||||||
<script src="js/header.js"></script>
|
<script src="js/header.js"></script>
|
||||||
<script src="js/menu.js"></script>
|
<script src="js/menu.js"></script>
|
||||||
<script src="js/notifications.js"></script>
|
|
||||||
<style>
|
<style>
|
||||||
/* Add your css files here. */
|
/* Add your css files here. */
|
||||||
@import url("styles/main.css");
|
@import url("styles/main.css");
|
||||||
@@ -13,14 +12,19 @@
|
|||||||
@import url("styles/header.css");
|
@import url("styles/header.css");
|
||||||
@import url("styles/menu.css");
|
@import url("styles/menu.css");
|
||||||
@import url("styles/footer.css");
|
@import url("styles/footer.css");
|
||||||
|
|
||||||
|
@import url("styles/mobilefriendly.css") screen and (orientation: portrait);
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once ("../queries/checkInput.php");
|
require_once ("../queries/checkInput.php");
|
||||||
require_once ("../queries/connect.php");
|
require_once ("../queries/connect.php");
|
||||||
|
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");
|
||||||
|
} else {
|
||||||
|
updateLastActivity();
|
||||||
}
|
}
|
||||||
@@ -25,8 +25,7 @@ $userinfo = getHeaderInfo();
|
|||||||
</div>
|
</div>
|
||||||
<?=$userinfo["fname"]?>
|
<?=$userinfo["fname"]?>
|
||||||
</div>
|
</div>
|
||||||
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
|
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/><i id="open-notifications" class="fa fa-bars"></i>
|
||||||
<i id="open-notifications" class="fa fa-bars"></i>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<?php include("notification-center.php"); ?>
|
<?php include("notification-center.php"); ?>
|
||||||
|
|||||||
@@ -13,12 +13,13 @@
|
|||||||
|
|
||||||
<!-- Login name -->
|
<!-- Login name -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<label><b>Gebruikersnaam</b></label>
|
<label><b>Gebruikersnaam/Email</b></label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
placeholder="Voer uw gebruikersnaam in"
|
class="middle"
|
||||||
name="uname"
|
placeholder="Voer uw gebruikersnaam/email in"
|
||||||
value="<?php echo $uname ?>"
|
name="user"
|
||||||
title="Moet 6 of meer karakters bevatten"
|
value="<?php echo $user ?>"
|
||||||
|
title="Moet een geldige gebruiker zijn"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<label><b>Wachtwoord</b></label>
|
<label><b>Wachtwoord</b></label>
|
||||||
<input type="password"
|
<input type="password"
|
||||||
|
class="middle"
|
||||||
placeholder="Voer uw wachtwoord in"
|
placeholder="Voer uw wachtwoord in"
|
||||||
name="psw"
|
name="psw"
|
||||||
title="Moet minstens 8 karakters lang zijn"
|
title="Moet minstens 8 karakters lang zijn"
|
||||||
@@ -44,73 +46,65 @@
|
|||||||
Inloggen
|
Inloggen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="login_containerlogin">
|
||||||
|
<label><b>Onthoud mij</b></label>
|
||||||
|
<input type="checkbox" name="rememberMe" value=1><br>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Button for going to the register screen -->
|
<!-- Button for going to the register screen -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
|
<!-- <a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>-->
|
||||||
|
|
||||||
<!-- Trigger/Open The Modal -->
|
<?php
|
||||||
<button id="myBtn" class="button">Wachtwoord vergeten</button>
|
include("../views/forgotPasswordModal.php");
|
||||||
|
include("../views/registerModal.php");
|
||||||
|
?>
|
||||||
|
|
||||||
<!-- The Modal -->
|
|
||||||
<div id="myModal" class="modal">
|
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
|
||||||
return= $correct
|
|
||||||
method="post"
|
|
||||||
name="forgotPassword">
|
|
||||||
|
|
||||||
<!-- Modal content -->
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<span class="close">×</span>
|
|
||||||
<h3>Voer uw emailadres in</h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<input type="text"
|
|
||||||
placeholder="Voer uw email in"
|
|
||||||
name="forgotEmail"
|
|
||||||
title="Voer een email in">
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
|
||||||
<button type="submit"
|
|
||||||
value="reset"
|
|
||||||
name="submit"
|
|
||||||
id="frm1_submit">
|
|
||||||
Reset password
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>
|
<script>
|
||||||
// Get the modal
|
|
||||||
var modal = document.getElementById('myModal');
|
|
||||||
|
|
||||||
// Get the button that opens the modal
|
// Get the button that opens the modal
|
||||||
|
var modal = document.getElementById('myModal');
|
||||||
var btn = document.getElementById("myBtn");
|
var btn = document.getElementById("myBtn");
|
||||||
|
|
||||||
|
// Get the modal
|
||||||
|
var registerModal = document.getElementById('registerModal');
|
||||||
|
var registerBtn = document.getElementById("registerBtn");
|
||||||
|
|
||||||
// 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];
|
||||||
|
var registerSpan = document.getElementsByClassName("close")[1];
|
||||||
|
|
||||||
// When the user clicks the button, open the modal
|
// When the user clicks the button, open the modal
|
||||||
btn.onclick = function () {
|
btn.onclick = function () {
|
||||||
|
// modal.style.display = "block";
|
||||||
modal.style.display = "block";
|
modal.style.display = "block";
|
||||||
|
window.onload=emailSent();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
registerBtn.onclick = function () {
|
||||||
|
registerModal.style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the user clicks on <span> (x), close the modal
|
// When the user clicks on <span> (x), close the modal
|
||||||
span.onclick = function () {
|
span.onclick = function () {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
}
|
}
|
||||||
|
registerSpan.onclick = function () {
|
||||||
|
registerModal.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
// When the user clicks anywhere outside of the modal, close it
|
// When the user clicks anywhere outside of the modal, close it
|
||||||
window.onclick = function (event) {
|
window.onclick = function (event) {
|
||||||
if (event.target == modal) {
|
if (event.target == modal) {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
}
|
}
|
||||||
|
if (event.target == registerModal) {
|
||||||
|
registerModal.style.display = "none";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<nav class="menu">
|
<nav class="menu" id="contact-menu">
|
||||||
<section id="friends-menu-section">
|
<section id="friends-menu-section">
|
||||||
<h4>
|
<h4>
|
||||||
Top vrienden
|
Recente vrienden
|
||||||
</h4>
|
</h4>
|
||||||
<ul id="menu-friends-list" class="nav-list">
|
<ul id="menu-friends-list" class="nav-list">
|
||||||
</ul>
|
</ul>
|
||||||
@@ -12,6 +12,13 @@
|
|||||||
</h4>
|
</h4>
|
||||||
<ul id="menu-groups-list" class="nav-list">
|
<ul id="menu-groups-list" class="nav-list">
|
||||||
</ul>
|
</ul>
|
||||||
|
<ul class="nav-list">
|
||||||
|
<li>
|
||||||
|
<a href="#">
|
||||||
|
Maak een groep aan
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<ul class="nav-list">
|
<ul class="nav-list">
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ function messagePage(string $content) {
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@import url(styles/main.css);
|
@import url(../styles/main.css);
|
||||||
@import url(styles/settings.css);
|
@import url(../styles/settings.css);
|
||||||
@import url(styles/resetpassword.css);
|
@import url(../styles/message-page.css);
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class='password-change'>
|
<div class='password-change'>
|
||||||
<div class='top-logo'><a href='login.php'><img src='img/top-logo.png' alt='MyHyvesbook+'/></a></div>
|
<div class='top-logo'><a href='../index.php'><img src='../img/top-logo.png' alt='MyHyvesbook+'/></a></div>
|
||||||
<div class='item-box platform'>$content</div>
|
<div class='item-box platform'>$content</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
<nav class="menu" id="notification-center">
|
<nav class="menu" id="notification-center">
|
||||||
<section id="quick-links">
|
<section id="quick-links">
|
||||||
<a href="chat.php"><i class="fa fa-comments-o" data-title="Prive chats"></i></a>
|
<a href="chat.php" data-title="Prive chats"><i class="fa fa-comments-o"></i></a>
|
||||||
<a href="settings.php"><i class="fa fa-cog" data-title="Instellingen"></i></a>
|
<a href="settings.php" data-title="Instellingen"><i class="fa fa-cog"></i></a>
|
||||||
<a href="profile.php"><i class="fa fa-user" data-title="Profiel"></i></a>
|
<a href="profile.php" data-title="Profiel"><i class="fa fa-user"></i></a>
|
||||||
<a href="logout.php"><i class="fa fa-sign-out" data-title="Uitloggen"></i></a>
|
<?php
|
||||||
|
include_once ("../queries/user.php");
|
||||||
|
|
||||||
|
// auth
|
||||||
|
$role = getRoleByID($_SESSION['userID']);
|
||||||
|
|
||||||
|
if ($role == 'admin' OR $role == 'owner') {
|
||||||
|
echo "<a href=\"admin.php\" data-title=\"Admin\"><i class=\"fa fa-lock\"></i></a>";
|
||||||
|
echo "<style>@import url('styles/adminbutton.css'); </style>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<a href="logout.php" data-title="Admin"><i class="fa fa-sign-out"></i></a>
|
||||||
</section>
|
</section>
|
||||||
<section id="friend-request-section">
|
<section id="friend-request-section">
|
||||||
<h4>
|
<h4>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
$postID = $_GET['postID'];
|
$postID = $_GET['postID'];
|
||||||
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
|
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
|
||||||
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
|
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
|
||||||
|
session_start();
|
||||||
|
|
||||||
echo("
|
echo("
|
||||||
<div class='post-header header'>
|
<div class='post-header header'>
|
||||||
@@ -21,10 +22,19 @@ echo("
|
|||||||
|
|
||||||
<div class='post-comments'>
|
<div class='post-comments'>
|
||||||
<div class="commentfield">
|
<div class="commentfield">
|
||||||
<form id="newcommentform" action="javascript:postComment();">
|
<form id="newcommentform" onsubmit="return false;">
|
||||||
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
||||||
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..."></textarea> <br>
|
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..." maxlength="1000"></textarea><span></span> <br>
|
||||||
<input type="submit" value="Reageer!">
|
<button onclick="postComment('reaction')" name="button" value="reaction">Reageer!</button>
|
||||||
|
<button onclick="postComment('nietslecht')" name="button" value="nietslecht" class="nietslecht">
|
||||||
|
<?php
|
||||||
|
if (checkNietSlecht($postID, $_SESSION["userID"])) {
|
||||||
|
echo 'Trek <span class="nietslecht-text">"Niet slecht."</span> terug';
|
||||||
|
} else {
|
||||||
|
echo '<img src="img/nietslecht_small.png" /> <span class="nietslecht-text">"Niet slecht."</span>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -40,7 +50,7 @@ echo("
|
|||||||
<div class='comment'>
|
<div class='comment'>
|
||||||
<div class='commentinfo'>
|
<div class='commentinfo'>
|
||||||
$commentauthor
|
$commentauthor
|
||||||
<span class='commentdate', title='$commentdate'>
|
<span class='commentdate' title='$commentdate'>
|
||||||
$commentnicetime
|
$commentnicetime
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,18 +1,43 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="profile-box platform">
|
<div class="user-box">
|
||||||
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
|
<img class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br />
|
||||||
|
<div class="platform">
|
||||||
|
<div class="status-buttons-container">
|
||||||
|
<button disabled class="gray">
|
||||||
|
<?= $user["onlinestatus"] ?>
|
||||||
|
</button>
|
||||||
|
<button disabled class="gray"><?= $user["role"] ?></button>
|
||||||
|
</div>
|
||||||
<div class="friend-button-container">
|
<div class="friend-button-container">
|
||||||
|
<p>:)</p>
|
||||||
|
<p>Je ziet er goed uit vandaag</p>
|
||||||
|
</div>
|
||||||
|
<div class="profile-info">
|
||||||
|
<h2><?= $user["fname"]?> <?=$user["lname"]?></h2>
|
||||||
|
<h5><?=$user["username"]?></h5>
|
||||||
|
<?php if (strlen($user["bio"]) <= 50) {
|
||||||
|
echo "<p>" . $user["bio"] . "</p>";
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php if (strlen($user["bio"]) > 50) {
|
||||||
|
echo "<div class='platform'><h3>Bio:</h3><p>" . $user["bio"] . "</p></div>";
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
<div class="item-box platform">
|
||||||
|
<h3>Informatie</h3>
|
||||||
|
<p>
|
||||||
|
<ul>
|
||||||
|
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
|
||||||
|
<li>Locatie: <?= $user["location"] ?></li>
|
||||||
|
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h1>
|
<div class="item-box platform">
|
||||||
<h5 class="profile-username"><?=$user["username"]?></h5>
|
<h3>Vrienden</h3>
|
||||||
<p><?=$user["bio"]?></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="item-box left platform">
|
|
||||||
<h2>Vrienden</h2>
|
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
while($friend = $profile_friends->fetch()) {
|
while($friend = $profile_friends->fetch()) {
|
||||||
@@ -27,12 +52,12 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item-box right platform">
|
<div class="item-box platform">
|
||||||
<h2>Groepen</h2>
|
<h3>Groepen</h3>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
while($group = $profile_groups->fetch()) {
|
while($group = $profile_groups->fetch()) {
|
||||||
echo "<a href='/group/${group["name"]}/' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
|
echo "<a href='group.php?groupname=${group['name']}' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($profile_groups->rowCount() === 0) {
|
if($profile_groups->rowCount() === 0) {
|
||||||
|
|||||||
@@ -40,14 +40,44 @@
|
|||||||
|
|
||||||
<!-- Register birthday -->
|
<!-- Register birthday -->
|
||||||
<div class="login_containerregister">
|
<div class="login_containerregister">
|
||||||
<label><b>Geboortedatum</b></label>
|
<label><b>Geboortedatum(Dag/Maand/Jaar)</b></label>
|
||||||
<input type="text"
|
<select name="day_date" >
|
||||||
name="bday"
|
<option>dag</option>
|
||||||
value="<?php echo $bday ?>"
|
<?php
|
||||||
id="bday"
|
for($i=1; $i<32; $i++) {
|
||||||
placeholder="1996/01/01"
|
$i = sprintf("%02d", $i);
|
||||||
data-fv-date-max=""
|
?>
|
||||||
>
|
<option value="<?= $i ?>" <?php submitselect($day_date, $i)?>><?= $i ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<select name="month_date">
|
||||||
|
<option>Maand</option>
|
||||||
|
<option value="01" <?php submitselect($month_date, "01")?>>Januari</option>
|
||||||
|
<option value="02" <?php submitselect($month_date, "02")?>>Februari</option>
|
||||||
|
<option value="03" <?php submitselect($month_date, "03")?>>Maart</option>
|
||||||
|
<option value="04" <?php submitselect($month_date, "04")?>>April</option>
|
||||||
|
<option value="05" <?php submitselect($month_date, "05")?>>Mei</option>
|
||||||
|
<option value="06" <?php submitselect($month_date, "06")?>>Juni</option>
|
||||||
|
<option value="07" <?php submitselect($month_date, "07")?>>Juli</option>
|
||||||
|
<option value="08" <?php submitselect($month_date, "08")?>>Augustus</option>
|
||||||
|
<option value="09" <?php submitselect($month_date, "09")?>>September</option>
|
||||||
|
<option value="10" <?php submitselect($month_date, "10")?>>Oktober</option>
|
||||||
|
<option value="11" <?php submitselect($month_date, "11")?>>November</option>
|
||||||
|
<option value="12" <?php submitselect($month_date, "12")?>>December</option>
|
||||||
|
</select>
|
||||||
|
<select name="year_date">
|
||||||
|
<option>Jaar</option>
|
||||||
|
<?php
|
||||||
|
$year = (new DateTime)->format("Y");
|
||||||
|
for($i=$year; $i > $year - 100; $i--) {
|
||||||
|
?>
|
||||||
|
<option value="<?= $i ?>" <?php submitselect($year_date, $i)?>><?= $i ?></option>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
*<span class="error"> <?php echo $bdayErr;?></span>
|
*<span class="error"> <?php echo $bdayErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -118,6 +148,18 @@
|
|||||||
*<span class="error"> <?php echo $emailErr;?></span>
|
*<span class="error"> <?php echo $emailErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Register email -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Herhaal email</b></label>
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Herhaal uw email"
|
||||||
|
name="confirmEmail"
|
||||||
|
value="<?php echo $confirmEmail ?>"
|
||||||
|
id="email"
|
||||||
|
title="Herhaal uw email">
|
||||||
|
*<span class="error"> <?php echo $confirmEmailErr;?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="login_containerregister">
|
<div class="login_containerregister">
|
||||||
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ"></div>
|
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ"></div>
|
||||||
<span class="error"> <?php echo $captchaErr;?></span>
|
<span class="error"> <?php echo $captchaErr;?></span>
|
||||||
|
|||||||
158
website/views/registerModal.php
Normal file
158
website/views/registerModal.php
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
<!-- Trigger/Open The Modal -->
|
||||||
|
<button id="registerBtn" class="button">Registreer een account</button>
|
||||||
|
|
||||||
|
<!-- The Modal -->
|
||||||
|
<div id="registerModal" class="modal">
|
||||||
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
|
return= $correct
|
||||||
|
method="post"
|
||||||
|
name="forgotPassword">
|
||||||
|
|
||||||
|
<!-- Modal content -->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<span class="close">×</span>
|
||||||
|
<h3>Registreer uw account</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
|
return= $correct
|
||||||
|
method="post">
|
||||||
|
|
||||||
|
<div class="login_containerregister"><label>U krijgt een bevestigingsemail na het registreren</label></div>
|
||||||
|
|
||||||
|
<!-- Error message -->
|
||||||
|
<div class="login_containerfault"><?php echo $genericErr;?></span></div>
|
||||||
|
|
||||||
|
<!-- Register name -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Naam</b></label>
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Voer uw naam in"
|
||||||
|
name="name"
|
||||||
|
value="<?php echo $name ?>"
|
||||||
|
title="Mag alleen letters bevatten"
|
||||||
|
>
|
||||||
|
*<span class="error"><?php echo $nameErr;?></span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- Register surname -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Achternaam</b></label>
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Voer uw achternaam in"
|
||||||
|
name="surname"
|
||||||
|
value="<?php echo $surname ?>"
|
||||||
|
title="Mag alleen letters bevatten"
|
||||||
|
>
|
||||||
|
*<span class="error"> <?php echo $surnameErr;?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Register birthday -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Geboortedatum</b></label>
|
||||||
|
<?php
|
||||||
|
include("../views/bdayInput.php");
|
||||||
|
?>
|
||||||
|
*<span class="error"> <?php echo $bdayErr;?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Register username -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Gebruikersnaam</b></label>
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Voer uw gebruikersnaam in"
|
||||||
|
name="username"
|
||||||
|
value="<?php echo $username ?>"
|
||||||
|
title="Moet minimaal 6 karakters bevatten"
|
||||||
|
>
|
||||||
|
*<span class="error"> <?php echo $usernameErr;?></span>
|
||||||
|
<ul>
|
||||||
|
<li>Minstens 6 karakters</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Register password -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Wachtwoord</b></label>
|
||||||
|
<input type="password"
|
||||||
|
placeholder="Voer uw wachtwoord in"
|
||||||
|
name="password"
|
||||||
|
value="<?php echo $password ?>"
|
||||||
|
id="password"
|
||||||
|
>
|
||||||
|
*<span class="error"> <?php echo $passwordErr;?></span>
|
||||||
|
<ul>
|
||||||
|
<li>Minstens 8 karakters</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- Repeat password -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Herhaal wachtwoord</b></label>
|
||||||
|
<input type="password"
|
||||||
|
placeholder="Herhaal wachtwoord"
|
||||||
|
name="confirmpassword"
|
||||||
|
value="<?php echo $confirmpassword ?>"
|
||||||
|
id="confirmpassword"
|
||||||
|
title="Herhaal wachtwoord"
|
||||||
|
>
|
||||||
|
*<span class="error"> <?php echo $confirmpasswordErr;?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Register location -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Locatie</b></label>
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Voer uw woonplaats in"
|
||||||
|
name="location"
|
||||||
|
value="<?php echo $location ?>"
|
||||||
|
pattern="[A-Za-z]{1,}"
|
||||||
|
title="Mag alleen letters bevatten">
|
||||||
|
*<span class="error"> <?php echo $locationErr;?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Register email -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Email</b></label>
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Voer uw email in"
|
||||||
|
name="email"
|
||||||
|
value="<?php echo $email ?>"
|
||||||
|
id="email"
|
||||||
|
title="Voer een geldige email in">
|
||||||
|
*<span class="error"> <?php echo $emailErr;?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Register email -->
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<label><b>Herhaal email</b></label>
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Herhaal uw email"
|
||||||
|
name="confirmEmail"
|
||||||
|
value="<?php echo $confirmEmail ?>"
|
||||||
|
id="email"
|
||||||
|
title="Herhaal uw email">
|
||||||
|
*<span class="error"> <?php echo $confirmEmailErr;?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="login_containerregister">
|
||||||
|
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ">
|
||||||
|
</div>
|
||||||
|
<span class="error"> <?php echo $captchaErr;?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
||||||
|
<button type="submit"
|
||||||
|
value="register"
|
||||||
|
name="submit"
|
||||||
|
id="frm1_submit">
|
||||||
|
Registreer
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -21,10 +21,8 @@ if (isset($_GET['filter'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user_n = ($user_currentpage - 1) * $user_perpage;
|
$user_n = ($user_currentpage - 1) * $user_perpage;
|
||||||
$user_count = countSomeUsers($search)->fetchColumn();
|
|
||||||
|
|
||||||
$group_n = ($group_currentpage - 1) * $group_perpage;
|
$group_n = ($group_currentpage - 1) * $group_perpage;
|
||||||
$group_count = countSomeGroups($search)->fetchColumn();
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -40,8 +38,10 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
id="search-input"
|
id="search-input"
|
||||||
name="search"
|
name="search"
|
||||||
onkeyup="
|
onkeyup="
|
||||||
searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
|
$('#user-pagenumber, #group-pagenumber').prop('value', 1);
|
||||||
searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);"
|
searchUsers();
|
||||||
|
searchGroups();
|
||||||
|
pageNumber();"
|
||||||
placeholder="Zoek"
|
placeholder="Zoek"
|
||||||
value=<?php echo "$search";?>
|
value=<?php echo "$search";?>
|
||||||
>
|
>
|
||||||
@@ -66,26 +66,12 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
<div class="platform item-box searchleft" id="search-friends-output">
|
<div class="platform item-box searchleft" id="search-friends-output">
|
||||||
<h4>Gebruikers</h4>
|
<h4>Gebruikers</h4>
|
||||||
|
|
||||||
<select class="user-pageselect"
|
<div id="user-pageselect"></div>
|
||||||
name="user-pageselect"
|
|
||||||
id="user-pageselect"
|
|
||||||
form="search-form"
|
|
||||||
onchange="this.form.submit()">
|
|
||||||
<?php
|
|
||||||
for ($i=1; $i <= ceil($user_count / $user_perpage); $i++) {
|
|
||||||
if ($user_currentpage == $i) {
|
|
||||||
echo "<option value='$i' selected>$i</option>";
|
|
||||||
} else {
|
|
||||||
echo "<option value='$i'>$i</option>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<ul id='search-users-list' class='nav-list'>
|
<ul id='search-users-list' class='nav-list'>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
|
searchUsers();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -94,26 +80,12 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
<div class="platform item-box searchright" id="search-group-output">
|
<div class="platform item-box searchright" id="search-group-output">
|
||||||
<h4>Groepen</h4>
|
<h4>Groepen</h4>
|
||||||
|
|
||||||
<select class="group-pageselect"
|
<div id="group-pageselect"></div>
|
||||||
name="group-pageselect"
|
|
||||||
id="group-pageselect"
|
|
||||||
form="search-form"
|
|
||||||
onchange="this.form.submit()">
|
|
||||||
<?php
|
|
||||||
for ($i=1; $i <= ceil($group_count / $group_perpage); $i++) {
|
|
||||||
if ($group_currentpage == $i) {
|
|
||||||
echo "<option value='$i' selected>$i</option>";
|
|
||||||
} else {
|
|
||||||
echo "<option value='$i'>$i</option>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<ul id="search-groups-list" class="nav-list">
|
<ul id="search-groups-list" class="nav-list">
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);
|
searchGroups();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
36
website/views/searchPageNumber.php
Normal file
36
website/views/searchPageNumber.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
if ($option == "user") {
|
||||||
|
echo "<select class=\"user-pageselect\"
|
||||||
|
name=\"user-pageselect\"
|
||||||
|
id='user-pagenumber'
|
||||||
|
form=\"search-form\"
|
||||||
|
onchange=\"pageNumber(); searchUsers();\">";
|
||||||
|
|
||||||
|
for ($i=1; $i <= ceil($user_count / $user_perpage); $i++) {
|
||||||
|
if ($user_currentpage == $i) {
|
||||||
|
echo "<option value='$i' selected>$i</option>";
|
||||||
|
} else {
|
||||||
|
echo "<option value='$i'>$i</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</select>";
|
||||||
|
} else {
|
||||||
|
echo "<select class=\"group-pageselect\"
|
||||||
|
name=\"group-pageselect\"
|
||||||
|
id='group-pagenumber'
|
||||||
|
form=\"search-form\"
|
||||||
|
onchange=\"pageNumber(); searchGroups();\">";
|
||||||
|
|
||||||
|
for ($i=1; $i <= ceil($group_count / $group_perpage); $i++) {
|
||||||
|
if ($group_currentpage == $i) {
|
||||||
|
echo "<option value='$i' selected>$i</option>";
|
||||||
|
} else {
|
||||||
|
echo "<option value='$i'>$i</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</select>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -4,13 +4,11 @@ $settings = getSettings();
|
|||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
<?php
|
<?php if ($_SERVER["REQUEST_METHOD"] == "POST"): ?>
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
<div class='platform settings-message <?=$alertClass?>'>
|
||||||
echo "<div class='platform settings-message $alertClass '>
|
<?=$alertMessage?>
|
||||||
$alertMessage
|
</div>
|
||||||
</div>";
|
<?php endif; ?>
|
||||||
}
|
|
||||||
?>
|
|
||||||
<form class="settings-profile platform" method="post">
|
<form class="settings-profile platform" method="post">
|
||||||
<h5>Profiel Instellingen</h5>
|
<h5>Profiel Instellingen</h5>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -43,12 +41,59 @@ $settings = getSettings();
|
|||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
<?php $currentbday = new DateTime($settings["birthdate"]); ?>
|
||||||
<label for="bday">Geboortedatum</label>
|
<label for="bday">Geboortedatum</label>
|
||||||
<input type="date"
|
<select name='day' id="bday">
|
||||||
name="bday"
|
<?php for ($day = 1; $day <= 31; $day++): ?>
|
||||||
id="bday"
|
<option value='<?=$day?>'
|
||||||
placeholder="yyyy-mm-dd"
|
<?=($day == $currentbday->format("d")) ? "selected" : ""?>
|
||||||
value="<?= $settings["birthdate"]?>"
|
>
|
||||||
|
<?=$day?>
|
||||||
|
</option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<select name='month' id="bday">
|
||||||
|
<?php
|
||||||
|
$months = array ("januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus",
|
||||||
|
"september", "oktober", "november", "december");
|
||||||
|
for ($month = 1; $month <= 12; $month++):
|
||||||
|
?>
|
||||||
|
<option value='<?=$month?>'
|
||||||
|
<?=($month == $currentbday->format("m")) ? "selected" : ""?>
|
||||||
|
>
|
||||||
|
<?=$months[$month - 1]?>
|
||||||
|
</option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<select name='year' id="bday">
|
||||||
|
<?php
|
||||||
|
$now = (new DateTime)->format("Y");
|
||||||
|
for ($year = $now; $year >= 1900; $year--): ?>
|
||||||
|
<option value='<?=$year?>'
|
||||||
|
<?=($year == $currentbday->format("Y")) ? "selected" : ""?>
|
||||||
|
>
|
||||||
|
<?=$year?>
|
||||||
|
</option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
<option value="680" <?=(680 == $currentbday->format("Y")) ? "selected" : ""?>>
|
||||||
|
680
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label for="showBday">Toon leeftijd</label>
|
||||||
|
<input type="checkbox"
|
||||||
|
name="showBday"
|
||||||
|
id="showBday"
|
||||||
|
<?=($settings["showBday"] ? "checked" : "")?>
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label for="showEmail">Toon Email</label>
|
||||||
|
<input type="checkbox"
|
||||||
|
name="showEmail"
|
||||||
|
id="showEmail"
|
||||||
|
<?=($settings["showEmail"] ? "checked" : "")?>
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -57,7 +102,8 @@ $settings = getSettings();
|
|||||||
rows="5"
|
rows="5"
|
||||||
title="bio"
|
title="bio"
|
||||||
id="bio"
|
id="bio"
|
||||||
><?= $settings["bio"]?></textarea>
|
maxlength="1000"
|
||||||
|
><?=$settings["bio"]?></textarea><span></span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label></label>
|
<label></label>
|
||||||
@@ -98,24 +144,30 @@ $settings = getSettings();
|
|||||||
<h5>Verander Wachtwoord</h5>
|
<h5>Verander Wachtwoord</h5>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<label>Oud wachtwoord</label>
|
<label for="password-old">Oud wachtwoord</label>
|
||||||
<input type="password"
|
<input type="password"
|
||||||
name="password-old"
|
name="password-old"
|
||||||
|
id="password-old"
|
||||||
placeholder="Oud wachtwoord"
|
placeholder="Oud wachtwoord"
|
||||||
|
autocomplete="current-password"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label>Nieuw wachtwoord</label>
|
<label for="password-new">Nieuw wachtwoord</label>
|
||||||
<input type="password"
|
<input type="password"
|
||||||
name="password-new"
|
name="password-new"
|
||||||
|
id="password-new"
|
||||||
placeholder="Nieuw wachtwoord"
|
placeholder="Nieuw wachtwoord"
|
||||||
|
autocomplete="new-password"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label>Bevestig wachtwoord</label>
|
<label for="password-confirm">Bevestig wachtwoord</label>
|
||||||
<input type="password"
|
<input type="password"
|
||||||
name="password-confirm"
|
name="password-confirm"
|
||||||
|
id="password-confirm"
|
||||||
placeholder="Bevestig wachtwoord"
|
placeholder="Bevestig wachtwoord"
|
||||||
|
autocomplete="new-password"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
Reference in New Issue
Block a user