Passed
Push — master ( a3cfc6...b61ff7 )
by Nils
06:14
created
sources/backups.queries.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
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
 
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
             // Prepare variables
139 139
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
140 140
         
141
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
141
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
142 142
         
143 143
             // get a token
144 144
             $token = GenerateCryptKey(20, false, true, true, false, true);
145 145
         
146 146
             //save file
147
-            $filename = time() . '-' . $token . '.sql';
148
-            $filepath = $SETTINGS['path_to_files_folder'] . '/' . $filename;
147
+            $filename = time().'-'.$token.'.sql';
148
+            $filepath = $SETTINGS['path_to_files_folder'].'/'.$filename;
149 149
             $handle = fopen($filepath, 'w+');
150 150
             
151 151
             if ($handle === false) {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             $tables = array();
164 164
             $result = DB::query('SHOW TABLES');
165 165
             foreach ($result as $row) {
166
-                $tables[] = $row['Tables_in_' . DB_NAME];
166
+                $tables[] = $row['Tables_in_'.DB_NAME];
167 167
             }
168 168
         
169 169
             $backupSuccess = true;
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
                 if (empty($pre) || substr_count($table, $pre) > 0) {
174 174
                     $table = safeString($table);
175 175
                     // Write table drop and creation
176
-                    fwrite($handle, 'DROP TABLE IF EXISTS ' . $table . ";\n");
177
-                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
178
-                    fwrite($handle, safeString($row2['Create Table']) . ";\n\n");
176
+                    fwrite($handle, 'DROP TABLE IF EXISTS '.$table.";\n");
177
+                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
178
+                    fwrite($handle, safeString($row2['Create Table']).";\n\n");
179 179
         
180 180
                     // Get field information
181 181
                     DB::query(
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                         }
201 201
                         
202 202
                         foreach ($rows as $record) {
203
-                            $insertQuery = 'INSERT INTO ' . $table . ' VALUES(';
203
+                            $insertQuery = 'INSERT INTO '.$table.' VALUES(';
204 204
                             $values = array();
205 205
                             
206 206
                             foreach ($record as $value) {
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
                                 if ($value === null) {
209 209
                                     $values[] = 'NULL';
210 210
                                 } else {
211
-                                    $values[] = '"' . addslashes(preg_replace("/\n/", '\\n', $value)) . '"';
211
+                                    $values[] = '"'.addslashes(preg_replace("/\n/", '\\n', $value)).'"';
212 212
                                 }
213 213
                             }
214 214
                             
215
-                            $insertQuery .= implode(',', $values) . ");\n";
215
+                            $insertQuery .= implode(',', $values).");\n";
216 216
                             fwrite($handle, $insertQuery);
217 217
                             
218 218
                             // Flush buffer periodically to free memory
@@ -242,14 +242,14 @@  discard block
 block discarded – undo
242 242
                 prepareFileWithDefuse(
243 243
                     'encrypt',
244 244
                     $filepath,
245
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
245
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
246 246
                     $post_key
247 247
                 );
248 248
         
249 249
                 // Do clean
250 250
                 unlink($filepath);
251 251
                 rename(
252
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
252
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
253 253
                     $filepath
254 254
                 );
255 255
             }
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
                 array(
272 272
                     'error' => false,
273 273
                     'message' => '',
274
-                    'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
275
-                        '&action=backup&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' .
276
-                        $session->get('user-key_tmp') . '&pathIsFiles=1',
274
+                    'download' => 'sources/downloadFile.php?name='.urlencode($filename).
275
+                        '&action=backup&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.
276
+                        $session->get('user-key_tmp').'&pathIsFiles=1',
277 277
                 ),
278 278
                 'encode'
279 279
             );
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
                 error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
335 335
             }
336 336
         
337
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
337
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
338 338
         
339 339
             if (empty($post_clearFilename) === true) {
340 340
                 // Get filename from database
341 341
                 $data = DB::queryFirstRow(
342 342
                     'SELECT valeur
343
-                    FROM ' . prefixTable('misc') . '
343
+                    FROM ' . prefixTable('misc').'
344 344
                     WHERE increment_id = %i',
345 345
                     $post_backupFile
346 346
                 );
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                 $post_backupFile = safeString($data['valeur']);
368 368
                 
369 369
                 // Verify file exists
370
-                if (!file_exists($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile)) {
370
+                if (!file_exists($SETTINGS['path_to_files_folder'].'/'.$post_backupFile)) {
371 371
                     echo prepareExchangedData(
372 372
                         array(
373 373
                             'error' => true,
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
                     // Decrypt the file
385 385
                     $ret = prepareFileWithDefuse(
386 386
                         'decrypt',
387
-                        $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
388
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
387
+                        $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
388
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
389 389
                         $post_key
390 390
                     );
391 391
                     
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
                     }
403 403
         
404 404
                     // Do clean
405
-                    fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
406
-                    $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
405
+                    fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
406
+                    $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
407 407
                 } else {
408 408
                     echo prepareExchangedData(
409 409
                         array(
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
                                 DB::query($query);
486 486
                                 $executedQueries++;
487 487
                             } catch (Exception $e) {
488
-                                $errors[] = "Error executing query: " . $e->getMessage() . " - Query: " . substr($query, 0, 100) . "...";
488
+                                $errors[] = "Error executing query: ".$e->getMessage()." - Query: ".substr($query, 0, 100)."...";
489 489
                             }
490 490
                             $query = '';
491 491
                         }
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
             } catch (Exception $e) {
502 502
                 // Rollback transaction on any exception
503 503
                 DB::rollback();
504
-                $errors[] = "Transaction failed: " . $e->getMessage();
504
+                $errors[] = "Transaction failed: ".$e->getMessage();
505 505
             }
506 506
         
507 507
             // Calculate the new offset
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                 echo prepareExchangedData(
517 517
                     array(
518 518
                         'error' => true,
519
-                        'message' => 'Errors occurred during import: ' . implode('; ', $errors),
519
+                        'message' => 'Errors occurred during import: '.implode('; ', $errors),
520 520
                         'newOffset' => $newOffset,
521 521
                         'totalSize' => $post_totalSize,
522 522
                         'clearFilename' => $post_backupFile,
Please login to merge, or discard this patch.
sources/downloadFile.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
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
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
     
135 135
     header('Content-Description: File Transfer');
136 136
     header('Content-Type: application/octet-stream');
137
-    header('Content-Disposition: attachment; filename="' . $safeFilename . '"');
137
+    header('Content-Disposition: attachment; filename="'.$safeFilename.'"');
138 138
     header('Cache-Control: must-revalidate, no-cache, no-store');
139 139
     header('Pragma: public');
140 140
     header('Expires: 0');
141 141
     
142 142
     if ($filesize !== null) {
143
-        header('Content-Length: ' . $filesize);
143
+        header('Content-Length: '.$filesize);
144 144
     }
145 145
 }
146 146
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         return false;
153 153
     }
154 154
     
155
-    $filepath = $basePath . '/' . basename($filename);
155
+    $filepath = $basePath.'/'.basename($filename);
156 156
     
157 157
     // Security: Verify the resolved path is within the allowed directory
158 158
     $realBasePath = realpath($basePath);
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
     $file_info = DB::queryFirstRow(
231 231
         'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
232 232
         s.share_key AS share_key
233
-        FROM ' . prefixTable('files') . ' AS f
234
-        INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
233
+        FROM ' . prefixTable('files').' AS f
234
+        INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
235 235
         WHERE s.user_id = %i AND s.object_id = %i',
236 236
         $session->get('user-id'),
237 237
         $get_fileid
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         // Get unencrypted file info
252 252
         $file_info = DB::queryFirstRow(
253 253
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension
254
-            FROM ' . prefixTable('files') . ' AS f
254
+            FROM ' . prefixTable('files').' AS f
255 255
             WHERE f.id = %i',
256 256
             $get_fileid
257 257
         );
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
     
264 264
     // Prepare filename for download
265 265
     $filename = str_replace('b64:', '', $file_info['name']);
266
-    $filename = basename($filename, '.' . $file_info['extension']);
266
+    $filename = basename($filename, '.'.$file_info['extension']);
267 267
     $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
268
-    $filename = $filename . '.' . $file_info['extension'];
268
+    $filename = $filename.'.'.$file_info['extension'];
269 269
     
270 270
     // Determine file path
271
-    $candidatePath1 = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . $file_info['file'];
272
-    $candidatePath2 = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file_info['file']);
271
+    $candidatePath1 = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file'];
272
+    $candidatePath2 = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file_info['file']);
273 273
     
274 274
     $filePath = false;
275 275
     if (file_exists($candidatePath1)) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     }
280 280
     
281 281
     if (WIP === true) {
282
-        error_log('downloadFile.php: filePath: ' . $filePath . " - ");
282
+        error_log('downloadFile.php: filePath: '.$filePath." - ");
283 283
     }
284 284
     
285 285
     // Validate file path and security
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
             // Get current user hash
269 269
             $userHash = DB::queryFirstRow(
270
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
270
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
271 271
                 $session->get('user-id')
272 272
             )['pw'];
273 273
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
  * @param string $post_key
323 323
  * @return string
324 324
  */
325
-function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string
325
+function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string
326 326
 {
327 327
     $session = SessionManager::getSession();
328 328
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     if (isset($dataReceived['user_id'])) {
358 358
         // Get info about user to modify
359 359
         $targetUserInfos = DB::queryFirstRow(
360
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
360
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
361 361
             WHERE id = %i',
362 362
             $dataReceived['user_id']
363 363
         );
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         case 'mail_me'://action_mail
507 507
             // Get info about user to send email
508 508
             $data_user = DB::queryFirstRow(
509
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
509
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
510 510
                 WHERE email = %s',
511 511
                 filter_var($dataReceived['receipt'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)
512 512
             );
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
     if (isset($dataReceived['user_id'])) {
625 625
         // Get info about user to modify
626 626
         $targetUserInfos = DB::queryFirstRow(
627
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
627
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
628 628
             WHERE id = %i',
629 629
             $dataReceived['user_id']
630 630
         );
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
             // Get current user hash
710 710
             $userHash = DB::queryFirstRow(
711
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
711
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
712 712
                 $session->get('user-id')
713 713
             )['pw'];
714 714
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 
747 747
                 // Get current user hash
748 748
                 $userHash = DB::queryFirstRow(
749
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
749
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
750 750
                     $session->get('user-id')
751 751
                 )['pw'];
752 752
 
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
 
791 791
                 // Get current user hash
792 792
                 $userHash = DB::queryFirstRow(
793
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %i;",
793
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %i;",
794 794
                     $session->get('user-id')
795 795
                 )['pw'];
796 796
 
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
  * @param array $SETTINGS
835 835
  * @return string
836 836
  */
837
-function systemHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
837
+function systemHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
838 838
 {
839 839
     $session = SessionManager::getSession();
840 840
     switch ($post_type) {
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                 )
936 936
             );
937 937
 
938
-            return '[{"token" : "' . $token . '"}]';
938
+            return '[{"token" : "'.$token.'"}]';
939 939
 
940 940
         /*
941 941
         * Default case
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 }
952 952
 
953 953
 
954
-function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
954
+function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
955 955
 {
956 956
     switch ($post_type) {
957 957
         /*
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
         array(
1021 1021
             'error' => false,
1022 1022
             'timestamp' => $session->get('user-session_duration'),
1023
-            'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60),
1023
+            'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60),
1024 1024
             'max_session_duration' => $maximum_session_expiration_time,
1025 1025
         ),
1026 1026
         'encode'
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
     // get number of items
1073 1073
     DB::queryFirstRow(
1074 1074
         'SELECT increment_id
1075
-        FROM ' . prefixTable('sharekeys_items') .
1075
+        FROM ' . prefixTable('sharekeys_items').
1076 1076
         ' WHERE user_id = %i',
1077 1077
         $userId
1078 1078
     );
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
         // check if expected security level is reached
1128 1128
         $dataUser = DB::queryFirstRow(
1129 1129
             'SELECT *
1130
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
1130
+            FROM ' . prefixTable('users').' WHERE id = %i',
1131 1131
             $post_user_id
1132 1132
         );
1133 1133
 
@@ -1148,8 +1148,8 @@  discard block
 block discarded – undo
1148 1148
         if (empty($dataUser['fonction_id']) === false) {
1149 1149
             $data = DB::queryFirstRow(
1150 1150
                 'SELECT complexity
1151
-                FROM ' . prefixTable('roles_title') . '
1152
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
1151
+                FROM ' . prefixTable('roles_title').'
1152
+                WHERE id IN (' . $dataUser['fonction_id'].')
1153 1153
                 ORDER BY complexity DESC'
1154 1154
             );
1155 1155
         } else {
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
             return prepareExchangedData(
1163 1163
                 array(
1164 1164
                     'error' => true,
1165
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' .
1166
-                        $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
1165
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'.
1166
+                        $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
1167 1167
                 ),
1168 1168
                 'encode'
1169 1169
             );
@@ -1267,14 +1267,14 @@  discard block
 block discarded – undo
1267 1267
         // Get data about user
1268 1268
         $dataUser = DB::queryFirstRow(
1269 1269
             'SELECT id, email, pw
1270
-            FROM ' . prefixTable('users') . '
1270
+            FROM ' . prefixTable('users').'
1271 1271
             WHERE login = %s',
1272 1272
             $post_login
1273 1273
         );
1274 1274
     } else {
1275 1275
         $dataUser = DB::queryFirstRow(
1276 1276
             'SELECT id, login, email, pw
1277
-            FROM ' . prefixTable('users') . '
1277
+            FROM ' . prefixTable('users').'
1278 1278
             WHERE id = %i',
1279 1279
             $post_id
1280 1280
         );
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
     // Check if token already used
1329 1329
     $dataToken = DB::queryFirstRow(
1330 1330
         'SELECT end_timestamp, reason
1331
-        FROM ' . prefixTable('tokens') . '
1331
+        FROM ' . prefixTable('tokens').'
1332 1332
         WHERE token = %s AND user_id = %i',
1333 1333
         $post_token,
1334 1334
         $dataUser['id']
@@ -1339,11 +1339,11 @@  discard block
 block discarded – undo
1339 1339
         return prepareExchangedData(
1340 1340
             array(
1341 1341
                 'error' => true,
1342
-                'message' => 'TOKEN already used',//$lang->get('no_email_set'),
1342
+                'message' => 'TOKEN already used', //$lang->get('no_email_set'),
1343 1343
             ),
1344 1344
             'encode'
1345 1345
         );
1346
-    } elseif(DB::count() === 0) {
1346
+    } elseif (DB::count() === 0) {
1347 1347
         // Store token for this action
1348 1348
         DB::insert(
1349 1349
             prefixTable('tokens'),
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
                 'email' => $dataUser['email'],
1406 1406
                 'email_result' => str_replace(
1407 1407
                     '#email#',
1408
-                    '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1408
+                    '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1409 1409
                     addslashes($lang->get('admin_email_result_ok'))
1410 1410
                 ),
1411 1411
             ),
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
             'email' => $dataUser['email'],
1422 1422
             'email_result' => str_replace(
1423 1423
                 '#email#',
1424
-                '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1424
+                '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1425 1425
                 addslashes($lang->get('admin_email_result_ok'))
1426 1426
             ),
1427 1427
         ),
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 
1439 1439
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
1440 1440
         $row = DB::queryFirstRow(
1441
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1441
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1442 1442
             'cron',
1443 1443
             'sending_emails'
1444 1444
         );
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1447 1447
             $rows = DB::query(
1448 1448
                 'SELECT *
1449
-                FROM ' . prefixTable('emails') .
1449
+                FROM ' . prefixTable('emails').
1450 1450
                 ' WHERE status != %s',
1451 1451
                 'sent'
1452 1452
             );
@@ -1498,8 +1498,8 @@  discard block
 block discarded – undo
1498 1498
     $arr_html = array();
1499 1499
     $rows = DB::query(
1500 1500
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
1501
-        FROM ' . prefixTable('log_items') . ' AS l
1502
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1501
+        FROM ' . prefixTable('log_items').' AS l
1502
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1503 1503
         WHERE l.action = %s AND l.id_user = %i
1504 1504
         ORDER BY l.date DESC
1505 1505
         LIMIT 0, 100',
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1532 1532
         && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1)
1533 1533
     ) {
1534
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1534
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1535 1535
         $nb_suggestions_waiting = DB::count();
1536 1536
     }
1537 1537
 
@@ -1566,13 +1566,13 @@  discard block
 block discarded – undo
1566 1566
             if ($data === 'stat_languages') {
1567 1567
                 $tmp = '';
1568 1568
                 foreach ($stats_data[$data] as $key => $value) {
1569
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1569
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1570 1570
                 }
1571 1571
                 $statsToSend[$data] = $tmp;
1572 1572
             } elseif ($data === 'stat_country') {
1573 1573
                 $tmp = '';
1574 1574
                 foreach ($stats_data[$data] as $key => $value) {
1575
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1575
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1576 1576
                 }
1577 1577
                 $statsToSend[$data] = $tmp;
1578 1578
             } else {
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
             $url_found = $value;
1660 1660
             if (empty($url_found) === false) {
1661 1661
                 $tmp = parse_url($url_found);
1662
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : '');
1662
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : '');
1663 1663
                 $value = $anonym_url;
1664 1664
             } else {
1665 1665
                 $value = '';
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
     $teampass_errors = '';
1690 1690
     $rows = DB::query(
1691 1691
         'SELECT label, date AS error_date
1692
-        FROM ' . prefixTable('log_system') . "
1692
+        FROM ' . prefixTable('log_system')."
1693 1693
         WHERE `type` LIKE 'error'
1694 1694
         ORDER BY `date` DESC
1695 1695
         LIMIT 0, 10"
@@ -1697,9 +1697,9 @@  discard block
 block discarded – undo
1697 1697
     if (DB::count() > 0) {
1698 1698
         foreach ($rows as $record) {
1699 1699
             if (empty($teampass_errors) === true) {
1700
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1700
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1701 1701
             } else {
1702
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1702
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1703 1703
             }
1704 1704
         }
1705 1705
     }
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
     // Now prepare text
1713 1713
     $txt = '### Page on which it happened
1714
-' . $data['current_page'] . '
1714
+' . $data['current_page'].'
1715 1715
 
1716 1716
 ### Steps to reproduce
1717 1717
 1.
@@ -1726,39 +1726,39 @@  discard block
 block discarded – undo
1726 1726
 Tell us what happens instead
1727 1727
 
1728 1728
 ### Server configuration
1729
-**Operating system**: ' . php_uname() . '
1729
+**Operating system**: ' . php_uname().'
1730 1730
 
1731
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1731
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1732 1732
 
1733
-**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)) . '
1733
+**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)).'
1734 1734
 
1735
-**PHP version:** ' . PHP_VERSION . '
1735
+**PHP version:** ' . PHP_VERSION.'
1736 1736
 
1737
-**Teampass version:** ' . TP_VERSION . '.' . TP_VERSION_MINOR . '
1737
+**Teampass version:** ' . TP_VERSION.'.'.TP_VERSION_MINOR.'
1738 1738
 
1739 1739
 **Teampass configuration variables:**
1740 1740
 ```
1741
-' . $list_of_options . '
1741
+' . $list_of_options.'
1742 1742
 ```
1743 1743
 
1744 1744
 **Updated from an older Teampass or fresh install:**
1745 1745
 
1746 1746
 ### Client configuration
1747 1747
 
1748
-**Browser:** ' . $data['browser_name'] . ' - ' . $data['browser_version'] . '
1748
+**Browser:** ' . $data['browser_name'].' - '.$data['browser_version'].'
1749 1749
 
1750
-**Operating system:** ' . $data['os'] . ' - ' . $data['os_archi'] . 'bits
1750
+**Operating system:** ' . $data['os'].' - '.$data['os_archi'].'bits
1751 1751
 
1752 1752
 ### Logs
1753 1753
 
1754 1754
 #### Web server error log
1755 1755
 ```
1756
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1756
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1757 1757
 ```
1758 1758
 
1759 1759
 #### Teampass 10 last system errors
1760 1760
 ```
1761
-' . $teampass_errors . '
1761
+' . $teampass_errors.'
1762 1762
 ```
1763 1763
 
1764 1764
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
         // Check if user exists
1799 1799
         $userInfo = DB::queryFirstRow(
1800 1800
             'SELECT public_key, private_key, pw, auth_type
1801
-            FROM ' . prefixTable('users') . '
1801
+            FROM ' . prefixTable('users').'
1802 1802
             WHERE id = %i',
1803 1803
             $post_user_id
1804 1804
         );
@@ -1807,9 +1807,9 @@  discard block
 block discarded – undo
1807 1807
             // Get one item
1808 1808
             $currentUserKey = DB::queryFirstRow(
1809 1809
                 'SELECT object_id, share_key, increment_id
1810
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
1811
-                INNER JOIN ' . prefixTable('items') . ' AS i ON  (i.id = si.object_id)
1812
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON  (i.id_tree = nt.id)
1810
+                FROM ' . prefixTable('sharekeys_items').' AS si
1811
+                INNER JOIN ' . prefixTable('items').' AS i ON  (i.id = si.object_id)
1812
+                INNER JOIN ' . prefixTable('nested_tree').' AS nt ON  (i.id_tree = nt.id)
1813 1813
                 WHERE user_id = %i AND nt.personal_folder = %i',
1814 1814
                 $post_user_id,
1815 1815
                 0
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
         // Get user info
1904 1904
         $userData = DB::queryFirstRow(
1905 1905
             'SELECT private_key
1906
-            FROM ' . prefixTable('users') . '
1906
+            FROM ' . prefixTable('users').'
1907 1907
             WHERE id = %i',
1908 1908
             $post_user_id
1909 1909
         );
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
         // Get user info
1985 1985
         $userData = DB::queryFirstRow(
1986 1986
             'SELECT email, auth_type, login
1987
-            FROM ' . prefixTable('users') . '
1987
+            FROM ' . prefixTable('users').'
1988 1988
             WHERE id = %i',
1989 1989
             $post_user_id
1990 1990
         );
@@ -2082,7 +2082,7 @@  discard block
 block discarded – undo
2082 2082
         // Get user info
2083 2083
         $userData = DB::queryFirstRow(
2084 2084
             'SELECT email, auth_type, login
2085
-            FROM ' . prefixTable('users') . '
2085
+            FROM ' . prefixTable('users').'
2086 2086
             WHERE id = %i',
2087 2087
             $userId
2088 2088
         );
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
         // Check if user exists
2149 2149
         DB::queryFirstRow(
2150 2150
             'SELECT *
2151
-            FROM ' . prefixTable('users') . '
2151
+            FROM ' . prefixTable('users').'
2152 2152
             WHERE id = %i',
2153 2153
             $post_user_id
2154 2154
         );
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
         // Check if user exists
2219 2219
         $userInfo = DB::queryFirstRow(
2220 2220
             'SELECT public_key
2221
-            FROM ' . prefixTable('users') . '
2221
+            FROM ' . prefixTable('users').'
2222 2222
             WHERE id = %i',
2223 2223
             $post_user_id
2224 2224
         );
@@ -2366,15 +2366,15 @@  discard block
 block discarded – undo
2366 2366
     // Loop on items
2367 2367
     $rows = DB::query(
2368 2368
         'SELECT id, pw
2369
-        FROM ' . prefixTable('items') . '
2369
+        FROM ' . prefixTable('items').'
2370 2370
         WHERE perso = 0
2371
-        LIMIT ' . $post_start . ', ' . $post_length
2371
+        LIMIT ' . $post_start.', '.$post_length
2372 2372
     );
2373 2373
     foreach ($rows as $record) {
2374 2374
         // Get itemKey from current user
2375 2375
         $currentUserKey = DB::queryFirstRow(
2376 2376
             'SELECT share_key, increment_id
2377
-            FROM ' . prefixTable('sharekeys_items') . '
2377
+            FROM ' . prefixTable('sharekeys_items').'
2378 2378
             WHERE object_id = %i AND user_id = %i',
2379 2379
             $record['id'],
2380 2380
             $session->get('user-id')
@@ -2406,7 +2406,7 @@  discard block
 block discarded – undo
2406 2406
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2407 2407
                 $currentUserKey = DB::queryFirstRow(
2408 2408
                     'SELECT increment_id
2409
-                    FROM ' . prefixTable('sharekeys_items') . '
2409
+                    FROM ' . prefixTable('sharekeys_items').'
2410 2410
                     WHERE object_id = %i AND user_id = %i',
2411 2411
                     $record['id'],
2412 2412
                     $post_user_id
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
     // SHould we change step?
2440 2440
     DB::query(
2441 2441
         'SELECT *
2442
-        FROM ' . prefixTable('items') . '
2442
+        FROM ' . prefixTable('items').'
2443 2443
         WHERE perso = 0'
2444 2444
     );
2445 2445
 
@@ -2464,15 +2464,15 @@  discard block
 block discarded – undo
2464 2464
     // Loop on logs
2465 2465
     $rows = DB::query(
2466 2466
         'SELECT increment_id
2467
-        FROM ' . prefixTable('log_items') . '
2467
+        FROM ' . prefixTable('log_items').'
2468 2468
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2469
-        LIMIT ' . $post_start . ', ' . $post_length
2469
+        LIMIT ' . $post_start.', '.$post_length
2470 2470
     );
2471 2471
     foreach ($rows as $record) {
2472 2472
         // Get itemKey from current user
2473 2473
         $currentUserKey = DB::queryFirstRow(
2474 2474
             'SELECT share_key
2475
-            FROM ' . prefixTable('sharekeys_logs') . '
2475
+            FROM ' . prefixTable('sharekeys_logs').'
2476 2476
             WHERE object_id = %i AND user_id = %i',
2477 2477
             $record['increment_id'],
2478 2478
             $session->get('user-id')
@@ -2504,7 +2504,7 @@  discard block
 block discarded – undo
2504 2504
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2505 2505
                 $currentUserKey = DB::queryFirstRow(
2506 2506
                     'SELECT increment_id
2507
-                    FROM ' . prefixTable('sharekeys_items') . '
2507
+                    FROM ' . prefixTable('sharekeys_items').'
2508 2508
                     WHERE object_id = %i AND user_id = %i',
2509 2509
                     $record['id'],
2510 2510
                     $post_user_id
@@ -2526,7 +2526,7 @@  discard block
 block discarded – undo
2526 2526
     // SHould we change step?
2527 2527
     DB::query(
2528 2528
         'SELECT increment_id
2529
-        FROM ' . prefixTable('log_items') . '
2529
+        FROM ' . prefixTable('log_items').'
2530 2530
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2531 2531
     );
2532 2532
 
@@ -2551,15 +2551,15 @@  discard block
 block discarded – undo
2551 2551
     // Loop on fields
2552 2552
     $rows = DB::query(
2553 2553
         'SELECT id
2554
-        FROM ' . prefixTable('categories_items') . '
2554
+        FROM ' . prefixTable('categories_items').'
2555 2555
         WHERE encryption_type = "teampass_aes"
2556
-        LIMIT ' . $post_start . ', ' . $post_length
2556
+        LIMIT ' . $post_start.', '.$post_length
2557 2557
     );
2558 2558
     foreach ($rows as $record) {
2559 2559
         // Get itemKey from current user
2560 2560
         $currentUserKey = DB::queryFirstRow(
2561 2561
             'SELECT share_key
2562
-            FROM ' . prefixTable('sharekeys_fields') . '
2562
+            FROM ' . prefixTable('sharekeys_fields').'
2563 2563
             WHERE object_id = %i AND user_id = %i',
2564 2564
             $record['id'],
2565 2565
             $session->get('user-id')
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2592 2592
                 $currentUserKey = DB::queryFirstRow(
2593 2593
                     'SELECT increment_id
2594
-                    FROM ' . prefixTable('sharekeys_items') . '
2594
+                    FROM ' . prefixTable('sharekeys_items').'
2595 2595
                     WHERE object_id = %i AND user_id = %i',
2596 2596
                     $record['id'],
2597 2597
                     $post_user_id
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
     // SHould we change step?
2614 2614
     DB::query(
2615 2615
         'SELECT *
2616
-        FROM ' . prefixTable('categories_items') . '
2616
+        FROM ' . prefixTable('categories_items').'
2617 2617
         WHERE encryption_type = "teampass_aes"'
2618 2618
     );
2619 2619
 
@@ -2638,14 +2638,14 @@  discard block
 block discarded – undo
2638 2638
     // Loop on suggestions
2639 2639
     $rows = DB::query(
2640 2640
         'SELECT id
2641
-        FROM ' . prefixTable('suggestion') . '
2642
-        LIMIT ' . $post_start . ', ' . $post_length
2641
+        FROM ' . prefixTable('suggestion').'
2642
+        LIMIT ' . $post_start.', '.$post_length
2643 2643
     );
2644 2644
     foreach ($rows as $record) {
2645 2645
         // Get itemKey from current user
2646 2646
         $currentUserKey = DB::queryFirstRow(
2647 2647
             'SELECT share_key
2648
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2648
+            FROM ' . prefixTable('sharekeys_suggestions').'
2649 2649
             WHERE object_id = %i AND user_id = %i',
2650 2650
             $record['id'],
2651 2651
             $session->get('user-id')
@@ -2677,7 +2677,7 @@  discard block
 block discarded – undo
2677 2677
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2678 2678
                 $currentUserKey = DB::queryFirstRow(
2679 2679
                     'SELECT increment_id
2680
-                    FROM ' . prefixTable('sharekeys_items') . '
2680
+                    FROM ' . prefixTable('sharekeys_items').'
2681 2681
                     WHERE object_id = %i AND user_id = %i',
2682 2682
                     $record['id'],
2683 2683
                     $post_user_id
@@ -2723,15 +2723,15 @@  discard block
 block discarded – undo
2723 2723
     // Loop on files
2724 2724
     $rows = DB::query(
2725 2725
         'SELECT id
2726
-        FROM ' . prefixTable('files') . '
2727
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2728
-        LIMIT ' . $post_start . ', ' . $post_length
2726
+        FROM ' . prefixTable('files').'
2727
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2728
+        LIMIT ' . $post_start.', '.$post_length
2729 2729
     ); //aes_encryption
2730 2730
     foreach ($rows as $record) {
2731 2731
         // Get itemKey from current user
2732 2732
         $currentUserKey = DB::queryFirstRow(
2733 2733
             'SELECT share_key
2734
-            FROM ' . prefixTable('sharekeys_files') . '
2734
+            FROM ' . prefixTable('sharekeys_files').'
2735 2735
             WHERE object_id = %i AND user_id = %i',
2736 2736
             $record['id'],
2737 2737
             $session->get('user-id')
@@ -2763,7 +2763,7 @@  discard block
 block discarded – undo
2763 2763
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2764 2764
                 $currentUserKey = DB::queryFirstRow(
2765 2765
                     'SELECT increment_id
2766
-                    FROM ' . prefixTable('sharekeys_items') . '
2766
+                    FROM ' . prefixTable('sharekeys_items').'
2767 2767
                     WHERE object_id = %i AND user_id = %i',
2768 2768
                     $record['id'],
2769 2769
                     $post_user_id
@@ -2785,8 +2785,8 @@  discard block
 block discarded – undo
2785 2785
     // SHould we change step?
2786 2786
     DB::query(
2787 2787
         'SELECT *
2788
-        FROM ' . prefixTable('files') . '
2789
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2788
+        FROM ' . prefixTable('files').'
2789
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2790 2790
     );
2791 2791
 
2792 2792
     $next_start = (int) $post_start + (int) $post_length;
@@ -2819,9 +2819,9 @@  discard block
 block discarded – undo
2819 2819
     if (count($session->get('user-personal_folders')) > 0) {
2820 2820
         $rows = DB::query(
2821 2821
             'SELECT id, pw
2822
-            FROM ' . prefixTable('items') . '
2822
+            FROM ' . prefixTable('items').'
2823 2823
             WHERE perso = 1 AND id_tree IN %ls AND encryption_type = %s
2824
-            LIMIT ' . $post_start . ', ' . $post_length,
2824
+            LIMIT ' . $post_start.', '.$post_length,
2825 2825
             $session->get('user-personal_folders'),
2826 2826
             "defuse"
2827 2827
         );
@@ -2829,7 +2829,7 @@  discard block
 block discarded – undo
2829 2829
             // Get itemKey from current user
2830 2830
             $currentUserKey = DB::queryFirstRow(
2831 2831
                 'SELECT share_key, increment_id
2832
-                FROM ' . prefixTable('sharekeys_items') . '
2832
+                FROM ' . prefixTable('sharekeys_items').'
2833 2833
                 WHERE object_id = %i AND user_id = %i',
2834 2834
                 $record['id'],
2835 2835
                 $session->get('user-id')
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
                 if ((int) $post_user_id !== (int) $session->get('user-id')) {
2857 2857
                     $currentUserKey = DB::queryFirstRow(
2858 2858
                         'SELECT increment_id
2859
-                        FROM ' . prefixTable('sharekeys_items') . '
2859
+                        FROM ' . prefixTable('sharekeys_items').'
2860 2860
                         WHERE object_id = %i AND user_id = %i',
2861 2861
                         $record['id'],
2862 2862
                         $post_user_id
@@ -2879,7 +2879,7 @@  discard block
 block discarded – undo
2879 2879
     // SHould we change step?
2880 2880
     DB::query(
2881 2881
         'SELECT *
2882
-        FROM ' . prefixTable('items') . '
2882
+        FROM ' . prefixTable('items').'
2883 2883
         WHERE perso = 0'
2884 2884
     );
2885 2885
 
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
         // Check if user exists
2908 2908
         $userInfo = DB::queryFirstRow(
2909 2909
             'SELECT public_key, encrypted_psk
2910
-            FROM ' . prefixTable('users') . '
2910
+            FROM ' . prefixTable('users').'
2911 2911
             WHERE id = %i',
2912 2912
             $post_user_id
2913 2913
         );
@@ -2933,7 +2933,7 @@  discard block
 block discarded – undo
2933 2933
                 if ($post_counterItemsToTreat === -1) {
2934 2934
                     DB::query(
2935 2935
                         'SELECT id
2936
-                        FROM ' . prefixTable('items') . '
2936
+                        FROM ' . prefixTable('items').'
2937 2937
                         WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
2938 2938
                         $session->get('user-personal_folders'),
2939 2939
                         'teampass_aes'
@@ -2946,7 +2946,7 @@  discard block
 block discarded – undo
2946 2946
                 // Loop on persoanl items
2947 2947
                 $rows = DB::query(
2948 2948
                     'SELECT id, pw
2949
-                    FROM ' . prefixTable('items') . '
2949
+                    FROM ' . prefixTable('items').'
2950 2950
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s
2951 2951
                     LIMIT ' . $post_length,
2952 2952
                     $session->get('user-personal_folders'),
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
                     // Loop on files
2991 2991
                     $rows = DB::query(
2992 2992
                         'SELECT id, file
2993
-                        FROM ' . prefixTable('files') . '
2993
+                        FROM ' . prefixTable('files').'
2994 2994
                         WHERE status != %s
2995 2995
                         AND id_item = %i',
2996 2996
                         TP_ENCRYPTION_NAME,
@@ -3001,13 +3001,13 @@  discard block
 block discarded – undo
3001 3001
                         // Now decrypt the file
3002 3002
                         prepareFileWithDefuse(
3003 3003
                             'decrypt',
3004
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
3005
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
3004
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
3005
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
3006 3006
                             $post_user_psk
3007 3007
                         );
3008 3008
 
3009 3009
                         // Encrypt the file
3010
-                        $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
3010
+                        $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
3011 3011
 
3012 3012
                         DB::update(
3013 3013
                             prefixTable('files'),
@@ -3030,7 +3030,7 @@  discard block
 block discarded – undo
3030 3030
                         );
3031 3031
 
3032 3032
                         // Unlink original file
3033
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
3033
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
3034 3034
                     }
3035 3035
                 }
3036 3036
 
@@ -3038,7 +3038,7 @@  discard block
 block discarded – undo
3038 3038
                 $next_start = (int) $post_start + (int) $post_length;
3039 3039
                 DB::query(
3040 3040
                     'SELECT id
3041
-                    FROM ' . prefixTable('items') . '
3041
+                    FROM ' . prefixTable('items').'
3042 3042
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
3043 3043
                     $session->get('user-personal_folders'),
3044 3044
                     'teampass_aes'
@@ -3108,7 +3108,7 @@  discard block
 block discarded – undo
3108 3108
         // Get user info
3109 3109
         $userData = DB::queryFirstRow(
3110 3110
             'SELECT special, auth_type, is_ready_for_usage, ongoing_process_id, otp_provided, keys_recovery_time
3111
-            FROM ' . prefixTable('users') . '
3111
+            FROM ' . prefixTable('users').'
3112 3112
             WHERE id = %i',
3113 3113
             $post_user_id
3114 3114
         );
@@ -3155,7 +3155,7 @@  discard block
 block discarded – undo
3155 3155
         // Get user info
3156 3156
         $userData = DB::queryFirstRow(
3157 3157
             'SELECT auth_type, login, private_key
3158
-            FROM ' . prefixTable('users') . '
3158
+            FROM ' . prefixTable('users').'
3159 3159
             WHERE id = %i',
3160 3160
             $post_user_id
3161 3161
         );
@@ -3205,7 +3205,7 @@  discard block
 block discarded – undo
3205 3205
                 return prepareExchangedData(
3206 3206
                     array(
3207 3207
                         'error' => false,
3208
-                        'message' => $lang->get('done'),'',
3208
+                        'message' => $lang->get('done'), '',
3209 3209
                     ),
3210 3210
                     'encode'
3211 3211
                 );
@@ -3253,7 +3253,7 @@  discard block
 block discarded – undo
3253 3253
         // Get user info
3254 3254
         $userData = DB::queryFirstRow(
3255 3255
             'SELECT auth_type, login, private_key, special
3256
-            FROM ' . prefixTable('users') . '
3256
+            FROM ' . prefixTable('users').'
3257 3257
             WHERE id = %i',
3258 3258
             $post_user_id
3259 3259
         );
@@ -3287,7 +3287,7 @@  discard block
 block discarded – undo
3287 3287
                 return prepareExchangedData(
3288 3288
                     array(
3289 3289
                         'error' => false,
3290
-                        'message' => $lang->get('done'),'',
3290
+                        'message' => $lang->get('done'), '',
3291 3291
                     ),
3292 3292
                     'encode'
3293 3293
                 );
@@ -3309,8 +3309,8 @@  discard block
 block discarded – undo
3309 3309
             // Get one itemKey from current user
3310 3310
             $currentUserKey = DB::queryFirstRow(
3311 3311
                 'SELECT ski.share_key, ski.increment_id, l.id_user
3312
-                FROM ' . prefixTable('sharekeys_items') . ' AS ski
3313
-                INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
3312
+                FROM ' . prefixTable('sharekeys_items').' AS ski
3313
+                INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
3314 3314
                 WHERE ski.user_id = %i
3315 3315
                 ORDER BY RAND()
3316 3316
                 LIMIT 1',
@@ -3400,7 +3400,7 @@  discard block
 block discarded – undo
3400 3400
             $session->get('user-id')
3401 3401
         );
3402 3402
         // Return data
3403
-        return '[{"new_value":"' . $session->get('user-session_duration') . '"}]';
3403
+        return '[{"new_value":"'.$session->get('user-session_duration').'"}]';
3404 3404
     }
3405 3405
     
3406 3406
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +170 added lines, -172 removed lines patch added patch discarded remove patch
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
             $text = Crypto::decrypt($message, $key);
100 100
         }
101 101
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
102
-        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: ' . $ex->getMessage());
102
+        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: '.$ex->getMessage());
103 103
         $err = 'wrong_key_or_modified_ciphertext';
104 104
     } catch (CryptoException\BadFormatException $ex) {
105
-        error_log('TEAMPASS-Error-Bad format exception: ' . $ex->getMessage());
105
+        error_log('TEAMPASS-Error-Bad format exception: '.$ex->getMessage());
106 106
         $err = 'bad_format';
107 107
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
108
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
108
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
109 109
         $err = 'environment_error';
110 110
     } catch (CryptoException\IOException $ex) {
111
-        error_log('TEAMPASS-Error-IO: ' . $ex->getMessage());
111
+        error_log('TEAMPASS-Error-IO: '.$ex->getMessage());
112 112
         $err = 'io_error';
113 113
     } catch (Exception $ex) {
114
-        error_log('TEAMPASS-Error-Unexpected exception: ' . $ex->getMessage());
114
+        error_log('TEAMPASS-Error-Unexpected exception: '.$ex->getMessage());
115 115
         $err = 'unexpected_error';
116 116
     }
117 117
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function trimElement($chaine, string $element): string
198 198
 {
199
-    if (! empty($chaine)) {
199
+    if (!empty($chaine)) {
200 200
         if (is_array($chaine) === true) {
201 201
             $chaine = implode(';', $chaine);
202 202
         }
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
  */
245 245
 function db_error_handler(array $params): void
246 246
 {
247
-    echo 'Error: ' . $params['error'] . "<br>\n";
248
-    echo 'Query: ' . $params['query'] . "<br>\n";
247
+    echo 'Error: '.$params['error']."<br>\n";
248
+    echo 'Query: '.$params['query']."<br>\n";
249 249
     throw new Exception('Error - Query', 1);
250 250
 }
251 251
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     $session->set('user-forbiden_personal_folders', []);
324 324
     
325 325
     // Get list of Folders
326
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
326
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
327 327
     foreach ($rows as $record) {
328 328
         array_push($groupesVisibles, $record['id']);
329 329
     }
@@ -332,20 +332,20 @@  discard block
 block discarded – undo
332 332
     // get complete list of ROLES
333 333
     $tmp = explode(';', $idFonctions);
334 334
     $rows = DB::query(
335
-        'SELECT * FROM ' . prefixTable('roles_title') . '
335
+        'SELECT * FROM '.prefixTable('roles_title').'
336 336
         ORDER BY title ASC'
337 337
     );
338 338
     foreach ($rows as $record) {
339
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
339
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
340 340
             array_push($tmp, $record['id']);
341 341
         }
342 342
     }
343 343
     $session->set('user-roles', implode(';', $tmp));
344 344
     $session->set('user-admin', 1);
345 345
     // Check if admin has created Folders and Roles
346
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
346
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
347 347
     $session->set('user-nb_folders', DB::count());
348
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
348
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
349 349
     $session->set('user-nb_roles', DB::count());
350 350
 
351 351
     return true;
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
     // Does this user is allowed to see other items
429 429
     $inc = 0;
430 430
     $rows = DB::query(
431
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
431
+        'SELECT id, id_tree FROM '.prefixTable('items').'
432 432
             WHERE restricted_to LIKE %ss AND inactif = %s'.
433 433
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
434 434
         $globalsUserId,
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
     // Check for the users roles if some specific rights exist on items
446 446
     $rows = DB::query(
447 447
         'SELECT i.id_tree, r.item_id
448
-        FROM ' . prefixTable('items') . ' as i
449
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
448
+        FROM ' . prefixTable('items').' as i
449
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
450 450
         WHERE i.id_tree <> "" '.
451 451
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
452 452
         'ORDER BY i.id_tree ASC',
@@ -490,18 +490,18 @@  discard block
 block discarded – undo
490 490
     $session->set('system-list_restricted_folders_for_items', $restrictedFoldersForItems);
491 491
     $session->set('user-forbiden_personal_folders', $noAccessPersonalFolders);
492 492
     // Folders and Roles numbers
493
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('nested_tree') . '');
494
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('nested_tree') . '');
493
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
494
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
495 495
     $session->set('user-nb_folders', DB::count());
496
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
497
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
496
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
497
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
498 498
     $session->set('user-nb_roles', DB::count());
499 499
     // check if change proposals on User's items
500 500
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
501 501
         $countNewItems = DB::query(
502 502
             'SELECT COUNT(*)
503
-            FROM ' . prefixTable('items_change') . ' AS c
504
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
503
+            FROM ' . prefixTable('items_change').' AS c
504
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
505 505
             WHERE i.action = %s AND i.id_user = %i',
506 506
             'at_creation',
507 507
             $globalsUserId
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 {
529 529
     $rows = DB::query(
530 530
         'SELECT *
531
-        FROM ' . prefixTable('roles_values') . '
531
+        FROM ' . prefixTable('roles_values').'
532 532
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
533 533
         ['W', 'ND', 'NE', 'NDNE', 'R'],
534 534
         $userRoles,
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
     ) {
596 596
         $persoFld = DB::queryFirstRow(
597 597
             'SELECT id
598
-            FROM ' . prefixTable('nested_tree') . '
598
+            FROM ' . prefixTable('nested_tree').'
599 599
             WHERE title = %s AND personal_folder = %i'.
600 600
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
601 601
             $globalsUserId,
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
     }
629 629
     $persoFlds = DB::query(
630 630
         'SELECT id
631
-        FROM ' . prefixTable('nested_tree') . '
631
+        FROM ' . prefixTable('nested_tree').'
632 632
         WHERE %l',
633 633
         $where
634 634
     );
@@ -696,12 +696,12 @@  discard block
 block discarded – undo
696 696
     //Load Tree
697 697
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
698 698
     // truncate table
699
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
699
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
700 700
     // reload date
701 701
     $rows = DB::query(
702 702
         'SELECT *
703
-        FROM ' . prefixTable('items') . ' as i
704
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
703
+        FROM ' . prefixTable('items').' as i
704
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
705 705
         AND l.action = %s
706 706
         AND i.inactif = %i',
707 707
         'at_creation',
@@ -713,18 +713,18 @@  discard block
 block discarded – undo
713 713
             $tags = '';
714 714
             $itemTags = DB::query(
715 715
                 'SELECT tag
716
-                FROM ' . prefixTable('tags') . '
716
+                FROM ' . prefixTable('tags').'
717 717
                 WHERE item_id = %i AND tag != ""',
718 718
                 $record['id']
719 719
             );
720 720
             foreach ($itemTags as $itemTag) {
721
-                $tags .= $itemTag['tag'] . ' ';
721
+                $tags .= $itemTag['tag'].' ';
722 722
             }
723 723
 
724 724
             // Get renewal period
725 725
             $resNT = DB::queryFirstRow(
726 726
                 'SELECT renewal_period
727
-                FROM ' . prefixTable('nested_tree') . '
727
+                FROM ' . prefixTable('nested_tree').'
728 728
                 WHERE id = %i',
729 729
                 $record['id_tree']
730 730
             );
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
                     // Is this a User id?
738 738
                     $user = DB::queryFirstRow(
739 739
                         'SELECT id, login
740
-                        FROM ' . prefixTable('users') . '
740
+                        FROM ' . prefixTable('users').'
741 741
                         WHERE id = %i',
742 742
                         $elem->title
743 743
                     );
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
                     'id' => $record['id'],
756 756
                     'label' => $record['label'],
757 757
                     'description' => $record['description'] ?? '',
758
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
758
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
759 759
                     'tags' => $tags,
760 760
                     'id_tree' => $record['id_tree'],
761 761
                     'perso' => $record['perso'],
762
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
762
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
763 763
                     'login' => $record['login'] ?? '',
764 764
                     'folder' => implode(' » ', $folder),
765 765
                     'author' => $record['id_user'],
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
     // get new value from db
789 789
     $data = DB::queryFirstRow(
790 790
         'SELECT label, description, id_tree, perso, restricted_to, login, url
791
-        FROM ' . prefixTable('items') . '
791
+        FROM ' . prefixTable('items').'
792 792
         WHERE id=%i',
793 793
         $ident
794 794
     );
@@ -796,12 +796,12 @@  discard block
 block discarded – undo
796 796
     $tags = '';
797 797
     $itemTags = DB::query(
798 798
         'SELECT tag
799
-            FROM ' . prefixTable('tags') . '
799
+            FROM ' . prefixTable('tags').'
800 800
             WHERE item_id = %i AND tag != ""',
801 801
         $ident
802 802
     );
803 803
     foreach ($itemTags as $itemTag) {
804
-        $tags .= $itemTag['tag'] . ' ';
804
+        $tags .= $itemTag['tag'].' ';
805 805
     }
806 806
     // form id_tree to full foldername
807 807
     $folder = [];
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             // Is this a User id?
813 813
             $user = DB::queryFirstRow(
814 814
                 'SELECT id, login
815
-                FROM ' . prefixTable('users') . '
815
+                FROM ' . prefixTable('users').'
816 816
                 WHERE id = %i',
817 817
                 $elem->title
818 818
             );
@@ -830,10 +830,10 @@  discard block
 block discarded – undo
830 830
             'label' => $data['label'],
831 831
             'description' => $data['description'],
832 832
             'tags' => $tags,
833
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
833
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
834 834
             'id_tree' => $data['id_tree'],
835 835
             'perso' => $data['perso'],
836
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
836
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
837 837
             'login' => $data['login'] ?? '',
838 838
             'folder' => implode(' » ', $folder),
839 839
             'author' => $session->get('user-id'),
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
     // get new value from db
864 864
     $data = DB::queryFirstRow(
865 865
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
866
-        FROM ' . prefixTable('items') . ' as i
867
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
866
+        FROM ' . prefixTable('items').' as i
867
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
868 868
         WHERE i.id = %i
869 869
         AND l.action = %s',
870 870
         $ident,
@@ -874,12 +874,12 @@  discard block
 block discarded – undo
874 874
     $tags = '';
875 875
     $itemTags = DB::query(
876 876
         'SELECT tag
877
-            FROM ' . prefixTable('tags') . '
877
+            FROM ' . prefixTable('tags').'
878 878
             WHERE item_id = %i AND tag != ""',
879 879
         $ident
880 880
     );
881 881
     foreach ($itemTags as $itemTag) {
882
-        $tags .= $itemTag['tag'] . ' ';
882
+        $tags .= $itemTag['tag'].' ';
883 883
     }
884 884
     // form id_tree to full foldername
885 885
     $folder = [];
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
             // Is this a User id?
891 891
             $user = DB::queryFirstRow(
892 892
                 'SELECT id, login
893
-                FROM ' . prefixTable('users') . '
893
+                FROM ' . prefixTable('users').'
894 894
                 WHERE id = %i',
895 895
                 $elem->title
896 896
             );
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
             'label' => $data['label'],
910 910
             'description' => $data['description'],
911 911
             'tags' => empty($tags) === false ? $tags : 'None',
912
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
912
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
913 913
             'id_tree' => $data['id_tree'],
914 914
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
915 915
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -931,53 +931,53 @@  discard block
 block discarded – undo
931 931
 function getStatisticsData(array $SETTINGS): array
932 932
 {
933 933
     DB::query(
934
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
934
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
935 935
         0
936 936
     );
937 937
     $counter_folders = DB::count();
938 938
     DB::query(
939
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
939
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
940 940
         1
941 941
     );
942 942
     $counter_folders_perso = DB::count();
943 943
     DB::query(
944
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
944
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
945 945
         0
946 946
     );
947 947
     $counter_items = DB::count();
948 948
         DB::query(
949
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
949
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
950 950
         1
951 951
     );
952 952
     $counter_items_perso = DB::count();
953 953
         DB::query(
954
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
954
+        'SELECT id FROM '.prefixTable('users').' WHERE login NOT IN (%s, %s, %s)',
955 955
         'OTV', 'TP', 'API'
956 956
     );
957 957
     $counter_users = DB::count();
958 958
         DB::query(
959
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
959
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
960 960
         1
961 961
     );
962 962
     $admins = DB::count();
963 963
     DB::query(
964
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
964
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
965 965
         1
966 966
     );
967 967
     $managers = DB::count();
968 968
     DB::query(
969
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
969
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
970 970
         1
971 971
     );
972 972
     $readOnly = DB::count();
973 973
     // list the languages
974 974
     $usedLang = [];
975 975
     $tp_languages = DB::query(
976
-        'SELECT name FROM ' . prefixTable('languages')
976
+        'SELECT name FROM '.prefixTable('languages')
977 977
     );
978 978
     foreach ($tp_languages as $tp_language) {
979 979
         DB::query(
980
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
980
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
981 981
             $tp_language['name']
982 982
         );
983 983
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
     // get list of ips
987 987
     $usedIp = [];
988 988
     $tp_ips = DB::query(
989
-        'SELECT user_ip FROM ' . prefixTable('users')
989
+        'SELECT user_ip FROM '.prefixTable('users')
990 990
     );
991 991
     foreach ($tp_ips as $ip) {
992 992
         if (array_key_exists($ip['user_ip'], $usedIp)) {
993 993
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
994
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
994
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
995 995
             $usedIp[$ip['user_ip']] = 1;
996 996
         }
997 997
     }
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1087 1087
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1088 1088
         <br><div style="float:right;">' .
1089
-        $textMail .
1089
+        $textMail.
1090 1090
         '<br><br></td></tr></table>
1091 1091
     </td></tr></table>
1092 1092
     <br></body></html>';
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 {
1168 1168
     array_walk_recursive(
1169 1169
         $array,
1170
-        static function (&$item): void {
1170
+        static function(&$item): void {
1171 1171
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1172 1172
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1173 1173
             }
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
  */
1279 1279
 function prefixTable(string $table): string
1280 1280
 {
1281
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1281
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1282 1282
     return $safeTable;
1283 1283
 }
1284 1284
 
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1396 1396
 {
1397 1397
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1398
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1398
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1399 1399
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1400 1400
     socket_close($sock);
1401 1401
 }
@@ -1442,14 +1442,14 @@  discard block
 block discarded – undo
1442 1442
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1443 1443
         if ($type === 'user_mngt') {
1444 1444
             send_syslog(
1445
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1445
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1446 1446
                 $SETTINGS['syslog_host'],
1447 1447
                 $SETTINGS['syslog_port'],
1448 1448
                 'teampass'
1449 1449
             );
1450 1450
         } else {
1451 1451
             send_syslog(
1452
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1452
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1453 1453
                 $SETTINGS['syslog_host'],
1454 1454
                 $SETTINGS['syslog_port'],
1455 1455
                 'teampass'
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
         if (empty($item_label) === true) {
1525 1525
             $dataItem = DB::queryFirstRow(
1526 1526
                 'SELECT id, id_tree, label
1527
-                FROM ' . prefixTable('items') . '
1527
+                FROM ' . prefixTable('items').'
1528 1528
                 WHERE id = %i',
1529 1529
                 $item_id
1530 1530
             );
@@ -1532,11 +1532,11 @@  discard block
 block discarded – undo
1532 1532
         }
1533 1533
 
1534 1534
         send_syslog(
1535
-            'action=' . str_replace('at_', '', $action) .
1536
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1537
-                ' itemno=' . $item_id .
1538
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1539
-                ' itemname="' . addslashes($item_label) . '"',
1535
+            'action='.str_replace('at_', '', $action).
1536
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1537
+                ' itemno='.$item_id.
1538
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1539
+                ' itemname="'.addslashes($item_label).'"',
1540 1540
             $SETTINGS['syslog_host'],
1541 1541
             $SETTINGS['syslog_port'],
1542 1542
             'teampass'
@@ -1567,8 +1567,8 @@  discard block
 block discarded – undo
1567 1567
     // send email to user that what to be notified
1568 1568
     $notification = DB::queryFirstField(
1569 1569
         'SELECT email
1570
-        FROM ' . prefixTable('notification') . ' AS n
1571
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1570
+        FROM ' . prefixTable('notification').' AS n
1571
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1572 1572
         WHERE n.item_id = %i AND n.user_id != %i',
1573 1573
         $item_id,
1574 1574
         $globalsUserId
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
         // Get list of changes
1580 1580
         $htmlChanges = '<ul>';
1581 1581
         foreach ($changes as $change) {
1582
-            $htmlChanges .= '<li>' . $change . '</li>';
1582
+            $htmlChanges .= '<li>'.$change.'</li>';
1583 1583
         }
1584 1584
         $htmlChanges .= '</ul>';
1585 1585
         // send email
@@ -1616,15 +1616,15 @@  discard block
 block discarded – undo
1616 1616
     $path = '';
1617 1617
     foreach ($arbo as $elem) {
1618 1618
         if (empty($path) === true) {
1619
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1619
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1620 1620
         } else {
1621
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1621
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1622 1622
         }
1623 1623
     }
1624 1624
 
1625 1625
     // Build text to show user
1626 1626
     if (empty($label) === false) {
1627
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1627
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1628 1628
     }
1629 1629
     return empty($path) === true ? '' : $path;
1630 1630
 }
@@ -1680,7 +1680,7 @@  discard block
 block discarded – undo
1680 1680
 {
1681 1681
     // Perform a copy if the file exists
1682 1682
     if (file_exists($configFilePath)) {
1683
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1683
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1684 1684
         if (!copy($configFilePath, $backupFilePath)) {
1685 1685
             return "ERROR: Could not copy file '$configFilePath'";
1686 1686
         }
@@ -1688,10 +1688,10 @@  discard block
 block discarded – undo
1688 1688
 
1689 1689
     // Regenerate the config file
1690 1690
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1691
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1691
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1692 1692
     foreach ($rows as $record) {
1693 1693
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1694
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1694
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1695 1695
     }
1696 1696
     $data[] = ");\n";
1697 1697
     $data = array_unique($data);
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 {
1737 1737
     global $SETTINGS;
1738 1738
     /* LOAD CPASSMAN SETTINGS */
1739
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1739
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1740 1740
         $SETTINGS = [];
1741 1741
         $SETTINGS['duplicate_folder'] = 0;
1742 1742
         //by default, this is set to 0;
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
         //by default, this value is set to 5;
1747 1747
         $settings = [];
1748 1748
         $rows = DB::query(
1749
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1749
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1750 1750
             [
1751 1751
                 'type' => 'admin',
1752 1752
                 'type2' => 'settings',
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
     $source_cf = [];
1779 1779
     $rows = DB::query(
1780 1780
         'SELECT id_category
1781
-            FROM ' . prefixTable('categories_folders') . '
1781
+            FROM ' . prefixTable('categories_folders').'
1782 1782
             WHERE id_folder = %i',
1783 1783
         $source_id
1784 1784
     );
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
     $target_cf = [];
1790 1790
     $rows = DB::query(
1791 1791
         'SELECT id_category
1792
-            FROM ' . prefixTable('categories_folders') . '
1792
+            FROM ' . prefixTable('categories_folders').'
1793 1793
             WHERE id_folder = %i',
1794 1794
         $target_id
1795 1795
     );
@@ -1884,10 +1884,10 @@  discard block
 block discarded – undo
1884 1884
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1885 1885
         $err = 'wrong_key';
1886 1886
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1887
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1887
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1888 1888
         $err = 'environment_error';
1889 1889
     } catch (CryptoException\IOException $ex) {
1890
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1890
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1891 1891
         $err = 'general_error';
1892 1892
     }
1893 1893
 
@@ -1920,10 +1920,10 @@  discard block
 block discarded – undo
1920 1920
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1921 1921
         $err = 'wrong_key';
1922 1922
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1923
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1923
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1924 1924
         $err = 'environment_error';
1925 1925
     } catch (CryptoException\IOException $ex) {
1926
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1926
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1927 1927
         $err = 'general_error';
1928 1928
     }
1929 1929
 
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 ) {
2010 2010
     // Check if the path exists
2011 2011
     $path = basename($path);
2012
-    if (! file_exists($path)) {
2012
+    if (!file_exists($path)) {
2013 2013
         return false;
2014 2014
     }
2015 2015
 
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
     // Load item data
2063 2063
     $data = DB::queryFirstRow(
2064 2064
         'SELECT id_tree
2065
-        FROM ' . prefixTable('items') . '
2065
+        FROM ' . prefixTable('items').'
2066 2066
         WHERE id = %i',
2067 2067
         $item_id
2068 2068
     );
@@ -2125,7 +2125,7 @@  discard block
 block discarded – undo
2125 2125
         }
2126 2126
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2127 2127
     }
2128
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2128
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2129 2129
     return $email;
2130 2130
 }
2131 2131
 
@@ -2156,11 +2156,11 @@  discard block
 block discarded – undo
2156 2156
 function formatSizeUnits(int $bytes): string
2157 2157
 {
2158 2158
     if ($bytes >= 1073741824) {
2159
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2159
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2160 2160
     } elseif ($bytes >= 1048576) {
2161
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2161
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2162 2162
     } elseif ($bytes >= 1024) {
2163
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2163
+        $bytes = number_format($bytes / 1024, 2).' KB';
2164 2164
     } elseif ($bytes > 1) {
2165 2165
         $bytes .= ' bytes';
2166 2166
     } elseif ($bytes === 1) {
@@ -2409,7 +2409,7 @@  discard block
 block discarded – undo
2409 2409
     $cipher->enableContinuousBuffer();
2410 2410
 
2411 2411
     // Encrypt the file content
2412
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2412
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2413 2413
     $fileContent = file_get_contents($filePath);
2414 2414
     $plaintext = $fileContent;
2415 2415
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2417,9 +2417,9 @@  discard block
 block discarded – undo
2417 2417
     // Save new file
2418 2418
     // deepcode ignore InsecureHash: is simply used to get a unique name
2419 2419
     $hash = uniqid('', true);
2420
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2420
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2421 2421
     file_put_contents($fileOut, $ciphertext);
2422
-    unlink($fileInPath . '/' . $fileInName);
2422
+    unlink($fileInPath.'/'.$fileInName);
2423 2423
     return [
2424 2424
         'fileHash' => base64_encode($hash),
2425 2425
         'objectKey' => base64_encode($objectKey),
@@ -2435,9 +2435,9 @@  discard block
 block discarded – undo
2435 2435
  *
2436 2436
  * @return string|array
2437 2437
  */
2438
-function decryptFile(string $fileName, string $filePath, string $key): string|array
2438
+function decryptFile(string $fileName, string $filePath, string $key): string | array
2439 2439
 {
2440
-    if (! defined('FILE_BUFFER_SIZE')) {
2440
+    if (!defined('FILE_BUFFER_SIZE')) {
2441 2441
         define('FILE_BUFFER_SIZE', 128 * 1024);
2442 2442
     }
2443 2443
     
@@ -2454,7 +2454,7 @@  discard block
 block discarded – undo
2454 2454
     $cipher->enableContinuousBuffer();
2455 2455
     $cipher->disablePadding();
2456 2456
     // Get file content
2457
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2457
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2458 2458
     if ($safeFilePath !== false && file_exists($safeFilePath)) {
2459 2459
         $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2460 2460
     } else {
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
         // Only create the sharekey for a user
2551 2551
         $user = DB::queryFirstRow(
2552 2552
             'SELECT public_key
2553
-            FROM ' . prefixTable('users') . '
2553
+            FROM ' . prefixTable('users').'
2554 2554
             WHERE id = %i
2555 2555
             AND public_key != ""',
2556 2556
             $userId
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
         }
2592 2592
         $users = DB::query(
2593 2593
             'SELECT id, public_key
2594
-            FROM ' . prefixTable('users') . '
2594
+            FROM ' . prefixTable('users').'
2595 2595
             WHERE id NOT IN %li
2596 2596
             AND public_key != ""',
2597 2597
             $user_ids
@@ -2600,7 +2600,7 @@  discard block
 block discarded – undo
2600 2600
         foreach ($users as $user) {
2601 2601
             // Insert in DB the new object key for this item by user
2602 2602
             if (count($objectKeyArray) === 0) {
2603
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2603
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2604 2604
                 DB::insert(
2605 2605
                     $object_name,
2606 2606
                     [
@@ -2614,7 +2614,7 @@  discard block
 block discarded – undo
2614 2614
                 );
2615 2615
             } else {
2616 2616
                 foreach ($objectKeyArray as $object) {
2617
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2617
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2618 2618
                     DB::insert(
2619 2619
                         $object_name,
2620 2620
                         [
@@ -2642,7 +2642,7 @@  discard block
 block discarded – undo
2642 2642
 function isBase64(string $str): bool
2643 2643
 {
2644 2644
     $str = (string) trim($str);
2645
-    if (! isset($str[0])) {
2645
+    if (!isset($str[0])) {
2646 2646
         return false;
2647 2647
     }
2648 2648
 
@@ -2716,7 +2716,7 @@  discard block
 block discarded – undo
2716 2716
     } catch (\LdapRecord\Auth\BindException $e) {
2717 2717
         $error = $e->getDetailedError();
2718 2718
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2719
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2719
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2720 2720
         }
2721 2721
         // deepcode ignore ServerLeak: No important data is sent
2722 2722
         echo 'An error occurred.';
@@ -2733,7 +2733,7 @@  discard block
 block discarded – undo
2733 2733
     } catch (\LdapRecord\Auth\BindException $e) {
2734 2734
         $error = $e->getDetailedError();
2735 2735
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2736
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2736
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2737 2737
         }
2738 2738
         // deepcode ignore ServerLeak: No important data is sent
2739 2739
         echo 'An error occurred.';
@@ -2760,7 +2760,7 @@  discard block
 block discarded – undo
2760 2760
     // expect if personal item
2761 2761
     DB::delete(
2762 2762
         prefixTable('sharekeys_items'),
2763
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2763
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2764 2764
         $userId
2765 2765
     );
2766 2766
     // Remove all item sharekeys files
@@ -2768,8 +2768,8 @@  discard block
 block discarded – undo
2768 2768
         prefixTable('sharekeys_files'),
2769 2769
         'user_id = %i AND object_id NOT IN (
2770 2770
             SELECT f.id 
2771
-            FROM ' . prefixTable('items') . ' AS i 
2772
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2771
+            FROM ' . prefixTable('items').' AS i 
2772
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2773 2773
             WHERE i.perso = 1
2774 2774
         )',
2775 2775
         $userId
@@ -2779,8 +2779,8 @@  discard block
 block discarded – undo
2779 2779
         prefixTable('sharekeys_fields'),
2780 2780
         'user_id = %i AND object_id NOT IN (
2781 2781
             SELECT c.id 
2782
-            FROM ' . prefixTable('items') . ' AS i 
2783
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2782
+            FROM ' . prefixTable('items').' AS i 
2783
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2784 2784
             WHERE i.perso = 1
2785 2785
         )',
2786 2786
         $userId
@@ -2788,13 +2788,13 @@  discard block
 block discarded – undo
2788 2788
     // Remove all item sharekeys logs
2789 2789
     DB::delete(
2790 2790
         prefixTable('sharekeys_logs'),
2791
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2791
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2792 2792
         $userId
2793 2793
     );
2794 2794
     // Remove all item sharekeys suggestions
2795 2795
     DB::delete(
2796 2796
         prefixTable('sharekeys_suggestions'),
2797
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2797
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2798 2798
         $userId
2799 2799
     );
2800 2800
     return false;
@@ -2815,7 +2815,7 @@  discard block
 block discarded – undo
2815 2815
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2816 2816
             $now->setTimezone(new DateTimeZone($timezone));
2817 2817
             $offsets[] = $offset = $now->getOffset();
2818
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2818
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2819 2819
         }
2820 2820
 
2821 2821
         array_multisort($offsets, $timezones);
@@ -2835,7 +2835,7 @@  discard block
 block discarded – undo
2835 2835
 {
2836 2836
     $hours = intval($offset / 3600);
2837 2837
     $minutes = abs(intval($offset % 3600 / 60));
2838
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2838
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2839 2839
 }
2840 2840
 
2841 2841
 /**
@@ -2934,8 +2934,7 @@  discard block
 block discarded – undo
2934 2934
 {
2935 2935
     if (isset($array[$key]) === true
2936 2936
         && (is_int($value) === true ?
2937
-            (int) $array[$key] === $value :
2938
-            (string) $array[$key] === $value)
2937
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
2939 2938
     ) {
2940 2939
         return true;
2941 2940
     }
@@ -2957,8 +2956,7 @@  discard block
 block discarded – undo
2957 2956
 {
2958 2957
     if (isset($var) === false
2959 2958
         || (is_int($value) === true ?
2960
-            (int) $var === $value :
2961
-            (string) $var === $value)
2959
+            (int) $var === $value : (string) $var === $value)
2962 2960
     ) {
2963 2961
         return true;
2964 2962
     }
@@ -3009,7 +3007,7 @@  discard block
 block discarded – undo
3009 3007
  */
3010 3008
 function isSetArrayOfValues(array $arrayOfValues): bool
3011 3009
 {
3012
-    foreach($arrayOfValues as $value) {
3010
+    foreach ($arrayOfValues as $value) {
3013 3011
         if (isset($value) === false) {
3014 3012
             return false;
3015 3013
         }
@@ -3031,7 +3029,7 @@  discard block
 block discarded – undo
3031 3029
     /*PHP8 - integer|string*/$value
3032 3030
 ) : bool
3033 3031
 {
3034
-    foreach($arrayOfVars as $variable) {
3032
+    foreach ($arrayOfVars as $variable) {
3035 3033
         if ($variable !== $value) {
3036 3034
             return false;
3037 3035
         }
@@ -3051,7 +3049,7 @@  discard block
 block discarded – undo
3051 3049
     /*PHP8 - integer|string*/$value
3052 3050
 ) : bool
3053 3051
 {
3054
-    foreach($arrayOfVars as $variable) {
3052
+    foreach ($arrayOfVars as $variable) {
3055 3053
         if ($variable === $value) {
3056 3054
             return true;
3057 3055
         }
@@ -3065,7 +3063,7 @@  discard block
 block discarded – undo
3065 3063
  * @param string|int|null $value
3066 3064
  * @return boolean
3067 3065
  */
3068
-function isValueSetNullEmpty(string|int|null $value) : bool
3066
+function isValueSetNullEmpty(string | int | null $value) : bool
3069 3067
 {
3070 3068
     if (is_null($value) === true || empty($value) === true) {
3071 3069
         return true;
@@ -3120,7 +3118,7 @@  discard block
 block discarded – undo
3120 3118
  * @param array     $filters
3121 3119
  * @return array|string
3122 3120
  */
3123
-function dataSanitizer(array $data, array $filters): array|string
3121
+function dataSanitizer(array $data, array $filters): array | string
3124 3122
 {
3125 3123
     // Load Sanitizer library
3126 3124
     $sanitizer = new Sanitizer($data, $filters);
@@ -3149,7 +3147,7 @@  discard block
 block discarded – undo
3149 3147
     // Exists ?
3150 3148
     $userCacheId = DB::queryFirstRow(
3151 3149
         'SELECT increment_id
3152
-        FROM ' . prefixTable('cache_tree') . '
3150
+        FROM ' . prefixTable('cache_tree').'
3153 3151
         WHERE user_id = %i',
3154 3152
         $user_id
3155 3153
     );
@@ -3200,7 +3198,7 @@  discard block
 block discarded – undo
3200 3198
  */
3201 3199
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3202 3200
 { 
3203
-    $resultat = ($nombre/$total) * $pourcentage;
3201
+    $resultat = ($nombre / $total) * $pourcentage;
3204 3202
     return round($resultat);
3205 3203
 }
3206 3204
 
@@ -3230,7 +3228,7 @@  discard block
 block discarded – undo
3230 3228
 
3231 3229
     // Get last folder update
3232 3230
     $lastFolderChange = DB::queryFirstRow(
3233
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3231
+        'SELECT valeur FROM '.prefixTable('misc').'
3234 3232
         WHERE type = %s AND intitule = %s',
3235 3233
         'timestamp',
3236 3234
         'last_folder_change'
@@ -3251,7 +3249,7 @@  discard block
 block discarded – undo
3251 3249
     // Does this user has a tree cache
3252 3250
     $userCacheTree = DB::queryFirstRow(
3253 3251
         'SELECT '.$fieldName.'
3254
-        FROM ' . prefixTable('cache_tree') . '
3252
+        FROM ' . prefixTable('cache_tree').'
3255 3253
         WHERE user_id = %i',
3256 3254
         $session->get('user-id')
3257 3255
     );
@@ -3289,7 +3287,7 @@  discard block
 block discarded – undo
3289 3287
     if (count($folderIds) === 0) {
3290 3288
         $folderIds = DB::queryFirstColumn(
3291 3289
             'SELECT id
3292
-            FROM ' . prefixTable('nested_tree') . '
3290
+            FROM ' . prefixTable('nested_tree').'
3293 3291
             WHERE personal_folder=%i',
3294 3292
             0
3295 3293
         );
@@ -3306,8 +3304,8 @@  discard block
 block discarded – undo
3306 3304
         $rows_tmp = DB::query(
3307 3305
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3308 3306
             f.id_category AS category_id
3309
-            FROM ' . prefixTable('categories_folders') . ' AS f
3310
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3307
+            FROM ' . prefixTable('categories_folders').' AS f
3308
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3311 3309
             WHERE id_folder=%i',
3312 3310
             $folder
3313 3311
         );
@@ -3333,7 +3331,7 @@  discard block
 block discarded – undo
3333 3331
         $valTemp = '';
3334 3332
         $data = DB::queryFirstRow(
3335 3333
             'SELECT valeur
3336
-            FROM ' . prefixTable('misc') . '
3334
+            FROM ' . prefixTable('misc').'
3337 3335
             WHERE type = %s AND intitule=%i',
3338 3336
             'complex',
3339 3337
             $folder
@@ -3350,14 +3348,14 @@  discard block
 block discarded – undo
3350 3348
         $valTemp = '';
3351 3349
         $rows_tmp = DB::query(
3352 3350
             'SELECT t.title
3353
-            FROM ' . prefixTable('roles_values') . ' as v
3354
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3351
+            FROM ' . prefixTable('roles_values').' as v
3352
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3355 3353
             WHERE v.folder_id = %i
3356 3354
             GROUP BY title',
3357 3355
             $folder
3358 3356
         );
3359 3357
         foreach ($rows_tmp as $record) {
3360
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3358
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3361 3359
         }
3362 3360
         $arr_data['visibilityRoles'] = $valTemp;
3363 3361
 
@@ -3390,7 +3388,7 @@  discard block
 block discarded – undo
3390 3388
         // loop on users and check if user has this role
3391 3389
         $rows = DB::query(
3392 3390
             'SELECT id, fonction_id
3393
-            FROM ' . prefixTable('users') . '
3391
+            FROM ' . prefixTable('users').'
3394 3392
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3395 3393
             $session->get('user-id')
3396 3394
         );
@@ -3422,7 +3420,7 @@  discard block
 block discarded – undo
3422 3420
 
3423 3421
     $val = DB::queryFirstRow(
3424 3422
         'SELECT *
3425
-        FROM ' . prefixTable('users') . '
3423
+        FROM ' . prefixTable('users').'
3426 3424
         WHERE id = %i',
3427 3425
         $userId
3428 3426
     );
@@ -3438,12 +3436,12 @@  discard block
 block discarded – undo
3438 3436
 function upgradeRequired(): bool
3439 3437
 {
3440 3438
     // Get settings.php
3441
-    include_once __DIR__. '/../includes/config/settings.php';
3439
+    include_once __DIR__.'/../includes/config/settings.php';
3442 3440
 
3443 3441
     // Get timestamp in DB
3444 3442
     $val = DB::queryFirstRow(
3445 3443
         'SELECT valeur
3446
-        FROM ' . prefixTable('misc') . '
3444
+        FROM ' . prefixTable('misc').'
3447 3445
         WHERE type = %s AND intitule = %s',
3448 3446
         'admin',
3449 3447
         'upgrade_timestamp'
@@ -3494,7 +3492,7 @@  discard block
 block discarded – undo
3494 3492
     // prepapre background tasks for item keys generation        
3495 3493
     $userTP = DB::queryFirstRow(
3496 3494
         'SELECT pw, public_key, private_key
3497
-        FROM ' . prefixTable('users') . '
3495
+        FROM ' . prefixTable('users').'
3498 3496
         WHERE id = %i',
3499 3497
         TP_USER_ID
3500 3498
     );
@@ -3555,7 +3553,7 @@  discard block
 block discarded – undo
3555 3553
     }
3556 3554
 
3557 3555
     // Generate new keys
3558
-    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3556
+    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3559 3557
         $userKeys = [
3560 3558
             'public_key' => $recovery_public_key,
3561 3559
             'private_key_clear' => $recovery_private_key,
@@ -3598,8 +3596,8 @@  discard block
 block discarded – undo
3598 3596
             'process_type' => 'create_user_keys',
3599 3597
             'arguments' => json_encode([
3600 3598
                 'new_user_id' => (int) $userId,
3601
-                'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3602
-                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3599
+                'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3600
+                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3603 3601
                 'owner_id' => (int) TP_USER_ID,
3604 3602
                 'creator_pwd' => $userTP['pw'],
3605 3603
                 'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -3670,19 +3668,19 @@  discard block
 block discarded – undo
3670 3668
 
3671 3669
     // Prepare the subtask queries
3672 3670
     $queries = [
3673
-        'step20' => 'SELECT * FROM ' . prefixTable('items'),
3671
+        'step20' => 'SELECT * FROM '.prefixTable('items'),
3674 3672
 
3675
-        'step30' => 'SELECT * FROM ' . prefixTable('log_items') . 
3673
+        'step30' => 'SELECT * FROM '.prefixTable('log_items'). 
3676 3674
                     ' WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"',
3677 3675
 
3678
-        'step40' => 'SELECT * FROM ' . prefixTable('categories_items') . 
3676
+        'step40' => 'SELECT * FROM '.prefixTable('categories_items'). 
3679 3677
                     ' WHERE encryption_type = "teampass_aes"',
3680 3678
 
3681
-        'step50' => 'SELECT * FROM ' . prefixTable('suggestion'),
3679
+        'step50' => 'SELECT * FROM '.prefixTable('suggestion'),
3682 3680
 
3683
-        'step60' => 'SELECT * FROM ' . prefixTable('files') . ' AS f
3684
-                        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
3685
-                        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"'
3681
+        'step60' => 'SELECT * FROM '.prefixTable('files').' AS f
3682
+                        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
3683
+                        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"'
3686 3684
     ];
3687 3685
 
3688 3686
     // Perform loop on $queries to create sub-tasks
@@ -3872,7 +3870,7 @@  discard block
 block discarded – undo
3872 3870
  */
3873 3871
 function createTaskForItem(
3874 3872
     string $processType,
3875
-    string|array $taskName,
3873
+    string | array $taskName,
3876 3874
     int $itemId,
3877 3875
     int $userId,
3878 3876
     string $objectKey,
@@ -3896,7 +3894,7 @@  discard block
 block discarded – undo
3896 3894
                 'object_key' => $objectKey,
3897 3895
                 'author' => (int) $userId,
3898 3896
             ]),
3899
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
3897
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
3900 3898
         )
3901 3899
     );
3902 3900
     $processId = DB::insertId();
@@ -3906,7 +3904,7 @@  discard block
 block discarded – undo
3906 3904
     if (is_array($taskName) === false) {
3907 3905
         $taskName = [$taskName];
3908 3906
     }
3909
-    foreach($taskName as $task) {
3907
+    foreach ($taskName as $task) {
3910 3908
         if (WIP === true) error_log('createTaskForItem - task: '.$task);
3911 3909
         switch ($task) {
3912 3910
             case 'item_password':
@@ -4003,7 +4001,7 @@  discard block
 block discarded – undo
4003 4001
  * @param integer $user_id
4004 4002
  * @return void
4005 4003
  */
4006
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4004
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4007 4005
 {
4008 4006
     if ($allUsers === true) {
4009 4007
         // Load class DB
@@ -4013,7 +4011,7 @@  discard block
 block discarded – undo
4013 4011
 
4014 4012
         $users = DB::query(
4015 4013
             'SELECT id
4016
-            FROM ' . prefixTable('users') . '
4014
+            FROM ' . prefixTable('users').'
4017 4015
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4018 4016
             ORDER BY login ASC'
4019 4017
         );
@@ -4031,7 +4029,7 @@  discard block
 block discarded – undo
4031 4029
  * @param integer $user_id
4032 4030
  * @return void
4033 4031
  */
4034
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4032
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4035 4033
 {
4036 4034
     if ($user_id === 0) {
4037 4035
         return;
@@ -4042,8 +4040,8 @@  discard block
 block discarded – undo
4042 4040
 
4043 4041
     $personalItems = DB::queryFirstColumn(
4044 4042
         'SELECT id
4045
-        FROM ' . prefixTable('items') . ' AS i
4046
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4043
+        FROM ' . prefixTable('items').' AS i
4044
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4047 4045
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4048 4046
         $user_id
4049 4047
     );
@@ -4092,7 +4090,7 @@  discard block
 block discarded – undo
4092 4090
     // Check if user exists
4093 4091
     $userInfo = DB::queryFirstRow(
4094 4092
         'SELECT login
4095
-        FROM ' . prefixTable('users') . '
4093
+        FROM ' . prefixTable('users').'
4096 4094
         WHERE id = %i',
4097 4095
         $userId
4098 4096
     );
@@ -4101,7 +4099,7 @@  discard block
 block discarded – undo
4101 4099
         $now = (int) time();
4102 4100
         // Prepare file content
4103 4101
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4104
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4102
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4105 4103
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4106 4104
             "Public Key:\n".$session->get('user-public_key')."\n\n".
4107 4105
             "Private Key:\n".$session->get('user-private_key')."\n\n";
@@ -4124,7 +4122,7 @@  discard block
 block discarded – undo
4124 4122
         return prepareExchangedData(
4125 4123
             array(
4126 4124
                 'error' => false,
4127
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4125
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4128 4126
                 'timestamp' => $now,
4129 4127
                 'content' => base64_encode($export_value),
4130 4128
                 'login' => $userInfo['login'],
@@ -4150,8 +4148,8 @@  discard block
 block discarded – undo
4150 4148
  */
4151 4149
 function loadClasses(string $className = ''): void
4152 4150
 {
4153
-    require_once __DIR__. '/../includes/config/include.php';
4154
-    require_once __DIR__. '/../includes/config/settings.php';
4151
+    require_once __DIR__.'/../includes/config/include.php';
4152
+    require_once __DIR__.'/../includes/config/settings.php';
4155 4153
     require_once __DIR__.'/../vendor/autoload.php';
4156 4154
 
4157 4155
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4364,7 +4362,7 @@  discard block
 block discarded – undo
4364 4362
 
4365 4363
     // Get current user hash
4366 4364
     $userHash = DB::queryFirstRow(
4367
-        "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
4365
+        "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
4368 4366
         $session->get('user-id')
4369 4367
     )['pw'];
4370 4368
 
@@ -4412,11 +4410,11 @@  discard block
 block discarded – undo
4412 4410
         }
4413 4411
         
4414 4412
         // Alternative: serialize ou json selon le contexte
4415
-        return get_class($value) . (method_exists($value, 'getId') ? '#' . $value->getId() : '');
4413
+        return get_class($value).(method_exists($value, 'getId') ? '#'.$value->getId() : '');
4416 4414
     }
4417 4415
     
4418 4416
     if (is_resource($value)) {
4419
-        return 'Resource#' . get_resource_id($value) . ' of type ' . get_resource_type($value);
4417
+        return 'Resource#'.get_resource_id($value).' of type '.get_resource_type($value);
4420 4418
     }
4421 4419
     
4422 4420
     // Cas par défaut
@@ -4436,7 +4434,7 @@  discard block
 block discarded – undo
4436 4434
     // Refuse access if user does not exist and/or is admin
4437 4435
     $user = DB::queryFirstRow(
4438 4436
         'SELECT admin
4439
-        FROM ' . prefixTable('users') . '
4437
+        FROM ' . prefixTable('users').'
4440 4438
         WHERE id = %i',
4441 4439
         $userId
4442 4440
     );
@@ -4447,8 +4445,8 @@  discard block
 block discarded – undo
4447 4445
     // Get file info
4448 4446
     $file = DB::queryFirstRow(
4449 4447
         'SELECT f.id_item, i.id_tree
4450
-        FROM ' . prefixTable('files') . ' as f
4451
-        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
4448
+        FROM ' . prefixTable('files').' as f
4449
+        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
4452 4450
         WHERE f.id = %i',
4453 4451
         $fileId
4454 4452
     );
@@ -4457,7 +4455,7 @@  discard block
 block discarded – undo
4457 4455
     }
4458 4456
 
4459 4457
     // Check if user has access to the item
4460
-    include_once __DIR__. '/items.queries.php';
4458
+    include_once __DIR__.'/items.queries.php';
4461 4459
     $itemAccess = getCurrentAccessRights(
4462 4460
         (int) filter_var($userId, FILTER_SANITIZE_NUMBER_INT),
4463 4461
         (int) filter_var($file['id_item'], FILTER_SANITIZE_NUMBER_INT),
@@ -4490,7 +4488,7 @@  discard block
 block discarded – undo
4490 4488
     // Refuse access if user does not exist and/or is not admin
4491 4489
     $user = DB::queryFirstRow(
4492 4490
         'SELECT admin
4493
-        FROM ' . prefixTable('users') . '
4491
+        FROM ' . prefixTable('users').'
4494 4492
         WHERE id = %i',
4495 4493
         $userId
4496 4494
     );
@@ -4501,7 +4499,7 @@  discard block
 block discarded – undo
4501 4499
     // Ensure that user has performed the backup
4502 4500
     DB::queryFirstRow(
4503 4501
         'SELECT f.id
4504
-        FROM ' . prefixTable('log_system') . ' as f
4502
+        FROM ' . prefixTable('log_system').' as f
4505 4503
         WHERE f.type = %s AND f.label = %s AND f.qui = %i AND f.field_1 = %s',
4506 4504
         'admin_action',
4507 4505
         'dataBase backup',
Please login to merge, or discard this patch.