Merge branch 'master' into lars

This commit is contained in:
Lars van Hijfte
2017-02-02 17:45:10 +01:00
12 changed files with 335 additions and 18 deletions

View File

@@ -0,0 +1,36 @@
<?php
require_once "../queries/createGroup.php";
require_once "../queries/connect.php";
require_once "../queries/alerts.php"?>
<!DOCTYPE html>
<html>
<head>
<?php include("../views/head.php"); ?>
<style>
@import url("styles/settings.css");
</style>
</head>
<body>
<?php
/*
* This view adds the main layout over the screen.
* Header and menu.
*/
include("../views/main.php");
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
createGroup();
} catch (AlertMessage $e) {
}
$groupname = $_POST["groupName"];
header("location: group.php?groupname=$groupname");
}
/* Add your view files here. */
include("../views/createGroup.php");
/* This adds the footer. */
include("../views/footer.php");
?>
</body>
</html>

View File

@@ -13,9 +13,16 @@
include_once("../queries/group_page.php");
$group = selectGroupByName($_GET["groupname"]);
if(!$group = selectGroupByName($_GET["groupname"])) {
header("HTTP/1.0 404 Not Found");
header("Location: error/404.php");
die();
}
$members = selectGroupMembers($group["groupID"]);
/*
* This view adds the main layout over the screen.
* Header, menu, footer.

View File

@@ -0,0 +1,46 @@
<?php
require_once "../queries/picture.php";
require_once "../queries/groupAdmin.php";
require_once "../queries/alerts.php";
?>
<!DOCTYPE html>
<html>
<head>
<?php include("../views/head.php"); ?>
<style>
/*Insert own stylesheet here ;)*/
@import url("styles/settings.css");
</style>
</head>
<body>
<?php
/*
* This view adds the main layout over the screen.
* Header and menu.
*/
include("../views/main.php");
$alertClass;
$alertMessage;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
if ($_POST["form"] == "group") {
updateGroupSettings($_POST["groupID"]);
} else if ($_POST["form"] == "picture") {
if (checkGroupAdmin($_POST["groupID"], $_SESSION["userID"])) {
updateAvatar($_POST["groupID"]);
}
}
} catch (AlertMessage $w) {
$alertClass = $w->getClass();
$alertMessage = $w->getMessage();
}
}
/* Add your view files here. */
include("../views/groupAdmin.php");
/* This adds the footer. */
include("../views/footer.php");
?>
</body>
</html>

View File

@@ -21,19 +21,19 @@ include_once("../queries/calcAge.php");
if(empty($_GET["username"])) {
$userID = $_SESSION["userID"];
$showProfile = True;
} else {
$userID = getUserID($_GET["username"]);
$showProfile = False;
}
$user = selectUser($_SESSION["userID"], $userID);
if(!$user = selectUser($_SESSION["userID"], $userID)) {
header("HTTP/1.0 404 Not Found");
header("Location: error/404.php");
die();
}
$profile_friends = selectAllFriends($userID);
$profile_groups = selectAllUserGroups($userID);
$showProfile = $showProfile || $user["showProfile"] || ($user["status"] == 'confirmed');
echo " friendship status: " . $user["status"];
echo " showprofile: $showProfile";
echo " userID: " . $user["userID"];
$showProfile = $user["showProfile"] || ($user["status"] == 'confirmed') || $_SESSION["userID"] == $userID;
if ($userID == $_SESSION["userID"]) {