Merge branch 'master' into kevin-prototype

This commit is contained in:
K. Nobel
2017-02-02 15:38:39 +01:00
23 changed files with 160 additions and 66 deletions

View File

@@ -12,13 +12,15 @@ if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if (empty($_POST["title"]) or
empty($_POST["content"]) or
empty($_SESSION["userID"])
) {
if (empty($_SESSION["userID"])) {
header('HTTP/1.1 500 Non enough arguments');
}
if (empty(test_input($_POST["title"])) or
empty(test_input($_POST["content"]))
) {
echo "empty";
} else {
if (empty($_POST["group"])) {
// User Post
makePost(
@@ -43,6 +45,7 @@ if (isset($_SESSION["userID"]) &&
test_input($_POST["content"])
);
}
}
} else {
echo "frozen";
}

View File

@@ -0,0 +1,8 @@
<?php
if (isset($_GET["groupname"])) {
$url = "https://myhyvesbookplus.nl/~lars/group.php?groupname=" . $_GET["groupname"];
} else {
$url = "https://myhyvesbookplus.nl/";
}
?>
<a href="<?= $url ?>" target='_blank'><img style="width: 100%; height: auto;" src="../external/nietslecht_button.png" alt='\"Niet slecht\" ons op MyHyvesbook+' /></a>

View File

@@ -25,6 +25,9 @@ function loadMessages() {
addMessages(messages);
$("#lastID").val(messages[messages.length - 1].messageID);
}
loadUnreadMessages();
gettingMessages = false;
});
} else {
@@ -56,7 +59,7 @@ function addMessages(messages) {
for(var i in messages) {
// Initialize message variables.
var thisDate = new Date(messages[i].creationdate.replace(/ /,"T"));
var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes();
var thisTime = thisDate.getHours() + ":" + ('0' + thisDate.getMinutes()).slice(-2);
var type;
thisDate.setHours(0,0,0,0);
@@ -78,6 +81,8 @@ function addMessages(messages) {
</div>';
}
previousDate = thisDate;
previousTime = thisTime;
previousType = type;
messagesText += '<div class="chat-message"><div class="' + type + '">';
// If it is not the first message, and has a different date/time/type then the previous message,
} else if (type != previousType || thisTime != previousTime || thisDate.getTime() > previousDate.getTime()) {

View File

@@ -31,7 +31,7 @@ function fancyText(text) {
}
// Add links
else {
return "<a href='" + link + "'>" + link + "</a>";
return "<a href='" + link + "' target='_blank'>" + link + "</a>";
}
});

View File

@@ -31,14 +31,28 @@ function postPost() {
$.post("API/postPost.php", { title: title,
content : content,
group : groupID })
.done(function() {
.done(function(data) {
if (data == "empty") {
$('#alertbox').show();
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
window.scrollTo(0,0);
} else {
$('#alertbox').hide();
masonry(masonryMode);
}
});
} else {
$.post("API/postPost.php", { title: title,
content : content })
.done(function() {
.done(function(data) {
if (data == "empty") {
$('#alertbox').show();
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
window.scrollTo(0,0);
} else {
$('#alertbox').hide();
masonry(masonryMode);
}
});
}
@@ -98,6 +112,10 @@ function masonry(mode) {
masonryMode = mode;
$container.children().remove();
// reinit posts
noposts = false;
postAmount = 0;
/*
* Initialise columns.
*/
@@ -153,9 +171,6 @@ function loadMorePosts(uID, gID, offset, limit) {
return;
}
console.log(uID, gID, offset, limit);
$.post("API/getPosts.php", { usr : uID,
grp : gID,
offset : offset,

View File

@@ -18,7 +18,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
switch ($_POST["form"]) {
case "profile":
updateSettings();
checkUpdateSettings();
break;
case "password":
changePassword();

View File

@@ -133,6 +133,12 @@ label {
color: red;
}
.login_containerNoscript {
padding: 4px;
text-align: center;
color: red;
}
@keyframes animatezoom {
from {transform: scale(0)}
to {transform: scale(1)}
@@ -150,7 +156,7 @@ label {
margin: 16px auto;
overflow-y: auto;
padding: 20px;
width: 600px;
width: 650px;
}
select{

View File

@@ -48,6 +48,10 @@
width: 90%;
}
.post-content a {
text-decoration: underline;
}
.commentfield {
margin-bottom: 20px;
}

View File

@@ -1,5 +1,14 @@
/* New */
.alertbox {
display: none;
background-color: firebrick;
}
.alerttext {
color: white;
}
.user-box {
text-align: center;
}
@@ -89,6 +98,10 @@ div.posts div.post {
word-wrap: break-word;
}
div.posts div.post a {
text-decoration: underline;
}
div.posts div.post:hover {
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
}

View File

@@ -47,6 +47,8 @@ function checkName($variable){
throw new lettersAndSpacesException("Verplicht!");
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
} else if (strlen($variable) > 63){
throw new lettersAndSpacesException(("Mag maximaal 63 karakters hebben!"));
}
}
@@ -81,6 +83,8 @@ function username($variable){
throw new usernameException("Moet minstens 6 karakters bevatten");
} else if (getExistingUsername() == 1) {
throw new usernameException("Gebruikersnaam bestaal al");
} else if (strlen($variable) > 50) {
throw new usernameException("Mag maximaal 50 karakters!");
}
}
@@ -92,6 +96,8 @@ function fbUsername($variable){
throw new usernameException("Moet minstens 6 karakters bevatten");
} else if (getExistingFBUsername() == 1) {
throw new usernameException("Gebruikersnaam bestaal al");
} else if (strlen($variable) > 50) {
throw new usernameException("Mag maximaal 50 karakters!");
}
}
@@ -101,6 +107,8 @@ function longerEight($variable){
throw new passwordException("Verplicht!");
} else if (strlen($variable) < 8) {
throw new passwordException("Moet minstens 8 karakters bevatten");
} else if (strlen($variable) > 50) {
throw new usernameException("Mag maximaal 50 karakters!");
}
}
@@ -112,9 +120,11 @@ function validateEmail($variable){
throw new emailException("Geldige email invullen");
} else if (getExistingEmail() == 1){
throw new emailException("Email bestaal al!");
} else if (strlen($variable) > 255) {
throw new emailException("Mag maximaal 50 karakters!");
}
}
//255
/* checks if an input is a valid email. */
function validateFBEmail($variable){
if (empty($variable)) {
@@ -122,7 +132,9 @@ function validateFBEmail($variable){
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
throw new emailException("Geldige email invullen");
} else if (getExistingFBEmail() == 1){
throw new emailException("Email bestaal al!");
throw new emailException("Uw email wordt al gebruikt voor een ander account!");
} else if (strlen($variable) > 255) {
throw new emailException("Mag maximaal 50 karakters!");
}
}

View File

@@ -17,7 +17,7 @@ function selectLimitedFriends($userID, $limit) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
@@ -58,7 +58,7 @@ function selectAllFriends($userID) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
@@ -94,7 +94,7 @@ function selectAllFriendRequests() {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
@@ -245,7 +245,7 @@ function searchSomeFriends($n, $m, $search) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,

View File

@@ -50,6 +50,15 @@ function getPasswordHash() {
return $stmt->fetch();
}
function checkUpdateSettings() {
if (empty(test_input($_POST['fname'])) || empty(test_input($_POST['lname']))) {
throw new AngryAlert("Geen voornaam of achternaam.");
return;
}
updateSettings();
}
/**
* Changes the setting from post.
* @throws HappyAlert

View File

@@ -62,7 +62,7 @@ function selectUser($me, $other) {
) AS profilepicture,
`bio`,
`user`.`creationdate`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
@@ -137,7 +137,7 @@ function select20UsersFromN($n) {
`username`,
`role`,
`bancomment`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`
@@ -162,7 +162,7 @@ function search20UsersFromN($n, $keyword) {
`username`,
`role`,
`bancomment`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`
@@ -190,7 +190,7 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
`username`,
`role`,
`bancomment`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`
@@ -224,7 +224,7 @@ function searchSomeUsersByStatus($n, $m, $search, $status) {
`username`,
`role`,
`bancomment`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`
@@ -368,7 +368,7 @@ function searchSomeUsers($n, $m, $search) {
'../img/avatar-standard.png'
) AS profilepicture,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 12) as `fullname`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`

View File

@@ -1,8 +1,8 @@
<tr>
<th><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll(this)"></th>
<th class="table-username">Gebruikersnaam</th>
<th class="table-username">Groepsnaam</th>
<th class="table-status">Status</th>
<th class="table-comment">Aantekening</th>
<th class="table-comment">Beschrijving</th>
<th class="table-action">Actie</th>
</tr>
@@ -33,9 +33,9 @@ while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
<form class='admin-groupaction'
onsubmit=\"adminUpdate(this); return false;\">
<select class='action' name='actions'>
<option value='hidden'>Hidden</option>
<option value='public'>Public</option>
<option value='membersonly'>Members</option>
<option value='hidden'>Verborgen</option>
<option value='public'>Publiek</option>
<option value='membersonly'>Alleen Leden</option>
</select>
<input type='hidden' name='groupID' value='$groupID'>
<input type='submit' value='Confirm'>

View File

@@ -55,7 +55,8 @@ while($user = $q->fetch(PDO::FETCH_ASSOC)) {
OR $user['role'] == 'owner'))) {
echo "<option value='frozen'>Bevries</option>
<option value='banned'>Ban</option>
<option value='user'>Activeer</option>";
<option value='user'>Activeer</option>
<option value='unconfirmed'>Ongevalideerd</option>";
if ($userinfo == 'owner') {
echo "<option value='admin'>Admin</option>

View File

@@ -67,13 +67,13 @@ if (isset($_GET["groupstatus"])) {
id="frozen"
value="frozen"
<?php if (in_array("frozen", $status)) echo "checked";?>>
<label for="frozen">Gefrozen</label><br>
<label for="frozen">Bevroren</label><br>
<input type="checkbox"
name="status[]"
id="banned"
value="banned"
<?php if (in_array("banned", $status)) echo "checked";?>>
<label for="banned">Gebant</label><br>
<label for="banned">Verbannen</label><br>
<input type="checkbox"
name="status[]"
id="admin"
@@ -91,7 +91,7 @@ if (isset($_GET["groupstatus"])) {
id="owner"
value="owner"
<?php if (in_array("owner", $status)) echo "checked";?>>
<label for="owner">Owner</label>
<label for="owner">Eigenaar</label>
</div>
<div id="admin-groupfilter">
@@ -122,6 +122,7 @@ if (isset($_GET["groupstatus"])) {
<button type="submit" name="batchactions" id="freeze" value="frozen">Bevries</button>
<button type="submit" name="batchactions" id="ban" value="banned">Ban</button>
<button type="submit" name="batchactions" id="restore" value="user">Activeer</button>
<button type="submit" name="batchactions" id="unconfirm" value="unconfirmed">Maak Ongevalideerd</button>
<?php
if ($userinfo == 'owner') {
echo "<button type=\"submit\"
@@ -131,7 +132,7 @@ if (isset($_GET["groupstatus"])) {
<button type=\"submit\"
name=\"batchactions\"
id=\"owner\"
value=\"owner\">Maak Owner</button>";
value=\"owner\">Maak Eigenaar</button>";
}
?>
</form>
@@ -139,9 +140,9 @@ if (isset($_GET["groupstatus"])) {
onsubmit="adminUpdate(this); return false;">
<input type="hidden" name="groupbatchactions" id="groupbatchinput">
<button type="submit" name="batchactions" id="hide" value="hidden">Hide</button>
<button type="submit" name="batchactions" id="ban" value="public">Public</button>
<button type="submit" name="batchactions" id="members" value="membersonly">Members</button>
<button type="submit" name="batchactions" id="hide" value="hidden">Verborgen</button>
<button type="submit" name="batchactions" id="ban" value="public">Publiek</button>
<button type="submit" name="batchactions" id="members" value="membersonly">Alleen Leden</button>
</form>
</div>

View File

@@ -55,7 +55,6 @@
*<span class="error"> <?php echo $fbConfirmpasswordErr;?></span>
</div>
<?php if(empty($userBday)) { ?>
<!-- Register birthday -->
<div class="login_containerregister">
@@ -67,6 +66,7 @@
</div>
<?php } ?>
</div>
*<span class="error"> <?php echo $fbEmailErr;?></span>
<div class="modal-footer">
<button type="submit"
value="fbRegister"
@@ -77,7 +77,6 @@
</div>
</div>
<input type="hidden"
name="fbName"
value="<?php echo $fbName ?>">

View File

@@ -2,7 +2,6 @@
<meta name="description" content="MyHyvesbook+ is het sociaal media voor alle coole mensen.">
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
<meta name="author" content="MyHyvesbookplus corporation">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MyHyvesbook+</title>
<!-- Add your javascript files here. -->
<script src="js/jquery.js"></script>

View File

@@ -7,7 +7,6 @@ $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 = "";

View File

@@ -1,3 +1,9 @@
<div class="login_containerNoscript">
<noscript>
<a href="http://www.enable-javascript.com/nl/" target="_blank">Om deze site te gebruiken is het noodzakelijk om Javascript aan te zetten.
Klikt hier voor de instructies om je Javascript te activeren</a>.
</noscript>
</div>
<div>
<img style="width:50%;margin-left:25%"
src="/img/top-logo.png"
@@ -62,11 +68,12 @@
<!--Login with facebook button-->
<?php
if(!isset($acces_token)) {
echo '<div class="login_containerlogin"><a class="fbButton" href="' . $loginurl . '">login with 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>';
}
?>
<script>
// Get the modal
var modal = document.getElementById('myModal');
var registerModal = document.getElementById('registerModal');

View File

@@ -1,5 +1,8 @@
<head>
<meta charset="utf-8">
<meta charset="UTF-8">
<meta name="description" content="MyHyvesbook+ is het sociaal media voor alle coole mensen.">
<meta name="keywords" content="MyHyvesbookPlus,Myhyvesbook+,sociaal,media">
<meta name="author" content="MyHyvesbookplus corporation">
<title>MyHyvesbook+</title>
<link rel="stylesheet"
type="text/css"
@@ -7,7 +10,11 @@
<link rel="stylesheet"
type="text/css"
href="styles/index.css">
<link rel="stylesheet"
type="text/css"
href="styles/font-awesome.css">
<script src="js/jquery.js"></script>
<script src="js/registerAndLogin.js"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>

View File

@@ -12,6 +12,8 @@
</h4>
<ul id="menu-groups-list" class="nav-list">
</ul>
</section>
<section>
<ul class="nav-list">
<li>
<a href="#">

View File

@@ -1,4 +1,8 @@
<div class="content">
<div class='platform alertbox' id="alertbox">
<span class="alerttext" id="alerttext"></span>
</div>
<div class="user-box">
<img class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br />
<div class="platform">