@@ -184,7 +184,7 @@ |
||
184 | 184 | * @param ManagerProfileDetails $managerProfileDetails |
185 | 185 | * @return int $profileId |
186 | 186 | */ |
187 | - public static function updateManagerProfile(ManagerProfile $managerProfile, ManagerProfileDetailsNonLocalized $managerProfileDetails){ |
|
187 | + public static function updateManagerProfile(ManagerProfile $managerProfile, ManagerProfileDetailsNonLocalized $managerProfileDetails) { |
|
188 | 188 | |
189 | 189 | //var_dump($managerProfile->getUser_manager_profile_id()); |
190 | 190 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param dbconnection $link |
60 | 60 | * $link is the connection required to be closed |
61 | 61 | */ |
62 | - protected static function closeConnection($link){ |
|
62 | + protected static function closeConnection($link) { |
|
63 | 63 | $link = null; |
64 | 64 | } |
65 | 65 | |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * @param type $sql |
70 | 70 | * @return type |
71 | 71 | */ |
72 | - protected static function executeDBTransaction($link,$sql){ |
|
73 | - try{ |
|
72 | + protected static function executeDBTransaction($link, $sql) { |
|
73 | + try { |
|
74 | 74 | $link->beginTransaction(); |
75 | 75 | $link->exec($sql); |
76 | 76 | $link->commit(); |
77 | 77 | } catch (Exception $e) { |
78 | 78 | $link->rollBack(); |
79 | - die('<b>Error:</b> '.$e->getMessage()); |
|
79 | + die('<b>Error:</b> ' . $e->getMessage()); |
|
80 | 80 | } |
81 | 81 | return $link; |
82 | 82 | } |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | |
99 | 99 | try { |
100 | 100 | $sql->execute() or die("ERROR: " . implode(":", $conn->errorInfo())); |
101 | - $sql->setFetchMode( PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobPoster',array( |
|
101 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobPoster', array( |
|
102 | 102 | 'id', 'locale_id', 'manager_user_id', 'title', 'description', 'applicants_to_date', 'term_qty', 'term_units', 'job_min_level', |
103 | - 'job_max_level', 'start_date','open_date', 'close_date', 'department', 'branch', 'division', 'location_province', 'location_city', |
|
104 | - 'remuneration_range_low','remuneration_range_high','impact','key_tasks','core_competencies','dev_competencies', |
|
103 | + 'job_max_level', 'start_date', 'open_date', 'close_date', 'department', 'branch', 'division', 'location_province', 'location_city', |
|
104 | + 'remuneration_range_low', 'remuneration_range_high', 'impact', 'key_tasks', 'core_competencies', 'dev_competencies', |
|
105 | 105 | 'classification', 'security_clearance', 'language_requirement' |
106 | 106 | )); |
107 | 107 | $jobPosters = $sql->fetchAll(); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobPoster', array( |
201 | 201 | 'id', 'locale_id', 'manager_user_id', 'title', 'description', 'applicants_to_date', 'term_qty', 'term_units', 'job_min_level', |
202 | 202 | 'job_max_level', 'start_date', 'open_date', 'close_date', 'department', 'branch', 'division', 'location_province', 'location_city', |
203 | - 'remuneration_range_low','remuneration_range_high','impact','classification','security_clearance', 'language_requirement', |
|
203 | + 'remuneration_range_low', 'remuneration_range_high', 'impact', 'classification', 'security_clearance', 'language_requirement', |
|
204 | 204 | )); |
205 | 205 | $jobPoster = $sql->fetch(); |
206 | 206 | } catch (PDOException $e) { |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | |
594 | 594 | try { |
595 | 595 | $sql->execute() or die("ERROR: " . implode(":", $conn->errorInfo())); |
596 | - $sql->setFetchMode( PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobPoster',array( |
|
596 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobPoster', array( |
|
597 | 597 | 'id', 'locale_id', 'manager_user_id', 'title', 'description', 'applicants_to_date', 'term_qty', 'term_units', 'job_min_level', |
598 | 598 | 'job_max_level', 'start_date', 'open_date', 'close_date', 'department', 'branch', 'division', 'location_province', 'location_city', |
599 | - 'remuneration_range_low','remuneration_range_high','impact','key_tasks','core_competencies','dev_competencies', |
|
600 | - 'classification', 'security_clearance','language_requirement' |
|
599 | + 'remuneration_range_low', 'remuneration_range_high', 'impact', 'key_tasks', 'core_competencies', 'dev_competencies', |
|
600 | + 'classification', 'security_clearance', 'language_requirement' |
|
601 | 601 | )); |
602 | 602 | $jobPosters = $sql->fetchAll(); |
603 | 603 | //var_dump($rows); |
@@ -125,7 +125,7 @@ |
||
125 | 125 | public static function getWorkplacePhotoByManagerProfileAndName($photoName, $managerProfileId) { |
126 | 126 | if (WorkEnvironmentDAO::workplacePhotoExistsForManagerAndName($managerProfileId, $photoName)) { |
127 | 127 | return WorkEnvironmentDAO::getWorkplacePhoto($managerProfileId, $photoName); |
128 | - } else { |
|
128 | + }else { |
|
129 | 129 | return NULL; |
130 | 130 | } |
131 | 131 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public static function getProfilePic($user_id) { |
22 | 22 | if (ProfilePicDAO::profilePicExistsForUser($user_id)) { |
23 | 23 | return ProfilePicDAO::getProfilePic($user_id); |
24 | - } else { |
|
24 | + }else { |
|
25 | 25 | return NULL; |
26 | 26 | } |
27 | 27 | } |
@@ -29,108 +29,108 @@ |
||
29 | 29 | $requestParams = substr($requestURI, strlen($context) + 1); |
30 | 30 | |
31 | 31 | switch ($requestMethod) { |
32 | - case 'GET': |
|
33 | - if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
34 | - $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
|
32 | + case 'GET': |
|
33 | + if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
34 | + $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
|
35 | 35 | |
36 | - $open_id = Utils::getParameterFromRequest($requestParams, $user_id_param_index); |
|
36 | + $open_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($open_id) > 0) { |
|
40 | + if (strlen($open_id) > 0) { |
|
41 | 41 | |
42 | - $user = new User(); |
|
42 | + $user = new User(); |
|
43 | 43 | |
44 | - $user->setOpen_id($open_id); |
|
44 | + $user->setOpen_id($open_id); |
|
45 | 45 | |
46 | - if (JWTUtils::validateJWT($jwt, $user)) { |
|
46 | + if (JWTUtils::validateJWT($jwt, $user)) { |
|
47 | 47 | |
48 | - $result = UserController::getUserByOpenId($user); |
|
48 | + $result = UserController::getUserByOpenId($user); |
|
49 | 49 | |
50 | - $json = json_encode($result, JSON_PRETTY_PRINT); |
|
50 | + $json = json_encode($result, JSON_PRETTY_PRINT); |
|
51 | 51 | |
52 | - echo($json); |
|
52 | + echo($json); |
|
53 | + |
|
54 | + }else { |
|
55 | + header('HTTP/1.0 401 Unauthorized'); |
|
56 | + echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
57 | + exit; |
|
58 | + } |
|
53 | 59 | |
54 | 60 | }else { |
55 | 61 | header('HTTP/1.0 401 Unauthorized'); |
56 | - echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
62 | + echo json_encode(array("failed"=>"No user id provided"), JSON_FORCE_OBJECT); |
|
57 | 63 | exit; |
58 | 64 | } |
59 | - |
|
60 | 65 | }else { |
61 | 66 | header('HTTP/1.0 401 Unauthorized'); |
62 | - echo json_encode(array("failed"=>"No user id provided"), JSON_FORCE_OBJECT); |
|
67 | + echo json_encode(array("failed"=>'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
|
63 | 68 | exit; |
64 | 69 | } |
65 | 70 | }else { |
66 | 71 | header('HTTP/1.0 401 Unauthorized'); |
67 | - echo json_encode(array("failed"=>'Invalid token, please reauthorize user'), JSON_FORCE_OBJECT); |
|
72 | + echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
68 | 73 | exit; |
69 | 74 | } |
70 | - }else { |
|
71 | - header('HTTP/1.0 401 Unauthorized'); |
|
72 | - echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
73 | - exit; |
|
74 | - } |
|
75 | - break; |
|
76 | - case 'POST': |
|
77 | - if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
78 | - $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
|
75 | + break; |
|
76 | + case 'POST': |
|
77 | + if (isset($_SERVER["HTTP_AUTHORIZATION"])) { |
|
78 | + $jwt = JWTUtils::getTokenFromRequest($_SERVER["HTTP_AUTHORIZATION"]); |
|
79 | 79 | |
80 | - $jsonBody = file_get_contents('php://input'); |
|
81 | - if (strlen($jsonBody) > 1) { |
|
80 | + $jsonBody = file_get_contents('php://input'); |
|
81 | + if (strlen($jsonBody) > 1) { |
|
82 | 82 | |
83 | - $credentials = json_decode($jsonBody, TRUE); //convert JSON into array |
|
84 | - //var_dump($credentials); |
|
85 | - if ($credentials !== null) { |
|
83 | + $credentials = json_decode($jsonBody, TRUE); //convert JSON into array |
|
84 | + //var_dump($credentials); |
|
85 | + if ($credentials !== null) { |
|
86 | 86 | |
87 | - $user = new User(); |
|
87 | + $user = new User(); |
|
88 | 88 | |
89 | - $user->setOpen_id($credentials["sub"]); |
|
90 | - $user->setName($credentials["name"]); |
|
91 | - $user->setEmail($credentials["email"]); |
|
92 | - $user->setUser_role($credentials["user_role"]); |
|
89 | + $user->setOpen_id($credentials["sub"]); |
|
90 | + $user->setName($credentials["name"]); |
|
91 | + $user->setEmail($credentials["email"]); |
|
92 | + $user->setUser_role($credentials["user_role"]); |
|
93 | 93 | |
94 | - if (JWTUtils::validateJWT($jwt, $user)) { |
|
94 | + if (JWTUtils::validateJWT($jwt, $user)) { |
|
95 | 95 | |
96 | - $result = UserController::getUserByOpenId($user); |
|
96 | + $result = UserController::getUserByOpenId($user); |
|
97 | 97 | |
98 | - $json = json_encode($result, JSON_PRETTY_PRINT); |
|
98 | + $json = json_encode($result, JSON_PRETTY_PRINT); |
|
99 | 99 | |
100 | - echo($json); |
|
100 | + echo($json); |
|
101 | + }else { |
|
102 | + header('HTTP/1.0 401 Unauthorized'); |
|
103 | + echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
104 | + exit; |
|
105 | + } |
|
101 | 106 | }else { |
102 | - header('HTTP/1.0 401 Unauthorized'); |
|
103 | - echo json_encode(array("failed"=>"Invalid token"), JSON_FORCE_OBJECT); |
|
107 | + header('HTTP/1.0 400 Bad Request'); |
|
108 | + echo json_encode(array("failed"=>"Bad Reqest"), JSON_FORCE_OBJECT); |
|
104 | 109 | exit; |
105 | 110 | } |
111 | + |
|
106 | 112 | }else { |
107 | 113 | header('HTTP/1.0 400 Bad Request'); |
108 | 114 | echo json_encode(array("failed"=>"Bad Reqest"), JSON_FORCE_OBJECT); |
109 | 115 | exit; |
110 | 116 | } |
111 | - |
|
112 | 117 | }else { |
113 | - header('HTTP/1.0 400 Bad Request'); |
|
114 | - echo json_encode(array("failed"=>"Bad Reqest"), JSON_FORCE_OBJECT); |
|
118 | + header('HTTP/1.0 401 Unauthorized'); |
|
119 | + echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
115 | 120 | exit; |
116 | 121 | } |
117 | - }else { |
|
118 | - header('HTTP/1.0 401 Unauthorized'); |
|
119 | - echo json_encode(array("failed"=>'No authorization token provided'), JSON_FORCE_OBJECT); |
|
120 | - exit; |
|
121 | - } |
|
122 | - break; |
|
123 | - case 'DELETE': |
|
124 | - //Here Handle DELETE Request |
|
125 | - break; |
|
126 | - case 'PUT': |
|
127 | - //Here Handle PUT Request |
|
128 | - break; |
|
129 | - case 'OPTIONS': |
|
130 | - //Here Handle OPTIONS/Pre-flight requests |
|
131 | - header("Access-Control-Allow-Headers: Accept, Content-Type, Access-Control-Allow-Origin, x-access-token"); |
|
132 | - header("Access-Control-Allow-Methods: GET,POST"); |
|
133 | - echo(""); |
|
134 | - break; |
|
122 | + break; |
|
123 | + case 'DELETE': |
|
124 | + //Here Handle DELETE Request |
|
125 | + break; |
|
126 | + case 'PUT': |
|
127 | + //Here Handle PUT Request |
|
128 | + break; |
|
129 | + case 'OPTIONS': |
|
130 | + //Here Handle OPTIONS/Pre-flight requests |
|
131 | + header("Access-Control-Allow-Headers: Accept, Content-Type, Access-Control-Allow-Origin, x-access-token"); |
|
132 | + header("Access-Control-Allow-Methods: GET,POST"); |
|
133 | + echo(""); |
|
134 | + break; |
|
135 | 135 | } |
136 | 136 | ?> |
137 | 137 | \ No newline at end of file |
@@ -4,14 +4,14 @@ |
||
4 | 4 | * Summary: removes special characters for inserting tab title in Excel Spreadsheets |
5 | 5 | */ |
6 | 6 | |
7 | -class SpecialCharacterHandler{ |
|
7 | +class SpecialCharacterHandler { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @param string $string |
11 | 11 | * @return string $fixedString |
12 | 12 | */ |
13 | - public function removeSpecialCharacters($string){ |
|
14 | - $forbiddenCharacters = array("*","/","\\","?","[","]"); |
|
13 | + public function removeSpecialCharacters($string) { |
|
14 | + $forbiddenCharacters = array("*", "/", "\\", "?", "[", "]"); |
|
15 | 15 | $fixedString = str_replace($forbiddenCharacters, "", $string); |
16 | 16 | return $fixedString; |
17 | 17 | } |