7 Commits

Author SHA1 Message Date
Lars van Hijfte
8c4c4a59fd Merge branch 'master' into lars-algemeen 2017-01-23 16:25:18 +01:00
Lars van Hijfte
58ce5f1e75 Menu, netjes, notification 2017-01-23 16:24:48 +01:00
Marijn Jansen
80f7c24641 Merge branch 'marijn-settings' into 'master'
Profile picrure old deletion (:

See merge request !97
2017-01-23 16:24:28 +01:00
Marijn Jansen
f82dd73b7d Profile picrure old deletion (: 2017-01-23 16:23:47 +01:00
Marijn Jansen
449b500636 Merge branch 'joey-testing' into 'master'
Fixed css and confirmation for logged in already

See merge request !96
2017-01-23 13:26:10 +01:00
Marijn Jansen
af11297fad Merge branch 'marijn-button' into 'master'
Marijn button

See merge request !95
2017-01-23 13:25:07 +01:00
Joey Lai
21ff896d65 Fixed css and confirmation for logged in already 2017-01-23 13:24:13 +01:00
15 changed files with 136 additions and 117 deletions

View File

@@ -0,0 +1,8 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/friendship.php");
echo selectAllUnreadChat();

View File

@@ -13,14 +13,14 @@ $(document).ready(function() {
marginRight: "256px" marginRight: "256px"
}, 500); }, 500);
$(".chat-right").animate({ $(".chat-right").animate({
width: "100%" width: "calc(100% - 512px - 40px)"
}, 500); }, 500);
$("#notification-center").animate({ $("#notification-center").animate({
right: "0px" right: "0px"
}, 500); }, 500);
} else { } else {
$(".chat-right").animate({ $(".chat-right").animate({
width: "100%" width: "calc(100% - 256px - 40px)"
}, 500); }, 500);
$(".content").animate({ $(".content").animate({
marginRight: "0px" marginRight: "0px"
@@ -30,4 +30,6 @@ $(document).ready(function() {
}, 500); }, 500);
} }
}); });
$("#own-profile-picture").click();
}); });

View File

@@ -1,7 +1,7 @@
function showNotifications(notifications, id) { function showNotifications(notifications, id) {
$("#friendrequestslist").html(""); $("#" + id).html("");
for (i in notifications) { for (i in notifications) {
$("#friendrequestslist").append(" \ $("#" + id).append(" \
<li class='friend-item $extraItem'> \ <li class='friend-item $extraItem'> \
<form action='profile.php' method='get'> \ <form action='profile.php' method='get'> \
<button type='submit' \ <button type='submit' \
@@ -20,15 +20,25 @@ function showNotifications(notifications, id) {
function loadNotifications() { function loadNotifications() {
$.post( $.post(
"API/loadNotifications.php" "API/loadFriendRequestNotifications.php"
).done(function(data) { ).done(function(data) {
if (data && data != "[]") { if (data && data != "[]") {
showNotifications(JSON.parse(data), "friendrequestslist"); showNotifications(JSON.parse(data), "friendrequestslist");
} }
}); });
$.post(
"API/loadChatNotifications.php"
).done(function(data) {
if (data && data != "[]") {
showNotifications(JSON.parse(data), "unreadChatlist");
}
});
setTimeout(loadNotifications, 10000); setTimeout(loadNotifications, 10000);
} }
$(document).ready(function() {
loadNotifications();
});
loadNotifications();

View File

@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<?php <?php
include("../views/head.php"); include_once("../views/head.php");
include_once("../queries/connect.php"); include_once("../queries/connect.php");
include_once("../queries/settings.php"); include_once("../queries/settings.php");
?> ?>
@@ -12,8 +12,6 @@
</head> </head>
<body> <body>
<?php <?php
include("../views/main.php");
$notImplemented = new settingsMessage("angry", "Deze functie werkt nog niet :("); $notImplemented = new settingsMessage("angry", "Deze functie werkt nog niet :(");
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
@@ -33,6 +31,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
break; break;
} }
} }
include("../views/main.php");
include("../views/settings-view.php"); include("../views/settings-view.php");

View File

@@ -1,6 +1,5 @@
footer { footer {
width: calc(100% - 256px); width: 100%;
margin-left: 256px;
background-color: rgba(0,0,0,0.4); background-color: rgba(0,0,0,0.4);
} }

View File

@@ -13,7 +13,7 @@ a.button {
/* Body */ /* Body */
body { body {
height: 900px; height: 100%;
background-color: #C8CABD; background-color: #C8CABD;
/*background-image: url(http://play.pokemonshowdown.com/fx/client-bg-shaymin.jpg); /*background-image: url(http://play.pokemonshowdown.com/fx/client-bg-shaymin.jpg);
background-size: cover; background-size: cover;
@@ -46,7 +46,7 @@ body {
form { form {
/*background-color: #a87a87;*/ /*background-color: #a87a87;*/
border-radius: 12px; border-radius: 12px;
height: 80%; height: 70%;
margin: auto; margin: auto;
width: 70%; width: 70%;
overflow-y:auto; overflow-y:auto;
@@ -159,7 +159,7 @@ label {
background-repeat: repeat-x; background-repeat: repeat-x;
background-attachment: fixed;*/ background-attachment: fixed;*/
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
height: 550px; height: 500px;
margin: 34px auto; margin: 34px auto;
overflow-y: auto; overflow-y: auto;
padding: 20px; padding: 20px;

View File

@@ -166,6 +166,7 @@ textarea {
textarea:hover, input:hover, select:hover { textarea:hover, input:hover, select:hover {
border-radius: 10px; border-radius: 10px;
box-shadow: 0 1px 1px rgba(0,0,0,0.12);
} }
textarea:focus, input:focus, select:focus { textarea:focus, input:focus, select:focus {

View File

@@ -6,15 +6,15 @@
left: 0; left: 0;
top: 80px; top: 80px;
height: calc(100% - 80px); height: calc(100% - 80px);
width: 256px; width: 236px;
background-color: #EEE; padding: 20px 10px;
/*box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);*/
} }
.menu section { .menu section {
margin: 0 5px 10px 5px; margin-bottom: 10px;
background-color: white; border-radius: 5px;
background-color: #FFFFFF;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
} }
@@ -24,6 +24,7 @@
.nav-list li { .nav-list li {
padding: 5px 20px; padding: 5px 20px;
border-radius: 4px;
} }
.more-item { .more-item {
@@ -40,7 +41,7 @@
.friend-item:hover, .group-item:hover { .friend-item:hover, .group-item:hover {
background: #FBC02D; background: #FBC02D;
color: white; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
} }
.menu button { .menu button {
@@ -54,7 +55,7 @@
#notification-center { #notification-center {
left: auto; left: auto;
width: 256px; width: 236px;
right: -256px; right: -256px;
} }
@@ -67,4 +68,9 @@
color: #4CAF50; color: #4CAF50;
font-size: 42px; font-size: 42px;
padding: 7px; padding: 7px;
transition-duration: 250ms;
}
#quick-links i:hover {
color: #FBC02D;
} }

View File

@@ -33,9 +33,6 @@ div.posts div.post {
} }
div.posts div.post:hover { div.posts div.post:hover {
/*margin: 15px 0 0 -5px;*/
/*padding: 15px;*/
/*z-index: 20;*/
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
} }

View File

@@ -21,8 +21,8 @@ function selectAllFriends($userID) {
`friendship`.`user2ID` = `user`.`userID` OR `friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND `friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND `friendship`.`user1ID` = `user`.`userID`) AND
`role` != 5 AND `user`.`role` != 'banned' AND
`status` = 1 `friendship`.`status` = 'confirmed'
"); ");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT); $stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
@@ -52,8 +52,8 @@ function selectAllFriendRequests() {
`friendship`.`user2ID` = `user`.`userID` OR `friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND `friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND `friendship`.`user1ID` = `user`.`userID`) AND
`role` != 5 AND `user`.`role` != 5 AND
`status` = 0 `friendship`.`status` = 'requested'
"); ");
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT); $stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);

View File

@@ -1,7 +1,7 @@
<?php <?php
function selectAllGroupsFromUser($userID) { function selectAllGroupsFromUser($userID) {
return $GLOBALS["db"]->query(" $stmt = $GLOBALS["db"]->prepare("
SELECT SELECT
`group_page`.`name`, `group_page`.`name`,
`group_page`.`picture` `group_page`.`picture`
@@ -10,8 +10,13 @@ function selectAllGroupsFromUser($userID) {
INNER JOIN INNER JOIN
`group_member` `group_member`
WHERE WHERE
`group_member`.`userID` = $userID AND `group_member`.`userID` = :userID AND
`group_member`.`groupID` = `group_page`.`groupID` AND `group_member`.`groupID` = `group_page`.`groupID` AND
`group_page`.`status` != 0 `group_page`.`status` != 'hidden'
"); ");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
} }

View File

@@ -188,15 +188,25 @@ function doChangeEmail($email) {
function updateProfilePicture() { function updateProfilePicture() {
$profilePictureDir = "/var/www/html/public/"; $profilePictureDir = "/var/www/html/public/";
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]); $relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]);
// removeOldProfilePicture(); removeOldProfilePicture();
move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath); move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath);
setProfilePictureToDatabase("../" . $relativePath); setProfilePictureToDatabase("../" . $relativePath);
} }
//function removeOldProfilePicture() { function removeOldProfilePicture() {
// $stmt = $GLOBALS["db"]->prepare("
// unlink("/var/www/html/public/uploads/profilepictures/" . $_SESSION["userID"] . "_*"); SELECT
//} `profilepicture`
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
$old_avatar = $stmt->fetch()["profilepicture"];
unlink("/var/www/html/public/uploads/" . $old_avatar);
}
function setProfilePictureToDatabase($url) { function setProfilePictureToDatabase($url) {
$stmt = $GLOBALS["db"]->prepare(" $stmt = $GLOBALS["db"]->prepare("

View File

@@ -7,6 +7,6 @@
<link rel="stylesheet" <link rel="stylesheet"
type="text/css" type="text/css"
href="styles/index.css"> href="styles/index.css">
<script src="jqeury.js"></script> <script src="/js/jqeury.js"></script>
<script src="registerAndLogin.js"></script> <script src="/js/registerAndLogin.js"></script>
</head> </head>

View File

@@ -1,36 +1,46 @@
<nav class="menu"> <nav class="menu">
<section id="friends-menu-section platform"> <section id="friends-menu-section">
<h4>
Vrienden
</h4>
<ul class="nav-list">
<?php <?php
// Load file. // Load file.
require_once("../queries/friendship.php"); require_once("../queries/friendship.php");
require_once("../queries/user.php"); require_once("../queries/user.php");
// Get all the friends of a user. // Get confirmed friends of the user and a random non-friend.
$friends = selectAllFriends($_SESSION["userID"]); $friends = selectAllFriends($_SESSION["userID"])->fetchAll();
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
$i = 0; $i = 0;
// Print all the users. if (sizeof($friends) == 0) {
while($friend = $friends->fetch(PDO::FETCH_ASSOC)) { echo "
$i ++; <ul class=\"nav-list\"><li class='friend-item'>
<form action='profile.php' method='get'>
<button type='submit'
name='username'
value='$randomUser'>
<div class='friend'>
Maak nieuwe vrienden :)
</div>
</button>
</form>
</li><ul class=\"nav-list\">
";
} else {
echo "
<h4>
Vrienden
</h4>
<ul class=\"nav-list\">
";
// Set default values of a friend. foreach ($friends as $i => $friend) {
$username = $friend["username"]; $username = $friend["username"];
$extraItem = ""; $extraItem = "";
$pf = "img/notbad.jpg";
// Change values if needed.
if (!empty($friend["profilepicture"]))
$pf = $friend["profilepicture"]; $pf = $friend["profilepicture"];
if ($i > 5) if ($i >= 5)
$extraItem = "extra-menu-items"; $extraItem = "extra-menu-items";
// Echo the friend.
echo " echo "
<li class='friend-item $extraItem'> <li class='friend-item $extraItem'>
<form action='profile.php' method='get'> <form action='profile.php' method='get'>
@@ -47,66 +57,45 @@
"; ";
} }
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"]; if (sizeof($friends) > 5) {
echo "
<li class='friend-item'>
<form action='/profile' method='get'>
<button type='submit'
name='username'
value='$randomUser'>
<div class='friend'>
Klik hier voor een nieuw vriendje :)
</div>
</button>
</form>
</li>
";
if ($i > 5) {
$i -= 5;
echo " echo "
<li class='more-item' id='more-friends-click'> <li class='more-item' id='more-friends-click'>
En nog $i anderen... Meer vrienden..
</li> </li>
"; ";
} }
}
?> ?>
</ul>
</section> </section>
<section id="groups-menu-section"> <section id="groups-menu-section">
<h4>
Groepen
</h4>
<ul class="nav-list">
<?php <?php
// Load file. // Load file.
include_once("../queries/group_member.php"); require_once("../queries/group_member.php");
// Get all the friends of a user. // Get all the friends of a user.
$groups = selectAllGroupsFromUser($_SESSION["userID"]); $groups = selectAllGroupsFromUser($_SESSION["userID"]);
$i = 0;
// Print all the users. if (sizeof($groups) > 0) {
while($group = $groups->fetch(PDO::FETCH_ASSOC)) { echo "
$i ++; <h4>
Groepen
</h4>
<ul class=\"nav-list\">
";
foreach ($groups as $i => $group) {
// Set default values of a friend. // Set default values of a friend.
$name = $group["name"]; $name = $group["name"];
$extraItem = ""; $extraItem = "";
$picture = "img/notbad.jpg";
// Change values if needed.
if (!empty($group["picture"]))
$picture = $group["picture"]; $picture = $group["picture"];
// Change values if needed.
if ($i > 3) if ($i > 3)
$extraItem = "extra-menu-items"; $extraItem = "extra-menu-items";
// Echo the friend.
echo " echo "
<li class='group-item'> <li class='group-item $extraItem'>
<form action='group.php' method='get'> <form action='group.php' method='get'>
<button type='submit' <button type='submit'
name='groupname' name='groupname'
@@ -121,27 +110,20 @@
"; ";
} }
if ($i == 0) { if (sizeof($groups) > 3) {
echo "<li class='group-item'>
<div class='group'>
Je hoort nergens bij.
</div>
</li>";
} else if ($i > 3) {
$i -= 3;
echo " echo "
<li class='more-item' id='more-groups-click'> <li class='more-item' id='more-groups-click'>
En nog $i andere... Meer groepen..
</li> </li>
"; ";
} }
}
?> ?>
</ul>
</section> </section>
<section> <section>
<ul> <ul>
<li class="more-item" id="menu-back"> <li class="more-item" id="menu-back">
Ga terug Terug naar het overzicht
</li> </li>
</ul> </ul>
</section> </section>