diff --git a/website/public/API/sendMessage.php b/website/public/API/sendMessage.php index f84cb11..c5d47d1 100644 --- a/website/public/API/sendMessage.php +++ b/website/public/API/sendMessage.php @@ -3,7 +3,6 @@ session_start(); require_once("../../queries/connect.php"); require_once("../../queries/private_message.php"); -require_once("../../queries/friendship.php"); require_once("../../queries/checkInput.php"); if (!empty(test_input($_POST["destination"])) && diff --git a/website/queries/private_message.php b/website/queries/private_message.php index 369ee40..4d48d3a 100644 --- a/website/queries/private_message.php +++ b/website/queries/private_message.php @@ -30,6 +30,7 @@ function getOldChatMessages($user2ID) { } function sendMessage($destination, $content) { + require_once("friendship.php"); if (getFriendshipStatus($destination) == 1) { $stmt = $GLOBALS["db"]->prepare(" INSERT INTO @@ -58,6 +59,7 @@ function sendMessage($destination, $content) { } function getNewChatMessages($lastID, $destination) { + require_once("friendship.php"); if (getFriendshipStatus($destination) == 1) { $stmt = $GLOBALS["db"]->prepare(" SELECT @@ -91,13 +93,13 @@ function getNewChatMessages($lastID, $destination) { function selectAllUnreadChat() { $stmt = $GLOBALS["db"]->prepare(" SELECT - LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`, + LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`, `user`.`userID`, IFNULL( `profilepicture`, '../img/avatar-standard.png' ) AS profilepicture, - LEFT(`private_message`.`content`, 15) as `content` + LEFT(`private_message`.`content`, 15) AS `content` FROM `private_message`, `friendship`,