@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | */ |
87 | 87 | public static function base64url_decode($data) { |
88 | - return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); |
|
88 | + return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data)%4, '=', STR_PAD_RIGHT)); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | } |
191 | 191 | |
192 | - public static function getOpenIdUserFromJWT($jwt) { |
|
192 | + public static function getOpenIdUserFromJWT($jwt) { |
|
193 | 193 | if (self::validateJWT($jwt, null)) { |
194 | 194 | $openId = self::getPayloadFromToken($jwt); |
195 | 195 | if ($openId['sub']) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | } |
201 | 201 | return null; |
202 | - } |
|
202 | + } |
|
203 | 203 | |
204 | 204 | public static function isExpired($exp){ |
205 | 205 | return false; |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | $path = dirname(getcwd()); |
11 | 11 | |
12 | 12 | //var_dump(ROOT); |
13 | -require_once $path.'/config/auth.config.inc'; |
|
14 | -require_once $path.'/model/User.php'; |
|
15 | -require_once $path.'/controller/UserController.php'; |
|
16 | -require_once $path.'/utils/Utils.php'; |
|
13 | +require_once $path . '/config/auth.config.inc'; |
|
14 | +require_once $path . '/model/User.php'; |
|
15 | +require_once $path . '/controller/UserController.php'; |
|
16 | +require_once $path . '/utils/Utils.php'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Description of JWTUtils |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param User $user |
28 | 28 | * @return type |
29 | 29 | */ |
30 | - public static function generateJWT(User $user){ |
|
30 | + public static function generateJWT(User $user) { |
|
31 | 31 | $key = SECRET; |
32 | 32 | //var_dump($key); |
33 | 33 | $header = JWTUtils::setHeader(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return type |
43 | 43 | */ |
44 | - public static function setHeader(){ |
|
44 | + public static function setHeader() { |
|
45 | 45 | |
46 | 46 | $header_content = array("alg"=>"HS256", "typ"=>"JWT"); |
47 | 47 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @param type $token |
57 | 57 | */ |
58 | - public static function getPayloadFromToken($jwt){ |
|
58 | + public static function getPayloadFromToken($jwt) { |
|
59 | 59 | |
60 | 60 | $jwt_elements = explode('.', $jwt); |
61 | - $payload = json_decode(Utils::base64url_decode($jwt_elements[1]),TRUE); |
|
61 | + $payload = json_decode(Utils::base64url_decode($jwt_elements[1]), TRUE); |
|
62 | 62 | //var_dump($payload); |
63 | 63 | return $payload; |
64 | 64 | } |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | * @param User $user |
69 | 69 | * @return type |
70 | 70 | */ |
71 | - public static function setPayload(User $user){ |
|
71 | + public static function setPayload(User $user) { |
|
72 | 72 | |
73 | 73 | $user_id = $user->getUser_id(); |
74 | 74 | |
75 | 75 | $iat = time(); |
76 | 76 | |
77 | - $expiryTime = time()+60*60*24; //expires in one day |
|
77 | + $expiryTime = time() + 60*60*24; //expires in one day |
|
78 | 78 | |
79 | - $payload_content = array("iat"=>$iat,"iss"=>"https://talentcloud.localhost","exp"=>$expiryTime,"user_id"=>$user_id); |
|
79 | + $payload_content = array("iat"=>$iat, "iss"=>"https://talentcloud.localhost", "exp"=>$expiryTime, "user_id"=>$user_id); |
|
80 | 80 | |
81 | 81 | $payload = Utils::base64url_encode(json_encode($payload_content)); |
82 | 82 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | * @param type $key |
92 | 92 | * @return type |
93 | 93 | */ |
94 | - public static function setSignature($header, $payload, $key){ |
|
94 | + public static function setSignature($header, $payload, $key) { |
|
95 | 95 | |
96 | - $unsignedToken = $header.'.'.$payload; |
|
96 | + $unsignedToken = $header . '.' . $payload; |
|
97 | 97 | |
98 | 98 | $encoded_key = Utils::base64url_encode($key); |
99 | 99 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | * @param type $signature |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - public static function setToken($header,$payload,$signature){ |
|
115 | + public static function setToken($header, $payload, $signature) { |
|
116 | 116 | |
117 | - $token = $header.'.'.$payload.'.'.$signature; |
|
117 | + $token = $header . '.' . $payload . '.' . $signature; |
|
118 | 118 | |
119 | 119 | return $token; |
120 | 120 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param type $headers |
126 | 126 | * @return type |
127 | 127 | */ |
128 | - public static function getTokenFromHeader($headers){ |
|
128 | + public static function getTokenFromHeader($headers) { |
|
129 | 129 | $token = null; |
130 | 130 | if (!empty($headers)) { |
131 | 131 | if (preg_match('/Bearer\s(\S+)/', $headers['Authorization'], $token)) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param type $headers |
141 | 141 | * @return type |
142 | 142 | */ |
143 | - public static function getTokenFromRequest($authHeader){ |
|
143 | + public static function getTokenFromRequest($authHeader) { |
|
144 | 144 | $token = null; |
145 | 145 | if (!empty($authHeader)) { |
146 | 146 | if (preg_match('/Bearer\s(\S+)/', $authHeader, $token)) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param type $jwt |
156 | 156 | * @return boolean |
157 | 157 | */ |
158 | - public static function validateJWT($jwt, $user){ |
|
158 | + public static function validateJWT($jwt, $user) { |
|
159 | 159 | $isValid = true; |
160 | 160 | |
161 | 161 | // Split jwt string by '.' |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | $recieved_signature = Utils::base64url_decode($jwt_elements[2]); |
179 | 179 | |
180 | 180 | // checking if the generated signature is equal to the received signature |
181 | - if($isValid){ |
|
182 | - if(hash_equals($evalSignature, $recieved_signature)) { |
|
181 | + if ($isValid) { |
|
182 | + if (hash_equals($evalSignature, $recieved_signature)) { |
|
183 | 183 | // If everything worked fine, if the signature is ok and the payload was not modified you should get a success message and the ecryption hashes match |
184 | 184 | $isValid = true; |
185 | 185 | } |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | return null; |
202 | 202 | } |
203 | 203 | |
204 | - public static function isExpired($exp){ |
|
204 | + public static function isExpired($exp) { |
|
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | |
208 | - public static function issuedBy($iss){ |
|
208 | + public static function issuedBy($iss) { |
|
209 | 209 | return true; |
210 | 210 | } |
211 | 211 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @param ApplicationMicroReference[] $references |
33 | 33 | */ |
34 | 34 | public static function getApplicationMicroReferencesForJobApplication($jobPosterApplicationId, $locale) { |
35 | - $link = BaseDAO::getConnection(); |
|
35 | + $link = BaseDAO::getConnection(); |
|
36 | 36 | |
37 | 37 | $sqlStr = " |
38 | 38 | SELECT |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | ini_set("display_errors", 1); |
7 | 7 | set_time_limit(0); |
8 | 8 | |
9 | - if(!isset($_SESSION)){ |
|
9 | + if (!isset($_SESSION)) { |
|
10 | 10 | session_start(); |
11 | 11 | } |
12 | 12 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $referenceArrays = $sql->fetchAll(); |
82 | 82 | $references = []; |
83 | - foreach($referenceArrays as $referenceArray) { |
|
83 | + foreach ($referenceArrays as $referenceArray) { |
|
84 | 84 | $basicReference = new MicroReference(); |
85 | 85 | $basicReference->setMicro_reference_id($referenceArray['micro_reference_id']); |
86 | 86 | $basicReference->setMicro_reference_name($referenceArray['micro_reference_name']); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | ini_set("display_errors", 1); |
7 | 7 | set_time_limit(0); |
8 | 8 | |
9 | -if(!isset($_SESSION)){ |
|
9 | +if (!isset($_SESSION)) { |
|
10 | 10 | session_start(); |
11 | 11 | } |
12 | 12 |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | try { |
100 | 100 | $sql->execute() or die("ERROR: " . implode(":", $conn->errorInfo())); |
101 | 101 | $sql->setFetchMode( PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobPoster',array( |
102 | - 'id', 'locale_id', 'manager_user_id', 'title', 'description', 'applicants_to_date', 'term_qty', 'term_units', 'job_min_level', |
|
102 | + 'id', 'locale_id', 'manager_user_id', 'title', 'description', 'applicants_to_date', 'term_qty', 'term_units', 'job_min_level', |
|
103 | 103 | 'job_max_level', 'start_date','open_date', 'close_date', 'department', 'branch', 'division', 'location_province', 'location_city', |
104 | 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(); |
108 | 108 | //var_dump($rows); |
109 | 109 | } catch (PDOException $e) { |
@@ -201,7 +201,7 @@ discard block |
||
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 | 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) { |
207 | 207 | BaseDAO::closeConnection($link); |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $sqlAssetType->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
501 | 501 | |
502 | 502 | if (sizeof($key_task_data) > 0) |
503 | - $sql4->execute($key_task_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
503 | + $sql4->execute($key_task_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
504 | 504 | if (sizeof($core_competency_data) > 0) |
505 | 505 | $sql5->execute($core_competency_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
506 | 506 | if (sizeof($dev_competency_data) > 0) |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | 'job_max_level', 'start_date', 'open_date', 'close_date', 'department', 'branch', 'division', 'location_province', 'location_city', |
595 | 595 | 'remuneration_range_low','remuneration_range_high','impact','key_tasks','core_competencies','dev_competencies', |
596 | 596 | 'classification', 'security_clearance','language_requirement' |
597 | - )); |
|
597 | + )); |
|
598 | 598 | $jobPosters = $sql->fetchAll(); |
599 | 599 | //var_dump($rows); |
600 | 600 | } catch (PDOException $e) { |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | ini_set("display_errors", 1); |
7 | 7 | set_time_limit(0); |
8 | 8 | |
9 | - if(!isset($_SESSION)){ |
|
9 | + if (!isset($_SESSION)) { |
|
10 | 10 | session_start(); |
11 | 11 | } |
12 | 12 | |
@@ -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) { |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | $sqlQuestions->execute($input_fields) or die("ERROR: " . implode(":", $conn->errorInfo())); |
285 | 285 | |
286 | 286 | $sqlTasks->setFetchMode(PDO::FETCH_NUM); |
287 | - $sqlCoreComps->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Lookup'); |
|
288 | - $sqlDevelopingComps->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Lookup'); |
|
289 | - $sqlQuestions->setFetchMode( PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobPosterQuestion'); |
|
287 | + $sqlCoreComps->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'Lookup'); |
|
288 | + $sqlDevelopingComps->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'Lookup'); |
|
289 | + $sqlQuestions->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobPosterQuestion'); |
|
290 | 290 | |
291 | 291 | //fetch array items |
292 | 292 | $tasks = $sqlTasks->fetchAll(); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * specifies department, province, etc, by id instead of by name |
315 | 315 | * @return int job_post_id: id of the newly created job post |
316 | 316 | */ |
317 | - public static function createJobPoster($jobPosterNonLocalized){ |
|
317 | + public static function createJobPoster($jobPosterNonLocalized) { |
|
318 | 318 | $link = BaseDAO::getConnection(); |
319 | 319 | $sqlStr1 = " |
320 | 320 | INSERT INTO job_poster |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | //Build bulk insert sql strings for array data |
374 | 374 | $key_task_data = []; |
375 | 375 | $key_task_values = []; |
376 | - foreach($jobPosterNonLocalized->getKey_tasks_en() as $task) { |
|
376 | + foreach ($jobPosterNonLocalized->getKey_tasks_en() as $task) { |
|
377 | 377 | $key_task_values[] = '(@job_post_id, 1, ?)'; |
378 | 378 | $key_task_data[] = $task; |
379 | 379 | } |
380 | - foreach($jobPosterNonLocalized->getKey_tasks_fr() as $task) { |
|
380 | + foreach ($jobPosterNonLocalized->getKey_tasks_fr() as $task) { |
|
381 | 381 | $key_task_values[] = '(@job_post_id, 2, ?)'; |
382 | 382 | $key_task_data[] = $task; |
383 | 383 | } |
@@ -389,11 +389,11 @@ discard block |
||
389 | 389 | $sqlStr_EssentialType = '(SELECT ct.criteria_type_id INTO @essential_type FROM criteria_type ct WHERE ct.criteria_type = "essential")'; |
390 | 390 | $core_competency_data = []; |
391 | 391 | $core_competency_values = []; |
392 | - foreach($jobPosterNonLocalized->getCore_competencies_en() as $core_competency) { |
|
392 | + foreach ($jobPosterNonLocalized->getCore_competencies_en() as $core_competency) { |
|
393 | 393 | $core_competency_values[] = '(@job_post_id, 1, @essential_type, ?)'; |
394 | 394 | $core_competency_data[] = $core_competency; |
395 | 395 | } |
396 | - foreach($jobPosterNonLocalized->getCore_competencies_fr() as $core_competency) { |
|
396 | + foreach ($jobPosterNonLocalized->getCore_competencies_fr() as $core_competency) { |
|
397 | 397 | $core_competency_values[] = '(@job_post_id, 2, @essential_type, ?)'; |
398 | 398 | $core_competency_data[] = $core_competency; |
399 | 399 | } |
@@ -405,11 +405,11 @@ discard block |
||
405 | 405 | |
406 | 406 | $dev_competency_data = []; |
407 | 407 | $dev_competency_values = []; |
408 | - foreach($jobPosterNonLocalized->getDeveloping_competencies_en() as $dev_competency) { |
|
408 | + foreach ($jobPosterNonLocalized->getDeveloping_competencies_en() as $dev_competency) { |
|
409 | 409 | $dev_competency_values[] = '(@job_post_id, 1, @asset_type, ?)'; |
410 | 410 | $dev_competency_data[] = $dev_competency; |
411 | 411 | } |
412 | - foreach($jobPosterNonLocalized->getDeveloping_competencies_fr() as $dev_competency) { |
|
412 | + foreach ($jobPosterNonLocalized->getDeveloping_competencies_fr() as $dev_competency) { |
|
413 | 413 | $dev_competency_values[] = '(@job_post_id, 2, @asset_type, ?)'; |
414 | 414 | $dev_competency_data[] = $dev_competency; |
415 | 415 | } |
@@ -419,12 +419,12 @@ discard block |
||
419 | 419 | |
420 | 420 | $question_data = []; |
421 | 421 | $question_values = []; |
422 | - foreach($jobPosterNonLocalized->getQuestions_en() as $question) { |
|
422 | + foreach ($jobPosterNonLocalized->getQuestions_en() as $question) { |
|
423 | 423 | $question_values[] = '(@job_post_id, 1, ?, ?)'; |
424 | 424 | $question_data[] = $question->getQuestion(); |
425 | 425 | $question_data[] = $question->getDescription(); |
426 | 426 | } |
427 | - foreach($jobPosterNonLocalized->getQuestions_fr() as $question) { |
|
427 | + foreach ($jobPosterNonLocalized->getQuestions_fr() as $question) { |
|
428 | 428 | $question_values[] = '(@job_post_id, 2, ?, ?)'; |
429 | 429 | $question_data[] = $question->getQuestion(); |
430 | 430 | $question_data[] = $question->getDescription(); |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | if (sizeof($dev_competency_data) > 0) |
507 | 507 | $sql6->execute($dev_competency_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
508 | 508 | if (sizeof($question_data) > 0) |
509 | - $sqlQuestions->execute ($question_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
509 | + $sqlQuestions->execute($question_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
510 | 510 | |
511 | 511 | $link->commit(); |
512 | 512 | } catch (PDOException $e) { |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * @param type $locale |
524 | 524 | * @return type |
525 | 525 | */ |
526 | - public static function getJobPostersByManagerId($locale,$managerId) { |
|
526 | + public static function getJobPostersByManagerId($locale, $managerId) { |
|
527 | 527 | |
528 | 528 | $link = BaseDAO::getConnection(); |
529 | 529 | $sqlStr = " |
@@ -589,11 +589,11 @@ discard block |
||
589 | 589 | |
590 | 590 | try { |
591 | 591 | $sql->execute() or die("ERROR: " . implode(":", $conn->errorInfo())); |
592 | - $sql->setFetchMode( PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobPoster',array( |
|
592 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobPoster', array( |
|
593 | 593 | 'id', 'locale_id', 'manager_user_id', 'title', 'description', 'applicants_to_date', 'term_qty', 'term_units', 'job_min_level', |
594 | 594 | 'job_max_level', 'start_date', 'open_date', 'close_date', 'department', 'branch', 'division', 'location_province', 'location_city', |
595 | - 'remuneration_range_low','remuneration_range_high','impact','key_tasks','core_competencies','dev_competencies', |
|
596 | - 'classification', 'security_clearance','language_requirement' |
|
595 | + 'remuneration_range_low', 'remuneration_range_high', 'impact', 'key_tasks', 'core_competencies', 'dev_competencies', |
|
596 | + 'classification', 'security_clearance', 'language_requirement' |
|
597 | 597 | )); |
598 | 598 | $jobPosters = $sql->fetchAll(); |
599 | 599 | //var_dump($rows); |
@@ -446,14 +446,18 @@ discard block |
||
446 | 446 | $sqlEssentialType = $link->prepare($sqlStr_EssentialType); |
447 | 447 | $sqlAssetType = $link->prepare($sqlStr_AssetType); |
448 | 448 | |
449 | - if (sizeof($key_task_data) > 0) |
|
450 | - $sql4 = $link->prepare($sqlStr4); |
|
451 | - if (sizeof($core_competency_data) > 0) |
|
452 | - $sql5 = $link->prepare($sqlStr5); |
|
453 | - if (sizeof($dev_competency_data) > 0) |
|
454 | - $sql6 = $link->prepare($sqlStr6); |
|
455 | - if (sizeof($question_data) > 0) |
|
456 | - $sqlQuestions = $link->prepare($sqlQuestionsStr); |
|
449 | + if (sizeof($key_task_data) > 0) { |
|
450 | + $sql4 = $link->prepare($sqlStr4); |
|
451 | + } |
|
452 | + if (sizeof($core_competency_data) > 0) { |
|
453 | + $sql5 = $link->prepare($sqlStr5); |
|
454 | + } |
|
455 | + if (sizeof($dev_competency_data) > 0) { |
|
456 | + $sql6 = $link->prepare($sqlStr6); |
|
457 | + } |
|
458 | + if (sizeof($question_data) > 0) { |
|
459 | + $sqlQuestions = $link->prepare($sqlQuestionsStr); |
|
460 | + } |
|
457 | 461 | |
458 | 462 | |
459 | 463 | $sql1->bindValue(':term_units_id', $jobPosterNonLocalized->getTerm_units_id(), PDO::PARAM_INT); |
@@ -499,14 +503,18 @@ discard block |
||
499 | 503 | $sqlEssentialType->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
500 | 504 | $sqlAssetType->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
501 | 505 | |
502 | - if (sizeof($key_task_data) > 0) |
|
503 | - $sql4->execute($key_task_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
504 | - if (sizeof($core_competency_data) > 0) |
|
505 | - $sql5->execute($core_competency_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
506 | - if (sizeof($dev_competency_data) > 0) |
|
507 | - $sql6->execute($dev_competency_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
508 | - if (sizeof($question_data) > 0) |
|
509 | - $sqlQuestions->execute ($question_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
506 | + if (sizeof($key_task_data) > 0) { |
|
507 | + $sql4->execute($key_task_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
508 | + } |
|
509 | + if (sizeof($core_competency_data) > 0) { |
|
510 | + $sql5->execute($core_competency_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
511 | + } |
|
512 | + if (sizeof($dev_competency_data) > 0) { |
|
513 | + $sql6->execute($dev_competency_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
514 | + } |
|
515 | + if (sizeof($question_data) > 0) { |
|
516 | + $sqlQuestions->execute ($question_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
|
517 | + } |
|
510 | 518 | |
511 | 519 | $link->commit(); |
512 | 520 | } catch (PDOException $e) { |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | ini_set("display_errors", 1); |
7 | 7 | set_time_limit(0); |
8 | 8 | |
9 | - if(!isset($_SESSION)){ |
|
9 | + if (!isset($_SESSION)) { |
|
10 | 10 | session_start(); |
11 | 11 | } |
12 | 12 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | try { |
74 | 74 | $sql->execute() or die("ERROR: " . implode(":", $conn->errorInfo())); |
75 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'ProfilePic',array('user_id','image','last_updated', 'type', 'size')); |
|
75 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'ProfilePic', array('user_id', 'image', 'last_updated', 'type', 'size')); |
|
76 | 76 | $profile_pic = $sql->fetch(); |
77 | 77 | } catch (PDOException $e) { |
78 | 78 | return 'getProfilePic failed: ' . $e->getMessage(); |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class AuthenticationDAO extends BaseDAO { |
25 | 25 | |
26 | - /** |
|
27 | - * |
|
28 | - * @param type $email_address |
|
29 | - * @param type $password |
|
30 | - * @return type |
|
31 | - */ |
|
32 | - public static function authenticateUser($email_address, $password) { |
|
26 | + /** |
|
27 | + * |
|
28 | + * @param type $email_address |
|
29 | + * @param type $password |
|
30 | + * @return type |
|
31 | + */ |
|
32 | + public static function authenticateUser($email_address, $password) { |
|
33 | 33 | |
34 | 34 | $md5_password = md5($password); |
35 | 35 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | BaseDAO::closeConnection($link); |
58 | 58 | return $row; |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | 61 | public static function storeAuthToken($token, User $authUser){ |
62 | 62 |
@@ -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 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | return $row; |
59 | 59 | } |
60 | 60 | |
61 | - public static function storeAuthToken($token, User $authUser){ |
|
61 | + public static function storeAuthToken($token, User $authUser) { |
|
62 | 62 | |
63 | 63 | $user_id = intval($authUser->getUser_id()); |
64 | 64 | $access_token = $token['access_token']; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | try { |
97 | 97 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
98 | 98 | $count = $sql->rowCount(); |
99 | - if($count > 0){ |
|
99 | + if ($count > 0) { |
|
100 | 100 | $id = $link->lastInsertId(); |
101 | 101 | } |
102 | 102 | } catch (PDOException $e) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | - public static function getAuthTokenByUserId(User $authUser){ |
|
112 | + public static function getAuthTokenByUserId(User $authUser) { |
|
113 | 113 | |
114 | 114 | $user_id = intval($authUser->getUser_id()); |
115 | 115 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | try { |
126 | 126 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
127 | 127 | $count = $sql->rowCount(); |
128 | - if($count > 0){ |
|
128 | + if ($count > 0) { |
|
129 | 129 | $id = $link->lastInsertId(); |
130 | 130 | } |
131 | 131 | } catch (PDOException $e) { |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | ini_set("display_errors", 1); |
7 | 7 | set_time_limit(0); |
8 | 8 | |
9 | -if(!isset($_SESSION)){ |
|
9 | +if (!isset($_SESSION)) { |
|
10 | 10 | session_start(); |
11 | 11 | } |
12 | 12 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | require_once '../dao/BaseDAO.php'; |
17 | 17 | require_once '../model/User.php'; |
18 | 18 | |
19 | -class UserDAO extends BaseDAO{ |
|
19 | +class UserDAO extends BaseDAO { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param type $password |
25 | 25 | * @return type |
26 | 26 | */ |
27 | - public static function getUserByCredentials($email_address, $password){ |
|
27 | + public static function getUserByCredentials($email_address, $password) { |
|
28 | 28 | |
29 | 29 | /* |
30 | 30 | * SELECT u.firstname, u.lastname, ur.user_role FROM tc.user u, tc.user_role ur |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | try { |
53 | 53 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
54 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'User', array('user_id', 'email', 'firstname', 'lastname', 'is_confirmed', 'user_role')); |
|
54 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'User', array('user_id', 'email', 'firstname', 'lastname', 'is_confirmed', 'user_role')); |
|
55 | 55 | $row = $sql->fetch(); |
56 | 56 | //var_dump($row); |
57 | 57 | } catch (PDOException $e) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $row = null; |
77 | 77 | try { |
78 | 78 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
79 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'User'); |
|
79 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'User'); |
|
80 | 80 | $row = $sql->fetch(); |
81 | 81 | //var_dump($row); |
82 | 82 | } catch (PDOException $e) { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $row = null; |
102 | 102 | try { |
103 | 103 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
104 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'User'); |
|
104 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'User'); |
|
105 | 105 | $row = $sql->fetch(); |
106 | 106 | //var_dump($row); |
107 | 107 | } catch (PDOException $e) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | try { |
133 | 133 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
134 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'User'); |
|
134 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'User'); |
|
135 | 135 | $user = $sql->fetch(); |
136 | 136 | //var_dump($row); |
137 | 137 | } catch (PDOException $e) { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | try { |
163 | 163 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
164 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'User'); |
|
164 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'User'); |
|
165 | 165 | $user = $sql->fetch(); |
166 | 166 | } catch (PDOException $e) { |
167 | 167 | return 'getUserByJobSeekerProfileId failed: ' . $e->getMessage(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | return $user; |
171 | 171 | } |
172 | 172 | |
173 | - public static function registerUser(User $user){ |
|
173 | + public static function registerUser(User $user) { |
|
174 | 174 | |
175 | 175 | $email = $user->getEmail(); |
176 | 176 | $name = $user->getName(); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | try { |
209 | 209 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
210 | 210 | $count = $sql->rowCount(); |
211 | - if($count > 0){ |
|
211 | + if ($count > 0) { |
|
212 | 212 | $user_id = $link->lastInsertId(); |
213 | 213 | } |
214 | 214 | $user->setUser_id($user_id); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | return $count > 0; |
275 | 275 | } |
276 | 276 | |
277 | - public static function validateEmail($emailAddress){ |
|
277 | + public static function validateEmail($emailAddress) { |
|
278 | 278 | |
279 | 279 | /* |
280 | 280 | * SELECT user_id FROM tc.user WHERE email = ''; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | ini_set("display_errors", 1); |
7 | 7 | set_time_limit(0); |
8 | 8 | |
9 | - if(!isset($_SESSION)){ |
|
9 | + if (!isset($_SESSION)) { |
|
10 | 10 | session_start(); |
11 | 11 | } |
12 | 12 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | try { |
50 | 50 | $sql->execute() or die("ERROR: " . implode(":", $conn->errorInfo())); |
51 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobSeekerProfile'); |
|
51 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobSeekerProfile'); |
|
52 | 52 | $profile = $sql->fetch(); |
53 | 53 | //var_dump($rows); |
54 | 54 | } catch (PDOException $e) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | try { |
90 | 90 | $sql->execute() or die("ERROR: " . implode(":", $conn->errorInfo())); |
91 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobSeekerProfile'); |
|
91 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobSeekerProfile'); |
|
92 | 92 | $rows = $sql->fetch(); |
93 | 93 | //var_dump($rows); |
94 | 94 | } catch (PDOException $e) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | try { |
120 | 120 | $sql->execute() or die("ERROR: " . implode(":", $conn->errorInfo())); |
121 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobSeekerProfileAnswer'); |
|
121 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobSeekerProfileAnswer'); |
|
122 | 122 | $rows = $sql->fetchAll(); |
123 | 123 | //var_dump($rows); |
124 | 124 | } catch (PDOException $e) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param int $user_id |
135 | 135 | * @return int job_seeker_profile_id |
136 | 136 | */ |
137 | - public static function addJobSeekerProfile($jobSeekerProfile,$user_id){ |
|
137 | + public static function addJobSeekerProfile($jobSeekerProfile, $user_id) { |
|
138 | 138 | |
139 | 139 | $user_id_int = intval($user_id); |
140 | 140 | $jobSeekerProfile_link = $jobSeekerProfile->getJob_seeker_profile_link(); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | "; |
176 | 176 | $answer_value_strings = []; |
177 | 177 | $answer_data = []; |
178 | - foreach($jobSeekerProfile->getJob_seeker_profile_answers() as $answer) { |
|
178 | + foreach ($jobSeekerProfile->getJob_seeker_profile_answers() as $answer) { |
|
179 | 179 | $answer_value_strings[] = '(@job_seeker_profile_id, ?, ?)'; |
180 | 180 | $answer_data[] = $answer->getJob_seeker_profile_question_id(); |
181 | 181 | $answer_data[] = $answer->getAnswer(); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $link->beginTransaction(); |
203 | 203 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
204 | 204 | $job_seeker_profile_id = $link->lastInsertId(); |
205 | - $sql_id->execute()or die("ERROR: " . implode(":", $link->errorInfo())); |
|
205 | + $sql_id->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
|
206 | 206 | $sql_user2profile->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
207 | 207 | if (sizeof($answer_data) > 0) { |
208 | 208 | $sql_answers->execute($answer_data) or die("ERROR: " . implode(":", $link->errorInfo())); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | try { |
260 | 260 | $sql->execute() or die("ERROR: " . implode(":", $link->errorInfo())); |
261 | - $sql->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'JobSeekerProfile'); |
|
261 | + $sql->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'JobSeekerProfile'); |
|
262 | 262 | $rows = $sql->fetchAll(); |
263 | 263 | } catch (PDOException $e) { |
264 | 264 | return 'getJobSeekers failed: ' . $e->getMessage(); |