Merge branch 'master' into joey-testing

This commit is contained in:
Joey Lai
2017-01-20 16:24:59 +01:00
15 changed files with 232 additions and 113 deletions

View File

@@ -1,7 +1,27 @@
$(document).ready(function() {
// Hide notification center.
$("#profile-menu-popup").hide();
// $("#own-profile-picture").click(function() {
// $("#profile-menu-popup").toggle();
// $("#profile-hello-popup").toggle();
// });
$("#own-profile-picture").click(function() {
$("#profile-menu-popup").toggle();
$("#profile-hello-popup").toggle();
if($("#notification-center").css('right') == "-256px") {
// $(".content").animate({
// marginRight: "256px"
// }, 500);
$("#notification-center").animate({
right: "0px"
}, 500);
} else {
// $(".content").animate({
// marginRight: "0px"
// }, 500);
$("#notification-center").animate({
right: "-256px"
}, 500);
}
});
});

View File

@@ -1,7 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<?php include("../views/head.php"); ?>
<?php
include_once("../queries/user.php");
include_once("../queries/group_page.php");
include("../views/head.php");
?>
<style>
@import url("styles/search.css");
</style>

View File

@@ -29,7 +29,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
break;
case "picture":
updateProfilePicture();
$result = $notImplemented;
$result = new settingsMessage("happy", "Deze melding doet nog niks nuttigs.");
break;
}
}

View File

@@ -33,32 +33,12 @@ header {
header div {
display: inline-block;
}
#open-chat {
font-size: 32px;
line-height: 80px;
margin-right: 50px;
}
.profile-menu {
font-size: 21px;
}
.profile-menu img {
padding: 8px;
height: 64px;
width: 64px;
}
#own-profile-picture, #profile-menu-popup span {
#own-profile-picture {
cursor: pointer;
}
#profile-menu-popup {
padding: 5px;
background: white;
color: #666;
border-radius: 3px;
}

View File

@@ -43,3 +43,20 @@
padding: 0;
text-align: left;
}
#notification-center {
left: auto;
width: 256px;
right: -256px;
}
#quick-links {
text-align: center;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
#quick-links i {
color: #845663;
font-size: 42px;
padding: 7px;
}

View File

@@ -10,9 +10,12 @@
margin: 0 20px 20px 0;
}
.profile-box .profile-username {
.profile-box h1.profile-username {
padding-top: 50px;
}
.profile-box h5.profile-username {
padding-top: 0;
}
div.posts {
padding-top: 20px;
@@ -37,23 +40,18 @@ div.posts .post p.subscript {
font-size: 8pt;
}
/*.posts {*/
/*z-index: -1;*/
/*margin-right: 0;*/
/*width: calc(100% + 15px);*/
/*}*/
div.posts .post form input, div.posts .post form textarea {
width: calc(100% - 15px);
}
/*.post-box {*/
/*display: inline-flex;*/
/*margin: 20px 15px 0 0;*/
/*padding: 25px;*/
/*background-color: #FFFFFF;*/
/*}*/
div.posts .post form input[type="submit"] {
width: 100%;
}
/*!* fullscreen *!*/
/*.post-box {*/
/*width: calc(25% - 69px);*/
/*}*/
div.posts .post form textarea.newpost {
margin: 15px 0 15px 0;
height: 100px;
}
@media only screen and (max-width: 1500px) {
.post-box {
@@ -68,14 +66,6 @@ div.posts .post p.subscript {
}
}
.post {
width: 100%;
}
.post img {
width: 100%;
}
.post .post-date {
float: right;
color: #aaaaaa;

View File

@@ -10,3 +10,8 @@
#search-friends-output {
margin-right: 10px;
}
.searchleft, .searchright {
display: inline-block;
vertical-align: top;
}

View File

@@ -15,6 +15,7 @@ function selectAllFriends($userID) {
`user`
INNER JOIN
`friendship`
WHERE
(`friendship`.`user1ID` = :userID AND
`friendship`.`user2ID` = `user`.`userID` OR

View File

@@ -172,5 +172,26 @@ function changeMultipleGroupStatusByID($ids, $status) {
return $q;
}
function searchSomeGroups($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`name`,
`picture`
FROM
`group_page`
WHERE
`name` LIKE :keyword
ORDER BY
`name`
LIMIT
:n, :m
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}
?>

View File

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

View File

@@ -272,3 +272,32 @@ function selectRandomNotFriendUser($userID) {
$stmt->execute();
return $stmt->fetch();
}
function searchSomeUsers($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`username`,
`profilepicture`,
`fname`,
`lname`
FROM
`user`
WHERE
`username` LIKE :keyword OR
`fname` LIKE :keyword OR
`lname` LIKE :keyword
ORDER BY
`fname`,
`lname`,
`username`
LIMIT
:n, :m
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}

View File

@@ -19,11 +19,6 @@ $userinfo = getHeaderInfo();
</form>
</div>
<div class="right profile-menu">
<div id="profile-menu-popup">
<a href="/logout"><span style="color: red;" class="fa fa-sign-out" data-title="Uitloggen"></span></a> |
<a href="/settings"><span style="color: blue;" class="fa fa-cog" data-title="Instellingen"></span></a> |
<a href="/profile"><span style="color: green;" class="fa fa-user" data-title="Profiel"></span></a>
</div>
<div id="profile-hello-popup">
<div id="hello-loop">
Hallo
@@ -32,5 +27,6 @@ $userinfo = getHeaderInfo();
</div>
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
</div>
<a href="/chat"><div class="right fa fa-comments-o" id="open-chat" data-title="Prive chats"></div></a>
</header>
<?php include("notification-center.php"); ?>

View File

@@ -0,0 +1,11 @@
<nav class="menu" id="notification-center">
<section id="quick-links">
<a href="chat.php"><i class="fa fa-comments-o" data-title="Prive chats"></i></a>
<a href="settings.php"><i class="fa fa-cog" data-title="Instellingen"></i></a>
<a href="profile.php"><i class="fa fa-user" data-title="Profiel"></i></a>
<a href="logout.php"><i class="fa fa-sign-out" data-title="Uitloggen"></i></a>
</section>
<section id="not">
</section>
</nav>

View File

@@ -4,7 +4,8 @@
<div class="profile-button">
<p><img src="/img/add-friend.png"> Als vriend toevoegen</p>
</div>
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?> (<?=$user["username"]?>)</h1>
<h1 class="profile-username"><?=$user["username"]?></h1>
<h5 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h5>
<p><?=$user["bio"]?></p>
</div>
@@ -13,7 +14,7 @@
<p>
<?php
while($friend = $profile_friends->fetch()) {
echo "<a href='profile/${friend["username"]}/' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
echo "<a href='/profile/${friend["username"]}/' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
}
@@ -29,7 +30,7 @@
<p>
<?php
while($group = $profile_groups->fetch()) {
echo "<a href='group/${group["name"]}/' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
echo "<a href='/group/${group["name"]}/' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
}
if($profile_groups->rowCount() === 0) {
@@ -41,6 +42,18 @@
<div class="posts">
<?php
if ($_SESSION["userID"] === $userID) {
?>
<div class="post platform">
<form>
<input type="text" class="newpost" placeholder="Titel">
<textarea class="newpost">Schrijf een berichtje...</textarea>
<input type="submit" value="Plaats!">
</form>
</div>
<?php
}
while($post = $posts->fetch()) {
$nicetime = nicetime($post["creationdate"]);
echo "

File diff suppressed because one or more lines are too long