2 Commits

Author SHA1 Message Date
Marijn Jansen
04df02862f More Awesome Fonts :D 2017-02-02 10:52:42 +01:00
Marijn Jansen
e299ef59e8 Added show profile into settings 2017-02-02 10:28:12 +01:00
10 changed files with 25 additions and 81 deletions

View File

@@ -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') {$user_perpage = $group_perpage = 20; getRoleByID($_SESSION["userID"]) != 'banned') {
$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,26 +28,20 @@ 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');
} }

View File

@@ -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($("<input value=\"Plaats!\" type=\"submit\">")); $form.append($("<button type=\"submit\"><i class='fa fa-sticky-note-o'></i> Plaats!</button>"));
columns[0][1].append($postInput); columns[0][1].append($postInput);
columns[0][0] = $postInput.height() + margin; columns[0][0] = $postInput.height() + margin;

View File

@@ -34,6 +34,4 @@ function deletePost(postID) {
}); });
closeModal(); closeModal();
masonry(masonryMode); masonry(masonryMode);
} }

View File

@@ -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"] { div.posts .post form input[type="submit"], .post button{
width: 100%; width: 100%;
} }

View File

@@ -276,34 +276,3 @@ 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();
}

View File

@@ -55,29 +55,6 @@ 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

View File

@@ -18,7 +18,8 @@ function getSettings() {
`bio`, `bio`,
`profilepicture`, `profilepicture`,
`showBday`, `showBday`,
`showEmail` `showEmail`,
`showProfile`
FROM FROM
`user` `user`
WHERE WHERE
@@ -64,7 +65,8 @@ 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
"); ");
@@ -79,6 +81,7 @@ 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();

View File

@@ -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">Reageer!</button> <button onclick="postComment('reaction')" name="button" value="reaction" class="green"><i class="fa fa-comment"></i> 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"])) {

View File

@@ -48,12 +48,7 @@ $group_n = ($group_currentpage - 1) * $group_perpage;
<label for="filter"> <label for="filter">
Filter: Filter:
</label> </label>
<select name="filter" <select name="filter" id="search-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>

View File

@@ -96,6 +96,14 @@ $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"