1 Commits

Author SHA1 Message Date
Marijn Jansen
eb094858b5 End of day 2017-01-31 16:11:03 +01:00
42 changed files with 278 additions and 530 deletions

View File

@@ -6,20 +6,15 @@ 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");
$userinfo = getRoleByID($_SESSION['userID']);
if (isset($_POST["actions"]) && isset($_POST["userID"])) { if (isset($_POST["actions"]) && isset($_POST["userID"])) {
changeUserStatusByID($_POST["userID"], $_POST["actions"]); changeUserStatusByID($_POST["userID"], $_POST["actions"]);
} else if (isset($_POST["actions"]) && isset($_POST["groupID"])) { } else if (isset($_POST["actions"]) && isset($_POST["groupID"])) {
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]); changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
} else if (isset($_POST["batchactions"]) && isset($_POST["checkbox-user"])) { } else if (isset($_POST["batchactions"]) && isset($_POST["checkbox-user"])) {
if ($userinfo == 'owner') { changeMultipleUserStatusByID($_POST["checkbox-user"], $_POST["batchactions"]);
changeMultipleUserStatusByID($_POST["checkbox-user"], $_POST["batchactions"]);
} else {
changeMultipleUserStatusByIDAdmin($_POST["checkbox-user"], $_POST["batchactions"]);
}
} else if (isset($_POST["groupbatchactions"]) && isset($_POST["checkbox-group"])) { } else if (isset($_POST["groupbatchactions"]) && isset($_POST["checkbox-group"])) {
changeMultipleGroupStatusByID($_POST["checkbox-group"], $_POST["groupbatchactions"]); changeMultipleGroupStatusByID($_POST["checkbox-group"], $_POST["groupbatchactions"]);
} else if (isset($_POST['bancommentuserID']) && isset($_POST['bancommenttext'])) {
editBanCommentByID($_POST['bancommentuserID'], $_POST['bancommenttext']);
} }
//header("location: ../admin.php");
print_r($_POST);

View File

@@ -5,7 +5,6 @@ session_start();
require_once ("../../queries/connect.php"); 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");
$search = ""; $search = "";
if (isset($_POST["search"])) { if (isset($_POST["search"])) {
@@ -22,17 +21,8 @@ if (isset($_POST['status'])) {
$status = $_POST["status"]; $status = $_POST["status"];
} }
$groupstatus = array(); if ($pagetype == "user") {
if (isset($_POST['groupstatus'])) { include ("../../views/adminpanel-page.php");
$groupstatus = $_POST["groupstatus"]; } else {
echo "Pagenumber failed!";
} }
$entries = 20;
$currentpage = 1;
if (isset($_POST['currentpage'])) {
$currentpage = (int) test_input($_POST["currentpage"]);
}
$offset = (int) $currentpage * $entries - $entries;
include ("../../views/adminpanel-page.php");

View File

@@ -8,11 +8,13 @@ require_once ("../../queries/user.php");
require_once ("../../queries/group_page.php"); require_once ("../../queries/group_page.php");
$offset = 0; $offset = 0;
$entries = 20; if (isset($_POST["n"])) {
if (isset($_POST["currentpage"])) { $offset = (int) test_input($_POST["n"]);
$offset = (int) test_input($_POST["currentpage"]) * $entries - $entries; }
$entries = 20;
if (isset($_POST["m"])) {
$entries = (int) test_input($_POST["m"]);
} }
$search = ""; $search = "";
if (isset($_POST["search"])) { if (isset($_POST["search"])) {
$search = test_input($_POST["search"]); $search = test_input($_POST["search"]);
@@ -33,8 +35,6 @@ if (isset($_POST['groupstatus'])) {
$groupstatus = $_POST["groupstatus"]; $groupstatus = $_POST["groupstatus"];
} }
$userinfo = getRoleByID($_SESSION['userID']);
if ($pagetype == "user") { if ($pagetype == "user") {
include ("../../views/adminpanel-table.php"); include ("../../views/adminpanel-table.php");
} else if ($pagetype == "group") { } else if ($pagetype == "group") {

View File

@@ -4,12 +4,5 @@ session_start();
require_once ("../../queries/connect.php"); require_once ("../../queries/connect.php");
require_once ("../../queries/friendship.php"); require_once ("../../queries/friendship.php");
require_once ("../../queries/user.php");
if (isset($_SESSION["userID"]) && echo selectAllFriendRequests();
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
echo selectAllFriendRequests();
} else {
echo "[]";
}

View File

@@ -6,15 +6,11 @@ require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php"); require_once ("../../queries/checkInput.php");
require_once ("../../queries/friendship.php"); require_once ("../../queries/friendship.php");
if (isset($_SESSION["userID"])) { if (isset($_POST["limit"])) {
if (isset($_POST["limit"])) { echo selectLimitedFriends($_SESSION["userID"], (int) test_input($_POST["limit"]));
echo selectLimitedFriends($_SESSION["userID"], (int)test_input($_POST["limit"])); } else if (isset($_GET["limit"])) {
} else if (isset($_GET["limit"])) { echo selectLimitedFriends($_SESSION["userID"], (int) test_input($_GET["limit"]));
echo selectLimitedFriends($_SESSION["userID"], (int)test_input($_GET["limit"]));
} else {
echo selectFriends($_SESSION["userID"]);
}
} else { } else {
echo "[]"; echo selectFriends($_SESSION["userID"]);
} }

View File

@@ -2,36 +2,28 @@
session_start(); session_start();
require_once("../../queries/post.php"); require("../../queries/post.php");
require_once("../../queries/connect.php"); require_once("../../queries/connect.php");
require_once("../../queries/checkInput.php"); require("../../queries/checkInput.php");
require_once("../../queries/user.php"); print_r($_POST);
if ($_POST['button'] == 'reaction') {
if (empty($_POST['newcomment-content'])) {
if (isset($_SESSION["userID"]) && echo 0;
getRoleByID($_SESSION["userID"]) != 'frozen' && } else {
getRoleByID($_SESSION["userID"]) != 'banned') { if (makeComment($_POST['postID'],
if ($_POST['button'] == 'reaction') { $_SESSION['userID'],
if (empty($_POST['newcomment-content'])) { test_input($_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; echo 1;
} else { } else {
echo 0; echo 0;
} }
}
} else if ($_POST['button'] == 'nietslecht') {
if (makeNietSlecht($_POST["postID"], $_SESSION["userID"])) {
echo 1;
} else { } else {
echo 0; echo 0;
} }
} else { } else {
echo "frozen"; echo 0;
} }

View File

@@ -6,6 +6,7 @@ require_once("../../queries/post.php");
require_once("../../queries/group_page.php"); require_once("../../queries/group_page.php");
require_once("../../queries/connect.php"); require_once("../../queries/connect.php");
require_once("../../queries/checkInput.php"); require_once("../../queries/checkInput.php");
require_once("../../queries/picture.php");
if (empty($_POST["title"]) or if (empty($_POST["title"]) or
empty($_POST["content"]) or empty($_POST["content"]) or
@@ -17,7 +18,6 @@ if (empty($_POST["group"])) {
// User Post // User Post
makePost( makePost(
$_SESSION["userID"], $_SESSION["userID"],
null,
test_input($_POST["title"]), test_input($_POST["title"]),
test_input($_POST["content"]) test_input($_POST["content"])
); );
@@ -32,23 +32,8 @@ if (empty($_POST["group"])) {
makePost( makePost(
$_SESSION["userID"], $_SESSION["userID"],
$_POST["group"],
test_input($_POST["title"]), test_input($_POST["title"]),
test_input($_POST["content"]) test_input($_POST["content"]),
$_POST["group"]
); );
} }
//if (empty($_POST['newpost-title'])) {
//} else {
// makePost($_SESSION['userID'],
// null,
// test_input($_POST['newpost-title']),
// test_input($_POST['newpost-content']));
//}
//
//header("Location: ../profile.php");

View File

@@ -1,41 +0,0 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/user.php");
require_once ("../../queries/group_page.php");
$user_perpage = $group_perpage = 20;
$user_currentpage = $group_currentpage = 1;
if (isset($_POST['user-pageselect'])) {
$user_currentpage = test_input($_POST['user-pageselect']);
}
if (isset($_POST['group-pageselect'])) {
$group_currentpage = test_input($_POST['group-pageselect']);
}
$user_n = $user_currentpage * $user_perpage - $user_perpage;
$group_n = $group_currentpage * $group_perpage - $group_perpage;
$search = "";
if (isset($_POST['search'])) {
$search = test_input($_POST['search']);
}
$user_count = countSomeUsers($search)->fetchColumn();
$group_count = countSomeGroups($search)->fetchColumn();
$filter = "all";
if (isset($_POST['filter'])) {
$filter = test_input($_POST['filter']);
}
$option = "user";
if (isset($_POST['option'])) {
$option = test_input($_POST['option']);
}
include ("../../views/searchPageNumber.php");

View File

@@ -8,15 +8,13 @@ require_once ("../../queries/friendship.php");
require_once ("../../queries/user.php"); require_once ("../../queries/user.php");
$n = 0; $n = 0;
$m = 20; if (isset($_POST["n"])) {
$n = (int) test_input($_POST["n"]);
$page = 1; }
if (isset($_POST["user-pageselect"])) { $m = 20;
$page = (int) test_input($_POST['user-pageselect']); if (isset($_POST["m"])) {
$m = (int) test_input($_POST["m"]);
} }
$n = ($page - 1) * $m;
$search = ""; $search = "";
if (isset($_POST["search"])) { if (isset($_POST["search"])) {
$search = test_input($_POST["search"]); $search = test_input($_POST["search"]);

View File

@@ -4,22 +4,14 @@ session_start();
require_once("../../queries/connect.php"); require_once("../../queries/connect.php");
require_once("../../queries/private_message.php"); require_once("../../queries/private_message.php");
require_once("../../queries/checkInput.php"); require_once("../../queries/checkInput.php");
require_once("../../queries/user.php");
if (isset($_SESSION["userID"]) && if (!empty(test_input($_POST["destination"])) &&
getRoleByID($_SESSION["userID"]) != 'frozen' && !empty(test_input($_POST["content"]))) {
getRoleByID($_SESSION["userID"]) != 'banned') { if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
if (!empty(test_input($_POST["destination"])) && echo 1;
!empty(test_input($_POST["content"]))
) {
if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
echo 1;
} else {
echo 0;
}
} else { } else {
echo 0; echo 0;
} }
} else { } else {
echo "frozen"; echo 0;
} }

View File

@@ -8,7 +8,7 @@
<style> <style>
@import url("styles/adminpanel.css"); @import url("styles/adminpanel.css");
</style> </style>
<script src="js/admin.js" charset="utf-8"></script> <script src="js/admin.js" charset="utf-8"></script>
</head> </head>
<body> <body>
<?php <?php
@@ -19,9 +19,9 @@
include_once ("../queries/user.php"); include_once ("../queries/user.php");
// auth // auth
$role = getRoleByID($_SESSION['userID']); $userinfo = getRoleByID($_SESSION['userID'])->fetch(PDO::FETCH_ASSOC);
if ($role != 'admin' AND $role != 'owner') { if ($userinfo['role'] != 'admin' AND $userinfo['role'] != 'owner') {
header("location:profile.php"); header("location:profile.php");
} }

View File

@@ -33,7 +33,7 @@ foreach($friends as $i => $friend) {
} }
?>'> ?>'>
<div class='friend'> <div class='friend'>
<img alt='PF' class='profile-picture <?= $friend->onlinestatus ?>' src='<?= $friend->profilepicture ?>'/> <img alt='PF' class='profile-picture' src='<?= $friend->profilepicture ?>'/>
<div class='friend-name'> <div class='friend-name'>
<?= $friend->fullname ?><br/> <?= $friend->fullname ?><br/>
<span style='color: #666'><?php <span style='color: #666'><?php

View File

@@ -11,7 +11,7 @@
<body> <body>
<?php <?php
include_once("../queries/group_page.php"); include("../queries/group_page.php");
$group = selectGroupByName($_GET["groupname"]); $group = selectGroupByName($_GET["groupname"]);
$members = selectGroupMembers(2); $members = selectGroupMembers(2);

View File

@@ -1,48 +1,42 @@
$(window).on("load", function () { $(window).on("load", function () {
changeFilter(); changeFilter();
searchFromOne();
$(".admin-searchinput").keyup(function(){ $(".admin-searchinput").keyup(function(){
searchFromOne(); adminSearch();
}); });
// all inputs and labels directly under admin filter and groupfilter // all inputs and labels directly under admin filter and groupfilter
$("#admin-filter, #admin-groupfilter > input, label").change(function(){ $("#admin-filter, #admin-groupfilter > input, label").click(function(){
searchFromOne(); adminSearch();
}); });
$("#pagetype").change(function(){ $("#pagetype").change(function(){
searchFromOne(); adminSearch();
}); });
/* Update hidden input to be equal to submit pressed, adminSearch();
because serialize doesn't take submit values. */
$('#admin-batchform > button').click(function () {
$('#batchinput').prop('value', $(this).prop('value'));
console.log($('#batchinput').prop('value'));
});
$('#admin-groupbatchform > button').click(function () {
$('#groupbatchinput').prop('value', $(this).prop('value'));
console.log($('#batchinput').prop('value'));
});
}); });
function checkAll() { function checkAll(allbox) {
$('.checkbox-list').each(function () { var checkboxes = document.getElementsByClassName('checkbox-list');
$(this).prop('checked', $('#checkall').prop('checked'));
}); for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type == 'checkbox') {
checkboxes[i].checked = allbox.checked;
}
}
} }
function checkCheckAll() { function checkCheckAll(allbox) {
var checkboxes = document.getElementsByClassName('checkbox-list');
var checked = true; var checked = true;
$('.checkbox-list').each(function () { for (var i = 0; i < checkboxes.length; i++) {
if ($(this).prop('checked') == false) { if (checkboxes[i].type == 'checkbox') {
checked = false; if (checkboxes[i].checked == false) {
return; checked = false;
break;
}
} }
}); }
allbox.checked = checked;
$('#checkall').prop('checked', checked);
} }
function changeFilter() { function changeFilter() {
@@ -61,28 +55,12 @@ function changeFilter() {
} }
} }
function searchFromOne() {
$('#currentpage').prop('value', 1);
adminSearch();
}
function adminSearch() { function adminSearch() {
console.log($("#admin-searchform").serialize());
$.post( $.post(
"API/adminSearchUsers.php", "API/adminSearchUsers.php",
$("#admin-searchform").serialize() $("#admin-searchform").serialize()
).done(function (data) { ).done(function (data) {
$("#usertable").html(data); $("#usertable").html(data);
updatePageN();
})
}
function adminUpdate(form) {
$.post(
"API/adminChangeUser.php",
$(form).serialize()
).done(function () {
adminSearch();
}) })
} }
@@ -94,17 +72,3 @@ function updatePageN() {
$("#admin-pageinfo").html(data); $("#admin-pageinfo").html(data);
}) })
} }
function toggleBancomment(button) {
$(button).siblings("div").toggle();
$(button).toggle();
}
function editComment(form) {
$.post(
"API/adminChangeUser.php",
$(form).serialize()
).done(function (data) {
adminSearch();
});
}

View File

@@ -33,11 +33,7 @@ function sendMessage() {
$.post( $.post(
"API/sendMessage.php", "API/sendMessage.php",
$("#sendMessageForm").serialize() $("#sendMessageForm").serialize()
).done(function(response) { );
if (response == "frozen") {
alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
}
});
$("#newContent").val(""); $("#newContent").val("");
loadMessages(); loadMessages();
@@ -47,9 +43,8 @@ function addMessages(messages) {
var messagesText = ""; var messagesText = "";
for(var i in messages) { for(var i in messages) {
// Initialize message variables // Initialize message variables
var thisDate = new Date(messages[i].creationdate.replace(/ /,"T")); var thisDate = new Date(messages[i].creationdate);
var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes(); var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes();
console.log(thisDate);
var type; var type;
thisDate.setHours(0,0,0,0); thisDate.setHours(0,0,0,0);
@@ -59,15 +54,17 @@ function addMessages(messages) {
type = "chat-message-other"; type = "chat-message-other";
} }
if (i == 0) { if (i == 0) {
previousDate = thisDate; if (thisDate > previousDate) {
messagesText += '\ previousDate = thisDate;
<div class="day-message"> \ messagesText += '\
<div class="day-message-content">\ <div class="day-message"> \
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\ <div class="day-message-content">\
</div> \ ' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div>'; </div> \
</div>';
}
messagesText += '<div class="chat-message"><div class="' + type + '">'; messagesText += '<div class="chat-message"><div class="' + type + '">';
} else if (type != previousType || thisTime != previousTime || thisDate.getTime() > previousDate.getTime()) { } else if (type != previousType || thisTime != previousTime || thisDate > previousDate) {
messagesText += '<div class="chat-time">\ messagesText += '<div class="chat-time">\
' + thisTime + '\ ' + thisTime + '\
</div></div></div>'; </div></div></div>';

View File

@@ -3,7 +3,7 @@ var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "a
function fancyText(text) { function fancyText(text) {
// Add links, images, gifs and (youtube) video's. // Add links, images, gifs and (youtube) video's.
var regex = /(https?:\/\/.[^ <>"]*)/ig; var regex = /(https?:\/\/.[^ ]*)/ig;
text = text.replace(regex, function(link) { text = text.replace(regex, function(link) {
// Add images // Add images
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) { if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
@@ -94,13 +94,3 @@ function showGroups(groups, list) {
return false; return false;
} }
} }
$(document).ready(function() {
$("body").delegate("textarea[maxlength]", "keydown", function() {
if ($(this).val().length / .9 >= $(this).attr("maxlength")) {
$(this).next().text($(this).val().length + "/" + $(this).attr("maxlength"));
} else {
$(this).next().text("");
}
});
});

View File

@@ -19,7 +19,7 @@ function requestPost(postID) {
var scrollBarWidth = window.innerWidth - document.body.offsetWidth; var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
scrollbarMargin(scrollBarWidth, 'hidden'); scrollbarMargin(scrollBarWidth, 'hidden');
$('#modal-response').show(); $('#modal-response').show();
$('#modal-response').html(fancyText(data)); $('#modal-response').html(data);
}); });
} }
@@ -31,14 +31,16 @@ function postPost() {
$.post("API/postPost.php", { title: title, $.post("API/postPost.php", { title: title,
content : content, content : content,
group : groupID }) group : groupID })
.done(function() { .done(function(data) {
masonry(masonryMode); masonry(masonryMode);
console.log(data);
}); });
} else { } else {
$.post("API/postPost.php", { title: title, $.post("API/postPost.php", { title: title,
content : content }) content : content })
.done(function() { .done(function(data) {
masonry(masonryMode); masonry(masonryMode);
console.log(data);
}); });
} }
@@ -78,26 +80,27 @@ function masonry(mode) {
* Initialise columns. * Initialise columns.
*/ */
var columns = new Array(columnCount); var columns = new Array(columnCount);
var $columns = new Array(columnCount);
for (i = 0; i < columnCount; i++) { for (i = 0; i < columnCount; i++) {
$column = $("<div class=\"column\">"); $column = $("<div class='column'>");
$column.width(100/columnCount + "%"); $column.width(100/columnCount + "%");
$container.append($column); $container.append($column);
columns[i] = [0, $column]; columns[i] = [0, $column];
} }
if(mode > 0) { if(mode > 0) {
$postInput = $("<div class=\"post platform\">"); $postInput = $("<div class='post platform'>");
$form = $("<form class=\"newpost\" action=\"API/postPost.php\" method=\"post\" onsubmit=\"postPost(); return false;\">"); $form = $("<form class='newpost' action='API/postPost.php' method='post' onsubmit='postPost(); return false;'>");
$postInput.append($form); $postInput.append($form);
if(mode == 2) { if(mode == 2) {
$form.append($("<input class=\"newpost\" type=\"hidden\" name=\"group\" value=\"" + groupID + "\">")); $form.append($("<input class='newpost' type='hidden' name='group' value='" + groupID + "'>"));
} }
$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...'>"));
$form.append($("<input value=\"Plaats!\" type=\"submit\">")); $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][1].append($postInput);
columns[0][0] = $postInput.height() + margin; columns[0][0] = $postInput.height() + margin;
@@ -128,11 +131,11 @@ function masonry(mode) {
* Rearange the objects. * Rearange the objects.
*/ */
$.each(posts, function() { $.each(posts, function() {
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">"); $post = $("<div class='post platform' onclick='requestPost(\'"+this['postID']+"\')'>");
$post.append($("<h2>").html(this["title"])); $post.append($("<h2>").html(this["title"]));
$post.append($("<p>").html(fancyText(this["content"]))); $post.append($("<p>").html(this["content"]));
$post.append($("<p class=\"subscript\">").text(this["nicetime"])); $post.append($("<p class='subscript'>").text(this["nicetime"]));
$post.append($("<p class=\"subscript\">").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"])); $post.append($("<p class='subscript'>").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"]));
shortestColumn = getShortestColumn(columns); shortestColumn = getShortestColumn(columns);
shortestColumn[1].append($post); shortestColumn[1].append($post);

View File

@@ -4,10 +4,8 @@ function postComment(buttonValue) {
$.post( $.post(
"API/postComment.php", "API/postComment.php",
formData formData
).done(function (response) { ).done(function(data) {
if (response == "frozen") { console.log(data);
alert("Je account is bevroren, dus je kan geen comments plaatsen of \"niet slechten\". Contacteer een admin als je denkt dat dit onjuist is.");
}
}); });
$("#newcomment").val(""); $("#newcomment").val("");
@@ -17,6 +15,6 @@ function postComment(buttonValue) {
"API/loadPost.php", "API/loadPost.php",
$("#newcommentform").serialize() $("#newcommentform").serialize()
).done(function (data) { ).done(function (data) {
$('#modal-response').html(fancyText(data)); $('#modal-response').html(data);
}); });
} }

View File

@@ -1,11 +1,12 @@
$(window).on('load', function () { function searchUsers(n, m) {
pageNumber();
});
function searchUsers() {
$.post( $.post(
"API/searchUsers.php", "API/searchUsers.php",
$('#search-form').serialize() {
n: n,
m: m,
search: $("#search-input").val(),
filter: $("#search-filter").val()
}
).done(function(data) { ).done(function(data) {
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) { if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
$("#search-users-list").text("Niemand gevonden"); $("#search-users-list").text("Niemand gevonden");
@@ -13,29 +14,18 @@ function searchUsers() {
}); });
} }
function searchGroups() { function searchGroups(n, m) {
$.post( $.post(
"API/searchGroups.php", "API/searchGroups.php",
$('#search-form').serialize() {
n: n,
m: m,
search: $("#search-input").val(),
filter: $("#search-filter").val()
}
).done(function(data) { ).done(function(data) {
if (!showGroups(data, "#search-groups-list")) { if (!showGroups(data, "#search-groups-list")) {
$("#search-groups-list").text("Geen groepen gevonden"); $("#search-groups-list").text("Geen groepen gevonden");
} }
}); });
} }
function pageNumber() {
var input = input2 = $('#search-form').serialize();
$.post(
"API/searchPageNumber.php",
input + "&option=user"
).done(function (data) {
$('#user-pageselect').html(data);
});
$.post(
"API/searchPageNumber.php",
input2 + "&option=group"
).done(function (data) {
$('#group-pageselect').html(data);
});
}

View File

@@ -13,11 +13,10 @@
</head> </head>
<body> <body>
<?php <?php
include_once("../queries/user.php"); include("../queries/user.php");
include_once("../queries/friendship.php"); include("../queries/friendship.php");
include_once("../queries/nicetime.php"); include("../queries/nicetime.php");
include_once("../queries/post.php"); include("../queries/post.php");
include_once("../queries/calcAge.php");
if(empty($_GET["username"])) { if(empty($_GET["username"])) {
$userID = $_SESSION["userID"]; $userID = $_SESSION["userID"];

View File

@@ -4,7 +4,7 @@
.admin-panel input[type="radio"], input[type="checkbox"] { .admin-panel input[type="radio"], input[type="checkbox"] {
vertical-align: middle; vertical-align: middle;
height: 28px; height: auto;
margin: 2px; margin: 2px;
} }
@@ -34,6 +34,7 @@
width: 100%; width: 100%;
} }
.usertable .table-checkbox {width: 20px}
.usertable .table-username {width: 150px} .usertable .table-username {width: 150px}
.usertable .table-status {width: 100px} .usertable .table-status {width: 100px}
.usertable .table-action {width: 200px} .usertable .table-action {width: 200px}
@@ -43,18 +44,10 @@
padding: 3px; padding: 3px;
} }
.usertable th, tr { .usertable tr {
text-align: left; text-align: left;
} }
.usertable tr:hover { .usertable tr:hover {
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.bancommentedit {
display: none;
}
.bancommentform input[type="text"] {
width: 100%;
}

View File

@@ -22,7 +22,6 @@ body {
height: calc(100% - 100px); height: calc(100% - 100px);
display: inline-block; display: inline-block;
float: left;
overflow-y: auto; overflow-y: auto;
} }
@@ -32,14 +31,12 @@ body {
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
width: calc(100% - 256px - 85px); width: calc(100% - 256px - 75px);
height: calc(100% - 80px); height: calc(100% - 80px);
margin-right: 10px;
padding: 10px; padding: 10px;
display: inline-block; display: inline-block;
float: right;
word-wrap: break-word; word-wrap: break-word;
} }

View File

@@ -49,7 +49,7 @@ header div {
} }
#open-notifications { #open-notifications {
padding: 20px 20px 20px 0px; padding: 5px 20px 5px 0px;
} }
@media only screen and (max-width: 1080px) { @media only screen and (max-width: 1080px) {

View File

@@ -92,14 +92,6 @@ p {
border-radius: 50%; border-radius: 50%;
} }
.online {
border: #4CAF50 solid 3px;
}
.offline {
border: #666666 solid 3px;
}
.group-picture { .group-picture {
border-radius: 5px; border-radius: 5px;
} }
@@ -307,16 +299,8 @@ div[data-title]:hover:after {
body { body {
font-size: 28px!important; font-size: 28px!important;
} }
button, input, select { button {
font-size: 28px; font-size: 28px;
height: 42px;
}
textarea {
font-size: 28px;
}
input[type="checkbox"], input[type="radio"] {
width: 28px;
height: 28px;
} }
} }

View File

@@ -45,7 +45,7 @@
.main-picture { .main-picture {
position: relative; position: relative;
border-width: 5px; border: #4CAF50 solid 5px;
display: inline-block; display: inline-block;
width: 150px; width: 150px;
@@ -120,8 +120,4 @@ div.posts .post form textarea.newpost {
.post-box { .post-box {
width: calc(100% - 65px); width: calc(100% - 65px);
} }
.modal {
left: 0!important;
width: 100%!important;
}
} }

View File

@@ -16,10 +16,6 @@ function selectLimitedFriends($userID, $limit) {
`profilepicture`, `profilepicture`,
'../img/avatar-standard.png' '../img/avatar-standard.png'
) AS profilepicture, ) 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,7 +29,10 @@ function selectLimitedFriends($userID, $limit) {
`user`.`role` != 'banned' AND `user`.`role` != 'banned' AND
`friendship`.`status` = 'confirmed' `friendship`.`status` = 'confirmed'
ORDER BY ORDER BY
`user`.`lastactivity` CASE
WHEN `friendship`.`user2ID` = `user`.`userID` THEN `friendship`.`chatLastVisted1`
WHEN `friendship`.`user1ID` = `user`.`userID` THEN `friendship`.`chatLastVisted2`
END
DESC DESC
LIMIT :limitCount LIMIT :limitCount
"); ");

View File

@@ -21,7 +21,7 @@ function updateAvatar(bool $group = false) {
move_uploaded_file($tmpImg, $publicDir . $relativePath); move_uploaded_file($tmpImg, $publicDir . $relativePath);
} else { } else {
$relativePath = $avatarDir . $_SESSION["userID"] . "_avatar.png"; $relativePath = $avatarDir . $_SESSION["userID"] . "_avatar.png";
$scaledImg = scaleAvatar($tmpImg); $scaledImg = scalePicture($tmpImg);
$group ? removeOldGroupAvatar($_POST["groupID"]) : removeOldUserAvatar(); $group ? removeOldGroupAvatar($_POST["groupID"]) : removeOldUserAvatar();
imagepng($scaledImg, $publicDir . $relativePath); imagepng($scaledImg, $publicDir . $relativePath);
} }
@@ -30,6 +30,24 @@ function updateAvatar(bool $group = false) {
throw new HappyAlert("Profielfoto veranderd."); 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. * Removes the old avatar from the uploads folder, for a user.
*/ */
@@ -128,7 +146,7 @@ function checkAvatarSize(string $img) {
* @return bool|resource Returns the image as an Resource. * @return bool|resource Returns the image as an Resource.
* @throws AngryAlert * @throws AngryAlert
*/ */
function scaleAvatar(string $imgLink, int $newWidth = 600) { function scalePicture(string $imgLink, int $newWidth = 600) {
$img = imagecreatefromstring(file_get_contents($imgLink)); $img = imagecreatefromstring(file_get_contents($imgLink));
if ($img) { if ($img) {
return imagescale($img, $newWidth); return imagescale($img, $newWidth);

View File

@@ -97,20 +97,28 @@ function selectCommentsByPostId($postID) {
return $stmt; return $stmt;
} }
function makePost($userID, $groupID, $title, $content) { 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(" $stmt = prepareQuery("
INSERT INTO INSERT INTO
`post` ( `post` (
`author`, `author`,
`groupID`, `groupID`,
`title`, `title`,
`content` `content`,
`image`
) )
VALUES ( VALUES (
:userID, :userID,
:groupID, :groupID,
:title, :title,
:content :content,
:image
) )
"); ");
@@ -118,6 +126,7 @@ function makePost($userID, $groupID, $title, $content) {
$stmt->bindParam(':groupID', $groupID); $stmt->bindParam(':groupID', $groupID);
$stmt->bindParam(':title', $title); $stmt->bindParam(':title', $title);
$stmt->bindParam(':content', $content); $stmt->bindParam(':content', $content);
$stmt->bindParam(':image', $picturePath);
$stmt->execute(); $stmt->execute();
} }

View File

@@ -16,8 +16,6 @@ function getOldChatMessages($user2ID) {
`destination` = :user1 `destination` = :user1
ORDER BY ORDER BY
`creationdate` ASC `creationdate` ASC
LIMIT
100
"); ");
$stmt->bindParam(":user1", $user1ID); $stmt->bindParam(":user1", $user1ID);

View File

@@ -2,19 +2,6 @@
require_once ("connect.php"); require_once ("connect.php");
function updateLastActivity() {
$stmt = prepareQuery("
UPDATE
`user`
SET
`lastactivity` = NOW()
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $_SESSION["userID"]);
return $stmt->execute();
}
function getUserID($username) { function getUserID($username) {
$stmt = prepareQuery(" $stmt = prepareQuery("
SELECT SELECT
@@ -278,25 +265,6 @@ function changeMultipleUserStatusByID($ids, $status) {
return $q; return $q;
} }
function changeMultipleUserStatusByIDAdmin($ids, $status) {
$q = prepareQuery("
UPDATE
`user`
SET
`role` = :status
WHERE
FIND_IN_SET (`userID`, :ids)
AND NOT `role` = 'admin'
AND NOT `role` = 'owner'
");
$ids = implode(',', $ids);
$q->bindParam(':ids', $ids);
$q->bindParam(':status', $status);
$q->execute();
return $q;
}
function selectRandomNotFriendUser($userID) { function selectRandomNotFriendUser($userID) {
$stmt = prepareQuery(" $stmt = prepareQuery("
SELECT SELECT
@@ -367,10 +335,9 @@ function countSomeUsers($search) {
FROM FROM
`user` `user`
WHERE WHERE
(`username` LIKE :keyword OR `username` LIKE :keyword OR
`fname` LIKE :keyword OR `fname` LIKE :keyword OR
`lname` LIKE :keyword) AND `lname` LIKE :keyword
`role` != 'banned'
ORDER BY ORDER BY
`fname`, `fname`,
`lname`, `lname`,
@@ -395,20 +362,5 @@ function getRoleByID($userID) {
$stmt->bindParam(':userID', $userID); $stmt->bindParam(':userID', $userID);
$stmt->execute(); $stmt->execute();
return $stmt->fetch()["role"]; return $stmt;
}
function editBanCommentByID($userID, $comment) {
$stmt = prepareQuery("
UPDATE
`user`
SET
`bancomment` = :comment
WHERE
`userID` = :userID
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->bindParam(':comment', $comment);
$stmt->execute();
} }

View File

@@ -16,6 +16,7 @@ while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
$name = $group['name']; $name = $group['name'];
$role = $group['status']; $role = $group['status'];
$description = $group['description']; $description = $group['description'];
$function = "checkCheckAll(document.getElementById('checkall'))";
echo(" echo("
<tr> <tr>
@@ -24,14 +25,15 @@ while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
class='checkbox-list' class='checkbox-list'
value='$groupID' value='$groupID'
form='admin-groupbatchform' form='admin-groupbatchform'
onchange='checkCheckAll();'> onchange='$function'>
</td> </td>
<td>$name</td> <td>$name</td>
<td>$role</td> <td>$role</td>
<td>$description</td> <td>$description</td>
<td> <td>
<form class='admin-groupaction' <form class='admin-groupaction'
onsubmit=\"adminUpdate(this); return false;\"> action='API/adminChangeUser.php'
method='post'>
<select class='action' name='actions'> <select class='action' name='actions'>
<option value='hidden'>Hidden</option> <option value='hidden'>Hidden</option>
<option value='public'>Public</option> <option value='public'>Public</option>

View File

@@ -5,26 +5,27 @@ if ($pagetype == "user") {
$pages = countSomeGroupsByStatus($search, $groupstatus); $pages = countSomeGroupsByStatus($search, $groupstatus);
} }
$countresults = $pages->fetchColumn(); $countresults = $pages->fetchColumn();
$mincount = min($listm, $countresults);
$minlist = min($listn + 1, $countresults);
?> ?>
Pagina: Pagina: <form class="admin-pageselector"
<select class="admin-pageselect" action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
name="currentpage" method="post">
id="currentpage" <select class="admin-pageselect"
form="admin-searchform" name="pageselect"
onchange="adminSearch();"> onchange="this.form.submit()"
<?php value="">
for ($i=1; $i <= ceil($countresults / $entries); $i++) { <?php
if ($currentpage == $i) { for ($i=1; $i <= ceil($countresults / $perpage); $i++) {
echo "<option value='$i' selected>$i</option>"; if ($currentpage == $i) {
} else { echo "<option value='$i' selected>$i</option>";
echo "<option value='$i'>$i</option>"; } else {
echo "<option value='$i'>$i</option>";
}
} }
} ?>
?> </select>
</select> </form>
<?php <?php
$n = min($offset + 1, $countresults); echo "$minlist tot $mincount ($countresults totaal)";
$m = min($offset + $entries, $countresults);
echo " $n tot $m ($countresults totaal)";
?> ?>

View File

@@ -1,5 +1,5 @@
<tr> <tr>
<th><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll()"></th> <th><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll(this)"></th>
<th class="table-username">Gebruikersnaam</th> <th class="table-username">Gebruikersnaam</th>
<th class="table-status">Status</th> <th class="table-status">Status</th>
<th class="table-comment">Aantekening</th> <th class="table-comment">Aantekening</th>
@@ -14,6 +14,7 @@ while($user = $q->fetch(PDO::FETCH_ASSOC)) {
$username = $user['username']; $username = $user['username'];
$role = $user['role']; $role = $user['role'];
$bancomment = $user['bancomment']; $bancomment = $user['bancomment'];
$function = "checkCheckAll(document.getElementById('checkall'))";
echo(" echo("
<tr> <tr>
@@ -23,47 +24,20 @@ while($user = $q->fetch(PDO::FETCH_ASSOC)) {
class='checkbox-list' class='checkbox-list'
value='$userID' value='$userID'
form='admin-batchform' form='admin-batchform'
onchange='checkCheckAll();'> onchange='$function'>
</td> </td>
<td>$username</td> <td>$username</td>
<td>$role</td> <td>$role</td>
<td> <td>$bancomment</td>
<div class='bancomment'>$bancomment</div>
<div class='bancommentedit'>
<form class='bancommentform'
id='bancommentform'
onsubmit='editComment(this);
return false;'>
<input type='text'
name='bancommenttext'
placeholder='Schrijf een aantekening'
value='$bancomment'>
<input type='hidden'
name='bancommentuserID'
value='$userID'>
<button type='submit'>Update</button>
</form>
</div>
<button type='button' onclick='toggleBancomment(this)'>Verander</button>
</td>
<td> <td>
<form class='admin-useraction' <form class='admin-useraction'
onsubmit=\"adminUpdate(this); return false;\"> action='API/adminChangeUser.php'
<select class='action' name='actions'>"); method='post'>
if (!($userinfo == 'admin' <select class='action' name='actions'>
AND ($user['role'] == 'admin' <option value='frozen'>Bevries</option>
OR $user['role'] == 'owner'))) { <option value='banned'>Ban</option>
echo "<option value='frozen'>Bevries</option> <option value='user'>Activeer</option>
<option value='banned'>Ban</option> </select>
<option value='user'>Activeer</option>";
if ($userinfo == 'owner') {
echo "<option value='admin'>Admin</option>
<option value='owner'>Owner</option>";
}
}
echo ("</select>
<input type='hidden' name='userID' value='$userID'> <input type='hidden' name='userID' value='$userID'>
<input type='submit' value='Confirm'> <input type='submit' value='Confirm'>
</form> </form>

View File

@@ -2,10 +2,11 @@
<!-- 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;
$perpage = 20;
$status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner"); $status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner");
$groupstatus = array("hidden", "public", "membersonly"); $groupstatus = array("hidden", "public", "membersonly");
$pagetype = "user"; $pagetype = "user";
$userinfo = getRoleByID($_SESSION['userID']);
if (isset($_GET["search"])) { if (isset($_GET["search"])) {
$search = test_input($_GET["search"]); $search = test_input($_GET["search"]);
@@ -23,6 +24,13 @@ if (isset($_GET["groupstatus"])) {
$groupstatus = $_GET["groupstatus"]; $groupstatus = $_GET["groupstatus"];
} }
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST["pageselect"])) {
$currentpage = $_POST["pageselect"];
}
}
?> ?>
<div class="content"> <div class="content">
@@ -31,7 +39,7 @@ if (isset($_GET["groupstatus"])) {
<div class="admin-options"> <div class="admin-options">
<form class="admin-searchform" <form class="admin-searchform"
id="admin-searchform" id="admin-searchform"
action="javascript:searchFromOne();" action="javascript:adminSearch();"
method="get"> method="get">
<div class="admin-searchbar"> <div class="admin-searchbar">
@@ -112,33 +120,23 @@ if (isset($_GET["groupstatus"])) {
<div class="admin-users"> <div class="admin-users">
<div class="admin-usertitle"> <div class="admin-usertitle">
<h4>Resultaat:</h4> <h4>Resultaat:</h4>
<div style="float: right" id="admin-pageinfo"> <span style="float: right" id="admin-pageinfo">
</div> </span>
<form id="admin-batchform" <form
onsubmit="adminUpdate(this); return false;"> id="admin-batchform"
action="API/adminChangeUser.php"
method="post">
<input type="hidden" name="batchactions" id="batchinput">
<button type="submit" name="batchactions" id="freeze" value="frozen">Bevries</button> <button type="submit" name="batchactions" id="freeze" value="frozen">Bevries</button>
<button type="submit" name="batchactions" id="ban" value="banned">Ban</button> <button type="submit" name="batchactions" id="ban" value="banned">Ban</button>
<button type="submit" name="batchactions" id="restore" value="user">Activeer</button> <button type="submit" name="batchactions" id="restore" value="user">Activeer</button>
<?php
if ($userinfo == 'owner') {
echo "<button type=\"submit\"
name=\"batchactions\"
id=\"admin\"
value=\"admin\">Maak Admin</button>
<button type=\"submit\"
name=\"batchactions\"
id=\"owner\"
value=\"owner\">Maak Owner</button>";
}
?>
</form> </form>
<form id="admin-groupbatchform" <form
onsubmit="adminUpdate(this); return false;"> id="admin-groupbatchform"
action="API/adminChangeUser.php"
method="post">
<input type="hidden" name="groupbatchactions" id="groupbatchinput">
<button type="submit" name="batchactions" id="hide" value="hidden">Hide</button> <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="ban" value="public">Public</button>
<button type="submit" name="batchactions" id="members" value="membersonly">Members</button> <button type="submit" name="batchactions" id="members" value="membersonly">Members</button>

View File

@@ -19,12 +19,9 @@
require_once ("../queries/checkInput.php"); require_once ("../queries/checkInput.php");
require_once ("../queries/connect.php"); require_once ("../queries/connect.php");
require_once ("../queries/user.php");
session_start(); session_start();
if(!isset($_SESSION["userID"])){ if(!isset($_SESSION["userID"])){
header("location:login.php"); header("location:login.php");
} else {
updateLastActivity();
} }

View File

@@ -25,7 +25,8 @@ $userinfo = getHeaderInfo();
</div> </div>
<?=$userinfo["fname"]?> <?=$userinfo["fname"]?>
</div> </div>
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/><i id="open-notifications" class="fa fa-bars"></i> <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"); ?>

View File

@@ -7,9 +7,9 @@
include_once ("../queries/user.php"); include_once ("../queries/user.php");
// auth // auth
$role = getRoleByID($_SESSION['userID']); $userinfo = getRoleByID($_SESSION['userID'])->fetch(PDO::FETCH_ASSOC);
if ($role == 'admin' OR $role == 'owner') { if ($userinfo['role'] == 'admin' OR $userinfo['role'] == 'owner') {
echo "<a href=\"admin.php\" data-title=\"Admin\"><i class=\"fa fa-lock\"></i></a>"; echo "<a href=\"admin.php\" data-title=\"Admin\"><i class=\"fa fa-lock\"></i></a>";
echo "<style>@import url('styles/adminbutton.css'); </style>"; echo "<style>@import url('styles/adminbutton.css'); </style>";
} }

View File

@@ -24,7 +24,7 @@ echo("
<div class="commentfield"> <div class="commentfield">
<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..."></textarea> <br>
<button onclick="postComment('reaction')" name="button" value="reaction">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

View File

@@ -1,10 +1,10 @@
<div class="content"> <div class="content">
<div class="user-box"> <div class="user-box">
<img class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br /> <img class="profile-picture main-picture" src="<?= $user["profilepicture"] ?>"><br />
<div class="platform"> <div class="platform">
<div class="status-buttons-container"> <div class="status-buttons-container">
<button disabled class="gray"> <button disabled class="gray">
<?= $user["onlinestatus"] ?> <?= $user["onlinestatus"] ?>
</button> </button>
<button disabled class="gray"><?= $user["role"] ?></button> <button disabled class="gray"><?= $user["role"] ?></button>
</div> </div>
@@ -29,7 +29,7 @@
<h3>Informatie</h3> <h3>Informatie</h3>
<p> <p>
<ul> <ul>
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li> <li>Geboren op: <?= $user["birthdate"] ?></li>
<li>Locatie: <?= $user["location"] ?></li> <li>Locatie: <?= $user["location"] ?></li>
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li> <li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
</ul> </ul>

View File

@@ -21,8 +21,10 @@ if (isset($_GET['filter'])) {
} }
$user_n = ($user_currentpage - 1) * $user_perpage; $user_n = ($user_currentpage - 1) * $user_perpage;
$user_count = countSomeUsers($search)->fetchColumn();
$group_n = ($group_currentpage - 1) * $group_perpage; $group_n = ($group_currentpage - 1) * $group_perpage;
$group_count = countSomeGroups($search)->fetchColumn();
?> ?>
<div class="content"> <div class="content">
@@ -38,10 +40,8 @@ $group_n = ($group_currentpage - 1) * $group_perpage;
id="search-input" id="search-input"
name="search" name="search"
onkeyup=" onkeyup="
$('#user-pagenumber, #group-pagenumber').prop('value', 1); searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
searchUsers(); searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);"
searchGroups();
pageNumber();"
placeholder="Zoek" placeholder="Zoek"
value=<?php echo "$search";?> value=<?php echo "$search";?>
> >
@@ -66,12 +66,26 @@ $group_n = ($group_currentpage - 1) * $group_perpage;
<div class="platform item-box searchleft" id="search-friends-output"> <div class="platform item-box searchleft" id="search-friends-output">
<h4>Gebruikers</h4> <h4>Gebruikers</h4>
<div id="user-pageselect"></div> <select class="user-pageselect"
name="user-pageselect"
id="user-pageselect"
form="search-form"
onchange="this.form.submit()">
<?php
for ($i=1; $i <= ceil($user_count / $user_perpage); $i++) {
if ($user_currentpage == $i) {
echo "<option value='$i' selected>$i</option>";
} else {
echo "<option value='$i'>$i</option>";
}
}
?>
</select>
<ul id='search-users-list' class='nav-list'> <ul id='search-users-list' class='nav-list'>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
searchUsers(); searchUsers(<?= $user_n ?>, <?= $user_perpage ?>);
}); });
</script> </script>
</ul> </ul>
@@ -80,12 +94,26 @@ $group_n = ($group_currentpage - 1) * $group_perpage;
<div class="platform item-box searchright" id="search-group-output"> <div class="platform item-box searchright" id="search-group-output">
<h4>Groepen</h4> <h4>Groepen</h4>
<div id="group-pageselect"></div> <select class="group-pageselect"
name="group-pageselect"
id="group-pageselect"
form="search-form"
onchange="this.form.submit()">
<?php
for ($i=1; $i <= ceil($group_count / $group_perpage); $i++) {
if ($group_currentpage == $i) {
echo "<option value='$i' selected>$i</option>";
} else {
echo "<option value='$i'>$i</option>";
}
}
?>
</select>
<ul id="search-groups-list" class="nav-list"> <ul id="search-groups-list" class="nav-list">
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
searchGroups(); searchGroups(<?= $group_n ?>, <?= $group_perpage ?>);
}); });
</script> </script>
</ul> </ul>

View File

@@ -1,36 +0,0 @@
<?php
if ($option == "user") {
echo "<select class=\"user-pageselect\"
name=\"user-pageselect\"
id='user-pagenumber'
form=\"search-form\"
onchange=\"pageNumber(); searchUsers();\">";
for ($i=1; $i <= ceil($user_count / $user_perpage); $i++) {
if ($user_currentpage == $i) {
echo "<option value='$i' selected>$i</option>";
} else {
echo "<option value='$i'>$i</option>";
}
}
echo "</select>";
} else {
echo "<select class=\"group-pageselect\"
name=\"group-pageselect\"
id='group-pagenumber'
form=\"search-form\"
onchange=\"pageNumber(); searchGroups();\">";
for ($i=1; $i <= ceil($group_count / $group_perpage); $i++) {
if ($group_currentpage == $i) {
echo "<option value='$i' selected>$i</option>";
} else {
echo "<option value='$i'>$i</option>";
}
}
echo "</select>";
}
?>

View File

@@ -75,9 +75,6 @@ $settings = getSettings();
<?=$year?> <?=$year?>
</option> </option>
<?php endfor; ?> <?php endfor; ?>
<option value="680" <?=(680 == $currentbday->format("Y")) ? "selected" : ""?>>
680
</option>
</select> </select>
</li> </li>
<li> <li>
@@ -102,8 +99,7 @@ $settings = getSettings();
rows="5" rows="5"
title="bio" title="bio"
id="bio" id="bio"
maxlength="1000" ><?=$settings["bio"]?></textarea>
><?=$settings["bio"]?></textarea><span></span>
</li> </li>
<li> <li>
<label></label> <label></label>