From f9f1e2bf173ee75f6eb9dbb8c94e0bd9ef078cf3 Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Tue, 24 Jan 2017 16:40:30 +0100 Subject: [PATCH 1/4] Changed select posts query. --- website/queries/user.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/website/queries/user.php b/website/queries/user.php index 18cd3f6..25bbf0e 100644 --- a/website/queries/user.php +++ b/website/queries/user.php @@ -68,18 +68,24 @@ function selectAllUserGroups($userID) { function selectAllUserPosts($userID) { $stmt = $GLOBALS["db"]->prepare(" SELECT - `postID`, - `author`, - `title`, - `content`, - `creationdate` + `postID`, + `author`, + `title`, + CASE LENGTH(`content`) >= 150 + WHEN TRUE THEN + CONCAT(LEFT(`content`, 150), '...') + WHEN FALSE THEN + `content` + END + AS `content`, + `creationdate` FROM - `post` + `post` WHERE - `author` = :userID AND - `groupID` IS NULL + `author` = :userID AND + `groupID` IS NULL ORDER BY - `creationdate` DESC + `creationdate` DESC "); $stmt->bindParam(':userID', $userID, PDO::PARAM_INT); From 70957015ceb57b7d363b9277c17942dee03cd74e Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Tue, 24 Jan 2017 16:51:34 +0100 Subject: [PATCH 2/4] Fixed links to friends on profile page. --- website/views/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/views/profile.php b/website/views/profile.php index 19bd908..1080290 100644 --- a/website/views/profile.php +++ b/website/views/profile.php @@ -14,7 +14,7 @@

fetch()) { - echo "${friend["username"]}"; + echo "${friend["username"]}"; } From de03d8799a2ce018e3f62ac8da30459ef76787ee Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Tue, 24 Jan 2017 16:58:51 +0100 Subject: [PATCH 3/4] Fixed placeholder for new post. --- website/views/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/views/profile.php b/website/views/profile.php index 2bc0341..0b2f4f2 100644 --- a/website/views/profile.php +++ b/website/views/profile.php @@ -60,7 +60,7 @@

- +
From 7144d700e4c3d805b4d85f68b7d20e93e68d966b Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Tue, 24 Jan 2017 17:02:49 +0100 Subject: [PATCH 4/4] Removed debug echo from profile page. --- website/public/profile.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/website/public/profile.php b/website/public/profile.php index 439f74a..4f9d680 100644 --- a/website/public/profile.php +++ b/website/public/profile.php @@ -20,8 +20,6 @@ if(empty($_GET["username"])) { $userID = getUserID($_GET["username"]); } -echo "User ID: $userID"; - $user = selectUser($_SESSION["userID"], $userID); $profile_friends = selectAllFriends($userID); $profile_groups = selectAllUserGroups($userID);