Merge branch 'master' into marijn-groups
This commit is contained in:
@@ -3,10 +3,10 @@ session_start();
|
||||
|
||||
require_once "../../queries/post.php";
|
||||
require_once "../../queries/user.php";
|
||||
|
||||
if (isset($_SESSION["userID"]) and
|
||||
getRoleByID($_SESSION["userID"]) != 'frozen' and
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
if (!isset($_SESSION["userID"])) {
|
||||
echo "logged out";
|
||||
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' and
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
|
||||
if (empty($_POST["postID"]) or empty($_SESSION["userID"])) {
|
||||
header('HTTP/1.1 500 Non enough arguments');
|
||||
|
||||
@@ -7,10 +7,10 @@ require_once("../../queries/connect.php");
|
||||
require_once("../../queries/checkInput.php");
|
||||
require_once("../../queries/user.php");
|
||||
|
||||
|
||||
if (isset($_SESSION["userID"]) &&
|
||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
if (!isset($_SESSION["userID"])) {
|
||||
echo "logged out";
|
||||
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
if ($_POST['button'] == 'reaction') {
|
||||
if (empty($_POST['newcomment-content'])) {
|
||||
echo 0;
|
||||
|
||||
@@ -8,9 +8,10 @@ require_once("../../queries/connect.php");
|
||||
require_once("../../queries/checkInput.php");
|
||||
require_once("../../queries/user.php");
|
||||
|
||||
if (isset($_SESSION["userID"]) &&
|
||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
if (!isset($_SESSION["userID"])) {
|
||||
echo "logged out";
|
||||
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
|
||||
if (empty($_SESSION["userID"])) {
|
||||
header('HTTP/1.1 500 Non enough arguments');
|
||||
|
||||
@@ -7,9 +7,10 @@ require_once("../../queries/checkInput.php");
|
||||
require_once("../../queries/user.php");
|
||||
|
||||
// Check if the user is allowed to send a message.
|
||||
if (isset($_SESSION["userID"]) &&
|
||||
getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
if (!isset($_SESSION["userID"])) {
|
||||
echo "logged out";
|
||||
} else if (getRoleByID($_SESSION["userID"]) != 'frozen' &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
if (!empty(test_input($_POST["destination"])) &&
|
||||
!empty(test_input($_POST["content"]))
|
||||
) {
|
||||
|
||||
@@ -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');
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
try{
|
||||
$fbUsername = str_replace(' ', '', test_input(($_POST["fbUsername"])));
|
||||
checkInputChoice($fbUsername, "fbUsername");
|
||||
} catch(usernameException $e){
|
||||
$fbCorrect = false;
|
||||
$fbUsernameErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$fbPassword = str_replace(' ', '', test_input(($_POST["fbPassword"])));
|
||||
checkInputChoice($fbPassword, "longerEight");
|
||||
matchfbPassword();
|
||||
} catch(passwordException $e){
|
||||
$fbCorrect = false;
|
||||
$fbPasswordErr = $e->getMessage();
|
||||
} catch(fbConfirmPasswordException $e){
|
||||
$fbCorrect = false;
|
||||
$fbConfirmpasswordErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$fbName = test_input(($_POST["fbName"]));
|
||||
checkInputChoice($fbName, "lettersAndSpaces");
|
||||
} catch(lettersAndSpacesException $e){
|
||||
$fbCorrect = false;
|
||||
}
|
||||
|
||||
try {
|
||||
$fbSurname = test_input(($_POST["fbSurname"]));
|
||||
checkInputChoice($fbSurname, "lettersAndSpaces");
|
||||
}
|
||||
catch(lettersAndSpacesException $e){
|
||||
$fbCorrect = false;
|
||||
}
|
||||
|
||||
try {
|
||||
$fbDay_date = test_input(($_POST["fbDay_date"]));
|
||||
$fbMonth_date = test_input(($_POST["fbMonth_date"]));
|
||||
$fbYear_date = test_input(($_POST["fbYear_date"]));
|
||||
$fbBday = $fbYear_date . "-" . $fbMonth_date . "-" . $fbDay_date;
|
||||
checkInputChoice($fbBday, "bday");
|
||||
} catch (bdayException $e) {
|
||||
$fbBdayErr = $e->getMessage();
|
||||
$fbCorrect = false;
|
||||
}
|
||||
|
||||
try{
|
||||
$fbEmail = test_input(($_POST["fbEmail"]));
|
||||
checkInputChoice($fbEmail, "fbEmail");
|
||||
} catch(emailException $e){
|
||||
$fbCorrect = false;
|
||||
$fbEmailErr = $e->getMessage();
|
||||
|
||||
}
|
||||
|
||||
$fbUserID = test_input(($_POST["fbUserID"]));
|
||||
|
||||
try {
|
||||
fbRegisterCheck($fbCorrect);
|
||||
} catch(registerException $e){
|
||||
echo "<script>
|
||||
window.onload = function() {
|
||||
$('#fbModal').show();
|
||||
}
|
||||
</script>";
|
||||
$fbRegisterErr = $e->getMessage();
|
||||
}
|
||||
@@ -43,6 +43,8 @@ function sendMessage() {
|
||||
).done(function(response) {
|
||||
if (response == "frozen") {
|
||||
alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||
} else if (response == "logged out") {
|
||||
window.location.href = "login.php?url=" + window.location.pathname;
|
||||
}
|
||||
// Load messages if the message has been send, so it shows in the chat.
|
||||
loadMessages();
|
||||
|
||||
@@ -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":
|
||||
value1 = "request";
|
||||
class1 = "green";
|
||||
text1 = "Bevriend";
|
||||
icon1 = "fa-handshake-o";
|
||||
text1 = "Word vrienden";
|
||||
icon1 = "fa-user-plus";
|
||||
break;
|
||||
case "1":
|
||||
value1 = userID;
|
||||
class1 = "green";
|
||||
text1 = "Chat";
|
||||
icon1 = "fa-comment-o";
|
||||
icon1 = "fa-comment";
|
||||
value2 = "delete";
|
||||
class2 = "red";
|
||||
text2 = "Verwijder";
|
||||
icon2 = "fa-times";
|
||||
text2 = "Ontvriend";
|
||||
icon2 = "fa-user-times";
|
||||
break;
|
||||
case "2":
|
||||
value1 = "delete";
|
||||
class1 = "red";
|
||||
text1 = "Trek verzoek in";
|
||||
icon1 = "fa-cross";
|
||||
icon1 = "fa-times";
|
||||
break;
|
||||
case "3":
|
||||
value1 = "accept";
|
||||
@@ -51,16 +51,18 @@ function placeFriendButtons() {
|
||||
}
|
||||
|
||||
$buttonContainer.append(
|
||||
"<button class='"+ class1 +" friend-button' value='"+ value1 +"'>" +
|
||||
"<i class='fa "+ icon1 +"'></i> " + text1 +
|
||||
"</button>");
|
||||
"<div><button class='"+ class1 +" fancy-button friend-button' value='"+ value1 +"'>" +
|
||||
"<span>"+ text1 +"</span>" +
|
||||
"<i class='fa fa-fw "+ icon1 +"'></i> " +
|
||||
"</button></div>");
|
||||
$buttonContainer.append(
|
||||
"<button class='"+ class2 +" friend-button' value='"+ value2 +"'>" +
|
||||
"<i class='fa "+ icon2 +"'></i> " + text2 +
|
||||
"</button>");
|
||||
"<div><button class='"+ class2 +" fancy-button friend-button' value='"+ value2 +"'>" +
|
||||
"<span>"+ text2 +"</span>" +
|
||||
"<i class='fa fa-fw "+ icon2 +"'></i> " +
|
||||
"</button></div>");
|
||||
|
||||
|
||||
$buttonContainer.children().click(function() {
|
||||
$buttonContainer.find("button").click(function() {
|
||||
if (isNaN(this.value))
|
||||
editFriendship(userID, this.value);
|
||||
else if (this.value != "")
|
||||
|
||||
@@ -5,23 +5,23 @@ function placeGroupButtons() {
|
||||
|
||||
if (data == 'none') {
|
||||
$buttonContainer.append(
|
||||
"<button class='green group-button group-button-fixed' value='request'>" +
|
||||
"<i class='fa fa-plus'></i> Voeg toe" +
|
||||
"<button class='green group-button fancy-button' value='request'>" +
|
||||
"<span>Treed toe</span><i class='fa fa-plus'></i>" +
|
||||
"</button>");
|
||||
} else if (data == 'request') {
|
||||
$buttonContainer.append(
|
||||
"<button class='red group-button group-button-fixed' value='none'>" +
|
||||
"<i class='fa fa-times'></i> Trek verzoek in" +
|
||||
"<button class='red group-button fancy-button' value='none'>" +
|
||||
"<span>Trek verzoek in</span><i class='fa fa-times'></i>" +
|
||||
"</button>");
|
||||
} else if (data == 'admin') {
|
||||
$buttonContainer.append(
|
||||
"<button class='group-button group-button-fancy' value='admin'>" +
|
||||
"<button class='group-button fancy-button' value='admin'>" +
|
||||
"<span>Instellingen</span><i class='fa fa-cogs'></i>" +
|
||||
"</button>"
|
||||
);
|
||||
} else {
|
||||
$buttonContainer.append(
|
||||
"<button class='red group-button group-button-fancy' value='none'>" +
|
||||
"<button class='red group-button fancy-button' value='none'>" +
|
||||
"<span>Verlaat groep</span><i class='fa fa-sign-out'></i>" +
|
||||
"</button>");
|
||||
}
|
||||
|
||||
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) {
|
||||
// Add links, images, gifs and (youtube) video's.
|
||||
var regex = /(https?:\/\/.[^ <>"]*)/ig;
|
||||
text = text.replace(regex, function(link) {
|
||||
text = text.replace(/(https?:\/\/.[^ \n<>"]*)/ig, function(link) {
|
||||
// Add images
|
||||
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
|
||||
return "<img alt='" + link + "' src='" + link + "' />";
|
||||
@@ -39,7 +38,7 @@ function fancyText(text) {
|
||||
}
|
||||
|
||||
// This function gets the value of a cookie when given a key.
|
||||
// If didn´t find any compatible cookie, it returns false.
|
||||
// If it didn´t find any compatible cookie, it returns false.
|
||||
function getCookie(key) {
|
||||
cookies = document.cookie.split("; ");
|
||||
for (var i in cookies) {
|
||||
|
||||
@@ -26,7 +26,7 @@ function requestPost(postID) {
|
||||
function postPost() {
|
||||
title = $("input.newpost[name='title']").val();
|
||||
content = $("textarea.newpost[name='content']").val();
|
||||
|
||||
console.log(masonryMode);
|
||||
if (masonryMode == 2) {
|
||||
$.post("API/postPost.php", { title: title,
|
||||
content : content,
|
||||
@@ -36,6 +36,10 @@ function postPost() {
|
||||
$('#alertbox').show();
|
||||
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
||||
window.scrollTo(0,0);
|
||||
} else if (data == "logged out") {
|
||||
window.location.href = "login.php?url=" + window.location.pathname;
|
||||
} else if (data == "frozen") {
|
||||
alert("Je account is bevroren, dus je kan geen posts plaatsen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||
} else {
|
||||
$('#alertbox').hide();
|
||||
masonry(masonryMode);
|
||||
@@ -49,6 +53,10 @@ function postPost() {
|
||||
$('#alertbox').show();
|
||||
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
|
||||
window.scrollTo(0,0);
|
||||
} else if (data == "logged out") {
|
||||
window.location.href = "login.php?url=" + window.location.pathname;
|
||||
} else if (data == "frozen") {
|
||||
alert("Je account is bevroren, dus je kan geen posts plaatsen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||
} else {
|
||||
$('#alertbox').hide();
|
||||
masonry(masonryMode);
|
||||
|
||||
@@ -8,6 +8,8 @@ function postComment(buttonValue) {
|
||||
).done(function (response) {
|
||||
if (response == "frozen") {
|
||||
alert("Je account is bevroren, dus je kan geen comments plaatsen of \"niet slechten\". Contacteer een admin als je denkt dat dit onjuist is.");
|
||||
} else if (response == "logged out") {
|
||||
window.location.href = "login.php?url=" + window.location.pathname;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -30,6 +32,8 @@ function deletePost(postID) {
|
||||
).done(function (response) {
|
||||
if (response == "frozen") {
|
||||
alert("Je account is bevroren, dus je kan geen posts verwijderen. Contacteer een admin als je denkt dat dit onjuist is.");
|
||||
} else if (response == "logged out") {
|
||||
window.location.href = "login.php?url=" + window.location.pathname;
|
||||
}
|
||||
});
|
||||
closeModal();
|
||||
|
||||
@@ -13,18 +13,12 @@
|
||||
?>
|
||||
<body>
|
||||
<?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");
|
||||
|
||||
/* This view adds login view */
|
||||
include("../views/login-view.php");
|
||||
?>
|
||||
<script src="js/loginRegisterModals.js"></script>;
|
||||
</body>
|
||||
</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>
|
||||
@@ -1,91 +0,0 @@
|
||||
<?php
|
||||
|
||||
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, "");
|
||||
} 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);
|
||||
sendConfirmEmail(getUserID()["userID"]);
|
||||
} catch(registerException $e){
|
||||
echo "<script>
|
||||
window.onload = function() {
|
||||
$('#registerModal').show();
|
||||
}
|
||||
</script>";
|
||||
$genericErr = $e->getMessage();
|
||||
}
|
||||
@@ -198,12 +198,6 @@ ul {
|
||||
animation-duration: 0.4s
|
||||
}
|
||||
|
||||
/* Add Animation */
|
||||
@-webkit-keyframes animatetop {
|
||||
from {top:-300px; opacity:0}
|
||||
to {top:0; opacity:1}
|
||||
}
|
||||
|
||||
@keyframes animatetop {
|
||||
from {top:-300px; opacity:0}
|
||||
to {top:0; opacity:1}
|
||||
|
||||
@@ -256,8 +256,6 @@ div[data-title]:hover:after {
|
||||
top: 150%;
|
||||
z-index: 200;
|
||||
white-space: nowrap;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
|
||||
background-color: #333;
|
||||
|
||||
@@ -91,16 +91,5 @@
|
||||
|
||||
.deleteButton {
|
||||
background-color: firebrick;
|
||||
}
|
||||
|
||||
.deleteButton i {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.deleteButton:hover span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.deleteButton span {
|
||||
display: none;
|
||||
float: right;
|
||||
}
|
||||
@@ -27,16 +27,21 @@
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.friend-button-container div, .status-buttons-container div {
|
||||
width: 200px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.friend-button-container button, .status-buttons-container button, .group-button-container button {
|
||||
display: block;
|
||||
float: right;
|
||||
|
||||
margin: 7px 0;
|
||||
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.friend-button-container button, .status-buttons-container button, .group-button-fixed {
|
||||
width: 200px;
|
||||
.status-buttons-container button {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.group-button-container button {
|
||||
@@ -74,22 +79,21 @@
|
||||
|
||||
.group-picture {
|
||||
border: none;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.group-button-fancy span {
|
||||
.fancy-button span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.group-button-fancy:hover {
|
||||
.fancy-button:hover {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.group-button-fancy i {
|
||||
.fancy-button i {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.group-button-fancy:hover span {
|
||||
.fancy-button:hover span {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user