From 6d5de98c1daad7b5adc41238ae4c3a282f6432ed Mon Sep 17 00:00:00 2001 From: Marijn Jansen Date: Fri, 3 Feb 2017 11:31:18 +0100 Subject: [PATCH] comments --- website/queries/checkInput.php | 43 +++++++++++++++++++++++++++++--- website/queries/createGroup.php | 3 +++ website/queries/emailconfirm.php | 9 ++++++- website/queries/login.php | 5 +++- website/queries/post.php | 6 +++++ 5 files changed, 61 insertions(+), 5 deletions(-) diff --git a/website/queries/checkInput.php b/website/queries/checkInput.php index 247050b..5680de8 100644 --- a/website/queries/checkInput.php +++ b/website/queries/checkInput.php @@ -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){ if (empty($variable)) { throw new lettersAndSpacesException("Verplicht!"); @@ -52,7 +56,11 @@ function checkName($variable){ } } -/* Checks for bday */ +/** + * Checks for bday + * @param $variable + * @throws bdayException + */ function validateBday($variable){ if (empty($variable)) { throw new bdayException("Verplicht!"); @@ -219,6 +227,9 @@ function test_input($data) { return $data; } +/** + * Class lettersAndSpacesException + */ class lettersAndSpacesException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -227,7 +238,9 @@ class lettersAndSpacesException extends Exception } } - +/** + * Class bdayException + */ class bdayException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -236,6 +249,9 @@ class bdayException extends Exception } } +/** + * Class usernameException + */ class usernameException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -244,6 +260,9 @@ class usernameException extends Exception } } +/** + * Class passwordException + */ class passwordException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -252,6 +271,9 @@ class passwordException extends Exception } } +/** + * Class confirmPasswordException + */ class confirmPasswordException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -260,6 +282,9 @@ class confirmPasswordException extends Exception } } +/** + * Class fbConfirmPasswordException + */ class fbConfirmPasswordException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -268,6 +293,9 @@ class fbConfirmPasswordException extends Exception } } +/** + * Class emailException + */ class emailException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -276,6 +304,9 @@ class emailException extends Exception } } +/** + * Class confirmEmailException + */ class confirmEmailException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -284,6 +315,9 @@ class confirmEmailException extends Exception } } +/** + * Class captchaException + */ class captchaException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) @@ -292,6 +326,9 @@ class captchaException extends Exception } } +/** + * Class registerException + */ class registerException extends Exception { public function __construct($message = "", $code = 0, Exception $previous = null) diff --git a/website/queries/createGroup.php b/website/queries/createGroup.php index 1b093fb..84843d2 100644 --- a/website/queries/createGroup.php +++ b/website/queries/createGroup.php @@ -8,6 +8,7 @@ require_once "../queries/alerts.php"; */ function createGroup() { + // Creates the group. $createGroup = prepareQuery(" INSERT INTO `group_page` (`name`, `description`) @@ -17,6 +18,7 @@ function createGroup() $createGroup->bindValue(':description', test_input($_POST["bio"])); $createGroup->execute(); + // Gets the groupID just created. $getGroupID = prepareQuery(" SELECT `groupID` @@ -28,6 +30,7 @@ function createGroup() $getGroupID->execute(); $groupID = $getGroupID->fetch()["groupID"]; + // Adds the user as an admin. $makeUserAdmin = prepareQuery(" INSERT INTO `group_member` (userID, groupID, role) diff --git a/website/queries/emailconfirm.php b/website/queries/emailconfirm.php index 0e6aab1..ff9c672 100644 --- a/website/queries/emailconfirm.php +++ b/website/queries/emailconfirm.php @@ -1,5 +1,8 @@