@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | ini_set("display_errors", 1); |
6 | 6 | set_time_limit(0); |
7 | 7 | |
8 | - if(!isset($_SESSION)){ |
|
8 | + if (!isset($_SESSION)) { |
|
9 | 9 | session_start(); |
10 | 10 | } |
11 | 11 | |
@@ -27,18 +27,18 @@ discard block |
||
27 | 27 | |
28 | 28 | $context = '/'; |
29 | 29 | |
30 | - $requestParams = substr($requestURI,strlen($context)); |
|
30 | + $requestParams = substr($requestURI, strlen($context)); |
|
31 | 31 | //var_dump($requestParams); |
32 | 32 | switch ($requestMethod) { |
33 | 33 | case 'GET': |
34 | - if(strlen($requestParams) > 1){ |
|
34 | + if (strlen($requestParams) > 1) { |
|
35 | 35 | $locale = Utils::getLocaleFromRequest($requestParams); |
36 | 36 | $managerProfileId = Utils::getParameterFromRequest($requestParams, 5); |
37 | 37 | |
38 | 38 | $result = TeamCultureController::getTeamCultureByManagerProfileId($managerProfileId, $locale); |
39 | 39 | $json = json_encode($result, JSON_PRETTY_PRINT); |
40 | 40 | echo($json); |
41 | - }else{ |
|
41 | + }else { |
|
42 | 42 | $result = array(); |
43 | 43 | $json = json_encode($result, JSON_PRETTY_PRINT); |
44 | 44 | echo($json); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $result = TeamCultureController::getTeamCultureByManagerProfileId($managerProfileId, $locale); |
39 | 39 | $json = json_encode($result, JSON_PRETTY_PRINT); |
40 | 40 | echo($json); |
41 | - }else{ |
|
41 | + } else{ |
|
42 | 42 | $result = array(); |
43 | 43 | $json = json_encode($result, JSON_PRETTY_PRINT); |
44 | 44 | echo($json); |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | ini_set("display_errors", 1); |
9 | 9 | set_time_limit(0); |
10 | 10 | |
11 | -if(!isset($_SESSION)){ |
|
11 | +if (!isset($_SESSION)) { |
|
12 | 12 | session_start(); |
13 | 13 | } |
14 | 14 | |
15 | 15 | /*set api path*/ |
16 | -set_include_path(get_include_path(). PATH_SEPARATOR); |
|
16 | +set_include_path(get_include_path() . PATH_SEPARATOR); |
|
17 | 17 | |
18 | 18 | require_once '../controller/JobSeekerController.php'; |
19 | 19 | require_once '../model/JobSeekerProfile.php'; |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | |
28 | 28 | $context = '/'; |
29 | 29 | |
30 | -$requestParams = substr($requestURI,strlen($context)); |
|
30 | +$requestParams = substr($requestURI, strlen($context)); |
|
31 | 31 | |
32 | 32 | switch ($requestMethod) { |
33 | 33 | case 'GET': |
34 | - if(strlen($requestParams) > 1){ |
|
34 | + if (strlen($requestParams) > 1) { |
|
35 | 35 | $result = JobSeekerController::getJobSeekers(); |
36 | 36 | $json = json_encode($result, JSON_PRETTY_PRINT); |
37 | 37 | echo($json); |
38 | - }else{ |
|
38 | + }else { |
|
39 | 39 | $result = array(); |
40 | 40 | $json = json_encode($result, JSON_PRETTY_PRINT); |
41 | 41 | echo($json); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $result = JobSeekerController::getJobSeekers(); |
36 | 36 | $json = json_encode($result, JSON_PRETTY_PRINT); |
37 | 37 | echo($json); |
38 | - }else{ |
|
38 | + } else{ |
|
39 | 39 | $result = array(); |
40 | 40 | $json = json_encode($result, JSON_PRETTY_PRINT); |
41 | 41 | echo($json); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | ini_set("display_errors", 1); |
6 | 6 | set_time_limit(0); |
7 | 7 | |
8 | -if(!isset($_SESSION)){ |
|
8 | +if (!isset($_SESSION)) { |
|
9 | 9 | session_start(); |
10 | 10 | } |
11 | 11 | |
@@ -23,27 +23,27 @@ discard block |
||
23 | 23 | $context = '/'; |
24 | 24 | header("Access-Control-Allow-Origin: *"); |
25 | 25 | header("Content-Type: application/json; charset=utf-8"); |
26 | - $requestParams = substr($requestURI,strlen($context)); |
|
26 | + $requestParams = substr($requestURI, strlen($context)); |
|
27 | 27 | $user_id_param_index = 4; |
28 | 28 | //var_dump($requestParams); |
29 | 29 | //$headers = apache_request_headers(); |
30 | 30 | switch ($requestMethod) { |
31 | 31 | case 'GET': |
32 | 32 | |
33 | - if(isset($_SERVER["HTTP_AUTHORIZATION"])){ |
|
33 | + if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
34 | 34 | $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
35 | 35 | |
36 | 36 | $user_id = Utils::getParameterFromRequest($requestParams, $user_id_param_index); |
37 | 37 | |
38 | - if(strlen($requestParams) > 1){ |
|
38 | + if (strlen($requestParams) > 1) { |
|
39 | 39 | |
40 | - if(strlen($user_id) > 0){ |
|
40 | + if (strlen($user_id) > 0) { |
|
41 | 41 | |
42 | 42 | $user = new User(); |
43 | 43 | |
44 | 44 | $user->setUser_id($user_id); |
45 | 45 | |
46 | - if(JWTUtils::validateJWT($jwt, $user)){ |
|
46 | + if (JWTUtils::validateJWT($jwt, $user)) { |
|
47 | 47 | |
48 | 48 | $result = UserController::getUserById($user); |
49 | 49 | |
@@ -51,25 +51,25 @@ discard block |
||
51 | 51 | |
52 | 52 | echo($json); |
53 | 53 | |
54 | - }else{ |
|
54 | + }else { |
|
55 | 55 | header('HTTP/1.0 401 Unauthorized'); |
56 | - echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
|
56 | + echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
57 | 57 | exit; |
58 | 58 | } |
59 | 59 | |
60 | - }else{ |
|
60 | + }else { |
|
61 | 61 | header('HTTP/1.0 401 Unauthorized'); |
62 | - echo json_encode(array("failed"=>"No user id provided"),JSON_FORCE_OBJECT); |
|
62 | + echo json_encode(array("failed"=>"No user id provided"), JSON_FORCE_OBJECT); |
|
63 | 63 | exit; |
64 | 64 | } |
65 | - }else{ |
|
65 | + }else { |
|
66 | 66 | header('HTTP/1.0 401 Unauthorized'); |
67 | - echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
|
67 | + echo json_encode(array("failed"=>'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
|
68 | 68 | exit; |
69 | 69 | } |
70 | - }else{ |
|
70 | + }else { |
|
71 | 71 | header('HTTP/1.0 401 Unauthorized'); |
72 | - echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
|
72 | + echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
73 | 73 | exit; |
74 | 74 | } |
75 | 75 | |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | case 'POST': |
78 | 78 | $jsonBody = file_get_contents('php://input'); |
79 | 79 | //var_dump($jsonBody); |
80 | - if(strlen($jsonBody) > 1){ |
|
80 | + if (strlen($jsonBody) > 1) { |
|
81 | 81 | $credentials = json_decode($jsonBody, TRUE); //convert JSON into array |
82 | 82 | $email = $credentials['email']; |
83 | 83 | $password = $credentials['password']; |
84 | 84 | $userrole = $credentials['userrole']; |
85 | - if(strlen($email) > 1){ |
|
85 | + if (strlen($email) > 1) { |
|
86 | 86 | $newUser = new User(); |
87 | 87 | $newUser->setEmail($email); |
88 | 88 | $newUser->setPassword($password); |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | $userRegistered = UserController::registerUser($newUser); |
91 | 91 | $json = json_encode($userRegistered, JSON_PRETTY_PRINT); |
92 | 92 | echo($json); |
93 | - }else{ |
|
93 | + }else { |
|
94 | 94 | $result = array(); |
95 | 95 | $json = json_encode($result, JSON_PRETTY_PRINT); |
96 | 96 | echo($json); |
97 | 97 | } |
98 | - }else{ |
|
98 | + }else { |
|
99 | 99 | header('HTTP/1.0 401 Unauthorized'); |
100 | 100 | echo 'Authorization declined'; |
101 | 101 | exit; |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | case 'PUT': |
108 | 108 | $jsonBody = file_get_contents('php://input'); |
109 | 109 | |
110 | - if(isset($_SERVER["HTTP_AUTHORIZATION"])){ |
|
110 | + if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
111 | 111 | $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
112 | - if(strlen($requestParams) > 1){ |
|
113 | - if(strlen($jsonBody) > 0){ |
|
112 | + if (strlen($requestParams) > 1) { |
|
113 | + if (strlen($jsonBody) > 0) { |
|
114 | 114 | $userJson = json_decode($jsonBody, TRUE); |
115 | 115 | |
116 | 116 | $updatedUser = new User(); |
@@ -121,35 +121,35 @@ discard block |
||
121 | 121 | $updatedUser->setLastname($userJson['lastname']); |
122 | 122 | $updatedUser->setUser_role($userJson['user_role']); |
123 | 123 | |
124 | - if(JWTUtils::validateJWT($jwt, $updatedUser)){ |
|
124 | + if (JWTUtils::validateJWT($jwt, $updatedUser)) { |
|
125 | 125 | $result = UserController::updateUser($updatedUser); |
126 | 126 | $json = json_encode($result, JSON_PRETTY_PRINT); |
127 | 127 | echo($json); |
128 | - }else{ |
|
128 | + }else { |
|
129 | 129 | header('HTTP/1.0 401 Unauthorized'); |
130 | - echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
|
130 | + echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
131 | 131 | exit; |
132 | 132 | } |
133 | - }else{ |
|
133 | + }else { |
|
134 | 134 | header('HTTP/1.0 401 Unauthorized'); |
135 | - echo json_encode(array("failed"=>"No user id provided"),JSON_FORCE_OBJECT); |
|
135 | + echo json_encode(array("failed"=>"No user id provided"), JSON_FORCE_OBJECT); |
|
136 | 136 | exit; |
137 | 137 | } |
138 | - }else{ |
|
138 | + }else { |
|
139 | 139 | header('HTTP/1.0 401 Unauthorized'); |
140 | - echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
|
140 | + echo json_encode(array("failed"=>'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | - }else{ |
|
143 | + }else { |
|
144 | 144 | header('HTTP/1.0 401 Unauthorized'); |
145 | - echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
|
145 | + echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
146 | 146 | exit; |
147 | 147 | } |
148 | 148 | |
149 | 149 | //TODO: check authaurization |
150 | - if(strlen($jsonBody) > 1){ |
|
150 | + if (strlen($jsonBody) > 1) { |
|
151 | 151 | |
152 | - }else{ |
|
152 | + }else { |
|
153 | 153 | header('HTTP/1.0 401 Unauthorized'); |
154 | 154 | echo 'Authorization declined'; |
155 | 155 | exit; |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | |
52 | 52 | echo($json); |
53 | 53 | |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | header('HTTP/1.0 401 Unauthorized'); |
56 | 56 | echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
57 | 57 | exit; |
58 | 58 | } |
59 | 59 | |
60 | - }else{ |
|
60 | + } else{ |
|
61 | 61 | header('HTTP/1.0 401 Unauthorized'); |
62 | 62 | echo json_encode(array("failed"=>"No user id provided"),JSON_FORCE_OBJECT); |
63 | 63 | exit; |
64 | 64 | } |
65 | - }else{ |
|
65 | + } else{ |
|
66 | 66 | header('HTTP/1.0 401 Unauthorized'); |
67 | 67 | echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
68 | 68 | exit; |
69 | 69 | } |
70 | - }else{ |
|
70 | + } else{ |
|
71 | 71 | header('HTTP/1.0 401 Unauthorized'); |
72 | 72 | echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
73 | 73 | exit; |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | $userRegistered = UserController::registerUser($newUser); |
91 | 91 | $json = json_encode($userRegistered, JSON_PRETTY_PRINT); |
92 | 92 | echo($json); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | $result = array(); |
95 | 95 | $json = json_encode($result, JSON_PRETTY_PRINT); |
96 | 96 | echo($json); |
97 | 97 | } |
98 | - }else{ |
|
98 | + } else{ |
|
99 | 99 | header('HTTP/1.0 401 Unauthorized'); |
100 | 100 | echo 'Authorization declined'; |
101 | 101 | exit; |
@@ -125,22 +125,22 @@ discard block |
||
125 | 125 | $result = UserController::updateUser($updatedUser); |
126 | 126 | $json = json_encode($result, JSON_PRETTY_PRINT); |
127 | 127 | echo($json); |
128 | - }else{ |
|
128 | + } else{ |
|
129 | 129 | header('HTTP/1.0 401 Unauthorized'); |
130 | 130 | echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
131 | 131 | exit; |
132 | 132 | } |
133 | - }else{ |
|
133 | + } else{ |
|
134 | 134 | header('HTTP/1.0 401 Unauthorized'); |
135 | 135 | echo json_encode(array("failed"=>"No user id provided"),JSON_FORCE_OBJECT); |
136 | 136 | exit; |
137 | 137 | } |
138 | - }else{ |
|
138 | + } else{ |
|
139 | 139 | header('HTTP/1.0 401 Unauthorized'); |
140 | 140 | echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
141 | 141 | exit; |
142 | 142 | } |
143 | - }else{ |
|
143 | + } else{ |
|
144 | 144 | header('HTTP/1.0 401 Unauthorized'); |
145 | 145 | echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
146 | 146 | exit; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | //TODO: check authaurization |
150 | 150 | if(strlen($jsonBody) > 1){ |
151 | 151 | |
152 | - }else{ |
|
152 | + } else{ |
|
153 | 153 | header('HTTP/1.0 401 Unauthorized'); |
154 | 154 | echo 'Authorization declined'; |
155 | 155 | exit; |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | ini_set("display_errors", 1); |
6 | 6 | set_time_limit(0); |
7 | 7 | |
8 | - if(!isset($_SESSION)){ |
|
8 | + if (!isset($_SESSION)) { |
|
9 | 9 | session_start(); |
10 | 10 | } |
11 | 11 | |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | |
25 | 25 | $context = '/'; |
26 | 26 | |
27 | - $requestParams = substr($requestURI,strlen($context)); |
|
27 | + $requestParams = substr($requestURI, strlen($context)); |
|
28 | 28 | |
29 | 29 | switch ($requestMethod) { |
30 | 30 | case 'GET': |
31 | - if(strlen($requestParams) > 1){ |
|
31 | + if (strlen($requestParams) > 1) { |
|
32 | 32 | $locale = Utils::getLocaleFromRequest($requestParams); |
33 | 33 | $result = JobPosterController::getJobPostersByLocale($locale); |
34 | 34 | $json = json_encode($result, JSON_PRETTY_PRINT); |
35 | - header("Content-length:".strlen($json)); |
|
35 | + header("Content-length:" . strlen($json)); |
|
36 | 36 | echo($json); |
37 | - }else{ |
|
37 | + }else { |
|
38 | 38 | $result = array(); |
39 | 39 | $json = json_encode($result, JSON_PRETTY_PRINT); |
40 | 40 | echo($json); |
@@ -106,4 +106,4 @@ |
||
106 | 106 | break; |
107 | 107 | } |
108 | 108 | |
109 | - ?> |
|
110 | 109 | \ No newline at end of file |
110 | + ?> |
|
111 | 111 | \ No newline at end of file |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $json = json_encode($result, JSON_PRETTY_PRINT); |
36 | 36 | header("Content-length:".strlen($json)); |
37 | 37 | echo($json); |
38 | - }else{ |
|
38 | + } else{ |
|
39 | 39 | $result = array(); |
40 | 40 | $json = json_encode($result, JSON_PRETTY_PRINT); |
41 | 41 | echo($json); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | ini_set("display_errors", 1); |
6 | 6 | set_time_limit(0); |
7 | 7 | |
8 | - if(!isset($_SESSION)){ |
|
8 | + if (!isset($_SESSION)) { |
|
9 | 9 | session_start(); |
10 | 10 | } |
11 | 11 | |
@@ -24,21 +24,21 @@ discard block |
||
24 | 24 | |
25 | 25 | $context = '/'; |
26 | 26 | |
27 | - $requestParams = substr($requestURI,strlen($context)); |
|
27 | + $requestParams = substr($requestURI, strlen($context)); |
|
28 | 28 | //var_dump($requestParams); |
29 | 29 | switch ($requestMethod) { |
30 | 30 | case 'GET': |
31 | 31 | //Here Handle PUT Request |
32 | 32 | //$jsonBody = file_get_contents('php://input'); |
33 | - if(strlen($requestParams) > 1){ |
|
33 | + if (strlen($requestParams) > 1) { |
|
34 | 34 | //$jobSeekerJSON = json_decode($jsonBody, TRUE); |
35 | 35 | //var_dump($jobSeekerJSON); |
36 | - $jobPosterId = Utils::getParameterFromRequest($requestParams,4); |
|
36 | + $jobPosterId = Utils::getParameterFromRequest($requestParams, 4); |
|
37 | 37 | $jobApplicationsWithAnswers = JobApplicationController::getJobApplictionsWithAnswersByJobPoster($jobPosterId); |
38 | 38 | |
39 | 39 | $json = json_encode($jobApplicationsWithAnswers, JSON_PRETTY_PRINT); |
40 | 40 | echo($json); |
41 | - }else{ |
|
41 | + }else { |
|
42 | 42 | $result = array(); |
43 | 43 | $json = json_encode($result, JSON_PRETTY_PRINT); |
44 | 44 | echo($json); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | $json = json_encode($jobApplicationsWithAnswers, JSON_PRETTY_PRINT); |
40 | 40 | echo($json); |
41 | - }else{ |
|
41 | + } else{ |
|
42 | 42 | $result = array(); |
43 | 43 | $json = json_encode($result, JSON_PRETTY_PRINT); |
44 | 44 | echo($json); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | ini_set("display_errors", 1); |
5 | 5 | set_time_limit(0); |
6 | 6 | |
7 | - if(!isset($_SESSION)){ |
|
7 | + if (!isset($_SESSION)) { |
|
8 | 8 | session_start(); |
9 | 9 | } |
10 | 10 | |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | |
25 | 25 | $context = '/'; |
26 | 26 | |
27 | - $requestParams = substr($requestURI,strlen($context)); |
|
27 | + $requestParams = substr($requestURI, strlen($context)); |
|
28 | 28 | //var_dump($requestParams); |
29 | 29 | switch ($requestMethod) { |
30 | 30 | case 'GET': |
31 | - if(strlen($requestParams) > 1){ |
|
32 | - $jobPosterApplicationId = Utils::getParameterFromRequest($requestParams,4); |
|
31 | + if (strlen($requestParams) > 1) { |
|
32 | + $jobPosterApplicationId = Utils::getParameterFromRequest($requestParams, 4); |
|
33 | 33 | $result = SkillDeclarationController::getAllSkillDeclarationsForJobApplication($jobPosterApplicationId); |
34 | 34 | $json = json_encode($result, JSON_PRETTY_PRINT); |
35 | 35 | echo($json); |
36 | - }else{ |
|
36 | + }else { |
|
37 | 37 | $result = array(); |
38 | 38 | $json = json_encode($result, JSON_PRETTY_PRINT); |
39 | 39 | echo($json); |
@@ -70,23 +70,23 @@ discard block |
||
70 | 70 | case 'DELETE': |
71 | 71 | //TODO: authenticate user |
72 | 72 | |
73 | - if(strlen($requestParams) > 1){ |
|
74 | - $jobPosterApplicationId = Utils::getParameterFromRequest($requestParams,4); |
|
75 | - $criteriaId = Utils::getParameterFromRequest($requestParams,6); |
|
73 | + if (strlen($requestParams) > 1) { |
|
74 | + $jobPosterApplicationId = Utils::getParameterFromRequest($requestParams, 4); |
|
75 | + $criteriaId = Utils::getParameterFromRequest($requestParams, 6); |
|
76 | 76 | |
77 | 77 | if (JobApplicationController::jobApplicationIsDraft($jobPosterApplicationId)) { |
78 | 78 | $result = SkillDeclarationController::removeSkillDeclarationFromJobApplication($jobPosterApplicationId, $criteriaId); |
79 | 79 | |
80 | 80 | $json = json_encode($result, JSON_PRETTY_PRINT); |
81 | 81 | echo($json); |
82 | - } else { |
|
82 | + }else { |
|
83 | 83 | header('HTTP/1.0 403 Forbidden'); |
84 | - echo json_encode(array("failed"=>"Only Draft applications can be modified."),JSON_FORCE_OBJECT); |
|
84 | + echo json_encode(array("failed"=>"Only Draft applications can be modified."), JSON_FORCE_OBJECT); |
|
85 | 85 | exit; |
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | - }else{ |
|
89 | + }else { |
|
90 | 90 | $result = array(); |
91 | 91 | $json = json_encode($result, JSON_PRETTY_PRINT); |
92 | 92 | echo($json); |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | case 'PUT': |
96 | 96 | //TODO: authenticate user |
97 | 97 | |
98 | - if(strlen($requestParams) > 1){ |
|
99 | - $jobPosterApplicationId = Utils::getParameterFromRequest($requestParams,4); |
|
100 | - $criteriaId = Utils::getParameterFromRequest($requestParams,6); |
|
98 | + if (strlen($requestParams) > 1) { |
|
99 | + $jobPosterApplicationId = Utils::getParameterFromRequest($requestParams, 4); |
|
100 | + $criteriaId = Utils::getParameterFromRequest($requestParams, 6); |
|
101 | 101 | |
102 | 102 | //TODO: ensure application exists |
103 | 103 | //TODO: ensure criteriaId is valid for application |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | |
118 | 118 | $json = json_encode($result, JSON_PRETTY_PRINT); |
119 | 119 | echo($json); |
120 | - } else { |
|
120 | + }else { |
|
121 | 121 | header('HTTP/1.0 403 Forbidden'); |
122 | - echo json_encode(array("failed"=>"Only Draft applications can be modified."),JSON_FORCE_OBJECT); |
|
122 | + echo json_encode(array("failed"=>"Only Draft applications can be modified."), JSON_FORCE_OBJECT); |
|
123 | 123 | exit; |
124 | 124 | } |
125 | 125 | |
126 | - }else{ |
|
126 | + }else { |
|
127 | 127 | $result = array(); |
128 | 128 | $json = json_encode($result, JSON_PRETTY_PRINT); |
129 | 129 | echo($json); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $result = SkillDeclarationController::getAllSkillDeclarationsForJobApplication($jobPosterApplicationId); |
34 | 34 | $json = json_encode($result, JSON_PRETTY_PRINT); |
35 | 35 | echo($json); |
36 | - }else{ |
|
36 | + } else{ |
|
37 | 37 | $result = array(); |
38 | 38 | $json = json_encode($result, JSON_PRETTY_PRINT); |
39 | 39 | echo($json); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | - }else{ |
|
89 | + } else{ |
|
90 | 90 | $result = array(); |
91 | 91 | $json = json_encode($result, JSON_PRETTY_PRINT); |
92 | 92 | echo($json); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | exit; |
124 | 124 | } |
125 | 125 | |
126 | - }else{ |
|
126 | + } else{ |
|
127 | 127 | $result = array(); |
128 | 128 | $json = json_encode($result, JSON_PRETTY_PRINT); |
129 | 129 | echo($json); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $result = ContentController::getContentByLocale($locale); |
40 | 40 | $json = json_encode($result, JSON_PRETTY_PRINT); |
41 | 41 | echo($json); |
42 | - } else { |
|
42 | + }else { |
|
43 | 43 | $result = array(); |
44 | 44 | $json = json_encode($result, JSON_PRETTY_PRINT); |
45 | 45 | echo($json); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | ini_set("display_errors", 1); |
6 | 6 | set_time_limit(0); |
7 | 7 | |
8 | - if(!isset($_SESSION)){ |
|
8 | + if (!isset($_SESSION)) { |
|
9 | 9 | session_start(); |
10 | 10 | } |
11 | 11 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | |
27 | 27 | $context = '/'; |
28 | 28 | |
29 | - $requestParams = substr($requestURI,strlen($context)); |
|
29 | + $requestParams = substr($requestURI, strlen($context)); |
|
30 | 30 | //var_dump($requestParams); |
31 | 31 | switch ($requestMethod) { |
32 | 32 | case 'GET': |
33 | - if(strlen($requestParams) > 1){ |
|
33 | + if (strlen($requestParams) > 1) { |
|
34 | 34 | $managerProfileId = Utils::getParameterFromRequest($requestParams, 4); |
35 | 35 | |
36 | 36 | $result = TeamCultureController::getTeamCultureNonLocalizedByManagerProfileId($managerProfileId); |
37 | 37 | $json = json_encode($result, JSON_PRETTY_PRINT); |
38 | 38 | echo($json); |
39 | - }else{ |
|
39 | + }else { |
|
40 | 40 | $result = array(); |
41 | 41 | $json = json_encode($result, JSON_PRETTY_PRINT); |
42 | 42 | echo($json); |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | //Here Handle DELETE Request |
50 | 50 | break; |
51 | 51 | case 'PUT': |
52 | - if(isset($_SERVER["HTTP_AUTHORIZATION"])){ |
|
52 | + if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
53 | 53 | $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
54 | 54 | |
55 | - if(strlen($requestParams) > 1){ |
|
55 | + if (strlen($requestParams) > 1) { |
|
56 | 56 | |
57 | - $managerProfileId = Utils::getParameterFromRequest($requestParams,4); |
|
57 | + $managerProfileId = Utils::getParameterFromRequest($requestParams, 4); |
|
58 | 58 | |
59 | - if(strlen($managerProfileId) > 0){ |
|
59 | + if (strlen($managerProfileId) > 0) { |
|
60 | 60 | |
61 | 61 | $user = UserController::getUserByManagerProfileId($managerProfileId); |
62 | 62 | |
63 | - if(JWTUtils::validateJWT($jwt, $user)){ |
|
63 | + if (JWTUtils::validateJWT($jwt, $user)) { |
|
64 | 64 | $json = json_decode(file_get_contents('php://input'), TRUE); |
65 | 65 | |
66 | 66 | $teamCulture = new TeamCultureNonLocalized(); |
@@ -79,25 +79,25 @@ discard block |
||
79 | 79 | $resultJson = json_encode($result, JSON_PRETTY_PRINT); |
80 | 80 | echo($resultJson); |
81 | 81 | |
82 | - }else{ |
|
82 | + }else { |
|
83 | 83 | header('HTTP/1.0 401 Unauthorized'); |
84 | - echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
|
84 | + echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
85 | 85 | exit; |
86 | 86 | } |
87 | 87 | |
88 | - }else{ |
|
88 | + }else { |
|
89 | 89 | header('HTTP/1.0 401 Unauthorized'); |
90 | - echo json_encode(array("failed"=>"No manager profile id provided"),JSON_FORCE_OBJECT); |
|
90 | + echo json_encode(array("failed"=>"No manager profile id provided"), JSON_FORCE_OBJECT); |
|
91 | 91 | exit; |
92 | 92 | } |
93 | - }else{ |
|
93 | + }else { |
|
94 | 94 | header('HTTP/1.0 401 Unauthorized'); |
95 | - echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
|
95 | + echo json_encode(array("failed"=>'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
|
96 | 96 | exit; |
97 | 97 | } |
98 | - }else{ |
|
98 | + }else { |
|
99 | 99 | header('HTTP/1.0 401 Unauthorized'); |
100 | - echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
|
100 | + echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
101 | 101 | exit; |
102 | 102 | } |
103 | 103 | break; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $result = TeamCultureController::getTeamCultureNonLocalizedByManagerProfileId($managerProfileId); |
37 | 37 | $json = json_encode($result, JSON_PRETTY_PRINT); |
38 | 38 | echo($json); |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | $result = array(); |
41 | 41 | $json = json_encode($result, JSON_PRETTY_PRINT); |
42 | 42 | echo($json); |
@@ -79,23 +79,23 @@ discard block |
||
79 | 79 | $resultJson = json_encode($result, JSON_PRETTY_PRINT); |
80 | 80 | echo($resultJson); |
81 | 81 | |
82 | - }else{ |
|
82 | + } else{ |
|
83 | 83 | header('HTTP/1.0 401 Unauthorized'); |
84 | 84 | echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
85 | 85 | exit; |
86 | 86 | } |
87 | 87 | |
88 | - }else{ |
|
88 | + } else{ |
|
89 | 89 | header('HTTP/1.0 401 Unauthorized'); |
90 | 90 | echo json_encode(array("failed"=>"No manager profile id provided"),JSON_FORCE_OBJECT); |
91 | 91 | exit; |
92 | 92 | } |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | header('HTTP/1.0 401 Unauthorized'); |
95 | 95 | echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
96 | 96 | exit; |
97 | 97 | } |
98 | - }else{ |
|
98 | + } else{ |
|
99 | 99 | header('HTTP/1.0 401 Unauthorized'); |
100 | 100 | echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
101 | 101 | exit; |
@@ -5,19 +5,19 @@ discard block |
||
5 | 5 | ini_set("display_errors", 1); |
6 | 6 | set_time_limit(0); |
7 | 7 | |
8 | - if(!isset($_SESSION)){ |
|
8 | + if (!isset($_SESSION)) { |
|
9 | 9 | session_start(); |
10 | 10 | } |
11 | 11 | |
12 | 12 | /*set api path*/ |
13 | - if(!defined('ROOT_PATH')){ |
|
13 | + if (!defined('ROOT_PATH')) { |
|
14 | 14 | define('ROOT_PATH', dirname(__DIR__) . '/'); |
15 | 15 | } |
16 | 16 | |
17 | - require_once ROOT_PATH.'controller/ManagerProfileController.php'; |
|
18 | - require_once ROOT_PATH.'model/ManagerProfile.php'; |
|
19 | - require_once ROOT_PATH.'model/ManagerProfileDetailsNonLocalized.php'; |
|
20 | - require_once ROOT_PATH.'utils/Utils.php'; |
|
17 | + require_once ROOT_PATH . 'controller/ManagerProfileController.php'; |
|
18 | + require_once ROOT_PATH . 'model/ManagerProfile.php'; |
|
19 | + require_once ROOT_PATH . 'model/ManagerProfileDetailsNonLocalized.php'; |
|
20 | + require_once ROOT_PATH . 'utils/Utils.php'; |
|
21 | 21 | |
22 | 22 | $requestMethod = filter_input(INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_ENCODED); |
23 | 23 | $requestURI = urldecode(filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_ENCODED)); |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | |
29 | 29 | $context = '/'; |
30 | 30 | |
31 | - $requestParams = substr($requestURI,strlen($context)); |
|
31 | + $requestParams = substr($requestURI, strlen($context)); |
|
32 | 32 | $user_id_param_index = 4; |
33 | 33 | switch ($requestMethod) { |
34 | 34 | case 'GET': |
35 | - if(strlen($requestParams) > 1){ |
|
35 | + if (strlen($requestParams) > 1) { |
|
36 | 36 | $user_id = Utils::getParameterFromRequest($requestParams, $user_id_param_index); |
37 | 37 | $managerProfile = new ManagerProfile(); |
38 | 38 | $managerProfile->setUser_id($user_id); |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | if ($result === false) { |
41 | 41 | header('HTTP/1.0 404 Not Found'); |
42 | 42 | echo json_encode(array("failed" => "Manager Profile does not exist for specified user"), JSON_FORCE_OBJECT); |
43 | - } else { |
|
43 | + }else { |
|
44 | 44 | $json = json_encode($result, JSON_PRETTY_PRINT); |
45 | 45 | echo($json); |
46 | 46 | } |
47 | - }else{ |
|
47 | + }else { |
|
48 | 48 | $result = array(); |
49 | 49 | $json = json_encode($result, JSON_PRETTY_PRINT); |
50 | 50 | echo($json); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $json = json_encode($result, JSON_PRETTY_PRINT); |
45 | 45 | echo($json); |
46 | 46 | } |
47 | - }else{ |
|
47 | + } else{ |
|
48 | 48 | $result = array(); |
49 | 49 | $json = json_encode($result, JSON_PRETTY_PRINT); |
50 | 50 | echo($json); |
@@ -127,4 +127,4 @@ |
||
127 | 127 | break; |
128 | 128 | } |
129 | 129 | |
130 | - ?> |
|
130 | + ?> |