@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | // Get items |
51 | 51 | $rows = DB::query( |
52 | 52 | 'SELECT i.id, label, description, i.pw, i.url, i.id_tree, i.login, i.email, i.viewed_no, i.fa_icon, i.inactif, i.perso, t.title as folder_label |
53 | - FROM ' . prefixTable('items') . ' AS i |
|
53 | + FROM ' . prefixTable('items').' AS i |
|
54 | 54 | LEFT JOIN '.prefixTable('nested_tree').' as t ON (t.id = i.id_tree) '. |
55 | - $sqlExtra . |
|
56 | - " ORDER BY i.id ASC" . |
|
57 | - ($limit > 0 ? " LIMIT ". $limit : '') |
|
55 | + $sqlExtra. |
|
56 | + " ORDER BY i.id ASC". |
|
57 | + ($limit > 0 ? " LIMIT ".$limit : '') |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | $ret = []; |
61 | 61 | foreach ($rows as $row) { |
62 | 62 | $userKey = DB::queryfirstrow( |
63 | 63 | 'SELECT share_key |
64 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
64 | + FROM ' . prefixTable('sharekeys_items').' |
|
65 | 65 | WHERE user_id = %i AND object_id = %i', |
66 | 66 | $userId, |
67 | 67 | $row['id'] |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if (empty($path) === true) { |
99 | 99 | $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
100 | 100 | } else { |
101 | - $path .= '/' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
101 | + $path .= '/'.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ) : array |
149 | 149 | { |
150 | 150 | try { |
151 | - include_once API_ROOT_PATH . '/../sources/main.functions.php'; |
|
151 | + include_once API_ROOT_PATH.'/../sources/main.functions.php'; |
|
152 | 152 | |
153 | 153 | // Load config |
154 | 154 | $configManager = new ConfigManager(); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | if (strlen($password) > $SETTINGS['pwd_maximum_length']) { |
274 | - throw new Exception('Password is too long (max allowed is ' . $SETTINGS['pwd_maximum_length'] . ' characters)'); |
|
274 | + throw new Exception('Password is too long (max allowed is '.$SETTINGS['pwd_maximum_length'].' characters)'); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | { |
285 | 285 | $dataFolderSettings = DB::queryFirstRow( |
286 | 286 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
287 | - FROM ' . prefixTable('nested_tree') . ' |
|
287 | + FROM ' . prefixTable('nested_tree').' |
|
288 | 288 | WHERE id = %i', |
289 | 289 | $folderId |
290 | 290 | ); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | { |
308 | 308 | $folderComplexity = DB::queryFirstRow( |
309 | 309 | 'SELECT valeur |
310 | - FROM ' . prefixTable('misc') . ' |
|
310 | + FROM ' . prefixTable('misc').' |
|
311 | 311 | WHERE type = %s AND intitule = %i', |
312 | 312 | 'complex', |
313 | 313 | $itemInfos['folderId'] |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | private function checkForDuplicates(string $label, array $SETTINGS, array $itemInfos) : void |
336 | 336 | { |
337 | 337 | DB::queryFirstRow( |
338 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
338 | + 'SELECT * FROM '.prefixTable('items').' |
|
339 | 339 | WHERE label = %s AND inactif = %i', |
340 | 340 | $label, |
341 | 341 | 0 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // SQL where clause with folders list |
56 | 56 | if (isset($arrQueryStringParams['folders']) === true) { |
57 | 57 | // convert the folders to an array |
58 | - $arrQueryStringParams['folders'] = explode(',', str_replace( array('[',']') , '' , $arrQueryStringParams['folders'])); |
|
58 | + $arrQueryStringParams['folders'] = explode(',', str_replace(array('[', ']'), '', $arrQueryStringParams['folders'])); |
|
59 | 59 | |
60 | 60 | // ensure to only use the intersection |
61 | 61 | $foldersList = implode(',', array_intersect($arrQueryStringParams['folders'], $userData['folders_list'])); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } else { |
217 | 217 | // Gérer le cas où les paramètres ne sont pas un tableau |
218 | 218 | $strErrorDesc = 'Data not consistent'; |
219 | - $strErrorHeader = 'Expected array, received ' . gettype($arrQueryStringParams); |
|
219 | + $strErrorHeader = 'Expected array, received '.gettype($arrQueryStringParams); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | } else { |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | // SQL where clause with item id |
264 | 264 | if (isset($arrQueryStringParams['id']) === true) { |
265 | 265 | // build sql where clause by ID |
266 | - $sqlExtra = ' WHERE i.id = '.$arrQueryStringParams['id'] . $sql_constraint; |
|
266 | + $sqlExtra = ' WHERE i.id = '.$arrQueryStringParams['id'].$sql_constraint; |
|
267 | 267 | } else if (isset($arrQueryStringParams['label']) === true) { |
268 | 268 | // build sql where clause by LABEL |
269 | - $sqlExtra = ' WHERE i.label '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['label'] : ' = '.$arrQueryStringParams['label']) . $sql_constraint; |
|
269 | + $sqlExtra = ' WHERE i.label '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['label'] : ' = '.$arrQueryStringParams['label']).$sql_constraint; |
|
270 | 270 | } else if (isset($arrQueryStringParams['description']) === true) { |
271 | 271 | // build sql where clause by LABEL |
272 | 272 | $sqlExtra = ' WHERE i.description '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['description'] : ' = '.$arrQueryStringParams['description']).$sql_constraint; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ) { |
77 | 77 | // Not allowed page |
78 | 78 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
79 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
79 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
80 | 80 | exit; |
81 | 81 | } |
82 | 82 | |
@@ -118,19 +118,19 @@ discard block |
||
118 | 118 | $get_filename = str_replace('"', '\"', $get_filename); |
119 | 119 | |
120 | 120 | // Use Content-Disposition header with double quotes around filename |
121 | -header('Content-Disposition: attachment; filename="' . rawurldecode($get_filename) . '"'); |
|
121 | +header('Content-Disposition: attachment; filename="'.rawurldecode($get_filename).'"'); |
|
122 | 122 | header('Content-Type: application/octet-stream'); |
123 | 123 | header('Cache-Control: must-revalidate, no-cache, no-store'); |
124 | 124 | header('Expires: 0'); |
125 | 125 | if (null !== $request->query->get('pathIsFiles') && (int) $get_pathIsFiles === 1) { |
126 | - readfile($SETTINGS['path_to_files_folder'] . '/' . basename($get_filename)); |
|
126 | + readfile($SETTINGS['path_to_files_folder'].'/'.basename($get_filename)); |
|
127 | 127 | } else { |
128 | 128 | // get file key |
129 | 129 | $file_info = DB::queryfirstrow( |
130 | 130 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension, |
131 | 131 | s.share_key AS share_key |
132 | - FROM ' . prefixTable('files') . ' AS f |
|
133 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
132 | + FROM ' . prefixTable('files').' AS f |
|
133 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
134 | 134 | WHERE s.user_id = %i AND s.object_id = %i', |
135 | 135 | $session->get('user-id'), |
136 | 136 | $get_fileid |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | // if not encrypted |
150 | 150 | $file_info = DB::queryfirstrow( |
151 | 151 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension |
152 | - FROM ' . prefixTable('files') . ' AS f |
|
152 | + FROM ' . prefixTable('files').' AS f |
|
153 | 153 | WHERE f.id = %i', |
154 | 154 | $get_fileid |
155 | 155 | ); |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | // Set the filename of the download |
160 | 160 | $filename = basename($file_info['name'], '.'.$file_info['extension']); |
161 | 161 | $filename = isBase64($filename) === true ? base64_decode($filename) : $filename; |
162 | - $filename = $filename . '.' . $file_info['extension']; |
|
162 | + $filename = $filename.'.'.$file_info['extension']; |
|
163 | 163 | // Get the full path to the file to be downloaded |
164 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' .TP_FILE_PREFIX . $file_info['file'])) { |
|
165 | - $filePath = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . $file_info['file']; |
|
164 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file'])) { |
|
165 | + $filePath = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file']; |
|
166 | 166 | } else { |
167 | - $filePath = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file_info['file']); |
|
167 | + $filePath = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file_info['file']); |
|
168 | 168 | } |
169 | 169 | $filePath = realpath($filePath); |
170 | 170 | |
171 | - if (WIP === true) error_log('downloadFile.php: filePath: ' . $filePath." - "); |
|
171 | + if (WIP === true) error_log('downloadFile.php: filePath: '.$filePath." - "); |
|
172 | 172 | |
173 | 173 | if ($filePath && is_readable($filePath) && strpos($filePath, realpath($SETTINGS['path_to_upload_folder'])) === 0) { |
174 | 174 | header('Content-Description: File Transfer'); |
175 | 175 | header('Content-Type: application/octet-stream'); |
176 | - header('Content-Disposition: attachment; filename="' . basename($filename) . '"'); |
|
176 | + header('Content-Disposition: attachment; filename="'.basename($filename).'"'); |
|
177 | 177 | header('Expires: 0'); |
178 | 178 | header('Cache-Control: must-revalidate'); |
179 | 179 | header('Pragma: public'); |
180 | - header('Content-Length: ' . filesize($filePath)); |
|
180 | + header('Content-Length: '.filesize($filePath)); |
|
181 | 181 | flush(); // Clear system output buffer |
182 | 182 | if (empty($fileContent) === true) { |
183 | 183 | // deepcode ignore PT: File and path are secured directly inside the function decryptFile() |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ) { |
79 | 79 | // Not allowed page |
80 | 80 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
81 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
81 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
82 | 82 | exit; |
83 | 83 | } |
84 | 84 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $lexer = new Lexer($config); |
167 | 167 | $config->setIgnoreHeaderLine('true'); |
168 | 168 | $interpreter = new Interpreter(); |
169 | - $interpreter->addObserver(function (array $row) use (&$valuesToImport,$header) { |
|
169 | + $interpreter->addObserver(function(array $row) use (&$valuesToImport, $header) { |
|
170 | 170 | $rowData = array_combine($header, $row); |
171 | 171 | $valuesToImport[] = array( |
172 | 172 | 'Label' => $rowData['label'], |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | ]; |
708 | 708 | $startPathLevel = 1; |
709 | 709 | |
710 | - foreach($post_folders as $folder) { |
|
710 | + foreach ($post_folders as $folder) { |
|
711 | 711 | // get parent id |
712 | 712 | $parentId = $arrFolders[$folder['parentFolderId']]; |
713 | 713 | |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | DB::startTransaction(); |
779 | 779 | |
780 | 780 | // Import all items |
781 | - foreach($post_items as $item) { |
|
781 | + foreach ($post_items as $item) { |
|
782 | 782 | // get info about this folder |
783 | 783 | $destinationFolderMore = DB::queryFirstRow( |
784 | 784 | 'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | ]; |
1020 | 1020 | } |
1021 | 1021 | |
1022 | -spl_autoload_register(function ($class) { |
|
1022 | +spl_autoload_register(function($class) { |
|
1023 | 1023 | $prefix = 'League\\Csv\\'; |
1024 | 1024 | $base_dir = __DIR__.'/src/'; |
1025 | 1025 | $len = strlen($prefix); |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | header("Access-Control-Allow-Methods: POST, GET"); |
40 | 40 | header("Access-Control-Max-Age: 3600"); |
41 | 41 | header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"); |
42 | -require __DIR__ . "/inc/bootstrap.php"; |
|
42 | +require __DIR__."/inc/bootstrap.php"; |
|
43 | 43 | |
44 | 44 | // sanitize url segments |
45 | 45 | $base = new BaseController(); |
46 | 46 | $uri = $base->getUriSegments(); |
47 | 47 | if (!is_array($uri)) { |
48 | - $uri = [$uri]; // ensure $uril is table |
|
48 | + $uri = [$uri]; // ensure $uril is table |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // Prepare DB password |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | if ($uri[0] === 'authorize') { |
62 | 62 | // Is API enabled in Teampass settings |
63 | 63 | if ($apiStatus['error'] === false) { |
64 | - require API_ROOT_PATH . "/Controller/Api/AuthController.php"; |
|
64 | + require API_ROOT_PATH."/Controller/Api/AuthController.php"; |
|
65 | 65 | $objFeedController = new AuthController(); |
66 | - $strMethodName = $uri[0] . 'Action'; |
|
66 | + $strMethodName = $uri[0].'Action'; |
|
67 | 67 | $objFeedController->{$strMethodName}(); |
68 | 68 | } else { |
69 | 69 | // Error management |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | |
90 | 90 | // action related to USER |
91 | 91 | } elseif ($controller === 'user') { |
92 | - require API_ROOT_PATH . "/Controller/Api/UserController.php"; |
|
92 | + require API_ROOT_PATH."/Controller/Api/UserController.php"; |
|
93 | 93 | $objFeedController = new UserController(); |
94 | - $strMethodName = (string) $action . 'Action'; |
|
94 | + $strMethodName = (string) $action.'Action'; |
|
95 | 95 | $objFeedController->{$strMethodName}(); |
96 | 96 | |
97 | 97 | // action related to ITEM |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $postType = $request->query->get('post_type', ''); |
48 | 48 | $postType = filter_var($postType, FILTER_SANITIZE_SPECIAL_CHARS); |
49 | 49 | $get['post_type'] = $postType; |
50 | -if (isset($SETTINGS['duo']) === true && (int) $SETTINGS['duo'] === 1 && $get['post_type'] === 'duo' ) { |
|
50 | +if (isset($SETTINGS['duo']) === true && (int) $SETTINGS['duo'] === 1 && $get['post_type'] === 'duo') { |
|
51 | 51 | $get['duo_state'] = $request->query->get('state'); |
52 | 52 | $get['duo_code'] = $request->query->get('duo_code'); |
53 | 53 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | exit; |
78 | 78 | } else { |
79 | 79 | // Gérer les erreurs |
80 | - echo 'Erreur lors de la récupération des informations utilisateur : ' . htmlspecialchars($userInfo['message'], ENT_QUOTES, 'UTF-8'); |
|
80 | + echo 'Erreur lors de la récupération des informations utilisateur : '.htmlspecialchars($userInfo['message'], ENT_QUOTES, 'UTF-8'); |
|
81 | 81 | }; |
82 | 82 | } |
83 | 83 | |
@@ -100,8 +100,7 @@ discard block |
||
100 | 100 | <div class="login-box"> |
101 | 101 | <div class="login-logo"><div style="margin:30px;">', |
102 | 102 | isset($SETTINGS['custom_logo']) === true && empty($SETTINGS['custom_logo']) === false ? |
103 | - '<img src="' . (string) $SETTINGS['custom_logo'] . '" alt="" style="text-align:center; max-width:100px;" />' : |
|
104 | - '<img src="includes/images/teampass-logo2-login.png" alt="Teampass Logo">', |
|
103 | + '<img src="'.(string) $SETTINGS['custom_logo'].'" alt="" style="text-align:center; max-width:100px;" />' : '<img src="includes/images/teampass-logo2-login.png" alt="Teampass Logo">', |
|
105 | 104 | ' |
106 | 105 | </div> |
107 | 106 | <div style="font-weight:bold;"> |
@@ -121,14 +120,14 @@ discard block |
||
121 | 120 | |
122 | 121 | <div class="card-body login-card-body1"> |
123 | 122 | <div class="input-group has-feedback mb-2"> |
124 | - <div class="input-group-prepend infotip" title="' . $lang->get('login') . '"> |
|
123 | + <div class="input-group-prepend infotip" title="' . $lang->get('login').'"> |
|
125 | 124 | <span class="input-group-text"><i class="fa-solid fa-user fa-fw"></i></span> |
126 | 125 | </div>'; |
127 | 126 | if ( |
128 | 127 | isset($SETTINGS['enable_http_request_login']) === true |
129 | 128 | && (int) $SETTINGS['enable_http_request_login'] === 1 |
130 | 129 | && $request->getUser() !== null |
131 | - && ! (isset($SETTINGS['maintenance_mode']) === true |
|
130 | + && !(isset($SETTINGS['maintenance_mode']) === true |
|
132 | 131 | && (int) $SETTINGS['maintenance_mode'] === 1) |
133 | 132 | ) { |
134 | 133 | if (strpos($request->getUser(), '@') !== false) { |
@@ -142,42 +141,42 @@ discard block |
||
142 | 141 | <input type="text" id="login" class="form-control" placeholder="', filter_var($username, FILTER_SANITIZE_FULL_SPECIAL_CHARS), '" readonly>'; |
143 | 142 | } else { |
144 | 143 | echo ' |
145 | - <input type="text" id="login" class="form-control" placeholder="' . $lang->get('index_login') . '" value="'.(null !== $session->get('user-login') && empty($session->get('user-login')) === false ? filter_var($session->get('user-login'), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '').'">'; |
|
144 | + <input type="text" id="login" class="form-control" placeholder="' . $lang->get('index_login').'" value="'.(null !== $session->get('user-login') && empty($session->get('user-login')) === false ? filter_var($session->get('user-login'), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '').'">'; |
|
146 | 145 | } |
147 | 146 | |
148 | 147 | echo ' |
149 | 148 | </div>'; |
150 | -if (! (isset($SETTINGS['enable_http_request_login']) === true |
|
149 | +if (!(isset($SETTINGS['enable_http_request_login']) === true |
|
151 | 150 | && (int) $SETTINGS['enable_http_request_login'] === 1 |
152 | 151 | && $request->getUser() !== null |
153 | - && ! (isset($SETTINGS['maintenance_mode']) === true |
|
152 | + && !(isset($SETTINGS['maintenance_mode']) === true |
|
154 | 153 | && (int) $SETTINGS['maintenance_mode'] === 1))) { |
155 | 154 | echo ' |
156 | 155 | <div class="input-group has-feedback mb-2"> |
157 | - <div class="input-group-prepend infotip" title="' . $lang->get('password') . '"> |
|
156 | + <div class="input-group-prepend infotip" title="' . $lang->get('password').'"> |
|
158 | 157 | <span class="input-group-text"><i class="fa-solid fa-lock fa-fw"></i></span> |
159 | 158 | </div> |
160 | - <input type="password" id="pw" class="form-control submit-button" placeholder="' . $lang->get('index_password') . '"> |
|
159 | + <input type="password" id="pw" class="form-control submit-button" placeholder="' . $lang->get('index_password').'"> |
|
161 | 160 | </div>'; |
162 | 161 | } |
163 | 162 | |
164 | 163 | echo ' |
165 | 164 | <div class="input-group has-feedback mb-2"> |
166 | - <div class="input-group-prepend infotip" title="' . $lang->get('session_expiration_in_minutes') . '"> |
|
165 | + <div class="input-group-prepend infotip" title="' . $lang->get('session_expiration_in_minutes').'"> |
|
167 | 166 | <span class="input-group-text"><i class="fa-solid fa-clock fa-fw"></i></span> |
168 | 167 | </div> |
169 | 168 | <input type="text" id="session_duration" class="form-control submit-button" |
170 | - placeholder="' . $lang->get('index_session_duration') .' (' . $lang->get('minutes') . ')" |
|
169 | + placeholder="' . $lang->get('index_session_duration').' ('.$lang->get('minutes').')" |
|
171 | 170 | value="', isset($SETTINGS['default_session_expiration_time']) === true ? $SETTINGS['default_session_expiration_time'] : '', '"> |
172 | 171 | </div>'; |
173 | 172 | // 2FA auth selector |
174 | 173 | $mfaHtmlPart = ' |
175 | - <input type="hidden" id="2fa_user_selection" value="'.htmlspecialchars((isset($get['post_type']) === true && $get['post_type'] === 'duo') ? 'duo' : ''). '"> |
|
176 | - <input type="hidden" id="duo_code" value="'.htmlspecialchars(isset($get['duo_code']) === true && is_null($get['duo_code']) === false ? $get['duo_code'] : ''). '"> |
|
177 | - <input type="hidden" id="duo_state" value="'.htmlspecialchars(isset($get['duo_state']) === true && is_null($get['duo_state']) === false ? $get['duo_state'] : ''). '"> |
|
174 | + <input type="hidden" id="2fa_user_selection" value="'.htmlspecialchars((isset($get['post_type']) === true && $get['post_type'] === 'duo') ? 'duo' : '').'"> |
|
175 | + <input type="hidden" id="duo_code" value="'.htmlspecialchars(isset($get['duo_code']) === true && is_null($get['duo_code']) === false ? $get['duo_code'] : '').'"> |
|
176 | + <input type="hidden" id="duo_state" value="'.htmlspecialchars(isset($get['duo_state']) === true && is_null($get['duo_state']) === false ? $get['duo_state'] : '').'"> |
|
178 | 177 | <div class="row mb-3 hidden" id="2fa_methods_selector"> |
179 | 178 | <div class="col-12"> |
180 | - <h8 class="login-box-msg">' . $lang->get('2fa_authentication_selector') . '</h8> |
|
179 | + <h8 class="login-box-msg">' . $lang->get('2fa_authentication_selector').'</h8> |
|
181 | 180 | <div class="2fa-methods text-center mt-2">'. |
182 | 181 | (isset($SETTINGS['google_authentication']) === true && (int) $SETTINGS['google_authentication'] === 1 ? |
183 | 182 | ' |
@@ -210,14 +209,14 @@ discard block |
||
210 | 209 | echo ' |
211 | 210 | <div id="div-2fa-google" class="mb-3 div-2fa-method hidden"> |
212 | 211 | <div class="input-group has-feedback mb-2"> |
213 | - <div class="input-group-prepend infotip" title="' . $lang->get('mfa_unique_code') . '"> |
|
212 | + <div class="input-group-prepend infotip" title="' . $lang->get('mfa_unique_code').'"> |
|
214 | 213 | <span class="input-group-text"><i class="fa-solid fa-key fa-fw"></i></span> |
215 | 214 | </div> |
216 | - <input type="text" id="ga_code" class="form-control submit-button" placeholder="' . $lang->get('ga_identification_code') . '" /> |
|
215 | + <input type="text" id="ga_code" class="form-control submit-button" placeholder="' . $lang->get('ga_identification_code').'" /> |
|
217 | 216 | <span class="input-group-append"> |
218 | 217 | <button type="button" class="btn btn-info btn-flat" onclick="send_user_new_temporary_ga_code()"> |
219 | 218 | <i class="fa-solid fa-envelope form-control-feedback pointer infotip" |
220 | - title="' . $lang->get('i_need_to_generate_new_ga_code') . '"></i> |
|
219 | + title="' . $lang->get('i_need_to_generate_new_ga_code').'"></i> |
|
221 | 220 | </button> |
222 | 221 | </span> |
223 | 222 | </div> |
@@ -235,7 +234,7 @@ discard block |
||
235 | 234 | <script> |
236 | 235 | var seconds = 1; |
237 | 236 | function updateLogonButton(timeToGo){ |
238 | - document.getElementById("but_identify_user").value = "' . $lang->get('duration_login_attempt') . ' " + timeToGo; |
|
237 | + document.getElementById("but_identify_user").value = "' . $lang->get('duration_login_attempt').' " + timeToGo; |
|
239 | 238 | } |
240 | 239 | $( window ).on( "load", function() { |
241 | 240 | updateLogonButton(seconds); |
@@ -244,7 +243,7 @@ discard block |
||
244 | 243 | if (seconds >= 0) { |
245 | 244 | updateLogonButton(seconds); |
246 | 245 | } else if(seconds === 0) { |
247 | - launchIdentify("", "' . $nextUrl . '"); |
|
246 | + launchIdentify("", "' . $nextUrl.'"); |
|
248 | 247 | } |
249 | 248 | updateLogonButton(seconds); |
250 | 249 | }, |
@@ -265,15 +264,15 @@ discard block |
||
265 | 264 | <div class="col-8"> |
266 | 265 | <div id="yubiko-new-key" class="alert alert-info hidden"> |
267 | 266 | <p> |
268 | - <input type="text" size="10" id="yubico_user_id" class="form-control" placeholder="' . $lang->get('yubico_user_id') . '"> |
|
267 | + <input type="text" size="10" id="yubico_user_id" class="form-control" placeholder="' . $lang->get('yubico_user_id').'"> |
|
269 | 268 | </p> |
270 | 269 | <p> |
271 | - <input type="text" size="10" id="yubico_user_key" class="form-control" placeholder="' . $lang->get('yubico_user_key') . '"> |
|
270 | + <input type="text" size="10" id="yubico_user_key" class="form-control" placeholder="' . $lang->get('yubico_user_key').'"> |
|
272 | 271 | </p> |
273 | 272 | </div> |
274 | - <input autocomplete="off" type="text" id="yubico_key" class="form-control submit-button" placeholder="' . $lang->get('press_your_yubico_key') . '"> |
|
273 | + <input autocomplete="off" type="text" id="yubico_key" class="form-control submit-button" placeholder="' . $lang->get('press_your_yubico_key').'"> |
|
275 | 274 | <div class="row"> |
276 | - <span class="ml-2 mt-1 font-weight-light small pointer" id="register-yubiko-key">' . $lang->get('register_new_yubiko_key') . '</span> |
|
275 | + <span class="ml-2 mt-1 font-weight-light small pointer" id="register-yubiko-key">' . $lang->get('register_new_yubiko_key').'</span> |
|
277 | 276 | </div> |
278 | 277 | </div> |
279 | 278 | </div>'; |
@@ -282,22 +281,22 @@ discard block |
||
282 | 281 | echo ' |
283 | 282 | <div class="row mt-5"> |
284 | 283 | <div class="col-12"> |
285 | - <button id="but_identify_user" class="btn btn-primary btn-block">' . $lang->get('log_in') . '</button> |
|
284 | + <button id="but_identify_user" class="btn btn-primary btn-block">' . $lang->get('log_in').'</button> |
|
286 | 285 | |
287 | 286 | <!-- In case of upgrade, the user has to provide his One Time Code --> |
288 | 287 | <div class="card-body user-one-time-code-card-body hidden"> |
289 | - <h5 class="login-box-msg">' . $lang->get('provide_personal_one_time_code') . '</h5> |
|
288 | + <h5 class="login-box-msg">' . $lang->get('provide_personal_one_time_code').'</h5> |
|
290 | 289 | |
291 | 290 | <div class="input-group has-feedback mb-2 mt-4"> |
292 | 291 | <div class="input-group-prepend"> |
293 | 292 | <span class="input-group-text"><i class="fa-solid fa-unlock-alt"></i></span> |
294 | 293 | </div> |
295 | - <input type="password" id="user-one-time-code" class="form-control" placeholder="' . $lang->get('one_time_code') . '"> |
|
294 | + <input type="password" id="user-one-time-code" class="form-control" placeholder="' . $lang->get('one_time_code').'"> |
|
296 | 295 | </div> |
297 | 296 | |
298 | 297 | <div class="row mb-3"> |
299 | 298 | <div class="col-12"> |
300 | - <button id="but_confirm_otc" class="btn btn-primary btn-block">' . $lang->get('confirm') . '</button> |
|
299 | + <button id="but_confirm_otc" class="btn btn-primary btn-block">' . $lang->get('confirm').'</button> |
|
301 | 300 | </div> |
302 | 301 | </div> |
303 | 302 | </div> |
@@ -312,7 +311,7 @@ discard block |
||
312 | 311 | <hr class="mt-3 mb-3"/> |
313 | 312 | <div class="row mb-2"> |
314 | 313 | <div class="col-12"> |
315 | - <button id="but_login_with_oauth2" class="btn btn-primary btn-block">' . $SETTINGS['oauth2_client_appname'] . '</button> |
|
314 | + <button id="but_login_with_oauth2" class="btn btn-primary btn-block">' . $SETTINGS['oauth2_client_appname'].'</button> |
|
316 | 315 | </div> |
317 | 316 | </div>'; |
318 | 317 | } |
@@ -325,10 +324,10 @@ discard block |
||
325 | 324 | // In case of password change |
326 | 325 | echo ' |
327 | 326 | <div class="card-body confirm-password-card-body hidden"> |
328 | - <h5 class="login-box-msg">' . $lang->get('new_password_required') . '</h5> |
|
327 | + <h5 class="login-box-msg">' . $lang->get('new_password_required').'</h5> |
|
329 | 328 | |
330 | 329 | <div class="alert alert-info"> |
331 | - <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('password_strength') . ' |
|
330 | + <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('password_strength').' |
|
332 | 331 | <span id="confirm-password-level" class="ml-2 font-weight-bold"></span></div> |
333 | 332 | </div> |
334 | 333 | |
@@ -338,20 +337,20 @@ discard block |
||
338 | 337 | <div class="input-group-prepend"> |
339 | 338 | <span class="input-group-text"><i class="fas fa-key"></i></span> |
340 | 339 | </div> |
341 | - <input type="password" id="current-user-password" class="form-control" placeholder="' . $lang->get('current_password') . '"> |
|
340 | + <input type="password" id="current-user-password" class="form-control" placeholder="' . $lang->get('current_password').'"> |
|
342 | 341 | </div> |
343 | 342 | </div> |
344 | 343 | <div class="input-group has-feedback mb-2 mt-4"> |
345 | 344 | <div class="input-group-prepend"> |
346 | 345 | <span class="input-group-text"><i class="fas fa-key"></i></span> |
347 | 346 | </div> |
348 | - <input type="password" id="new-user-password" class="form-control" placeholder="' . $lang->get('index_new_pw') . '"> |
|
347 | + <input type="password" id="new-user-password" class="form-control" placeholder="' . $lang->get('index_new_pw').'"> |
|
349 | 348 | </div> |
350 | 349 | <div class="input-group has-feedback mb-2"> |
351 | 350 | <div class="input-group-prepend"> |
352 | 351 | <span class="input-group-text"><i class="fas fa-key"></i></span> |
353 | 352 | </div> |
354 | - <input type="password" id="new-user-password-confirm" class="form-control" placeholder="' . $lang->get('index_change_pw_confirmation') . '"> |
|
353 | + <input type="password" id="new-user-password-confirm" class="form-control" placeholder="' . $lang->get('index_change_pw_confirmation').'"> |
|
355 | 354 | </div> |
356 | 355 | <div class="row mb-3"> |
357 | 356 | <div class="col-md-12 offset-sm-4 text-center"> |
@@ -362,7 +361,7 @@ discard block |
||
362 | 361 | </div> |
363 | 362 | <div class="row mb-3"> |
364 | 363 | <div class="col-12"> |
365 | - <button id="but_confirm_new_password" class="btn btn-primary btn-block">' . $lang->get('confirm') . '</button> |
|
364 | + <button id="but_confirm_new_password" class="btn btn-primary btn-block">' . $lang->get('confirm').'</button> |
|
366 | 365 | </div> |
367 | 366 | </div> |
368 | 367 | </div> |
@@ -370,20 +369,20 @@ discard block |
||
370 | 369 | |
371 | 370 | <div class="card-body hidden" id="card-user-treat-psk"> |
372 | 371 | <div class="alert alert-info"> |
373 | - <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('user_has_psk_info') . '</div> |
|
372 | + <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('user_has_psk_info').'</div> |
|
374 | 373 | </div> |
375 | 374 | <div class="input-group has-feedback mb-2"> |
376 | 375 | <div class="input-group-prepend"> |
377 | 376 | <span class="input-group-text"><i class="fas fa-key"></i></span> |
378 | 377 | </div> |
379 | - <input type="password" id="user-old-defuse-psk" class="form-control" placeholder="' . $lang->get('home_personal_saltkey') . '"> |
|
378 | + <input type="password" id="user-old-defuse-psk" class="form-control" placeholder="' . $lang->get('home_personal_saltkey').'"> |
|
380 | 379 | </div> |
381 | 380 | <div class="row mb-3 mt-4"> |
382 | 381 | <div class="col-12"> |
383 | - <button id="but_confirm_defuse_psk" class="btn btn-primary btn-block">' . $lang->get('launch') . '</button> |
|
382 | + <button id="but_confirm_defuse_psk" class="btn btn-primary btn-block">' . $lang->get('launch').'</button> |
|
384 | 383 | </div> |
385 | 384 | <div class="col-12 mt-3"> |
386 | - <button id="but_confirm_forgot_defuse_psk" class="btn btn-danger btn-block text-bold">' . $lang->get('i_cannot_remember') . '</button> |
|
385 | + <button id="but_confirm_forgot_defuse_psk" class="btn btn-danger btn-block text-bold">' . $lang->get('i_cannot_remember').'</button> |
|
387 | 386 | </div> |
388 | 387 | </div> |
389 | 388 | </div> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ) { |
78 | 78 | // Not allowed page |
79 | 79 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
80 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
80 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | ); |
463 | 463 | |
464 | 464 | // add new role to user |
465 | - $tmp = $data_tmp['fonction_id'] . (substr($data_tmp['fonction_id'], -1) == ';' ? $role_id : ';' . $role_id); |
|
465 | + $tmp = $data_tmp['fonction_id'].(substr($data_tmp['fonction_id'], -1) == ';' ? $role_id : ';'.$role_id); |
|
466 | 466 | $session->set('user-roles', str_replace(';;', ';', $tmp)); |
467 | 467 | |
468 | 468 | // store in DB |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | $groupsData = $openLdapExtra->getADGroups($ldapConnection, $SETTINGS); |
724 | 724 | break; |
725 | 725 | default: |
726 | - throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']); |
|
726 | + throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']); |
|
727 | 727 | } |
728 | 728 | } catch (Exception $e) { |
729 | 729 | if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | } else { |
744 | 744 | // Handle successful retrieval of groups |
745 | 745 | // exists in Teampass |
746 | - foreach($groupsData['userGroups'] as $key => $group) { |
|
746 | + foreach ($groupsData['userGroups'] as $key => $group) { |
|
747 | 747 | $role_detail = DB::queryfirstrow( |
748 | 748 | 'SELECT a.increment_id as increment_id, a.role_id as role_id, r.title as title |
749 | 749 | FROM '.prefixTable('ldap_groups_roles').' AS a |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | |
769 | 769 | // Get all groups in Teampass |
770 | 770 | $teampassRoles = array(); |
771 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title')); |
|
771 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title')); |
|
772 | 772 | foreach ($rows as $record) { |
773 | 773 | array_push( |
774 | 774 | $teampassRoles, |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ) { |
81 | 81 | // Not allowed page |
82 | 82 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
83 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
83 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
84 | 84 | exit; |
85 | 85 | } |
86 | 86 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $openLdapExtra = new OpenLdapExtra(); |
155 | 155 | break; |
156 | 156 | default: |
157 | - throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']); |
|
157 | + throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']); |
|
158 | 158 | } |
159 | 159 | } catch (Exception $e) { |
160 | 160 | if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | // 2- Get user info from AD |
174 | 174 | // We want to isolate attribute ldap_user_attribute or mostly samAccountName |
175 | 175 | $userADInfos = $ldapConnection->query() |
176 | - ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username) |
|
176 | + ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username) |
|
177 | 177 | ->firstOrFail(); |
178 | 178 | |
179 | 179 | // Is user enabled? Only ActiveDirectory |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } catch (\LdapRecord\Query\ObjectNotFoundException $e) { |
195 | 195 | $error = $e->getDetailedError(); |
196 | 196 | if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
197 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
197 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
198 | 198 | } |
199 | 199 | // deepcode ignore ServerLeak: No important data is sent and is encrypted before being sent |
200 | 200 | echo prepareExchangedData( |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | // For OpenLDAP and others, we use attribute dn |
214 | 214 | $userAuthAttempt = $ldapConnection->auth()->attempt( |
215 | 215 | $SETTINGS['ldap_type'] === 'ActiveDirectory' ? |
216 | - $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication |
|
216 | + $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication |
|
217 | 217 | $userADInfos['dn'], |
218 | 218 | $post_password |
219 | 219 | ); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } catch (\LdapRecord\Query\ObjectNotFoundException $e) { |
233 | 233 | $error = $e->getDetailedError(); |
234 | 234 | if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
235 | - error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage()); |
|
235 | + error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage()); |
|
236 | 236 | } |
237 | 237 | // deepcode ignore ServerLeak: No important data is sent and is encrypted before being sent |
238 | 238 | echo prepareExchangedData( |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | function provideLog(string $message, array $SETTINGS) |
103 | 103 | { |
104 | 104 | if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
105 | - error_log((string) date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) . ' - '.$message); |
|
105 | + error_log((string) date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).' - '.$message); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | -function performVisibleFoldersHtmlUpdate (int $user_id) |
|
109 | +function performVisibleFoldersHtmlUpdate(int $user_id) |
|
110 | 110 | { |
111 | 111 | $html = []; |
112 | 112 | |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | |
117 | 117 | // get current folders visible for user |
118 | 118 | $cache_tree = DB::queryFirstRow( |
119 | - 'SELECT increment_id, data FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', |
|
119 | + 'SELECT increment_id, data FROM '.prefixTable('cache_tree').' WHERE user_id = %i', |
|
120 | 120 | $user_id |
121 | 121 | ); |
122 | - $folders = json_decode($cache_tree['data'], true);//print_r($folders); |
|
122 | + $folders = json_decode($cache_tree['data'], true); //print_r($folders); |
|
123 | 123 | foreach ($folders as $folder) { |
124 | 124 | $idFolder = (int) explode("li_", $folder['id'])[1]; |
125 | 125 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | // get folder info |
134 | 134 | $folder = DB::queryFirstRow( |
135 | - 'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
135 | + 'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
136 | 136 | $idFolder |
137 | 137 | ); |
138 | 138 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | function subTaskStatus($taskId) |
168 | 168 | { |
169 | 169 | $subTasks = DB::query( |
170 | - 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i', |
|
170 | + 'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i', |
|
171 | 171 | $taskId |
172 | 172 | ); |
173 | 173 |