Merge branch 'lars' into 'master'
Lars See merge request !159
This commit was merged in pull request #163.
This commit is contained in:
@@ -16,6 +16,10 @@ function selectLimitedFriends($userID, $limit) {
|
||||
`profilepicture`,
|
||||
'../img/avatar-standard.png'
|
||||
) AS profilepicture,
|
||||
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
|
||||
WHEN TRUE THEN 'online'
|
||||
WHEN FALSE THEN 'offline'
|
||||
END AS `onlinestatus`,
|
||||
`role`
|
||||
FROM
|
||||
`user`
|
||||
@@ -28,11 +32,8 @@ function selectLimitedFriends($userID, $limit) {
|
||||
`friendship`.`user1ID` = `user`.`userID`) AND
|
||||
`user`.`role` != 'banned' AND
|
||||
`friendship`.`status` = 'confirmed'
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN `friendship`.`user2ID` = `user`.`userID` THEN `friendship`.`chatLastVisted1`
|
||||
WHEN `friendship`.`user1ID` = `user`.`userID` THEN `friendship`.`chatLastVisted2`
|
||||
END
|
||||
ORDER BY
|
||||
`user`.`lastactivity`
|
||||
DESC
|
||||
LIMIT :limitCount
|
||||
");
|
||||
|
||||
@@ -16,6 +16,8 @@ function getOldChatMessages($user2ID) {
|
||||
`destination` = :user1
|
||||
ORDER BY
|
||||
`creationdate` ASC
|
||||
LIMIT
|
||||
100
|
||||
");
|
||||
|
||||
$stmt->bindParam(":user1", $user1ID);
|
||||
|
||||
@@ -2,6 +2,19 @@
|
||||
|
||||
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) {
|
||||
$stmt = prepareQuery("
|
||||
SELECT
|
||||
@@ -363,5 +376,5 @@ function getRoleByID($userID) {
|
||||
|
||||
$stmt->bindParam(':userID', $userID);
|
||||
$stmt->execute();
|
||||
return $stmt;
|
||||
return $stmt->fetch()["role"];
|
||||
}
|
||||
Reference in New Issue
Block a user