Compare commits
1 Commits
lars
...
hendrik-te
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f566c6eec4 |
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
include_once("../queries/group_page.php");
|
include_once("../queries/group_page.php");
|
||||||
|
|
||||||
if(isset($_SESSION["userID"]) and !$group = selectGroupByName($_GET["groupname"])) {
|
if(!$group = selectGroupByName($_GET["groupname"])) {
|
||||||
header("HTTP/1.0 404 Not Found");
|
header("HTTP/1.0 404 Not Found");
|
||||||
header("Location: error/404.php");
|
header("Location: error/404.php");
|
||||||
die();
|
die();
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ function sendMessage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#newContent").val("");
|
$("#newContent").val("");
|
||||||
$("#newContent").focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add messages to the chat.
|
// Add messages to the chat.
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Posts a comment or "Niet slecht." on a post.
|
||||||
|
* Button specifies between comment and "Niet slecht.".
|
||||||
|
* Alerts or redirects if frozen or not logged in.
|
||||||
|
*/
|
||||||
function postComment(buttonValue) {
|
function postComment(buttonValue) {
|
||||||
formData = $("#newcommentform").serializeArray();
|
formData = $("#newcommentform").serializeArray();
|
||||||
formData.push({name: "button", value: buttonValue});
|
formData.push({name: "button", value: buttonValue});
|
||||||
@@ -24,6 +29,10 @@ function postComment(buttonValue) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a post given by postID, closes modal and reloads posts.
|
||||||
|
* @param postID
|
||||||
|
*/
|
||||||
function deletePost(postID) {
|
function deletePost(postID) {
|
||||||
var formData = [{name: "postID", value: postID}];
|
var formData = [{name: "postID", value: postID}];
|
||||||
$.post(
|
$.post(
|
||||||
|
|||||||
0
website/public/js/profile.js
Normal file
0
website/public/js/profile.js
Normal file
@@ -1,3 +1,4 @@
|
|||||||
|
// Checks if user is logged in and offers to logout.
|
||||||
function checkLoggedIn() {
|
function checkLoggedIn() {
|
||||||
if (confirm("U bent al ingelogd!\nWilt u uitloggen?\nKlik ok om uit te loggen.") == true) {
|
if (confirm("U bent al ingelogd!\nWilt u uitloggen?\nKlik ok om uit te loggen.") == true) {
|
||||||
window.location.href = "logout.php";
|
window.location.href = "logout.php";
|
||||||
@@ -6,18 +7,22 @@ function checkLoggedIn() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alert for validation mail.
|
||||||
function emailAlert(){
|
function emailAlert(){
|
||||||
alert("Bevestigingsemail is gestuurd!\n");
|
alert("Bevestigingsemail is gestuurd!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alert for banned account.
|
||||||
function bannedAlert(){
|
function bannedAlert(){
|
||||||
alert("Uw account is geband!");
|
alert("Uw account is geband!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alert for frozen account.
|
||||||
function frozenAlert(){
|
function frozenAlert(){
|
||||||
alert("Uw account is bevroren!\n");
|
alert("Uw account is bevroren!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alert for unconfirmed email.
|
||||||
function emailNotConfirmed(){
|
function emailNotConfirmed(){
|
||||||
alert("Uw account is nog niet bevestigd!\nEr is een nieuwe email gestuurd om uw account te bevestigen");
|
alert("Uw account is nog niet bevestigd!\nEr is een nieuwe email gestuurd om uw account te bevestigen");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ if(empty($_GET["username"])) {
|
|||||||
$userID = getUserID($_GET["username"]);
|
$userID = getUserID($_GET["username"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$user = selectUser($_SESSION["userID"], $userID)) {
|
||||||
if (isset($_SESSION["userID"]) and !$user = selectUser($_SESSION["userID"], $userID)) {
|
|
||||||
header("HTTP/1.0 404 Not Found");
|
header("HTTP/1.0 404 Not Found");
|
||||||
header("Location: error/404.php");
|
header("Location: error/404.php");
|
||||||
die();
|
die();
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
|
.admin-panel {
|
||||||
|
min-width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
.admin-panel input[type="radio"], input[type="checkbox"] {
|
.admin-panel input[type="radio"], input[type="checkbox"] {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height: 14px;
|
height: 28px;
|
||||||
width: 14px;
|
margin: 2px;
|
||||||
margin: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-checkbox {
|
|
||||||
width: 28px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-searchform {
|
.admin-searchform {
|
||||||
@@ -44,7 +42,6 @@
|
|||||||
.usertable th, td {
|
.usertable th, td {
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.usertable th, tr {
|
.usertable th, tr {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ function updateGroupSettings(int $groupID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a user is an admin for a page.
|
* Checks if an user is an admin for a page.
|
||||||
* @param int $groupID
|
* @param int $groupID
|
||||||
* @param int $userID
|
* @param int $userID
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ function getUserID() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validateLogin($username, $password, $url){
|
function validateLogin($username, $password, $url){
|
||||||
// Empty username or password field
|
echo $url;
|
||||||
|
// Empty username or password field
|
||||||
if (empty($username) || empty($password)) {
|
if (empty($username) || empty($password)) {
|
||||||
throw new loginException("Inloggegevens zijn niet ingevuld");
|
throw new loginException("Inloggegevens zijn niet ingevuld");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a relative dutch and readable text when given a datetime.
|
|
||||||
* @param $date
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function nicetime($date) {
|
function nicetime($date) {
|
||||||
if(empty($date)) {
|
if(empty($date)) {
|
||||||
return "No date provided";
|
return "No date provided";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create dutch arrays so it has dutch words.
|
|
||||||
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
|
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
|
||||||
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
|
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
|
||||||
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
|
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
|
||||||
@@ -22,8 +15,7 @@ function nicetime($date) {
|
|||||||
return "Bad date";
|
return "Bad date";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it is in the future or not.
|
if($now > $unix_date) {
|
||||||
if($now >= $unix_date) {
|
|
||||||
$difference = $now - $unix_date;
|
$difference = $now - $unix_date;
|
||||||
$tense = "geleden";
|
$tense = "geleden";
|
||||||
} else {
|
} else {
|
||||||
@@ -31,7 +23,6 @@ function nicetime($date) {
|
|||||||
$tense = "vanaf nu";
|
$tense = "vanaf nu";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the nice time.
|
|
||||||
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
|
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
|
||||||
$difference /= $lengths[$i];
|
$difference /= $lengths[$i];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,6 @@
|
|||||||
|
|
||||||
require_once("connect.php");
|
require_once("connect.php");
|
||||||
|
|
||||||
/**
|
|
||||||
* Select all posts on a user.
|
|
||||||
* @param $userID
|
|
||||||
* @param $groupID
|
|
||||||
* @return bool|PDOStatement
|
|
||||||
*/
|
|
||||||
function selectAllPosts($userID, $groupID) {
|
function selectAllPosts($userID, $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -52,14 +46,6 @@ function selectAllPosts($userID, $groupID) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Select $limit posts from $offset from a user or group.
|
|
||||||
* @param $userID
|
|
||||||
* @param $groupID
|
|
||||||
* @param $offset
|
|
||||||
* @param $limit
|
|
||||||
* @return bool|PDOStatement
|
|
||||||
*/
|
|
||||||
function selectSomePosts($userID, $groupID, $offset, $limit) {
|
function selectSomePosts($userID, $groupID, $offset, $limit) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -108,13 +94,9 @@ function selectSomePosts($userID, $groupID, $offset, $limit) {
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
return $stmt;
|
return $stmt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Select all the post information from an postID.
|
|
||||||
* @param $postID
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function selectPostById($postID) {
|
function selectPostById($postID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -140,11 +122,6 @@ function selectPostById($postID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the comments from a post.
|
|
||||||
* @param $postID
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function selectCommentsByPostId($postID) {
|
function selectCommentsByPostId($postID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -171,13 +148,6 @@ function selectCommentsByPostId($postID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a post to a group or user
|
|
||||||
* @param $userID
|
|
||||||
* @param $groupID
|
|
||||||
* @param $title
|
|
||||||
* @param $content
|
|
||||||
*/
|
|
||||||
function makePost($userID, $groupID, $title, $content) {
|
function makePost($userID, $groupID, $title, $content) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -202,13 +172,6 @@ function makePost($userID, $groupID, $title, $content) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a comment by a post.
|
|
||||||
* @param $postID
|
|
||||||
* @param $userID
|
|
||||||
* @param $content
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function makeComment($postID, $userID, $content) : int {
|
function makeComment($postID, $userID, $content) : int {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -231,12 +194,6 @@ function makeComment($postID, $userID, $content) : int {
|
|||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If a post already is niet slechted.
|
|
||||||
* @param int $postID
|
|
||||||
* @param int $userID
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function makeNietSlecht(int $postID, int $userID) : int {
|
function makeNietSlecht(int $postID, int $userID) : int {
|
||||||
if (checkNietSlecht($postID, $userID)) {
|
if (checkNietSlecht($postID, $userID)) {
|
||||||
return deleteNietSlecht($postID, $userID);
|
return deleteNietSlecht($postID, $userID);
|
||||||
@@ -245,12 +202,6 @@ function makeNietSlecht(int $postID, int $userID) : int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggle a niet slecht of a post.
|
|
||||||
* @param int $postID
|
|
||||||
* @param int $userID
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function checkNietSlecht(int $postID, int $userID) {
|
function checkNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -267,12 +218,6 @@ function checkNietSlecht(int $postID, int $userID) {
|
|||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a niet slecht to a post.
|
|
||||||
* @param int $postID
|
|
||||||
* @param int $userID
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function addNietSlecht(int $postID, int $userID) {
|
function addNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
@@ -285,12 +230,6 @@ function addNietSlecht(int $postID, int $userID) {
|
|||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete a niet slecht.
|
|
||||||
* @param int $postID
|
|
||||||
* @param int $userID
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function deleteNietSlecht(int $postID, int $userID) {
|
function deleteNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
@@ -305,11 +244,6 @@ function deleteNietSlecht(int $postID, int $userID) {
|
|||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete a post
|
|
||||||
* @param int $postID
|
|
||||||
* @param int $userID
|
|
||||||
*/
|
|
||||||
function deletePost(int $postID, int $userID) {
|
function deletePost(int $postID, int $userID) {
|
||||||
if (checkPermissionOnPost($postID, $userID)) {
|
if (checkPermissionOnPost($postID, $userID)) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
@@ -323,12 +257,6 @@ function deletePost(int $postID, int $userID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a user has premissions to delete a post.
|
|
||||||
* @param int $postID
|
|
||||||
* @param int $userID
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
function checkPermissionOnPost(int $postID, int $userID) : bool {
|
function checkPermissionOnPost(int $postID, int $userID) : bool {
|
||||||
$getGroupID = prepareQuery("
|
$getGroupID = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -354,10 +282,10 @@ function checkPermissionOnPost(int $postID, int $userID) : bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns role of a user.
|
* Returns role of an user.
|
||||||
* @param int $userID
|
* @param int $userID
|
||||||
* @param int $groupID
|
* @param int $groupID
|
||||||
* @return mixed role of a user.
|
* @return mixed role of an user.
|
||||||
*/
|
*/
|
||||||
function getRoleInGroup(int $userID, int $groupID) {
|
function getRoleInGroup(int $userID, int $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the the last 100 chat messages.
|
|
||||||
* @param $user2ID
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function getOldChatMessages($user2ID) {
|
function getOldChatMessages($user2ID) {
|
||||||
require_once ("friendship.php");
|
require_once ("friendship.php");
|
||||||
$user1ID = $_SESSION["userID"];
|
$user1ID = $_SESSION["userID"];
|
||||||
@@ -41,12 +36,6 @@ function getOldChatMessages($user2ID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a chat message.
|
|
||||||
* @param $destination
|
|
||||||
* @param $content
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
function sendMessage($destination, $content) {
|
function sendMessage($destination, $content) {
|
||||||
require_once("friendship.php");
|
require_once("friendship.php");
|
||||||
if (getFriendshipStatus($destination) == 1) {
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
@@ -76,12 +65,6 @@ function sendMessage($destination, $content) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the chat messages after an messageID ($lastID).
|
|
||||||
* @param $lastID
|
|
||||||
* @param $destination
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function getNewChatMessages($lastID, $destination) {
|
function getNewChatMessages($lastID, $destination) {
|
||||||
require_once("friendship.php");
|
require_once("friendship.php");
|
||||||
if (getFriendshipStatus($destination) == 1) {
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
@@ -113,10 +96,7 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get of every friend the first unread chat message.
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function selectAllUnreadChat() {
|
function selectAllUnreadChat() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
require_once ("connect.php");
|
require_once ("connect.php");
|
||||||
|
|
||||||
/**
|
|
||||||
* This sets the last activity of the session user to now.
|
|
||||||
* @return bool, true is it ran correctly
|
|
||||||
*/
|
|
||||||
function updateLastActivity() {
|
function updateLastActivity() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -19,11 +15,6 @@ function updateLastActivity() {
|
|||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This gets the userID from a username
|
|
||||||
* @param $username
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
function getUserID($username) {
|
function getUserID($username) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -39,11 +30,6 @@ function getUserID($username) {
|
|||||||
return $stmt->fetch()["userID"];
|
return $stmt->fetch()["userID"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This gets the username from a userID
|
|
||||||
* @param $userID
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
function getUsername($userID) {
|
function getUsername($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -59,12 +45,6 @@ function getUsername($userID) {
|
|||||||
return $stmt->fetch()["username"];
|
return $stmt->fetch()["username"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This selects the information about the other user and the connection between the two.
|
|
||||||
* @param $me
|
|
||||||
* @param $other
|
|
||||||
* @return bool|mixed
|
|
||||||
*/
|
|
||||||
function selectUser($me, $other) {
|
function selectUser($me, $other) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -127,11 +107,6 @@ function selectUser($me, $other) {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Select all the users from a group.
|
|
||||||
* @param $userID
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function selectAllUserGroups($userID) {
|
function selectAllUserGroups($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -155,11 +130,6 @@ function selectAllUserGroups($userID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Selects 20 users from a given point in the table, ordered by role and name
|
|
||||||
* @param $n
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function select20UsersFromN($n) {
|
function select20UsersFromN($n) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -185,12 +155,6 @@ function select20UsersFromN($n) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Search 20 users from a given point in the table, ordered by role and name
|
|
||||||
* @param $n
|
|
||||||
* @param $keyword
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function search20UsersFromN($n, $keyword) {
|
function search20UsersFromN($n, $keyword) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -219,13 +183,6 @@ function search20UsersFromN($n, $keyword) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Search 20 users from a given point in the database where the status @param $status
|
|
||||||
* @param $n
|
|
||||||
* @param $keyword
|
|
||||||
* @param $status
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function search20UsersFromNByStatus($n, $keyword, $status) {
|
function search20UsersFromNByStatus($n, $keyword, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -258,14 +215,6 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Search users from a given point in the database where the status @param $status
|
|
||||||
* @param $n
|
|
||||||
* @param $m
|
|
||||||
* @param $search
|
|
||||||
* @param $status
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function searchSomeUsersByStatus($n, $m, $search, $status) {
|
function searchSomeUsersByStatus($n, $m, $search, $status) {
|
||||||
// parentheses not needed in where clause, for clarity as
|
// parentheses not needed in where clause, for clarity as
|
||||||
// role search should override status filter.
|
// role search should override status filter.
|
||||||
@@ -303,12 +252,6 @@ function searchSomeUsersByStatus($n, $m, $search, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Count the users with a name like $search and a $status
|
|
||||||
* @param $search
|
|
||||||
* @param $status
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function countSomeUsersByStatus($search, $status) {
|
function countSomeUsersByStatus($search, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -333,12 +276,7 @@ function countSomeUsersByStatus($search, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the user status
|
|
||||||
* @param $id
|
|
||||||
* @param $status
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function changeUserStatusByID($id, $status) {
|
function changeUserStatusByID($id, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -355,12 +293,6 @@ function changeUserStatusByID($id, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Change multiple user statuses by an id array.
|
|
||||||
* @param $ids
|
|
||||||
* @param $status
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function changeMultipleUserStatusByID($ids, $status) {
|
function changeMultipleUserStatusByID($ids, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -378,13 +310,6 @@ function changeMultipleUserStatusByID($ids, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Change multiple user statuses by an id array.
|
|
||||||
* This excludes that admins and owners statuses can be changed.
|
|
||||||
* @param $ids
|
|
||||||
* @param $status
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function changeMultipleUserStatusByIDAdmin($ids, $status) {
|
function changeMultipleUserStatusByIDAdmin($ids, $status) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
@@ -404,11 +329,6 @@ function changeMultipleUserStatusByIDAdmin($ids, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Select a random user that is nog your friend.
|
|
||||||
* @param $userID
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
function selectRandomNotFriendUser($userID) {
|
function selectRandomNotFriendUser($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -437,13 +357,6 @@ function selectRandomNotFriendUser($userID) {
|
|||||||
return $stmt->fetch();
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Search users.
|
|
||||||
* @param $n
|
|
||||||
* @param $m
|
|
||||||
* @param $search
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function searchSomeUsers($n, $m, $search) {
|
function searchSomeUsers($n, $m, $search) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -484,11 +397,6 @@ function searchSomeUsers($n, $m, $search) {
|
|||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Count the users that you get searching for a user with a keyword.
|
|
||||||
* @param $search
|
|
||||||
* @return PDOStatement
|
|
||||||
*/
|
|
||||||
function countSomeUsers($search) {
|
function countSomeUsers($search) {
|
||||||
$q = prepareQuery("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -512,11 +420,6 @@ function countSomeUsers($search) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the role of a user by userID.
|
|
||||||
* @param $userID
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
function getRoleByID($userID) {
|
function getRoleByID($userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -532,11 +435,6 @@ function getRoleByID($userID) {
|
|||||||
return $stmt->fetch()["role"];
|
return $stmt->fetch()["role"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit the ban comment.
|
|
||||||
* @param $userID
|
|
||||||
* @param $comment
|
|
||||||
*/
|
|
||||||
function editBanCommentByID($userID, $comment) {
|
function editBanCommentByID($userID, $comment) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="table-checkbox"><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()"></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>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
// Checks if there's a user already logged in
|
// Checks if there's an user already logged in
|
||||||
if(isset($_SESSION["userID"])){
|
if(isset($_SESSION["userID"])){
|
||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload=checkLoggedIn();
|
window.onload=checkLoggedIn();
|
||||||
|
|||||||
Reference in New Issue
Block a user