Compare commits
2 Commits
marijn-set
...
hendrik-se
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9c68d5f5f | ||
|
|
d027333bd7 |
@@ -6,11 +6,11 @@ require_once ("../../queries/connect.php");
|
|||||||
require_once ("../../queries/checkInput.php");
|
require_once ("../../queries/checkInput.php");
|
||||||
require_once ("../../queries/user.php");
|
require_once ("../../queries/user.php");
|
||||||
require_once ("../../queries/group_page.php");
|
require_once ("../../queries/group_page.php");
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
require_once ("../../queries/group_member.php");
|
||||||
|
|
||||||
if (isset($_SESSION["userID"]) &&
|
if (isset($_SESSION["userID"]) &&
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
getRoleByID($_SESSION["userID"]) != 'banned') {$user_perpage = $group_perpage = 20;
|
||||||
|
|
||||||
$user_perpage = $group_perpage = 20;
|
|
||||||
|
|
||||||
$user_currentpage = $group_currentpage = 1;
|
$user_currentpage = $group_currentpage = 1;
|
||||||
if (isset($_POST['user-pageselect'])) {
|
if (isset($_POST['user-pageselect'])) {
|
||||||
@@ -28,20 +28,26 @@ if (isset($_SESSION["userID"]) &&
|
|||||||
$search = test_input($_POST['search']);
|
$search = test_input($_POST['search']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_count = countSomeUsers($search)->fetchColumn();
|
|
||||||
$group_count = countSomeGroups($search)->fetchColumn();
|
|
||||||
|
|
||||||
$filter = "all";
|
$filter = "all";
|
||||||
if (isset($_POST['filter'])) {
|
if (isset($_POST['filter'])) {
|
||||||
$filter = test_input($_POST['filter']);
|
$filter = test_input($_POST['filter']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($filter == "all") {
|
||||||
|
$user_count = countSomeUsers($search)->fetchColumn();
|
||||||
|
$group_count = countSomeGroups($search)->fetchColumn();
|
||||||
|
} else {
|
||||||
|
$user_count = countSomeFriends($search);
|
||||||
|
$group_count = countSomeOwnGroups($search);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$option = "user";
|
$option = "user";
|
||||||
if (isset($_POST['option'])) {
|
if (isset($_POST['option'])) {
|
||||||
$option = test_input($_POST['option']);
|
$option = test_input($_POST['option']);
|
||||||
}
|
}
|
||||||
|
|
||||||
include("../../views/searchPageNumber.php");
|
include ("../../views/searchPageNumber.php");
|
||||||
} else {
|
} else {
|
||||||
header('HTTP/1.0 403 Forbidden');
|
header('HTTP/1.0 403 Forbidden');
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ function masonry(mode) {
|
|||||||
|
|
||||||
$form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">"));
|
$form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">"));
|
||||||
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\" maxlength='1000'></textarea><span></span>"));
|
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\" maxlength='1000'></textarea><span></span>"));
|
||||||
$form.append($("<button type=\"submit\"><i class='fa fa-sticky-note-o'></i> Plaats!</button>"));
|
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
||||||
columns[0][1].append($postInput);
|
columns[0][1].append($postInput);
|
||||||
|
|
||||||
columns[0][0] = $postInput.height() + margin;
|
columns[0][0] = $postInput.height() + margin;
|
||||||
|
|||||||
@@ -34,4 +34,6 @@ function deletePost(postID) {
|
|||||||
});
|
});
|
||||||
closeModal();
|
closeModal();
|
||||||
masonry(masonryMode);
|
masonry(masonryMode);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ div.posts .post form input, div.posts .post form textarea {
|
|||||||
width: calc(100% - 15px);
|
width: calc(100% - 15px);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.posts .post form input[type="submit"], .post button{
|
div.posts .post form input[type="submit"] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -276,3 +276,34 @@ function searchSomeFriends($n, $m, $search) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function countSomeFriends($search) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
COUNT(*)
|
||||||
|
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`
|
||||||
|
");
|
||||||
|
|
||||||
|
$search = "%$search%";
|
||||||
|
$stmt->bindParam(':keyword', $search);
|
||||||
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->fetchColumn();
|
||||||
|
}
|
||||||
@@ -55,6 +55,29 @@ function searchSomeOwnGroups($n, $m, $search) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function countSomeOwnGroups($search) {
|
||||||
|
$stmt = prepareQuery("
|
||||||
|
SELECT
|
||||||
|
COUNT(*)
|
||||||
|
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
|
||||||
|
");
|
||||||
|
|
||||||
|
$search = "%$search%";
|
||||||
|
$stmt->bindParam(':keyword', $search);
|
||||||
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
return $stmt->fetchColumn();
|
||||||
|
}
|
||||||
|
|
||||||
function addMember($groupID, $userID, $role) {
|
function addMember($groupID, $userID, $role) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ function getSettings() {
|
|||||||
`bio`,
|
`bio`,
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
`showBday`,
|
`showBday`,
|
||||||
`showEmail`,
|
`showEmail`
|
||||||
`showProfile`
|
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
@@ -65,8 +64,7 @@ function updateSettings() {
|
|||||||
`birthdate` = :bday,
|
`birthdate` = :bday,
|
||||||
`bio` = :bio,
|
`bio` = :bio,
|
||||||
`showEmail` = :showEmail,
|
`showEmail` = :showEmail,
|
||||||
`showBday` = :showBday,
|
`showBday` = :showBday
|
||||||
`showProfile` = :showProfile
|
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
@@ -81,7 +79,6 @@ function updateSettings() {
|
|||||||
$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(":showEmail", (array_key_exists("showEmail", $_POST) ? "1" : "0"));
|
||||||
$stmt->bindValue(":showBday", (array_key_exists("showBday", $_POST) ? "1" : "0"));
|
$stmt->bindValue(":showBday", (array_key_exists("showBday", $_POST) ? "1" : "0"));
|
||||||
$stmt->bindValue(":showProfile", (array_key_exists("showProfile", $_POST) ? "1" : "0"));
|
|
||||||
|
|
||||||
$stmt->bindValue(":userID", $_SESSION["userID"]);
|
$stmt->bindValue(":userID", $_SESSION["userID"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
|
|||||||
<form id="newcommentform" onsubmit="return false;">
|
<form id="newcommentform" onsubmit="return false;">
|
||||||
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
||||||
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..." maxlength="1000"></textarea><span></span> <br>
|
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..." maxlength="1000"></textarea><span></span> <br>
|
||||||
<button onclick="postComment('reaction')" name="button" value="reaction" class="green"><i class="fa fa-comment"></i> Reageer!</button>
|
<button onclick="postComment('reaction')" name="button" value="reaction">Reageer!</button>
|
||||||
<button onclick="postComment('nietslecht')" name="button" value="nietslecht" class="nietslecht">
|
<button onclick="postComment('nietslecht')" name="button" value="nietslecht" class="nietslecht">
|
||||||
<?php
|
<?php
|
||||||
if (checkNietSlecht($postID, $_SESSION["userID"])) {
|
if (checkNietSlecht($postID, $_SESSION["userID"])) {
|
||||||
|
|||||||
@@ -48,7 +48,12 @@ $group_n = ($group_currentpage - 1) * $group_perpage;
|
|||||||
<label for="filter">
|
<label for="filter">
|
||||||
Filter:
|
Filter:
|
||||||
</label>
|
</label>
|
||||||
<select name="filter" id="search-filter">
|
<select name="filter"
|
||||||
|
id="search-filter"
|
||||||
|
onchange="$('#user-pagenumber, #group-pagenumber').prop('value', 1);
|
||||||
|
searchUsers();
|
||||||
|
searchGroups();
|
||||||
|
pageNumber();">
|
||||||
<option value="personal"
|
<option value="personal"
|
||||||
<?php if ($filter == "personal") echo "selected";?>>
|
<?php if ($filter == "personal") echo "selected";?>>
|
||||||
Persoonlijk</option>
|
Persoonlijk</option>
|
||||||
|
|||||||
@@ -96,14 +96,6 @@ $settings = getSettings();
|
|||||||
<?=($settings["showEmail"] ? "checked" : "")?>
|
<?=($settings["showEmail"] ? "checked" : "")?>
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<label for="showProfile">Publiek profiel</label>
|
|
||||||
<input type="checkbox"
|
|
||||||
name="showProfile"
|
|
||||||
id="showProfile"
|
|
||||||
<?=($settings["showProfile"] ? "checked" : "")?>
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<label for="bio">Bio</label>
|
<label for="bio">Bio</label>
|
||||||
<textarea name="bio"
|
<textarea name="bio"
|
||||||
|
|||||||
Reference in New Issue
Block a user