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/user.php");
|
||||
require_once ("../../queries/group_page.php");
|
||||
require_once ("../../queries/friendship.php");
|
||||
require_once ("../../queries/group_member.php");
|
||||
|
||||
if (isset($_SESSION["userID"]) &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
|
||||
$user_perpage = $group_perpage = 20;
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {$user_perpage = $group_perpage = 20;
|
||||
|
||||
$user_currentpage = $group_currentpage = 1;
|
||||
if (isset($_POST['user-pageselect'])) {
|
||||
@@ -28,20 +28,26 @@ if (isset($_SESSION["userID"]) &&
|
||||
$search = test_input($_POST['search']);
|
||||
}
|
||||
|
||||
$user_count = countSomeUsers($search)->fetchColumn();
|
||||
$group_count = countSomeGroups($search)->fetchColumn();
|
||||
|
||||
$filter = "all";
|
||||
if (isset($_POST['filter'])) {
|
||||
$filter = test_input($_POST['filter']);
|
||||
}
|
||||
|
||||
if ($filter == "all") {
|
||||
$user_count = countSomeUsers($search)->fetchColumn();
|
||||
$group_count = countSomeGroups($search)->fetchColumn();
|
||||
} else {
|
||||
$user_count = countSomeFriends($search);
|
||||
$group_count = countSomeOwnGroups($search);
|
||||
}
|
||||
|
||||
|
||||
$option = "user";
|
||||
if (isset($_POST['option'])) {
|
||||
$option = test_input($_POST['option']);
|
||||
}
|
||||
|
||||
include("../../views/searchPageNumber.php");
|
||||
include ("../../views/searchPageNumber.php");
|
||||
} else {
|
||||
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($("<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][0] = $postInput.height() + margin;
|
||||
|
||||
@@ -34,4 +34,6 @@ function deletePost(postID) {
|
||||
});
|
||||
closeModal();
|
||||
masonry(masonryMode);
|
||||
|
||||
|
||||
}
|
||||
@@ -108,7 +108,7 @@ div.posts .post form input, div.posts .post form textarea {
|
||||
width: calc(100% - 15px);
|
||||
}
|
||||
|
||||
div.posts .post form input[type="submit"], .post button{
|
||||
div.posts .post form input[type="submit"] {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
@@ -276,3 +276,34 @@ function searchSomeFriends($n, $m, $search) {
|
||||
$stmt->execute();
|
||||
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());
|
||||
}
|
||||
|
||||
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) {
|
||||
$stmt = prepareQuery("
|
||||
INSERT INTO
|
||||
|
||||
@@ -18,8 +18,7 @@ function getSettings() {
|
||||
`bio`,
|
||||
`profilepicture`,
|
||||
`showBday`,
|
||||
`showEmail`,
|
||||
`showProfile`
|
||||
`showEmail`
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
@@ -65,8 +64,7 @@ function updateSettings() {
|
||||
`birthdate` = :bday,
|
||||
`bio` = :bio,
|
||||
`showEmail` = :showEmail,
|
||||
`showBday` = :showBday,
|
||||
`showProfile` = :showProfile
|
||||
`showBday` = :showBday
|
||||
WHERE
|
||||
`userID` = :userID
|
||||
");
|
||||
@@ -81,7 +79,6 @@ function updateSettings() {
|
||||
$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(":showProfile", (array_key_exists("showProfile", $_POST) ? "1" : "0"));
|
||||
|
||||
$stmt->bindValue(":userID", $_SESSION["userID"]);
|
||||
$stmt->execute();
|
||||
|
||||
@@ -30,7 +30,7 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
|
||||
<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..." 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">
|
||||
<?php
|
||||
if (checkNietSlecht($postID, $_SESSION["userID"])) {
|
||||
|
||||
@@ -48,7 +48,12 @@ $group_n = ($group_currentpage - 1) * $group_perpage;
|
||||
<label for="filter">
|
||||
Filter:
|
||||
</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"
|
||||
<?php if ($filter == "personal") echo "selected";?>>
|
||||
Persoonlijk</option>
|
||||
|
||||
@@ -96,14 +96,6 @@ $settings = getSettings();
|
||||
<?=($settings["showEmail"] ? "checked" : "")?>
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<label for="showProfile">Publiek profiel</label>
|
||||
<input type="checkbox"
|
||||
name="showProfile"
|
||||
id="showProfile"
|
||||
<?=($settings["showProfile"] ? "checked" : "")?>
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<label for="bio">Bio</label>
|
||||
<textarea name="bio"
|
||||
|
||||
Reference in New Issue
Block a user