Passed
Push — master ( 0f3664...743a3e )
by Nils
06:44 queued 16s
created
sources/import.queries.php 1 patch
Spacing   +33 added lines, -33 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
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         );
168 168
 
169 169
         // Initialisation
170
-        $file = $SETTINGS['path_to_files_folder'] . '/' . $data['valeur'];
170
+        $file = $SETTINGS['path_to_files_folder'].'/'.$data['valeur'];
171 171
         $importation_possible = true;
172 172
         $valuesToImport = [];
173 173
         $items_number = 0;
@@ -224,26 +224,26 @@  discard block
 block discarded – undo
224 224
                 'ISO-8859-1',
225 225
                 'ISO-8859-15',
226 226
                 'Windows-1252',
227
-                'Windows-1251',  // Cyrillique
228
-                'CP1251',        // Cyrillique alternatif
229
-                'KOI8-R',        // Cyrillique russe
230
-                'Shift_JIS',     // Japonais
231
-                'EUC-JP',        // Japonais
232
-                'ISO-2022-JP',   // Japonais
233
-                'TIS-620',       // ThaĂŻ
234
-                'Windows-874',   // ThaĂŻ Windows
235
-                'Big5',          // Chinois traditionnel
236
-                'GB2312',        // Chinois simplifié
237
-                'GBK',           // Chinois simplifié étendu
238
-                'EUC-KR',        // Coréen
239
-                'ISO-8859-2',    // Europe centrale
240
-                'ISO-8859-5',    // Cyrillique ISO
241
-                'ISO-8859-7',    // Grec
242
-                'Windows-1250',  // Europe centrale
243
-                'Windows-1253',  // Grec
244
-                'Windows-1254',  // Turc
245
-                'Windows-1255',  // Hébreu
246
-                'Windows-1256',  // Arabe
227
+                'Windows-1251', // Cyrillique
228
+                'CP1251', // Cyrillique alternatif
229
+                'KOI8-R', // Cyrillique russe
230
+                'Shift_JIS', // Japonais
231
+                'EUC-JP', // Japonais
232
+                'ISO-2022-JP', // Japonais
233
+                'TIS-620', // ThaĂŻ
234
+                'Windows-874', // ThaĂŻ Windows
235
+                'Big5', // Chinois traditionnel
236
+                'GB2312', // Chinois simplifié
237
+                'GBK', // Chinois simplifié étendu
238
+                'EUC-KR', // Coréen
239
+                'ISO-8859-2', // Europe centrale
240
+                'ISO-8859-5', // Cyrillique ISO
241
+                'ISO-8859-7', // Grec
242
+                'Windows-1250', // Europe centrale
243
+                'Windows-1253', // Grec
244
+                'Windows-1254', // Turc
245
+                'Windows-1255', // Hébreu
246
+                'Windows-1256', // Arabe
247 247
             ];
248 248
             
249 249
             // Get the list of encodings supported by the system
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
         // Get the data and ensure columns are correctly mapped
288 288
         $interpreter = new Interpreter();
289
-        $interpreter->addObserver(function (array $row) use (&$valuesToImport, $header) {
289
+        $interpreter->addObserver(function(array $row) use (&$valuesToImport, $header) {
290 290
             $rowData = array_combine($header, $row);
291 291
 
292 292
             if ($rowData !== false) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             // Handle multiple lignes description
340 340
             if (strpos($comments, '<br>') !== false || strpos($label, '<br>') !== false) {
341 341
                 $continue_on_next_line = true;
342
-                $comment .= " " . $label . " " . $comments;
342
+                $comment .= " ".$label." ".$comments;
343 343
             } else {
344 344
                 // Insert previous line if changing line
345 345
                 if (!empty($label)) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                     // Insert in batch
349 349
                     $batchInsert[] = array(
350 350
                         'label'        => $label,
351
-                        'description'  => $comment . $comments,
351
+                        'description'  => $comment.$comments,
352 352
                         'pwd'          => $pwd,
353 353
                         'url'          => $url,
354 354
                         'folder'       => ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1) ? $folder : '',
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
             // Insert in batch
380 380
             $batchInsert[] = array(
381 381
                 'label'        => $label,
382
-                'description'  => $comment . $comments,
382
+                'description'  => $comment.$comments,
383 383
                 'pwd'          => $pwd,
384 384
                 'url'          => $url,
385 385
                 'folder'       => ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1) ? $folder : '',
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
             $values = [];
404 404
         
405 405
             foreach ($batchInsert as $data) {
406
-                $values[] = "('" . implode("','", array_map('addslashes', $data)) . "')";
406
+                $values[] = "('".implode("','", array_map('addslashes', $data))."')";
407 407
             }
408 408
         
409
-            $sql = "INSERT INTO `$tableName` (`label`, `description`, `pwd`, `url`, `folder`, `login`, `operation_id`) VALUES " . implode(',', $values);
409
+            $sql = "INSERT INTO `$tableName` (`label`, `description`, `pwd`, `url`, `folder`, `login`, `operation_id`) VALUES ".implode(',', $values);
410 410
             
411 411
             DB::query($sql);
412 412
         }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $parentId = $dataReceived['folderId']; // Strating with provided folder
490 490
 
491 491
             foreach ($parts as $part) {
492
-                $currentPath = trim($currentPath . "/" . $part, "/");
492
+                $currentPath = trim($currentPath."/".$part, "/");
493 493
                 $currentFolder = $part;
494 494
 
495 495
                 // Check if this folder has already been created
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
                         // Get ID of existing folder
551 551
                         $ret = DB::queryFirstRow(
552 552
                             'SELECT *
553
-                            FROM ' . prefixTable('nested_tree') . '
553
+                            FROM ' . prefixTable('nested_tree').'
554 554
                             WHERE title = %s',
555 555
                             $currentFolder
556 556
                         );
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
         ];
1073 1073
         $startPathLevel = 1;
1074 1074
 
1075
-        foreach($post_folders as $folder) {
1075
+        foreach ($post_folders as $folder) {
1076 1076
             // get parent id
1077 1077
             $parentId = $arrFolders[$folder['parentFolderId']];
1078 1078
 
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
         DB::startTransaction();
1144 1144
 
1145 1145
         // Import all items
1146
-        foreach($post_items as $item) {
1146
+        foreach ($post_items as $item) {
1147 1147
             // get info about this folder
1148 1148
             $destinationFolderMore = DB::queryFirstRow(
1149 1149
                 'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
     ];
1369 1369
 }
1370 1370
 
1371
-spl_autoload_register(function ($class) {
1371
+spl_autoload_register(function($class) {
1372 1372
     $prefix = 'League\\Csv\\';
1373 1373
     $base_dir = __DIR__.'/src/';
1374 1374
     $len = strlen($prefix);
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) {
75 75
     // Not allowed page
76 76
     $session->set('system-error_code', ERR_NOT_ALLOWED);
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit;
79 79
 }
80 80
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
         // Get info about user to modify
147 147
         $targetUserInfos = DB::queryFirstRow(
148
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
148
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
149 149
             WHERE id = %i',
150 150
             (int) $dataReceived['user_id']
151 151
         );
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             // Check if user already exists
278 278
             $data = DB::query(
279 279
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
280
-                FROM ' . prefixTable('users') . '
280
+                FROM ' . prefixTable('users').'
281 281
                 WHERE login = %s
282 282
                 AND deleted_at IS NULL',
283 283
                 $login
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
             // Get info about user to delete
498 498
             $data_user = DB::queryFirstRow(
499
-                'SELECT login, admin, isAdministratedByRole FROM ' . prefixTable('users') . '
499
+                'SELECT login, admin, isAdministratedByRole FROM '.prefixTable('users').'
500 500
                 WHERE id = %i',
501 501
                 $post_id
502 502
             );
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                 );
531 531
                 // delete personal folder and subfolders
532 532
                 $data = DB::queryFirstRow(
533
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
533
+                    'SELECT id FROM '.prefixTable('nested_tree').'
534 534
                     WHERE title = %s AND personal_folder = %i',
535 535
                     $post_id,
536 536
                     '1'
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
544 544
                         // delete items & logs
545 545
                         $items = DB::query(
546
-                            'SELECT id FROM ' . prefixTable('items') . '
546
+                            'SELECT id FROM '.prefixTable('items').'
547 547
                             WHERE id_tree=%i AND perso = %i',
548 548
                             $folder->id,
549 549
                             '1'
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                 // Delete any process related to user
568 568
                 $processes = DB::query(
569 569
                     'SELECT increment_id
570
-                    FROM ' . prefixTable('background_tasks') . '
570
+                    FROM ' . prefixTable('background_tasks').'
571 571
                     WHERE JSON_EXTRACT(arguments, "$.new_user_id") = %i',
572 572
                     $post_id
573 573
                 );
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
             $return = array();
621 621
             // Check if folder exists
622 622
             $data = DB::query(
623
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
623
+                'SELECT * FROM '.prefixTable('nested_tree').'
624 624
                 WHERE title = %s AND parent_id = %i',
625 625
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
626 626
                 '0'
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
             }
634 634
             // Check if role exists
635 635
             $data = DB::query(
636
-                'SELECT * FROM ' . prefixTable('roles_title') . '
636
+                'SELECT * FROM '.prefixTable('roles_title').'
637 637
                 WHERE title = %s',
638 638
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
639 639
             );
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
             // Get info about user to delete
663 663
             $data_user = DB::queryFirstRow(
664 664
                 'SELECT admin, isAdministratedByRole, gestionnaire
665
-                FROM ' . prefixTable('users') . '
665
+                FROM ' . prefixTable('users').'
666 666
                 WHERE id = %i',
667 667
                 $post_user_id
668 668
             );
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
             // Get info about user
719 719
             $rowUser = DB::queryFirstRow(
720 720
                 'SELECT *
721
-                FROM ' . prefixTable('users') . '
721
+                FROM ' . prefixTable('users').'
722 722
                 WHERE id = %i',
723 723
                 $post_id
724 724
             );
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 
746 746
                 $rows = DB::query('
747 747
                     SELECT id,title,creator_id 
748
-                    FROM ' . prefixTable('roles_title') .'
748
+                    FROM ' . prefixTable('roles_title').'
749 749
                     WHERE id IN %li',
750 750
                     $session->get('user-roles_array')
751 751
                 );
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
                 $rolesList = array();
784 784
                 $managedBy = array();
785 785
                 $selected = '';
786
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
786
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
787 787
                 foreach ($rows as $reccord) {
788 788
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
789 789
                 }
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
                         array_push(
815 815
                             $managedBy,
816 816
                             array(
817
-                                'title' => $lang->get('managers_of') . ' ' . $fonction['title'],
817
+                                'title' => $lang->get('managers_of').' '.$fonction['title'],
818 818
                                 'id' => $fonction['id'],
819 819
                                 'selected' => $selected,
820 820
                             )
@@ -896,9 +896,9 @@  discard block
 block discarded – undo
896 896
 
897 897
                 // get USER STATUS
898 898
                 if ($rowUser['disabled'] == 1) {
899
-                    $arrData['info'] = $lang->get('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . $lang->get('user_info_unlock_question') . '</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . $lang->get('user_info_delete_question') . '</label>';
899
+                    $arrData['info'] = $lang->get('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.$lang->get('user_info_unlock_question').'</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.$lang->get('user_info_delete_question').'</label>';
900 900
                 } else {
901
-                    $arrData['info'] = $lang->get('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . $lang->get('user_info_lock_question');
901
+                    $arrData['info'] = $lang->get('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.$lang->get('user_info_lock_question');
902 902
                 }
903 903
 
904 904
                 $arrData['error'] = false;
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 
986 986
             // Get info about user to modify
987 987
             $data_user = DB::queryFirstRow(
988
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
988
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
989 989
                 WHERE id = %i',
990 990
                 $post_id
991 991
             );
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
                 // count number of admins
997 997
                 $users = DB::query(
998 998
                     'SELECT id
999
-                    FROM ' . prefixTable('users') . '
999
+                    FROM ' . prefixTable('users').'
1000 1000
                     WHERE admin = 1 AND email != "" AND pw != "" AND id != %i',
1001 1001
                     $post_id
1002 1002
                 );
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
             // Exclude roles from AD - PR #3635
1020 1020
             $adRoles = DB::query(
1021 1021
                 'SELECT roles_from_ad_groups
1022
-                FROM ' . prefixTable('users') . '
1022
+                FROM ' . prefixTable('users').'
1023 1023
                 WHERE id = %i',
1024 1024
                 $post_id
1025 1025
             )[0]['roles_from_ad_groups'];
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
                     );
1124 1124
                     // delete personal folder and subfolders
1125 1125
                     $data = DB::queryFirstRow(
1126
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1126
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1127 1127
                         WHERE title = %s AND personal_folder = %i',
1128 1128
                         $post_id,
1129 1129
                         '1'
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1137 1137
                             // delete items & logs
1138 1138
                             $items = DB::query(
1139
-                                'SELECT id FROM ' . prefixTable('items') . '
1139
+                                'SELECT id FROM '.prefixTable('items').'
1140 1140
                                 WHERE id_tree=%i AND perso = %i',
1141 1141
                                 $folder->id,
1142 1142
                                 '1'
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
                 } else {
1158 1158
                     // Get old data about user
1159 1159
                     $oldData = DB::queryFirstRow(
1160
-                        'SELECT * FROM ' . prefixTable('users') . '
1160
+                        'SELECT * FROM '.prefixTable('users').'
1161 1161
                         WHERE id = %i',
1162 1162
                         $post_id
1163 1163
                     );
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 
1195 1195
                     // update LOG
1196 1196
                     if ($oldData['email'] !== $post_email) {
1197
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id);
1197
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id);
1198 1198
                     }
1199 1199
                 }
1200 1200
                 echo prepareExchangedData(
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
             }
1243 1243
 
1244 1244
             DB::queryFirstRow(
1245
-                'SELECT * FROM ' . prefixTable('users') . '
1245
+                'SELECT * FROM '.prefixTable('users').'
1246 1246
                 WHERE login = %s
1247 1247
                 AND deleted_at IS NULL',
1248 1248
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
             // get User info
1295 1295
             $rowUser = DB::queryFirstRow(
1296 1296
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb, roles_from_ad_groups
1297
-                FROM ' . prefixTable('users') . '
1297
+                FROM ' . prefixTable('users').'
1298 1298
                 WHERE id = %i',
1299 1299
                 $post_id
1300 1300
             );
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
             $html = '';
1305 1305
 
1306 1306
             if (isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1307
-                $rowUser['fonction_id'] = empty($rowUser['fonction_id'])  === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id']. ';' . $rowUser['roles_from_ad_groups'];
1307
+                $rowUser['fonction_id'] = empty($rowUser['fonction_id']) === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id'].';'.$rowUser['roles_from_ad_groups'];
1308 1308
             }
1309 1309
             $arrData['functions'] = array_filter(explode(';', $rowUser['fonction_id']));
1310 1310
             $arrData['allowed_folders'] = array_filter(explode(';', $rowUser['groupes_visibles']));
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
                 // refine folders based upon roles
1316 1316
                 $rows = DB::query(
1317 1317
                     'SELECT folder_id, type
1318
-                    FROM ' . prefixTable('roles_values') . '
1318
+                    FROM ' . prefixTable('roles_values').'
1319 1319
                     WHERE role_id IN %ls
1320 1320
                     ORDER BY folder_id ASC',
1321 1321
                     $arrData['functions']
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
                 }
1339 1339
 
1340 1340
                 // add allowed folders
1341
-                foreach($arrData['allowed_folders'] as $Fld) {
1341
+                foreach ($arrData['allowed_folders'] as $Fld) {
1342 1342
                     array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true));
1343 1343
                 }
1344 1344
                 
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
                             // get folder name
1350 1350
                             $row = DB::queryFirstRow(
1351 1351
                                 'SELECT title, nlevel, id
1352
-                                FROM ' . prefixTable('nested_tree') . '
1352
+                                FROM ' . prefixTable('nested_tree').'
1353 1353
                                 WHERE id = %i',
1354 1354
                                 $fld['id']
1355 1355
                             );
@@ -1362,38 +1362,38 @@  discard block
 block discarded – undo
1362 1362
 
1363 1363
                             // manage right icon
1364 1364
                             if ($fld['type'] == 'W') {
1365
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . $lang->get('write') . '"></i>' .
1366
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' .
1367
-                                    '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>';
1365
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.$lang->get('write').'"></i>'.
1366
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'.
1367
+                                    '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>';
1368 1368
                             } elseif ($fld['type'] == 'ND') {
1369
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1370
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' .
1371
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>';
1369
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1370
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'.
1371
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>';
1372 1372
                             } elseif ($fld['type'] == 'NE') {
1373
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1374
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' .
1375
-                                    '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>';
1373
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1374
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'.
1375
+                                    '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>';
1376 1376
                             } elseif ($fld['type'] == 'NDNE') {
1377
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1378
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' .
1379
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>';
1377
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1378
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'.
1379
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>';
1380 1380
                             } elseif ($fld['type'] == '') {
1381
-                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="' . $lang->get('no_access') . '"></i>';
1381
+                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="'.$lang->get('no_access').'"></i>';
1382 1382
                             } else {
1383
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . $lang->get('read') . '"></i>';
1383
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.$lang->get('read').'"></i>';
1384 1384
                             }
1385 1385
 
1386
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1387
-                                ' <small class="text-info">[' . $row['id'] . ']</small>'.
1388
-                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . $lang->get('user_specific_right') . '"></i>' : '').
1389
-                                '</td><td>' . $label . '</td></tr>';
1386
+                            $html .= '<tr><td>'.$ident.$row['title'].
1387
+                                ' <small class="text-info">['.$row['id'].']</small>'.
1388
+                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.$lang->get('user_specific_right').'"></i>' : '').
1389
+                                '</td><td>'.$label.'</td></tr>';
1390 1390
                             break;
1391 1391
                         }
1392 1392
                     }
1393 1393
                 }
1394 1394
 
1395
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1396
-                    $html . '</tbody></table>';
1395
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1396
+                    $html.'</tbody></table>';
1397 1397
             } else {
1398 1398
                 $html_full = '';
1399 1399
             }
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
             if ((int) $session->get('user-admin') === 0 && (int) $session->get('user-can_manage_all_users') === 0) {
1440 1440
                 $rows = DB::query(
1441 1441
                     'SELECT *
1442
-                    FROM ' . prefixTable('users') . '
1442
+                    FROM ' . prefixTable('users').'
1443 1443
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1444 1444
                     '0',
1445 1445
                     array_filter($session->get('user-roles_array'))
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
             } else {
1448 1448
                 $rows = DB::query(
1449 1449
                     'SELECT *
1450
-                    FROM ' . prefixTable('users') . '
1450
+                    FROM ' . prefixTable('users').'
1451 1451
                     WHERE admin = %i',
1452 1452
                     '0'
1453 1453
                 );
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
                 $groupIds = [];
1460 1460
                 foreach (explode(';', $record['fonction_id']) as $group) {
1461 1461
                     $tmp = DB::queryFirstRow(
1462
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1462
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1463 1463
                         WHERE id = %i',
1464 1464
                         $group
1465 1465
                     );
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
                 // Get managed_by
1473 1473
                 $managedBy = DB::queryFirstRow(
1474
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1474
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1475 1475
                     WHERE id = %i',
1476 1476
                     $record['isAdministratedByRole']
1477 1477
                 );
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
                 $foldersAllowedIds = [];
1482 1482
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1483 1483
                     $tmp = DB::queryFirstRow(
1484
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1484
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1485 1485
                         WHERE id = %i',
1486 1486
                         $role
1487 1487
                     );
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
                 $foldersForbiddenIds = [];
1495 1495
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1496 1496
                     $tmp = DB::queryFirstRow(
1497
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1497
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1498 1498
                         WHERE id = %i',
1499 1499
                         $role
1500 1500
                     );
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
                         'login' => $record['login'],
1513 1513
                         'groups' => implode(', ', $groups),
1514 1514
                         'groupIds' => $groupIds,
1515
-                        'managedBy' => $managedBy=== null ? $lang->get('administrator') : $managedBy['title'],
1515
+                        'managedBy' => $managedBy === null ? $lang->get('administrator') : $managedBy['title'],
1516 1516
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1517 1517
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1518 1518
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 
1614 1614
             // Get info about user
1615 1615
             $data_user = DB::queryFirstRow(
1616
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1616
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1617 1617
                 WHERE id = %i',
1618 1618
                 $inputData['source_id']
1619 1619
             );
@@ -1840,14 +1840,14 @@  discard block
 block discarded – undo
1840 1840
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
1841 1841
                 $data_user = DB::queryFirstRow(
1842 1842
                     'SELECT fonction_id, public_key
1843
-                    FROM ' . prefixTable('users') . '
1843
+                    FROM ' . prefixTable('users').'
1844 1844
                     WHERE id = %i',
1845 1845
                     $post_user_id
1846 1846
                 );
1847 1847
 
1848 1848
                 if ($data_user) {
1849 1849
                     // Ensure array is unique
1850
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
1850
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
1851 1851
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
1852 1852
                 } else {
1853 1853
                     // User not found
@@ -1863,14 +1863,14 @@  discard block
 block discarded – undo
1863 1863
             }
1864 1864
 
1865 1865
             // Manage specific case of api key
1866
-            if($post_field === 'user_api_key') {
1866
+            if ($post_field === 'user_api_key') {
1867 1867
                 $encrypted_key = encryptUserObjectKey(base64_encode($post_new_value), $session->get('user-public_key'));
1868 1868
                 $session->set('user-api_key', $post_new_value);
1869 1869
 
1870 1870
                 // test if user has an api key
1871 1871
                 $data_user = DB::queryFirstRow(
1872 1872
                     'SELECT value
1873
-                    FROM ' . prefixTable('api') . '
1873
+                    FROM ' . prefixTable('api').'
1874 1874
                     WHERE user_id = %i',
1875 1875
                     $post_user_id
1876 1876
                 );
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
             } catch (\LdapRecord\Auth\BindException $e) {
1991 1991
                 $error = $e->getDetailedError();
1992 1992
                 if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
1993
-                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
1993
+                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
1994 1994
                 }
1995 1995
                 // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending
1996 1996
                 echo prepareExchangedData(
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
             } catch (\LdapRecord\Auth\BindException $e) {
2021 2021
                 $error = $e->getDetailedError();
2022 2022
                 if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2023
-                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2023
+                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2024 2024
                 }
2025 2025
                 // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending
2026 2026
                 echo prepareExchangedData(
@@ -2037,7 +2037,7 @@  discard block
 block discarded – undo
2037 2037
                 if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue;
2038 2038
                 // Build the list of all groups in AD
2039 2039
                 if (isset($adUser['memberof']) === true) {
2040
-                    foreach($adUser['memberof'] as $j => $adUserGroup) {
2040
+                    foreach ($adUser['memberof'] as $j => $adUserGroup) {
2041 2041
                         if (empty($adUserGroup) === false && $j !== "count") {
2042 2042
                             $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2043 2043
                             if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
                     // Get his ID
2054 2054
                     $userInfo = DB::queryFirstRow(
2055 2055
                         'SELECT id, login, fonction_id, auth_type
2056
-                        FROM ' . prefixTable('users') . '
2056
+                        FROM ' . prefixTable('users').'
2057 2057
                         WHERE login = %s',
2058 2058
                         $userLogin
2059 2059
                     );
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
 
2090 2090
             // Get all groups in Teampass
2091 2091
             $teampassRoles = array();
2092
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2092
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2093 2093
             foreach ($rows as $record) {
2094 2094
                 array_push(
2095 2095
                     $teampassRoles,
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
             // Check if user already exists
2155 2155
             $data = DB::query(
2156 2156
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2157
-                FROM ' . prefixTable('users') . '
2157
+                FROM ' . prefixTable('users').'
2158 2158
                 WHERE login = %s',
2159 2159
                 $post_login
2160 2160
             );
@@ -2331,7 +2331,7 @@  discard block
 block discarded – undo
2331 2331
             // Check if user already exists
2332 2332
             DB::query(
2333 2333
                 'SELECT id
2334
-                FROM ' . prefixTable('users') . '
2334
+                FROM ' . prefixTable('users').'
2335 2335
                 WHERE id = %i',
2336 2336
                 $post_id
2337 2337
             );
@@ -2393,7 +2393,7 @@  discard block
 block discarded – undo
2393 2393
             // Get all groups in Teampass
2394 2394
             $teampassRoles = array();
2395 2395
             $titleToIdMap = [];
2396
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2396
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2397 2397
             foreach ($rows as $record) {
2398 2398
                 array_push(
2399 2399
                     $teampassRoles,
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
                     // Get his ID
2440 2440
                     $userInfo = DB::queryFirstRow(
2441 2441
                         'SELECT id, login, fonction_id, auth_type
2442
-                        FROM ' . prefixTable('users') . '
2442
+                        FROM ' . prefixTable('users').'
2443 2443
                         WHERE login = %s',
2444 2444
                         $userLogin
2445 2445
                     );
@@ -2546,7 +2546,7 @@  discard block
 block discarded – undo
2546 2546
             // Check if user already exists
2547 2547
             DB::query(
2548 2548
                 'SELECT id
2549
-                FROM ' . prefixTable('users') . '
2549
+                FROM ' . prefixTable('users').'
2550 2550
                 WHERE id = %i',
2551 2551
                 $post_id
2552 2552
             );
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
             // Search TP_USER in db        
2614 2614
             $userTP = DB::queryFirstRow(
2615 2615
                 'SELECT pw
2616
-                FROM ' . prefixTable('users') . '
2616
+                FROM ' . prefixTable('users').'
2617 2617
                 WHERE id = %i',
2618 2618
                 TP_USER_ID
2619 2619
             );
@@ -2635,8 +2635,8 @@  discard block
 block discarded – undo
2635 2635
                     'process_type' => 'create_user_keys',
2636 2636
                     'arguments' => json_encode([
2637 2637
                         'new_user_id' => (int) $post_user_id,
2638
-                        'new_user_pwd' => empty($post_user_pwd) === true ? '' : cryption($post_user_pwd, '','encrypt', $SETTINGS)['string'],
2639
-                        'new_user_code' => cryption($post_user_code, '','encrypt', $SETTINGS)['string'],
2638
+                        'new_user_pwd' => empty($post_user_pwd) === true ? '' : cryption($post_user_pwd, '', 'encrypt', $SETTINGS)['string'],
2639
+                        'new_user_code' => cryption($post_user_code, '', 'encrypt', $SETTINGS)['string'],
2640 2640
                         'owner_id' => (int) TP_USER_ID,
2641 2641
                         'creator_pwd' => $userTP['pw'],
2642 2642
                         'email_body' => $lang->get('email_body_user_config_5'),
@@ -2725,8 +2725,8 @@  discard block
 block discarded – undo
2725 2725
             // get user info
2726 2726
             $processesProgress = DB::query(
2727 2727
                 'SELECT u.ongoing_process_id, pt.task, pt.updated_at, pt.finished_at, pt.is_in_progress
2728
-                FROM ' . prefixTable('users') . ' AS u
2729
-                INNER JOIN ' . prefixTable('background_subtasks') . ' AS pt ON (pt.task_id = u.ongoing_process_id)
2728
+                FROM ' . prefixTable('users').' AS u
2729
+                INNER JOIN ' . prefixTable('background_subtasks').' AS pt ON (pt.task_id = u.ongoing_process_id)
2730 2730
                 WHERE u.id = %i',
2731 2731
                 $user_id
2732 2732
             );
@@ -2734,9 +2734,9 @@  discard block
 block discarded – undo
2734 2734
             //print_r($processesProgress);
2735 2735
             $finished_steps = 0;
2736 2736
             $nb_steps = count($processesProgress);
2737
-            foreach($processesProgress as $process) {
2737
+            foreach ($processesProgress as $process) {
2738 2738
                 if ((int) $process['is_in_progress'] === -1) {
2739
-                    $finished_steps ++;
2739
+                    $finished_steps++;
2740 2740
                 }
2741 2741
             }
2742 2742
 
@@ -2745,7 +2745,7 @@  discard block
 block discarded – undo
2745 2745
                     'error' => false,
2746 2746
                     'message' => '',
2747 2747
                     'user_id' => $user_id,
2748
-                    'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps/$nb_steps*100, 0).'%',
2748
+                    'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps / $nb_steps * 100, 0).'%',
2749 2749
                     'debug' => $finished_steps.",".$nb_steps,
2750 2750
                 ),
2751 2751
                 'encode'
@@ -2835,7 +2835,7 @@  discard block
 block discarded – undo
2835 2835
 
2836 2836
     // Get info about user
2837 2837
     $data_user = DB::queryFirstRow(
2838
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2838
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2839 2839
         WHERE id = %i',
2840 2840
         $value[1]
2841 2841
     );
@@ -2869,7 +2869,7 @@  discard block
 block discarded – undo
2869 2869
             logEvents(
2870 2870
                 $SETTINGS,
2871 2871
                 'user_mngt',
2872
-                'at_user_new_' . $value[0] . ':' . $value[1],
2872
+                'at_user_new_'.$value[0].':'.$value[1],
2873 2873
                 (string) $session->get('user-id'),
2874 2874
                 $session->get('user-login'),
2875 2875
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
@@ -2903,7 +2903,7 @@  discard block
 block discarded – undo
2903 2903
 
2904 2904
     // Get info about user
2905 2905
     $data_user = DB::queryFirstRow(
2906
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2906
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2907 2907
         WHERE id = %i',
2908 2908
         $id[1]
2909 2909
     );
Please login to merge, or discard this patch.