");
+ $post.append($("
").text(this["title"]));
+ $post.append($("
").html(this["content"]));
+ $post.append($("
").text(this["nicetime"]));
- $("div.posts div.column").width(100/columnCount + "%");
+ shortestColumn = getShortestColumn(columns);
+ shortestColumn[1].append($post);
+ shortestColumn[0] = shortestColumn[0] + $post.height() + margin;
+ });
+ });
+}
- $(".modal-close").click(function () {
- $(".modal").hide();
- scrollbarMargin(0, 'auto');
- $('#modal-response').hide();
- $('.modal-default').show();
- });
-}
\ No newline at end of file
diff --git a/website/public/js/menu.js b/website/public/js/menu.js
index 32b048a..8329cde 100644
--- a/website/public/js/menu.js
+++ b/website/public/js/menu.js
@@ -1,39 +1,108 @@
+
$(document).ready(function() {
- $(".extra-menu-items").hide();
- $("#menu-back").hide();
+ // Show more friends/users
// Show more friends
- $("#more-friends-click").click(function() {
- // Show only friends
- $("#groups-menu-section").slideUp();
- $("#friends-menu-section li").show();
+ // $("#more-friends-click").click(function() {
+ // // Show only friends
+ // $("#groups-menu-section").slideUp();
+ // $("#friends-menu-section li").show();
+ //
+ // // Change buttons
+ // $("#more-friends-click").hide();
+ // $("#menu-back").show();
+ // });
+ //
+ // // Show more groups
+ // $("#more-groups-click").click(function() {
+ // // Show only groups
+ // $("#friends-menu-section").slideUp();
+ // $("#groups-menu-section li").show();
+ //
+ // // Change buttons
+ // $("#more-groups-click").hide();
+ // $("#menu-back").show();
+ // });
- // Change buttons
- $("#more-friends-click").hide();
- $("#menu-back").show();
- });
+ // // Go back
+ // $("#menu-back").click(function() {
+ // // Show overview of friends and groups
+ // $("#friends-menu-section").slideDown();
+ // $("#groups-menu-section").slideDown();
+ // $(".extra-menu-items").hide();
+ //
+ // // Change buttons
+ // $("#menu-back").hide();
+ // $("#more-groups-click").show();
+ // $("#more-friends-click").show();
+ // });
- // Show more groups
- $("#more-groups-click").click(function() {
- // Show only groups
- $("#friends-menu-section").slideUp();
- $("#groups-menu-section li").show();
-
- // Change buttons
- $("#more-groups-click").hide();
- $("#menu-back").show();
- });
-
- // Go back
- $("#menu-back").click(function() {
- // Show overview of friends and groups
- $("#friends-menu-section").slideDown();
- $("#groups-menu-section").slideDown();
- $(".extra-menu-items").hide();
-
- // Change buttons
- $("#menu-back").hide();
- $("#more-groups-click").show();
- $("#more-friends-click").show();
- });
+ loadMenuFriends(5);
+ loadNotificationFriends();
+ loadUnreadMessages();
+ loadMenuGroups();
});
+
+
+function loadMenuFriends(limit) {
+ $.post(
+ "API/loadFriends.php",
+ {
+ limit: 5
+ }
+ ).done(function(data) {
+ if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
+ $("#friends-menu-section").show();
+ } else {
+ $("#friends-menu-section").hide();
+ }
+ });
+
+ setTimeout(loadMenuFriends, 3000, limit);
+}
+
+function loadMenuGroups() {
+ $.post(
+ "API/loadGroups.php",
+ {
+ limit: 5
+ }
+ ).done(function(data) {
+ if (showGroups(data, "#menu-groups-list")) {
+ $("#groups-menu-section").show();
+ } else {
+ $("#groups-menu-section").hide();
+ }
+ });
+
+ setTimeout(loadMenuGroups, 3000);
+}
+
+function loadNotificationFriends() {
+ $.post(
+ "API/loadFriendRequest.php"
+ ).done(function(data) {
+ if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
+ $("#friend-request-section").show();
+ } else {
+ $("#friend-request-section").hide();
+ }
+ });
+
+ setTimeout(loadNotificationFriends, 3000);
+}
+
+function loadUnreadMessages() {
+ $.post(
+ "API/loadChatNotifications.php"
+ ).done(function(data) {
+ if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
+ console.log(data);
+ $("#unread-messages-section").show();
+ } else {
+ $("#unread-messages-section").hide();
+ }
+ });
+
+ setTimeout(loadUnreadMessages, 3000);
+}
\ No newline at end of file
diff --git a/website/public/js/notifications.js b/website/public/js/notifications.js
index afcaca0..d78d167 100644
--- a/website/public/js/notifications.js
+++ b/website/public/js/notifications.js
@@ -1,89 +1,43 @@
-function showFriendNotifications(notifications) {
- $("#friendrequestslist").html("");
- for (i in notifications) {
- var outgoing = "";
- if (notifications[i].friend_state == "3") {
- outgoing = "";
- }
-
- $("#friendrequestslist").append(" \
-
\
- \
- \
-
\
- \
- ");
- }
-}
-
-function showChatNotifications(notifications) {
- $("#unreadChatlist").html("");
- for (i in notifications) {
- $("#unreadChatlist").append(" \
-
\
- \
- \
- ");
- }
-}
-
-function loadNotifications() {
- $.post(
- "API/loadFriendRequestNotifications.php"
- ).done(function(data) {
- if (data && data != "[]") {
- showFriendNotifications(JSON.parse(data));
- }
- });
- $.post(
- "API/loadChatNotifications.php"
- ).done(function(data) {
- if (data && data != "[]") {
- showChatNotifications(JSON.parse(data));
- }
- });
-
- setTimeout(loadNotifications, 10000);
-}
-$(document).ready(function() {
- loadNotifications();
-});
+// function showChatNotifications(notifications) {
+// $("#unreadChatlist").html("");
+// for (i in notifications) {
+// $("#unreadChatlist").append(" \
+//
\
+// \
+// \
+// ");
+// }
+// }
+//
+// function loadNotifications() {
+// $.post(
+// "API/loadChatNotifications.php"
+// ).done(function(data) {
+// if (data && data != "[]") {
+// $("#unread-messages-section").show();
+// showChatNotifications(JSON.parse(data));
+// } else {
+// $("#unread-messages-section").hide();
+// }
+// });
+//
+// setTimeout(loadNotifications, 10000);
+// }
+// $(document).ready(function() {
+// loadNotifications();
+// });
diff --git a/website/public/js/registerAndLogin.js b/website/public/js/registerAndLogin.js
index ef49e83..b2fda05 100644
--- a/website/public/js/registerAndLogin.js
+++ b/website/public/js/registerAndLogin.js
@@ -12,4 +12,4 @@ function bannedAlert(){
function emailNotConfirmed(){
alert("Your account has not been verified yet!\nAnother email has been sent to you")
-}
\ No newline at end of file
+}
diff --git a/website/public/login.php b/website/public/login.php
index de4ecab..0515793 100644
--- a/website/public/login.php
+++ b/website/public/login.php
@@ -6,6 +6,8 @@
include_once("../queries/login.php");
include_once("../queries/checkInput.php");
include_once("../queries/emailconfirm.php");
+ include_once("../queries/requestpassword.php");
+ include_once("../queries/register.php");
?>
getMessage();
+ switch ($_POST["submit"]) {
+ case "login":
+ try {
+ $uname = ($_POST["uname"]);
+ validateLogin($_POST["uname"], $_POST["psw"]);
+ } catch(loginException $e) {
+ $loginErr = $e->getMessage();
+ }
+ break;
+ case "reset":
+ try {
+ resetEmail($_POST["forgotEmail"]);
+ sendPasswordRecovery($_POST["forgotEmail"]);
+ } catch (emailException $e){
+ $resetErr = $e->getMessage();
+ echo "";
+ }
+ break;
+
}
}
+// // Trying to login
+// if ($_SERVER["REQUEST_METHOD"] == "POST") {
+// try{
+// $uname = ($_POST["uname"]);
+// validateLogin($_POST["uname"], $_POST["psw"]);
+// } catch(loginException $e) {
+// $loginErr = $e->getMessage();
+// }
+// }
/* This view adds login view */
include("../views/login-view.php");
diff --git a/website/public/profile.php b/website/public/profile.php
index c8f27c4..a79ad4c 100644
--- a/website/public/profile.php
+++ b/website/public/profile.php
@@ -2,6 +2,7 @@
+
+
+
+
+
+
+ ");
+
+ echo $webpage;
+ }
\ No newline at end of file
diff --git a/website/views/notification-center.php b/website/views/notification-center.php
index 037b4ae..8c01217 100644
--- a/website/views/notification-center.php
+++ b/website/views/notification-center.php
@@ -5,19 +5,19 @@
-
+
-
+
diff --git a/website/views/profile.php b/website/views/profile.php
index 404d957..54f028d 100644
--- a/website/views/profile.php
+++ b/website/views/profile.php
@@ -2,21 +2,10 @@
-
-
-
-
- fetch()) {
- $nicetime = nicetime($post["creationdate"]);
- $postID = $post["postID"];
- echo "
-
-
${post["title"]}
-
${post["content"]}
-
${nicetime} geplaatst.
-
-
- ";
- }
- ?>
diff --git a/website/views/register-view.php b/website/views/register-view.php
index f970a6f..5f39472 100644
--- a/website/views/register-view.php
+++ b/website/views/register-view.php
@@ -126,7 +126,7 @@
-
Login
+
Annuleren