23 Commits

Author SHA1 Message Date
Marijn Jansen
6d5de98c1d comments 2017-02-03 11:31:18 +01:00
Marijn Jansen
ac2ce3d07b Merge branch 'master' into marijn-groups 2017-02-03 11:13:20 +01:00
Marijn Jansen
c69b5d8ed3 Comments 2017-02-03 11:12:02 +01:00
Marijn Jansen
5de3a84683 Merge branch 'marijn-groups' into 'master'
Marijn groups

See merge request !201
2017-02-03 10:59:35 +01:00
Marijn Jansen
b8d6136a9d Added deadmin! 2017-02-03 10:59:10 +01:00
Lars van Hijfte
1862369013 Merge branch 'joey-testing' into 'master'
Joey testing

See merge request !200
2017-02-03 10:54:47 +01:00
Joey Lai
8d70804155 Merge branch 'joey-testing' of ssh://gitlab-fnwi.uva.nl:1337/11166932/WebDB into joey-testing 2017-02-03 10:52:35 +01:00
Joey Lai
0ac12f5110 Merge branch 'master' into joey-testing 2017-02-03 10:48:14 +01:00
Lars van Hijfte
5e8fa6791f Merge branch 'joey-testing' into 'master'
Fixed url

See merge request !198
2017-02-03 10:45:33 +01:00
Marijn Jansen
28e9269b52 Delete groups 2017-02-03 10:44:50 +01:00
Lars van Hijfte
fe190975d5 Merge branch 'master' into 'joey-testing'
# Conflicts:
#   website/views/homeLoginRegister.php
2017-02-03 10:41:05 +01:00
Lars van Hijfte
87b0ab5892 Merge branch 'lars' into 'master'
Lars

See merge request !199
2017-02-03 10:40:16 +01:00
Joey Lai
c8dbdfe70e Fixed url 2017-02-03 10:34:44 +01:00
Lars van Hijfte
8949d14a5e Merge branch 'revert-50e94fb8' into 'master'
Revert "Merge branch 'joey-testing' into 'master'"

See merge request !197
2017-02-03 10:34:39 +01:00
Lars van Hijfte
02349dbe28 Changed description 2017-02-03 10:30:44 +01:00
Lars van Hijfte
da01729b61 Merge branch 'master' into lars 2017-02-03 10:15:10 +01:00
Lars van Hijfte
6d739a4480 Chat is now only loading the last 100 messages 2017-02-03 00:24:38 +01:00
Lars van Hijfte
ab21226925 Merge branch 'master' into lars 2017-02-03 00:14:03 +01:00
Lars van Hijfte
7e4107ac8b Added fancy buttons in profile 2017-02-03 00:13:23 +01:00
Lars van Hijfte
e9468b0ec8 Merge branch 'master' into lars 2017-02-02 21:04:32 +01:00
Lars van Hijfte
b206d243b9 Validator fixes
Changes chat, profile and settings pages so it is compatible with the validator of w3
2017-02-02 18:17:58 +01:00
Lars van Hijfte
4f731e12fe Merge branch 'master' into lars 2017-02-02 17:45:10 +01:00
Lars van Hijfte
f8c9454b85 empty SessionID sends the user to login page
If the session is empty, it now sends you to the login page with a safed url so it can revert you back to the right page after login
2017-02-02 17:43:32 +01:00
33 changed files with 346 additions and 126 deletions

View File

@@ -3,10 +3,10 @@ session_start();
require_once "../../queries/post.php";
require_once "../../queries/user.php";
if (isset($_SESSION["userID"]) and
getRoleByID($_SESSION["userID"]) != 'frozen' and
getRoleByID($_SESSION["userID"]) != 'banned') {
if (!isset($_SESSION["userID"])) {
echo "logged out";
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' and
getRoleByID($_SESSION["userID"]) != 'banned') {
if (empty($_POST["postID"]) or empty($_SESSION["userID"])) {
header('HTTP/1.1 500 Non enough arguments');

View File

@@ -7,10 +7,10 @@ require_once("../../queries/connect.php");
require_once("../../queries/checkInput.php");
require_once("../../queries/user.php");
if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if (!isset($_SESSION["userID"])) {
echo "logged out";
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if ($_POST['button'] == 'reaction') {
if (empty($_POST['newcomment-content'])) {
echo 0;

View File

@@ -8,9 +8,10 @@ require_once("../../queries/connect.php");
require_once("../../queries/checkInput.php");
require_once("../../queries/user.php");
if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if (!isset($_SESSION["userID"])) {
echo "logged out";
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if (empty($_SESSION["userID"])) {
header('HTTP/1.1 500 Non enough arguments');

View File

@@ -7,9 +7,10 @@ require_once("../../queries/checkInput.php");
require_once("../../queries/user.php");
// Check if the user is allowed to send a message.
if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if (!isset($_SESSION["userID"])) {
echo "logged out";
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if (!empty(test_input($_POST["destination"])) &&
!empty(test_input($_POST["content"]))
) {

View File

@@ -21,6 +21,8 @@ require_once "../queries/alerts.php";
include("../views/main.php");
$alertClass;
$alertMessage;
// Select which button has been pressed.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
switch ($_POST["form"]) {
@@ -44,6 +46,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
upgradeUser($_POST["groupID"], $_POST["userID"], "admin");
break;
case "deadmin":
if (!array_key_exists("userID", $_POST)) {
throw new AngryAlert("Geen gebruiker geselecteerd.");
}
upgradeUser($_POST["groupID"], $_POST["userID"], "member");
break;
case "delete":
deleteGroup();
break;
}
} catch (AlertMessage $w) {
$alertClass = $w->getClass();

View File

@@ -43,6 +43,8 @@ function sendMessage() {
).done(function(response) {
if (response == "frozen") {
alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
} else if (response == "logged out") {
window.location.href = "login.php?url=" + window.location.pathname;
}
// Load messages if the message has been send, so it shows in the chat.
loadMessages();

View File

@@ -19,24 +19,24 @@ function placeFriendButtons() {
case "0":
value1 = "request";
class1 = "green";
text1 = "Bevriend";
icon1 = "fa-handshake-o";
text1 = "Word vrienden";
icon1 = "fa-user-plus";
break;
case "1":
value1 = userID;
class1 = "green";
text1 = "Chat";
icon1 = "fa-comment-o";
icon1 = "fa-comment";
value2 = "delete";
class2 = "red";
text2 = "Verwijder";
icon2 = "fa-times";
text2 = "Ontvriend";
icon2 = "fa-user-times";
break;
case "2":
value1 = "delete";
class1 = "red";
text1 = "Trek verzoek in";
icon1 = "fa-cross";
icon1 = "fa-times";
break;
case "3":
value1 = "accept";
@@ -51,16 +51,18 @@ function placeFriendButtons() {
}
$buttonContainer.append(
"<button class='"+ class1 +" friend-button' value='"+ value1 +"'>" +
"<i class='fa "+ icon1 +"'></i> " + text1 +
"</button>");
"<div><button class='"+ class1 +" fancy-button friend-button' value='"+ value1 +"'>" +
"<span>"+ text1 +"</span>" +
"<i class='fa fa-fw "+ icon1 +"'></i> " +
"</button></div>");
$buttonContainer.append(
"<button class='"+ class2 +" friend-button' value='"+ value2 +"'>" +
"<i class='fa "+ icon2 +"'></i> " + text2 +
"</button>");
"<div><button class='"+ class2 +" fancy-button friend-button' value='"+ value2 +"'>" +
"<span>"+ text2 +"</span>" +
"<i class='fa fa-fw "+ icon2 +"'></i> " +
"</button></div>");
$buttonContainer.children().click(function() {
$buttonContainer.find("button").click(function() {
if (isNaN(this.value))
editFriendship(userID, this.value);
else if (this.value != "")

View File

@@ -5,23 +5,23 @@ function placeGroupButtons() {
if (data == 'none') {
$buttonContainer.append(
"<button class='green group-button group-button-fixed' value='request'>" +
"<i class='fa fa-plus'></i> Voeg toe" +
"<button class='green group-button fancy-button' value='request'>" +
"<span>Treed toe</span><i class='fa fa-plus'></i>" +
"</button>");
} else if (data == 'request') {
$buttonContainer.append(
"<button class='red group-button group-button-fixed' value='none'>" +
"<i class='fa fa-times'></i> Trek verzoek in" +
"<button class='red group-button fancy-button' value='none'>" +
"<span>Trek verzoek in</span><i class='fa fa-times'></i>" +
"</button>");
} else if (data == 'admin') {
$buttonContainer.append(
"<button class='group-button group-button-fancy' value='admin'>" +
"<button class='group-button fancy-button' value='admin'>" +
"<span>Instellingen</span><i class='fa fa-cogs'></i>" +
"</button>"
);
} else {
$buttonContainer.append(
"<button class='red group-button group-button-fancy' value='none'>" +
"<button class='red group-button fancy-button' value='none'>" +
"<span>Verlaat groep</span><i class='fa fa-sign-out'></i>" +
"</button>");
}

View File

@@ -3,8 +3,7 @@ var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "a
function fancyText(text) {
// Add links, images, gifs and (youtube) video's.
var regex = /(https?:\/\/.[^ <>"]*)/ig;
text = text.replace(regex, function(link) {
text = text.replace(/(https?:\/\/.[^ \n<>"]*)/ig, function(link) {
// Add images
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
return "<img alt='" + link + "' src='" + link + "' />";
@@ -39,7 +38,7 @@ function fancyText(text) {
}
// This function gets the value of a cookie when given a key.
// If didn´t find any compatible cookie, it returns false.
// If it didn´t find any compatible cookie, it returns false.
function getCookie(key) {
cookies = document.cookie.split("; ");
for (var i in cookies) {

View File

@@ -26,7 +26,7 @@ function requestPost(postID) {
function postPost() {
title = $("input.newpost[name='title']").val();
content = $("textarea.newpost[name='content']").val();
console.log(masonryMode);
if (masonryMode == 2) {
$.post("API/postPost.php", { title: title,
content : content,
@@ -36,6 +36,10 @@ function postPost() {
$('#alertbox').show();
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
window.scrollTo(0,0);
} else if (data == "logged out") {
window.location.href = "login.php?url=" + window.location.pathname;
} else if (data == "frozen") {
alert("Je account is bevroren, dus je kan geen posts plaatsen. Contacteer een admin als je denkt dat dit onjuist is.");
} else {
$('#alertbox').hide();
masonry(masonryMode);
@@ -49,6 +53,10 @@ function postPost() {
$('#alertbox').show();
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
window.scrollTo(0,0);
} else if (data == "logged out") {
window.location.href = "login.php?url=" + window.location.pathname;
} else if (data == "frozen") {
alert("Je account is bevroren, dus je kan geen posts plaatsen. Contacteer een admin als je denkt dat dit onjuist is.");
} else {
$('#alertbox').hide();
masonry(masonryMode);

View File

@@ -8,6 +8,8 @@ function postComment(buttonValue) {
).done(function (response) {
if (response == "frozen") {
alert("Je account is bevroren, dus je kan geen comments plaatsen of \"niet slechten\". Contacteer een admin als je denkt dat dit onjuist is.");
} else if (response == "logged out") {
window.location.href = "login.php?url=" + window.location.pathname;
}
});
@@ -30,6 +32,8 @@ function deletePost(postID) {
).done(function (response) {
if (response == "frozen") {
alert("Je account is bevroren, dus je kan geen posts verwijderen. Contacteer een admin als je denkt dat dit onjuist is.");
} else if (response == "logged out") {
window.location.href = "login.php?url=" + window.location.pathname;
}
});
closeModal();

View File

@@ -14,6 +14,8 @@
<?php
$alertClass;
$alertMessage;
// Select which button has been pressed.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
switch ($_POST["form"]) {
@@ -29,7 +31,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
case "picture":
updateAvatar();
break;
}
} catch (AlertMessage $w) {
$alertClass = $w->getClass();

View File

@@ -256,8 +256,6 @@ div[data-title]:hover:after {
top: 150%;
z-index: 200;
white-space: nowrap;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
background-color: #333;

View File

@@ -91,16 +91,5 @@
.deleteButton {
background-color: firebrick;
}
.deleteButton i {
display: inline-block;
}
.deleteButton:hover span {
display: inline-block;
}
.deleteButton span {
display: none;
float: right;
}

View File

@@ -27,16 +27,21 @@
display: inline-block;
}
.friend-button-container div, .status-buttons-container div {
width: 200px;
display: inline-block;
}
.friend-button-container button, .status-buttons-container button, .group-button-container button {
display: block;
float: right;
margin: 7px 0;
font-size: 18px;
}
.friend-button-container button, .status-buttons-container button, .group-button-fixed {
width: 200px;
.status-buttons-container button {
float: left;
}
.group-button-container button {
@@ -74,22 +79,21 @@
.group-picture {
border: none;
margin-right: 15px;
}
.group-button-fancy span {
.fancy-button span {
display: none;
}
.group-button-fancy:hover {
.fancy-button:hover {
text-align: right;
}
.group-button-fancy i {
.fancy-button i {
display: inline-block;
}
.group-button-fancy:hover span {
.fancy-button:hover span {
display: inline-block;
margin-right: 5px;
}

View File

@@ -41,7 +41,11 @@ function checkInputChoice($variable, $option){
}
}
/* Checks for only letters and spaces. */
/**
* Checks for only letters and spaces.
* @param $variable
* @throws lettersAndSpacesException
*/
function checkName($variable){
if (empty($variable)) {
throw new lettersAndSpacesException("Verplicht!");
@@ -52,7 +56,11 @@ function checkName($variable){
}
}
/* Checks for bday */
/**
* Checks for bday
* @param $variable
* @throws bdayException
*/
function validateBday($variable){
if (empty($variable)) {
throw new bdayException("Verplicht!");
@@ -219,6 +227,9 @@ function test_input($data) {
return $data;
}
/**
* Class lettersAndSpacesException
*/
class lettersAndSpacesException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -227,7 +238,9 @@ class lettersAndSpacesException extends Exception
}
}
/**
* Class bdayException
*/
class bdayException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -236,6 +249,9 @@ class bdayException extends Exception
}
}
/**
* Class usernameException
*/
class usernameException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -244,6 +260,9 @@ class usernameException extends Exception
}
}
/**
* Class passwordException
*/
class passwordException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -252,6 +271,9 @@ class passwordException extends Exception
}
}
/**
* Class confirmPasswordException
*/
class confirmPasswordException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -260,6 +282,9 @@ class confirmPasswordException extends Exception
}
}
/**
* Class fbConfirmPasswordException
*/
class fbConfirmPasswordException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -268,6 +293,9 @@ class fbConfirmPasswordException extends Exception
}
}
/**
* Class emailException
*/
class emailException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -276,6 +304,9 @@ class emailException extends Exception
}
}
/**
* Class confirmEmailException
*/
class confirmEmailException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -284,6 +315,9 @@ class confirmEmailException extends Exception
}
}
/**
* Class captchaException
*/
class captchaException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
@@ -292,6 +326,9 @@ class captchaException extends Exception
}
}
/**
* Class registerException
*/
class registerException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)

View File

@@ -10,6 +10,11 @@ else {
or die('Error connecting to mysql server');
}
/**
* Helperfunction to create a database query.
* @param string $query
* @return PDOStatement
*/
function prepareQuery(string $query) : PDOStatement {
return $GLOBALS["db"]->prepare($query);
}

View File

@@ -2,8 +2,13 @@
require_once "../queries/checkInput.php";
require_once "../queries/picture.php";
require_once "../queries/alerts.php";
/**
* Creates a group.
*/
function createGroup()
{
// Creates the group.
$createGroup = prepareQuery("
INSERT INTO
`group_page` (`name`, `description`)
@@ -13,6 +18,7 @@ function createGroup()
$createGroup->bindValue(':description', test_input($_POST["bio"]));
$createGroup->execute();
// Gets the groupID just created.
$getGroupID = prepareQuery("
SELECT
`groupID`
@@ -24,6 +30,7 @@ function createGroup()
$getGroupID->execute();
$groupID = $getGroupID->fetch()["groupID"];
// Adds the user as an admin.
$makeUserAdmin = prepareQuery("
INSERT INTO
`group_member` (userID, groupID, role)

View File

@@ -1,5 +1,8 @@
<?php
/**
* Sends a confirm email if you know the username.
* @param string $username
*/
function sendConfirmEmailUsername(string $username) {
$stmt = prepareQuery("
SELECT
@@ -15,6 +18,10 @@ function sendConfirmEmailUsername(string $username) {
sendConfirmEmail($userID);
}
/**
* Sends a confirm email if you know the userID.
* @param int $userID
*/
function sendConfirmEmail(int $userID) {
$stmt = prepareQuery("
SELECT

View File

@@ -1,4 +1,9 @@
<?php
/**
* Gets the current settings for a group.
* @param int $groupID
* @return mixed
*/
function getGroupSettings(int $groupID) {
$stmt = prepareQuery("
SELECT
@@ -15,6 +20,12 @@ function getGroupSettings(int $groupID) {
return $stmt->fetch();
}
/**
* Updates the settings for a group.
* @param int $groupID
* @throws AngryAlert
* @throws HappyAlert
*/
function updateGroupSettings(int $groupID)
{
if (!checkGroupAdmin($groupID, $_SESSION["userID"])) {
@@ -40,6 +51,12 @@ function updateGroupSettings(int $groupID)
}
}
/**
* Checks if an user is an admin for a page.
* @param int $groupID
* @param int $userID
* @return bool
*/
function checkGroupAdmin(int $groupID, int $userID) : bool {
$stmt = prepareQuery("
SELECT
@@ -60,7 +77,40 @@ function checkGroupAdmin(int $groupID, int $userID) : bool {
return ($role == "admin");
}
function getAllGroupMembers(int $groupID) {
/**
* Returns all normal members for a group.
* @param int $groupID
* @return array|bool
*/
function getAllGroupUsers(int $groupID) {
return getAllGroupMembers($groupID, 'member');
}
/**
* Returns all admin for a group.
* @param int $groupID
* @return array|bool
*/
function getAllGroupAdmins(int $groupID) {
return getAllGroupMembers($groupID, 'admin');
}
/**
* Returns all Moderators for a group.
* @param int $groupID
* @return array|bool
*/
function getAllGroupMods(int $groupID) {
return getAllGroupMembers($groupID, 'mod');
}
/**
* Returns all members for a group specified by a string.
* @param int $groupID
* @param string $role
* @return array|bool
*/
function getAllGroupMembers(int $groupID, string $role) {
$stmt = prepareQuery("
SELECT
`username`,
@@ -74,16 +124,25 @@ function getAllGroupMembers(int $groupID) {
ON
`group_member`.`userID` = `user`.`userID`
WHERE
`groupID` = :groupID AND `group_member`.`role` = 'member'
`groupID` = :groupID AND `group_member`.`role` = :role
");
$stmt->bindParam(':groupID', $groupID);
$stmt->bindParam(":role", $role);
if (!$stmt->execute()) {
return False;
}
return $stmt->fetchAll();
}
/**
* Upgrades or downgrades a groupmember to a different role.
* @param int $groupID
* @param int $userID
* @param string $role
* @throws AngryAlert
* @throws HappyAlert
*/
function upgradeUser(int $groupID, int $userID, string $role) {
if (!checkGroupAdmin($groupID, $_SESSION["userID"])) {
throw new AngryAlert("Geen toestemming om te wijzigen");
@@ -106,4 +165,28 @@ function upgradeUser(int $groupID, int $userID, string $role) {
} else {
throw new AngryAlert("Er is iets mis gegaan");
}
}
/**
* Removes a group form the database.
* @throws AngryAlert
* @throws HappyAlert
*/
function deleteGroup() {
if (!checkGroupAdmin($_POST["groupID"], $_SESSION["userID"])) {
throw new AngryAlert("Geen toestemming om de groep te verwijderen!");
}
$stmt = prepareQuery("
DELETE FROM
`group_page`
WHERE
`groupID` = :groupID
");
$stmt->bindValue(":groupID", $_POST["groupID"]);
$stmt->execute();
if ($stmt->rowCount()) {
throw new HappyAlert("Group verwijderd!");
} else {
throw new AngryAlert("Er is iets mis gegaan");
}
}

View File

@@ -1,6 +1,9 @@
<?php
//Find matching password with the inputted username/emailadress.
/**
* Find matching password with the inputted username/emailadress.
* @return mixed
*/
function getUser() {
$stmt = prepareQuery("
SELECT

View File

@@ -281,6 +281,12 @@ function checkPermissionOnPost(int $postID, int $userID) : bool {
}
}
/**
* Returns role of an user.
* @param int $userID
* @param int $groupID
* @return mixed role of an user.
*/
function getRoleInGroup(int $userID, int $groupID) {
$stmt = prepareQuery("
SELECT

View File

@@ -6,18 +6,23 @@ function getOldChatMessages($user2ID) {
if (getFriendshipStatus($user2ID) == 1) {
$stmt = prepareQuery("
SELECT
*
*
FROM
`private_message`
WHERE
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1
(SELECT
*
FROM
`private_message`
WHERE
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1
ORDER BY
`messageID` DESC
LIMIT
100) sub
ORDER BY
`creationdate` ASC
LIMIT
100
`messageID` ASC
");
$stmt->bindParam(":user1", $user1ID);
@@ -76,7 +81,7 @@ function getNewChatMessages($lastID, $destination) {
`destination` = :user1) AND
`messageID` > :lastID
ORDER BY
`creationdate` ASC
`messageID` ASC
");
$stmt->bindParam(':user1', $_SESSION["userID"]);

View File

@@ -16,7 +16,10 @@ function getSettings() {
`location`,
`birthdate`,
`bio`,
`profilepicture`,
IFNULL(
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
`showBday`,
`showEmail`,
`showProfile`

View File

@@ -1,6 +1,6 @@
<div class="content">
<div class="user-box">
<img class="group-picture main-picture" src="<?= $group["picture"] ?>"><br />
<img alt="<?= $group["name"] ?>" class="group-picture main-picture" src="<?= $group["picture"] ?>"><br />
<div class="platform">
<div class="status-buttons-container">
<button disabled class="gray"><?= $group["status"] ?></button>

View File

@@ -16,7 +16,7 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
<li>
<label></label>
<a href="group.php?groupname=<?=$groupinfo["name"]?>">
<button class="fa fa-chevron-left"> Terug naar de groep</button>
<button><i class="fa fa-chevron-left"></i> Terug naar de groep</button>
</a>
</li>
</ul>
@@ -51,8 +51,7 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
<button type="submit"
name="form"
value="group"
class="fa fa-save"
> Opslaan</button>
><i class="fa fa-save"></i> Opslaan</button>
</li>
</ul>
</form>
@@ -80,8 +79,7 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
<button type="submit"
name="form"
value="picture"
class="fa fa-picture-o"
> Verander profielfoto</button>
><i class="fa fa-picture-o"></i> Verander profielfoto</button>
</li>
</ul>
</form>
@@ -94,7 +92,7 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
<select name="userID">
<option disabled selected>Geen gebruiker geselecteerd:</option>
<?php
$groupMembers = getAllGroupMembers($_GET["groupID"]);
$groupMembers = getAllGroupUsers($_GET["groupID"]);
foreach ($groupMembers as $groupMember) {?>
<option value="<?=$groupMember["userID"]?>">
<?=$groupMember["fullname"]?> (<?=$groupMember["username"]?>)
@@ -114,11 +112,55 @@ $groupinfo = getGroupSettings($_GET["groupID"]);
</il>
</ul>
</form>
<form class="platform" method="post">
<h5>Verwijder een admin/mod</h5>
<ul>
<il>
<input name="groupID" value="<?=$_GET["groupID"]?>" type="hidden">
<label>Selecteer gebruiker</label>
<select name="userID">
<option disabled selected>Geen gebruiker geselecteerd:</option>
<?php
$groupAdmins = getAllGroupAdmins($_GET["groupID"]);
foreach ($groupAdmins as $groupAdmin) {?>
<option value="<?=$groupAdmin["userID"]?>">
<?=$groupAdmin["fullname"]?> (<?=$groupAdmin["username"]?>) (<?=$groupAdmin["role"]?>)
</option>
<?php } ?>
<?php
$groupMods = getAllGroupMods($_GET["groupID"]);
foreach ($groupMods as $groupMod) {?>
<option value="<?=$groupMod["userID"]?>">
<?=$groupMod["fullname"]?> (<?=$groupMod["username"]?>) (<?=$groupMod["role"]?>)
</option>
<?php } ?>
</select>
<button name="form"
value="deadmin"
>
Verwijder
</button>
</il>
</ul>
</form>
<form class="platform" method="post">
<ul>
<h5>Verwijder groep</h5>
<li>
<label></label>
<input name="groupID" value="<?=$_GET["groupID"]?>" type="hidden">
<button class="red"
name="form"
value="delete"
><i class="fa fa-trash"></i> Verwijder groep</button>
</li>
</ul>
</form>
<div class="platform">
<ul>
<li>
<label></label>
<a href="group.php?groupname=<?=$groupinfo["name"]?>"><button class="fa fa-chevron-left"> Terug naar de groep</button></a>
<a href="group.php?groupname=<?=$groupinfo["name"]?>"><button><i class="fa fa-chevron-left"></i> Terug naar de groep</button></a>
</li>
</ul>
</div>

View File

@@ -1,5 +1,5 @@
<meta charset="UTF-8">
<meta name="description" content="MyHyvesbook+ is het sociaal media voor alle coole mensen.">
<meta name="description" content="MyHyvesbook+ is het sociaal medium voor alle coole mensen. Stap nu over van facebook op het gloednieuwe en betere sociaal medium.">
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
<meta name="author" content="MyHyvesbookplus corporation">
<title>MyHyvesbook+</title>
@@ -26,8 +26,8 @@ require_once ("../queries/user.php");
session_start();
if(!isset($_SESSION["userID"])){
header("location:login.php");
if(!isset($_SESSION["userID"])) {
header("location:login.php?url=" . "$_SERVER[REQUEST_URI]");
} else {
updateLastActivity();
}

View File

@@ -23,9 +23,9 @@ $userinfo = getHeaderInfo();
<div id="hello-loop">
Hallo
</div>
<?=$userinfo["fname"]?>
<?= $userinfo["fname"] ?>
</div>
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/><i id="open-notifications" class="fa fa-bars"></i>
<img alt="<?= $userinfo["lname"] ?>" id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/><i id="open-notifications" class="fa fa-bars"></i>
</div>
</header>
<?php include("notification-center.php"); ?>

View File

@@ -29,13 +29,12 @@ $user = $psw = $remember ="";
$loginErr = $resetErr = $fbRegisterErr ="";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$url = $_POST["url"];
// Checks for which button is pressed
switch ($_POST["submit"]) {
case "login":
try {
$user = ($_POST["user"]);
validateLogin($_POST["user"], $_POST["psw"], $url);
validateLogin($_POST["user"], $_POST["psw"], $_POST["url"]);
} catch(loginException $e) {
$loginErr = $e->getMessage();
}

View File

@@ -1,6 +1,6 @@
<head>
<meta charset="UTF-8">
<meta name="description" content="MyHyvesbook+ is het sociaal media voor alle coole mensen.">
<meta name="description" content="MyHyvesbook+ is het sociaal medium voor alle coole mensen. Stap nu over van facebook op het gloednieuwe en betere sociaal medium.">
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
<meta name="author" content="MyHyvesbookplus corporation">
<title>MyHyvesbook+</title>

View File

@@ -5,14 +5,6 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
?>
<div class='post-header header'>
<h4><?=$post['title']?></h4>
<?php if (checkPermissionOnPost($postID, $_SESSION["userID"])) {?>
<button class="deleteButton"
onclick="deletePost('<?=$postID?>')"
type="submit">
<i class="fa fa-trash"></i>
<span>Verwijder post</span>
</button><br />
<?php } ?>
<span class='postinfo'>
gepost door <?=$fullname?>,
<span class='posttime' title='<?=$post['creationdate']?>'>
@@ -20,7 +12,14 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
</span>
</span>
</div>
<?php if (checkPermissionOnPost($postID, $_SESSION["userID"])) {?>
<button class="deleteButton fancy-button"
onclick="deletePost('<?=$postID?>')"
type="submit">
<span>Verwijder post</span>
<i class="fa fa-trash"></i>
</button><br />
<?php } ?>
<div class='post-content'>
<p><?=$post['content']?></p>
</div>

View File

@@ -4,13 +4,19 @@
</div>
<div class="user-box">
<img class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br />
<img alt="<?= $user["fname"] ?>" class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br />
<div class="platform">
<div class="status-buttons-container">
<button disabled class="gray">
<?= $user["onlinestatus"] ?>
</button>
<button disabled class="gray"><?= $user["role"] ?></button>
<div>
<button disabled class="gray">
<?= $user["onlinestatus"] ?>
</button>
</div>
<div>
<button disabled class="gray">
<?= $user["role"] ?>
</button>
</div>
</div>
<div class="friend-button-container">
<p>:)</p>
@@ -33,18 +39,16 @@
<?php if($showProfile) { ?>
<div class="item-box platform">
<h3>Informatie</h3>
<p>
<ul>
<?php if ($user["showBday"]) { ?>
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
<?php } ?>
<?php if ($user["showEmail"]) { ?>
<li>Email: <?= $user["email"] ?></li>
<?php } ?>
<li>Locatie: <?= $user["location"] ?></li>
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
</ul>
</p>
<ul>
<?php if ($user["showBday"]) { ?>
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
<?php } ?>
<?php if ($user["showEmail"]) { ?>
<li>Email: <?= $user["email"] ?></li>
<?php } ?>
<li>Locatie: <?= $user["location"] ?></li>
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
</ul>
</div>
<div class="item-box platform">
@@ -52,7 +56,7 @@
<p>
<?php
while($friend = $profile_friends->fetch()) {
echo "<a href='profile.php?username=${friend["username"]}' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
echo "<a href='profile.php?username=${friend["username"]}' data-title='${friend["username"]}'><img class='profile-picture' height='42' width='42' src='${friend["profilepicture"]}' alt='${friend["username"]}' /></a>";
}

View File

@@ -45,8 +45,8 @@ $settings = getSettings();
</li>
<li>
<?php $currentbday = new DateTime($settings["birthdate"]); ?>
<label for="bday">Geboortedatum</label>
<select name='day' id="bday">
<label>Geboortedatum</label>
<select name='day'>
<?php for ($day = 1; $day <= 31; $day++): ?>
<option value='<?=$day?>'
<?=($day == $currentbday->format("d")) ? "selected" : ""?>
@@ -55,7 +55,7 @@ $settings = getSettings();
</option>
<?php endfor; ?>
</select>
<select name='month' id="bday">
<select name='month'>
<?php
$months = array ("januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus",
"september", "oktober", "november", "december");
@@ -68,7 +68,7 @@ $settings = getSettings();
</option>
<?php endfor; ?>
</select>
<select name='year' id="bday">
<select name='year'>
<?php
$now = (new DateTime)->format("Y");
for ($year = $now; $year >= 1900; $year--): ?>