Merge branch 'master' into hendrik-post

This commit is contained in:
Hendrik
2017-02-01 14:13:55 +01:00
117 changed files with 11735 additions and 414 deletions

View File

@@ -1,5 +1,6 @@
<select name="day_date" >
<option>dag</option>
<!--All the days-->
<select name="day_date" autocomplete="bday-day">
<option>Dag</option>
<?php
for($i=1; $i<32; $i++) {
$i = sprintf("%02d", $i);
@@ -9,7 +10,8 @@
}
?>
</select>
<select name="month_date">
<!--All the months-->
<select name="month_date" autocomplete="bday-month">
<option>Maand</option>
<option value="01" <?php submitselect($month_date, "01")?>>januari</option>
<option value="02" <?php submitselect($month_date, "02")?>>februari</option>
@@ -24,11 +26,12 @@
<option value="11" <?php submitselect($month_date, "11")?>>november</option>
<option value="12" <?php submitselect($month_date, "12")?>>december</option>
</select>
<select name="year_date">
<!--All the year from 1900 till current year-->
<select name="year_date" autocomplete="bday-year">
<option>Jaar</option>
<?php
$year = (new DateTime)->format("Y");
for($i=$year; $i > $year - 100; $i--) {
for($i=$year; $i >= 1900; $i--) {
?>
<option value="<?= $i ?>" <?php submitselect($year_date, $i)?>><?= $i ?></option>
<?php

View File

@@ -0,0 +1,94 @@
<!-- The Modal -->
<div id="fbModal" class="modal">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
return= $correct
method="post"
name="fbModal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">&times;</span>
<h3>Voer uw gegevens in</h3>
</div>
<div class="modal-body">
<div class="login_containerfault"><span><?php echo $fbRegisterErr; ?></span></div>
<div class="login_containerfault"><span><?php echo $fbEmailErr; ?></span></div>
<!-- Register username -->
<div class="login_containerregister">
<label><b>Gebruikersnaam</b></label>
<input type="text"
placeholder="Voer uw gebruikersnaam in"
name="fbUsername"
value="<?php echo $fbUsername ?>"
title="Moet minimaal 6 karakters bevatten"
required>
*<span class="error"> <?php echo $fbUsernameErr;?></span>
<ul>
<li>Minstens 6 karakters</li>
</ul>
</div>
<!-- Register password -->
<div class="login_containerregister">
<label><b>Wachtwoord</b></label>
<input type="password"
placeholder="Voer uw wachtwoord in"
name="fbPassword"
value="<?php echo $fbPassword ?>"
id="password"
required>
*<span class="error"> <?php echo $fbPasswordErr;?></span>
<ul>
<li>Minstens 8 karakters</li>
</ul>
</div>
<!-- Repeat password -->
<div class="login_containerregister">
<label><b>Herhaal wachtwoord</b></label>
<input type="password"
placeholder="Herhaal wachtwoord"
name="fbConfirmpassword"
value="<?php echo $fbConfirmpassword ?>"
id="confirmpassword"
title="Herhaal wachtwoord">
*<span class="error"> <?php echo $fbConfirmpasswordErr;?></span>
</div>
<?php if(empty($userBday)) { ?>
<!-- Register birthday -->
<div class="login_containerregister">
<label><b>Geboortedatum</b></label>
<?php
include("../views/fbBdayInput.php");
?>
*<span class="error"> <?php echo $fbBdayErr;?></span>
</div>
<?php } ?>
</div>
<div class="modal-footer">
<button type="submit"
value="fbRegister"
name="submit"
id="frm1_submit">
Registreer account
</button>
</div>
</div>
<input type="hidden"
name="fbName"
value="<?php echo $fbName ?>">
<input type="hidden"
name="fbSurname"
value="<?php echo $fbSurname ?>">
<input type="hidden"
name="fbUserID"
value="<?php echo $fbUserID ?>">
<input type="hidden"
name="fbEmail"
value="<?php echo $fbEmail ?>">
</form>
</div>

View File

@@ -0,0 +1,40 @@
<!--All the days-->
<select name="fbDay_date" autocomplete="bday-day">
<option>Dag</option>
<?php
for($i=1; $i<32; $i++) {
$i = sprintf("%02d", $i);
?>
<option value="<?= $i ?>" <?php submitselect($fbDay_date, $i)?>><?= $i ?></option>
<?php
}
?>
</select>
<!--All the months-->
<select name="fbMonth_date" autocomplete="bday-month">
<option>Maand</option>
<option value="01" <?php submitselect($fbMonth_date, "01")?>>januari</option>
<option value="02" <?php submitselect($fbMonth_date, "02")?>>februari</option>
<option value="03" <?php submitselect($fbMonth_date, "03")?>>maart</option>
<option value="04" <?php submitselect($fbMonth_date, "04")?>>april</option>
<option value="05" <?php submitselect($fbMonth_date, "05")?>>mei</option>
<option value="06" <?php submitselect($fbMonth_date, "06")?>>juni</option>
<option value="07" <?php submitselect($fbMonth_date, "07")?>>juli</option>
<option value="08" <?php submitselect($fbMonth_date, "08")?>>augustus</option>
<option value="09" <?php submitselect($fbMonth_date, "09")?>>september</option>
<option value="10" <?php submitselect($fbMonth_date, "10")?>>oktober</option>
<option value="11" <?php submitselect($fbMonth_date, "11")?>>november</option>
<option value="12" <?php submitselect($fbMonth_date, "12")?>>december</option>
</select>
<!--All the year from 1900 till current year-->
<select name="fbYear_date" autocomplete="bday-year">
<option>Jaar</option>
<?php
$year = (new DateTime)->format("Y");
for($i=$year; $i >= 1900; $i--) {
?>
<option value="<?= $i ?>" <?php submitselect($fbYear_date, $i)?>><?= $i ?></option>
<?php
}
?>
</select>

View File

@@ -19,7 +19,8 @@
class="middle"
placeholder="Voer uw email in"
name="forgotEmail"
title="Voer een email in">
title="Voer een email in"
required>
</div>
<div class="modal-footer">
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>

View File

@@ -1,11 +1,10 @@
<div class="content">
<div class="profile-box platform">
<img class="left main-picture" src="<?= $group['picture'] ?>">
<div class="profile-button">
<p><img src="img/leave-group.png"> Groep verlaten</p>
</div>
<img class="left main-picture group-picture" src="<?= $group['picture'] ?>">
<div class="group-button-container"></div>
<h1 class="profile-username"><?= $group['name'] ?></h1>
<p><?= $group['description'] ?></p>
</div>
<div class="item-box-full-width platform">

View File

@@ -0,0 +1,114 @@
<?php
// Facebook variables
$appID = "353857824997532";
$appSecret = "db47e91ffbfd355fdd11b4b65eade851";
$fbUsername = $fbPassword = $fbConfirmpassword = "";
$fbUsernameErr = $fbPasswordErr = $fbConfirmpasswordErr = $fbEmailErr = $fbBdayErr = "";
$fbCorrect = true;
$fbName = $fbSurname = $fbBday = $fbEmail = $fbUserID = "";
$bdayExist = false;
// Register variables
$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 = $month_date = $year_date = "";
$fbDay_date = $fbMonth_date = $fbYear_date = "";
// Login variables
$user = $psw = $remember ="";
$loginErr = $resetErr = $fbRegisterErr ="";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Checks for which button is pressed
switch ($_POST["submit"]) {
case "login":
try {
$user = ($_POST["user"]);
validateLogin($_POST["user"], $_POST["psw"]);
} catch(loginException $e) {
$loginErr = $e->getMessage();
}
break;
case "reset":
try {
resetEmail($_POST["forgotEmail"]);
sendPasswordRecovery($_POST["forgotEmail"]);
} catch (emailException $e){
$resetErr = $e->getMessage();
echo "<script>
window.onload = function() {
$('#myModal').show();
}
</script>";
}
break;
case "register":
include("register.php");
break;
case "fbRegister":
include("fbRegister.php");
break;
}
}
$fb = new Facebook\Facebook([
'app_id' => $appID,
'app_secret' => $appSecret,
'default_graph_version' => 'v2.2',
]);
$redirect = "https://myhyvesbookplus.nl/login.php";
$helper = $fb->getRedirectLoginHelper();
try {
// Returns a `Facebook\FacebookResponse` object
$acces_token = $helper->getAccessToken();
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
if(!isset($acces_token)){
$permission=["email", "user_birthday"];
$loginurl=$helper->getLoginUrl($redirect,$permission);
}else {
$fb->setDefaultAccessToken($acces_token);
$response = $fb->get('/me?fields=email,name,birthday');
$usernode = $response->getGraphUser();
$nameSplit = explode(" ", $usernode->getName());
$fbName = $nameSplit[0];
$fbSurname = $nameSplit[1];
$fbUserID = $usernode->getID();
$fbEmail = $usernode->getProperty("email");
// $image = 'https://graph.facebook.com/' . $usernode->getId() . '/picture?width=200';
if (fbLogin($fbUserID) == 1) {
$fbID = getfbUserID($fbUserID)["userID"];
$fbRole = getfbUserID($fbUserID)["role"];
if($fbRole == "banned"){
echo "<script>
window.onload=bannedAlert();
</script>";
} else if($fbRole == "frozen"){
$_SESSION["userID"] = $fbID;
echo "<script>
window.onload=frozenAlert();
window.location.href= 'profile.php';
</script>";
} else {
$_SESSION["userID"] = $fbID;
header("location: profile.php");
}
} else {
echo "<script>
window.onload = function() {
$('#fbModal').show();
}
</script>";
}
}

View File

@@ -20,7 +20,7 @@
name="user"
value="<?php echo $user ?>"
title="Moet een geldige gebruiker zijn"
>
required>
</div>
<!-- Login password -->
@@ -31,7 +31,7 @@
placeholder="Voer uw wachtwoord in"
name="psw"
title="Moet minstens 8 karakters lang zijn"
>
required>
</div>
<!-- Error message -->
@@ -47,58 +47,68 @@
</button>
</div>
<div class="login_containerlogin">
<label><b>Onthoud mij</b></label>
<input type="checkbox" name="rememberMe" value=1><br>
</div>
</form>
</div>
<!-- Button for going to the register screen -->
<!--Vieuws for the modals-->
<div class="login_containerlogin">
<!-- <a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>-->
<?php
include("../views/forgotPasswordModal.php");
include("../views/registerModal.php");
include("../views/facebookRegisterModal.php");
?>
</div>
<!--Login with facebook button-->
<?php
if(!isset($acces_token)) {
echo '<div class="login_containerlogin"><a class="fbButton" href="' . $loginurl . '">login with Facebook!</a></div>';
}
?>
<script>
// Get the button that opens the modal
// 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 modal
var registerModal = document.getElementById('registerModal');
var registerBtn = document.getElementById("registerBtn");
// 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
/**
* When the user clicks the button, open the modal
*/
btn.onclick = function () {
// modal.style.display = "block";
modal.style.display = "block";
window.onload=emailSent();
}
registerBtn.onclick = function () {
registerModal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
/**
* 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
/**
* When the user clicks anywhere outside of the modal, close it
*/
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
@@ -106,5 +116,20 @@ var registerSpan = document.getElementsByClassName("close")[1];
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>

View File

@@ -32,7 +32,8 @@
name="name"
value="<?php echo $name ?>"
title="Mag alleen letters bevatten"
>
required
autocomplete="given-name">
*<span class="error"><?php echo $nameErr;?></span>
</div>
@@ -44,7 +45,8 @@
name="surname"
value="<?php echo $surname ?>"
title="Mag alleen letters bevatten"
>
required
autocomplete="family-name">
*<span class="error"> <?php echo $surnameErr;?></span>
</div>
@@ -65,7 +67,7 @@
name="username"
value="<?php echo $username ?>"
title="Moet minimaal 6 karakters bevatten"
>
required>
*<span class="error"> <?php echo $usernameErr;?></span>
<ul>
<li>Minstens 6 karakters</li>
@@ -81,7 +83,7 @@
name="password"
value="<?php echo $password ?>"
id="password"
>
required>
*<span class="error"> <?php echo $passwordErr;?></span>
<ul>
<li>Minstens 8 karakters</li>
@@ -96,7 +98,7 @@
value="<?php echo $confirmpassword ?>"
id="confirmpassword"
title="Herhaal wachtwoord"
>
required>
*<span class="error"> <?php echo $confirmpasswordErr;?></span>
</div>
@@ -109,7 +111,6 @@
value="<?php echo $location ?>"
pattern="[A-Za-z]{1,}"
title="Mag alleen letters bevatten">
*<span class="error"> <?php echo $locationErr;?></span>
</div>
<!-- Register email -->
@@ -120,7 +121,8 @@
name="email"
value="<?php echo $email ?>"
id="email"
title="Voer een geldige email in">
title="Voer een geldige email in"
required>
*<span class="error"> <?php echo $emailErr;?></span>
</div>
@@ -132,10 +134,12 @@
name="confirmEmail"
value="<?php echo $confirmEmail ?>"
id="email"
title="Herhaal uw email">
title="Herhaal uw email"
required>
*<span class="error"> <?php echo $confirmEmailErr;?></span>
</div>
<!-- Captcha confirm -->
<div class="login_containerregister">
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ">
</div>
@@ -145,6 +149,7 @@
</div>
<div class="modal-footer">
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
<!-- Register button -->
<button type="submit"
value="register"
name="submit"