From b66c108f4ec105ed990c804581197b03beb2ac52 Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Thu, 26 Jan 2017 14:31:45 +0100 Subject: [PATCH 1/3] Fixed post titles for htmlchars. --- website/public/js/masonry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/public/js/masonry.js b/website/public/js/masonry.js index 0b31443..6b91e4b 100644 --- a/website/public/js/masonry.js +++ b/website/public/js/masonry.js @@ -100,7 +100,7 @@ function masonry(mode) { */ jQuery.each(posts, function() { $post = $("
"); - $post.append($("

").text(this["title"])); + $post.append($("

").html(this["title"])); $post.append($("

").html(this["content"])); $post.append($("

").text(this["nicetime"])); From 59fc65e27af9a388497dbdfb067f5dd7055c46d0 Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Thu, 26 Jan 2017 16:09:18 +0100 Subject: [PATCH 2/3] Made small changes to posts, added amount of comments and niet slechts --- website/public/js/masonry.js | 7 +++---- website/queries/user.php | 30 +++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/website/public/js/masonry.js b/website/public/js/masonry.js index f30139c..f30f0af 100644 --- a/website/public/js/masonry.js +++ b/website/public/js/masonry.js @@ -70,9 +70,7 @@ function masonry(mode) { $form.append($("")); columns[0][1].append($postInput); - $postInput.on("load", function() { - columns[0][0] = $postInput.height() + margin; - }); + columns[0][0] = $postInput.height() + margin; } /* @@ -99,11 +97,12 @@ function masonry(mode) { /* * Rearange the objects. */ - jQuery.each(posts, function() { + $.each(posts, function() { $post = $("

"); $post.append($("

").html(this["title"])); $post.append($("

").html(this["content"])); $post.append($("

").text(this["nicetime"])); + $post.append($("

").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"])); shortestColumn = getShortestColumn(columns); shortestColumn[1].append($post); diff --git a/website/queries/user.php b/website/queries/user.php index 4a7ee57..9c23721 100644 --- a/website/queries/user.php +++ b/website/queries/user.php @@ -105,24 +105,36 @@ function selectAllUserGroups($userID) { function selectAllUserPosts($userID) { $stmt = $GLOBALS["db"]->prepare(" SELECT - `postID`, - `author`, + `post`.`postID`, + `post`.`author`, `title`, - CASE LENGTH(`content`) >= 150 AND `content` NOT LIKE '= 150 AND `post`.`content` NOT LIKE 'bindParam(':userID', $userID, PDO::PARAM_INT); From 8da1469ca90dc31897c2db79fad270e2326b1f97 Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Fri, 27 Jan 2017 16:05:45 +0100 Subject: [PATCH 3/3] Started with group page. --- website/public/group.php | 11 +++++++ website/queries/group_page.php | 53 ++++++++++++++++++++++++++++++++++ website/views/group.php | 40 ++++++------------------- 3 files changed, 73 insertions(+), 31 deletions(-) diff --git a/website/public/group.php b/website/public/group.php index ee20feb..fa45090 100644 --- a/website/public/group.php +++ b/website/public/group.php @@ -8,6 +8,17 @@ + + +prepare(" + SELECT + `group_page`.`groupID`, + `name`, + `description`, + `picture`, + `status`, + COUNT(`group_member`.`groupID`) as `members` + FROM + `group_page` + LEFT JOIN + `group_member` + ON + `group_page`.`groupID` = `group_member`.`groupID` + WHERE + name LIKE :name + "); + + $stmt->bindParam(':name', $name); + if (!$stmt->execute()) { + return False; + } + return $stmt->fetch(); +} + +function selectGroupMembers(int $groupID) { + $stmt = $GLOBALS["db"]->prepare(" + SELECT + `username`, + `fname`, + `lname`, + `profilepicture` + FROM + `group_member` + LEFT JOIN + `user` + ON + `group_member`.`userID` = `user`.`userID` + WHERE + `groupID` = :groupID + LIMIT 20 + "); + + $stmt->bindParam(':groupID', $groupID); + if (!$stmt->execute()) { + return False; + } + return $stmt->fetchAll(); +} + function selectGroupById($groupID) { $q = $GLOBALS["db"]->prepare(" SELECT diff --git a/website/views/group.php b/website/views/group.php index c8ed118..b2098c7 100644 --- a/website/views/group.php +++ b/website/views/group.php @@ -1,43 +1,21 @@

- +

Groep verlaten

-

[groepnaam]

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dictum turpis quam, eu ultrices sapien hendrerit tincidunt. Nunc aliquam neque turpis, id porta quam iaculis id. Sed suscipit, nisl a fermentum congue, nunc augue finibus lectus, id varius nunc purus nec dolor. Integer laoreet tellus sit amet sapien auctor congue. Mauris laoreet eu elit vel rhoncus. Nam et tortor arcu. Maecenas sit amet leo quis tellus varius gravida. Sed quis fermentum odio, sed dictum nulla. Donec aliquam rutrum orci cursus tempus. Quisque sit amet ipsum eget velit aliquam facilisis ultricies quis ligula. Nunc nisi lacus, luctus non bibendum quis, sagittis sit amet odio.

+

+

-

Leden

+

Leden ()

- [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - [gebruikersnaam]'s profielfoto - - ...en nog 25 anderen! + \"""; + } + ?>