@@ -38,7 +38,7 @@ |
||
38 | 38 | "error" => '', |
39 | 39 | ); |
40 | 40 | |
41 | - }catch (Exception $e) { |
|
41 | + } catch (Exception $e) { |
|
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $ret = []; |
35 | 35 | |
36 | 36 | foreach ($rows as $row) { |
37 | - $isVisible = in_array((int) $row['id'], $foldersId); |
|
37 | + $isVisible = in_array((int) $row['id'], $foldersId); |
|
38 | 38 | $childrens = $this->getFoldersChildren($row['id'], $foldersId); |
39 | 39 | |
40 | 40 | if ($isVisible || count($childrens) > 0) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | [ |
44 | 44 | 'id' => (int) $row['id'], |
45 | 45 | 'title' => $row['title'], |
46 | - 'isVisible' => $isVisible, |
|
46 | + 'isVisible' => $isVisible, |
|
47 | 47 | 'childrens' => $childrens |
48 | 48 | ] |
49 | 49 | ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | if ( count($childrens) > 0) { |
65 | 65 | foreach ($childrens as $children) { |
66 | - $isVisible = in_array((int) $children['id'], $foldersId); |
|
66 | + $isVisible = in_array((int) $children['id'], $foldersId); |
|
67 | 67 | $childs = $this->getFoldersChildren($children['id'], $foldersId); |
68 | 68 | |
69 | 69 | if (in_array((int) $children['id'], $foldersId) || count($childs) > 0) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | [ |
73 | 73 | 'id' => (int) $children['id'], |
74 | 74 | 'title' => $children['title'], |
75 | - 'isVisible' => $isVisible, |
|
75 | + 'isVisible' => $isVisible, |
|
76 | 76 | 'childrens' => $childs |
77 | 77 | ] |
78 | 78 | ); |
@@ -3886,7 +3886,9 @@ |
||
3886 | 3886 | ); |
3887 | 3887 | |
3888 | 3888 | // if not exists then error |
3889 | - if (is_null($val) === true || count($val) === 0 || defined('UPGRADE_MIN_DATE') === false) return true; |
|
3889 | + if (is_null($val) === true || count($val) === 0 || defined('UPGRADE_MIN_DATE') === false) { |
|
3890 | + return true; |
|
3891 | + } |
|
3890 | 3892 | |
3891 | 3893 | // if empty or too old then error |
3892 | 3894 | if (empty($val['valeur']) === true || (int) $val['valeur'] < (int) UPGRADE_MIN_DATE) { |
@@ -2225,7 +2225,7 @@ discard block |
||
2225 | 2225 | * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt> |
2226 | 2226 | * |
2227 | 2227 | * @author Jeppe Toustrup (tenzer at tenzer dot dk) |
2228 | - * |
|
2228 | + * |
|
2229 | 2229 | * @param string $path An either relative or absolute path to a file or directory which should be processed. |
2230 | 2230 | * @param int $filePerm The permissions any found files should get. |
2231 | 2231 | * @param int $dirPerm The permissions any found folder should get. |
@@ -3848,7 +3848,6 @@ discard block |
||
3848 | 3848 | * @param integer $processId |
3849 | 3849 | * @param integer $nbItemsToTreat |
3850 | 3850 | * @return void |
3851 | - |
|
3852 | 3851 | */ |
3853 | 3852 | function createUserTasks($processId, $nbItemsToTreat): void |
3854 | 3853 | { |
@@ -128,8 +128,7 @@ |
||
128 | 128 | </div> |
129 | 129 | <?php |
130 | 130 | } |
131 | -} |
|
132 | -catch (Exception $e) { |
|
131 | +} catch (Exception $e) { |
|
133 | 132 | echo $e->getMessage(); |
134 | 133 | }?> |
135 | 134 | </div> |
@@ -207,8 +207,7 @@ |
||
207 | 207 | </div> |
208 | 208 | <?php |
209 | 209 | } |
210 | -} |
|
211 | -catch (Exception $e) { |
|
210 | +} catch (Exception $e) { |
|
212 | 211 | echo $e->getMessage(); |
213 | 212 | } |
214 | 213 | ?> |
@@ -2603,7 +2603,9 @@ |
||
2603 | 2603 | } |
2604 | 2604 | |
2605 | 2605 | foreach ($results as $adUser) { |
2606 | - if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue; |
|
2606 | + if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) { |
|
2607 | + continue; |
|
2608 | + } |
|
2607 | 2609 | // Build the list of all groups in AD |
2608 | 2610 | if (isset($adUser['memberof']) === true) { |
2609 | 2611 | foreach($adUser['memberof'] as $j => $adUserGroup) { |
@@ -1822,7 +1822,9 @@ |
||
1822 | 1822 | $inputData['itemId'] |
1823 | 1823 | ); |
1824 | 1824 | foreach ($rows as $record) { |
1825 | - if ($record['raison'] === NULL) continue; |
|
1825 | + if ($record['raison'] === NULL) { |
|
1826 | + continue; |
|
1827 | + } |
|
1826 | 1828 | $reason = explode(':', $record['raison']); |
1827 | 1829 | if (count($reason) > 0) { |
1828 | 1830 | $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - ' |
@@ -37,45 +37,45 @@ discard block |
||
37 | 37 | * @return boolean |
38 | 38 | */ |
39 | 39 | function is_jwt_valid($jwt) { |
40 | - try { |
|
41 | - $decoded = (array) JWT::decode($jwt, new Key(DB_PASSWD, 'HS256')); |
|
40 | + try { |
|
41 | + $decoded = (array) JWT::decode($jwt, new Key(DB_PASSWD, 'HS256')); |
|
42 | 42 | |
43 | - // Check if expiration is reached |
|
44 | - if ($decoded['exp'] - time() < 0) { |
|
45 | - return false; |
|
46 | - } |
|
43 | + // Check if expiration is reached |
|
44 | + if ($decoded['exp'] - time() < 0) { |
|
45 | + return false; |
|
46 | + } |
|
47 | 47 | /* |
48 | 48 | $decoded1 = JWT::decode($jwt, new Key(DB_PASSWD, 'HS256'), $headers = new stdClass()); |
49 | 49 | print_r($headers); |
50 | 50 | */ |
51 | 51 | |
52 | - return true; |
|
53 | - } catch (InvalidArgumentException $e) { |
|
54 | - // provided key/key-array is empty or malformed. |
|
55 | - return false; |
|
56 | - } catch (DomainException $e) { |
|
57 | - // provided algorithm is unsupported OR |
|
58 | - // provided key is invalid OR |
|
59 | - // unknown error thrown in openSSL or libsodium OR |
|
60 | - // libsodium is required but not available. |
|
61 | - return false; |
|
62 | - } catch (SignatureInvalidException $e) { |
|
63 | - // provided JWT signature verification failed. |
|
64 | - return false; |
|
65 | - } catch (BeforeValidException $e) { |
|
66 | - // provided JWT is trying to be used before "nbf" claim OR |
|
67 | - // provided JWT is trying to be used before "iat" claim. |
|
68 | - return false; |
|
69 | - } catch (ExpiredException $e) { |
|
70 | - // provided JWT is trying to be used after "exp" claim. |
|
71 | - return false; |
|
72 | - } catch (UnexpectedValueException $e) { |
|
73 | - // provided JWT is malformed OR |
|
74 | - // provided JWT is missing an algorithm / using an unsupported algorithm OR |
|
75 | - // provided JWT algorithm does not match provided key OR |
|
76 | - // provided key ID in key/key-array is empty or invalid. |
|
77 | - return false; |
|
78 | - } |
|
52 | + return true; |
|
53 | + } catch (InvalidArgumentException $e) { |
|
54 | + // provided key/key-array is empty or malformed. |
|
55 | + return false; |
|
56 | + } catch (DomainException $e) { |
|
57 | + // provided algorithm is unsupported OR |
|
58 | + // provided key is invalid OR |
|
59 | + // unknown error thrown in openSSL or libsodium OR |
|
60 | + // libsodium is required but not available. |
|
61 | + return false; |
|
62 | + } catch (SignatureInvalidException $e) { |
|
63 | + // provided JWT signature verification failed. |
|
64 | + return false; |
|
65 | + } catch (BeforeValidException $e) { |
|
66 | + // provided JWT is trying to be used before "nbf" claim OR |
|
67 | + // provided JWT is trying to be used before "iat" claim. |
|
68 | + return false; |
|
69 | + } catch (ExpiredException $e) { |
|
70 | + // provided JWT is trying to be used after "exp" claim. |
|
71 | + return false; |
|
72 | + } catch (UnexpectedValueException $e) { |
|
73 | + // provided JWT is malformed OR |
|
74 | + // provided JWT is missing an algorithm / using an unsupported algorithm OR |
|
75 | + // provided JWT algorithm does not match provided key OR |
|
76 | + // provided key ID in key/key-array is empty or invalid. |
|
77 | + return false; |
|
78 | + } |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | function base64url_encode($data) { |
@@ -83,24 +83,24 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | function get_authorization_header(){ |
86 | - $superGlobal = new SuperGlobal(); |
|
87 | - $headers = null; |
|
86 | + $superGlobal = new SuperGlobal(); |
|
87 | + $headers = null; |
|
88 | 88 | |
89 | - if (null !== $superGlobal->get('Authorization', 'SERVER')) { |
|
90 | - $headers = trim($superGlobal->get('Authorization', 'SERVER')); |
|
91 | - } else if (null !== $superGlobal->get('HTTP_AUTHORIZATION', 'SERVER')) { //Nginx or fast CGI |
|
92 | - $headers = trim($superGlobal->get('HTTP_AUTHORIZATION', 'SERVER')); |
|
93 | - } else if (function_exists('apache_request_headers') === true) { |
|
94 | - $requestHeaders = (array) apache_request_headers(); |
|
95 | - // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization) |
|
96 | - $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders)); |
|
97 | - //print_r($requestHeaders); |
|
98 | - if (isset($requestHeaders['Authorization']) === true) { |
|
99 | - $headers = trim($requestHeaders['Authorization']); |
|
100 | - } |
|
101 | - } |
|
89 | + if (null !== $superGlobal->get('Authorization', 'SERVER')) { |
|
90 | + $headers = trim($superGlobal->get('Authorization', 'SERVER')); |
|
91 | + } else if (null !== $superGlobal->get('HTTP_AUTHORIZATION', 'SERVER')) { //Nginx or fast CGI |
|
92 | + $headers = trim($superGlobal->get('HTTP_AUTHORIZATION', 'SERVER')); |
|
93 | + } else if (function_exists('apache_request_headers') === true) { |
|
94 | + $requestHeaders = (array) apache_request_headers(); |
|
95 | + // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization) |
|
96 | + $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders)); |
|
97 | + //print_r($requestHeaders); |
|
98 | + if (isset($requestHeaders['Authorization']) === true) { |
|
99 | + $headers = trim($requestHeaders['Authorization']); |
|
100 | + } |
|
101 | + } |
|
102 | 102 | |
103 | - return $headers; |
|
103 | + return $headers; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | function get_bearer_token() { |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | |
118 | 118 | function get_bearer_data($jwt) { |
119 | 119 | // split the jwt |
120 | - $tokenParts = explode('.', $jwt); |
|
121 | - $payload = base64_decode($tokenParts[1]); |
|
120 | + $tokenParts = explode('.', $jwt); |
|
121 | + $payload = base64_decode($tokenParts[1]); |
|
122 | 122 | |
123 | 123 | // HEADER: Get the access token from the header |
124 | 124 | if (empty($payload) === false) { |
@@ -133,7 +133,7 @@ |
||
133 | 133 | { |
134 | 134 | include API_ROOT_PATH . '/../includes/config/tp.config.php'; |
135 | 135 | |
136 | - $payload = [ |
|
136 | + $payload = [ |
|
137 | 137 | 'username' => $login, |
138 | 138 | 'id' => $id, |
139 | 139 | 'exp' => (time() + $SETTINGS['api_token_duration'] + 600), |