Compare commits
187 Commits
lars-chat
...
marijn-pos
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb094858b5 | ||
|
|
2a37b9c64d | ||
|
|
dfdf72daf4 | ||
|
|
1c9c88e030 | ||
|
|
6b13db9c4f | ||
|
|
c14a2770bd | ||
|
|
2e71942fdf | ||
|
|
03481f5888 | ||
|
|
d5d9d5857a | ||
|
|
dee483e946 | ||
|
|
c7d47cf446 | ||
|
|
4dc3b4f651 | ||
|
|
3579fe0cd5 | ||
|
|
a6b6d6d747 | ||
|
|
6983aa06a2 | ||
|
|
8dfa31696c | ||
|
|
ce53b6e9e4 | ||
|
|
bc7cbb0fb7 | ||
|
|
422e2d1308 | ||
|
|
6e6bbf8d92 | ||
|
|
3140242b4f | ||
|
|
0b6ca72dfc | ||
|
|
6831994ede | ||
|
|
bb56679885 | ||
|
|
b0a8ceafc3 | ||
|
|
54b56da445 | ||
|
|
183a98a339 | ||
|
|
941296802f | ||
|
|
aa12e29948 | ||
|
|
1acad8e765 | ||
|
|
44ff3a4cab | ||
|
|
dd017d8885 | ||
|
|
282875c6a2 | ||
|
|
c840b28495 | ||
|
|
f1b5a7fe95 | ||
|
|
e8c76bef5b | ||
|
|
25957c6c78 | ||
|
|
20b951cad2 | ||
|
|
792f346b12 | ||
|
|
54ddb78453 | ||
|
|
9a36dea592 | ||
|
|
578ad34020 | ||
|
|
f3df682af5 | ||
|
|
c8450f3cb3 | ||
|
|
b30ef0d0cf | ||
|
|
877637fcc9 | ||
|
|
89c8c35b4a | ||
|
|
c1a7ccc076 | ||
|
|
b24fed57d9 | ||
|
|
da30b9101c | ||
|
|
dd2113b234 | ||
|
|
3f960cc091 | ||
|
|
b12eaced4a | ||
|
|
16b1f93968 | ||
|
|
753c596056 | ||
|
|
8da1469ca9 | ||
|
|
f7f442ce75 | ||
|
|
c8c81ae730 | ||
|
|
a57465189a | ||
|
|
dc51ac5964 | ||
|
|
be9fa6d2c1 | ||
|
|
7e2c20e244 | ||
|
|
dd6b41783a | ||
|
|
e9eeeaf110 | ||
|
|
2651e0fb2b | ||
|
|
5e9629eddd | ||
|
|
d356468554 | ||
|
|
ce6a751630 | ||
|
|
609f350cd3 | ||
|
|
07c3b07eb3 | ||
|
|
f27b9ec6b4 | ||
|
|
bf1df4d2d4 | ||
|
|
3b542e0878 | ||
|
|
82c2eaccb3 | ||
|
|
cbff973b63 | ||
|
|
c2d8521cdd | ||
|
|
23904caf69 | ||
|
|
f1bfc89e6a | ||
|
|
f32e0ca382 | ||
|
|
d89e672990 | ||
|
|
032e25b044 | ||
|
|
7073995534 | ||
|
|
637a26ba33 | ||
|
|
dbdb12cca0 | ||
|
|
70b7734e8b | ||
|
|
c1fc022658 | ||
|
|
5c1208460f | ||
|
|
59fc65e27a | ||
|
|
0c324b9095 | ||
|
|
cdfbcc0168 | ||
|
|
bf87d20985 | ||
|
|
96f70e1a11 | ||
|
|
e75df42bd8 | ||
|
|
b66c108f4e | ||
|
|
f4b2fee290 | ||
|
|
a60a9b6594 | ||
|
|
feb64002f5 | ||
|
|
33a640329b | ||
|
|
59b0b00304 | ||
|
|
51cc736aca | ||
|
|
1a53d01747 | ||
|
|
e24960c319 | ||
|
|
cf964ec8d6 | ||
|
|
b89a575039 | ||
|
|
91aca6baa7 | ||
|
|
3ebacd6251 | ||
|
|
423c2fd771 | ||
|
|
58e5f200fa | ||
|
|
47eed5514a | ||
|
|
78e85c2939 | ||
|
|
44f86a4fbb | ||
|
|
7b7f0b2c64 | ||
|
|
328f0665f3 | ||
|
|
8fb8df075f | ||
|
|
6a882bf78d | ||
|
|
95ee91748f | ||
|
|
30d403ae7b | ||
|
|
2242feda21 | ||
|
|
2ece9e1c63 | ||
|
|
4ebdd378a6 | ||
|
|
09dac78eb4 | ||
|
|
e1ca3c52ed | ||
|
|
f7bf80d789 | ||
|
|
4c5ea08614 | ||
|
|
9046b397a1 | ||
|
|
91fae80326 | ||
|
|
f06de1e88d | ||
|
|
b161596d67 | ||
|
|
ded314f4d6 | ||
|
|
0b035c0583 | ||
|
|
cc08ebec3c | ||
|
|
1b2a1a5180 | ||
|
|
977757b2d3 | ||
|
|
6a43402c66 | ||
|
|
95570c49d4 | ||
|
|
9ff256429d | ||
|
|
c23b8bd8e5 | ||
|
|
e840def733 | ||
|
|
db333b6e98 | ||
|
|
30d1ef40f4 | ||
|
|
13c575179d | ||
|
|
aa48092d27 | ||
|
|
7f755bfd2c | ||
|
|
727d418c8d | ||
|
|
185874d23f | ||
|
|
827be40646 | ||
|
|
93ddefa42f | ||
|
|
d19639d1c3 | ||
|
|
d2c7f0787b | ||
|
|
1402a3ea07 | ||
|
|
981e34c950 | ||
|
|
022620a375 | ||
|
|
28f31d749b | ||
|
|
17600adbf1 | ||
|
|
f7da87596a | ||
|
|
7efd062f98 | ||
|
|
fddbd0ca87 | ||
|
|
37d83169c6 | ||
|
|
d19038cb1c | ||
|
|
12ed710369 | ||
|
|
3de4e1387f | ||
|
|
7bf8a16cf0 | ||
|
|
cbfce6f698 | ||
|
|
7144d700e4 | ||
|
|
ec56dbe578 | ||
|
|
b8f662f825 | ||
|
|
de03d8799a | ||
|
|
b9fc016f7d | ||
|
|
70957015ce | ||
|
|
f9f1e2bf17 | ||
|
|
4b6fe1d202 | ||
|
|
fd055e8355 | ||
|
|
0b705df09a | ||
|
|
c48227e258 | ||
|
|
7a19fea5f9 | ||
|
|
887c773463 | ||
|
|
4967ab6ea0 | ||
|
|
6314494177 | ||
|
|
86b97cc186 | ||
|
|
4b3d7967fb | ||
|
|
d44ddf2793 | ||
|
|
9e89307bf9 | ||
|
|
8403ff0a17 | ||
|
|
f6051ee14f | ||
|
|
119c82e110 | ||
|
|
648c2d26e4 | ||
|
|
ac83bb750b |
@@ -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
|
||||||
|
|||||||
20
website/public/API/adminChangeUser.php
Normal file
20
website/public/API/adminChangeUser.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
require_once ("../../queries/group_page.php");
|
||||||
|
|
||||||
|
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"])) {
|
||||||
|
changeMultipleUserStatusByID($_POST["checkbox-user"], $_POST["batchactions"]);
|
||||||
|
} else if (isset($_POST["groupbatchactions"]) && isset($_POST["checkbox-group"])) {
|
||||||
|
changeMultipleGroupStatusByID($_POST["checkbox-group"], $_POST["groupbatchactions"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//header("location: ../admin.php");
|
||||||
|
print_r($_POST);
|
||||||
28
website/public/API/adminPageNumber.php
Normal file
28
website/public/API/adminPageNumber.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/user.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"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pagetype == "user") {
|
||||||
|
include ("../../views/adminpanel-page.php");
|
||||||
|
} else {
|
||||||
|
echo "Pagenumber failed!";
|
||||||
|
}
|
||||||
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;
|
||||||
|
if (isset($_POST["n"])) {
|
||||||
|
$offset = (int) test_input($_POST["n"]);
|
||||||
|
}
|
||||||
|
$entries = 20;
|
||||||
|
if (isset($_POST["m"])) {
|
||||||
|
$entries = (int) test_input($_POST["m"]);
|
||||||
|
}
|
||||||
|
$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"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pagetype == "user") {
|
||||||
|
include ("../../views/adminpanel-table.php");
|
||||||
|
} else if ($pagetype == "group") {
|
||||||
|
include ("../../views/adminpanel-grouptable.php");
|
||||||
|
} else {
|
||||||
|
echo "Search failed!";
|
||||||
|
}
|
||||||
27
website/public/API/editFriendship.php
Normal file
27
website/public/API/editFriendship.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
if(empty($_POST["usr"]) OR empty($_POST["action"]) OR !in_array($_POST["action"], array("request", "accept", "delete"))) {
|
||||||
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
}
|
||||||
|
|
||||||
|
$friendship_status = getFriendshipStatus($_POST["usr"]);
|
||||||
|
|
||||||
|
if($_POST["action"] == "request" AND $friendship_status == 0) {
|
||||||
|
if (!requestFriendship($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Query (request) failed');
|
||||||
|
}
|
||||||
|
} else if($_POST["action"] == "delete" AND in_array($friendship_status, array(1, 2, 3))) {
|
||||||
|
if (!removeFriendship($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Query (delete) failed');
|
||||||
|
}
|
||||||
|
} else if ($_POST["action"] == "accept" AND $friendship_status == 3) {
|
||||||
|
if (!acceptFriendship($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Query (accept) failed');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('HTTP/1.1 500 Not the right friendship status');
|
||||||
|
}
|
||||||
24
website/public/API/getFriendshipStatus.php
Normal file
24
website/public/API/getFriendshipStatus.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
# -2: Query failed.
|
||||||
|
# -1: user1 and 2 are the same user
|
||||||
|
# 0 : no record found
|
||||||
|
# 1 : confirmed
|
||||||
|
# 2 : user1 sent request (you)
|
||||||
|
# 3 : user2 sent request (other)
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
if(empty($_POST["usr"])) {
|
||||||
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
}
|
||||||
|
|
||||||
|
$friendship_status = getFriendshipStatus($_POST["usr"]);
|
||||||
|
|
||||||
|
if($friendship_status == -2) {
|
||||||
|
header('HTTP/1.1 500 Query failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $friendship_status;
|
||||||
26
website/public/API/getPosts.php
Normal file
26
website/public/API/getPosts.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if(empty($_POST["usr"]) and empty($_POST["grp"])) {
|
||||||
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once ("../../queries/post.php");
|
||||||
|
require_once ("../../queries/nicetime.php");
|
||||||
|
|
||||||
|
if(empty($_POST["usr"])) {
|
||||||
|
$posts = selectAllPosts(0, $_POST["grp"]);
|
||||||
|
} else {
|
||||||
|
$posts = selectAllPosts($_POST["usr"], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$posts) {
|
||||||
|
header('HTTP/1.1 500 Query failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = $posts->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
for($i = 0; $i < sizeof($results); $i++) {
|
||||||
|
$results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($results);
|
||||||
16
website/public/API/loadFriends.php
Normal file
16
website/public/API/loadFriends.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
if (isset($_POST["limit"])) {
|
||||||
|
echo selectLimitedFriends($_SESSION["userID"], (int) test_input($_POST["limit"]));
|
||||||
|
} else if (isset($_GET["limit"])) {
|
||||||
|
echo selectLimitedFriends($_SESSION["userID"], (int) test_input($_GET["limit"]));
|
||||||
|
} else {
|
||||||
|
echo selectFriends($_SESSION["userID"]);
|
||||||
|
}
|
||||||
|
|
||||||
14
website/public/API/loadGroups.php
Normal file
14
website/public/API/loadGroups.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/group_member.php");
|
||||||
|
|
||||||
|
if (isset($_POST["limit"])) {
|
||||||
|
echo selectLimitedGroupsFromUser($_SESSION["userID"], (int) test_input($_POST["limit"]));
|
||||||
|
} else {
|
||||||
|
echo selectAllGroupsFromUser($_SESSION["userID"]);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -8,8 +8,9 @@ require_once("../../queries/checkInput.php");
|
|||||||
require_once("../../queries/friendship.php");
|
require_once("../../queries/friendship.php");
|
||||||
|
|
||||||
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
|
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
|
||||||
|
setLastVisited(test_input($_POST["destination"]));
|
||||||
echo getNewChatMessages(test_input($_POST["lastID"]), test_input($_POST["destination"]));
|
echo getNewChatMessages(test_input($_POST["lastID"]), test_input($_POST["destination"]));
|
||||||
} else {
|
} else {
|
||||||
echo getOldChatMessages(test_input($_POST["destination"]));
|
|
||||||
setLastVisited(test_input($_POST["destination"]));
|
setLastVisited(test_input($_POST["destination"]));
|
||||||
|
echo getOldChatMessages(test_input($_POST["destination"]));
|
||||||
}
|
}
|
||||||
12
website/public/API/loadPost.php
Normal file
12
website/public/API/loadPost.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once("../../queries/connect.php");
|
||||||
|
require_once("../../queries/post.php");
|
||||||
|
require_once("../../queries/checkInput.php");
|
||||||
|
require_once("../../queries/nicetime.php");
|
||||||
|
|
||||||
|
if(isset($_GET['postID'])) {
|
||||||
|
include("../../views/post-view.php");
|
||||||
|
} else {
|
||||||
|
echo "Failed to load";
|
||||||
|
}
|
||||||
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"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
website/public/API/postComment.php
Normal file
29
website/public/API/postComment.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require("../../queries/post.php");
|
||||||
|
require_once("../../queries/connect.php");
|
||||||
|
require("../../queries/checkInput.php");
|
||||||
|
print_r($_POST);
|
||||||
|
if ($_POST['button'] == 'reaction') {
|
||||||
|
if (empty($_POST['newcomment-content'])) {
|
||||||
|
echo 0;
|
||||||
|
} else {
|
||||||
|
if (makeComment($_POST['postID'],
|
||||||
|
$_SESSION['userID'],
|
||||||
|
test_input($_POST['newcomment-content']))) {
|
||||||
|
echo 1;
|
||||||
|
} else {
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ($_POST['button'] == 'nietslecht') {
|
||||||
|
if (makeNietSlecht($_POST["postID"], $_SESSION["userID"])) {
|
||||||
|
echo 1;
|
||||||
|
} else {
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
39
website/public/API/postPost.php
Normal file
39
website/public/API/postPost.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once("../../queries/post.php");
|
||||||
|
require_once("../../queries/group_page.php");
|
||||||
|
require_once("../../queries/connect.php");
|
||||||
|
require_once("../../queries/checkInput.php");
|
||||||
|
require_once("../../queries/picture.php");
|
||||||
|
|
||||||
|
if (empty($_POST["title"]) or
|
||||||
|
empty($_POST["content"]) or
|
||||||
|
empty($_SESSION["userID"])) {
|
||||||
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($_POST["group"])) {
|
||||||
|
// User Post
|
||||||
|
makePost(
|
||||||
|
$_SESSION["userID"],
|
||||||
|
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"],
|
||||||
|
test_input($_POST["title"]),
|
||||||
|
test_input($_POST["content"]),
|
||||||
|
$_POST["group"]
|
||||||
|
);
|
||||||
|
}
|
||||||
28
website/public/API/searchGroups.php
Normal file
28
website/public/API/searchGroups.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/group_member.php");
|
||||||
|
require_once ("../../queries/group_page.php");
|
||||||
|
|
||||||
|
$n = 0;
|
||||||
|
if (isset($_POST["n"])) {
|
||||||
|
$n = (int) test_input($_POST["n"]);
|
||||||
|
}
|
||||||
|
$m = 20;
|
||||||
|
if (isset($_POST["m"])) {
|
||||||
|
$m = (int) test_input($_POST["m"]);
|
||||||
|
}
|
||||||
|
$search = "";
|
||||||
|
if (isset($_POST["search"])) {
|
||||||
|
$search = test_input($_POST["search"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST["filter"]) && $_POST["filter"] == "personal") {
|
||||||
|
echo searchSomeOwnGroups($n, $m, $search);
|
||||||
|
} else {
|
||||||
|
echo searchSomeGroups($n, $m, $search);
|
||||||
|
}
|
||||||
27
website/public/API/searchUsers.php
Normal file
27
website/public/API/searchUsers.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/checkInput.php");
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
require_once ("../../queries/user.php");
|
||||||
|
|
||||||
|
$n = 0;
|
||||||
|
if (isset($_POST["n"])) {
|
||||||
|
$n = (int) test_input($_POST["n"]);
|
||||||
|
}
|
||||||
|
$m = 20;
|
||||||
|
if (isset($_POST["m"])) {
|
||||||
|
$m = (int) test_input($_POST["m"]);
|
||||||
|
}
|
||||||
|
$search = "";
|
||||||
|
if (isset($_POST["search"])) {
|
||||||
|
$search = test_input($_POST["search"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST["filter"]) && $_POST["filter"] == "personal") {
|
||||||
|
echo searchSomeFriends($n, $m, $search);
|
||||||
|
} else {
|
||||||
|
echo searchSomeUsers($n, $m, $search);
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
$userinfo = getRoleByID($_SESSION['userID'])->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($userinfo['role'] != 'admin' AND $userinfo['role'] != 'owner') {
|
||||||
|
header("location:profile.php");
|
||||||
|
}
|
||||||
|
|
||||||
include("../views/main.php");
|
include("../views/main.php");
|
||||||
|
|
||||||
/* Add your view files here. */
|
/* Add your view files here. */
|
||||||
|
|||||||
90
website/public/bits/friend-item.php
Normal file
90
website/public/bits/friend-item.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
include_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
if (isset($_POST["action"])) {
|
||||||
|
$action = $_POST["action"];
|
||||||
|
} else {
|
||||||
|
$action = "profile.php";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST["actionType"])) {
|
||||||
|
$actionType = $_POST["actionType"];
|
||||||
|
} else {
|
||||||
|
$actionType = "GET";
|
||||||
|
}
|
||||||
|
|
||||||
|
$friends = json_decode($_POST["friends"]);
|
||||||
|
|
||||||
|
foreach($friends as $i => $friend) {
|
||||||
|
$friendshipStatus = getFriendshipStatus($friend->userID);
|
||||||
|
?>
|
||||||
|
<li class='friend-item'>
|
||||||
|
<form action='<?= $action ?>' method='<?= $actionType ?>'>
|
||||||
|
<button type='submit'
|
||||||
|
name='username'
|
||||||
|
value='<?php
|
||||||
|
if (isset($friend->username)) {
|
||||||
|
echo $friend->username;
|
||||||
|
} else if (isset($friend->content)) {
|
||||||
|
echo $friend->userID;
|
||||||
|
}
|
||||||
|
?>'>
|
||||||
|
<div class='friend'>
|
||||||
|
<img alt='PF' class='profile-picture' src='<?= $friend->profilepicture ?>'/>
|
||||||
|
<div class='friend-name'>
|
||||||
|
<?= $friend->fullname ?><br/>
|
||||||
|
<span style='color: #666'><?php
|
||||||
|
if (isset($friend->username)) {
|
||||||
|
echo $friend->username;
|
||||||
|
} else if (isset($friend->content)) {
|
||||||
|
echo $friend->content;
|
||||||
|
}
|
||||||
|
?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
if ($friendshipStatus > 1) {
|
||||||
|
if ($friendshipStatus == 2) {
|
||||||
|
$denyName = "Annuleer";
|
||||||
|
} else {
|
||||||
|
$denyName = "Weiger";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class='notification-options'>
|
||||||
|
<?php
|
||||||
|
if ($friendshipStatus == 3) {
|
||||||
|
?>
|
||||||
|
<button name='accept'
|
||||||
|
onclick="editFriendship('<?= $friend->userID ?>', 'accept')"
|
||||||
|
class='accept-notification'
|
||||||
|
value='1'>
|
||||||
|
<i class='fa fa-check'></i>Accepteer
|
||||||
|
</button>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<input type='hidden' name='userID' value='' />
|
||||||
|
<button name='delete'
|
||||||
|
onclick="editFriendship('<?= $friend->userID ?>', 'delete')"
|
||||||
|
class='deny-notification'
|
||||||
|
value='1'>
|
||||||
|
<i class='fa fa-times'></i> <?= $denyName ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
24
website/public/bits/group-item.php
Normal file
24
website/public/bits/group-item.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
include_once ("../../queries/group_member.php");
|
||||||
|
|
||||||
|
$groups = json_decode($_POST["groups"]);
|
||||||
|
|
||||||
|
foreach($groups as $i => $group) {
|
||||||
|
?>
|
||||||
|
<li class='group-item'>
|
||||||
|
<form action='group.php' method='get'>
|
||||||
|
<button type='submit'
|
||||||
|
name='groupname'
|
||||||
|
value='<?= $group->name ?>'>
|
||||||
|
<div class='group'>
|
||||||
|
<img alt='PF' class='group-picture' src='<?= $group->picture ?>'/>
|
||||||
|
<?= $group->name ?>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
49
website/public/emailconfirm.php
Normal file
49
website/public/emailconfirm.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
include_once("../queries/connect.php");
|
||||||
|
include_once("../views/messagepage.php");
|
||||||
|
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||||
|
$checkHash = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`email`,
|
||||||
|
`role`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$checkHash->bindParam(":userID", $_GET["u"]);
|
||||||
|
$checkHash->execute();
|
||||||
|
$result = $checkHash->fetch();
|
||||||
|
$email = $result["email"];
|
||||||
|
$role = $result["role"];
|
||||||
|
if ($role == "unconfirmed") {
|
||||||
|
doActivate($email);
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige link.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige link.");
|
||||||
|
}
|
||||||
|
|
||||||
|
function doActivate(string $email) {
|
||||||
|
if (password_verify($email, $_GET["h"])) {
|
||||||
|
$confirmUser = prepareQuery("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`role` = :role
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$confirmUser->bindValue(":role", "user");
|
||||||
|
$confirmUser->bindParam(":userID", $_GET["u"]);
|
||||||
|
$confirmUser->execute();
|
||||||
|
if ($confirmUser->rowCount()) {
|
||||||
|
messagePage("Email bevestigd <br />
|
||||||
|
<a href='index.php'>Klik hier om terug te gaan naar de login pagina.</a>");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige link.");
|
||||||
|
}
|
||||||
|
}
|
||||||
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("../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,5 +1,9 @@
|
|||||||
<html>
|
<?php
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0; url=login.php" />
|
session_start();
|
||||||
</head>
|
|
||||||
</html>
|
if (isset($_SESSION["userID"])) {
|
||||||
|
header("Location: profile.php");
|
||||||
|
} else {
|
||||||
|
header("Location: login.php");
|
||||||
|
}
|
||||||
@@ -1,6 +1,18 @@
|
|||||||
window.onload = function() {
|
$(window).on("load", function () {
|
||||||
changeFilter();
|
changeFilter();
|
||||||
};
|
$(".admin-searchinput").keyup(function(){
|
||||||
|
adminSearch();
|
||||||
|
});
|
||||||
|
// all inputs and labels directly under admin filter and groupfilter
|
||||||
|
$("#admin-filter, #admin-groupfilter > input, label").click(function(){
|
||||||
|
adminSearch();
|
||||||
|
});
|
||||||
|
$("#pagetype").change(function(){
|
||||||
|
adminSearch();
|
||||||
|
});
|
||||||
|
|
||||||
|
adminSearch();
|
||||||
|
});
|
||||||
|
|
||||||
function checkAll(allbox) {
|
function checkAll(allbox) {
|
||||||
var checkboxes = document.getElementsByClassName('checkbox-list');
|
var checkboxes = document.getElementsByClassName('checkbox-list');
|
||||||
@@ -32,13 +44,31 @@ 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 adminSearch() {
|
||||||
|
$.post(
|
||||||
|
"API/adminSearchUsers.php",
|
||||||
|
$("#admin-searchform").serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
$("#usertable").html(data);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePageN() {
|
||||||
|
$.post(
|
||||||
|
"API/adminPageNumber.php",
|
||||||
|
$("#admin-searchform").serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
$("#admin-pageinfo").html(data);
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,23 +1,31 @@
|
|||||||
|
var previousDate = new Date("1970-01-01 00:00:00");
|
||||||
|
var previousTime = "00:00";
|
||||||
|
var gettingMessages = false;
|
||||||
|
var previousType = "robot";
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(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()
|
||||||
).done(function(data) {
|
).done(function (data) {
|
||||||
if (data && data != "[]") {
|
if (data && data != "[]") {
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -28,35 +36,76 @@ function sendMessage() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$("#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("");
|
||||||
$("#lastID").val("");
|
$("#lastID").val("");
|
||||||
$("#chat-recent-panel .friend-item").removeClass("active-friend-chat");
|
$("#chat-recent-panel .friend-item").removeClass("active-friend-chat");
|
||||||
$("#chat-left #friend-item-" + userID).addClass("active-friend-chat");
|
$("#friend-item-" + userID).addClass("active-friend-chat");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sayEmpty() {
|
function sayEmpty() {
|
||||||
$("#chat-history").html("Begin nu met chatten!");
|
$("#chat-history").html("Probeer ook eens foto's en video's te sturen");
|
||||||
}
|
}
|
||||||
70
website/public/js/friendButtons.js
Normal file
70
website/public/js/friendButtons.js
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
function placeFriendButtons() {
|
||||||
|
$.post("API/getFriendshipStatus.php", { usr: userID })
|
||||||
|
.done(function(data) {
|
||||||
|
var friendshipStatus = data;
|
||||||
|
var $buttonContainer = $("div.friend-button-container");
|
||||||
|
$("#start-profile-chat").hide();
|
||||||
|
$buttonContainer.html("");
|
||||||
|
var value1 = "";
|
||||||
|
var class1 = "empty-button";
|
||||||
|
var icon1 = "";
|
||||||
|
var text1 = "";
|
||||||
|
|
||||||
|
var value2 = "";
|
||||||
|
var class2 = "empty-button";
|
||||||
|
var icon2 = "";
|
||||||
|
var text2 = "";
|
||||||
|
|
||||||
|
switch (friendshipStatus) {
|
||||||
|
case "0":
|
||||||
|
value1 = "request";
|
||||||
|
class1 = "green";
|
||||||
|
text1 = "Bevriend";
|
||||||
|
icon1 = "fa-handshake-o";
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
value1 = userID;
|
||||||
|
class1 = "green";
|
||||||
|
text1 = "Chat";
|
||||||
|
icon1 = "fa-comment-o";
|
||||||
|
value2 = "delete";
|
||||||
|
class2 = "red";
|
||||||
|
text2 = "Verwijder";
|
||||||
|
icon2 = "fa-times";
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
value1 = "delete";
|
||||||
|
class1 = "red";
|
||||||
|
text1 = "Trek verzoek in";
|
||||||
|
icon1 = "fa-cross";
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
value1 = "accept";
|
||||||
|
class1 = "green";
|
||||||
|
text1 = "Accepteer";
|
||||||
|
icon1 = "fa-check";
|
||||||
|
value2 = "delete";
|
||||||
|
class2 = "red";
|
||||||
|
text2 = "Weiger";
|
||||||
|
icon2 = "fa-times";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$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() {
|
||||||
|
if (isNaN(this.value))
|
||||||
|
editFriendship(userID, this.value);
|
||||||
|
else if (this.value != "")
|
||||||
|
window.location.href = "chat.php?username=" + this.value;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,25 +1,40 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#own-profile-picture").click(function() {
|
// Toggle menu
|
||||||
if($("#notification-center").css('right') == "-256px") {
|
$("#own-profile-picture, #open-notifications").click(function() {
|
||||||
$(".content").animate({
|
if ($("#notification-center").css('display') == "none") {
|
||||||
marginRight: "256px"
|
// Make the menu visible and move the content to the left.
|
||||||
}, 500);
|
$(".modal").width("calc(100% - 512px)");
|
||||||
$(".chat-right").animate({
|
$(".content").css("margin-right", "256px");
|
||||||
width: $(".chat-right").width() - 266
|
$("#notification-center").css("right", "0px");
|
||||||
}, 500);
|
$("#notification-center").css("display", "block");
|
||||||
$("#notification-center").animate({
|
$("#contact-menu").css("display", "block");
|
||||||
right: "0px"
|
|
||||||
}, 500);
|
// 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 {
|
} else {
|
||||||
$(".chat-right").animate({
|
document.cookie = "menu=closed; path=/";
|
||||||
width: $(".chat-right").width() + 266
|
}
|
||||||
}, 500);
|
} else {
|
||||||
$(".content").animate({
|
$(".modal").width("calc(100% - 256px)");
|
||||||
marginRight: "0px"
|
$(".content").css("margin-right", "0px");
|
||||||
}, 500);
|
$("#notification-center").css("display", "none");
|
||||||
$("#notification-center").animate({
|
|
||||||
right: "-256px"
|
if (window.innerWidth > 1080) {
|
||||||
}, 500);
|
$("#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();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
96
website/public/js/main.js
Normal file
96
website/public/js/main.js
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
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) {
|
||||||
|
$.post("API/editFriendship.php", { usr: userID, action: value })
|
||||||
|
.done(function() {
|
||||||
|
placeFriendButtons();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFriends(friends, list) {
|
||||||
|
if(friends && friends != "[]") {
|
||||||
|
$(list).load("bits/friend-item.php", {
|
||||||
|
"friends": friends
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFriendsPlus(friends, list, limit, action, actionType) {
|
||||||
|
if(friends && friends != "[]") {
|
||||||
|
$(list).load("bits/friend-item.php", {
|
||||||
|
"friends": friends,
|
||||||
|
"limit": limit,
|
||||||
|
"action": action,
|
||||||
|
"actionType": actionType
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showGroups(groups, list) {
|
||||||
|
if(groups && groups != "[]") {
|
||||||
|
$(list).load("bits/group-item.php", {
|
||||||
|
"groups": groups
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,37 +1,109 @@
|
|||||||
margin = 20;
|
margin = 20;
|
||||||
|
|
||||||
|
// scrolling modal taken from http://stackoverflow.com/questions/10476632/how-to-scroll-the-page-when-a-modal-dialog-is-longer-than-the-screen
|
||||||
|
function scrollbarMargin(width, overflow) {
|
||||||
|
$('body').css({
|
||||||
|
marginRight: width,
|
||||||
|
overflow: overflow
|
||||||
|
});
|
||||||
|
$('.profile-menu').css({
|
||||||
|
marginRight: width
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestPost(postID) {
|
||||||
|
$(".modal").show();
|
||||||
|
|
||||||
|
$.get("API/loadPost.php", { postID : postID }).done(function(data) {
|
||||||
|
$('.modal-default').hide();
|
||||||
|
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
||||||
|
scrollbarMargin(scrollBarWidth, 'hidden');
|
||||||
|
$('#modal-response').show();
|
||||||
|
$('#modal-response').html(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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(data) {
|
||||||
|
masonry(masonryMode);
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.post("API/postPost.php", { title: title,
|
||||||
|
content : content })
|
||||||
|
.done(function(data) {
|
||||||
|
masonry(masonryMode);
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
console.log("LOADED");
|
$(".modal-close").click(function () {
|
||||||
container = $("div.posts");
|
$(".modal").hide();
|
||||||
posts = container.children();
|
scrollbarMargin(0, 'auto');
|
||||||
posts.remove();
|
$('#modal-response').hide();
|
||||||
|
$('.modal-default').show();
|
||||||
column = $('<div class="column"></div>').append(posts);
|
});
|
||||||
container.append(column);
|
|
||||||
|
|
||||||
mansonry();
|
|
||||||
mansonry();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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() {
|
||||||
mansonry();
|
if ($(window).width() != windowWidth) {
|
||||||
|
windowWidth = $(window).width();
|
||||||
|
masonry(masonryMode);
|
||||||
|
}
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
});
|
||||||
|
|
||||||
function mansonry() {
|
var $container = $(".posts");
|
||||||
|
|
||||||
|
function masonry(mode) {
|
||||||
|
masonryMode = mode;
|
||||||
|
$container.children().remove();
|
||||||
columnCount = Math.floor($(".posts").width() / 250);
|
columnCount = Math.floor($(".posts").width() / 250);
|
||||||
console.log("columns: " + columnCount);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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++) {
|
||||||
columns[i] = [0, []];
|
$column = $("<div class='column'>");
|
||||||
console.log(columns[i]);
|
$column.width(100/columnCount + "%");
|
||||||
|
$container.append($column);
|
||||||
|
columns[i] = [0, $column];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode > 0) {
|
||||||
|
$postInput = $("<div class='post platform'>");
|
||||||
|
$form = $("<form class='newpost' action='API/postPost.php' method='post' onsubmit='postPost(); return false;'>");
|
||||||
|
$postInput.append($form);
|
||||||
|
|
||||||
|
if(mode == 2) {
|
||||||
|
$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...'>"));
|
||||||
|
$form.append($("<label for='picture'>Voeg een foto toe</label><input class='newpost' name='picture' id='picture' type='file' accept='image/*' size='4000000'>"));
|
||||||
|
$form.append($("<input value='Plaats!' type='submit'>"));
|
||||||
|
columns[0][1].append($postInput);
|
||||||
|
|
||||||
|
columns[0][0] = $postInput.height() + margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -45,32 +117,30 @@ function mansonry() {
|
|||||||
column = columns[i];
|
column = columns[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return column;
|
return column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the posts from the server.
|
||||||
|
*/
|
||||||
|
$.post("API/getPosts.php", { usr : userID, grp : groupID })
|
||||||
|
.done(function(data) {
|
||||||
|
posts = JSON.parse(data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rearange the objects.
|
* Rearange the objects.
|
||||||
*/
|
*/
|
||||||
j = 0;
|
$.each(posts, function() {
|
||||||
posts.each(function(i) {
|
$post = $("<div class='post platform' onclick='requestPost(\'"+this['postID']+"\')'>");
|
||||||
post = posts[i];
|
$post.append($("<h2>").html(this["title"]));
|
||||||
|
$post.append($("<p>").html(this["content"]));
|
||||||
|
$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[0] = shortestColumn[0] + $(post).height() + margin;
|
shortestColumn[1].append($post);
|
||||||
shortestColumn[1].push(post);
|
shortestColumn[0] = shortestColumn[0] + $post.height() + margin;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
container.children().remove();
|
|
||||||
/*
|
|
||||||
* Display the objects again in the correct order.
|
|
||||||
*/
|
|
||||||
for (i = 0; i < columnCount; i++) {
|
|
||||||
column = $('<div class="column"></div>').append(columns[i][1]);
|
|
||||||
console.log(column);
|
|
||||||
container.append(column);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$("div.posts div.column").width(100/columnCount + "%");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,93 @@
|
|||||||
|
var menuFriendsData;
|
||||||
|
var menuGroupsData;
|
||||||
|
var notificationMessagesData;
|
||||||
|
var notificationRequestsData;
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(".extra-menu-items").hide();
|
loadMenuFriends(5);
|
||||||
$("#menu-back").hide();
|
loadNotificationFriends();
|
||||||
|
loadUnreadMessages();
|
||||||
// Show more friends
|
loadMenuGroups();
|
||||||
$("#more-friends-click").click(function() {
|
setInterval(updateMenus, 3000);
|
||||||
// Show only friends
|
|
||||||
$("#groups-menu-section").slideUp();
|
|
||||||
$("#friends-menu-section li").show();
|
|
||||||
|
|
||||||
// Change buttons
|
|
||||||
$("#more-friends-click").hide();
|
|
||||||
$("#menu-back").show();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Show more groups
|
|
||||||
$("#more-groups-click").click(function() {
|
|
||||||
// Show only groups
|
|
||||||
$("#friends-menu-section").slideUp();
|
|
||||||
$("#groups-menu-section li").show();
|
|
||||||
|
|
||||||
// Change buttons
|
|
||||||
$("#more-groups-click").hide();
|
|
||||||
$("#menu-back").show();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Go back
|
|
||||||
$("#menu-back").click(function() {
|
|
||||||
// Show overview of friends and groups
|
|
||||||
$("#friends-menu-section").slideDown();
|
|
||||||
$("#groups-menu-section").slideDown();
|
|
||||||
$(".extra-menu-items").hide();
|
|
||||||
|
|
||||||
// Change buttons
|
|
||||||
$("#menu-back").hide();
|
|
||||||
$("#more-groups-click").show();
|
|
||||||
$("#more-friends-click").show();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Update the menu and notification items.
|
||||||
|
function updateMenus() {
|
||||||
|
loadMenuFriends(5);
|
||||||
|
loadNotificationFriends();
|
||||||
|
loadUnreadMessages();
|
||||||
|
loadMenuGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get, every 3 seconds, the friends and insert them in the menu.
|
||||||
|
function loadMenuFriends(limit) {
|
||||||
|
$.post(
|
||||||
|
"API/loadFriends.php",
|
||||||
|
{
|
||||||
|
limit: 5
|
||||||
|
}
|
||||||
|
).done(function(data) {
|
||||||
|
if (menuFriendsData != data) {
|
||||||
|
menuFriendsData = data;
|
||||||
|
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
|
||||||
|
$("#friends-menu-section").show();
|
||||||
|
} else {
|
||||||
|
$("#friends-menu-section").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get, every 3 seconds, the groups and insert them in the menu.
|
||||||
|
function loadMenuGroups() {
|
||||||
|
$.post(
|
||||||
|
"API/loadGroups.php",
|
||||||
|
{
|
||||||
|
limit: 5
|
||||||
|
}
|
||||||
|
).done(function(data) {
|
||||||
|
if (menuGroupsData != data) {
|
||||||
|
menuGroupsData = data;
|
||||||
|
if (showGroups(data, "#menu-groups-list")) {
|
||||||
|
$("#groups-menu-section").show();
|
||||||
|
} else {
|
||||||
|
$("#groups-menu-section").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get, every 3 seconds, the friends requests and insert them in the notification center.
|
||||||
|
function loadNotificationFriends() {
|
||||||
|
$.post(
|
||||||
|
"API/loadFriendRequest.php"
|
||||||
|
).done(function(data) {
|
||||||
|
if (notificationRequestsData != data) {
|
||||||
|
notificationRequestsData = data;
|
||||||
|
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
|
||||||
|
$("#friend-request-section").show();
|
||||||
|
} else {
|
||||||
|
$("#friend-request-section").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get, every 3 seconds, the unread messages and insert them in the notification center.
|
||||||
|
function loadUnreadMessages() {
|
||||||
|
$.post(
|
||||||
|
"API/loadChatNotifications.php"
|
||||||
|
).done(function(data) {
|
||||||
|
if (notificationMessagesData != data) {
|
||||||
|
notificationMessagesData = data;
|
||||||
|
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
|
||||||
|
$("#unread-messages-section").show();
|
||||||
|
} else {
|
||||||
|
$("#unread-messages-section").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
function showFriendNotifications(notifications) {
|
|
||||||
$("#friendrequestslist").html("");
|
|
||||||
for (i in notifications) {
|
|
||||||
$("#friendrequestslist").append(" \
|
|
||||||
<li class='friend-item $extraItem'> \
|
|
||||||
<form action='profile.php' method='get'> \
|
|
||||||
<button type='submit' \
|
|
||||||
name='username' \
|
|
||||||
value='"+ notifications[i].username +"'> \
|
|
||||||
<div class='friend'> \
|
|
||||||
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
|
||||||
"+ notifications[i].username +" \
|
|
||||||
</div> \
|
|
||||||
</button> \
|
|
||||||
</form> \
|
|
||||||
</li> \
|
|
||||||
");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showChatNotifications(notifications) {
|
|
||||||
$("#unreadChatlist").html("");
|
|
||||||
for (i in notifications) {
|
|
||||||
$("#unreadChatlist").append(" \
|
|
||||||
<li class='friend-item $extraItem'> \
|
|
||||||
<form action='chat.php' method='get'> \
|
|
||||||
<button type='submit' \
|
|
||||||
name='username' \
|
|
||||||
value='"+ notifications[i].userID +"'> \
|
|
||||||
<div class='friend'> \
|
|
||||||
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
|
||||||
<div class='friend-name'> \
|
|
||||||
"+ notifications[i].name +"<br/> \
|
|
||||||
<span style='color: #666'>"+ notifications[i].content +"</span> \
|
|
||||||
</div> \
|
|
||||||
</div> \
|
|
||||||
</button> \
|
|
||||||
</form> \
|
|
||||||
</li> \
|
|
||||||
");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadNotifications() {
|
|
||||||
$.post(
|
|
||||||
"API/loadFriendRequestNotifications.php"
|
|
||||||
).done(function(data) {
|
|
||||||
if (data && data != "[]") {
|
|
||||||
showFriendNotifications(JSON.parse(data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.post(
|
|
||||||
"API/loadChatNotifications.php"
|
|
||||||
).done(function(data) {
|
|
||||||
if (data && data != "[]") {
|
|
||||||
showChatNotifications(JSON.parse(data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(loadNotifications, 10000);
|
|
||||||
}
|
|
||||||
$(document).ready(function() {
|
|
||||||
loadNotifications();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
20
website/public/js/post.js
Normal file
20
website/public/js/post.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
function postComment(buttonValue) {
|
||||||
|
formData = $("#newcommentform").serializeArray();
|
||||||
|
formData.push({name: "button", value: buttonValue});
|
||||||
|
$.post(
|
||||||
|
"API/postComment.php",
|
||||||
|
formData
|
||||||
|
).done(function(data) {
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#newcomment").val("");
|
||||||
|
|
||||||
|
//reload post
|
||||||
|
$.get(
|
||||||
|
"API/loadPost.php",
|
||||||
|
$("#newcommentform").serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
$('#modal-response').html(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
0
website/public/js/profile.js
Normal file
0
website/public/js/profile.js
Normal file
@@ -1,8 +1,15 @@
|
|||||||
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";
|
||||||
}
|
}
|
||||||
document.getElementById("demo").innerHTML = x;
|
}
|
||||||
|
|
||||||
|
function bannedAlert(){
|
||||||
|
alert("Uw account is geband!");
|
||||||
|
}
|
||||||
|
|
||||||
|
function emailNotConfirmed(){
|
||||||
|
alert("Uw account is nog niet bevestigd!\nEr is een nieuwe email gestuurd om uw account te bevestigen");
|
||||||
}
|
}
|
||||||
|
|||||||
31
website/public/js/search.js
Normal file
31
website/public/js/search.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
function searchUsers(n, m) {
|
||||||
|
$.post(
|
||||||
|
"API/searchUsers.php",
|
||||||
|
{
|
||||||
|
n: n,
|
||||||
|
m: m,
|
||||||
|
search: $("#search-input").val(),
|
||||||
|
filter: $("#search-filter").val()
|
||||||
|
}
|
||||||
|
).done(function(data) {
|
||||||
|
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
|
||||||
|
$("#search-users-list").text("Niemand gevonden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchGroups(n, m) {
|
||||||
|
$.post(
|
||||||
|
"API/searchGroups.php",
|
||||||
|
{
|
||||||
|
n: n,
|
||||||
|
m: m,
|
||||||
|
search: $("#search-input").val(),
|
||||||
|
filter: $("#search-filter").val()
|
||||||
|
}
|
||||||
|
).done(function(data) {
|
||||||
|
if (!showGroups(data, "#search-groups-list")) {
|
||||||
|
$("#search-groups-list").text("Geen groepen gevonden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
require_once("../queries/connect.php");
|
require_once("../queries/connect.php");
|
||||||
include_once("../queries/login.php");
|
include_once("../queries/login.php");
|
||||||
include_once("../queries/checkInput.php");
|
include_once("../queries/checkInput.php");
|
||||||
|
include_once("../queries/emailconfirm.php");
|
||||||
|
include_once("../queries/requestpassword.php");
|
||||||
|
include_once("../queries/register.php");
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
@@ -16,35 +19,45 @@
|
|||||||
</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 ="";
|
$loginErr = $resetErr ="";
|
||||||
|
|
||||||
// Trying to login
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
// Empty username or password field
|
switch ($_POST["submit"]) {
|
||||||
if (empty($_POST["uname"]) || empty($_POST["psw"])) {
|
case "login":
|
||||||
$loginErr = "Gebruikersnaam of wachtwoord is niet ingevuld";
|
try {
|
||||||
|
$user = ($_POST["user"]);
|
||||||
|
validateLogin($_POST["user"], $_POST["psw"]);
|
||||||
|
} catch(loginException $e) {
|
||||||
|
$loginErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
else {
|
break;
|
||||||
$uname = strtolower(test_input($_POST["uname"]));
|
case "reset":
|
||||||
$psw = test_input($_POST["psw"]);
|
try {
|
||||||
$hash = getUser()["password"];
|
resetEmail($_POST["forgotEmail"]);
|
||||||
$userid = getUser()["userID"];
|
sendPasswordRecovery($_POST["forgotEmail"]);
|
||||||
|
} catch (emailException $e){
|
||||||
// If there's an account, go to the profile page
|
$resetErr = $e->getMessage();
|
||||||
if(password_verify($psw, $hash)) {
|
echo "<script>
|
||||||
$_SESSION["userID"] = $userid;
|
window.onload = function() {
|
||||||
header("location: profile.php");
|
$('#myModal').show();
|
||||||
|
|
||||||
} else {
|
|
||||||
$loginErr = "Inloggegevens zijn niet correct";
|
|
||||||
}
|
}
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "register":
|
||||||
|
include("register.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This view adds login view */
|
/* This view adds login view */
|
||||||
include("../views/login-view.php");
|
include("../views/login-view.php");
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,15 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<?php
|
<?php
|
||||||
include("../views/login_head.php");
|
session_start();
|
||||||
require_once("../queries/connect.php");
|
session_destroy();
|
||||||
include_once("../queries/login.php");
|
header("Location: login.php");
|
||||||
?>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
unset($_SESSION["userID"]);
|
|
||||||
header("Location: login.php");
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -2,9 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<?php include("../views/head.php"); ?>
|
<?php include("../views/head.php"); ?>
|
||||||
<script src="/js/masonry.js"></script>
|
|
||||||
|
<script src="js/masonry.js"></script>
|
||||||
|
<script src="js/post.js"></script>
|
||||||
<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>
|
||||||
@@ -12,6 +16,7 @@
|
|||||||
include("../queries/user.php");
|
include("../queries/user.php");
|
||||||
include("../queries/friendship.php");
|
include("../queries/friendship.php");
|
||||||
include("../queries/nicetime.php");
|
include("../queries/nicetime.php");
|
||||||
|
include("../queries/post.php");
|
||||||
|
|
||||||
if(empty($_GET["username"])) {
|
if(empty($_GET["username"])) {
|
||||||
$userID = $_SESSION["userID"];
|
$userID = $_SESSION["userID"];
|
||||||
@@ -19,10 +24,18 @@ if(empty($_GET["username"])) {
|
|||||||
$userID = getUserID($_GET["username"]);
|
$userID = getUserID($_GET["username"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = selectUser($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"]) {
|
||||||
|
$friendship_status = -1;
|
||||||
|
$masonry_mode = 1;
|
||||||
|
} else {
|
||||||
|
$friendship_status = $user["friend_status"];
|
||||||
|
$masonry_mode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This view adds the main layout over the screen.
|
* This view adds the main layout over the screen.
|
||||||
@@ -36,5 +49,17 @@ include("../views/profile.php");
|
|||||||
/* This adds the footer. */
|
/* This adds the footer. */
|
||||||
include("../views/footer.php");
|
include("../views/footer.php");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<script src="js/friendButtons.js"></script>
|
||||||
|
<script src="js/masonry.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
userID = <?= $userID ?>;
|
||||||
|
groupID = 0;
|
||||||
|
placeFriendButtons();
|
||||||
|
|
||||||
|
masonry(<?= $masonry_mode ?>);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
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,45 +1,91 @@
|
|||||||
<!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");
|
|
||||||
?>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
if(isset($_SESSION["userID"])){
|
|
||||||
header("location: profile.php");
|
|
||||||
}
|
|
||||||
// define variables and set to empty values
|
|
||||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = "";
|
|
||||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = "";
|
|
||||||
$correct = true;
|
|
||||||
|
|
||||||
// Trying to register an account
|
try {
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
$name = test_input(($_POST["name"]));
|
||||||
checkInputChoice("name", "lettersAndSpace");
|
checkInputChoice($name, "lettersAndSpaces");
|
||||||
checkInputChoice("surname", "lettersAndSpace");
|
} catch(lettersAndSpacesException $e){
|
||||||
|
|
||||||
if (empty($_POST["bday"])) {
|
|
||||||
$bdayErr = "Geboortedatum is verplicht!";
|
|
||||||
$correct = false;
|
$correct = false;
|
||||||
|
$nameErr = $e->getMessage();
|
||||||
} else {
|
|
||||||
$bday = test_input($_POST["bday"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkInputChoice("username", "username");
|
try {
|
||||||
checkInputChoice("password", "longerEight");
|
$surname = test_input(($_POST["surname"]));
|
||||||
checkInputChoice("confirmpassword", "");
|
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();
|
matchPassword();
|
||||||
checkInputChoice("location", "lettersAndSpace");
|
} catch(passwordException $e){
|
||||||
checkInputChoice("email", "email");
|
$correct = false;
|
||||||
registerCheck();
|
$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){
|
||||||
|
echo "<script>
|
||||||
|
window.onload = function() {
|
||||||
|
$('#registerModal').show();
|
||||||
|
}
|
||||||
|
</script>";
|
||||||
|
$genericErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
/* This view adds register view */
|
|
||||||
include("../views/register-view.php");
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|||||||
57
website/public/resetpassword.php
Normal file
57
website/public/resetpassword.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
include_once("../queries/connect.php");
|
||||||
|
include_once("../views/messagepage.php");
|
||||||
|
include_once("../views/resetpassword.php");
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||||
|
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||||
|
if (verifyLink($_GET["u"], $_GET["h"])) {
|
||||||
|
messagePage(passwordResetFields());
|
||||||
|
} else {
|
||||||
|
messagePage("Wachtwoorden komen niet overeen.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige links");
|
||||||
|
}
|
||||||
|
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
if (verifyLink($_POST["u"], $_POST["h"])) {
|
||||||
|
if ($_POST["password"] == $_POST["password-confirm"]) {
|
||||||
|
changePassword();
|
||||||
|
messagePage("Wachtwoord gewijzigd");
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige link");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
messagePage("Ongeldige link");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function changePassword() {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`password` = :password
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindValue(":password", password_hash($_POST["password"], PASSWORD_DEFAULT));
|
||||||
|
$stmt->bindParam(":userID", $_POST["u"]);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyLink(int $userID, string $hash) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`password`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->execute();
|
||||||
|
$password = $stmt->fetch()["password"];
|
||||||
|
return password_verify($password, $hash);
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
<style>
|
<style>
|
||||||
@import url("styles/search.css");
|
@import url("styles/search.css");
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script src="js/search.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -43,6 +44,16 @@ header div {
|
|||||||
width: 64px;
|
width: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#own-profile-picture {
|
#own-profile-picture, #open-notifications {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#open-notifications {
|
||||||
|
padding: 5px 20px 5px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1080px) {
|
||||||
|
#header-logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
a.button {
|
a.button {
|
||||||
background-color: #C8CABD;
|
background-color: #C8CABD;
|
||||||
border-radius: 10px;
|
border-radius: 5px;
|
||||||
color: black;
|
color: black;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 50%;
|
padding: 8px 20px;
|
||||||
margin: 8px 0;
|
|
||||||
padding: 14px 20px;
|
|
||||||
width: 25%;
|
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 16px;
|
font-size: 22px;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Body */
|
/* Body */
|
||||||
body {
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #C8CABD;
|
background-color: #FBC02D;
|
||||||
/*background-image: url(http://play.pokemonshowdown.com/fx/client-bg-shaymin.jpg);
|
/*background-image: url(http://play.pokemonshowdown.com/fx/client-bg-shaymin.jpg);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-attachment: fixed;*/
|
background-attachment: fixed;*/
|
||||||
@@ -24,34 +23,20 @@ body {
|
|||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The Close Button */
|
|
||||||
.close {
|
|
||||||
/* Position it in the top right corner outside of the modal */
|
|
||||||
color: white;
|
|
||||||
font-size: 100px;
|
|
||||||
font-weight: bold;
|
|
||||||
position: absolute;
|
|
||||||
right: 25px;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Close button on hover */
|
|
||||||
.close:hover,
|
|
||||||
.close:focus {
|
|
||||||
color: red;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* inlogform */
|
/* inlogform */
|
||||||
form {
|
form {
|
||||||
/*background-color: #a87a87;*/
|
/*background-color: #a87a87;*/
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
height: 70%;
|
height: 85%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 70%;
|
width: 600px;
|
||||||
overflow-y:auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* inlog titel */
|
/* inlog titel */
|
||||||
h1 {
|
h1 {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
@@ -61,87 +46,76 @@ 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 {
|
||||||
|
padding: 8px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-color: #C8CABD;
|
border-color: #C8CABD;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 60%;
|
height: 60%;
|
||||||
padding: 8px 20px;
|
|
||||||
margin: 4px 0;
|
|
||||||
width: 70%;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
|
||||||
border: 0px;
|
|
||||||
border-bottom: 4px solid lightgray;
|
|
||||||
border-radius: 0px;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
button[type=submit] {
|
|
||||||
background-color: #C8CABD;
|
|
||||||
color: black ;
|
|
||||||
cursor: pointer;
|
|
||||||
font-family: Arial;
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
width: 50%;
|
padding: 8px 10px;
|
||||||
|
margin: 4px 0;
|
||||||
|
width: 55%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.middle{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: #C8CABD;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: black;
|
||||||
|
cursor: pointer;
|
||||||
|
height: 50%;
|
||||||
|
padding: 8px 20px;
|
||||||
|
margin: 5px;
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 22px;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: red;
|
color: red;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left-arrow {
|
|
||||||
display: inline-block;
|
|
||||||
position: relative;
|
|
||||||
background-color: #C8CABD;
|
|
||||||
height: 30px;
|
|
||||||
width: 90px;
|
|
||||||
padding: 3px 3px 3px 0px;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 0px 10px 10px 0px;
|
|
||||||
font-size: 24px;
|
|
||||||
|
|
||||||
}
|
|
||||||
.left-arrow:after {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
right: 100%;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
border-top: 15px solid transparent;
|
|
||||||
border-right: 20px solid #C8CABD;
|
|
||||||
border-bottom: 15px solid transparent;
|
|
||||||
border-left: 0px solid transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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:25px;
|
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;
|
||||||
}
|
}
|
||||||
@@ -159,24 +133,89 @@ label {
|
|||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
background-attachment: fixed;*/
|
background-attachment: fixed;*/
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
height: 500px;
|
height: 400px;
|
||||||
margin: 34px auto;
|
margin: 16px auto;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
width: 50%;
|
width: 600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.platform {
|
select{
|
||||||
width: 40%;
|
width: 18%;
|
||||||
margin: 34px auto;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@-webkit-keyframes animatezoom {
|
|
||||||
from {-webkit-transform: scale(0)}
|
|
||||||
to {-webkit-transform: scale(1)}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The Modal (background) */
|
||||||
|
.modal {
|
||||||
|
display: none; /* Hidden by default */
|
||||||
|
position: fixed; /* Stay in place */
|
||||||
|
z-index: 1; /* Sit on top */
|
||||||
|
padding-top: 30px; /* Location of the box */
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%; /* Full width */
|
||||||
|
height: 100%; /* Full height */
|
||||||
|
overflow: hidden; /* Enable scroll if needed */
|
||||||
|
background-color: rgb(0,0,0); /* Fallback color */
|
||||||
|
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Content */
|
||||||
|
.modal-content {
|
||||||
|
position: relative;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
margin: auto;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid #888;
|
||||||
|
width: 600px;
|
||||||
|
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
||||||
|
-webkit-animation-name: animatetop;
|
||||||
|
-webkit-animation-duration: 0.4s;
|
||||||
|
animation-name: animatetop;
|
||||||
|
animation-duration: 0.4s
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add Animation */
|
||||||
|
@-webkit-keyframes animatetop {
|
||||||
|
from {top:-300px; opacity:0}
|
||||||
|
to {top:0; opacity:1}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes animatetop {
|
||||||
|
from {top:-300px; opacity:0}
|
||||||
|
to {top:0; opacity:1}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The Close Button */
|
||||||
|
.close {
|
||||||
|
color: white;
|
||||||
|
float: right;
|
||||||
|
font-size: 36px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close:hover,
|
||||||
|
.close:focus {
|
||||||
|
color: #000;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
padding: 4px 16px;
|
||||||
|
background-color: #FBC02D;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
padding: 2px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
background-color: #FBC02D;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|||||||
@@ -97,16 +97,16 @@ p {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.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);
|
||||||
}
|
}
|
||||||
@@ -175,6 +175,19 @@ textarea:focus, input:focus, select:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* All buttons */
|
/* All buttons */
|
||||||
|
button.red {
|
||||||
|
background-color: firebrick;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.green {
|
||||||
|
background-color: forestgreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.gray{
|
||||||
|
background-color: #FFF;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
button,
|
button,
|
||||||
input[type="submit"],
|
input[type="submit"],
|
||||||
input[type="reset"] {
|
input[type="reset"] {
|
||||||
@@ -215,6 +228,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 {
|
||||||
@@ -222,6 +236,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 {
|
||||||
@@ -243,16 +258,20 @@ div[data-title]:hover:after {
|
|||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.friend {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.friend-item, .group-item {
|
.friend-item, .group-item {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition-duration: 250ms;
|
transition-duration: 250ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.friend-item button, .group-item button {
|
||||||
|
background: none;
|
||||||
|
color: inherit;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
.friend-item:hover, .group-item:hover {
|
.friend-item:hover, .group-item:hover {
|
||||||
background: #FBC02D;
|
background: #FBC02D;
|
||||||
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);
|
||||||
@@ -262,3 +281,26 @@ 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 {
|
||||||
|
font-size: 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;
|
||||||
@@ -34,15 +34,6 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu button {
|
|
||||||
background: none;
|
|
||||||
color: inherit;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 0;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#notification-center {
|
#notification-center {
|
||||||
left: auto;
|
left: auto;
|
||||||
width: 236px;
|
width: 236px;
|
||||||
@@ -64,3 +55,49 @@
|
|||||||
#quick-links i:hover {
|
#quick-links i:hover {
|
||||||
color: #FBC02D;
|
color: #FBC02D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notification-options {
|
||||||
|
width: 100%;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-options button {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 5px 20px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accept-notification:hover {
|
||||||
|
color: #4CAF50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deny-notification:hover {
|
||||||
|
color: firebrick;
|
||||||
|
}
|
||||||
|
|
||||||
|
.friend-item:hover .notification-options {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu button {
|
||||||
|
background: none;
|
||||||
|
color: inherit;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
28
website/public/styles/message-page.css
Normal file
28
website/public/styles/message-page.css
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
body {
|
||||||
|
background-color: #FBC02D;
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-change {
|
||||||
|
height: 100%;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-logo {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-box {
|
||||||
|
margin: 30px auto auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.top-logo img {
|
||||||
|
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);
|
||||||
|
}
|
||||||
86
website/public/styles/post-popup.css
Normal file
86
website/public/styles/post-popup.css
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/* modal based on: http://www.w3schools.com/howto/howto_css_modals.asp */
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 80px;
|
||||||
|
left: 256px;
|
||||||
|
width: calc(100% - 256px); /* Full width */
|
||||||
|
height: calc(100% - 80px); /* Full height */
|
||||||
|
background-color: rgb(0,0,0); /* Fallback color */
|
||||||
|
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Content/Box */
|
||||||
|
.modal-content {
|
||||||
|
margin: 5% auto;
|
||||||
|
width: 70%; /* Could be more or less, depending on screen size */
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close {
|
||||||
|
color: #aaa;
|
||||||
|
float: right;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close:hover,
|
||||||
|
.modal-close:focus {
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content img {
|
||||||
|
max-height: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-header h4 {
|
||||||
|
font-size: 20pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content {
|
||||||
|
margin: 30px auto;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentfield {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentfield textarea {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment {
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-top: 1px solid #4CAF50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentinfo {
|
||||||
|
font-size: 10pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentcontent {
|
||||||
|
margin: 5px auto;
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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: #4CAF50 solid 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,8 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post .post-date {
|
|
||||||
float: right;
|
|
||||||
color: #aaaaaa;
|
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile-button {
|
|
||||||
float: right;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
background-color: #4CAF50;
|
|
||||||
color: #FFFFFF;
|
|
||||||
transition-duration: 250ms;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile-button:hover {
|
|
||||||
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
|
|
||||||
}
|
|
||||||
@@ -25,5 +25,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
li.search-item:hover{
|
li.search-item:hover{
|
||||||
background-color: #EEE;
|
background-color: #FBC02D;
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
}
|
||||||
@@ -1,20 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Function for checking inputfields
|
* Function for checking inputfields
|
||||||
* @param variable $variable Give name of the inputfield.
|
* @param String $variable Give name of the inputfield.
|
||||||
* @param string $option Give the name of the option.
|
* @param String $option Give the name of the option.
|
||||||
* @return sets correct to false and gives value to error message if it doesn't pass the checks.
|
* @return sets correct to false and gives value to error message if it doesn't pass the checks.
|
||||||
*/
|
*/
|
||||||
function checkInputChoice($variable, $option){
|
function checkInputChoice($variable, $option){
|
||||||
if (empty($_POST[$variable])) {
|
|
||||||
$GLOBALS[$variable . "Err"] = "Verplicht!";
|
|
||||||
$GLOBALS["correct"] = false;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$GLOBALS[$variable] = test_input($_POST[$variable]);
|
|
||||||
switch ($option) {
|
switch ($option) {
|
||||||
case "lettersAndSpace":
|
case "lettersAndSpaces";
|
||||||
checkonly($variable);
|
checkName($variable);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "bday";
|
||||||
|
validateBday($variable);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "username";
|
case "username";
|
||||||
@@ -31,67 +29,128 @@ function checkInputChoice($variable, $option){
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks for only letters and spaces. */
|
/* Checks for only letters and spaces. */
|
||||||
function checkOnly($variable){
|
function checkName($variable){
|
||||||
if (!preg_match("/^[a-zA-Z ]*$/",$GLOBALS[$variable])) {
|
if (empty($variable)) {
|
||||||
$GLOBALS[$variable . "Err"] = "Alleen letters en spaties zijn toegestaan!";
|
throw new lettersAndSpacesException("Verplicht!");
|
||||||
$correct = false;
|
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
|
||||||
|
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Checks for bday */
|
||||||
|
function validateBday($variable){
|
||||||
|
if (empty($variable)) {
|
||||||
|
throw new bdayException("Verplicht!");
|
||||||
|
} else {
|
||||||
|
if (!(validateDate($variable, "Y-m-d"))) {
|
||||||
|
throw new bdayException("Geen geldige datum");
|
||||||
|
} else {
|
||||||
|
$dateNow = date("Y-m-d");
|
||||||
|
if ($dateNow < $variable) {
|
||||||
|
throw new bdayException("Geen geldige datum!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checks for date
|
||||||
|
function validateDate($date, $format)
|
||||||
|
{
|
||||||
|
$d = DateTime::createFromFormat($format, $date);
|
||||||
|
return $d && $d->format($format) == $date;
|
||||||
|
}
|
||||||
|
|
||||||
/* checks if username exist and if its longer than 6 characters. */
|
/* checks if username exist and if its longer than 6 characters. */
|
||||||
function username($variable){
|
function username($variable){
|
||||||
if (strlen($GLOBALS[$variable]) < 6) {
|
if (empty($variable)) {
|
||||||
$GLOBALS[$variable . "Err"] = "Gebruikersnaam moet minstens 6 karakters bevatten";
|
throw new usernameException("Verplicht!");
|
||||||
$correct = false;
|
} else if (strlen($variable) < 6) {
|
||||||
|
throw new usernameException("Moet minstens 6 karakters bevatten");
|
||||||
} else if (getExistingUsername() == 1) {
|
} else if (getExistingUsername() == 1) {
|
||||||
$GLOBALS[$variable . "Err"] = "Gebruikersnaam bestaat al";
|
throw new usernameException("Gebruikersnaam bestaal al");
|
||||||
$correct = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checks if an input is longer that 8 characters. */
|
/* checks if an input is longer that 8 characters. */
|
||||||
function longerEight($variable){
|
function longerEight($variable){
|
||||||
if (strlen($GLOBALS[$variable]) < 8) {
|
if (empty($variable)) {
|
||||||
$GLOBALS[$variable . "Err"] = "Moet minstens 8 karakters bevatten";
|
throw new passwordException("Verplicht!");
|
||||||
$correct = false;
|
} else if (strlen($variable) < 8) {
|
||||||
|
throw new passwordException("Moet minstens 8 karakters bevatten");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checks if an input is a valid email. */
|
/* checks if an input is a valid email. */
|
||||||
function validateEmail($variable){
|
function validateEmail($variable){
|
||||||
if (!filter_var($GLOBALS[$variable], FILTER_VALIDATE_EMAIL)) {
|
if (empty($variable)) {
|
||||||
$GLOBALS[$variable . "Err"] = "Geldige email invullen!";
|
throw new emailException("Verplicht!");
|
||||||
$correct = false;
|
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
throw new emailException("Geldige email invullen");
|
||||||
} else if (getExistingEmail() == 1){
|
} else if (getExistingEmail() == 1){
|
||||||
$GLOBALS[$variable . "Err"] = "Email bestaat al";
|
throw new emailException("Email bestaal al!");
|
||||||
$correct = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function matchEmail(){
|
||||||
|
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
|
||||||
|
throw new confirmEmailException("Emails matchen niet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* checks if an input is a valid email. */
|
||||||
|
function resetEmail($variable){
|
||||||
|
if (empty($variable)) {
|
||||||
|
throw new emailException("Verplicht!");
|
||||||
|
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
throw new emailException("Geldige email invullen");
|
||||||
|
} else if (getResetEmail() == 0){
|
||||||
|
throw new emailException("Email bestaat niet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* checks if two passwords matches. */
|
/* checks if two passwords matches. */
|
||||||
function matchPassword(){
|
function matchPassword(){
|
||||||
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
||||||
$GLOBALS["confirmpasswordErr"] = "Wachtwoorden matchen niet";
|
throw new confirmPasswordException("Wachtwoorden matchen niet!");
|
||||||
$GLOBALS["correct"] = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if everything is filled in correctly
|
/* Checks if captcha is correctly filled in */
|
||||||
function registerCheck(){
|
function checkCaptcha($captcha){
|
||||||
if ($GLOBALS["correct"] == false){
|
if(!$captcha){
|
||||||
$GLOBALS["genericErr"] = "Bepaalde velden zijn verkeerd of niet ingevuld!";
|
throw new captchaException("Captcha moet ingevuld worde!");
|
||||||
|
} else {
|
||||||
|
$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) {
|
||||||
|
throw new captchaException("Je bent een spammer!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get ip adres */
|
||||||
|
function getIp(){
|
||||||
|
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||||
|
$GLOBALS["ip"] = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
|
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||||
|
$GLOBALS["ip"] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
} else {
|
||||||
|
$GLOBALS["ip"] = $_SERVER['REMOTE_ADDR'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Checks if everything is filled in correctly */
|
||||||
|
function registerCheck($status){
|
||||||
|
if ($status == false){
|
||||||
|
throw new registerException("Bepaalde velden zijn verkeerd of niet ingevuld");
|
||||||
} else {
|
} else {
|
||||||
registerAccount();
|
registerAccount();
|
||||||
header("location: login.php");
|
header("location: login.php");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,4 +161,77 @@ function test_input($data) {
|
|||||||
$data = htmlspecialchars($data);
|
$data = htmlspecialchars($data);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class lettersAndSpacesException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class bdayException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class usernameException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class passwordException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class confirmPasswordException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class emailException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class confirmEmailException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class captchaException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class registerException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
42
website/queries/emailconfirm.php
Normal file
42
website/queries/emailconfirm.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function sendConfirmEmailUsername(string $username) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`userID`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`username` = :username
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":username", $username);
|
||||||
|
$stmt->execute();
|
||||||
|
$userID = $stmt->fetch()["username"];
|
||||||
|
sendConfirmEmail($userID);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendConfirmEmail(int $userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`email`,
|
||||||
|
`fname`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->execute();
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
$email = $user["email"];
|
||||||
|
$fname = $user["fname"];
|
||||||
|
$hash = password_hash($email, PASSWORD_DEFAULT);
|
||||||
|
$confirmLink = "https://myhyvesbookplus.nl/emailconfirm.php?u=$userID&h=$hash";
|
||||||
|
|
||||||
|
$subject = "Bevestig uw emailadres";
|
||||||
|
$body = "Hallo $fname,\r\n\r\nKlik op de onderstaande link om uw emailadres te bevestigen.\r\n\r\n$confirmLink\r\n\r\nGroeten MyHyvesbook+";
|
||||||
|
$header = "From: MyHyvesbook+ <noreply@myhyvesbookplus.nl>";
|
||||||
|
mail($email, $subject, $body, $header);
|
||||||
|
}
|
||||||
@@ -1,16 +1,64 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectAllFriends($userID) {
|
require_once ("connect.php");
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
|
||||||
|
function selectFriends($userID) {
|
||||||
|
return selectLimitedFriends($userID, 9999);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectLimitedFriends($userID, $limit) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
`onlinestatus`,
|
`role`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
INNER JOIN
|
||||||
|
`friendship`
|
||||||
|
WHERE
|
||||||
|
(`friendship`.`user1ID` = :userID AND
|
||||||
|
`friendship`.`user2ID` = `user`.`userID` OR
|
||||||
|
`friendship`.`user2ID` = :userID AND
|
||||||
|
`friendship`.`user1ID` = `user`.`userID`) AND
|
||||||
|
`user`.`role` != 'banned' AND
|
||||||
|
`friendship`.`status` = 'confirmed'
|
||||||
|
ORDER BY
|
||||||
|
CASE
|
||||||
|
WHEN `friendship`.`user2ID` = `user`.`userID` THEN `friendship`.`chatLastVisted1`
|
||||||
|
WHEN `friendship`.`user1ID` = `user`.`userID` THEN `friendship`.`chatLastVisted2`
|
||||||
|
END
|
||||||
|
DESC
|
||||||
|
LIMIT :limitCount
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':limitCount', $limit, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
return json_encode($stmt->fetchAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function selectAllFriends($userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`userID`,
|
||||||
|
`username`,
|
||||||
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||||
|
IFNULL(
|
||||||
|
`profilepicture`,
|
||||||
|
'../img/avatar-standard.png'
|
||||||
|
) AS profilepicture,
|
||||||
|
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`
|
||||||
@@ -33,16 +81,19 @@ function selectAllFriends($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectAllFriendRequests() {
|
function selectAllFriendRequests() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
) 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`
|
||||||
@@ -54,7 +105,7 @@ function selectAllFriendRequests() {
|
|||||||
`friendship`.`user2ID` = `user`.`userID` OR
|
`friendship`.`user2ID` = `user`.`userID` OR
|
||||||
`friendship`.`user2ID` = :userID AND
|
`friendship`.`user2ID` = :userID AND
|
||||||
`friendship`.`user1ID` = `user`.`userID`) AND
|
`friendship`.`user1ID` = `user`.`userID`) AND
|
||||||
`user`.`role` != 5 AND
|
`user`.`role` != 'banned' AND
|
||||||
`friendship`.`status` = 'requested'
|
`friendship`.`status` = 'requested'
|
||||||
");
|
");
|
||||||
|
|
||||||
@@ -64,9 +115,93 @@ function selectAllFriendRequests() {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFriendshipStatus($userID) {
|
||||||
|
# -2: Query failed.
|
||||||
|
# -1: user1 and 2 are the same user
|
||||||
|
# 0 : no record found
|
||||||
|
# 1 : confirmed
|
||||||
|
# 2 : user1 sent request (you)
|
||||||
|
# 3 : user2 sent request (other)
|
||||||
|
if($_SESSION["userID"] == $userID) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
CASE `status` IS NULL
|
||||||
|
WHEN TRUE THEN 0
|
||||||
|
WHEN FALSE THEN
|
||||||
|
CASE `status` = 'confirmed'
|
||||||
|
WHEN TRUE THEN
|
||||||
|
1
|
||||||
|
WHEN FALSE THEN
|
||||||
|
CASE `user1ID` = :me AND `user2ID` = :other
|
||||||
|
WHEN TRUE THEN
|
||||||
|
2
|
||||||
|
WHEN FALSE THEN
|
||||||
|
3
|
||||||
|
END
|
||||||
|
END
|
||||||
|
END AS `friend_state`
|
||||||
|
FROM
|
||||||
|
`friendship`
|
||||||
|
WHERE
|
||||||
|
`user1ID` = :other AND `user2ID` = :me OR
|
||||||
|
`user1ID` = :me AND `user2ID` = :other
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':me', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':other', $userID, PDO::PARAM_INT);
|
||||||
|
if(!$stmt->execute()) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
return intval($stmt->fetch()["friend_state"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestFriendship($userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
INSERT INTO `friendship` (user1ID, user2ID)
|
||||||
|
VALUES (:user1, :user2)
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':user1', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':user2', $userID, PDO::PARAM_INT);
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeFriendship($userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
DELETE FROM `friendship`
|
||||||
|
WHERE
|
||||||
|
`user1ID` = :user1 AND
|
||||||
|
`user2ID` = :user2 OR
|
||||||
|
`user1ID` = :user2 AND
|
||||||
|
`user2ID` = :user1
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':user1', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':user2', $userID, PDO::PARAM_INT);
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function acceptFriendship($userID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
UPDATE `friendship`
|
||||||
|
SET `status`='confirmed'
|
||||||
|
WHERE
|
||||||
|
`user1ID` = :user1 AND
|
||||||
|
`user2ID` = :user2
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':user1', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':user2', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
function setLastVisited($friend) {
|
function setLastVisited($friend) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`friendship`
|
`friendship`
|
||||||
SET `friendship`.chatLastVisted1=(
|
SET `friendship`.chatLastVisted1=(
|
||||||
@@ -94,3 +229,49 @@ function setLastVisited($friend) {
|
|||||||
|
|
||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function searchSomeFriends($n, $m, $search) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`userID`,
|
||||||
|
`username`,
|
||||||
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||||
|
IFNULL(
|
||||||
|
`profilepicture`,
|
||||||
|
'../img/avatar-standard.png'
|
||||||
|
) AS profilepicture,
|
||||||
|
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
|
||||||
|
WHEN TRUE THEN 'online'
|
||||||
|
WHEN FALSE THEN 'offline'
|
||||||
|
END AS `onlinestatus`,
|
||||||
|
`role`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
INNER JOIN
|
||||||
|
`friendship`
|
||||||
|
WHERE
|
||||||
|
((`friendship`.`user1ID` = :userID AND
|
||||||
|
`friendship`.`user2ID` = `user`.`userID` OR
|
||||||
|
`friendship`.`user2ID` = :userID AND
|
||||||
|
`friendship`.`user1ID` = `user`.`userID`) AND
|
||||||
|
`user`.`role` != 'banned' AND
|
||||||
|
`friendship`.`status` = 'confirmed') AND
|
||||||
|
(`username` LIKE :keyword OR
|
||||||
|
`fname` LIKE :keyword OR
|
||||||
|
`lname` LIKE :keyword)
|
||||||
|
ORDER BY
|
||||||
|
`fname`,
|
||||||
|
`lname`,
|
||||||
|
`username`
|
||||||
|
LIMIT
|
||||||
|
:n, :m
|
||||||
|
");
|
||||||
|
|
||||||
|
$search = "%$search%";
|
||||||
|
$stmt->bindParam(':keyword', $search);
|
||||||
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
return json_encode($stmt->fetchAll());
|
||||||
|
}
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectAllGroupsFromUser($userID) {
|
function selectAllGroupsFromUser($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
selectLimitedGroupsFromUser($userID, 9999);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectLimitedGroupsFromUser($userID, $limit) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`
|
`group_page`.`picture`
|
||||||
@@ -13,10 +17,40 @@ function selectAllGroupsFromUser($userID) {
|
|||||||
`group_member`.`userID` = :userID AND
|
`group_member`.`userID` = :userID AND
|
||||||
`group_member`.`groupID` = `group_page`.`groupID` AND
|
`group_member`.`groupID` = `group_page`.`groupID` AND
|
||||||
`group_page`.`status` != 'hidden'
|
`group_page`.`status` != 'hidden'
|
||||||
|
LIMIT :limitCount
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':limitCount', $limit, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return $stmt;
|
return json_encode($stmt->fetchAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchSomeOwnGroups($n, $m, $search) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`group_page`.`name`,
|
||||||
|
`group_page`.`picture`
|
||||||
|
FROM
|
||||||
|
`group_page`
|
||||||
|
INNER JOIN
|
||||||
|
`group_member`
|
||||||
|
WHERE
|
||||||
|
`group_member`.`userID` = :userID AND
|
||||||
|
`group_member`.`groupID` = `group_page`.`groupID` AND
|
||||||
|
`group_page`.`status` != 'hidden' AND
|
||||||
|
`name` LIKE :keyword
|
||||||
|
LIMIT
|
||||||
|
:n, :m
|
||||||
|
");
|
||||||
|
|
||||||
|
$search = "%$search%";
|
||||||
|
$stmt->bindParam(':keyword', $search);
|
||||||
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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`
|
||||||
@@ -192,11 +278,11 @@ function searchSomeGroups($n, $m, $search) {
|
|||||||
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt;
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
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,17 +1,64 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getUser() {
|
function getUser() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`password`,
|
`password`,
|
||||||
`userID`
|
`userID`,
|
||||||
|
`role`
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validateLogin($username, $password){
|
||||||
|
// Empty username or password field
|
||||||
|
if (empty($username) || empty($password)) {
|
||||||
|
throw new loginException("Inloggegevens zijn niet ingevuld");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$psw = test_input($password);
|
||||||
|
$hash = getUser()["password"];
|
||||||
|
$userID = getUser()["userID"];
|
||||||
|
$role = getUser()["role"];
|
||||||
|
|
||||||
|
// If there's an account, go to the profile page
|
||||||
|
if(password_verify($psw, $hash)) {
|
||||||
|
if ($role == "banned"){
|
||||||
|
echo "<script>
|
||||||
|
window.onload=bannedAlert();
|
||||||
|
</script>";
|
||||||
|
} else if ($role == "unconfirmed"){
|
||||||
|
sendConfirmEmail(getUser()["userID"]);
|
||||||
|
echo "<script>
|
||||||
|
window.onload=emailNotConfirmed();
|
||||||
|
</script>";
|
||||||
|
} else {
|
||||||
|
$_SESSION["userID"] = $userID;
|
||||||
|
// if($_POST[rememberMe] == 1){
|
||||||
|
// ini_set("session.gc_maxlifetime", "10");
|
||||||
|
// }
|
||||||
|
header("location: profile.php");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new loginException("Inloggevens zijn niet correct");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class loginException extends Exception
|
||||||
|
{
|
||||||
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
function nicetime($date) {
|
function nicetime($date) {
|
||||||
if(empty($date)) {
|
if(empty($date)) {
|
||||||
return "No date provided";
|
return "No date provided";
|
||||||
}
|
}
|
||||||
|
|
||||||
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
|
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
|
||||||
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
|
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
|
||||||
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
|
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
|
||||||
|
|
||||||
$now = time();
|
$now = time();
|
||||||
$unix_date = strtotime($date);
|
$unix_date = strtotime($date);
|
||||||
|
|
||||||
if(empty($unix_date)) {
|
if(empty($unix_date)) {
|
||||||
return "Bad date";
|
return "Bad date";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($now > $unix_date) {
|
if($now > $unix_date) {
|
||||||
$difference = $now - $unix_date;
|
$difference = $now - $unix_date;
|
||||||
$tense = "geleden";
|
$tense = "geleden";
|
||||||
} else {
|
} else {
|
||||||
$difference = $unix_date - $now;
|
$difference = $unix_date - $now;
|
||||||
$tense = "vanaf nu";
|
$tense = "vanaf nu";
|
||||||
}
|
}
|
||||||
|
|
||||||
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
|
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
|
||||||
$difference /= $lengths[$i];
|
$difference /= $lengths[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
$difference = round($difference);
|
$difference = round($difference);
|
||||||
|
|
||||||
if($difference != 1) {
|
if($difference != 1) {
|
||||||
$period = $multiple_periods[$i];
|
$period = $multiple_periods[$i];
|
||||||
} else {
|
} else {
|
||||||
$period = $single_periods[$i];
|
$period = $single_periods[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return "$difference $period $tense";
|
return "$difference $period $tense";
|
||||||
}
|
}
|
||||||
156
website/queries/picture.php
Normal file
156
website/queries/picture.php
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
<?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 = scalePicture($tmpImg);
|
||||||
|
$group ? removeOldGroupAvatar($_POST["groupID"]) : removeOldUserAvatar();
|
||||||
|
imagepng($scaledImg, $publicDir . $relativePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
$group ? setGroupAvatarToDatabase("../" . $relativePath, $_POST["groupID"]) : setUserAvatarToDatabase("../" . $relativePath);
|
||||||
|
throw new HappyAlert("Profielfoto veranderd.");
|
||||||
|
}
|
||||||
|
|
||||||
|
function uploadPostPicture($userID) {
|
||||||
|
$publicDir = "/var/www/html/public/";
|
||||||
|
$tmpImg = $_FILES["picture"]["tmp_name"];
|
||||||
|
$photoDir = "uploads/post/";
|
||||||
|
if (getimagesize($tmpImg)["mime"] == "image/gif") {
|
||||||
|
if ($_FILES["picture"]["size"] > 4000000) {
|
||||||
|
throw new AngryAlert("Bestand is te groot, maximaal 4MB toegestaan.");
|
||||||
|
}
|
||||||
|
$relativePath = $photoDir . date_format(new DateTime(), "YmdHis") . "_" . $userID . ".gif";
|
||||||
|
move_uploaded_file($tmpImg, $publicDir . $relativePath);
|
||||||
|
} else {
|
||||||
|
$relativePath = $photoDir . date_format(new DateTime(), "YmdHis") . "_" . $userID . ".png";
|
||||||
|
$scaledImg = scalePicture($tmpImg);
|
||||||
|
imagepng($scaledImg, $publicDir . $relativePath);
|
||||||
|
}
|
||||||
|
return $relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 scalePicture(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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
203
website/queries/post.php
Normal file
203
website/queries/post.php
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once("connect.php");
|
||||||
|
|
||||||
|
function selectAllPosts($userID, $groupID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`post`.`postID`,
|
||||||
|
`post`.`author`,
|
||||||
|
`title`,
|
||||||
|
CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
|
||||||
|
WHEN TRUE THEN
|
||||||
|
CONCAT(LEFT(`post`.`content`, 150), '...')
|
||||||
|
WHEN FALSE THEN
|
||||||
|
`post`.`content`
|
||||||
|
END
|
||||||
|
AS `content`,
|
||||||
|
`post`.`creationdate`,
|
||||||
|
COUNT(DISTINCT `commentID`) AS `comments`,
|
||||||
|
COUNT(DISTINCT `niet_slecht`.`postID`) AS `niet_slechts`
|
||||||
|
FROM
|
||||||
|
`post`
|
||||||
|
LEFT JOIN
|
||||||
|
`niet_slecht`
|
||||||
|
ON
|
||||||
|
`post`.`postID` = `niet_slecht`.`postID`
|
||||||
|
LEFT JOIN
|
||||||
|
`comment`
|
||||||
|
ON
|
||||||
|
`post`.`postID` = `comment`.`postID`
|
||||||
|
WHERE
|
||||||
|
`post`.`author` = :userID AND
|
||||||
|
`groupID` IS NULL OR
|
||||||
|
`groupID` = :groupID
|
||||||
|
GROUP BY
|
||||||
|
`post`.`postID`
|
||||||
|
ORDER BY
|
||||||
|
`post`.`creationdate` DESC
|
||||||
|
");
|
||||||
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':groupID', $groupID , PDO::PARAM_INT);
|
||||||
|
if(!$stmt->execute()) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
return $stmt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectPostById($postID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`user`.`fname`,
|
||||||
|
`user`.`lname`,
|
||||||
|
`user`.`username`,
|
||||||
|
`post`.`groupID`,
|
||||||
|
`post`.`title`,
|
||||||
|
`post`.`content`,
|
||||||
|
`post`.`creationdate`
|
||||||
|
FROM
|
||||||
|
`post`
|
||||||
|
INNER JOIN
|
||||||
|
`user`
|
||||||
|
ON
|
||||||
|
`post`.`author` = `user`. `userID`
|
||||||
|
WHERE
|
||||||
|
`post`.`postID` = :postID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':postID', $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectCommentsByPostId($postID) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`comment`.`commentID`,
|
||||||
|
`comment`.`postID`,
|
||||||
|
`comment`.`author`,
|
||||||
|
`comment`.`content`,
|
||||||
|
`comment`.`creationdate`,
|
||||||
|
`user`.`fname`,
|
||||||
|
`user`.`lname`,
|
||||||
|
`user`.`username`
|
||||||
|
FROM
|
||||||
|
`comment`
|
||||||
|
INNER JOIN
|
||||||
|
`user`
|
||||||
|
ON
|
||||||
|
`comment`.`author` = `user`.`userID`
|
||||||
|
WHERE
|
||||||
|
`comment`.`postID` = :postID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':postID', $postID);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makePost($userID, $title, $content, $groupID = null) {
|
||||||
|
$picturePath = null;
|
||||||
|
print_r($_FILES);
|
||||||
|
if (array_key_exists("picture", $_FILES)) {
|
||||||
|
$picturePath = uploadPostPicture($userID);
|
||||||
|
}
|
||||||
|
echo "Hallo!";
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
INSERT INTO
|
||||||
|
`post` (
|
||||||
|
`author`,
|
||||||
|
`groupID`,
|
||||||
|
`title`,
|
||||||
|
`content`,
|
||||||
|
`image`
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
:userID,
|
||||||
|
:groupID,
|
||||||
|
:title,
|
||||||
|
:content,
|
||||||
|
:image
|
||||||
|
)
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':userID', $userID);
|
||||||
|
$stmt->bindParam(':groupID', $groupID);
|
||||||
|
$stmt->bindParam(':title', $title);
|
||||||
|
$stmt->bindParam(':content', $content);
|
||||||
|
$stmt->bindParam(':image', $picturePath);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeComment($postID, $userID, $content) : int {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
INSERT INTO
|
||||||
|
`comment` (
|
||||||
|
`postID`,
|
||||||
|
`author`,
|
||||||
|
`content`
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
:postID,
|
||||||
|
:userID,
|
||||||
|
:content
|
||||||
|
)
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':postID', $postID);
|
||||||
|
$stmt->bindParam(':userID', $userID);
|
||||||
|
$stmt->bindParam(':content', $content);
|
||||||
|
$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,7 @@ function getOldChatMessages($user2ID) {
|
|||||||
`origin` = :user2 AND
|
`origin` = :user2 AND
|
||||||
`destination` = :user1
|
`destination` = :user1
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`messageID` ASC
|
`creationdate` ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":user1", $user1ID);
|
$stmt->bindParam(":user1", $user1ID);
|
||||||
@@ -23,10 +24,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 +53,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 +74,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,18 +84,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 `name`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
|
||||||
|
`user`.`userID`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/notbad.jpg'
|
'../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`,
|
||||||
@@ -92,15 +107,19 @@ function selectAllUnreadChat() {
|
|||||||
WHERE
|
WHERE
|
||||||
(`friendship`.user2ID = `private_message`.`origin` AND
|
(`friendship`.user2ID = `private_message`.`origin` AND
|
||||||
`friendship`.user1ID = `private_message`.`destination` AND
|
`friendship`.user1ID = `private_message`.`destination` AND
|
||||||
`friendship`.chatLastVisted1 < `private_message`.`creationdate` OR
|
(`friendship`.chatLastVisted1 < `private_message`.`creationdate` OR
|
||||||
|
`friendship`.chatLastVisted1 IS NULL) OR
|
||||||
`friendship`.user1ID = `private_message`.`origin` AND
|
`friendship`.user1ID = `private_message`.`origin` AND
|
||||||
`friendship`.user2ID = `private_message`.`destination` AND
|
`friendship`.user2ID = `private_message`.`destination` AND
|
||||||
`friendship`.chatLastVisted2 < `private_message`.`creationdate`) AND
|
(`friendship`.chatLastVisted2 < `private_message`.`creationdate` OR
|
||||||
|
`friendship`.chatLastVisted2 IS NULL)) AND
|
||||||
`private_message`.`origin` = `user`.`userID` AND
|
`private_message`.`origin` = `user`.`userID` AND
|
||||||
`private_message`.`destination` = :userID AND
|
`private_message`.`destination` = :userID AND
|
||||||
`user`.`role` != 'banned'
|
`user`.`role` != 'banned' AND
|
||||||
|
`friendship`.`status` = 'confirmed'
|
||||||
|
|
||||||
GROUP BY `user`.`userID`
|
GROUP BY `user`.`userID`
|
||||||
|
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $_SESSION["userID"]);
|
$stmt->bindParam(':userID', $_SESSION["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,30 @@ function getExistingEmail() {
|
|||||||
`email` LIKE :email
|
`email` LIKE :email
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":email", $_POST["email"]);
|
$stmt->bindValue(":email", test_input($_POST["email"]));
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getResetEmail() {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`email`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`email` LIKE :email
|
||||||
|
");
|
||||||
|
|
||||||
|
$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,
|
||||||
@@ -54,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";
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
54
website/queries/requestpassword.php
Normal file
54
website/queries/requestpassword.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
include_once "../queries/connect.php";
|
||||||
|
|
||||||
|
function sendPasswordRecovery(string $email) {
|
||||||
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`userID`,
|
||||||
|
`username`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`email` = :email
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":email", $email);
|
||||||
|
$stmt->execute();
|
||||||
|
if (!$stmt->rowCount()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$result = $stmt->fetch();
|
||||||
|
$userID = $result["userID"];
|
||||||
|
$username = $result["username"];
|
||||||
|
$hash = md5(random_int(0, 1000000));
|
||||||
|
$hashedHash = password_hash($hash, PASSWORD_DEFAULT);
|
||||||
|
setHashToDatabase($userID, $hash);
|
||||||
|
doSendPasswordRecovery($userID, $email, $username, $hashedHash);
|
||||||
|
} else {
|
||||||
|
// TODO: Be angry!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doSendPasswordRecovery(int $userID, string $email, string $username, string $hash) {
|
||||||
|
$resetLink = "https://myhyvesbookplus.nl/resetpassword.php?u=$userID&h=$hash";
|
||||||
|
|
||||||
|
$subject = "Reset uw wachtwoord";
|
||||||
|
$body = "Hallo $username,\r\n\r\nKlik op de onderstaande link om uw wachtwoord te resetten.\r\n\r\n$resetLink\r\n\r\nGroeten MyHyvesbook+";
|
||||||
|
$header = "From: MyHyvesbook+ <noreply@myhyvesbookplus.nl>";
|
||||||
|
mail($email, $subject, $body, $header);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHashToDatabase(int $userID, string $hash) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`password` = :hash
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":hash", $hash);
|
||||||
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->rowCount();
|
||||||
|
}
|
||||||
@@ -1,42 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
abstract class AlertMessage extends Exception {
|
include_once "../queries/emailconfirm.php";
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
include_once "../queries/picture.php";
|
||||||
{
|
include_once "../queries/alerts.php";
|
||||||
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`,
|
||||||
@@ -44,7 +16,9 @@ function getSettings() {
|
|||||||
`location`,
|
`location`,
|
||||||
`birthdate`,
|
`birthdate`,
|
||||||
`bio`,
|
`bio`,
|
||||||
`profilepicture`
|
`profilepicture`,
|
||||||
|
`showBday`,
|
||||||
|
`showEmail`
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
@@ -56,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`
|
||||||
@@ -71,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
|
||||||
@@ -80,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.");
|
||||||
@@ -108,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
|
||||||
@@ -132,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);
|
||||||
@@ -147,7 +153,7 @@ function changeEmail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function emailIsAvailableInDatabase($email) {
|
function emailIsAvailableInDatabase($email) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`
|
`email`
|
||||||
FROM
|
FROM
|
||||||
@@ -164,83 +170,24 @@ function emailIsAvailableInDatabase($email) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doChangeEmail($email) {
|
function doChangeEmail($email) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
`email` = :email
|
`email` = :email,
|
||||||
|
`role` = 'unconfirmed'
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
$stmt->bindParam(":email", $email);
|
$stmt->bindParam(":email", $email);
|
||||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
// return $stmt->rowCount();
|
|
||||||
|
|
||||||
if ($stmt->rowCount()) {
|
if ($stmt->rowCount()) {
|
||||||
|
sendConfirmEmail($_SESSION["userID"]);
|
||||||
|
session_destroy();
|
||||||
throw new HappyAlert("Emailadres is veranderd.");
|
throw new HappyAlert("Emailadres is veranderd.");
|
||||||
} else {
|
} else {
|
||||||
throw new AngryAlert();
|
throw new AngryAlert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAvatar() {
|
|
||||||
$profilePictureDir = "/var/www/html/public/";
|
|
||||||
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_avatar.png";
|
|
||||||
|
|
||||||
checkAvatarSize($_FILES["pp"]["tmp_name"]);
|
|
||||||
$scaledImg = scaleAvatar($_FILES["pp"]["tmp_name"]);
|
|
||||||
removeOldAvatar();
|
|
||||||
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,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("connect.php");
|
require_once ("connect.php");
|
||||||
|
|
||||||
function getUserID($username) {
|
function getUserID($username) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`
|
`userID`
|
||||||
FROM
|
FROM
|
||||||
@@ -17,33 +17,75 @@ function getUserID($username) {
|
|||||||
return $stmt->fetch()["userID"];
|
return $stmt->fetch()["userID"];
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectUser($userID) {
|
function getUsername($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`username`,
|
`username`
|
||||||
IFNULL(
|
|
||||||
`profilepicture`,
|
|
||||||
'../img/avatar-standard.png'
|
|
||||||
) AS profilepicture,
|
|
||||||
`bio`,
|
|
||||||
`role`,
|
|
||||||
`onlinestatus`,
|
|
||||||
`loggedin`,
|
|
||||||
`fname`,
|
|
||||||
`lname`
|
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_STR);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->fetch()["username"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectUser($me, $other) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
`userID`,
|
||||||
|
`username`,
|
||||||
|
`birthdate`,
|
||||||
|
`location`,
|
||||||
|
IFNULL(
|
||||||
|
`profilepicture`,
|
||||||
|
'../img/avatar-standard.png'
|
||||||
|
) AS profilepicture,
|
||||||
|
`bio`,
|
||||||
|
`user`.`creationdate`,
|
||||||
|
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
|
||||||
|
WHEN TRUE THEN 'online'
|
||||||
|
WHEN FALSE THEN 'offline'
|
||||||
|
END AS `onlinestatus`,
|
||||||
|
`role`,
|
||||||
|
`fname`,
|
||||||
|
`lname`,
|
||||||
|
CASE `status` IS NULL
|
||||||
|
WHEN TRUE THEN 0
|
||||||
|
WHEN FALSE THEN
|
||||||
|
CASE `status` = 'confirmed'
|
||||||
|
WHEN TRUE THEN
|
||||||
|
1
|
||||||
|
WHEN FALSE THEN
|
||||||
|
CASE `user1ID` = `userID` AND `user2ID` = :me
|
||||||
|
WHEN TRUE THEN
|
||||||
|
2
|
||||||
|
WHEN FALSE THEN
|
||||||
|
3
|
||||||
|
END
|
||||||
|
END
|
||||||
|
END AS `friend_status`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
LEFT JOIN
|
||||||
|
`friendship`
|
||||||
|
ON
|
||||||
|
`user1ID` = `userID` AND `user2ID` = :me OR
|
||||||
|
`user1ID` = :me AND `user2ID` = `userID`
|
||||||
|
WHERE
|
||||||
|
`user`.`userID` = :other
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':me', $me, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':other', $other, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectAllUserGroups($userID) {
|
function selectAllUserGroups($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -57,29 +99,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->execute();
|
|
||||||
return $stmt;
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectAllUserPosts($userID) {
|
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
|
||||||
SELECT
|
|
||||||
`postID`,
|
|
||||||
`author`,
|
|
||||||
`title`,
|
|
||||||
`content`,
|
|
||||||
`creationdate`
|
|
||||||
FROM
|
|
||||||
`post`
|
|
||||||
WHERE
|
|
||||||
`author` = :userID AND
|
|
||||||
`groupID` IS NULL
|
|
||||||
ORDER BY
|
|
||||||
`creationdate` DESC
|
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
@@ -88,7 +108,7 @@ function selectAllUserPosts($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select20UsersFromN($n) {
|
function select20UsersFromN($n) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -109,7 +129,7 @@ function select20UsersFromN($n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromN($n, $keyword) {
|
function search20UsersFromN($n, $keyword) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -133,7 +153,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`,
|
||||||
@@ -161,7 +181,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`,
|
||||||
@@ -190,7 +210,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
|
||||||
@@ -213,7 +233,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
|
||||||
@@ -229,7 +249,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
|
||||||
@@ -246,7 +266,7 @@ function changeMultipleUserStatusByID($ids, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectRandomNotFriendUser($userID) {
|
function selectRandomNotFriendUser($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`user`.`username`
|
`user`.`username`
|
||||||
FROM
|
FROM
|
||||||
@@ -273,20 +293,23 @@ function selectRandomNotFriendUser($userID) {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeUsers($n, $m, $search)
|
function searchSomeUsers($n, $m, $search) {
|
||||||
{
|
$stmt = prepareQuery("
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
|
||||||
SELECT
|
SELECT
|
||||||
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
`fname`,
|
'../img/avatar-standard.png'
|
||||||
`lname`
|
) AS profilepicture,
|
||||||
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`
|
||||||
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`,
|
||||||
@@ -299,12 +322,14 @@ function searchSomeUsers($n, $m, $search)
|
|||||||
$stmt->bindParam(':keyword', $search);
|
$stmt->bindParam(':keyword', $search);
|
||||||
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
|
||||||
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt;
|
|
||||||
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
function countSomeUsers($search) {
|
function countSomeUsers($search) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
@@ -324,3 +349,18 @@ 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;
|
||||||
|
}
|
||||||
48
website/views/adminpanel-grouptable.php
Normal file
48
website/views/adminpanel-grouptable.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<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'];
|
||||||
|
$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='API/adminChangeUser.php'
|
||||||
|
method='post'>
|
||||||
|
<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>
|
||||||
|
");
|
||||||
|
}
|
||||||
31
website/views/adminpanel-page.php
Normal file
31
website/views/adminpanel-page.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?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)";
|
||||||
|
?>
|
||||||
47
website/views/adminpanel-table.php
Normal file
47
website/views/adminpanel-table.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- 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'];
|
||||||
|
$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='API/adminChangeUser.php'
|
||||||
|
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>
|
||||||
|
");
|
||||||
|
}
|
||||||
@@ -1,14 +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;
|
$currentpage = 1;
|
||||||
$perpage = 20;
|
$perpage = 20;
|
||||||
$status = $groupstatus = array();
|
$status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner");
|
||||||
|
$groupstatus = array("hidden", "public", "membersonly");
|
||||||
$pagetype = "user";
|
$pagetype = "user";
|
||||||
|
|
||||||
if (isset($_GET["search"])) {
|
if (isset($_GET["search"])) {
|
||||||
@@ -29,31 +26,11 @@ if (isset($_GET["groupstatus"])) {
|
|||||||
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
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"])) {
|
if (isset($_POST["pageselect"])) {
|
||||||
$currentpage = $_POST["pageselect"];
|
$currentpage = $_POST["pageselect"];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$listn = ($currentpage-1) * $perpage;
|
|
||||||
$listm = $currentpage * $perpage;
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -61,7 +38,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:adminSearch();"
|
||||||
method="get">
|
method="get">
|
||||||
|
|
||||||
<div class="admin-searchbar">
|
<div class="admin-searchbar">
|
||||||
@@ -70,10 +48,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 +61,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 +93,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 +104,47 @@ $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">
|
<span 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>
|
</span>
|
||||||
<form
|
<form
|
||||||
id="admin-batchform"
|
id="admin-batchform"
|
||||||
action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
|
action="API/adminChangeUser.php"
|
||||||
method="post">
|
method="post">
|
||||||
|
|
||||||
<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>
|
</form>
|
||||||
|
<form
|
||||||
|
id="admin-groupbatchform"
|
||||||
|
action="API/adminChangeUser.php"
|
||||||
|
method="post">
|
||||||
|
|
||||||
|
<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>
|
</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. -->
|
<table class="usertable" id="usertable">
|
||||||
<?php
|
|
||||||
$listn = ($currentpage-1) * $perpage;
|
|
||||||
$listm = $currentpage * $perpage;
|
|
||||||
|
|
||||||
if ($pagetype == 'user') {
|
|
||||||
$q = searchSomeUsersByStatus($listn, $listm, $search, $status);
|
|
||||||
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
|
||||||
$userID = $user['userID'];
|
|
||||||
$username = $user['username'];
|
|
||||||
$role = $user['role'];
|
|
||||||
$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>
|
|
||||||
");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</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>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
// Set default values of a friend.
|
// Set default values of a friend.
|
||||||
$username = $friend["username"];
|
$username = $friend["username"];
|
||||||
|
$name = $friend["fullname"];
|
||||||
$userID = $friend["userID"];
|
$userID = $friend["userID"];
|
||||||
$pf = "img/avatar-standard.png";
|
$pf = "img/avatar-standard.png";
|
||||||
|
|
||||||
@@ -36,6 +37,10 @@
|
|||||||
</li>
|
</li>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
if (isset($_GET["username"]) && $_GET["username"] != "") {
|
||||||
|
$chatID = $_GET["username"];
|
||||||
|
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -69,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 class="modal">
|
||||||
|
<div class="modal-content platform">
|
||||||
|
<div class="modal-close">
|
||||||
|
×
|
||||||
|
</div>
|
||||||
|
<div class="modal-response" id="modal-response">
|
||||||
|
<span class="modal-default">Aan het laden...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
<title>MyHyvesbook+</title>
|
<title>MyHyvesbook+</title>
|
||||||
<!-- Add your javascript files here. -->
|
<!-- Add your javascript files here. -->
|
||||||
<script src="js/jquery.js"></script>
|
<script src="js/jquery.js"></script>
|
||||||
|
<script src="js/main.js"></script>
|
||||||
<script src="js/header.js"></script>
|
<script src="js/header.js"></script>
|
||||||
<script src="js/menu.js"></script>
|
<script src="js/menu.js"></script>
|
||||||
<script src="js/notifications.js"></script>
|
|
||||||
<style>
|
<style>
|
||||||
/* Add your css files here. */
|
/* Add your css files here. */
|
||||||
@import url("styles/main.css");
|
@import url("styles/main.css");
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
@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
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ $userinfo = getHeaderInfo();
|
|||||||
<input name="search"
|
<input name="search"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Zoek naar wat je wil"
|
placeholder="Zoek naar wat je wil"
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
@@ -27,6 +26,7 @@ $userinfo = getHeaderInfo();
|
|||||||
<?=$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>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<?php include("notification-center.php"); ?>
|
<?php include("notification-center.php"); ?>
|
||||||
|
|||||||
3
website/views/loadFriends.php
Normal file
3
website/views/loadFriends.php
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
echo json_encode(selectAllFriends($_SESSION["userID"])->fetchAll());
|
||||||
@@ -7,17 +7,19 @@
|
|||||||
<h1>Welkom bij MyHyvesbook+</h1>
|
<h1>Welkom bij MyHyvesbook+</h1>
|
||||||
<!-- Login content -->
|
<!-- Login content -->
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
return= $correct
|
return=$correct
|
||||||
method="post">
|
method="post"
|
||||||
|
name="login">
|
||||||
|
|
||||||
<!-- Login name -->
|
<!-- Login name -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<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>
|
||||||
|
|
||||||
@@ -25,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"
|
||||||
@@ -37,15 +40,71 @@
|
|||||||
<!-- Button for logging in -->
|
<!-- Button for logging in -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
value="Login"
|
value="login"
|
||||||
name="submit"
|
name="submit"
|
||||||
id="frm1_submit">
|
id="frm1_submit">
|
||||||
Login
|
Inloggen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
<!-- 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>
|
<label><b>Onthoud mij</b></label>
|
||||||
|
<input type="checkbox" name="rememberMe" value=1><br>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Button for going to the register screen -->
|
||||||
|
<div class="login_containerlogin">
|
||||||
|
<!-- <a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>-->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include("../views/forgotPasswordModal.php");
|
||||||
|
include("../views/registerModal.php");
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Get the button that opens the modal
|
||||||
|
var modal = document.getElementById('myModal');
|
||||||
|
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
|
||||||
|
var span = document.getElementsByClassName("close")[0];
|
||||||
|
var registerSpan = document.getElementsByClassName("close")[1];
|
||||||
|
|
||||||
|
// When the user clicks the button, open the modal
|
||||||
|
btn.onclick = function () {
|
||||||
|
// 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
|
||||||
|
span.onclick = function () {
|
||||||
|
modal.style.display = "none";
|
||||||
|
}
|
||||||
|
registerSpan.onclick = function () {
|
||||||
|
registerModal.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the user clicks anywhere outside of the modal, close it
|
||||||
|
window.onclick = function (event) {
|
||||||
|
if (event.target == modal) {
|
||||||
|
modal.style.display = "none";
|
||||||
|
}
|
||||||
|
if (event.target == registerModal) {
|
||||||
|
registerModal.style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
type="text/css"
|
type="text/css"
|
||||||
href="styles/index.css">
|
href="styles/index.css">
|
||||||
<script src="/js/jqeury.js"></script>
|
<script src="js/jquery.js"></script>
|
||||||
<script src="/js/registerAndLogin.js"></script>
|
<script src="js/registerAndLogin.js"></script>
|
||||||
|
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,133 +1,39 @@
|
|||||||
<nav class="menu">
|
<nav class="menu" id="contact-menu">
|
||||||
<section id="friends-menu-section">
|
<section id="friends-menu-section">
|
||||||
<?php
|
|
||||||
|
|
||||||
// Load file.
|
|
||||||
require_once("../queries/friendship.php");
|
|
||||||
require_once("../queries/user.php");
|
|
||||||
|
|
||||||
// Get confirmed friends of the user and a random non-friend.
|
|
||||||
$friends = selectAllFriends($_SESSION["userID"])->fetchAll();
|
|
||||||
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
if (sizeof($friends) == 0) {
|
|
||||||
echo "
|
|
||||||
<ul class=\"nav-list\"><li class='friend-item'>
|
|
||||||
<form action='profile.php' method='get'>
|
|
||||||
<button type='submit'
|
|
||||||
name='username'
|
|
||||||
value='$randomUser'>
|
|
||||||
<div class='friend'>
|
|
||||||
Maak nieuwe vrienden :)
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</li><ul class=\"nav-list\">
|
|
||||||
";
|
|
||||||
} else {
|
|
||||||
echo "
|
|
||||||
<h4>
|
<h4>
|
||||||
Vrienden
|
Recente vrienden
|
||||||
</h4>
|
</h4>
|
||||||
<ul class=\"nav-list\">
|
<ul id="menu-friends-list" class="nav-list">
|
||||||
";
|
</ul>
|
||||||
|
|
||||||
foreach ($friends as $i => $friend) {
|
|
||||||
$username = $friend["username"];
|
|
||||||
$name = $friend["name"];
|
|
||||||
$extraItem = "";
|
|
||||||
$pf = $friend["profilepicture"];
|
|
||||||
|
|
||||||
if ($i >= 5)
|
|
||||||
$extraItem = "extra-menu-items";
|
|
||||||
|
|
||||||
echo "
|
|
||||||
<li class='friend-item $extraItem'>
|
|
||||||
<form action='profile.php' method='get'>
|
|
||||||
<button type='submit'
|
|
||||||
name='username'
|
|
||||||
value='$username'>
|
|
||||||
<div class='friend'>
|
|
||||||
<img alt='PF' class='profile-picture' src='$pf'/>
|
|
||||||
<div class='friend-name'>
|
|
||||||
$name<br/>
|
|
||||||
<span style='color: #666'>$username</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof($friends) > 5) {
|
|
||||||
echo "
|
|
||||||
<li class='more-item' id='more-friends-click'>
|
|
||||||
Meer vrienden..
|
|
||||||
</li>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</section>
|
</section>
|
||||||
<section id="groups-menu-section">
|
<section id="groups-menu-section">
|
||||||
<?php
|
|
||||||
|
|
||||||
// Load file.
|
|
||||||
require_once("../queries/group_member.php");
|
|
||||||
|
|
||||||
// Get all the friends of a user.
|
|
||||||
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
|
|
||||||
|
|
||||||
if (sizeof($groups) > 0) {
|
|
||||||
echo "
|
|
||||||
<h4>
|
<h4>
|
||||||
Groepen
|
Top groepen
|
||||||
</h4>
|
</h4>
|
||||||
<ul class=\"nav-list\">
|
<ul id="menu-groups-list" class="nav-list">
|
||||||
";
|
</ul>
|
||||||
|
<ul class="nav-list">
|
||||||
foreach ($groups as $i => $group) {
|
<li>
|
||||||
// Set default values of a friend.
|
<a href="#">
|
||||||
$name = $group["name"];
|
Maak een groep aan
|
||||||
$extraItem = "";
|
</a>
|
||||||
$picture = $group["picture"];
|
|
||||||
|
|
||||||
// Change values if needed.
|
|
||||||
if ($i > 3)
|
|
||||||
$extraItem = "extra-menu-items";
|
|
||||||
|
|
||||||
echo "
|
|
||||||
<li class='group-item $extraItem'>
|
|
||||||
<form action='group.php' method='get'>
|
|
||||||
<button type='submit'
|
|
||||||
name='groupname'
|
|
||||||
value='$name'>
|
|
||||||
<div class='group'>
|
|
||||||
<img alt='PF' class='group-picture' src='$picture'/>
|
|
||||||
$name
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</li>
|
</li>
|
||||||
";
|
</ul>
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof($groups) > 3) {
|
|
||||||
echo "
|
|
||||||
<li class='more-item' id='more-groups-click'>
|
|
||||||
Meer groepen..
|
|
||||||
</li>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<ul>
|
<ul class="nav-list">
|
||||||
<li class="more-item" id="menu-back">
|
<li>
|
||||||
Terug naar het overzicht
|
<form action="search.php" method="get">
|
||||||
|
<input type="hidden"
|
||||||
|
name="search"
|
||||||
|
value="" />
|
||||||
|
<input type="hidden"
|
||||||
|
name="filter"
|
||||||
|
value="personal" />
|
||||||
|
<button type="submit">
|
||||||
|
Klik voor al je groepen en vrienden...
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
23
website/views/messagepage.php
Normal file
23
website/views/messagepage.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
function messagePage(string $content) {
|
||||||
|
$webpage = ("
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
@import url(../styles/main.css);
|
||||||
|
@import url(../styles/settings.css);
|
||||||
|
@import url(../styles/message-page.css);
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class='password-change'>
|
||||||
|
<div class='top-logo'><a href='../index.php'><img src='../img/top-logo.png' alt='MyHyvesbook+'/></a></div>
|
||||||
|
<div class='item-box platform'>$content</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
");
|
||||||
|
|
||||||
|
echo $webpage;
|
||||||
|
}
|
||||||
@@ -1,23 +1,34 @@
|
|||||||
<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
|
||||||
|
$userinfo = getRoleByID($_SESSION['userID'])->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($userinfo['role'] == 'admin' OR $userinfo['role'] == 'owner') {
|
||||||
|
echo "<a href=\"admin.php\" data-title=\"Admin\"><i class=\"fa fa-lock\"></i></a>";
|
||||||
|
echo "<style>@import url('styles/adminbutton.css'); </style>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<a href="logout.php" data-title="Admin"><i class="fa fa-sign-out"></i></a>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section id="friend-request-section">
|
||||||
<h4>
|
<h4>
|
||||||
Vriendchapsverzoeken
|
Verzoeken
|
||||||
</h4>
|
</h4>
|
||||||
<ul class="nav-list" id="friendrequestslist">
|
<ul class="nav-list" id="friend-requests-list">
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section id="unread-messages-section">
|
||||||
<h4>
|
<h4>
|
||||||
Nieuwe berichten
|
Nieuwe berichten
|
||||||
</h4>
|
</h4>
|
||||||
<ul class="nav-list" id="unreadChatlist">
|
<ul class="nav-list" id="unread-chat-list">
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
63
website/views/post-view.php
Normal file
63
website/views/post-view.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
$postID = $_GET['postID'];
|
||||||
|
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
echo("
|
||||||
|
<div class='post-header header'>
|
||||||
|
<h4>" . $post['title'] . "</h4>
|
||||||
|
<span class='postinfo'>
|
||||||
|
gepost door $fullname,
|
||||||
|
<span class='posttime' title='" . $post['creationdate'] . "'>
|
||||||
|
" . nicetime($post['creationdate']) . "
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='post-content'>
|
||||||
|
<p>" . $post['content'] . "</p>
|
||||||
|
</div>
|
||||||
|
"); ?>
|
||||||
|
|
||||||
|
<div class='post-comments'>
|
||||||
|
<div class="commentfield">
|
||||||
|
<form id="newcommentform" onsubmit="return false;">
|
||||||
|
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
||||||
|
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..."></textarea> <br>
|
||||||
|
<button onclick="postComment('reaction')" name="button" value="reaction">Reageer!</button>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$q = selectCommentsByPostId($postID);
|
||||||
|
while($comment = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$commentauthor = $comment['fname'] . " " . $comment['lname'] . " (" . $comment['username'] . ")";
|
||||||
|
$commentdate = $comment['creationdate'];
|
||||||
|
$commentnicetime = nicetime($commentdate);
|
||||||
|
$commentcontent = $comment['content'];
|
||||||
|
|
||||||
|
echo("
|
||||||
|
<div class='comment'>
|
||||||
|
<div class='commentinfo'>
|
||||||
|
$commentauthor
|
||||||
|
<span class='commentdate' title='$commentdate'>
|
||||||
|
$commentnicetime
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class='commentcontent'>
|
||||||
|
$commentcontent
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
");
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
@@ -1,20 +1,47 @@
|
|||||||
<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" src="<?= $user["profilepicture"] ?>"><br />
|
||||||
<div class="profile-button">
|
<div class="platform">
|
||||||
<p><img src="/img/add-friend.png"> Als vriend toevoegen</p>
|
<div class="status-buttons-container">
|
||||||
|
<button disabled class="gray">
|
||||||
|
<?= $user["onlinestatus"] ?>
|
||||||
|
</button>
|
||||||
|
<button disabled class="gray"><?= $user["role"] ?></button>
|
||||||
</div>
|
</div>
|
||||||
<h1 class="profile-username"><?=$user["username"]?></h1>
|
<div class="friend-button-container">
|
||||||
<h5 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h5>
|
<p>:)</p>
|
||||||
<p><?=$user["bio"]?></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>Geboren op: <?= $user["birthdate"] ?></li>
|
||||||
|
<li>Locatie: <?= $user["location"] ?></li>
|
||||||
|
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item-box left platform">
|
<div class="item-box platform">
|
||||||
<h2>Vrienden</h2>
|
<h3>Vrienden</h3>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
while($friend = $profile_friends->fetch()) {
|
while($friend = $profile_friends->fetch()) {
|
||||||
echo "<a href='/profile/${friend["username"]}/' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
|
echo "<a href='profile.php?username=${friend["username"]}' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -25,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) {
|
||||||
@@ -41,29 +68,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
<?php
|
|
||||||
if ($_SESSION["userID"] === $userID) {
|
|
||||||
?>
|
|
||||||
<div class="post platform">
|
|
||||||
<form>
|
|
||||||
<input type="text" class="newpost" placeholder="Titel">
|
|
||||||
<textarea class="newpost">Schrijf een berichtje...</textarea>
|
|
||||||
<input type="submit" value="Plaats!">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
while($post = $posts->fetch()) {
|
|
||||||
$nicetime = nicetime($post["creationdate"]);
|
|
||||||
echo "
|
|
||||||
<div class='post platform'>
|
|
||||||
<h2>${post["title"]}</h2>
|
|
||||||
<p>${post["content"]}</p>
|
|
||||||
<p class=\"subscript\">${nicetime} geplaatst.</p>
|
|
||||||
</div>
|
</div>
|
||||||
";
|
|
||||||
}
|
<div class="modal">
|
||||||
?>
|
<div class="modal-content platform">
|
||||||
|
<div class="modal-close">
|
||||||
|
×
|
||||||
|
</div>
|
||||||
|
<div class="modal-response" id="modal-response">
|
||||||
|
<span class="modal-default">Aan het laden...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,13 +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="date"
|
<select name="day_date" >
|
||||||
name="bday"
|
<option>dag</option>
|
||||||
value="<?php echo $bday ?>"
|
<?php
|
||||||
id="bday"
|
for($i=1; $i<32; $i++) {
|
||||||
placeholder="01/01/1900"
|
$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>
|
||||||
*<span class="error"> <?php echo $bdayErr;?></span>
|
*<span class="error"> <?php echo $bdayErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -95,7 +126,7 @@
|
|||||||
|
|
||||||
<!-- Register location -->
|
<!-- Register location -->
|
||||||
<div class="login_containerregister">
|
<div class="login_containerregister">
|
||||||
<label><b>Woonplaats</b></label>
|
<label><b>Locatie</b></label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
placeholder="Voer uw woonplaats in"
|
placeholder="Voer uw woonplaats in"
|
||||||
name="location"
|
name="location"
|
||||||
@@ -117,18 +148,35 @@
|
|||||||
*<span class="error"> <?php echo $emailErr;?></span>
|
*<span class="error"> <?php echo $emailErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Button for registering -->
|
<!-- Register email -->
|
||||||
<div class="login_containerregister">
|
<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>
|
||||||
|
|
||||||
|
<!-- Button for registering -->
|
||||||
|
<div class="login_containerlogin">
|
||||||
|
<!-- Button for going back to login screen -->
|
||||||
|
<a href="https://myhyvesbookplus.nl/login.php" class="button">Annuleren</a>
|
||||||
|
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
value="Registreer uw account"
|
value="Registreer uw account"
|
||||||
name="Submit"
|
name="Submit"
|
||||||
id="frm1_submit">
|
id="frm1_submit">
|
||||||
Registreer
|
Registreer
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div class="login_containerlogin">
|
|
||||||
<!-- Button for going back to login screen -->
|
|
||||||
<a href="https://myhyvesbookplus.nl/login.php" class="left-arrow">Login</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
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>
|
||||||
38
website/views/resetpassword.php
Normal file
38
website/views/resetpassword.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
function passwordResetFields() {
|
||||||
|
$username = $_GET['u'];
|
||||||
|
$hash = $_GET['h'];
|
||||||
|
$content ="
|
||||||
|
<form class='settings' method = 'post' >
|
||||||
|
<h5 > Voer een nieuw wachtwoord in </h5 >
|
||||||
|
<input type = 'hidden'
|
||||||
|
name = 'u'
|
||||||
|
value = '$username'
|
||||||
|
>
|
||||||
|
<input type = 'hidden'
|
||||||
|
name = 'h'
|
||||||
|
value = '$hash'
|
||||||
|
>
|
||||||
|
<ul >
|
||||||
|
<li >
|
||||||
|
<label > Nieuw wachtwoord </label >
|
||||||
|
<input type = 'password'
|
||||||
|
name = 'password'
|
||||||
|
placeholder = 'Nieuw wachtwoord'
|
||||||
|
>
|
||||||
|
</li >
|
||||||
|
<li >
|
||||||
|
<label > Bevestig wachtwoord </label >
|
||||||
|
<input type = 'password'
|
||||||
|
name = 'password-confirm'
|
||||||
|
placeholder = 'Bevestig wachtwoord'
|
||||||
|
>
|
||||||
|
</li >
|
||||||
|
<li >
|
||||||
|
<label ></label >
|
||||||
|
<button type = 'submit' > Verander wachtwoord </button >
|
||||||
|
</li >
|
||||||
|
</ul >
|
||||||
|
</form >";
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
@@ -5,11 +5,11 @@ $user_perpage = $group_perpage = 20;
|
|||||||
$user_currentpage = $group_currentpage = 1;
|
$user_currentpage = $group_currentpage = 1;
|
||||||
|
|
||||||
if (isset($_GET['user-pageselect'])) {
|
if (isset($_GET['user-pageselect'])) {
|
||||||
$user_currentpage = $_GET['user-pageselect'];
|
$user_currentpage = test_input($_GET['user-pageselect']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['group-pageselect'])) {
|
if (isset($_GET['group-pageselect'])) {
|
||||||
$group_currentpage = $_GET['group-pageselect'];
|
$group_currentpage = test_input($_GET['group-pageselect']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['search'])) {
|
if (isset($_GET['search'])) {
|
||||||
@@ -17,7 +17,7 @@ if (isset($_GET['search'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['filter'])) {
|
if (isset($_GET['filter'])) {
|
||||||
$filter = $_GET['filter'];
|
$filter = test_input($_GET['filter']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_n = ($user_currentpage - 1) * $user_perpage;
|
$user_n = ($user_currentpage - 1) * $user_perpage;
|
||||||
@@ -37,26 +37,24 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
Zoek:
|
Zoek:
|
||||||
</label>
|
</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
id="search-input"
|
||||||
name="search"
|
name="search"
|
||||||
placeholder="zoek"
|
onkeyup="
|
||||||
|
searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
|
||||||
|
searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);"
|
||||||
|
placeholder="Zoek"
|
||||||
value=<?php echo "$search";?>
|
value=<?php echo "$search";?>
|
||||||
>
|
>
|
||||||
<label for="filter">
|
<label for="filter">
|
||||||
Filter:
|
Filter:
|
||||||
</label>
|
</label>
|
||||||
<select name="filter">
|
<select name="filter" id="search-filter">
|
||||||
|
<option value="personal"
|
||||||
|
<?php if ($filter == "personal") echo "selected";?>>
|
||||||
|
Persoonlijk</option>
|
||||||
<option value="all"
|
<option value="all"
|
||||||
<?php if ($filter == "all") echo "selected";?>>
|
<?php if ($filter == "all") echo "selected";?>>
|
||||||
Alles</option>
|
Alles</option>
|
||||||
<option value="users"
|
|
||||||
<?php if ($filter == "users") echo "selected";?>>
|
|
||||||
Gebruikers</option>
|
|
||||||
<option value="groups"
|
|
||||||
<?php if ($filter == "groups") echo "selected";?>>
|
|
||||||
Groepen</option>
|
|
||||||
<option value="friends"
|
|
||||||
<?php if ($filter == "friends") echo "selected";?>>
|
|
||||||
Vrienden</option>
|
|
||||||
</select>
|
</select>
|
||||||
<input onclick="document.getElementById('user-pageselect').value = 1;
|
<input onclick="document.getElementById('user-pageselect').value = 1;
|
||||||
document.getElementById('group-pageselect').value = 1"
|
document.getElementById('group-pageselect').value = 1"
|
||||||
@@ -84,31 +82,12 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<ul class='nav-list'>
|
<ul id='search-users-list' class='nav-list'>
|
||||||
|
<script>
|
||||||
<?php
|
$(document).ready(function(){
|
||||||
$q = searchSomeUsers($user_n, $user_perpage, $search);
|
searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
|
||||||
|
});
|
||||||
while ($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
</script>
|
||||||
$username = $user['username'];
|
|
||||||
$profilepic = $user['profilepicture'];
|
|
||||||
$fname = $user['fname'];
|
|
||||||
$lname = $user['lname'];
|
|
||||||
|
|
||||||
echo("
|
|
||||||
<a href='https://myhyvesbookplus.nl/profile?username=$username'>
|
|
||||||
<li class='search-item'>
|
|
||||||
<div class='friend'>
|
|
||||||
<img class='profile-picture'
|
|
||||||
src='$profilepic'>
|
|
||||||
$fname $lname ($username)
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</a>
|
|
||||||
");
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -131,28 +110,12 @@ $group_count = countSomeGroups($search)->fetchColumn();
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<ul class="nav-list">
|
<ul id="search-groups-list" class="nav-list">
|
||||||
|
<script>
|
||||||
<?php
|
$(document).ready(function(){
|
||||||
$q = searchSomeGroups($group_n, $user_perpage, $search);
|
searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);
|
||||||
|
});
|
||||||
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
</script>
|
||||||
$groupname = $group['name'];
|
|
||||||
$grouppic = $group['picture'];
|
|
||||||
|
|
||||||
echo("
|
|
||||||
<a href='https://myhyvesbookplus.nl/group?groupName=$groupname'>
|
|
||||||
<li class='search-item'>
|
|
||||||
<div class='group'>
|
|
||||||
<img class='group-picture'
|
|
||||||
src='$grouppic'>
|
|
||||||
$groupname
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</a>
|
|
||||||
");
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -21,7 +19,7 @@ $settings = getSettings();
|
|||||||
id="fname"
|
id="fname"
|
||||||
placeholder="Voornaam"
|
placeholder="Voornaam"
|
||||||
title="Voornaam"
|
title="Voornaam"
|
||||||
value="<?= $settings["fname"]?>"
|
value="<?=$settings["fname"]?>"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -30,7 +28,7 @@ $settings = getSettings();
|
|||||||
name="lname"
|
name="lname"
|
||||||
id="lname"
|
id="lname"
|
||||||
placeholder="Achternaam"
|
placeholder="Achternaam"
|
||||||
value="<?= $settings["lname"]?>"
|
value="<?=$settings["lname"]?>"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -39,16 +37,60 @@ $settings = getSettings();
|
|||||||
name="location"
|
name="location"
|
||||||
id="location"
|
id="location"
|
||||||
placeholder="Locatie"
|
placeholder="Locatie"
|
||||||
value="<?= $settings["location"]?>"
|
value="<?=$settings["location"]?>"
|
||||||
>
|
>
|
||||||
</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; ?>
|
||||||
|
</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 +99,7 @@ $settings = getSettings();
|
|||||||
rows="5"
|
rows="5"
|
||||||
title="bio"
|
title="bio"
|
||||||
id="bio"
|
id="bio"
|
||||||
><?= $settings["bio"]?></textarea>
|
><?=$settings["bio"]?></textarea>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label></label>
|
<label></label>
|
||||||
@@ -73,7 +115,7 @@ $settings = getSettings();
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<label>Huidige profielfoto</label>
|
<label>Huidige profielfoto</label>
|
||||||
<img src="<?= $settings["profilepicture"] ?>"
|
<img src="<?=$settings["profilepicture"]?>"
|
||||||
class="profile-picture"
|
class="profile-picture"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
@@ -81,7 +123,8 @@ $settings = getSettings();
|
|||||||
<label>Selecteer foto</label>
|
<label>Selecteer foto</label>
|
||||||
<input type="file"
|
<input type="file"
|
||||||
name="pp"
|
name="pp"
|
||||||
accept="image/jpeg,image/gif,image/png"
|
accept="image/*"
|
||||||
|
size="4000000"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -97,24 +140,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>
|
||||||
@@ -133,7 +182,7 @@ $settings = getSettings();
|
|||||||
<label for="email-old">Huidig Email </label>
|
<label for="email-old">Huidig Email </label>
|
||||||
<input type="email"
|
<input type="email"
|
||||||
id="email-old"
|
id="email-old"
|
||||||
value="<?= $settings["email"]?>"
|
value="<?=$settings["email"]?>"
|
||||||
disabled
|
disabled
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user