Hendrik post #126
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
require("../queries/friendship.php");
|
|
||||||
require("../queries/user.php");
|
require("../../queries/friendship.php");
|
||||||
|
require("../../queries/user.php");
|
||||||
|
|
||||||
if(empty($_POST["userID"]) OR empty($_POST["delete"]) AND empty($_POST["accept"]) AND empty($_POST["request"])) {
|
if(empty($_POST["userID"]) OR empty($_POST["delete"]) AND empty($_POST["accept"]) AND empty($_POST["request"])) {
|
||||||
echo "Not enough arguments.";
|
echo "Not enough arguments.";
|
||||||
@@ -2,8 +2,8 @@ function showFriendNotifications(notifications) {
|
|||||||
$("#friendrequestslist").html("");
|
$("#friendrequestslist").html("");
|
||||||
for (i in notifications) {
|
for (i in notifications) {
|
||||||
$("#friendrequestslist").append(" \
|
$("#friendrequestslist").append(" \
|
||||||
<li class='friend-item $extraItem'> \
|
<li class='friend-item'> \
|
||||||
<form action='profile.php' method='get'> \
|
<form action='profile.php' method='post'> \
|
||||||
<button type='submit' \
|
<button type='submit' \
|
||||||
name='username' \
|
name='username' \
|
||||||
value='"+ notifications[i].username +"'> \
|
value='"+ notifications[i].username +"'> \
|
||||||
@@ -13,6 +13,22 @@ function showFriendNotifications(notifications) {
|
|||||||
</div> \
|
</div> \
|
||||||
</button> \
|
</button> \
|
||||||
</form> \
|
</form> \
|
||||||
|
<div class='notification-options'>\
|
||||||
|
<form action='API/edit_friendship.php' method='post'> \
|
||||||
|
<button type='submit' \
|
||||||
|
name='accept' \
|
||||||
|
class='accept-notification' \
|
||||||
|
value='"+ notifications[i].userID +"'> \
|
||||||
|
<i class='fa fa-check'></i> \
|
||||||
|
</button>\
|
||||||
|
<button\
|
||||||
|
name='delete' \
|
||||||
|
class='deny-notification' \
|
||||||
|
value='"+ notifications[i].userID +"'> \
|
||||||
|
<i class='fa fa-times'></i> \
|
||||||
|
</button> \
|
||||||
|
<form>\
|
||||||
|
</div> \
|
||||||
</li> \
|
</li> \
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
@@ -22,10 +38,10 @@ function showChatNotifications(notifications) {
|
|||||||
$("#unreadChatlist").html("");
|
$("#unreadChatlist").html("");
|
||||||
for (i in notifications) {
|
for (i in notifications) {
|
||||||
$("#unreadChatlist").append(" \
|
$("#unreadChatlist").append(" \
|
||||||
<li class='friend-item $extraItem'> \
|
<li class='friend-item'> \
|
||||||
<form action='chat.php' method='get'> \
|
<form action='chat.php' method='get'> \
|
||||||
<button type='submit' \
|
<button type='submit' \
|
||||||
name='username' \
|
name='chatID' \
|
||||||
value='"+ notifications[i].userID +"'> \
|
value='"+ notifications[i].userID +"'> \
|
||||||
<div class='friend'> \
|
<div class='friend'> \
|
||||||
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ include("../queries/nicetime.php");
|
|||||||
|
|
||||||
if(empty($_GET["username"])) {
|
if(empty($_GET["username"])) {
|
||||||
$userID = $_SESSION["userID"];
|
$userID = $_SESSION["userID"];
|
||||||
echo "USERNAME NOT GIVEN";
|
|
||||||
} else {
|
} else {
|
||||||
$userID = getUserID($_GET["username"]);
|
$userID = getUserID($_GET["username"]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,3 +64,31 @@
|
|||||||
#quick-links i:hover {
|
#quick-links i:hover {
|
||||||
color: #FBC02D;
|
color: #FBC02D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notification-options {
|
||||||
|
display: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-options form {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-options button {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 5px 20px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accept-notification:hover {
|
||||||
|
color: #4CAF50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deny-notification:hover {
|
||||||
|
color: firebrick;
|
||||||
|
}
|
||||||
|
|
||||||
|
.friend-item:hover .notification-options {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
@@ -80,6 +80,7 @@ function selectAllUnreadChat() {
|
|||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
||||||
|
`user`.`userID`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/notbad.jpg'
|
'../img/notbad.jpg'
|
||||||
|
|||||||
@@ -37,6 +37,11 @@
|
|||||||
</li>
|
</li>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$chatID = $_GET["chatID"];
|
||||||
|
if (isset($chatID) && $chatID != "") {
|
||||||
|
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
3
website/views/loadFriends.php
Normal file
3
website/views/loadFriends.php
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
echo json_encode(selectAllFriends($_SESSION["userID"])->fetchAll());
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="profile-box platform">
|
<div class="profile-box platform">
|
||||||
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
|
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
|
||||||
|
|
||||||
<form action="edit_friendship.php" method="post">
|
<form action="API/edit_friendship.php" method="post">
|
||||||
<input type="hidden" name="userID" value="<?= $userID ?>">
|
<input type="hidden" name="userID" value="<?= $userID ?>">
|
||||||
<?php
|
<?php
|
||||||
if($userID != $_SESSION["userID"] AND $user["friend_status"] == 0) {
|
if($userID != $_SESSION["userID"] AND $user["friend_status"] == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user