\
\
diff --git a/website/public/js/friendButtons.js b/website/public/js/friendButtons.js
index d62e919..47c476a 100644
--- a/website/public/js/friendButtons.js
+++ b/website/public/js/friendButtons.js
@@ -48,9 +48,6 @@ function placeFriendButtons() {
text2 = "Weiger";
icon2 = "fa-times";
break;
- default:
- console.log(friendshipStatus);
- break;
}
$buttonContainer.append(
diff --git a/website/public/js/header.js b/website/public/js/header.js
index bdf5fe3..13e3e12 100644
--- a/website/public/js/header.js
+++ b/website/public/js/header.js
@@ -1,25 +1,37 @@
$(document).ready(function() {
// Toggle menu
$("#own-profile-picture, #open-notifications").click(function() {
- if ($("#notification-center").css('right') == "-256px") {
- // Make the menu visible and move the content to the left.
- $("#chat-history").width("calc(100% - 587px)");
- $(".modal").width("calc(100% - 512px)");
- $(".content").css("margin-right", "256px");
- $("#notification-center").css("right", "0px");
+ if ($("#notification-center").css('display') == "none") {
+ // Make the menu visible and move the content to the left.
+ $(".modal").width("calc(100% - 512px)");
+ $(".content").css("margin-right", "256px");
+ $("#notification-center").css("right", "0px");
+ $("#notification-center").css("display", "block");
+ $("#contact-menu").css("display", "block");
- // Add cookie so the menu stays open on other pages
- document.cookie = "menu=open; path=/";
- } else {
- // Make the menu invisible and move the content to the right.
- $("#chat-history").width("calc(100% - 331px)");
- $(".modal").width("calc(100% - 256px)");
- $(".content").css("margin-right", "0px");
- $("#notification-center").css("right", "-256px");
+ // Add cookie so the menu stays open on other pages
+ if (window.innerWidth > 1080) {
+ $("#chat-history").width("calc(100% - 587px)");
+ document.cookie = "menu=open; path=/";
+ } else {
+ document.cookie = "menu=closed; path=/";
+ }
+ } else {
+ $(".modal").width("calc(100% - 256px)");
+ $(".content").css("margin-right", "0px");
+ $("#notification-center").css("display", "none");
- // Change menu cookie to close
- document.cookie = "menu=closed; path=/";
- }
+ if (window.innerWidth > 1080) {
+ $("#chat-history").width("calc(100% - 331px)");
+ } else {
+ // Make the menu invisible and move the content to the right.
+ $("#contact-menu").css("display", "none");
+ }
+
+ // Change menu cookie to close
+ document.cookie = "menu=closed; path=/";
+
+ }
});
if (getCookie("menu") == "open") {
diff --git a/website/public/register(stash).php b/website/public/register(stash).php
index 0077e62..99ebc02 100644
--- a/website/public/register(stash).php
+++ b/website/public/register(stash).php
@@ -10,6 +10,7 @@
diff($today);
+ return $interval->y;
+}
\ No newline at end of file
diff --git a/website/queries/friendship.php b/website/queries/friendship.php
index 038752d..450fd20 100644
--- a/website/queries/friendship.php
+++ b/website/queries/friendship.php
@@ -16,7 +16,6 @@ function selectLimitedFriends($userID, $limit) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
- `onlinestatus`,
`role`
FROM
`user`
@@ -56,7 +55,10 @@ function selectAllFriends($userID) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
- `onlinestatus`,
+ CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
+ WHEN TRUE THEN 'online'
+ WHEN FALSE THEN 'offline'
+ END AS `onlinestatus`,
`role`
FROM
`user`
@@ -88,7 +90,10 @@ function selectAllFriendRequests() {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
- `onlinestatus`,
+ CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
+ WHEN TRUE THEN 'online'
+ WHEN FALSE THEN 'offline'
+ END AS `onlinestatus`,
`role`
FROM
`user`
@@ -235,7 +240,10 @@ function searchSomeFriends($n, $m, $search) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
- `onlinestatus`,
+ CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
+ WHEN TRUE THEN 'online'
+ WHEN FALSE THEN 'offline'
+ END AS `onlinestatus`,
`role`
FROM
`user`
diff --git a/website/queries/settings.php b/website/queries/settings.php
index f4c5403..bdc9d38 100644
--- a/website/queries/settings.php
+++ b/website/queries/settings.php
@@ -110,20 +110,31 @@ function updateSettings() {
WHERE
`userID` = :userID
");
+ $bday = new DateTime();
+ $bday->setDate(test_input($_POST["year"]), test_input($_POST["month"]), test_input($_POST["day"]));
+ checkBday($bday);
$stmt->bindValue(":fname", test_input($_POST["fname"]));
$stmt->bindValue(":lname", test_input($_POST["lname"]));
$stmt->bindValue(":location", test_input($_POST["location"]));
- $stmt->bindValue(":bday", test_input($_POST["bday"]));
+ $stmt->bindValue(":bday", $bday->format("Ymd"));
$stmt->bindValue(":bio", test_input($_POST["bio"]));
- $stmt->bindValue(":showEmail", test_input($_POST["showEmail"]));
- $stmt->bindValue(":showBday", test_input($_POST["showBday"]));
+ $stmt->bindValue(":showEmail", (array_key_exists("showEmail", $_POST) ? "1" : "0"));
+ $stmt->bindValue(":showBday", (array_key_exists("showBday", $_POST) ? "1" : "0"));
$stmt->bindValue(":userID", $_SESSION["userID"]);
$stmt->execute();
throw new HappyAlert("Instellingen zijn opgeslagen.");
}
+function checkBday(DateTime $bday) {
+ $today = new DateTime();
+ if ($bday >= $today) {
+ throw new AngryAlert("Jij bent vast niet in de toekomst geboren toch? ;)");
+ }
+}
+
+
/**
* Change
* @throws AngryAlert
diff --git a/website/queries/user.php b/website/queries/user.php
index 2f645d1..26cf4e8 100644
--- a/website/queries/user.php
+++ b/website/queries/user.php
@@ -45,7 +45,10 @@ function selectUser($me, $other) {
) AS profilepicture,
`bio`,
`user`.`creationdate`,
- `onlinestatus`,
+ CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
+ WHEN TRUE THEN 'online'
+ WHEN FALSE THEN 'offline'
+ END AS `onlinestatus`,
`role`,
`fname`,
`lname`,
diff --git a/website/views/head.php b/website/views/head.php
index eb86d56..6e8ca0a 100644
--- a/website/views/head.php
+++ b/website/views/head.php
@@ -12,6 +12,8 @@
@import url("styles/header.css");
@import url("styles/menu.css");
@import url("styles/footer.css");
+
+ @import url("styles/mobilefriendly.css") screen and (orientation: portrait);
+