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

@@ -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`