Merge branch 'master' into hendrik-testing

This commit is contained in:
Hendrik
2017-01-20 15:39:44 +01:00
16 changed files with 138 additions and 125 deletions

View File

@@ -9,6 +9,4 @@ RewriteCond %{SCRIPT_FILENAME} !-f
# Resolve .php file for extensionless php urls # Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L] RewriteRule ^([^/.]+)$ $1.php [L]
RewriteRule ^([^/.]+)\/$ $1.php [L] RewriteRule ^profile/([A-z0-9]+)$ profile.php?username=$1 [NC]
RewriteRule ^profile/([A-z0-9]+)\/?$ profile.php?username=$1 [NC]

View File

@@ -3,11 +3,10 @@
session_start(); session_start();
require_once("../../queries/connect.php"); require_once("../../queries/connect.php");
require_once("../../queries/private_message.php"); require_once("../../queries/private_message.php");
require_once("../../queries/checkInput.php");
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") { if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
echo getNewChatMessages(test_input($_POST["lastID"]), test_input($_POST["destination"]));
echo getNewChatMessages($_POST["lastID"], $_POST["destination"]);
} else { } else {
echo getOldChatMessages($_POST["destination"]); echo getOldChatMessages(test_input($_POST["destination"]));
} }

View File

@@ -3,16 +3,15 @@
session_start(); session_start();
require_once("../../queries/connect.php"); require_once("../../queries/connect.php");
require_once("../../queries/private_message.php"); require_once("../../queries/private_message.php");
require_once("../../queries/checkInput.php");
if (isset($_POST["destination"]) && if (!empty(test_input($_POST["destination"])) &&
isset($_POST["content"])) { !empty(test_input($_POST["content"]))) {
if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
if (sendMessage($_POST["destination"], $_POST["content"])) { echo 1;
echo $_POST["content"] . " is naar " . $_POST["destination"] . " gestuurd";
} else { } else {
echo "YOU FAILED!!!"; echo 0;
} }
} else { } else {
echo "maybe dont try to hax the system?"; echo 0;
} }

View File

@@ -10,7 +10,6 @@ function loadMessages() {
$("#lastIDForm").serialize() $("#lastIDForm").serialize()
).done(function(data) { ).done(function(data) {
if (data && data != "[]") { if (data && data != "[]") {
console.log(data);
messages = JSON.parse(data); messages = JSON.parse(data);
addMessages(messages); addMessages(messages);
$("#lastID").val(messages[messages.length - 1].messageID); $("#lastID").val(messages[messages.length - 1].messageID);
@@ -23,13 +22,10 @@ function loadMessages() {
function sendMessage() { function sendMessage() {
console.log($("#sendMessageForm").serialize());
$.post( $.post(
"API/sendMessage.php", "API/sendMessage.php",
$("#sendMessageForm").serialize() $("#sendMessageForm").serialize()
).done(function( data ) { );
console.log(data);
});
$("#newContent").val(""); $("#newContent").val("");
} }

View File

@@ -7,6 +7,17 @@
include_once("../queries/checkInput.php") include_once("../queries/checkInput.php")
?> ?>
<body> <body>
<script>
function checkLoggedIn() {
if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) {
window.location.href = "logout.php";
} else {
window.history.back();
}
document.getElementById("demo").innerHTML = x;
}
</script>
<?php <?php
session_start(); session_start();
@@ -48,18 +59,5 @@
/* This view adds login view */ /* This view adds login view */
include("../views/login-view.php"); include("../views/login-view.php");
?> ?>
<script>
function checkLoggedIn() {
if (confirm("You are already logged in!\Do you want to logout?\Press ok to logout.") == true) {
unset($_SESSION["userID"]);
header("Location: login.php");
} else {
header("location: profile.php");
}
document.getElementById("demo").innerHTML = x;
}
</script>
</body> </body>
</html> </html>

View File

@@ -1,45 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<?php include("../views/head.php"); ?>
<script src="/js/masonry.js"></script>
<style>
@import url("/styles/profile.css");
</style>
</head>
<body>
<?php <?php
include("../queries/user.php"); include("../queries/user.php");
include("../queries/friendship.php"); include("../queries/friendship.php");
include("../queries/nicetime.php");
function nicetime($date) {
if(empty($date)) {
return "No date provided";
}
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
$now = time();
$unix_date = strtotime($date);
if(empty($unix_date)) {
return "Bad date";
}
if($now > $unix_date) {
$difference = $now - $unix_date;
$tense = "geleden";
} else {
$difference = $unix_date - $now;
$tense = "vanaf nu";
}
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
$difference /= $lengths[$i];
}
$difference = round($difference);
if($difference != 1) {
$period = $multiple_periods[$i];
} else {
$period = $single_periods[$i];
}
return "$difference $period $tense";
}
if(empty($_GET["username"])) { if(empty($_GET["username"])) {
$userID = $_SESSION["userID"]; $userID = $_SESSION["userID"];
@@ -52,18 +24,6 @@ $profile_friends = selectAllFriends($userID);
$profile_groups = selectAllUserGroups($userID); $profile_groups = selectAllUserGroups($userID);
$posts = selectAllUserPosts($userID); $posts = selectAllUserPosts($userID);
?>
<!DOCTYPE html>
<html>
<head>
<?php include("../views/head.php"); ?>
<style>
@import url("styles/profile.css");
</style>
</head>
<body>
<?php
/* /*
* This view adds the main layout over the screen. * This view adds the main layout over the screen.
* Header, menu, footer. * Header, menu, footer.

View File

@@ -1,7 +1,7 @@
a.button { a.button {
background-color: #405550; background-color: #C8CABD;
border-radius: 10px; border-radius: 10px;
color: white; color: black;
cursor: pointer; cursor: pointer;
height: 50%; height: 50%;
margin: 8px 0; margin: 8px 0;
@@ -46,8 +46,8 @@ body {
form { form {
/*background-color: #a87a87;*/ /*background-color: #a87a87;*/
border-radius: 12px; border-radius: 12px;
height: 75%; height: 80%;
margin: 10px auto; margin: auto;
width: 70%; width: 70%;
overflow-y:auto; overflow-y:auto;
} }
@@ -66,14 +66,15 @@ h2 {
font-size: 2.0em; font-size: 2.0em;
} }
input[type=text], input[type=password], input[type=email], input[type="date"] { input[type=text], input[type=password], input[type=email], input[type="date"] {
box-sizing: border-box; box-sizing: border-box;
border-color: #C8CABD; border-color: #C8CABD;
display: inline-block; display: inline-block;
height: 50%; height: 60%;
padding: 8px 20px; padding: 8px 20px;
margin: 4px 0; margin: 4px 0;
width: 50%; width: 70%;
} }
/* /*
input[type=text], input[type=password], input[type=email], input[type="date"] { input[type=text], input[type=password], input[type=email], input[type="date"] {
@@ -101,6 +102,31 @@ label {
display: block; display: block;
} }
.left-arrow {
display: inline-block;
position: relative;
background-color: #C8CABD;
height: 30px;
width: 90px;
padding: 3px 3px 3px 0px;
text-align: center;
border-radius: 0px 10px 10px 0px;
font-size: 24px;
}
.left-arrow:after {
content: '';
display: block;
position: absolute;
right: 100%;
top: 0;
bottom: 0;
border-top: 15px solid transparent;
border-right: 20px solid #C8CABD;
border-bottom: 15px solid transparent;
border-left: 0px solid transparent;
}
/* padding voor registreer container */ /* padding voor registreer container */
.login_containerregister { .login_containerregister {
padding: 16px; padding: 16px;
@@ -109,7 +135,7 @@ label {
/* padding voor login_containers */ /* padding voor login_containers */
.login_containerlogin { .login_containerlogin {
padding: 16px; padding:25px;
text-align: center; text-align: center;
} }
@@ -133,11 +159,11 @@ label {
background-repeat: repeat-x; background-repeat: repeat-x;
background-attachment: fixed;*/ background-attachment: fixed;*/
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
height: 53%; height: 550px;
margin: 34px auto; margin: 34px auto;
overflow-y: auto; overflow-y: auto;
padding: 20px; padding: 20px;
width: 35%; width: 50%;
} }
/*.platform { /*.platform {

View File

@@ -0,0 +1,39 @@
<?php
function nicetime($date) {
if(empty($date)) {
return "No date provided";
}
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
$now = time();
$unix_date = strtotime($date);
if(empty($unix_date)) {
return "Bad date";
}
if($now > $unix_date) {
$difference = $now - $unix_date;
$tense = "geleden";
} else {
$difference = $unix_date - $now;
$tense = "vanaf nu";
}
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
$difference /= $lengths[$i];
}
$difference = round($difference);
if($difference != 1) {
$period = $multiple_periods[$i];
} else {
$period = $single_periods[$i];
}
return "$difference $period $tense";
}

View File

@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Admin Panel</title> <title>Admin Panel</title>
<script src="../public/js/admin.js" charset="utf-8"></script> <script src="/js/admin.js" charset="utf-8"></script>
<?php <?php
include_once("../queries/user.php"); include_once("../queries/user.php");
include_once("../queries/group_page.php"); include_once("../queries/group_page.php");

View File

@@ -1,17 +1,16 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>MyHyvesbook+</title> <title>MyHyvesbook+</title>
<!-- Add your javascript files here. --> <!-- Add your javascript files here. -->
<script src="js/jquery.js"></script> <script src="/js/jquery.js"></script>
<script src="js/header.js"></script> <script src="/js/header.js"></script>
<script src="js/menu.js"></script> <script src="/js/menu.js"></script>
<script src="js/masonry.js"></script>
<style> <style>
/* Add your css files here. */ /* Add your css files here. */
@import url("styles/main.css"); @import url("/styles/main.css");
@import url("styles/font-awesome.css"); @import url("/styles/font-awesome.css");
@import url("styles/header.css"); @import url("/styles/header.css");
@import url("styles/menu.css"); @import url("/styles/menu.css");
@import url("styles/footer.css"); @import url("/styles/footer.css");
</style> </style>
<?php <?php

View File

@@ -5,10 +5,10 @@ $userinfo = getHeaderInfo();
?> ?>
<header> <header>
<div id="header-logo"> <div id="header-logo">
<a href="profile.php"><img src="img/top-logo.png" alt="MyHyvesbook+" /></a> <a href="profile.php"><img src="/img/top-logo.png" alt="MyHyvesbook+" /></a>
</div> </div>
<div id="header-search"> <div id="header-search">
<form action="search.php" method="get"> <form action="/search" method="get">
<input name="search" <input name="search"
type="text" type="text"
placeholder="Zoek naar wat je wil" placeholder="Zoek naar wat je wil"
@@ -20,9 +20,9 @@ $userinfo = getHeaderInfo();
</div> </div>
<div class="right profile-menu"> <div class="right profile-menu">
<div id="profile-menu-popup"> <div id="profile-menu-popup">
<a href="logout.php"><span style="color: red;" class="fa fa-sign-out" data-title="Uitloggen"></span></a> | <a href="/logout"><span style="color: red;" class="fa fa-sign-out" data-title="Uitloggen"></span></a> |
<a href="settings.php"><span style="color: blue;" class="fa fa-cog" data-title="Instellingen"></span></a> | <a href="/settings"><span style="color: blue;" class="fa fa-cog" data-title="Instellingen"></span></a> |
<a href="profile.php"><span style="color: green;" class="fa fa-user" data-title="Profiel"></span></a> <a href="/profile"><span style="color: green;" class="fa fa-user" data-title="Profiel"></span></a>
</div> </div>
<div id="profile-hello-popup"> <div id="profile-hello-popup">
<div id="hello-loop"> <div id="hello-loop">
@@ -32,5 +32,5 @@ $userinfo = getHeaderInfo();
</div> </div>
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/> <img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
</div> </div>
<a href="chat.php"><div class="right fa fa-comments-o" id="open-chat" data-title="Prive chats"></div></a> <a href="/chat"><div class="right fa fa-comments-o" id="open-chat" data-title="Prive chats"></div></a>
</header> </header>

View File

@@ -1,6 +1,6 @@
<div> <div>
<img style="width:50%;margin-left:25%" <img style="width:50%;margin-left:25%"
src="img/top-logo.png" src="/img/top-logo.png"
alt="MyHyvesbook+"> alt="MyHyvesbook+">
</div> </div>
<div class="platform"> <div class="platform">
@@ -46,6 +46,6 @@
</form> </form>
<!-- Button for going to the register screen --> <!-- Button for going to the register screen -->
<div class="login_containerlogin"> <div class="login_containerlogin">
<a href="https://myhyvesbookplus.nl/register.php" class="button">Registreer een account</a> <a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
</div> </div>
</div> </div>

View File

@@ -3,9 +3,9 @@
<title>MyHyvesbook+</title> <title>MyHyvesbook+</title>
<link rel="stylesheet" <link rel="stylesheet"
type="text/css" type="text/css"
href="styles/main.css"> href="/styles/main.css">
<link rel="stylesheet" <link rel="stylesheet"
type="text/css" type="text/css"
href="styles/index.css"> href="/styles/index.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="/js/jquery.js"></script>
</head> </head>

View File

@@ -51,7 +51,7 @@
echo " echo "
<li class='friend-item'> <li class='friend-item'>
<form action='profile.php' method='get'> <form action='/profile' method='get'>
<button type='submit' <button type='submit'
name='username' name='username'
value='$randomUser'> value='$randomUser'>

View File

@@ -2,7 +2,7 @@
<div class="profile-box platform"> <div class="profile-box platform">
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>"> <img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
<div class="profile-button"> <div class="profile-button">
<p><img src="img/add-friend.png"> Als vriend toevoegen</p> <p><img src="/img/add-friend.png"> Als vriend toevoegen</p>
</div> </div>
<h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?> (<?=$user["username"]?>)</h1> <h1 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?> (<?=$user["username"]?>)</h1>
<p><?=$user["bio"]?></p> <p><?=$user["bio"]?></p>
@@ -13,11 +13,11 @@
<p> <p>
<?php <?php
while($friend = $profile_friends->fetch()) { while($friend = $profile_friends->fetch()) {
echo "<a href='#' 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>";
} }
if($friends->rowCount() === 0) { if($profile_friends->rowCount() === 0) {
echo "<p>Deze gebruiker heeft nog geen vrienden gemaakt.</p>"; echo "<p>Deze gebruiker heeft nog geen vrienden gemaakt.</p>";
} }
?> ?>
@@ -29,10 +29,10 @@
<p> <p>
<?php <?php
while($group = $profile_groups->fetch()) { while($group = $profile_groups->fetch()) {
echo "<a href='#' 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($groups->rowCount() === 0) { if($profile_groups->rowCount() === 0) {
echo "<p>Deze gebruiker is nog geen lid van een groep.</p>"; echo "<p>Deze gebruiker is nog geen lid van een groep.</p>";
} }
?> ?>

View File

@@ -1,6 +1,6 @@
<div> <div>
<img style="width:50%;margin-left:25%" <img style="width:50%;margin-left:25%"
src="img/top-logo.png" src="/img/top-logo.png"
alt="MyHyvesbook+"> alt="MyHyvesbook+">
</div> </div>
@@ -123,13 +123,12 @@
value="Registreer uw account" value="Registreer uw account"
name="Submit" name="Submit"
id="frm1_submit"> id="frm1_submit">
Registreer uw account Registreer
</button> </button>
</div> </div>
</form> </form>
<!-- Button for going back to login screen -->
<div class="login_containerlogin"> <div class="login_containerlogin">
<a href="https://myhyvesbookplus.nl/login.php" class="button">Login met een account</a> <!-- Button for going back to login screen -->
<a href="https://myhyvesbookplus.nl/login.php" class="left-arrow">Login</a>
</div> </div>
</div> </div>