diff --git a/website/public/js/admin.js b/website/public/js/admin.js index e0dc9f7..76180d9 100644 --- a/website/public/js/admin.js +++ b/website/public/js/admin.js @@ -24,12 +24,14 @@ $(window).on("load", function () { }); }); +// Toggles all checkboxes based on one. function checkAll() { $('.checkbox-list').each(function () { $(this).prop('checked', $('#checkall').prop('checked')); }); } +// Simple function that checks if checkall should stay checked. function checkCheckAll() { var checked = true; @@ -43,6 +45,7 @@ function checkCheckAll() { $('#checkall').prop('checked', checked); } +// Toggle of filter options. function changeFilter() { if ($('#pagetype').find(":selected").val() == "group") { document.getElementById('admin-filter').style.display = 'none'; @@ -59,11 +62,13 @@ function changeFilter() { } } +// Sets the search page to one, relevant when changing filter or search. function searchFromOne() { $('#currentpage').prop('value', 1); adminSearch(); } +// AJAX live search. function adminSearch() { $.post( "API/adminSearchUsers.php", @@ -74,6 +79,7 @@ function adminSearch() { }) } +// AJAX live update. function adminUpdate(form) { $.post( "API/adminChangeUser.php", @@ -83,6 +89,7 @@ function adminUpdate(form) { }) } +// AJAX pagenumber functionality. function updatePageN() { $.post( "API/adminPageNumber.php", @@ -92,11 +99,13 @@ function updatePageN() { }) } +// Intended for the edit button to show a form. function toggleBancomment(button) { $(button).siblings("div").toggle(); $(button).toggle(); } +// AJAX value editing. function editComment(form) { $.post( "API/adminChangeUser.php", diff --git a/website/public/js/masonry.js b/website/public/js/masonry.js index d43577b..1a27677 100644 --- a/website/public/js/masonry.js +++ b/website/public/js/masonry.js @@ -91,6 +91,21 @@ $(window).on("load", function() { loadMorePosts(userID, groupID, postAmount, postLimit); } }; + + $(document).keyup(function(e) { + if (e.keyCode == 27) { + closeModal(); + } + }); + + $('.modal').click(function() { + closeModal(); + }); + + $('.modal-content').click(function(event){ + event.stopPropagation(); + }); + }); function closeModal() { diff --git a/website/public/styles/adminpanel.css b/website/public/styles/adminpanel.css index 39d823f..ec3cc80 100644 --- a/website/public/styles/adminpanel.css +++ b/website/public/styles/adminpanel.css @@ -34,9 +34,10 @@ width: 100%; } -.usertable .table-username {width: 150px} -.usertable .table-status {width: 100px} -.usertable .table-action {width: 200px} +.table-checkbox {width: 20px} +.table-username {width: 150px} +.table-status {width: 100px} +.table-action {width: 200px} .usertable th, td { border-bottom: 1px solid #ddd; @@ -51,6 +52,10 @@ background-color: #f5f5f5; } +.bancomment { + width: 80%; +} + .bancommentedit { display: none; } diff --git a/website/queries/checkInput.php b/website/queries/checkInput.php index 247050b..3d17f43 100644 --- a/website/queries/checkInput.php +++ b/website/queries/checkInput.php @@ -216,6 +216,7 @@ function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); + $data = trim($data); return $data; } diff --git a/website/views/adminpanel-grouptable.php b/website/views/adminpanel-grouptable.php index 2449b3d..d30e2ba 100644 --- a/website/views/adminpanel-grouptable.php +++ b/website/views/adminpanel-grouptable.php @@ -3,7 +3,7 @@ Groepsnaam Status Beschrijving - Actie + Zichtbaarheid + Maak Admin "; } ?> @@ -140,9 +139,9 @@ if (isset($_GET["groupstatus"])) { onsubmit="adminUpdate(this); return false;"> - - - + + + @@ -152,5 +151,3 @@ if (isset($_GET["groupstatus"])) { - - \ No newline at end of file diff --git a/website/views/head.php b/website/views/head.php index 3ec8a79..134cd6f 100644 --- a/website/views/head.php +++ b/website/views/head.php @@ -26,6 +26,7 @@ require_once ("../queries/user.php"); session_start(); +$_SESSION["userID"] = 11; if(!isset($_SESSION["userID"])) { header("location:login.php?url=" . "$_SERVER[REQUEST_URI]"); } else { diff --git a/website/views/profile.php b/website/views/profile.php index 0cb5cc2..e9178f4 100644 --- a/website/views/profile.php +++ b/website/views/profile.php @@ -55,10 +55,17 @@

Vrienden

fetch()) { + $friendcount = $profile_friends->rowCount(); + $frienddif = $friendcount - 7; + + for ($i = 0; $i < min($friendcount, 7); $i += 1) { + $friend = $profile_friends->fetch(); echo "${friend["username"]}"; } + if ($frienddif > 0) { + echo $frienddif === 1 ? "en nog 1 andere." : "...en nog $frienddif anderen."; + } if($profile_friends->rowCount() === 0) { echo "

Deze gebruiker heeft nog geen vrienden gemaakt.

"; @@ -71,10 +78,18 @@

Groepen

fetch()) { + $groupcount = $profile_groups->rowCount(); + $groupdif = $groupcount - 7; + + for ($i = 0; $i < min($groupcount, 7); $i += 1) { + $group = $profile_groups->fetch(); echo "${group["name"]}s logo"; } + if ($groupdif > 0) { + echo $groupdif === 1 ? "en nog 1 andere." : "...en nog $groupdif anderen."; + } + if($profile_groups->rowCount() === 0) { echo "

Deze gebruiker is nog geen lid van een groep.

"; }