@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $json = json_encode($result, JSON_PRETTY_PRINT); |
42 | 42 | echo($json); |
43 | 43 | } |
44 | - break; |
|
44 | + break; |
|
45 | 45 | case 'POST': |
46 | 46 | //must contain access token to get logged in content |
47 | 47 | header("Accept: application/json"); |
@@ -71,4 +71,4 @@ discard block |
||
71 | 71 | echo(""); |
72 | 72 | break; |
73 | 73 | } |
74 | - ?> |
|
75 | 74 | \ No newline at end of file |
75 | + ?> |
|
76 | 76 | \ No newline at end of file |
@@ -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,19 +24,19 @@ discard block |
||
24 | 24 | //$headers = apache_request_headers(); |
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 | //echo($locale); |
34 | 34 | $result = ContentController::getContentByLocale($locale); |
35 | 35 | //echo(implode(" ",$result->getContent())); |
36 | 36 | $json = json_encode($result, JSON_PRETTY_PRINT); |
37 | - header("Content-length:".strlen($json)); |
|
37 | + header("Content-length:" . strlen($json)); |
|
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); |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | case 'POST': |
46 | 46 | //must contain access token to get logged in content |
47 | 47 | header("Accept: application/json"); |
48 | - if(strlen($requestParams) > 1){ |
|
48 | + if (strlen($requestParams) > 1) { |
|
49 | 49 | $locale = Utils::getLocaleFromRequest($requestParams); |
50 | 50 | $result = ContentController::getContentByLocale($locale); |
51 | 51 | $json = json_encode($result, JSON_PRETTY_PRINT); |
52 | - header("Content-length:".strlen($json)); |
|
52 | + header("Content-length:" . strlen($json)); |
|
53 | 53 | echo($json); |
54 | - }else{ |
|
54 | + }else { |
|
55 | 55 | $result = array(); |
56 | 56 | $json = json_encode($result, JSON_PRETTY_PRINT); |
57 | 57 | echo($json); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $json = json_encode($result, JSON_PRETTY_PRINT); |
37 | 37 | header("Content-length:".strlen($json)); |
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); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $json = json_encode($result, JSON_PRETTY_PRINT); |
52 | 52 | header("Content-length:".strlen($json)); |
53 | 53 | echo($json); |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | $result = array(); |
56 | 56 | $json = json_encode($result, JSON_PRETTY_PRINT); |
57 | 57 | 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 | |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | $context = '/'; |
30 | 30 | |
31 | - $requestParams = substr($requestURI,strlen($context)); |
|
31 | + $requestParams = substr($requestURI, strlen($context)); |
|
32 | 32 | //var_dump($requestParams); |
33 | 33 | switch ($requestMethod) { |
34 | 34 | case 'GET': |
35 | - if(strlen($requestParams) > 1){ |
|
35 | + if (strlen($requestParams) > 1) { |
|
36 | 36 | $managerProfileId = Utils::getParameterFromRequest($requestParams, 4); |
37 | 37 | |
38 | 38 | $result = WorkEnvironmentController::getWorkEnivronmentByManagerProfile($managerProfileId); |
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); |
@@ -51,18 +51,18 @@ discard block |
||
51 | 51 | //Here Handle DELETE Request |
52 | 52 | break; |
53 | 53 | case 'PUT': |
54 | - if(isset($_SERVER["HTTP_AUTHORIZATION"])){ |
|
54 | + if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
55 | 55 | $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
56 | 56 | |
57 | - if(strlen($requestParams) > 1){ |
|
57 | + if (strlen($requestParams) > 1) { |
|
58 | 58 | |
59 | - $managerProfileId = Utils::getParameterFromRequest($requestParams,4); |
|
59 | + $managerProfileId = Utils::getParameterFromRequest($requestParams, 4); |
|
60 | 60 | |
61 | - if(strlen($managerProfileId) > 0){ |
|
61 | + if (strlen($managerProfileId) > 0) { |
|
62 | 62 | |
63 | 63 | $user = UserController::getUserByManagerProfileId($managerProfileId); |
64 | 64 | |
65 | - if(JWTUtils::validateJWT($jwt, $user)){ |
|
65 | + if (JWTUtils::validateJWT($jwt, $user)) { |
|
66 | 66 | $json = json_decode(file_get_contents('php://input'), TRUE); |
67 | 67 | |
68 | 68 | $basicWorkEnvironment = new BasicWorkEnvironment(); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $basicWorkEnvironment->setFlexible_allowed($json['flexible_allowed']); |
73 | 73 | |
74 | 74 | $photo_captions = []; |
75 | - foreach($json['workplace_photo_captions'] as $captionJson) { |
|
75 | + foreach ($json['workplace_photo_captions'] as $captionJson) { |
|
76 | 76 | $caption = new WorkplacePhotoCaption(); |
77 | 77 | //$caption->setWork_environment_id($captionJson['work_environment_id']); |
78 | 78 | $caption->setPhoto_name($captionJson['photo_name']); |
@@ -86,25 +86,25 @@ discard block |
||
86 | 86 | $resultJson = json_encode($result, JSON_PRETTY_PRINT); |
87 | 87 | echo($resultJson); |
88 | 88 | |
89 | - }else{ |
|
89 | + }else { |
|
90 | 90 | header('HTTP/1.0 401 Unauthorized'); |
91 | - echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
|
91 | + echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
92 | 92 | exit; |
93 | 93 | } |
94 | 94 | |
95 | - }else{ |
|
95 | + }else { |
|
96 | 96 | header('HTTP/1.0 401 Unauthorized'); |
97 | - echo json_encode(array("failed"=>"No manager profile id provided"),JSON_FORCE_OBJECT); |
|
97 | + echo json_encode(array("failed"=>"No manager profile id provided"), JSON_FORCE_OBJECT); |
|
98 | 98 | exit; |
99 | 99 | } |
100 | - }else{ |
|
100 | + }else { |
|
101 | 101 | header('HTTP/1.0 401 Unauthorized'); |
102 | - echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
|
102 | + echo json_encode(array("failed"=>'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
|
103 | 103 | exit; |
104 | 104 | } |
105 | - }else{ |
|
105 | + }else { |
|
106 | 106 | header('HTTP/1.0 401 Unauthorized'); |
107 | - echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
|
107 | + echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
108 | 108 | exit; |
109 | 109 | } |
110 | 110 | break; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $result = WorkEnvironmentController::getWorkEnivronmentByManagerProfile($managerProfileId); |
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); |
@@ -86,23 +86,23 @@ discard block |
||
86 | 86 | $resultJson = json_encode($result, JSON_PRETTY_PRINT); |
87 | 87 | echo($resultJson); |
88 | 88 | |
89 | - }else{ |
|
89 | + } else{ |
|
90 | 90 | header('HTTP/1.0 401 Unauthorized'); |
91 | 91 | echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
92 | 92 | exit; |
93 | 93 | } |
94 | 94 | |
95 | - }else{ |
|
95 | + } else{ |
|
96 | 96 | header('HTTP/1.0 401 Unauthorized'); |
97 | 97 | echo json_encode(array("failed"=>"No manager profile id provided"),JSON_FORCE_OBJECT); |
98 | 98 | exit; |
99 | 99 | } |
100 | - }else{ |
|
100 | + } else{ |
|
101 | 101 | header('HTTP/1.0 401 Unauthorized'); |
102 | 102 | echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
103 | 103 | exit; |
104 | 104 | } |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | header('HTTP/1.0 401 Unauthorized'); |
107 | 107 | echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
108 | 108 | exit; |
@@ -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/ProfilePicController.php'; |
19 | 19 | require_once '../model/ProfilePic.php'; |
@@ -26,22 +26,22 @@ discard block |
||
26 | 26 | |
27 | 27 | $context = '/'; |
28 | 28 | |
29 | - $requestParams = substr($requestURI,strlen($context)); |
|
29 | + $requestParams = substr($requestURI, strlen($context)); |
|
30 | 30 | |
31 | 31 | switch ($requestMethod) { |
32 | 32 | case 'GET': |
33 | - if(strlen($requestParams) > 1){ |
|
34 | - $user_id = Utils::getParameterFromRequest($requestParams,4); |
|
33 | + if (strlen($requestParams) > 1) { |
|
34 | + $user_id = Utils::getParameterFromRequest($requestParams, 4); |
|
35 | 35 | $result = ProfilePicController::getProfilePic($user_id); |
36 | 36 | |
37 | 37 | if ($result == NULL) { |
38 | 38 | http_response_code(404); |
39 | 39 | echo('No profile image uploaded for this user.'); |
40 | - } else { |
|
40 | + }else { |
|
41 | 41 | header("Content-type: " . $result->getType()); |
42 | 42 | echo($result->getImage()); |
43 | 43 | } |
44 | - }else{ |
|
44 | + }else { |
|
45 | 45 | $result = array(); |
46 | 46 | $json = json_encode($result, JSON_PRETTY_PRINT); |
47 | 47 | echo($json); |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | case 'PUT': |
71 | 71 | //Must have correct authaurization to modify photo |
72 | 72 | |
73 | - if(strlen($requestParams) > 1){ |
|
74 | - $user_id = Utils::getParameterFromRequest($requestParams,4); |
|
73 | + if (strlen($requestParams) > 1) { |
|
74 | + $user_id = Utils::getParameterFromRequest($requestParams, 4); |
|
75 | 75 | |
76 | 76 | $profile_pic = new ProfilePic($user_id, |
77 | 77 | file_get_contents('php://input'), |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | //echo($profile_pic->getImage()); |
84 | 84 | echo($result); |
85 | 85 | //echo('{"profilepic":"upload failed"}'); |
86 | - }else{ |
|
86 | + }else { |
|
87 | 87 | $result = array(); |
88 | 88 | $json = json_encode($result, JSON_PRETTY_PRINT); |
89 | 89 | echo($json); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | header("Content-type: " . $result->getType()); |
42 | 42 | echo($result->getImage()); |
43 | 43 | } |
44 | - }else{ |
|
44 | + } else{ |
|
45 | 45 | $result = array(); |
46 | 46 | $json = json_encode($result, JSON_PRETTY_PRINT); |
47 | 47 | echo($json); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | //echo($profile_pic->getImage()); |
84 | 84 | echo($result); |
85 | 85 | //echo('{"profilepic":"upload failed"}'); |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | $result = array(); |
88 | 88 | $json = json_encode($result, JSON_PRETTY_PRINT); |
89 | 89 | 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'; |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | |
29 | 29 | $context = '/'; |
30 | 30 | |
31 | - $requestParams = substr($requestURI,strlen($context)); |
|
31 | + $requestParams = substr($requestURI, strlen($context)); |
|
32 | 32 | |
33 | 33 | switch ($requestMethod) { |
34 | 34 | case 'GET': |
35 | - if(strlen($requestParams) > 1){ |
|
36 | - $user_id = Utils::getParameterFromRequest($requestParams,4); |
|
35 | + if (strlen($requestParams) > 1) { |
|
36 | + $user_id = Utils::getParameterFromRequest($requestParams, 4); |
|
37 | 37 | $result = JobSeekerController::getJobSeekerProfileByUserId(intval($user_id)); |
38 | 38 | $json = json_encode($result, JSON_PRETTY_PRINT); |
39 | 39 | echo($json); |
40 | - }else{ |
|
40 | + }else { |
|
41 | 41 | $result = array(); |
42 | 42 | $json = json_encode($result, JSON_PRETTY_PRINT); |
43 | 43 | echo($json); |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | case 'PUT': |
68 | 68 | //Here Handle PUT Request |
69 | 69 | $jsonBody = file_get_contents('php://input'); |
70 | - if(strlen($requestParams) > 1){ |
|
70 | + if (strlen($requestParams) > 1) { |
|
71 | 71 | $jobSeekerJSON = json_decode($jsonBody, TRUE); |
72 | 72 | //var_dump($jobSeekerJSON); |
73 | - $user_id = Utils::getParameterFromRequest($requestParams,4); |
|
73 | + $user_id = Utils::getParameterFromRequest($requestParams, 4); |
|
74 | 74 | $jobSeekerProfile = new JobSeekerProfile(); |
75 | 75 | $jobSeekerProfile->setJob_seeker_profile_link($jobSeekerJSON["personal_link"]); |
76 | 76 | $jobSeekerProfile->setJob_seeker_profile_twitter_link($jobSeekerJSON["twitter_username"]); |
77 | 77 | $jobSeekerProfile->setJob_seeker_profile_linkedin_link($jobSeekerJSON["linkedin_username"]); |
78 | 78 | $jobSeekerProfile->setJob_seeker_profile_tagline($jobSeekerJSON["tagline"]); |
79 | 79 | $answers = []; |
80 | - foreach($jobSeekerJSON["answers"] as $answerJson) { |
|
80 | + foreach ($jobSeekerJSON["answers"] as $answerJson) { |
|
81 | 81 | $answer = new JobSeekerProfileAnswer(); |
82 | 82 | $answer->setJob_seeker_profile_question_id($answerJson["job_seeker_profile_question_id"]); |
83 | 83 | $answer->setAnswer($answerJson["answer"]); |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | $jobSeekerProfile->setJob_seeker_profile_answers($answers); |
87 | 87 | |
88 | 88 | //$user = new User(); |
89 | - $result = JobSeekerController::addJobSeekerProfile($jobSeekerProfile,$user_id); |
|
89 | + $result = JobSeekerController::addJobSeekerProfile($jobSeekerProfile, $user_id); |
|
90 | 90 | |
91 | 91 | //$json = json_encode($result, JSON_PRETTY_PRINT); |
92 | 92 | echo($result); |
93 | - }else{ |
|
93 | + }else { |
|
94 | 94 | $result = array(); |
95 | 95 | $json = json_encode($result, JSON_PRETTY_PRINT); |
96 | 96 | echo($json); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $result = JobSeekerController::getJobSeekerProfileByUserId(intval($user_id)); |
38 | 38 | $json = json_encode($result, JSON_PRETTY_PRINT); |
39 | 39 | echo($json); |
40 | - }else{ |
|
40 | + } else{ |
|
41 | 41 | $result = array(); |
42 | 42 | $json = json_encode($result, JSON_PRETTY_PRINT); |
43 | 43 | echo($json); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | //$json = json_encode($result, JSON_PRETTY_PRINT); |
92 | 92 | echo($result); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | $result = array(); |
95 | 95 | $json = json_encode($result, JSON_PRETTY_PRINT); |
96 | 96 | echo($json); |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | echo json_encode(array("failed" => "Requested job application does not belong to this user"), JSON_FORCE_OBJECT); |
49 | 49 | exit; |
50 | 50 | } |
51 | - } else if ($user->getUser_role() === "administrator") { |
|
51 | + }else if ($user->getUser_role() === "administrator") { |
|
52 | 52 | $jobPoster = JobPosterController::getJobPosterById($locale, $jobPosterId); |
53 | 53 | if ($jobPoster->getManager_user_id() != $user->getUser_id()) { |
54 | 54 | header('HTTP/1.0 401 Unauthorized'); |
55 | 55 | echo json_encode(array("failed" => "This user is not authorized to view applications for this job"), JSON_FORCE_OBJECT); |
56 | 56 | exit; |
57 | 57 | } |
58 | - } else { |
|
58 | + }else { |
|
59 | 59 | header('HTTP/1.0 401 Unauthorized'); |
60 | 60 | echo json_encode(array("failed" => "This user does not have permissions to view job applications"), JSON_FORCE_OBJECT); |
61 | 61 | exit; |
@@ -72,17 +72,17 @@ discard block |
||
72 | 72 | |
73 | 73 | $json = json_encode($fullJobApplication, JSON_PRETTY_PRINT); |
74 | 74 | echo($json); |
75 | - } else { |
|
75 | + }else { |
|
76 | 76 | header('HTTP/1.0 401 Unauthorized'); |
77 | 77 | echo json_encode(array("failed" => "Invalid token"), JSON_FORCE_OBJECT); |
78 | 78 | exit; |
79 | 79 | } |
80 | - } else { |
|
80 | + }else { |
|
81 | 81 | header('HTTP/1.0 401 Unauthorized'); |
82 | 82 | echo json_encode(array("failed" => 'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
83 | 83 | exit; |
84 | 84 | } |
85 | - } else { |
|
85 | + }else { |
|
86 | 86 | header('HTTP/1.0 401 Unauthorized'); |
87 | 87 | echo json_encode(array("failed" => 'No authorization token provided'), JSON_FORCE_OBJECT); |
88 | 88 | exit; |
@@ -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 |
@@ -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 | |
@@ -25,52 +25,52 @@ discard block |
||
25 | 25 | |
26 | 26 | $context = '/'; |
27 | 27 | |
28 | - $requestParams = substr($requestURI,strlen($context)); |
|
28 | + $requestParams = substr($requestURI, strlen($context)); |
|
29 | 29 | $user_id_param_index = 5; |
30 | 30 | //$headers = apache_request_headers(); |
31 | 31 | |
32 | 32 | switch ($requestMethod) { |
33 | 33 | case 'GET': |
34 | 34 | |
35 | - if(isset($_SERVER["HTTP_AUTHORIZATION"])){ |
|
35 | + if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
36 | 36 | $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
37 | 37 | |
38 | 38 | $user_id = Utils::getParameterFromRequest($requestParams, $user_id_param_index); |
39 | 39 | $locale = Utils::getLocaleFromRequest($requestParams); |
40 | 40 | |
41 | - if(strlen($requestParams) > 1){ |
|
41 | + if (strlen($requestParams) > 1) { |
|
42 | 42 | |
43 | - if(strlen($user_id) > 0){ |
|
43 | + if (strlen($user_id) > 0) { |
|
44 | 44 | |
45 | 45 | $user = new User(); |
46 | 46 | |
47 | 47 | $user->setUser_id($user_id); |
48 | 48 | |
49 | - if(JWTUtils::validateJWT($jwt, $user)){ |
|
49 | + if (JWTUtils::validateJWT($jwt, $user)) { |
|
50 | 50 | $result = DashboardController::getDashboardByUserId($user_id, $locale); |
51 | 51 | $json = json_encode($result, JSON_PRETTY_PRINT); |
52 | 52 | |
53 | 53 | echo($json); |
54 | 54 | |
55 | - }else{ |
|
55 | + }else { |
|
56 | 56 | header('HTTP/1.0 401 Unauthorized'); |
57 | - echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
|
57 | + echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
58 | 58 | exit; |
59 | 59 | } |
60 | 60 | |
61 | - }else{ |
|
61 | + }else { |
|
62 | 62 | header('HTTP/1.0 401 Unauthorized'); |
63 | - echo json_encode(array("failed"=>"No user id provided"),JSON_FORCE_OBJECT); |
|
63 | + echo json_encode(array("failed"=>"No user id provided"), JSON_FORCE_OBJECT); |
|
64 | 64 | exit; |
65 | 65 | } |
66 | - }else{ |
|
66 | + }else { |
|
67 | 67 | header('HTTP/1.0 401 Unauthorized'); |
68 | - echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
|
68 | + echo json_encode(array("failed"=>'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
|
69 | 69 | exit; |
70 | 70 | } |
71 | - }else{ |
|
71 | + }else { |
|
72 | 72 | header('HTTP/1.0 401 Unauthorized'); |
73 | - echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
|
73 | + echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
74 | 74 | exit; |
75 | 75 | } |
76 | 76 | /* |
@@ -52,23 +52,23 @@ |
||
52 | 52 | |
53 | 53 | echo($json); |
54 | 54 | |
55 | - }else{ |
|
55 | + } else{ |
|
56 | 56 | header('HTTP/1.0 401 Unauthorized'); |
57 | 57 | echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
58 | 58 | exit; |
59 | 59 | } |
60 | 60 | |
61 | - }else{ |
|
61 | + } else{ |
|
62 | 62 | header('HTTP/1.0 401 Unauthorized'); |
63 | 63 | echo json_encode(array("failed"=>"No user id provided"),JSON_FORCE_OBJECT); |
64 | 64 | exit; |
65 | 65 | } |
66 | - }else{ |
|
66 | + } else{ |
|
67 | 67 | header('HTTP/1.0 401 Unauthorized'); |
68 | 68 | echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
69 | 69 | exit; |
70 | 70 | } |
71 | - }else{ |
|
71 | + } else{ |
|
72 | 72 | header('HTTP/1.0 401 Unauthorized'); |
73 | 73 | echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
74 | 74 | exit; |
@@ -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/WorkEnvironmentController.php'; |
19 | 19 | require_once '../controller/UserController.php'; |
@@ -28,24 +28,24 @@ discard block |
||
28 | 28 | |
29 | 29 | $context = '/'; |
30 | 30 | |
31 | - $requestParams = substr($requestURI,strlen($context)); |
|
31 | + $requestParams = substr($requestURI, strlen($context)); |
|
32 | 32 | |
33 | 33 | switch ($requestMethod) { |
34 | 34 | case 'GET': |
35 | - if(strlen($requestParams) > 1){ |
|
36 | - $managerProfileId = Utils::getParameterFromRequest($requestParams,4); |
|
37 | - $photoName = Utils::getParameterFromRequest($requestParams,5); |
|
35 | + if (strlen($requestParams) > 1) { |
|
36 | + $managerProfileId = Utils::getParameterFromRequest($requestParams, 4); |
|
37 | + $photoName = Utils::getParameterFromRequest($requestParams, 5); |
|
38 | 38 | |
39 | 39 | $result = WorkEnvironmentController::getWorkplacePhotoByManagerProfileAndName($photoName, $managerProfileId); |
40 | 40 | |
41 | 41 | if ($result == NULL) { |
42 | 42 | http_response_code(404); |
43 | 43 | echo('This workplace photo does not exist'); |
44 | - } else { |
|
44 | + }else { |
|
45 | 45 | header("Content-type: " . $result->getMime_type()); |
46 | 46 | echo($result->getFile()); |
47 | 47 | } |
48 | - }else{ |
|
48 | + }else { |
|
49 | 49 | $result = array(); |
50 | 50 | $json = json_encode($result, JSON_PRETTY_PRINT); |
51 | 51 | echo($json); |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | //Here Handle DELETE Request |
73 | 73 | break; |
74 | 74 | case 'PUT': |
75 | - if(isset($_SERVER["HTTP_AUTHORIZATION"])){ |
|
75 | + if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
76 | 76 | $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
77 | 77 | |
78 | - if(strlen($requestParams) > 1){ |
|
78 | + if (strlen($requestParams) > 1) { |
|
79 | 79 | |
80 | - $managerProfileId = Utils::getParameterFromRequest($requestParams,4); |
|
80 | + $managerProfileId = Utils::getParameterFromRequest($requestParams, 4); |
|
81 | 81 | |
82 | - if(strlen($managerProfileId) > 0){ |
|
82 | + if (strlen($managerProfileId) > 0) { |
|
83 | 83 | |
84 | 84 | $user = UserController::getUserByManagerProfileId($managerProfileId); |
85 | 85 | |
86 | - if(JWTUtils::validateJWT($jwt, $user)){ |
|
87 | - $photoName = Utils::getParameterFromRequest($requestParams,5); |
|
86 | + if (JWTUtils::validateJWT($jwt, $user)) { |
|
87 | + $photoName = Utils::getParameterFromRequest($requestParams, 5); |
|
88 | 88 | |
89 | 89 | $workplacePhoto = new File( |
90 | 90 | file_get_contents('php://input'), |
@@ -94,33 +94,33 @@ discard block |
||
94 | 94 | $json = json_encode($result, JSON_PRETTY_PRINT); |
95 | 95 | |
96 | 96 | echo($json); |
97 | - }else{ |
|
97 | + }else { |
|
98 | 98 | header('HTTP/1.0 401 Unauthorized'); |
99 | - echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
|
99 | + echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
100 | 100 | exit; |
101 | 101 | } |
102 | 102 | |
103 | - }else{ |
|
103 | + }else { |
|
104 | 104 | header('HTTP/1.0 401 Unauthorized'); |
105 | - echo json_encode(array("failed"=>"No manager profile id provided"),JSON_FORCE_OBJECT); |
|
105 | + echo json_encode(array("failed"=>"No manager profile id provided"), JSON_FORCE_OBJECT); |
|
106 | 106 | exit; |
107 | 107 | } |
108 | - }else{ |
|
108 | + }else { |
|
109 | 109 | header('HTTP/1.0 401 Unauthorized'); |
110 | - echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
|
110 | + echo json_encode(array("failed"=>'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
|
111 | 111 | exit; |
112 | 112 | } |
113 | - }else{ |
|
113 | + }else { |
|
114 | 114 | header('HTTP/1.0 401 Unauthorized'); |
115 | - echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
|
115 | + echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
116 | 116 | exit; |
117 | 117 | } |
118 | 118 | |
119 | - if(strlen($requestParams) > 1){ |
|
120 | - $managerProfileId = Utils::getParameterFromRequest($requestParams,4); |
|
119 | + if (strlen($requestParams) > 1) { |
|
120 | + $managerProfileId = Utils::getParameterFromRequest($requestParams, 4); |
|
121 | 121 | |
122 | 122 | //echo('{"profilepic":"upload failed"}'); |
123 | - }else{ |
|
123 | + }else { |
|
124 | 124 | $result = array(); |
125 | 125 | $json = json_encode($result, JSON_PRETTY_PRINT); |
126 | 126 | echo($json); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | header("Content-type: " . $result->getMime_type()); |
46 | 46 | echo($result->getFile()); |
47 | 47 | } |
48 | - }else{ |
|
48 | + } else{ |
|
49 | 49 | $result = array(); |
50 | 50 | $json = json_encode($result, JSON_PRETTY_PRINT); |
51 | 51 | echo($json); |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | $json = json_encode($result, JSON_PRETTY_PRINT); |
95 | 95 | |
96 | 96 | echo($json); |
97 | - }else{ |
|
97 | + } else{ |
|
98 | 98 | header('HTTP/1.0 401 Unauthorized'); |
99 | 99 | echo json_encode(array("failed"=>"Invalid token"),JSON_FORCE_OBJECT); |
100 | 100 | exit; |
101 | 101 | } |
102 | 102 | |
103 | - }else{ |
|
103 | + } else{ |
|
104 | 104 | header('HTTP/1.0 401 Unauthorized'); |
105 | 105 | echo json_encode(array("failed"=>"No manager profile id provided"),JSON_FORCE_OBJECT); |
106 | 106 | exit; |
107 | 107 | } |
108 | - }else{ |
|
108 | + } else{ |
|
109 | 109 | header('HTTP/1.0 401 Unauthorized'); |
110 | 110 | echo json_encode(array("failed"=>'Invalid token, please reauthorize user'),JSON_FORCE_OBJECT); |
111 | 111 | exit; |
112 | 112 | } |
113 | - }else{ |
|
113 | + } else{ |
|
114 | 114 | header('HTTP/1.0 401 Unauthorized'); |
115 | 115 | echo json_encode(array("failed"=>'No authorization token provided'),JSON_FORCE_OBJECT); |
116 | 116 | exit; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $managerProfileId = Utils::getParameterFromRequest($requestParams,4); |
121 | 121 | |
122 | 122 | //echo('{"profilepic":"upload failed"}'); |
123 | - }else{ |
|
123 | + } else{ |
|
124 | 124 | $result = array(); |
125 | 125 | $json = json_encode($result, JSON_PRETTY_PRINT); |
126 | 126 | 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,18 +24,18 @@ 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 | $userId = Utils::getParameterFromRequest($requestParams, 5); |
34 | 34 | $result = JobPosterController::getJobPostersByManagerId($locale, $userId); |
35 | 35 | $json = json_encode($result, JSON_PRETTY_PRINT); |
36 | - header("Content-length:".strlen($json)); |
|
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); |
@@ -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); |
@@ -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 @@ discard block |
||
35 | 35 | $result = WorkSampleController::getAllWorkSamplesForJobApplication($jobPosterApplicationId, $locale); |
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); |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | |
60 | 60 | $json = json_encode($result, JSON_PRETTY_PRINT); |
61 | 61 | echo($json); |
62 | - } else { |
|
62 | + }else { |
|
63 | 63 | header('HTTP/1.0 403 Forbidden'); |
64 | 64 | echo json_encode(array("failed" => "Only Draft applications can be modified."), JSON_FORCE_OBJECT); |
65 | 65 | exit; |
66 | 66 | } |
67 | - } else { |
|
67 | + }else { |
|
68 | 68 | $result = array(); |
69 | 69 | $json = json_encode($result, JSON_PRETTY_PRINT); |
70 | 70 | echo($json); |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | |
96 | 96 | $json = json_encode($result, JSON_PRETTY_PRINT); |
97 | 97 | echo($json); |
98 | - } else { |
|
98 | + }else { |
|
99 | 99 | header('HTTP/1.0 403 Forbidden'); |
100 | 100 | echo json_encode(array("failed" => "Only Draft applications can be modified."), JSON_FORCE_OBJECT); |
101 | 101 | exit; |
102 | 102 | } |
103 | - } else { |
|
103 | + }else { |
|
104 | 104 | $result = array(); |
105 | 105 | $json = json_encode($result, JSON_PRETTY_PRINT); |
106 | 106 | echo($json); |