Also fixed unread chat

This commit is contained in:
Lars van Hijfte
2017-01-26 21:54:47 +01:00
parent 032e25b044
commit d89e672990
2 changed files with 4 additions and 3 deletions

View File

@@ -3,7 +3,6 @@
session_start(); 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/friendship.php");
require_once("../../queries/checkInput.php"); require_once("../../queries/checkInput.php");
if (!empty(test_input($_POST["destination"])) && if (!empty(test_input($_POST["destination"])) &&

View File

@@ -30,6 +30,7 @@ function getOldChatMessages($user2ID) {
} }
function sendMessage($destination, $content) { function sendMessage($destination, $content) {
require_once("friendship.php");
if (getFriendshipStatus($destination) == 1) { if (getFriendshipStatus($destination) == 1) {
$stmt = $GLOBALS["db"]->prepare(" $stmt = $GLOBALS["db"]->prepare("
INSERT INTO INSERT INTO
@@ -58,6 +59,7 @@ function sendMessage($destination, $content) {
} }
function getNewChatMessages($lastID, $destination) { function getNewChatMessages($lastID, $destination) {
require_once("friendship.php");
if (getFriendshipStatus($destination) == 1) { if (getFriendshipStatus($destination) == 1) {
$stmt = $GLOBALS["db"]->prepare(" $stmt = $GLOBALS["db"]->prepare("
SELECT SELECT
@@ -91,13 +93,13 @@ function getNewChatMessages($lastID, $destination) {
function selectAllUnreadChat() { function selectAllUnreadChat() {
$stmt = $GLOBALS["db"]->prepare(" $stmt = $GLOBALS["db"]->prepare("
SELECT SELECT
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`, LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
`user`.`userID`, `user`.`userID`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,
'../img/avatar-standard.png' '../img/avatar-standard.png'
) AS profilepicture, ) AS profilepicture,
LEFT(`private_message`.`content`, 15) as `content` LEFT(`private_message`.`content`, 15) AS `content`
FROM FROM
`private_message`, `private_message`,
`friendship`, `friendship`,