Merge branch 'master' into hendrik-post

This commit is contained in:
Hendrik
2017-01-26 13:46:24 +01:00
42 changed files with 1103 additions and 457 deletions

View File

@@ -16,7 +16,7 @@
// Set default values of a friend.
$username = $friend["username"];
$name = $friend["name"];
$name = $friend["fullname"];
$userID = $friend["userID"];
$pf = "img/avatar-standard.png";
@@ -37,9 +37,8 @@
</li>
";
}
$chatID = $_GET["chatID"];
if (isset($chatID) && $chatID != "") {
if (isset($_GET["username"]) && $_GET["username"] != "") {
$chatID = $_GET["username"];
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
}
?>

View File

@@ -2,6 +2,7 @@
<title>MyHyvesbook+</title>
<!-- Add your javascript files here. -->
<script src="js/jquery.js"></script>
<script src="js/main.js"></script>
<script src="js/header.js"></script>
<script src="js/menu.js"></script>
<script src="js/notifications.js"></script>

View File

@@ -7,8 +7,9 @@
<h1>Welkom bij MyHyvesbook+</h1>
<!-- Login content -->
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
return= $correct
method="post">
return=$correct
method="post"
name="login">
<!-- Login name -->
<div class="login_containerlogin">
@@ -37,15 +38,79 @@
<!-- Button for logging in -->
<div class="login_containerlogin">
<button type="submit"
value="Login"
name="submit"
id="frm1_submit">
Login
value="login"
name="submit"
id="frm1_submit">
Inloggen
</button>
</div>
</form>
</div>
<!-- Button for going to the register screen -->
<div class="login_containerlogin">
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
<!-- Trigger/Open The Modal -->
<button id="myBtn" class="button">Wachtwoord vergeten</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
return= $correct
method="post"
name="forgotPassword">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">&times;</span>
<h3>Voer uw emailadres in</h3>
</div>
<div class="modal-body">
<input type="text"
placeholder="Voer uw email in"
name="forgotEmail"
title="Voer een email in">
</div>
<div class="modal-footer">
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
<button type="submit"
value="reset"
name="submit"
id="frm1_submit">
Reset password
</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script>
// Get the modal
var modal = document.getElementById('myModal');
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>

View File

@@ -7,7 +7,7 @@
<link rel="stylesheet"
type="text/css"
href="styles/index.css">
<script src="js/jqeury.js"></script>
<script src="js/jquery.js"></script>
<script src="js/registerAndLogin.js"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>

View File

@@ -1,134 +1,25 @@
<nav class="menu">
<section id="friends-menu-section">
<?php
// Load file.
require_once("../queries/friendship.php");
require_once("../queries/user.php");
// Get confirmed friends of the user and a random non-friend.
$friends = selectAllFriends($_SESSION["userID"])->fetchAll();
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
$i = 0;
if (sizeof($friends) == 0) {
echo "
<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\">
";
foreach ($friends as $i => $friend) {
$username = $friend["username"];
$name = $friend["name"];
$extraItem = "";
$pf = $friend["profilepicture"];
if ($i >= 5)
$extraItem = "extra-menu-items";
echo "
<li class='friend-item $extraItem'>
<form action='profile.php' method='get'>
<button type='submit'
name='username'
value='$username'>
<div class='friend'>
<img alt='PF' class='profile-picture' src='$pf'/>
<div class='friend-name'>
$name<br/>
<span style='color: #666'>$username</span>
</div>
</div>
</button>
</form>
</li>
";
}
if (sizeof($friends) > 5) {
echo "
<li class='more-item' id='more-friends-click'>
Meer vrienden..
</li>
";
}
}
?>
<h4>
Vrienden
</h4>
<ul id="menu-friends-list" class="nav-list">
</ul>
<h4><form action="search.php">
<input type="hidden"
value="friends"
name="filter" />
<button value=""
name="search">
Alle vrienden...
</button>
</form></h4>
</section>
<section id="groups-menu-section">
<?php
// Load file.
require_once("../queries/group_member.php");
// Get all the friends of a user.
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
if (sizeof($groups) > 0) {
echo "
<h4>
Groepen
</h4>
<ul class=\"nav-list\">
";
foreach ($groups as $i => $group) {
// Set default values of a friend.
$name = $group["name"];
$extraItem = "";
$picture = $group["picture"];
// Change values if needed.
if ($i > 3)
$extraItem = "extra-menu-items";
echo "
<li class='group-item $extraItem'>
<form action='group.php' method='get'>
<button type='submit'
name='groupname'
value='$name'>
<div class='group'>
<img alt='PF' class='group-picture' src='$picture'/>
$name
</div>
</button>
</form>
</li>
";
}
if (sizeof($groups) > 3) {
echo "
<li class='more-item' id='more-groups-click'>
Meer groepen..
</li>
";
}
}
?>
</section>
<section>
<ul>
<li class="more-item" id="menu-back">
Terug naar het overzicht
</li>
<h4>
Groepen
</h4>
<ul id="menu-groups-list" class="nav-list">
</ul>
</section>
</nav>

View File

@@ -0,0 +1,23 @@
<?php
function messagePage(string $content) {
$webpage = ("
<!DOCTYPE html>
<html>
<head>
<style>
@import url(styles/main.css);
@import url(styles/settings.css);
@import url(styles/resetpassword.css);
</style>
</head>
<body>
<div class='password-change'>
<div class='top-logo'><a href='login.php'><img src='img/top-logo.png' alt='MyHyvesbook+'/></a></div>
<div class='item-box platform'>$content</div>
</div>
</body>
</html>
");
echo $webpage;
}

View File

@@ -5,19 +5,19 @@
<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>
<section id="friend-request-section">
<h4>
Vriendchapsverzoeken
</h4>
<ul class="nav-list" id="friendrequestslist">
<ul class="nav-list" id="friend-requests-list">
</ul>
</section>
<section>
<section id="unread-messages-section">
<h4>
Nieuwe berichten
</h4>
<ul class="nav-list" id="unreadChatlist">
<ul class="nav-list" id="unread-chat-list">
</ul>
</section>

View File

@@ -2,21 +2,10 @@
<div class="profile-box platform">
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
<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) {
echo "<input class='profile-button' type='submit' name='request' value='Stuur vriendschapsverzoek!'>";
} else if($user["friend_status"] == 1) {
echo "<input class='profile-button' type='submit' name='delete' value='Verwijder vriend!'>";
} else if($user["friend_status"] == 2) {
echo "<input class='profile-button' type='submit' name='accept' value='Accepteer vriendschapsverzoek!'>";
echo "<input class='profile-button' type='submit' name='delete' value='Weiger vriendschapsverzoek!'>";
} else if($user["friend_status"] == 3) {
echo "<input class='profile-button' type='submit' name='delete' value='Trek vriendschapsverzoek in!'>";
}
?>
</form>
<div class="friend-button-container">
</div>
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h1>
<h5 class="profile-username"><?=$user["username"]?></h5>
<p><?=$user["bio"]?></p>
@@ -54,37 +43,7 @@
</div>
<div class="posts">
<?php
if ($_SESSION["userID"] === $userID) {
?>
<div class="post platform">
<form action="API/postPost.php" method="post">
<input type="text" name="newpost-title" class="newpost" placeholder="Titel">
<textarea class="newpost" name="newpost-content" placeholder="Schrijf een berichtje..."></textarea>
<input type="submit" value="Plaats!">
</form>
</div>
<?php
}
while($post = $posts->fetch()) {
$nicetime = nicetime($post["creationdate"]);
$postID = $post["postID"];
echo "
<div class='post platform' onclick='requestPost(this)'>
<h2>${post["title"]}</h2>
<p>${post["content"]}</p>
<p class=\"subscript\" title='" . $post["creationdate"] ."'>${nicetime} geplaatst.</p>
<form>
<input type='hidden'
name='postID'
value='$postID'
/>
</form>
</div>
";
}
?>
</div>
<div class="modal">

View File

@@ -126,7 +126,7 @@
<!-- Button for registering -->
<div class="login_containerlogin">
<!-- Button for going back to login screen -->
<a href="https://myhyvesbookplus.nl/login.php" class="left-arrow">Login</a>
<a href="https://myhyvesbookplus.nl/login.php" class="button">Annuleren</a>
<button type="submit"
value="Registreer uw account"

View File

@@ -0,0 +1,38 @@
<?php
function passwordResetFields() {
$username = $_GET['u'];
$hash = $_GET['h'];
$content ="
<form class='settings' method = 'post' >
<h5 > Voer een nieuw wachtwoord in </h5 >
<input type = 'hidden'
name = 'u'
value = '$username'
>
<input type = 'hidden'
name = 'h'
value = '$hash'
>
<ul >
<li >
<label > Nieuw wachtwoord </label >
<input type = 'password'
name = 'password'
placeholder = 'Nieuw wachtwoord'
>
</li >
<li >
<label > Bevestig wachtwoord </label >
<input type = 'password'
name = 'password-confirm'
placeholder = 'Bevestig wachtwoord'
>
</li >
<li >
<label ></label >
<button type = 'submit' > Verander wachtwoord </button >
</li >
</ul >
</form >";
return $content;
}