Merge branch 'hendrik-testing' into 'master'

Hendrik testing

See merge request !204
This commit was merged in pull request #208.
This commit is contained in:
Lars van Hijfte
2017-02-03 11:16:36 +01:00
8 changed files with 58 additions and 15 deletions

View File

@@ -24,12 +24,14 @@ $(window).on("load", function () {
}); });
}); });
// Toggles all checkboxes based on one.
function checkAll() { function checkAll() {
$('.checkbox-list').each(function () { $('.checkbox-list').each(function () {
$(this).prop('checked', $('#checkall').prop('checked')); $(this).prop('checked', $('#checkall').prop('checked'));
}); });
} }
// Simple function that checks if checkall should stay checked.
function checkCheckAll() { function checkCheckAll() {
var checked = true; var checked = true;
@@ -43,6 +45,7 @@ function checkCheckAll() {
$('#checkall').prop('checked', checked); $('#checkall').prop('checked', checked);
} }
// Toggle of filter options.
function changeFilter() { function changeFilter() {
if ($('#pagetype').find(":selected").val() == "group") { if ($('#pagetype').find(":selected").val() == "group") {
document.getElementById('admin-filter').style.display = 'none'; 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() { function searchFromOne() {
$('#currentpage').prop('value', 1); $('#currentpage').prop('value', 1);
adminSearch(); adminSearch();
} }
// AJAX live search.
function adminSearch() { function adminSearch() {
$.post( $.post(
"API/adminSearchUsers.php", "API/adminSearchUsers.php",
@@ -74,6 +79,7 @@ function adminSearch() {
}) })
} }
// AJAX live update.
function adminUpdate(form) { function adminUpdate(form) {
$.post( $.post(
"API/adminChangeUser.php", "API/adminChangeUser.php",
@@ -83,6 +89,7 @@ function adminUpdate(form) {
}) })
} }
// AJAX pagenumber functionality.
function updatePageN() { function updatePageN() {
$.post( $.post(
"API/adminPageNumber.php", "API/adminPageNumber.php",
@@ -92,11 +99,13 @@ function updatePageN() {
}) })
} }
// Intended for the edit button to show a form.
function toggleBancomment(button) { function toggleBancomment(button) {
$(button).siblings("div").toggle(); $(button).siblings("div").toggle();
$(button).toggle(); $(button).toggle();
} }
// AJAX value editing.
function editComment(form) { function editComment(form) {
$.post( $.post(
"API/adminChangeUser.php", "API/adminChangeUser.php",

View File

@@ -91,6 +91,21 @@ $(window).on("load", function() {
loadMorePosts(userID, groupID, postAmount, postLimit); 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() { function closeModal() {

View File

@@ -34,9 +34,10 @@
width: 100%; width: 100%;
} }
.usertable .table-username {width: 150px} .table-checkbox {width: 20px}
.usertable .table-status {width: 100px} .table-username {width: 150px}
.usertable .table-action {width: 200px} .table-status {width: 100px}
.table-action {width: 200px}
.usertable th, td { .usertable th, td {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
@@ -51,6 +52,10 @@
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.bancomment {
width: 80%;
}
.bancommentedit { .bancommentedit {
display: none; display: none;
} }

View File

@@ -216,6 +216,7 @@ function test_input($data) {
$data = trim($data); $data = trim($data);
$data = stripslashes($data); $data = stripslashes($data);
$data = htmlspecialchars($data); $data = htmlspecialchars($data);
$data = trim($data);
return $data; return $data;
} }

View File

@@ -3,7 +3,7 @@
<th class="table-username">Groepsnaam</th> <th class="table-username">Groepsnaam</th>
<th class="table-status">Status</th> <th class="table-status">Status</th>
<th class="table-comment">Beschrijving</th> <th class="table-comment">Beschrijving</th>
<th class="table-action">Actie</th> <th class="table-action">Zichtbaarheid</th>
</tr> </tr>
<?php <?php

View File

@@ -1,5 +1,4 @@
<!-- Form value holding. -->
<!-- function test_input taken from http://www.w3schools.com/php/php_form_validation.asp -->
<?php <?php
$search = ""; $search = "";
$status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner"); $status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner");
@@ -127,11 +126,11 @@ if (isset($_GET["groupstatus"])) {
if ($userinfo == 'owner') { if ($userinfo == 'owner') {
echo "<button type=\"submit\" echo "<button type=\"submit\"
name=\"batchactions\" name=\"batchactions\"
id=\"admin\" id=\"batch-admin\"
value=\"admin\">Maak Admin</button> value=\"admin\">Maak Admin</button>
<button type=\"submit\" <button type=\"submit\"
name=\"batchactions\" name=\"batchactions\"
id=\"owner\" id=\"batch-owner\"
value=\"owner\">Maak Eigenaar</button>"; value=\"owner\">Maak Eigenaar</button>";
} }
?> ?>
@@ -140,9 +139,9 @@ if (isset($_GET["groupstatus"])) {
onsubmit="adminUpdate(this); return false;"> onsubmit="adminUpdate(this); return false;">
<input type="hidden" name="groupbatchactions" id="groupbatchinput"> <input type="hidden" name="groupbatchactions" id="groupbatchinput">
<button type="submit" name="batchactions" id="hide" value="hidden">Verborgen</button> <button type="submit" name="batchactions" id="batch-hide" value="hidden">Verborgen</button>
<button type="submit" name="batchactions" id="ban" value="public">Publiek</button> <button type="submit" name="batchactions" id="batch-public" value="public">Publiek</button>
<button type="submit" name="batchactions" id="members" value="membersonly">Alleen Leden</button> <button type="submit" name="batchactions" id="batch-members" value="membersonly">Alleen Leden</button>
</form> </form>
</div> </div>
@@ -152,5 +151,3 @@ if (isset($_GET["groupstatus"])) {
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -26,6 +26,7 @@ require_once ("../queries/user.php");
session_start(); session_start();
$_SESSION["userID"] = 11;
if(!isset($_SESSION["userID"])) { if(!isset($_SESSION["userID"])) {
header("location:login.php?url=" . "$_SERVER[REQUEST_URI]"); header("location:login.php?url=" . "$_SERVER[REQUEST_URI]");
} else { } else {

View File

@@ -55,10 +55,17 @@
<h3>Vrienden</h3> <h3>Vrienden</h3>
<p> <p>
<?php <?php
while($friend = $profile_friends->fetch()) { $friendcount = $profile_friends->rowCount();
$frienddif = $friendcount - 7;
for ($i = 0; $i < min($friendcount, 7); $i += 1) {
$friend = $profile_friends->fetch();
echo "<a href='profile.php?username=${friend["username"]}' data-title='${friend["username"]}'><img class='profile-picture' height='42' width='42' src='${friend["profilepicture"]}' alt='${friend["username"]}' /></a>"; echo "<a href='profile.php?username=${friend["username"]}' data-title='${friend["username"]}'><img class='profile-picture' height='42' width='42' src='${friend["profilepicture"]}' alt='${friend["username"]}' /></a>";
} }
if ($frienddif > 0) {
echo $frienddif === 1 ? "en nog 1 andere." : "...en nog $frienddif anderen.";
}
if($profile_friends->rowCount() === 0) { if($profile_friends->rowCount() === 0) {
echo "<p>Deze gebruiker heeft nog geen vrienden gemaakt.</p>"; echo "<p>Deze gebruiker heeft nog geen vrienden gemaakt.</p>";
@@ -71,10 +78,18 @@
<h3>Groepen</h3> <h3>Groepen</h3>
<p> <p>
<?php <?php
while($group = $profile_groups->fetch()) { $groupcount = $profile_groups->rowCount();
$groupdif = $groupcount - 7;
for ($i = 0; $i < min($groupcount, 7); $i += 1) {
$group = $profile_groups->fetch();
echo "<a href='group.php?groupname=${group['name']}' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>"; echo "<a href='group.php?groupname=${group['name']}' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
} }
if ($groupdif > 0) {
echo $groupdif === 1 ? "en nog 1 andere." : "...en nog $groupdif anderen.";
}
if($profile_groups->rowCount() === 0) { if($profile_groups->rowCount() === 0) {
echo "<p>Deze gebruiker is nog geen lid van een groep.</p>"; echo "<p>Deze gebruiker is nog geen lid van een groep.</p>";
} }