Beispiel #1
0
 if (isset($_POST['userAdmin'])) {
     $admin = true;
 }
 $blocked = false;
 if (isset($_POST['userBlocked'])) {
     $blocked = true;
 }
 /**
  * Get current image name
  */
 $currentUserImagePath = $userdata->getImagePath();
 /**
  * Validate data
  */
 $validator = new ValidationHelpers();
 if ($validator->validateEmail($email) == false) {
     throw new EmptyDataException("wrong_email_pattern");
 }
 if ($validator->validateName($firstname) == false || $validator->validateName($lastname) == false) {
     throw new EmptyDataException("wrong_name_pattern");
 }
 if ($validator->validatePassword($password) == false) {
     throw new EmptyDataException("wrong_password_pattern");
 }
 if ($validator->validateUsername($username) == false) {
     throw new EmptyDataException("wrong_username_pattern");
 }
 if ($userdata->getUsername() != $username) {
     /**
      * Look if user with entered username already exists
      */
Beispiel #2
0
  * Connecting doctrine autoloader
  */
 require_once 'Doctrine/Common/ClassLoader.php';
 $classLoader = new ClassLoader("src");
 $classLoader->register();
 try {
     /**
      * Throw error if email and password fields are empty
      */
     if (empty($firstname) || empty($lastname) || empty($email) || empty($username) || empty($password) || empty($rpassword)) {
         throw new EmptyDataException();
     }
     $validator = new ValidationHelpers();
     $firstnameValidated = $validator->validateName($firstname);
     $lastnameValidated = $validator->validateName($lastname);
     $emailValidated = $validator->validateEmail($email);
     $usernameValidated = $validator->validateUsername($username);
     $passwordValidated = $validator->validatePassword($password);
     $rpasswordValidated = $validator->validatePassword($rpassword);
     if (!$firstnameValidated) {
         throw new WrongNamePatternException();
     }
     // validate firstname
     if (!$lastnameValidated) {
         throw new WrongNamePatternException();
     }
     // validate lastname
     if (!$emailValidated) {
         throw new WrongEmailPatternException();
     }
     // validate e-mail
 require_once 'Doctrine/Common/ClassLoader.php';
 $classLoader = new ClassLoader("src");
 $classLoader->register();
 try {
     /**
      * Throw error if email and password fields are empty
      */
     if (empty($email) || empty($password)) {
         throw new EmptyDataException();
     }
     $validator = new ValidationHelpers();
     // helper validation class
     /**
      * Email validation
      */
     $emailValidated = $validator->validateEmail($_POST['emailField']);
     if (!$emailValidated) {
         throw new WrongEmailPatternException();
     }
     /**
      * Password validation
      */
     $passwordValidated = $validator->validatePassword($_POST['passField']);
     if (!$passwordValidated) {
         throw new WrongPasswordPatternException();
     }
     /**
      * Throw error if email and password contain wrong characters
      */
     if (empty($email) && empty($password)) {
         throw new WrongDataException();
Beispiel #4
0
 $_SESSION['savedData']['admin'] = false;
 if (isset($_POST['userAdmin'])) {
     $_SESSION['savedData']['admin'] = true;
 }
 $_SESSION['savedData']['blocked'] = false;
 if (isset($_POST['userBlocked'])) {
     $_SESSION['savedData']['blocked'] = true;
 }
 if (empty($_SESSION['savedData']['username']) || empty($_SESSION['savedData']['password']) || empty($_SESSION['savedData']['email']) || empty($_SESSION['savedData']['firstname']) || empty($_SESSION['savedData']['lastname'])) {
     throw new EmptyDataException("missing");
 }
 /**
  * Validate data
  */
 $validator = new ValidationHelpers();
 if ($validator->validateEmail($_SESSION['savedData']['email']) == false) {
     throw new EmptyDataException("wrong_email_pattern");
 }
 if ($validator->validateName($_SESSION['savedData']['firstname']) == false || $validator->validateName($_SESSION['savedData']['lastname']) == false) {
     throw new EmptyDataException("wrong_name_pattern");
 }
 if ($validator->validatePassword($_SESSION['savedData']['password']) == false) {
     throw new EmptyDataException("wrong_password_pattern");
 }
 if ($validator->validateUsername($_SESSION['savedData']['username']) == false) {
     throw new EmptyDataException("wrong_username_pattern");
 }
 /**
  * Look if user with entered username already exists
  */
 if (!empty($userBiz->checkUserByUsername($_SESSION['savedData']['username']))) {