Hendrik post #126
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
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"])) {
|
||||
echo "Not enough arguments.";
|
||||
@@ -2,8 +2,8 @@ function showFriendNotifications(notifications) {
|
||||
$("#friendrequestslist").html("");
|
||||
for (i in notifications) {
|
||||
$("#friendrequestslist").append(" \
|
||||
<li class='friend-item $extraItem'> \
|
||||
<form action='profile.php' method='get'> \
|
||||
<li class='friend-item'> \
|
||||
<form action='profile.php' method='post'> \
|
||||
<button type='submit' \
|
||||
name='username' \
|
||||
value='"+ notifications[i].username +"'> \
|
||||
@@ -13,6 +13,22 @@ function showFriendNotifications(notifications) {
|
||||
</div> \
|
||||
</button> \
|
||||
</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> \
|
||||
");
|
||||
}
|
||||
@@ -22,10 +38,10 @@ function showChatNotifications(notifications) {
|
||||
$("#unreadChatlist").html("");
|
||||
for (i in notifications) {
|
||||
$("#unreadChatlist").append(" \
|
||||
<li class='friend-item $extraItem'> \
|
||||
<li class='friend-item'> \
|
||||
<form action='chat.php' method='get'> \
|
||||
<button type='submit' \
|
||||
name='username' \
|
||||
name='chatID' \
|
||||
value='"+ notifications[i].userID +"'> \
|
||||
<div class='friend'> \
|
||||
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
||||
|
||||
@@ -15,7 +15,6 @@ include("../queries/nicetime.php");
|
||||
|
||||
if(empty($_GET["username"])) {
|
||||
$userID = $_SESSION["userID"];
|
||||
echo "USERNAME NOT GIVEN";
|
||||
} else {
|
||||
$userID = getUserID($_GET["username"]);
|
||||
}
|
||||
|
||||
@@ -64,3 +64,31 @@
|
||||
#quick-links i:hover {
|
||||
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("
|
||||
SELECT
|
||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
|
||||
`user`.`userID`,
|
||||
IFNULL(
|
||||
`profilepicture`,
|
||||
'../img/notbad.jpg'
|
||||
|
||||
@@ -35,7 +35,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
";
|
||||
";
|
||||
}
|
||||
|
||||
$chatID = $_GET["chatID"];
|
||||
if (isset($chatID) && $chatID != "") {
|
||||
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
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">
|
||||
<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 ?>">
|
||||
<?php
|
||||
if($userID != $_SESSION["userID"] AND $user["friend_status"] == 0) {
|
||||
|
||||
Reference in New Issue
Block a user