Compare commits
29 Commits
marijn-fav
...
marijn-gro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d5de98c1d | ||
|
|
ac2ce3d07b | ||
|
|
5de3a84683 | ||
|
|
1862369013 | ||
|
|
8d70804155 | ||
|
|
0ac12f5110 | ||
|
|
5e8fa6791f | ||
|
|
fe190975d5 | ||
|
|
87b0ab5892 | ||
|
|
c8dbdfe70e | ||
|
|
8949d14a5e | ||
|
|
ecd24ef442 | ||
|
|
50e94fb8ed | ||
|
|
127162b938 | ||
|
|
02349dbe28 | ||
|
|
da01729b61 | ||
|
|
820ffb4a62 | ||
|
|
1a3efe9669 | ||
|
|
6d739a4480 | ||
|
|
ab21226925 | ||
|
|
7e4107ac8b | ||
|
|
de96ae8263 | ||
|
|
e9468b0ec8 | ||
|
|
839fb247b4 | ||
|
|
bf298f4b43 | ||
|
|
1486e71207 | ||
|
|
b206d243b9 | ||
|
|
4f731e12fe | ||
|
|
f8c9454b85 |
@@ -3,10 +3,10 @@ session_start();
|
|||||||
|
|
||||||
require_once "../../queries/post.php";
|
require_once "../../queries/post.php";
|
||||||
require_once "../../queries/user.php";
|
require_once "../../queries/user.php";
|
||||||
|
if (!isset($_SESSION["userID"])) {
|
||||||
if (isset($_SESSION["userID"]) and
|
echo "logged out";
|
||||||
getRoleByID($_SESSION["userID"]) != 'frozen' and
|
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' and
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
|
|
||||||
if (empty($_POST["postID"]) or empty($_SESSION["userID"])) {
|
if (empty($_POST["postID"]) or empty($_SESSION["userID"])) {
|
||||||
header('HTTP/1.1 500 Non enough arguments');
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ require_once("../../queries/connect.php");
|
|||||||
require_once("../../queries/checkInput.php");
|
require_once("../../queries/checkInput.php");
|
||||||
require_once("../../queries/user.php");
|
require_once("../../queries/user.php");
|
||||||
|
|
||||||
|
if (!isset($_SESSION["userID"])) {
|
||||||
if (isset($_SESSION["userID"]) &&
|
echo "logged out";
|
||||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
if ($_POST['button'] == 'reaction') {
|
if ($_POST['button'] == 'reaction') {
|
||||||
if (empty($_POST['newcomment-content'])) {
|
if (empty($_POST['newcomment-content'])) {
|
||||||
echo 0;
|
echo 0;
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ require_once("../../queries/connect.php");
|
|||||||
require_once("../../queries/checkInput.php");
|
require_once("../../queries/checkInput.php");
|
||||||
require_once("../../queries/user.php");
|
require_once("../../queries/user.php");
|
||||||
|
|
||||||
if (isset($_SESSION["userID"]) &&
|
if (!isset($_SESSION["userID"])) {
|
||||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
echo "logged out";
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
|
|
||||||
if (empty($_SESSION["userID"])) {
|
if (empty($_SESSION["userID"])) {
|
||||||
header('HTTP/1.1 500 Non enough arguments');
|
header('HTTP/1.1 500 Non enough arguments');
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ require_once("../../queries/checkInput.php");
|
|||||||
require_once("../../queries/user.php");
|
require_once("../../queries/user.php");
|
||||||
|
|
||||||
// Check if the user is allowed to send a message.
|
// Check if the user is allowed to send a message.
|
||||||
if (isset($_SESSION["userID"]) &&
|
if (!isset($_SESSION["userID"])) {
|
||||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
echo "logged out";
|
||||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||||
|
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||||
if (!empty(test_input($_POST["destination"])) &&
|
if (!empty(test_input($_POST["destination"])) &&
|
||||||
!empty(test_input($_POST["content"]))
|
!empty(test_input($_POST["content"]))
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
$fb = new Facebook\Facebook([
|
|
||||||
'app_id' => $appID, // Replace {app-id} with your app id
|
|
||||||
'app_secret' => $appSecret,
|
|
||||||
'default_graph_version' => 'v2.2',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$helper = $fb->getRedirectLoginHelper();
|
|
||||||
|
|
||||||
try {
|
|
||||||
$accessToken = $helper->getAccessToken();
|
|
||||||
} catch(Facebook\Exceptions\FacebookResponseException $e) {
|
|
||||||
// When Graph returns an error
|
|
||||||
echo 'Graph returned an error: ' . $e->getMessage();
|
|
||||||
exit;
|
|
||||||
} catch(Facebook\Exceptions\FacebookSDKException $e) {
|
|
||||||
// When validation fails or other local issues
|
|
||||||
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! isset($accessToken)) {
|
|
||||||
if ($helper->getError()) {
|
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
echo "Error: " . $helper->getError() . "\n";
|
|
||||||
echo "Error Code: " . $helper->getErrorCode() . "\n";
|
|
||||||
echo "Error Reason: " . $helper->getErrorReason() . "\n";
|
|
||||||
echo "Error Description: " . $helper->getErrorDescription() . "\n";
|
|
||||||
} else {
|
|
||||||
header('HTTP/1.0 400 Bad Request');
|
|
||||||
echo 'Bad request';
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logged in
|
|
||||||
echo '<h3>Access Token</h3>';
|
|
||||||
var_dump($accessToken->getValue());
|
|
||||||
|
|
||||||
// The OAuth 2.0 client handler helps us manage access tokens
|
|
||||||
$oAuth2Client = $fb->getOAuth2Client();
|
|
||||||
|
|
||||||
// Get the access token metadata from /debug_token
|
|
||||||
$tokenMetadata = $oAuth2Client->debugToken($accessToken);
|
|
||||||
echo '<h3>Metadata</h3>';
|
|
||||||
var_dump($tokenMetadata);
|
|
||||||
|
|
||||||
// Validation (these will throw FacebookSDKException's when they fail)
|
|
||||||
$tokenMetadata->validateAppId($appID); // Replace {app-id} with your app id
|
|
||||||
// If you know the user ID this access token belongs to, you can validate it here
|
|
||||||
//$tokenMetadata->validateUserId('123');
|
|
||||||
$tokenMetadata->validateExpiration();
|
|
||||||
|
|
||||||
if (! $accessToken->isLongLived()) {
|
|
||||||
// Exchanges a short-lived access token for a long-lived one
|
|
||||||
try {
|
|
||||||
$accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
|
|
||||||
} catch (Facebook\Exceptions\FacebookSDKException $e) {
|
|
||||||
echo "<p>Error getting long-lived access token: " . $helper->getMessage() . "</p>\n\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<h3>Long-lived</h3>';
|
|
||||||
var_dump($accessToken->getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
$_SESSION['fb_access_token'] = (string) $accessToken;
|
|
||||||
|
|
||||||
// User is logged in with a long-lived access token.
|
|
||||||
// You can redirect them to a members-only page.
|
|
||||||
//header('Location: https://example.com/members.php');
|
|
||||||
@@ -43,6 +43,8 @@ function sendMessage() {
|
|||||||
).done(function(response) {
|
).done(function(response) {
|
||||||
if (response == "frozen") {
|
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.");
|
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.
|
// Load messages if the message has been send, so it shows in the chat.
|
||||||
loadMessages();
|
loadMessages();
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
/**
|
|
||||||
* jQuery DOB Picker
|
|
||||||
* Website: https://github.com/tyea/dobpicker
|
|
||||||
* Version: 1.0
|
|
||||||
* Author: Tom Yeadon
|
|
||||||
* License: BSD 3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
jQuery.extend({
|
|
||||||
|
|
||||||
dobPicker: function(params) {
|
|
||||||
|
|
||||||
// set the defaults
|
|
||||||
if (typeof(params.dayDefault)==='undefined') params.dayDefault = 'Day';
|
|
||||||
if (typeof(params.monthDefault)==='undefined') params.monthDefault = 'Month';
|
|
||||||
if (typeof(params.yearDefault)==='undefined') params.yearDefault = 'Year';
|
|
||||||
if (typeof(params.minimumAge)==='undefined') params.minimumAge = 12;
|
|
||||||
if (typeof(params.maximumAge)==='undefined') params.maximumAge = 80;
|
|
||||||
|
|
||||||
// set the default messages
|
|
||||||
$(params.daySelector).append('<option value="">' + params.dayDefault + '</option>');
|
|
||||||
$(params.monthSelector).append('<option value="">' + params.monthDefault + '</option>');
|
|
||||||
$(params.yearSelector).append('<option value="">' + params.yearDefault + '</option>');
|
|
||||||
|
|
||||||
// populate the day select
|
|
||||||
for (i = 1; i <= 31; i++) {
|
|
||||||
if (i <= 9) {
|
|
||||||
var val = '0' + i;
|
|
||||||
} else {
|
|
||||||
var val = i;
|
|
||||||
}
|
|
||||||
$(params.daySelector).append('<option value="' + val + '">' + i + '</option>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// populate the month select
|
|
||||||
var months = [
|
|
||||||
"January",
|
|
||||||
"February",
|
|
||||||
"March",
|
|
||||||
"April",
|
|
||||||
"May",
|
|
||||||
"June",
|
|
||||||
"July",
|
|
||||||
"August",
|
|
||||||
"September",
|
|
||||||
"October",
|
|
||||||
"November",
|
|
||||||
"December"
|
|
||||||
];
|
|
||||||
|
|
||||||
for (i = 1; i <= 12; i++) {
|
|
||||||
if (i <= 9) {
|
|
||||||
var val = '0' + i;
|
|
||||||
} else {
|
|
||||||
var val = i;
|
|
||||||
}
|
|
||||||
$(params.monthSelector).append('<option value="' + val + '">' + months[i - 1] + '</option>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// populate the year select
|
|
||||||
var date = new Date();
|
|
||||||
var year = date.getFullYear();
|
|
||||||
var start = year - params.minimumAge;
|
|
||||||
var count = start - params.maximumAge;
|
|
||||||
|
|
||||||
for (i = start; i >= count; i--) {
|
|
||||||
$(params.yearSelector).append('<option value="' + i + '">' + i + '</option>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// do the logic for the day select
|
|
||||||
$(params.daySelector).change(function() {
|
|
||||||
|
|
||||||
$(params.monthSelector)[0].selectedIndex = 0;
|
|
||||||
$(params.yearSelector)[0].selectedIndex = 0;
|
|
||||||
$(params.yearSelector + ' option').removeAttr('disabled');
|
|
||||||
|
|
||||||
if ($(params.daySelector).val() >= 1 && $(params.daySelector).val() <= 29) {
|
|
||||||
|
|
||||||
$(params.monthSelector + ' option').removeAttr('disabled');
|
|
||||||
|
|
||||||
} else if ($(params.daySelector).val() == 30) {
|
|
||||||
|
|
||||||
$(params.monthSelector + ' option').removeAttr('disabled');
|
|
||||||
$(params.monthSelector + ' option[value="02"]').attr('disabled', 'disabled');
|
|
||||||
|
|
||||||
} else if($(params.daySelector).val() == 31) {
|
|
||||||
|
|
||||||
$(params.monthSelector + ' option').removeAttr('disabled');
|
|
||||||
$(params.monthSelector + ' option[value="02"]').attr('disabled', 'disabled');
|
|
||||||
$(params.monthSelector + ' option[value="04"]').attr('disabled', 'disabled');
|
|
||||||
$(params.monthSelector + ' option[value="06"]').attr('disabled', 'disabled');
|
|
||||||
$(params.monthSelector + ' option[value="09"]').attr('disabled', 'disabled');
|
|
||||||
$(params.monthSelector + ' option[value="11"]').attr('disabled', 'disabled');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// do the logic for the month select
|
|
||||||
$(params.monthSelector).change(function() {
|
|
||||||
|
|
||||||
$(params.yearSelector)[0].selectedIndex = 0;
|
|
||||||
$(params.yearSelector + ' option').removeAttr('disabled');
|
|
||||||
|
|
||||||
if ($(params.daySelector).val() == 29 && $(params.monthSelector).val() == '02') {
|
|
||||||
|
|
||||||
$(params.yearSelector + ' option').each(function(index) {
|
|
||||||
if (index !== 0) {
|
|
||||||
var year = $(this).attr('value');
|
|
||||||
var leap = !((year % 4) || (!(year % 100) && (year % 400)));
|
|
||||||
if (leap === false) {
|
|
||||||
$(this).attr('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
1
website/public/js/dobPicker.min.js
vendored
1
website/public/js/dobPicker.min.js
vendored
@@ -1 +0,0 @@
|
|||||||
jQuery.extend({dobPicker:function(a){for("undefined"==typeof a.dayDefault&&(a.dayDefault="Day"),"undefined"==typeof a.monthDefault&&(a.monthDefault="Month"),"undefined"==typeof a.yearDefault&&(a.yearDefault="Year"),"undefined"==typeof a.minimumAge&&(a.minimumAge=12),"undefined"==typeof a.maximumAge&&(a.maximumAge=80),$(a.daySelector).append('<option value="">'+a.dayDefault+"</option>"),$(a.monthSelector).append('<option value="">'+a.monthDefault+"</option>"),$(a.yearSelector).append('<option value="">'+a.yearDefault+"</option>"),i=1;i<=31;i++){if(i<=9)var b="0"+i;else var b=i;$(a.daySelector).append('<option value="'+b+'">'+i+"</option>")}var c=["January","February","March","April","May","June","July","August","September","October","November","December"];for(i=1;i<=12;i++){if(i<=9)var b="0"+i;else var b=i;$(a.monthSelector).append('<option value="'+b+'">'+c[i-1]+"</option>")}var d=new Date,e=d.getFullYear(),f=e-a.minimumAge,g=f-a.maximumAge;for(i=f;i>=g;i--)$(a.yearSelector).append('<option value="'+i+'">'+i+"</option>");$(a.daySelector).change(function(){$(a.monthSelector)[0].selectedIndex=0,$(a.yearSelector)[0].selectedIndex=0,$(a.yearSelector+" option").removeAttr("disabled"),$(a.daySelector).val()>=1&&$(a.daySelector).val()<=29?$(a.monthSelector+" option").removeAttr("disabled"):30==$(a.daySelector).val()?($(a.monthSelector+" option").removeAttr("disabled"),$(a.monthSelector+' option[value="02"]').attr("disabled","disabled")):31==$(a.daySelector).val()&&($(a.monthSelector+" option").removeAttr("disabled"),$(a.monthSelector+' option[value="02"]').attr("disabled","disabled"),$(a.monthSelector+' option[value="04"]').attr("disabled","disabled"),$(a.monthSelector+' option[value="06"]').attr("disabled","disabled"),$(a.monthSelector+' option[value="09"]').attr("disabled","disabled"),$(a.monthSelector+' option[value="11"]').attr("disabled","disabled"))}),$(a.monthSelector).change(function(){$(a.yearSelector)[0].selectedIndex=0,$(a.yearSelector+" option").removeAttr("disabled"),29==$(a.daySelector).val()&&"02"==$(a.monthSelector).val()&&$(a.yearSelector+" option").each(function(a){if(0!==a){var b=$(this).attr("value"),c=!(b%4||!(b%100)&&b%400);c===!1&&$(this).attr("disabled","disabled")}})})}});
|
|
||||||
@@ -19,24 +19,24 @@ function placeFriendButtons() {
|
|||||||
case "0":
|
case "0":
|
||||||
value1 = "request";
|
value1 = "request";
|
||||||
class1 = "green";
|
class1 = "green";
|
||||||
text1 = "Bevriend";
|
text1 = "Word vrienden";
|
||||||
icon1 = "fa-handshake-o";
|
icon1 = "fa-user-plus";
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
value1 = userID;
|
value1 = userID;
|
||||||
class1 = "green";
|
class1 = "green";
|
||||||
text1 = "Chat";
|
text1 = "Chat";
|
||||||
icon1 = "fa-comment-o";
|
icon1 = "fa-comment";
|
||||||
value2 = "delete";
|
value2 = "delete";
|
||||||
class2 = "red";
|
class2 = "red";
|
||||||
text2 = "Verwijder";
|
text2 = "Ontvriend";
|
||||||
icon2 = "fa-times";
|
icon2 = "fa-user-times";
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
value1 = "delete";
|
value1 = "delete";
|
||||||
class1 = "red";
|
class1 = "red";
|
||||||
text1 = "Trek verzoek in";
|
text1 = "Trek verzoek in";
|
||||||
icon1 = "fa-cross";
|
icon1 = "fa-times";
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
value1 = "accept";
|
value1 = "accept";
|
||||||
@@ -51,16 +51,18 @@ function placeFriendButtons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='"+ class1 +" friend-button' value='"+ value1 +"'>" +
|
"<div><button class='"+ class1 +" fancy-button friend-button' value='"+ value1 +"'>" +
|
||||||
"<i class='fa "+ icon1 +"'></i> " + text1 +
|
"<span>"+ text1 +"</span>" +
|
||||||
"</button>");
|
"<i class='fa fa-fw "+ icon1 +"'></i> " +
|
||||||
|
"</button></div>");
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='"+ class2 +" friend-button' value='"+ value2 +"'>" +
|
"<div><button class='"+ class2 +" fancy-button friend-button' value='"+ value2 +"'>" +
|
||||||
"<i class='fa "+ icon2 +"'></i> " + text2 +
|
"<span>"+ text2 +"</span>" +
|
||||||
"</button>");
|
"<i class='fa fa-fw "+ icon2 +"'></i> " +
|
||||||
|
"</button></div>");
|
||||||
|
|
||||||
|
|
||||||
$buttonContainer.children().click(function() {
|
$buttonContainer.find("button").click(function() {
|
||||||
if (isNaN(this.value))
|
if (isNaN(this.value))
|
||||||
editFriendship(userID, this.value);
|
editFriendship(userID, this.value);
|
||||||
else if (this.value != "")
|
else if (this.value != "")
|
||||||
|
|||||||
@@ -5,23 +5,23 @@ function placeGroupButtons() {
|
|||||||
|
|
||||||
if (data == 'none') {
|
if (data == 'none') {
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='green group-button group-button-fixed' value='request'>" +
|
"<button class='green group-button fancy-button' value='request'>" +
|
||||||
"<i class='fa fa-plus'></i> Voeg toe" +
|
"<span>Treed toe</span><i class='fa fa-plus'></i>" +
|
||||||
"</button>");
|
"</button>");
|
||||||
} else if (data == 'request') {
|
} else if (data == 'request') {
|
||||||
$buttonContainer.append(
|
$buttonContainer.append(
|
||||||
"<button class='red group-button group-button-fixed' value='none'>" +
|
"<button class='red group-button fancy-button' value='none'>" +
|
||||||
"<i class='fa fa-times'></i> Trek verzoek in" +
|
"<span>Trek verzoek in</span><i class='fa fa-times'></i>" +
|
||||||
"</button>");
|
"</button>");
|
||||||
} else if (data == 'admin') {
|
} else if (data == 'admin') {
|
||||||
$buttonContainer.append(
|
$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>" +
|
"<span>Instellingen</span><i class='fa fa-cogs'></i>" +
|
||||||
"</button>"
|
"</button>"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$buttonContainer.append(
|
$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>" +
|
"<span>Verlaat groep</span><i class='fa fa-sign-out'></i>" +
|
||||||
"</button>");
|
"</button>");
|
||||||
}
|
}
|
||||||
|
|||||||
68
website/public/js/loginRegisterModals.js
Normal file
68
website/public/js/loginRegisterModals.js
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
|
||||||
|
// Get the modal
|
||||||
|
var modal = document.getElementById('myModal');
|
||||||
|
var registerModal = document.getElementById('registerModal');
|
||||||
|
var facebookModal = document.getElementById("fbModal");
|
||||||
|
|
||||||
|
// Get the button that opens the modal
|
||||||
|
var registerBtn = document.getElementById("registerBtn");
|
||||||
|
var btn = document.getElementById("myBtn");
|
||||||
|
|
||||||
|
|
||||||
|
// Get the <span> element that closes the modal
|
||||||
|
var span = document.getElementsByClassName("close")[0];
|
||||||
|
var registerSpan = document.getElementsByClassName("close")[1];
|
||||||
|
var facebookCLose = document.getElementsByClassName("close")[2];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the user clicks the button, open the modal
|
||||||
|
*/
|
||||||
|
btn.onclick = function () {
|
||||||
|
modal.style.display = "block";
|
||||||
|
|
||||||
|
}
|
||||||
|
registerBtn.onclick = function () {
|
||||||
|
registerModal.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WHen the user clicks on (X), close the modal
|
||||||
|
*/
|
||||||
|
span.onclick = function () {
|
||||||
|
modal.style.display = "none";
|
||||||
|
}
|
||||||
|
registerSpan.onclick = function () {
|
||||||
|
registerModal.style.display = "none";
|
||||||
|
}
|
||||||
|
facebookCLose.onclick = function () {
|
||||||
|
facebookModal.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";
|
||||||
|
}
|
||||||
|
if (event.target == registerModal) {
|
||||||
|
registerModal.style.display = "none";
|
||||||
|
}
|
||||||
|
if (event.target == facebookModal) {
|
||||||
|
facebookModal.style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When ESC is pressed, close modal
|
||||||
|
*/
|
||||||
|
document.addEventListener('keyup', function(e) {
|
||||||
|
if (e.keyCode == 27) {
|
||||||
|
modal.style.display = "none";
|
||||||
|
registerModal.style.display = "none";
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* Created by joey on 2-2-17.
|
||||||
|
*/
|
||||||
@@ -3,8 +3,7 @@ var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "a
|
|||||||
|
|
||||||
function fancyText(text) {
|
function fancyText(text) {
|
||||||
// Add links, images, gifs and (youtube) video's.
|
// Add links, images, gifs and (youtube) video's.
|
||||||
var regex = /(https?:\/\/.[^ <>"]*)/ig;
|
text = text.replace(/(https?:\/\/.[^ \n<>"]*)/ig, function(link) {
|
||||||
text = text.replace(regex, function(link) {
|
|
||||||
// Add images
|
// Add images
|
||||||
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
|
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
|
||||||
return "<img alt='" + link + "' src='" + link + "' />";
|
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.
|
// 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) {
|
function getCookie(key) {
|
||||||
cookies = document.cookie.split("; ");
|
cookies = document.cookie.split("; ");
|
||||||
for (var i in cookies) {
|
for (var i in cookies) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function requestPost(postID) {
|
|||||||
function postPost() {
|
function postPost() {
|
||||||
title = $("input.newpost[name='title']").val();
|
title = $("input.newpost[name='title']").val();
|
||||||
content = $("textarea.newpost[name='content']").val();
|
content = $("textarea.newpost[name='content']").val();
|
||||||
|
console.log(masonryMode);
|
||||||
if (masonryMode == 2) {
|
if (masonryMode == 2) {
|
||||||
$.post("API/postPost.php", { title: title,
|
$.post("API/postPost.php", { title: title,
|
||||||
content : content,
|
content : content,
|
||||||
@@ -36,6 +36,10 @@ function postPost() {
|
|||||||
$('#alertbox').show();
|
$('#alertbox').show();
|
||||||
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
||||||
window.scrollTo(0,0);
|
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 {
|
} else {
|
||||||
$('#alertbox').hide();
|
$('#alertbox').hide();
|
||||||
masonry(masonryMode);
|
masonry(masonryMode);
|
||||||
@@ -49,6 +53,10 @@ function postPost() {
|
|||||||
$('#alertbox').show();
|
$('#alertbox').show();
|
||||||
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
||||||
window.scrollTo(0,0);
|
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 {
|
} else {
|
||||||
$('#alertbox').hide();
|
$('#alertbox').hide();
|
||||||
masonry(masonryMode);
|
masonry(masonryMode);
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ function postComment(buttonValue) {
|
|||||||
).done(function (response) {
|
).done(function (response) {
|
||||||
if (response == "frozen") {
|
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.");
|
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) {
|
).done(function (response) {
|
||||||
if (response == "frozen") {
|
if (response == "frozen") {
|
||||||
alert("Je account is bevroren, dus je kan geen posts verwijderen. Contacteer een admin als je denkt dat dit onjuist is.");
|
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();
|
closeModal();
|
||||||
|
|||||||
@@ -13,18 +13,12 @@
|
|||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
session_start();
|
|
||||||
|
|
||||||
// Checks if there's an user already logged in
|
|
||||||
if(isset($_SESSION["userID"])){
|
|
||||||
echo "<script>
|
|
||||||
window.onload=checkLoggedIn();
|
|
||||||
</script>";
|
|
||||||
}
|
|
||||||
include("../views/homeLoginRegister.php");
|
include("../views/homeLoginRegister.php");
|
||||||
|
|
||||||
/* This view adds login view */
|
/* This view adds login view */
|
||||||
include("../views/login-view.php");
|
include("../views/login-view.php");
|
||||||
?>
|
?>
|
||||||
|
<script src="js/loginRegisterModals.js"></script>;
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<?php
|
|
||||||
include("../views/login_head.php");
|
|
||||||
require_once("../queries/connect.php");
|
|
||||||
include_once("../queries/register.php");
|
|
||||||
include_once("../queries/checkInput.php");
|
|
||||||
include_once("../queries/emailconfirm.php");
|
|
||||||
?>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
if(isset($_SESSION["userID"])){
|
|
||||||
header("location: login.php");
|
|
||||||
}
|
|
||||||
// define variables and set to empty values
|
|
||||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
|
|
||||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
|
|
||||||
$correct = true;
|
|
||||||
$day_date = "dag";
|
|
||||||
$month_date = "maand";
|
|
||||||
$year_date = "jaar";
|
|
||||||
|
|
||||||
// Trying to register an account
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
try {
|
|
||||||
$name = test_input(($_POST["name"]));
|
|
||||||
checkInputChoice($name, "lettersAndSpaces");
|
|
||||||
} catch(lettersAndSpacesException $e){
|
|
||||||
$correct = false;
|
|
||||||
$nameErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$surname = test_input(($_POST["surname"]));
|
|
||||||
checkInputChoice($surname, "lettersAndSpaces");
|
|
||||||
}
|
|
||||||
catch(lettersAndSpacesException $e){
|
|
||||||
$correct = false;
|
|
||||||
$surnameErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
$day_date = test_input(($_POST["day_date"]));
|
|
||||||
$month_date = test_input(($_POST["month_date"]));
|
|
||||||
$year_date = test_input(($_POST["year_date"]));
|
|
||||||
$bday = $year_date . "-" . $month_date . "-" . $day_date;
|
|
||||||
checkInputChoice($bday, "bday");
|
|
||||||
} catch(bdayException $e){
|
|
||||||
$correct = false;
|
|
||||||
$bdayErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
$username = str_replace(' ', '', test_input(($_POST["username"])));
|
|
||||||
checkInputChoice($username, "username");
|
|
||||||
} catch(usernameException $e){
|
|
||||||
$correct = false;
|
|
||||||
$usernameErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
$password = str_replace(' ', '', test_input(($_POST["password"])));
|
|
||||||
checkInputChoice($password, "longerEight");
|
|
||||||
matchPassword();
|
|
||||||
} catch(passwordException $e){
|
|
||||||
$correct = false;
|
|
||||||
$passwordErr = $e->getMessage();
|
|
||||||
} catch(confirmPasswordException $e){
|
|
||||||
$correct = false;
|
|
||||||
$confirmPasswordErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
$location = test_input(($_POST["location"]));
|
|
||||||
checkInputChoice($location, "lettersAndSpaces");
|
|
||||||
} catch(lettersAndSpacesException $e){
|
|
||||||
$correct = false;
|
|
||||||
$locationErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
$email = test_input(($_POST["email"]));
|
|
||||||
checkInputChoice($email, "email");
|
|
||||||
$confirmEmail = test_input(($_POST["confirmEmail"]));
|
|
||||||
matchEmail();
|
|
||||||
} catch(emailException $e){
|
|
||||||
$correct = false;
|
|
||||||
$emailErr = $e->getMessage();
|
|
||||||
} catch(confirmEmailException $e){
|
|
||||||
$correct = false;
|
|
||||||
$confirmEmailErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
$captcha = $_POST['g-recaptcha-response'];
|
|
||||||
checkCaptcha($captcha);
|
|
||||||
} catch(captchaException $e){
|
|
||||||
$correct = false;
|
|
||||||
$captchaErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
getIp();
|
|
||||||
registerCheck($correct);
|
|
||||||
sendConfirmEmailUsername($username);
|
|
||||||
} catch(registerException $e){
|
|
||||||
$genericErr = $e->getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This view adds register view */
|
|
||||||
include("../views/register-view.php");
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -198,12 +198,6 @@ ul {
|
|||||||
animation-duration: 0.4s
|
animation-duration: 0.4s
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add Animation */
|
|
||||||
@-webkit-keyframes animatetop {
|
|
||||||
from {top:-300px; opacity:0}
|
|
||||||
to {top:0; opacity:1}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes animatetop {
|
@keyframes animatetop {
|
||||||
from {top:-300px; opacity:0}
|
from {top:-300px; opacity:0}
|
||||||
to {top:0; opacity:1}
|
to {top:0; opacity:1}
|
||||||
|
|||||||
@@ -256,8 +256,6 @@ div[data-title]:hover:after {
|
|||||||
top: 150%;
|
top: 150%;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
-moz-border-radius: 3px;
|
|
||||||
-webkit-border-radius: 3px;
|
|
||||||
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);
|
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
|
|||||||
@@ -91,16 +91,5 @@
|
|||||||
|
|
||||||
.deleteButton {
|
.deleteButton {
|
||||||
background-color: firebrick;
|
background-color: firebrick;
|
||||||
}
|
float: right;
|
||||||
|
|
||||||
.deleteButton i {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deleteButton:hover span {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deleteButton span {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
@@ -27,16 +27,21 @@
|
|||||||
display: inline-block;
|
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 {
|
.friend-button-container button, .status-buttons-container button, .group-button-container button {
|
||||||
display: block;
|
display: block;
|
||||||
|
float: right;
|
||||||
|
|
||||||
margin: 7px 0;
|
margin: 7px 0;
|
||||||
|
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
.status-buttons-container button {
|
||||||
.friend-button-container button, .status-buttons-container button, .group-button-fixed {
|
float: left;
|
||||||
width: 200px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-container button {
|
.group-button-container button {
|
||||||
@@ -74,22 +79,21 @@
|
|||||||
|
|
||||||
.group-picture {
|
.group-picture {
|
||||||
border: none;
|
border: none;
|
||||||
margin-right: 15px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-fancy span {
|
.fancy-button span {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-fancy:hover {
|
.fancy-button:hover {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-fancy i {
|
.fancy-button i {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-button-fancy:hover span {
|
.fancy-button:hover span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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){
|
function checkName($variable){
|
||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
throw new lettersAndSpacesException("Verplicht!");
|
throw new lettersAndSpacesException("Verplicht!");
|
||||||
@@ -52,7 +56,11 @@ function checkName($variable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks for bday */
|
/**
|
||||||
|
* Checks for bday
|
||||||
|
* @param $variable
|
||||||
|
* @throws bdayException
|
||||||
|
*/
|
||||||
function validateBday($variable){
|
function validateBday($variable){
|
||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
throw new bdayException("Verplicht!");
|
throw new bdayException("Verplicht!");
|
||||||
@@ -68,7 +76,7 @@ function validateBday($variable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks for date
|
/* Checks for date */
|
||||||
function validateDate($date, $format)
|
function validateDate($date, $format)
|
||||||
{
|
{
|
||||||
$d = DateTime::createFromFormat($format, $date);
|
$d = DateTime::createFromFormat($format, $date);
|
||||||
@@ -124,7 +132,7 @@ function validateEmail($variable){
|
|||||||
throw new emailException("Mag maximaal 50 karakters!");
|
throw new emailException("Mag maximaal 50 karakters!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//255
|
|
||||||
/* checks if an input is a valid email. */
|
/* checks if an input is a valid email. */
|
||||||
function validateFBEmail($variable){
|
function validateFBEmail($variable){
|
||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
@@ -138,6 +146,7 @@ function validateFBEmail($variable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* checks if email is the same */
|
||||||
function matchEmail(){
|
function matchEmail(){
|
||||||
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
|
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
|
||||||
throw new confirmEmailException("Emails matchen niet!");
|
throw new confirmEmailException("Emails matchen niet!");
|
||||||
@@ -153,7 +162,6 @@ function resetEmail($variable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* checks if two passwords matches. */
|
/* checks if two passwords matches. */
|
||||||
function matchPassword(){
|
function matchPassword(){
|
||||||
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
||||||
@@ -219,6 +227,9 @@ function test_input($data) {
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class lettersAndSpacesException
|
||||||
|
*/
|
||||||
class lettersAndSpacesException extends Exception
|
class lettersAndSpacesException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -227,7 +238,9 @@ class lettersAndSpacesException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class bdayException
|
||||||
|
*/
|
||||||
class bdayException extends Exception
|
class bdayException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -236,6 +249,9 @@ class bdayException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class usernameException
|
||||||
|
*/
|
||||||
class usernameException extends Exception
|
class usernameException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -244,6 +260,9 @@ class usernameException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class passwordException
|
||||||
|
*/
|
||||||
class passwordException extends Exception
|
class passwordException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -252,6 +271,9 @@ class passwordException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class confirmPasswordException
|
||||||
|
*/
|
||||||
class confirmPasswordException extends Exception
|
class confirmPasswordException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -260,6 +282,9 @@ class confirmPasswordException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class fbConfirmPasswordException
|
||||||
|
*/
|
||||||
class fbConfirmPasswordException extends Exception
|
class fbConfirmPasswordException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -268,6 +293,9 @@ class fbConfirmPasswordException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class emailException
|
||||||
|
*/
|
||||||
class emailException extends Exception
|
class emailException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -276,6 +304,9 @@ class emailException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class confirmEmailException
|
||||||
|
*/
|
||||||
class confirmEmailException extends Exception
|
class confirmEmailException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -284,6 +315,9 @@ class confirmEmailException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class captchaException
|
||||||
|
*/
|
||||||
class captchaException extends Exception
|
class captchaException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
@@ -292,6 +326,9 @@ class captchaException extends Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class registerException
|
||||||
|
*/
|
||||||
class registerException extends Exception
|
class registerException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ require_once "../queries/alerts.php";
|
|||||||
*/
|
*/
|
||||||
function createGroup()
|
function createGroup()
|
||||||
{
|
{
|
||||||
|
// Creates the group.
|
||||||
$createGroup = prepareQuery("
|
$createGroup = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`group_page` (`name`, `description`)
|
`group_page` (`name`, `description`)
|
||||||
@@ -17,6 +18,7 @@ function createGroup()
|
|||||||
$createGroup->bindValue(':description', test_input($_POST["bio"]));
|
$createGroup->bindValue(':description', test_input($_POST["bio"]));
|
||||||
$createGroup->execute();
|
$createGroup->execute();
|
||||||
|
|
||||||
|
// Gets the groupID just created.
|
||||||
$getGroupID = prepareQuery("
|
$getGroupID = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`groupID`
|
`groupID`
|
||||||
@@ -28,6 +30,7 @@ function createGroup()
|
|||||||
$getGroupID->execute();
|
$getGroupID->execute();
|
||||||
$groupID = $getGroupID->fetch()["groupID"];
|
$groupID = $getGroupID->fetch()["groupID"];
|
||||||
|
|
||||||
|
// Adds the user as an admin.
|
||||||
$makeUserAdmin = prepareQuery("
|
$makeUserAdmin = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`group_member` (userID, groupID, role)
|
`group_member` (userID, groupID, role)
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Sends a confirm email if you know the username.
|
||||||
|
* @param string $username
|
||||||
|
*/
|
||||||
function sendConfirmEmailUsername(string $username) {
|
function sendConfirmEmailUsername(string $username) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -15,6 +18,10 @@ function sendConfirmEmailUsername(string $username) {
|
|||||||
sendConfirmEmail($userID);
|
sendConfirmEmail($userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a confirm email if you know the userID.
|
||||||
|
* @param int $userID
|
||||||
|
*/
|
||||||
function sendConfirmEmail(int $userID) {
|
function sendConfirmEmail(int $userID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find matching password with the inputted username/emailadress.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
function getUser() {
|
function getUser() {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -33,7 +37,8 @@ function getUserID() {
|
|||||||
return $stmt->fetch(PDO::FETCH_ASSOC);
|
return $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateLogin($username, $password){
|
function validateLogin($username, $password, $url){
|
||||||
|
echo $url;
|
||||||
// Empty username or password field
|
// Empty username or password field
|
||||||
if (empty($username) || empty($password)) {
|
if (empty($username) || empty($password)) {
|
||||||
throw new loginException("Inloggegevens zijn niet ingevuld");
|
throw new loginException("Inloggegevens zijn niet ingevuld");
|
||||||
@@ -44,26 +49,42 @@ function validateLogin($username, $password){
|
|||||||
$userID = getUser()["userID"];
|
$userID = getUser()["userID"];
|
||||||
$role = getUser()["role"];
|
$role = getUser()["role"];
|
||||||
|
|
||||||
// If there's an account, go to the profile page
|
// If there's an account, check if the account is banned, frozen or unconfirmed.
|
||||||
if(password_verify($psw, $hash)) {
|
if(password_verify($psw, $hash)) {
|
||||||
if ($role == "banned"){
|
if ($role == "banned"){
|
||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload=bannedAlert();
|
window.onload=bannedAlert();
|
||||||
</script>";
|
</script>";
|
||||||
} else if ($role == "frozen"){
|
|
||||||
|
} else if ($role == "frozen") {
|
||||||
$_SESSION["userID"] = $userID;
|
$_SESSION["userID"] = $userID;
|
||||||
|
if (!isset($url) or $url = "") {
|
||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload=frozenAlert();
|
window.onload=frozenAlert();
|
||||||
window.location.href= 'profile.php';
|
window.location.href= 'profile.php';
|
||||||
</script>";
|
</script>";
|
||||||
|
} else {
|
||||||
|
echo "<script>
|
||||||
|
window.onload=frozenAlert();
|
||||||
|
window.location.href= $url;
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
|
||||||
} else if ($role == "unconfirmed"){
|
} else if ($role == "unconfirmed"){
|
||||||
sendConfirmEmail(getUser()["userID"]);
|
sendConfirmEmail(getUser()["userID"]);
|
||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload=emailNotConfirmed();
|
window.onload=emailNotConfirmed();
|
||||||
</script>";
|
</script>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$_SESSION["userID"] = $userID;
|
$_SESSION["userID"] = $userID;
|
||||||
header("location: profile.php");
|
if(!isset($url) or $url == "") {
|
||||||
|
header("location: profile.php");
|
||||||
|
echo "succes";
|
||||||
|
} else{
|
||||||
|
header("location: ".$url);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new loginException("Inloggevens zijn niet correct");
|
throw new loginException("Inloggevens zijn niet correct");
|
||||||
|
|||||||
@@ -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) {
|
function getRoleInGroup(int $userID, int $groupID) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -6,18 +6,23 @@ function getOldChatMessages($user2ID) {
|
|||||||
if (getFriendshipStatus($user2ID) == 1) {
|
if (getFriendshipStatus($user2ID) == 1) {
|
||||||
$stmt = prepareQuery("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
`private_message`
|
(SELECT
|
||||||
WHERE
|
*
|
||||||
`origin` = :user1 AND
|
FROM
|
||||||
`destination` = :user2 OR
|
`private_message`
|
||||||
`origin` = :user2 AND
|
WHERE
|
||||||
`destination` = :user1
|
`origin` = :user1 AND
|
||||||
|
`destination` = :user2 OR
|
||||||
|
`origin` = :user2 AND
|
||||||
|
`destination` = :user1
|
||||||
|
ORDER BY
|
||||||
|
`messageID` DESC
|
||||||
|
LIMIT
|
||||||
|
100) sub
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`creationdate` ASC
|
`messageID` ASC
|
||||||
LIMIT
|
|
||||||
100
|
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":user1", $user1ID);
|
$stmt->bindParam(":user1", $user1ID);
|
||||||
@@ -76,7 +81,7 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
`destination` = :user1) AND
|
`destination` = :user1) AND
|
||||||
`messageID` > :lastID
|
`messageID` > :lastID
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`creationdate` ASC
|
`messageID` ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div id="fbModal" class="modal">
|
<div id="fbModal" class="modal">
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
return= $correct
|
|
||||||
method="post"
|
method="post"
|
||||||
name="fbModal">
|
name="fbModal">
|
||||||
|
|
||||||
@@ -66,17 +65,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
*<span class="error"> <?php echo $fbEmailErr;?></span>
|
<span class="error"> <?php echo $fbEmailErr;?></span>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
value="fbRegister"
|
value="fbRegister"
|
||||||
name="submit"
|
name="submit">
|
||||||
id="frm1_submit">
|
|
||||||
Registreer account
|
Registreer account
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Facebook information-->
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
name="fbName"
|
name="fbName"
|
||||||
value="<?php echo $fbName ?>">
|
value="<?php echo $fbName ?>">
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div id="myModal" class="modal">
|
<div id="myModal" class="modal">
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
return= $correct
|
|
||||||
method="post"
|
method="post"
|
||||||
name="forgotPassword">
|
name="forgotPassword">
|
||||||
|
|
||||||
@@ -26,8 +25,7 @@
|
|||||||
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
value="reset"
|
value="reset"
|
||||||
name="submit"
|
name="submit">
|
||||||
id="frm1_submit">
|
|
||||||
Reset password
|
Reset password
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="user-box">
|
<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="platform">
|
||||||
<div class="status-buttons-container">
|
<div class="status-buttons-container">
|
||||||
<button disabled class="gray"><?= $group["status"] ?></button>
|
<button disabled class="gray"><?= $group["status"] ?></button>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<meta charset="UTF-8">
|
<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="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
|
||||||
<meta name="author" content="MyHyvesbookplus corporation">
|
<meta name="author" content="MyHyvesbookplus corporation">
|
||||||
<title>MyHyvesbook+</title>
|
<title>MyHyvesbook+</title>
|
||||||
@@ -26,8 +26,8 @@ require_once ("../queries/user.php");
|
|||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
if(!isset($_SESSION["userID"])){
|
if(!isset($_SESSION["userID"])) {
|
||||||
header("location:login.php");
|
header("location:login.php?url=" . "$_SERVER[REQUEST_URI]");
|
||||||
} else {
|
} else {
|
||||||
updateLastActivity();
|
updateLastActivity();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ $userinfo = getHeaderInfo();
|
|||||||
<div id="hello-loop">
|
<div id="hello-loop">
|
||||||
Hallo
|
Hallo
|
||||||
</div>
|
</div>
|
||||||
<?=$userinfo["fname"]?>
|
<?= $userinfo["fname"] ?>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<?php include("notification-center.php"); ?>
|
<?php include("notification-center.php"); ?>
|
||||||
|
|||||||
@@ -1,18 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Checks if there's an user already logged in
|
||||||
|
if(isset($_SESSION["userID"])){
|
||||||
|
echo "<script>
|
||||||
|
window.onload=checkLoggedIn();
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
|
||||||
// Facebook variables
|
// Facebook variables
|
||||||
$appID = "353857824997532";
|
$appID = "353857824997532";
|
||||||
$appSecret = "db47e91ffbfd355fdd11b4b65eade851";
|
$appSecret = "db47e91ffbfd355fdd11b4b65eade851";
|
||||||
$fbUsername = $fbPassword = $fbConfirmpassword = "";
|
$fbUsername = $fbPassword = $fbConfirmpassword = $fbName = $fbSurname = $fbBday = $fbEmail = $fbUserID = "";
|
||||||
$fbUsernameErr = $fbPasswordErr = $fbConfirmpasswordErr = $fbEmailErr = $fbBdayErr = "";
|
$fbUsernameErr = $fbPasswordErr = $fbConfirmpasswordErr = $fbEmailErr = $fbBdayErr = "";
|
||||||
$fbCorrect = true;
|
$fbCorrect = true;
|
||||||
$fbName = $fbSurname = $fbBday = $fbEmail = $fbUserID = "";
|
|
||||||
|
|
||||||
// Register variables
|
// Register variables
|
||||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
|
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
|
||||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
|
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
|
||||||
$correct = true;
|
$correct = true;
|
||||||
|
|
||||||
|
// Bday dates
|
||||||
$day_date = $month_date = $year_date = "";
|
$day_date = $month_date = $year_date = "";
|
||||||
$fbDay_date = $fbMonth_date = $fbYear_date = "";
|
$fbDay_date = $fbMonth_date = $fbYear_date = "";
|
||||||
|
|
||||||
@@ -26,7 +34,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
case "login":
|
case "login":
|
||||||
try {
|
try {
|
||||||
$user = ($_POST["user"]);
|
$user = ($_POST["user"]);
|
||||||
validateLogin($_POST["user"], $_POST["psw"]);
|
validateLogin($_POST["user"], $_POST["psw"], $_POST["url"]);
|
||||||
} catch(loginException $e) {
|
} catch(loginException $e) {
|
||||||
$loginErr = $e->getMessage();
|
$loginErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -45,18 +53,22 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "register":
|
case "register":
|
||||||
include("register.php");
|
include("../views/register.php");
|
||||||
break;
|
break;
|
||||||
case "fbRegister":
|
case "fbRegister":
|
||||||
include("fbRegister.php");
|
include("../views/fbRegister.php");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get facebook information with facebook PHP SDK.
|
||||||
$fb = new Facebook\Facebook([
|
$fb = new Facebook\Facebook([
|
||||||
'app_id' => $appID,
|
'app_id' => $appID,
|
||||||
'app_secret' => $appSecret,
|
'app_secret' => $appSecret,
|
||||||
'default_graph_version' => 'v2.2',
|
'default_graph_version' => 'v2.2',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Redirect back to login.php after logging/canceling with facebook.
|
||||||
$redirect = "https://myhyvesbookplus.nl/login.php";
|
$redirect = "https://myhyvesbookplus.nl/login.php";
|
||||||
$helper = $fb->getRedirectLoginHelper();
|
$helper = $fb->getRedirectLoginHelper();
|
||||||
|
|
||||||
@@ -71,6 +83,7 @@ try {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If theres no facebook account logged in, ask for permission.
|
||||||
if(!isset($acces_token)){
|
if(!isset($acces_token)){
|
||||||
$permission=["email", "user_birthday"];
|
$permission=["email", "user_birthday"];
|
||||||
$loginurl=$helper->getLoginUrl($redirect,$permission);
|
$loginurl=$helper->getLoginUrl($redirect,$permission);
|
||||||
@@ -79,13 +92,14 @@ if(!isset($acces_token)){
|
|||||||
$response = $fb->get('/me?fields=email,name,birthday');
|
$response = $fb->get('/me?fields=email,name,birthday');
|
||||||
$usernode = $response->getGraphUser();
|
$usernode = $response->getGraphUser();
|
||||||
|
|
||||||
|
// Get facebook information
|
||||||
$nameSplit = explode(" ", $usernode->getName());
|
$nameSplit = explode(" ", $usernode->getName());
|
||||||
$fbName = $nameSplit[0];
|
$fbName = $nameSplit[0];
|
||||||
$fbSurname = $nameSplit[1];
|
$fbSurname = $nameSplit[1];
|
||||||
$fbUserID = $usernode->getID();
|
$fbUserID = $usernode->getID();
|
||||||
$fbEmail = $usernode->getProperty("email");
|
$fbEmail = $usernode->getProperty("email");
|
||||||
// $image = 'https://graph.facebook.com/' . $usernode->getId() . '/picture?width=200';
|
|
||||||
|
|
||||||
|
// If there is an account, check if the account is banned or frozen.
|
||||||
if (fbLogin($fbUserID) == 1) {
|
if (fbLogin($fbUserID) == 1) {
|
||||||
$fbID = getfbUserID($fbUserID)["userID"];
|
$fbID = getfbUserID($fbUserID)["userID"];
|
||||||
$fbRole = getfbUserID($fbUserID)["role"];
|
$fbRole = getfbUserID($fbUserID)["role"];
|
||||||
@@ -93,16 +107,20 @@ if(!isset($acces_token)){
|
|||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload=bannedAlert();
|
window.onload=bannedAlert();
|
||||||
</script>";
|
</script>";
|
||||||
|
|
||||||
} else if($fbRole == "frozen"){
|
} else if($fbRole == "frozen"){
|
||||||
$_SESSION["userID"] = $fbID;
|
$_SESSION["userID"] = $fbID;
|
||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload=frozenAlert();
|
window.onload=frozenAlert();
|
||||||
window.location.href= 'profile.php';
|
window.location.href= 'profile.php';
|
||||||
</script>";
|
</script>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$_SESSION["userID"] = $fbID;
|
$_SESSION["userID"] = $fbID;
|
||||||
header("location: profile.php");
|
header("location: profile.php");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Registration with faceobook if theres no account.
|
||||||
} else {
|
} else {
|
||||||
echo "<script>
|
echo "<script>
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
|
|||||||
@@ -13,10 +13,17 @@
|
|||||||
<h1>Welkom bij MyHyvesbook+</h1>
|
<h1>Welkom bij MyHyvesbook+</h1>
|
||||||
<!-- Login content -->
|
<!-- Login content -->
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
return=$correct
|
|
||||||
method="post"
|
method="post"
|
||||||
name="login">
|
name="login">
|
||||||
|
|
||||||
|
<!-- Url parameter -->
|
||||||
|
<input type="hidden"
|
||||||
|
name="url"
|
||||||
|
value="<?php
|
||||||
|
if(isset($_GET["url"])) {
|
||||||
|
echo $_GET["url"];
|
||||||
|
} ?>"/>
|
||||||
|
|
||||||
<!-- Login name -->
|
<!-- Login name -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<label><b>Gebruikersnaam/Email</b></label>
|
<label><b>Gebruikersnaam/Email</b></label>
|
||||||
@@ -47,8 +54,7 @@
|
|||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
value="login"
|
value="login"
|
||||||
name="submit"
|
name="submit">
|
||||||
id="frm1_submit">
|
|
||||||
Inloggen
|
Inloggen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -68,75 +74,8 @@
|
|||||||
<!--Login with facebook button-->
|
<!--Login with facebook button-->
|
||||||
<?php
|
<?php
|
||||||
if(!isset($acces_token)) {
|
if(!isset($acces_token)) {
|
||||||
echo '<div class="login_containerlogin"><a class="fbButton" href="' . $loginurl . '"><i class="fa fa-facebook-square"></i> login met Facebook!</a></div>';
|
echo '<div class="login_containerlogin"><a class="fbButton" href="' . $loginurl . '"><i class="fa fa-facebook-square"></i> login met Facebook!</a></div>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="login_containerlogin"><a class="fbButton" href="' . "https://myhyvesbookplus.nl/login.php" . '"><i class="fa fa-facebook-square"></i> loguit Facebook sessie</a></div>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
// Get the modal
|
|
||||||
var modal = document.getElementById('myModal');
|
|
||||||
var registerModal = document.getElementById('registerModal');
|
|
||||||
var facebookModal = document.getElementById("fbModal");
|
|
||||||
|
|
||||||
// Get the button that opens the modal
|
|
||||||
var registerBtn = document.getElementById("registerBtn");
|
|
||||||
var btn = document.getElementById("myBtn");
|
|
||||||
|
|
||||||
|
|
||||||
// Get the <span> element that closes the modal
|
|
||||||
var span = document.getElementsByClassName("close")[0];
|
|
||||||
var registerSpan = document.getElementsByClassName("close")[1];
|
|
||||||
var facebookCLose = document.getElementsByClassName("close")[2];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When the user clicks the button, open the modal
|
|
||||||
*/
|
|
||||||
btn.onclick = function () {
|
|
||||||
modal.style.display = "block";
|
|
||||||
|
|
||||||
}
|
|
||||||
registerBtn.onclick = function () {
|
|
||||||
registerModal.style.display = "block";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* WHen the user clicks on (X), close the modal
|
|
||||||
*/
|
|
||||||
span.onclick = function () {
|
|
||||||
modal.style.display = "none";
|
|
||||||
}
|
|
||||||
registerSpan.onclick = function () {
|
|
||||||
registerModal.style.display = "none";
|
|
||||||
}
|
|
||||||
facebookCLose.onclick = function () {
|
|
||||||
facebookModal.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";
|
|
||||||
}
|
|
||||||
if (event.target == registerModal) {
|
|
||||||
registerModal.style.display = "none";
|
|
||||||
}
|
|
||||||
if (event.target == facebookModal) {
|
|
||||||
facebookModal.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When ESC is pressed, close modal
|
|
||||||
*/
|
|
||||||
document.addEventListener('keyup', function(e) {
|
|
||||||
if (e.keyCode == 27) {
|
|
||||||
modal.style.display = "none";
|
|
||||||
registerModal.style.display = "none";
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<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="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
|
||||||
<meta name="author" content="MyHyvesbookplus corporation">
|
<meta name="author" content="MyHyvesbookplus corporation">
|
||||||
<title>MyHyvesbook+</title>
|
<title>MyHyvesbook+</title>
|
||||||
|
|||||||
@@ -5,14 +5,6 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
|
|||||||
?>
|
?>
|
||||||
<div class='post-header header'>
|
<div class='post-header header'>
|
||||||
<h4><?=$post['title']?></h4>
|
<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'>
|
<span class='postinfo'>
|
||||||
gepost door <?=$fullname?>,
|
gepost door <?=$fullname?>,
|
||||||
<span class='posttime' title='<?=$post['creationdate']?>'>
|
<span class='posttime' title='<?=$post['creationdate']?>'>
|
||||||
@@ -20,7 +12,14 @@ $fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . "
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</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'>
|
<div class='post-content'>
|
||||||
<p><?=$post['content']?></p>
|
<p><?=$post['content']?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,13 +4,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="user-box">
|
<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="platform">
|
||||||
<div class="status-buttons-container">
|
<div class="status-buttons-container">
|
||||||
<button disabled class="gray">
|
<div>
|
||||||
<?= $user["onlinestatus"] ?>
|
<button disabled class="gray">
|
||||||
</button>
|
<?= $user["onlinestatus"] ?>
|
||||||
<button disabled class="gray"><?= $user["role"] ?></button>
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button disabled class="gray">
|
||||||
|
<?= $user["role"] ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="friend-button-container">
|
<div class="friend-button-container">
|
||||||
<p>:)</p>
|
<p>:)</p>
|
||||||
@@ -33,18 +39,16 @@
|
|||||||
<?php if($showProfile) { ?>
|
<?php if($showProfile) { ?>
|
||||||
<div class="item-box platform">
|
<div class="item-box platform">
|
||||||
<h3>Informatie</h3>
|
<h3>Informatie</h3>
|
||||||
<p>
|
<ul>
|
||||||
<ul>
|
<?php if ($user["showBday"]) { ?>
|
||||||
<?php if ($user["showBday"]) { ?>
|
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
|
||||||
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php if ($user["showEmail"]) { ?>
|
||||||
<?php if ($user["showEmail"]) { ?>
|
<li>Email: <?= $user["email"] ?></li>
|
||||||
<li>Email: <?= $user["email"] ?></li>
|
<?php } ?>
|
||||||
<?php } ?>
|
<li>Locatie: <?= $user["location"] ?></li>
|
||||||
<li>Locatie: <?= $user["location"] ?></li>
|
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
|
||||||
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
|
</ul>
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item-box platform">
|
<div class="item-box platform">
|
||||||
@@ -52,7 +56,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
while($friend = $profile_friends->fetch()) {
|
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>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div id="registerModal" class="modal">
|
<div id="registerModal" class="modal">
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
return= $correct
|
|
||||||
method="post"
|
method="post"
|
||||||
name="forgotPassword">
|
name="forgotPassword">
|
||||||
|
|
||||||
@@ -15,14 +14,11 @@
|
|||||||
<h3>Registreer uw account</h3>
|
<h3>Registreer uw account</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
|
||||||
return= $correct
|
|
||||||
method="post">
|
|
||||||
|
|
||||||
<div class="login_containerregister"><label>U krijgt een bevestigingsemail na het registreren</label></div>
|
<div class="login_containerregister"><label>U krijgt een bevestigingsemail na het registreren</label></div>
|
||||||
|
|
||||||
<!-- Error message -->
|
<!-- Error message -->
|
||||||
<div class="login_containerfault"><?php echo $genericErr;?></span></div>
|
<div class="login_containerfault"><span><?php echo $genericErr;?></span></div>
|
||||||
|
|
||||||
<!-- Register name -->
|
<!-- Register name -->
|
||||||
<div class="login_containerregister">
|
<div class="login_containerregister">
|
||||||
@@ -82,7 +78,6 @@
|
|||||||
placeholder="Voer uw wachtwoord in"
|
placeholder="Voer uw wachtwoord in"
|
||||||
name="password"
|
name="password"
|
||||||
value="<?php echo $password ?>"
|
value="<?php echo $password ?>"
|
||||||
id="password"
|
|
||||||
required>
|
required>
|
||||||
*<span class="error"> <?php echo $passwordErr;?></span>
|
*<span class="error"> <?php echo $passwordErr;?></span>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -96,7 +91,6 @@
|
|||||||
placeholder="Herhaal wachtwoord"
|
placeholder="Herhaal wachtwoord"
|
||||||
name="confirmpassword"
|
name="confirmpassword"
|
||||||
value="<?php echo $confirmpassword ?>"
|
value="<?php echo $confirmpassword ?>"
|
||||||
id="confirmpassword"
|
|
||||||
title="Herhaal wachtwoord"
|
title="Herhaal wachtwoord"
|
||||||
required>
|
required>
|
||||||
*<span class="error"> <?php echo $confirmpasswordErr;?></span>
|
*<span class="error"> <?php echo $confirmpasswordErr;?></span>
|
||||||
@@ -120,7 +114,6 @@
|
|||||||
placeholder="Voer uw email in"
|
placeholder="Voer uw email in"
|
||||||
name="email"
|
name="email"
|
||||||
value="<?php echo $email ?>"
|
value="<?php echo $email ?>"
|
||||||
id="email"
|
|
||||||
title="Voer een geldige email in"
|
title="Voer een geldige email in"
|
||||||
required>
|
required>
|
||||||
*<span class="error"> <?php echo $emailErr;?></span>
|
*<span class="error"> <?php echo $emailErr;?></span>
|
||||||
@@ -133,7 +126,6 @@
|
|||||||
placeholder="Herhaal uw email"
|
placeholder="Herhaal uw email"
|
||||||
name="confirmEmail"
|
name="confirmEmail"
|
||||||
value="<?php echo $confirmEmail ?>"
|
value="<?php echo $confirmEmail ?>"
|
||||||
id="email"
|
|
||||||
title="Herhaal uw email"
|
title="Herhaal uw email"
|
||||||
required>
|
required>
|
||||||
*<span class="error"> <?php echo $confirmEmailErr;?></span>
|
*<span class="error"> <?php echo $confirmEmailErr;?></span>
|
||||||
@@ -152,8 +144,7 @@
|
|||||||
<!-- Register button -->
|
<!-- Register button -->
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
value="register"
|
value="register"
|
||||||
name="submit"
|
name="submit">
|
||||||
id="frm1_submit">
|
|
||||||
Registreer
|
Registreer
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ $settings = getSettings();
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?php $currentbday = new DateTime($settings["birthdate"]); ?>
|
<?php $currentbday = new DateTime($settings["birthdate"]); ?>
|
||||||
<label for="bday">Geboortedatum</label>
|
<label>Geboortedatum</label>
|
||||||
<select name='day' id="bday">
|
<select name='day'>
|
||||||
<?php for ($day = 1; $day <= 31; $day++): ?>
|
<?php for ($day = 1; $day <= 31; $day++): ?>
|
||||||
<option value='<?=$day?>'
|
<option value='<?=$day?>'
|
||||||
<?=($day == $currentbday->format("d")) ? "selected" : ""?>
|
<?=($day == $currentbday->format("d")) ? "selected" : ""?>
|
||||||
@@ -55,7 +55,7 @@ $settings = getSettings();
|
|||||||
</option>
|
</option>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
</select>
|
</select>
|
||||||
<select name='month' id="bday">
|
<select name='month'>
|
||||||
<?php
|
<?php
|
||||||
$months = array ("januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus",
|
$months = array ("januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus",
|
||||||
"september", "oktober", "november", "december");
|
"september", "oktober", "november", "december");
|
||||||
@@ -68,7 +68,7 @@ $settings = getSettings();
|
|||||||
</option>
|
</option>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
</select>
|
</select>
|
||||||
<select name='year' id="bday">
|
<select name='year'>
|
||||||
<?php
|
<?php
|
||||||
$now = (new DateTime)->format("Y");
|
$now = (new DateTime)->format("Y");
|
||||||
for ($year = $now; $year >= 1900; $year--): ?>
|
for ($year = $now; $year >= 1900; $year--): ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user