diff --git a/core/Controllers/UserController.php b/core/Controllers/UserController.php index e4146dd1cd902ca873df68e14286be5428ba27fd..ab68ed0c2d4765d333749f31965e6b97f4cc9b77 100755 --- a/core/Controllers/UserController.php +++ b/core/Controllers/UserController.php @@ -42,9 +42,9 @@ class UserController $data = $request->getParams(); - $check = Validator::stringType()::notEmpty()->validate($data['userId']) && preg_match("/^[\w.@-]*$/", $data['userId']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['firstname']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['lastname']); + $check = Validator::stringType()->notEmpty()->validate($data['userId']) && preg_match("/^[\w.@-]*$/", $data['userId']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['firstname']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['lastname']); $check = $check && (empty($data['mail']) || filter_var($data['mail'], FILTER_VALIDATE_EMAIL)); $check = $check && (empty($data['phone']) || preg_match("/^(?:0|\+\d\d\s?)[1-9]([\.\-\s]?\d\d){4}$/", $data['phone'])); if (!$check) { @@ -59,7 +59,7 @@ class UserController UserModel::create(['user' => $data]); $newUser = UserModel::getByUserId(['userId' => $data['userId']]); - if (!Validator::intType()::notEmpty()->validate($newUser['id'])) { + if (!Validator::intType()->notEmpty()->validate($newUser['id'])) { return $response->withStatus(500)->withJson(['errors' => 'User Creation Error']); } @@ -78,9 +78,9 @@ class UserController $data = $request->getParams(); - $check = Validator::stringType()::notEmpty()->validate($data['user_id']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['firstname']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['lastname']); + $check = Validator::stringType()->notEmpty()->validate($data['user_id']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['firstname']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['lastname']); $check = $check && (empty($data['mail']) || filter_var($data['mail'], FILTER_VALIDATE_EMAIL)); $check = $check && (empty($data['phone']) || preg_match("/^(?:0|\+\d\d\s?)[1-9]([\.\-\s]?\d\d){4}$/", $data['phone'])); if (!$check) { @@ -180,8 +180,8 @@ class UserController $data = $request->getParams(); - $check = Validator::stringType()::notEmpty()->validate($data['firstname']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['lastname']); + $check = Validator::stringType()->notEmpty()->validate($data['firstname']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['lastname']); $check = $check && (empty($data['mail']) || filter_var($data['mail'], FILTER_VALIDATE_EMAIL)); $check = $check && (empty($data['phone']) || preg_match("/^(?:0|\+\d\d\s?)[1-9]([\.\-\s]?\d\d){4}$/", $data['phone'])); if (!$check) { @@ -296,7 +296,7 @@ class UserController $data = $request->getParams(); - $check = Validator::stringType()::notEmpty()->validate($data['status']); + $check = Validator::stringType()->notEmpty()->validate($data['status']); $check = $check && ($data['status'] == 'OK' || $data['status'] == 'ABS'); if (!$check) { return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); diff --git a/package-lock.json b/package-lock.json index 289363d59cbf11be22eb10853373cfd47adb0f4b..e3f1da41c5a6cef78df956a3283df868851ca3f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -168,7 +168,7 @@ "@types/jquery": { "version": "2.0.48", "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-2.0.48.tgz", - "integrity": "sha1-PpDYzeLSkBXlWDAX94MMs5dbLu8=", + "integrity": "sha512-nNLzUrVjaRV/Ds1eHZLYTd7IZxs38cwwLSaqMJj8OTXY8xNUbxSK69bi9cMLvQ7dm/IBeQ1wHwQ0S1uYa0rd2w==", "dev": true }, "@types/node": { diff --git a/src/app/basket/controllers/BasketController.php b/src/app/basket/controllers/BasketController.php index baa597ccac6524d7ba2ecb2f6b264e665707988f..e431b2a46862d7dbe7bc44d43d63abe2674631d4 100644 --- a/src/app/basket/controllers/BasketController.php +++ b/src/app/basket/controllers/BasketController.php @@ -56,10 +56,10 @@ class BasketController $data = $request->getParams(); - $check = Validator::stringType()::notEmpty()->validate($data['id']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['name']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['description']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['clause']); + $check = Validator::stringType()->notEmpty()->validate($data['id']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['name']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['description']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['clause']); if (!$check) { return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); } @@ -91,9 +91,9 @@ class BasketController $data = $request->getParams(); - $check = Validator::stringType()::notEmpty()->validate($data['name']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['description']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['clause']); + $check = Validator::stringType()->notEmpty()->validate($data['name']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['description']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['clause']); if (!$check) { return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); } @@ -196,9 +196,9 @@ class BasketController $data = $request->getParams(); - $check = Validator::stringType()::notEmpty()->validate($data['group_id']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['result_page']); - $check = $check && Validator::arrayType()::notEmpty()->validate($data['groupActions']); + $check = Validator::stringType()->notEmpty()->validate($data['group_id']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['result_page']); + $check = $check && Validator::arrayType()->notEmpty()->validate($data['groupActions']); if (!$check) { return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); } @@ -263,8 +263,8 @@ class BasketController $data = $request->getParams(); - $check = Validator::stringType()::notEmpty()->validate($data['result_page']); - $check = $check && Validator::arrayType()::notEmpty()->validate($data['groupActions']); + $check = Validator::stringType()->notEmpty()->validate($data['result_page']); + $check = $check && Validator::arrayType()->notEmpty()->validate($data['groupActions']); if (!$check) { return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); } diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index 04875335c8ad156caa6f35ac5e8d0ad94cd21531..4f044ab68d43e95708da6f0278837f76f8aa3155 100644 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -27,11 +27,11 @@ class ContactController $data = $request->getParams(); $check = Validator::notEmpty()->validate($data['firstname']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['lastname']); - $check = $check && Validator::intVal()::notEmpty()->validate($data['contactType']); - $check = $check && Validator::intVal()::notEmpty()->validate($data['contactPurposeId']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['isCorporatePerson']); - $check = $check && Validator::stringType()::notEmpty()->validate($data['email']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['lastname']); + $check = $check && Validator::intVal()->notEmpty()->validate($data['contactType']); + $check = $check && Validator::intVal()->notEmpty()->validate($data['contactPurposeId']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['isCorporatePerson']); + $check = $check && Validator::stringType()->notEmpty()->validate($data['email']); if (!$check) { return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); }