Passed
Push — teampass_3.0 ( 6d5809...2c08f5 )
by Nils
08:42 queued 04:08
created
sources/tree.php 1 patch
Spacing   +47 added lines, -51 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // includes
45
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
47
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
45
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
47
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
50 50
 
51 51
 // header
52 52
 header('Content-type: text/html; charset=utf-8');
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 // Connect to mysql server
63
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
63
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
64 64
 if (defined('DB_PASSWD_CLEAR') === false) {
65 65
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
66 66
 }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 DB::$encoding = DB_ENCODING;
73 73
 
74 74
 // Superglobal load
75
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
75
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
76 76
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
77 77
 $get = [];
78 78
 $get['user_tree_structure'] = $superGlobal->get('user_tree_structure', 'GET');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 $session['personal_visible_groups'] = $superGlobal->get('personal_visible_groups', 'SESSION');
93 93
 
94 94
 $lastFolderChange = DB::query(
95
-    'SELECT * FROM ' . prefixTable('misc') . '
95
+    'SELECT * FROM '.prefixTable('misc').'
96 96
     WHERE type = %s AND intitule = %s',
97 97
     'timestamp',
98 98
     'last_folder_change'
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     || (isset($get['force_refresh']) === true && (int) $get['force_refresh'] === 1)
104 104
 ) {
105 105
     // Build tree
106
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
106
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
107 107
     $tree->register();
108 108
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
109 109
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     $SETTINGS
214 214
 ) {
215 215
     // Load library
216
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
216
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
217 217
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
218 218
 
219 219
     // Prepare superGlobal variables
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                 // get count of Items in this folder
268 268
                 DB::query(
269 269
                     'SELECT *
270
-                    FROM ' . prefixTable('items') . '
270
+                    FROM ' . prefixTable('items').'
271 271
                     WHERE inactif=%i AND id_tree = %i',
272 272
                     0,
273 273
                     $node->id
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 // get info about current folder
278 278
                 DB::query(
279 279
                     'SELECT *
280
-                    FROM ' . prefixTable('nested_tree') . '
280
+                    FROM ' . prefixTable('nested_tree').'
281 281
                     WHERE parent_id = %i',
282 282
                     $node->id
283 283
                 );
@@ -285,11 +285,10 @@  discard block
 block discarded – undo
285 285
 
286 286
                 // If personal Folder, convert id into user name
287 287
                 $node->title = $node->title === $session_user_id && (int) $node->nlevel === 1 ?
288
-                    $session_login :
289
-                    ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES));
288
+                    $session_login : ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES));
290 289
 
291 290
                 // prepare json return for current node
292
-                $parent = $node->parent_id === 0 ? '#' : 'li_' . $node->parent_id;
291
+                $parent = $node->parent_id === 0 ? '#' : 'li_'.$node->parent_id;
293 292
 
294 293
                 // special case for READ-ONLY folder
295 294
                 $title = $session_user_read_only === true && in_array($node->id, $session_personal_folders) === false ? langHdl('read_only_account') : $title;
@@ -299,33 +298,30 @@  discard block
 block discarded – undo
299 298
 
300 299
                 if (in_array($node->id, $session_groupes_visibles)) {
301 300
                     if (in_array($node->id, $session_read_only_folders)) {
302
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
301
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
303 302
                         $title = langHdl('read_only_account');
304 303
                         $restricted = 1;
305 304
                         $folderClass = 'folder_not_droppable';
306 305
                     } elseif ($session_user_read_only === true && !in_array($node->id, $session_personal_visible_groups)) {
307
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
306
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
308 307
                     }
309 308
                     $text .=
310
-                        ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>'
309
+                        ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>'
311 310
                         .(isset($SETTINGS['tree_counters']) && (int) $SETTINGS['tree_counters'] === 1 ?
312
-                            '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  :
313
-                            '')
311
+                            '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '')
314 312
                         .'</span>';
315 313
                 } elseif (in_array($node->id, $listFoldersLimitedKeys)) {
316 314
                     $restricted = 1;
317 315
                     $text .= 
318 316
                         $session_user_read_only === true ?
319
-                            "<i class='far fa-eye fa-xs mr-1'></i>" :
320
-                            '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_folders_limited[$node->id]) . '</span>';
317
+                            "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_folders_limited[$node->id]).'</span>';
321 318
                 } elseif (in_array($node->id, $listRestrictedFoldersForItemsKeys)) {
322 319
                     $restricted = 1;
323 320
                     if ($session_user_read_only === true) {
324
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
321
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
325 322
                     }
326 323
                     $text .= $session_user_read_only === true ? 
327
-                        "<i class='far fa-eye fa-xs mr-1'></i>" :
328
-                        '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_restricted_folders_for_items[$node->id]) . '</span>';
324
+                        "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_restricted_folders_for_items[$node->id]).'</span>';
329 325
                 } else {
330 326
                     $restricted = 1;
331 327
                     $folderClass = 'folder_not_droppable';
@@ -351,18 +347,18 @@  discard block
 block discarded – undo
351 347
                     array_push(
352 348
                         $ret_json,
353 349
                         array(
354
-                            'id' => 'li_' . $node->id,
350
+                            'id' => 'li_'.$node->id,
355 351
                             'parent' => $parent,
356 352
                             'text' => $text,
357 353
                             'children' => $childrenNb === 0 ? false : true,
358 354
                             'li_attr' => array(
359 355
                                 'class' => 'jstreeopen',
360
-                                'title' => 'ID [' . $node->id . '] ' . $title,
356
+                                'title' => 'ID ['.$node->id.'] '.$title,
361 357
                             ),
362 358
                             'a_attr' => array(
363
-                                'id' => 'fld_' . $node->id,
359
+                                'id' => 'fld_'.$node->id,
364 360
                                 'class' => $folderClass,
365
-                                'onclick' => 'ListerItems(' . $node->id . ', ' . $restricted . ', 0, 1)',
361
+                                'onclick' => 'ListerItems('.$node->id.', '.$restricted.', 0, 1)',
366 362
                                 'data-title' => $node->title,
367 363
                             ),
368 364
                         )
@@ -371,13 +367,13 @@  discard block
 block discarded – undo
371 367
                     array_push(
372 368
                         $ret_json,
373 369
                         array(
374
-                            'id' => 'li_' . $node->id,
370
+                            'id' => 'li_'.$node->id,
375 371
                             'parent' =>  $parent,
376 372
                             'children' => $childrenNb === 0 ? false : true,
377
-                            'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>' . $text,
373
+                            'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text,
378 374
                             'li_attr' => array(
379 375
                                 'class' => '',
380
-                                'title' => 'ID [' . $node->id . '] ' . langHdl('no_access'),
376
+                                'title' => 'ID ['.$node->id.'] '.langHdl('no_access'),
381 377
                             ),
382 378
                         )
383 379
                     );
@@ -470,7 +466,7 @@  discard block
 block discarded – undo
470 466
                 ) === true
471 467
             ) {
472 468
                 DB::query(
473
-                    'SELECT * FROM ' . prefixTable('items') . '
469
+                    'SELECT * FROM '.prefixTable('items').'
474 470
                     WHERE inactif=%i AND id_tree = %i',
475 471
                     0,
476 472
                     $node
@@ -557,7 +553,7 @@  discard block
 block discarded – undo
557 553
 {
558 554
     // get info about current folder
559 555
     DB::query(
560
-        'SELECT * FROM ' . prefixTable('items') . '
556
+        'SELECT * FROM '.prefixTable('items').'
561 557
         WHERE inactif=%i AND id_tree = %i',
562 558
         0,
563 559
         $completTree[$nodeId]->id
@@ -658,7 +654,7 @@  discard block
 block discarded – undo
658 654
     */
659 655
 
660 656
     // prepare json return for current node
661
-    $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_' . $completTree[$nodeId]->parent_id;
657
+    $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_'.$completTree[$nodeId]->parent_id;
662 658
 
663 659
     // handle displaying
664 660
     if (
@@ -678,17 +674,17 @@  discard block
 block discarded – undo
678 674
         array_push(
679 675
             $ret_json,
680 676
             array(
681
-                'id' => 'li_' . $completTree[$nodeId]->id,
677
+                'id' => 'li_'.$completTree[$nodeId]->id,
682 678
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
683 679
                 'text' => $text.$completTree[$nodeId]->title.$nodeData['html'],
684 680
                 'li_attr' => array(
685 681
                     'class' => 'jstreeopen',
686
-                    'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . $nodeData['title'],
682
+                    'title' => 'ID ['.$completTree[$nodeId]->id.'] '.$nodeData['title'],
687 683
                 ),
688 684
                 'a_attr' => array(
689
-                    'id' => 'fld_' . $completTree[$nodeId]->id,
685
+                    'id' => 'fld_'.$completTree[$nodeId]->id,
690 686
                     'class' => $nodeData['folderClass'],
691
-                    'onclick' => 'ListerItems(' . $completTree[$nodeId]->id . ', ' . $nodeData['restricted'] . ', 0, 1)',
687
+                    'onclick' => 'ListerItems('.$completTree[$nodeId]->id.', '.$nodeData['restricted'].', 0, 1)',
692 688
                     'data-title' => $completTree[$nodeId]->title,
693 689
                 ),
694 690
             )
@@ -697,12 +693,12 @@  discard block
 block discarded – undo
697 693
         array_push(
698 694
             $ret_json,
699 695
             array(
700
-                'id' => 'li_' . $completTree[$nodeId]->id,
696
+                'id' => 'li_'.$completTree[$nodeId]->id,
701 697
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
702 698
                 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text.$completTree[$nodeId]->title.$nodeData['html'],
703 699
                 'li_attr' => array(
704 700
                     'class' => '',
705
-                    'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . langHdl('no_access'),
701
+                    'title' => 'ID ['.$completTree[$nodeId]->id.'] '.langHdl('no_access'),
706 702
                 ),
707 703
             )
708 704
         );
@@ -765,8 +761,8 @@  discard block
 block discarded – undo
765 761
     if (in_array($nodeId, $session_groupes_visibles) === true) {
766 762
         if (in_array($nodeId, $session_read_only_folders) === true) {
767 763
             return [
768
-                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
769
-                    ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
764
+                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
765
+                    ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
770 766
                 'title' => langHdl('read_only_account'),
771 767
                 'restricted' => 1,
772 768
                 'folderClass' => 'folder_not_droppable',
@@ -780,8 +776,8 @@  discard block
 block discarded – undo
780 776
             && in_array($nodeId, $session_personal_visible_groups) === false
781 777
         ) {
782 778
             return [
783
-                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
784
-                    ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
779
+                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
780
+                    ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
785 781
                 'title' => $title,
786 782
                 'restricted' => 0,
787 783
                 'folderClass' => 'folder',
@@ -791,8 +787,8 @@  discard block
 block discarded – undo
791 787
         }
792 788
         
793 789
         return [
794
-            'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
795
-                ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
790
+            'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
791
+                ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
796 792
             'title' => $title,
797 793
             'restricted' => 0,
798 794
             'folderClass' => 'folder',
@@ -803,8 +799,8 @@  discard block
 block discarded – undo
803 799
     
804 800
     if (in_array($nodeId, $listFoldersLimitedKeys) === true) {
805 801
         return [
806
-            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') .
807
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>',
802
+            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '').
803
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>',
808 804
             'title' => $title,
809 805
             'restricted' => 1,
810 806
             'folderClass' => 'folder',
@@ -815,8 +811,8 @@  discard block
 block discarded – undo
815 811
     
816 812
     if (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) {
817 813
         return [
818
-            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' .
819
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>',
814
+            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''.
815
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>',
820 816
             'title' => $title,
821 817
             'restricted' => 1,
822 818
             'folderClass' => 'folder',
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 /* do checks */
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
52 52
 $isprofileupdate = filter_input(INPUT_POST, 'isprofileupdate', FILTER_SANITIZE_STRING);
53 53
 if (
54 54
     checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         || $isprofileupdate === false
60 60
     ) {
61 61
         $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
62
-        include $SETTINGS['cpassman_dir'] . '/error.php';
62
+        include $SETTINGS['cpassman_dir'].'/error.php';
63 63
         exit();
64 64
     } else {
65 65
         // Do special check to allow user to change attributes of his profile
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
             || checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
69 69
         ) {
70 70
             $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
71
-            include $SETTINGS['cpassman_dir'] . '/error.php';
71
+            include $SETTINGS['cpassman_dir'].'/error.php';
72 72
             exit();
73 73
         }
74 74
     }
75 75
 }
76 76
 
77
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
77
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
78 78
 header('Content-type: text/html; charset=utf-8');
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
80
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
81
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
80
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
81
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
82 82
 
83 83
 // Connect to mysql server
84
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
84
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
85 85
 if (defined('DB_PASSWD_CLEAR') === false) {
86 86
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
87 87
 }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             // Prepare variables
131 131
             $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
132 132
             $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL);
133
-            $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
133
+            $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
134 134
             $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING);
135 135
             $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING);
136 136
             $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // Check if user already exists
160 160
             $data = DB::query(
161 161
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
162
-                FROM ' . prefixTable('users') . '
162
+                FROM ' . prefixTable('users').'
163 163
                 WHERE login = %s',
164 164
                 $login
165 165
             );
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
             // Get info about user to delete
391 391
             $data_user = DB::queryfirstrow(
392
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
392
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
393 393
                 WHERE id = %i',
394 394
                 $post_id
395 395
             );
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 );
409 409
                 // delete personal folder and subfolders
410 410
                 $data = DB::queryfirstrow(
411
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
411
+                    'SELECT id FROM '.prefixTable('nested_tree').'
412 412
                     WHERE title = %s AND personal_folder = %i',
413 413
                     $post_id,
414 414
                     '1'
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
422 422
                         // delete items & logs
423 423
                         $items = DB::query(
424
-                            'SELECT id FROM ' . prefixTable('items') . '
424
+                            'SELECT id FROM '.prefixTable('items').'
425 425
                             WHERE id_tree=%i AND perso = %i',
426 426
                             $folder->id,
427 427
                             '1'
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
             // Get info about user to delete
480 480
             $data_user = DB::queryfirstrow(
481
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
481
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
482 482
                 WHERE id = %i',
483 483
                 $post_id
484 484
             );
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
             // Get info about user to delete
522 522
             $data_user = DB::queryfirstrow(
523
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
523
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
524 524
                 WHERE id = %i',
525 525
                 $post_id
526 526
             );
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             // Get info about user to delete
564 564
             $data_user = DB::queryfirstrow(
565 565
                 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire
566
-                FROM ' . prefixTable('users') . '
566
+                FROM ' . prefixTable('users').'
567 567
                 WHERE id = %i',
568 568
                 $post_id
569 569
             );
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
             // Get info about user to delete
609 609
             $data_user = DB::queryfirstrow(
610
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
610
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
611 611
                 WHERE id = %i',
612 612
                 $post_id
613 613
             );
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
             // Get info about user to delete
651 651
             $data_user = DB::queryfirstrow(
652 652
                 'SELECT admin, isAdministratedByRole, gestionnaire
653
-                FROM ' . prefixTable('users') . '
653
+                FROM ' . prefixTable('users').'
654 654
                 WHERE id = %i',
655 655
                 $post_id
656 656
             );
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
             // Get info about user to delete
694 694
             $data_user = DB::queryfirstrow(
695 695
                 'SELECT admin, isAdministratedByRole, gestionnaire
696
-                FROM ' . prefixTable('users') . '
696
+                FROM ' . prefixTable('users').'
697 697
                 WHERE id = %i',
698 698
                 $post_id
699 699
             );
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
             // Get info about user to delete
734 734
             $data_user = DB::queryfirstrow(
735 735
                 'SELECT admin, isAdministratedByRole, gestionnaire
736
-                FROM ' . prefixTable('users') . '
736
+                FROM ' . prefixTable('users').'
737 737
                 WHERE id = %i',
738 738
                 $post_id
739 739
             );
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             $return = array();
773 773
             // Check if folder exists
774 774
             $data = DB::query(
775
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
775
+                'SELECT * FROM '.prefixTable('nested_tree').'
776 776
                 WHERE title = %s AND parent_id = %i',
777 777
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING),
778 778
                 '0'
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
             }
786 786
             // Check if role exists
787 787
             $data = DB::query(
788
-                'SELECT * FROM ' . prefixTable('roles_title') . '
788
+                'SELECT * FROM '.prefixTable('roles_title').'
789 789
                 WHERE title = %s',
790 790
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING)
791 791
             );
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         case 'user_log_items':
806 806
             $nb_pages = 1;
807 807
             $logs = $sql_filter = '';
808
-            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . '&nbsp;:&nbsp;</td>';
808
+            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').'&nbsp;:&nbsp;</td>';
809 809
 
810 810
             // Prepare POST variables
811 811
             $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT);
@@ -817,14 +817,14 @@  discard block
 block discarded – undo
817 817
                     && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING))
818 818
                     && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all'
819 819
                 ) {
820
-                    $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'";
820
+                    $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'";
821 821
                 }
822 822
                 // get number of pages
823 823
                 DB::query(
824 824
                     'SELECT *
825
-                    FROM ' . prefixTable('log_items') . ' as l
826
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
827
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
825
+                    FROM ' . prefixTable('log_items').' as l
826
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
827
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
828 828
                     WHERE l.id_user = %i ' . $sql_filter,
829 829
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
830 830
                 );
@@ -842,19 +842,19 @@  discard block
 block discarded – undo
842 842
                 // launch query
843 843
                 $rows = DB::query(
844 844
                     'SELECT l.date as date, u.login as login, i.label as label, l.action as action
845
-                    FROM ' . prefixTable('log_items') . ' as l
846
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
847
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
848
-                    WHERE l.id_user = %i ' . $sql_filter . '
845
+                    FROM ' . prefixTable('log_items').' as l
846
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
847
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
848
+                    WHERE l.id_user = %i ' . $sql_filter.'
849 849
                     ORDER BY date DESC
850
-                    LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page),
850
+                    LIMIT ' . intval($start).','.intval($post_nb_items_by_page),
851 851
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
852 852
                 );
853 853
             } else {
854 854
                 // get number of pages
855 855
                 DB::query(
856 856
                     'SELECT *
857
-                    FROM ' . prefixTable('log_system') . '
857
+                    FROM ' . prefixTable('log_system').'
858 858
                     WHERE type = %s AND field_1=%i',
859 859
                     'user_mngt',
860 860
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
                 // launch query
874 874
                 $rows = DB::query(
875 875
                     'SELECT *
876
-                    FROM ' . prefixTable('log_system') . '
876
+                    FROM ' . prefixTable('log_system').'
877 877
                     WHERE type = %s AND field_1 = %i
878 878
                     ORDER BY date DESC
879 879
                     LIMIT %i, %i',
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
             if (isset($counter) && $counter != 0) {
888 888
                 $nb_pages = ceil($counter / intval($post_nb_items_by_page));
889 889
                 for ($i = 1; $i <= $nb_pages; ++$i) {
890
-                    $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>';
890
+                    $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>';
891 891
                 }
892 892
             }
893 893
             $pages .= '</tr></table>';
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
                     if ($post_scope === 'user_mngt') {
897 897
                         $user = DB::queryfirstrow(
898 898
                             'SELECT login
899
-                            from ' . prefixTable('users') . '
899
+                            from ' . prefixTable('users').'
900 900
                             WHERE id=%i',
901 901
                             $record['qui']
902 902
                         );
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         if ($tmp[0] == 'at_user_initial_pwd_changed') {
907 907
                             $label = langHdl('log_user_initial_pwd_changed');
908 908
                         } elseif ($tmp[0] == 'at_user_email_changed') {
909
-                            $label = langHdl('log_user_email_changed') . $tmp[1];
909
+                            $label = langHdl('log_user_email_changed').$tmp[1];
910 910
                         } elseif ($tmp[0] == 'at_user_added') {
911 911
                             $label = langHdl('log_user_created');
912 912
                         } elseif ($tmp[0] == 'at_user_locked') {
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
                             $label = langHdl('log_user_pwd_changed');
918 918
                         }
919 919
                         // prepare log
920
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>';
920
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>';
921 921
                     } else {
922
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>';
922
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>';
923 923
                     }
924 924
                 }
925 925
             }
926 926
 
927
-            echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]';
927
+            echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]';
928 928
             break;
929 929
 
930 930
             /*
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             } else {
950 950
                 // Get folder id for Admin
951 951
                 $admin_folder = DB::queryFirstRow(
952
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
952
+                    'SELECT id FROM '.prefixTable('nested_tree').'
953 953
                     WHERE title = %i AND personal_folder = %i',
954 954
                     intval($_SESSION['user_id']),
955 955
                     '1'
@@ -960,15 +960,15 @@  discard block
 block discarded – undo
960 960
                     // Get each Items in PF
961 961
                     $rows = DB::query(
962 962
                         'SELECT i.pw, i.label, l.id_user
963
-                        FROM ' . prefixTable('items') . ' as i
964
-                        LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id)
963
+                        FROM ' . prefixTable('items').' as i
964
+                        LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id)
965 965
                         WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i',
966 966
                         'at_creation',
967 967
                         '1',
968 968
                         intval($folder->id)
969 969
                     );
970 970
                     foreach ($rows as $record) {
971
-                        echo $record['label'] . ' - ';
971
+                        echo $record['label'].' - ';
972 972
                         // Change user
973 973
                         DB::update(
974 974
                             prefixTable('log_items'),
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
             // Get info about user to delete
1004 1004
             $data_user = DB::queryfirstrow(
1005 1005
                 'SELECT admin, isAdministratedByRole, gestionnaire
1006
-                FROM ' . prefixTable('users') . '
1006
+                FROM ' . prefixTable('users').'
1007 1007
                 WHERE id = %i',
1008 1008
                 $post_user_id
1009 1009
             );
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
             // Do
1042 1042
             $rows = DB::query(
1043
-                'SELECT id FROM ' . prefixTable('users') . '
1043
+                'SELECT id FROM '.prefixTable('users').'
1044 1044
                 WHERE timestamp != %s AND admin != %i',
1045 1045
                 '',
1046 1046
                 '1'
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
                 // Get info about user to delete
1050 1050
                 $data_user = DB::queryfirstrow(
1051 1051
                     'SELECT admin, isAdministratedByRole, gestionnaire
1052
-                    FROM ' . prefixTable('users') . '
1052
+                    FROM ' . prefixTable('users').'
1053 1053
                     WHERE id = %i',
1054 1054
                     $record['id']
1055 1055
                 );
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
             // Get info about user
1108 1108
             $rowUser = DB::queryfirstrow(
1109 1109
                 'SELECT *
1110
-                FROM ' . prefixTable('users') . '
1110
+                FROM ' . prefixTable('users').'
1111 1111
                 WHERE id = %i',
1112 1112
                 $post_id
1113 1113
             );
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
                 $arrFldAllowed = array();
1126 1126
 
1127 1127
                 //Build tree
1128
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1128
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1129 1129
                 $tree->register();
1130 1130
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1131 1131
 
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
                 // array of roles for actual user
1137 1137
                 $my_functions = explode(';', $_SESSION['fonction_id']);
1138 1138
 
1139
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
1139
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
1140 1140
                 foreach ($rows as $record) {
1141 1141
                     if (
1142 1142
                         (int) $_SESSION['is_admin'] === 1
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
                 $rolesList = array();
1173 1173
                 $managedBy = array();
1174 1174
                 $selected = '';
1175
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
1175
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
1176 1176
                 foreach ($rows as $reccord) {
1177 1177
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
1178 1178
                 }
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
                         array_push(
1204 1204
                             $managedBy,
1205 1205
                             array(
1206
-                                'title' => langHdl('managers_of') . ' ' . $fonction['title'],
1206
+                                'title' => langHdl('managers_of').' '.$fonction['title'],
1207 1207
                                 'id' => $fonction['id'],
1208 1208
                                 'selected' => $selected,
1209 1209
                             )
@@ -1285,9 +1285,9 @@  discard block
 block discarded – undo
1285 1285
 
1286 1286
                 // get USER STATUS
1287 1287
                 if ($rowUser['disabled'] == 1) {
1288
-                    $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . langHdl('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">' . langHdl('user_info_delete_question') . '</label>';
1288
+                    $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.langHdl('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">'.langHdl('user_info_delete_question').'</label>';
1289 1289
                 } else {
1290
-                    $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . langHdl('user_info_lock_question');
1290
+                    $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.langHdl('user_info_lock_question');
1291 1291
                 }
1292 1292
 
1293 1293
                 $arrData['error'] = false;
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
                 // count number of admins
1380 1380
                 $users = DB::query(
1381 1381
                     'SELECT id
1382
-                    FROM ' . prefixTable('users') . '
1382
+                    FROM ' . prefixTable('users').'
1383 1383
                     WHERE admin = 1 AND email != "" AND pw != ""'
1384 1384
                 );
1385 1385
                 if (DB::count() === 1) {
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
             // Get info about user to delete
1467 1467
             $data_user = DB::queryfirstrow(
1468
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1468
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1469 1469
                 WHERE id = %i',
1470 1470
                 $post_id
1471 1471
             );
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
                     );
1487 1487
                     // delete personal folder and subfolders
1488 1488
                     $data = DB::queryfirstrow(
1489
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1489
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1490 1490
                         WHERE title = %s AND personal_folder = %i',
1491 1491
                         $post_id,
1492 1492
                         '1'
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1500 1500
                             // delete items & logs
1501 1501
                             $items = DB::query(
1502
-                                'SELECT id FROM ' . prefixTable('items') . '
1502
+                                'SELECT id FROM '.prefixTable('items').'
1503 1503
                                 WHERE id_tree=%i AND perso = %i',
1504 1504
                                 $folder->id,
1505 1505
                                 '1'
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
                 } else {
1521 1521
                     // Get old data about user
1522 1522
                     $oldData = DB::queryfirstrow(
1523
-                        'SELECT * FROM ' . prefixTable('users') . '
1523
+                        'SELECT * FROM '.prefixTable('users').'
1524 1524
                         WHERE id = %i',
1525 1525
                         $post_id
1526 1526
                     );
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 
1551 1551
                     // update LOG
1552 1552
                     if ($oldData['email'] !== $post_email) {
1553
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1553
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1554 1554
                     }
1555 1555
                 }
1556 1556
                 echo prepareExchangedData(
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 
1606 1606
             // Get info about user to delete
1607 1607
             $data_user = DB::queryfirstrow(
1608
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1608
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1609 1609
                 WHERE id = %i',
1610 1610
                 $post_id
1611 1611
             );
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
             }
1656 1656
 
1657 1657
             DB::queryfirstrow(
1658
-                'SELECT * FROM ' . prefixTable('users') . '
1658
+                'SELECT * FROM '.prefixTable('users').'
1659 1659
                 WHERE login = %s',
1660 1660
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING)
1661 1661
             );
@@ -1704,14 +1704,14 @@  discard block
 block discarded – undo
1704 1704
             $arrData = array();
1705 1705
 
1706 1706
             //Build tree
1707
-            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1707
+            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1708 1708
             $tree->register();
1709 1709
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1710 1710
 
1711 1711
             // get User info
1712 1712
             $rowUser = DB::queryFirstRow(
1713 1713
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb
1714
-                FROM ' . prefixTable('users') . '
1714
+                FROM ' . prefixTable('users').'
1715 1715
                 WHERE id = %i',
1716 1716
                 $post_id
1717 1717
             );
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
                 // refine folders based upon roles
1730 1730
                 $rows = DB::query(
1731 1731
                     'SELECT folder_id, type
1732
-                    FROM ' . prefixTable('roles_values') . '
1732
+                    FROM ' . prefixTable('roles_values').'
1733 1733
                     WHERE role_id IN %ls
1734 1734
                     ORDER BY folder_id ASC',
1735 1735
                     $arrData['functions']
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
                             // get folder name
1759 1759
                             $row = DB::queryFirstRow(
1760 1760
                                 'SELECT title, nlevel, id
1761
-                                FROM ' . prefixTable('nested_tree') . '
1761
+                                FROM ' . prefixTable('nested_tree').'
1762 1762
                                 WHERE id = %i',
1763 1763
                                 $fld['id']
1764 1764
                             );
@@ -1771,34 +1771,34 @@  discard block
 block discarded – undo
1771 1771
 
1772 1772
                             // manage right icon
1773 1773
                             if ($fld['type'] == 'W') {
1774
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' .
1775
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1776
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1774
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'.
1775
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1776
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1777 1777
                             } elseif ($fld['type'] == 'ND') {
1778
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1779
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1780
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1778
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1779
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1780
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1781 1781
                             } elseif ($fld['type'] == 'NE') {
1782
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1783
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1784
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1782
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1783
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1784
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1785 1785
                             } elseif ($fld['type'] == 'NDNE') {
1786
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1787
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1788
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1786
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1787
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1788
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1789 1789
                             } else {
1790
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>';
1790
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>';
1791 1791
                             }
1792 1792
 
1793
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1794
-                                ' <small>[' . $row['id'] . ']</small></td><td>' . $label . '</td></tr>';
1793
+                            $html .= '<tr><td>'.$ident.$row['title'].
1794
+                                ' <small>['.$row['id'].']</small></td><td>'.$label.'</td></tr>';
1795 1795
                             break;
1796 1796
                         }
1797 1797
                     }
1798 1798
                 }
1799 1799
 
1800
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1801
-                    $html . '</tbody></table>';
1800
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1801
+                    $html.'</tbody></table>';
1802 1802
             } else {
1803 1803
                 $html_full = '';
1804 1804
             }
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
             if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) {
1845 1845
                 $rows = DB::query(
1846 1846
                     'SELECT *
1847
-                    FROM ' . prefixTable('users') . '
1847
+                    FROM ' . prefixTable('users').'
1848 1848
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1849 1849
                     '0',
1850 1850
                     array_filter($_SESSION['user_roles'])
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
             } else {
1853 1853
                 $rows = DB::query(
1854 1854
                     'SELECT *
1855
-                    FROM ' . prefixTable('users') . '
1855
+                    FROM ' . prefixTable('users').'
1856 1856
                     WHERE admin = %i',
1857 1857
                     '0'
1858 1858
                 );
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
                 $groupIds = [];
1865 1865
                 foreach (explode(';', $record['fonction_id']) as $group) {
1866 1866
                     $tmp = DB::queryfirstrow(
1867
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1867
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1868 1868
                         WHERE id = %i',
1869 1869
                         $group
1870 1870
                     );
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 
1877 1877
                 // Get managed_by
1878 1878
                 $managedBy = DB::queryfirstrow(
1879
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1879
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1880 1880
                     WHERE id = %i',
1881 1881
                     $record['isAdministratedByRole']
1882 1882
                 );
@@ -1886,7 +1886,7 @@  discard block
 block discarded – undo
1886 1886
                 $foldersAllowedIds = [];
1887 1887
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1888 1888
                     $tmp = DB::queryfirstrow(
1889
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1889
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1890 1890
                         WHERE id = %i',
1891 1891
                         $role
1892 1892
                     );
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
                 $foldersForbiddenIds = [];
1900 1900
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1901 1901
                     $tmp = DB::queryfirstrow(
1902
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1902
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1903 1903
                         WHERE id = %i',
1904 1904
                         $role
1905 1905
                     );
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
                         'login' => $record['login'],
1918 1918
                         'groups' => implode(', ', $groups),
1919 1919
                         'groupIds' => $groupIds,
1920
-                        'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'],
1920
+                        'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'],
1921 1921
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1922 1922
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1923 1923
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
 
1996 1996
             // Get info about user
1997 1997
             $data_user = DB::queryfirstrow(
1998
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1998
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1999 1999
                 WHERE id = %i',
2000 2000
                 $post_source_id
2001 2001
             );
@@ -2155,14 +2155,14 @@  discard block
 block discarded – undo
2155 2155
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
2156 2156
                 $data_user = DB::queryfirstrow(
2157 2157
                     'SELECT fonction_id
2158
-                    FROM ' . prefixTable('users') . '
2158
+                    FROM ' . prefixTable('users').'
2159 2159
                     WHERE id = %i',
2160 2160
                     $post_user_id
2161 2161
                 );
2162 2162
 
2163 2163
                 if ($data_user) {
2164 2164
                     // Ensure array is unique
2165
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
2165
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
2166 2166
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
2167 2167
                 } else {
2168 2168
                     // User not found
@@ -2217,7 +2217,7 @@  discard block
 block discarded – undo
2217 2217
             if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') {
2218 2218
                 $record = DB::queryFirstRow(
2219 2219
                     'SELECT user_ip_lastdate
2220
-                    FROM ' . prefixTable('users') . '
2220
+                    FROM ' . prefixTable('users').'
2221 2221
                     WHERE id = %i',
2222 2222
                     $_SESSION['user_id']
2223 2223
                 );
@@ -2309,38 +2309,38 @@  discard block
 block discarded – undo
2309 2309
             ];
2310 2310
 
2311 2311
             // Load expected libraries
2312
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2313
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2314
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2315
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
2316
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
2317
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
2318
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
2319
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
2320
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2321
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
2322
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
2323
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
2324
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
2325
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
2326
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
2327
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
2328
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
2329
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
2330
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
2331
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
2332
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
2333
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
2334
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
2335
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
2336
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
2337
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
2338
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
2339
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2340
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2341
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2342
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2343
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2312
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2313
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2314
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2315
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
2316
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
2317
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
2318
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
2319
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
2320
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2321
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
2322
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
2323
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
2324
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
2325
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
2326
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
2327
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
2328
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
2329
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
2330
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
2331
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
2332
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
2333
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
2334
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
2335
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
2336
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
2337
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
2338
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
2339
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2340
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2341
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2342
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2343
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2344 2344
 
2345 2345
             $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2346 2346
             $ad->register();
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
                 echo prepareExchangedData(
2357 2357
                     array(
2358 2358
                         'error' => true,
2359
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
2359
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
2360 2360
                     ),
2361 2361
                     'encode'
2362 2362
                 );
@@ -2375,10 +2375,10 @@  discard block
 block discarded – undo
2375 2375
                 ['objectclass', '=', 'inetorgperson'],
2376 2376
             ], null, null, 'or')->get();
2377 2377
             
2378
-            foreach($users as $i => $adUser) {
2378
+            foreach ($users as $i => $adUser) {
2379 2379
 
2380 2380
                 // Build the list of all groups in AD
2381
-                foreach($adUser['memberof'] as $j => $adUserGroup) {
2381
+                foreach ($adUser['memberof'] as $j => $adUserGroup) {
2382 2382
                     if (empty($adUserGroup) === false && $j !== "count") {
2383 2383
                         $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2384 2384
                         if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2393,7 +2393,7 @@  discard block
 block discarded – undo
2393 2393
                     // Get his ID
2394 2394
                     DB::queryfirstrow(
2395 2395
                         'SELECT id, fonction_id, auth_type
2396
-                        FROM ' . prefixTable('users') . '
2396
+                        FROM ' . prefixTable('users').'
2397 2397
                         WHERE login = %s',
2398 2398
                         $userLogin
2399 2399
                     );
@@ -2428,7 +2428,7 @@  discard block
 block discarded – undo
2428 2428
             }
2429 2429
 
2430 2430
             // Get all groups in Teampass
2431
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2431
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2432 2432
             foreach ($rows as $record) {
2433 2433
                 array_push(
2434 2434
                     $teampassRoles,
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
             // Check if user already exists
2495 2495
             $data = DB::query(
2496 2496
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2497
-                FROM ' . prefixTable('users') . '
2497
+                FROM ' . prefixTable('users').'
2498 2498
                 WHERE login = %s',
2499 2499
                 $post_login
2500 2500
             );
@@ -2598,7 +2598,7 @@  discard block
 block discarded – undo
2598 2598
                 );
2599 2599
 
2600 2600
                 // Rebuild tree
2601
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
2601
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
2602 2602
                 $tree->register();
2603 2603
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
2604 2604
                 $tree->rebuild();
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
             // Check if user already exists
2667 2667
             DB::query(
2668 2668
                 'SELECT id
2669
-                FROM ' . prefixTable('users') . '
2669
+                FROM ' . prefixTable('users').'
2670 2670
                 WHERE id = %i',
2671 2671
                 $post_id
2672 2672
             );
@@ -2742,7 +2742,7 @@  discard block
 block discarded – undo
2742 2742
             // Check if user already exists
2743 2743
             $userInfo = DB::queryfirstrow(
2744 2744
                 'SELECT id, private_key, public_key
2745
-                FROM ' . prefixTable('users') . '
2745
+                FROM ' . prefixTable('users').'
2746 2746
                 WHERE id = %i',
2747 2747
                 $post_userid
2748 2748
             );
@@ -2777,7 +2777,7 @@  discard block
 block discarded – undo
2777 2777
             if (count($_SESSION['personal_folders']) > 0) {
2778 2778
                 DB::query(
2779 2779
                     'SELECT id
2780
-                    FROM ' . prefixTable('items') . '
2780
+                    FROM ' . prefixTable('items').'
2781 2781
                     WHERE id_tree IN %ls',
2782 2782
                     $_SESSION['personal_folders']
2783 2783
                 );
@@ -2855,7 +2855,7 @@  discard block
 block discarded – undo
2855 2855
             // Check if user already exists
2856 2856
             DB::query(
2857 2857
                 'SELECT id
2858
-                FROM ' . prefixTable('users') . '
2858
+                FROM ' . prefixTable('users').'
2859 2859
                 WHERE id = %i',
2860 2860
                 $post_id
2861 2861
             );
@@ -2949,7 +2949,7 @@  discard block
 block discarded – undo
2949 2949
 
2950 2950
     // Get info about user
2951 2951
     $data_user = DB::queryfirstrow(
2952
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2952
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2953 2953
         WHERE id = %i',
2954 2954
         $value[1]
2955 2955
     );
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
             logEvents(
2983 2983
                 $SETTINGS,
2984 2984
                 'user_mngt',
2985
-                'at_user_new_' . $value[0] . ':' . $value[1],
2985
+                'at_user_new_'.$value[0].':'.$value[1],
2986 2986
                 (string) $_SESSION['user_id'],
2987 2987
                 $_SESSION['login'],
2988 2988
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING)
@@ -3014,7 +3014,7 @@  discard block
 block discarded – undo
3014 3014
 
3015 3015
     // Get info about user
3016 3016
     $data_user = DB::queryfirstrow(
3017
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3017
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3018 3018
         WHERE id = %i',
3019 3019
         $value[1]
3020 3020
     );
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
     throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
45 45
 }
46 46
 
47
-if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') {
47
+if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') {
48 48
     $SETTINGS = [];
49 49
     $SETTINGS['cpassman_dir'] = '..';
50 50
 }
51 51
 
52
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
53
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
54
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
52
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
53
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
54
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
55 55
 
56 56
 // If Debug then clean the files
57 57
 if (DEBUGLDAP === true) {
58
-    define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt');
58
+    define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt');
59 59
     $fp = fopen(DEBUGLDAPFILE, 'w');
60 60
     fclose($fp);
61 61
 }
62 62
 if (DEBUGDUO === true) {
63
-    define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'] . '/duo.debug.txt');
63
+    define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'].'/duo.debug.txt');
64 64
     $fp = fopen(DEBUGDUOFILE, 'w');
65 65
     fclose($fp);
66 66
 }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 if (defined('DB_PASSWD_CLEAR') === false) {
77 77
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
78 78
 }
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
80 80
 if (defined('DB_PASSWD_CLEAR') === false) {
81 81
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
82 82
 }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     // Get DUO keys
96 96
     $duoData = DB::query(
97 97
         'SELECT intitule, valeur
98
-        FROM ' . prefixTable('misc') . '
98
+        FROM ' . prefixTable('misc').'
99 99
         WHERE type = %s',
100 100
         'duoSecurity'
101 101
     );
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     // load library
108
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
108
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
109 109
     $sig_request = Duo::signRequest(
110 110
         $_GLOBALS['IKEY'],
111 111
         $_GLOBALS['SKEY'],
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
         debugIdentify(
117 117
             DEBUGDUO,
118 118
             DEBUGDUOFILE,
119
-            "\n\n-----\n\n" .
120
-                'sig request : ' . $post_login . "\n" .
121
-                'resp : ' . $sig_request . "\n"
119
+            "\n\n-----\n\n".
120
+                'sig request : '.$post_login."\n".
121
+                'resp : '.$sig_request."\n"
122 122
         );
123 123
     }
124 124
 
125 125
     // load csrfprotector
126
-    $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php';
126
+    $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php';
127 127
     // return result
128
-    echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]';
128
+    echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]';
129 129
 // ---
130 130
     // ---
131 131
 } elseif ($post_type === 'identify_duo_user_check') {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     //--------
136 136
 
137 137
     // load library
138
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
138
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
139 139
     $authenticated_username = Duo::verifyResponse(
140 140
         $SETTINGS['duo_ikey'],
141 141
         $SETTINGS['duo_skey'],
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
         debugIdentify(
147 147
             DEBUGDUO,
148 148
             DEBUGDUOFILE,
149
-            "\n\n-----\n\n" .
150
-                'sig response : ' . $post_sig_response . "\n" .
151
-                'resp : ' . $authenticated_username . "\n"
149
+            "\n\n-----\n\n".
150
+                'sig response : '.$post_sig_response."\n".
151
+                'resp : '.$authenticated_username."\n"
152 152
         );
153 153
     }
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // is user in Teampass?
160 160
             DB::queryfirstrow(
161 161
                 'SELECT id
162
-                FROM ' . prefixTable('users') . '
162
+                FROM ' . prefixTable('users').'
163 163
                 WHERE login = %s',
164 164
                 $post_login
165 165
             );
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
             }
170 170
         }
171 171
 
172
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
172
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
173 173
     } else {
174
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
174
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
175 175
     }
176 176
     // ---
177 177
     // ---
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
 
199 199
     // Load superGlobals
200
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
200
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
201 201
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
202 202
     // Prepare GET variables
203 203
     $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
     } else {
286 286
         throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
287 287
     }
288
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
289
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
290
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
288
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
289
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
290
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
291 291
     
292 292
     header('Content-type: text/html; charset=utf-8');
293 293
     error_reporting(E_ERROR);
294 294
 
295 295
     // Load AntiXSS
296
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
296
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
297 297
     $antiXss = new voku\helper\AntiXSS();
298 298
 
299 299
     // Load superGlobals
300
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
300
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
301 301
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
302 302
 
303 303
     // Prepare GET variables
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER');
312 312
 
313 313
     // connect to the server
314
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
314
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
315 315
     DB::$host = DB_HOST;
316 316
     DB::$user = DB_USER;
317 317
     DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR;
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     DB::$port = DB_PORT;
320 320
     DB::$encoding = DB_ENCODING;
321 321
     // User's language loading
322
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php';
322
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php';
323 323
     
324 324
     // decrypt and retreive data in JSON format
325 325
     if (empty($sessionKey) === true) {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
         //$arrAttempts = array();
448 448
         $rows = DB::query(
449 449
             'SELECT date
450
-            FROM ' . prefixTable('log_system') . "
450
+            FROM ' . prefixTable('log_system')."
451 451
             WHERE field_1 = %s
452 452
             AND type = 'failed_auth'
453 453
             AND label = 'password_is_not_correct'
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
             foreach ($rows as $record) {
464 464
                 array_push(
465 465
                     $arrAttempts,
466
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
466
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
467 467
                 );
468 468
             }
469 469
         }
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         $superGlobal->put('user_upgrade_needed', $userInfo['upgrade_needed'], 'SESSION');
500 500
         $superGlobal->put('user_force_relog', $userInfo['force-relog'], 'SESSION');
501 501
         // get personal settings
502
-        if (! isset($userInfo['treeloadstrategy']) || empty($userInfo['treeloadstrategy'])) {
502
+        if (!isset($userInfo['treeloadstrategy']) || empty($userInfo['treeloadstrategy'])) {
503 503
             $userInfo['treeloadstrategy'] = 'full';
504 504
         }
505 505
         $superGlobal->put('treeloadstrategy', $userInfo['treeloadstrategy'], 'SESSION', 'user');
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         foreach ($superGlobal->get('user_roles', 'SESSION') as $role) {
602 602
             $resRoles = DB::queryFirstRow(
603 603
                 'SELECT title, complexity
604
-                FROM ' . prefixTable('roles_title') . '
604
+                FROM ' . prefixTable('roles_title').'
605 605
                 WHERE id=%i',
606 606
                 $role
607 607
             );
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 
623 623
         // build complete array of roles
624 624
         $superGlobal->put('arr_roles_full', [], 'SESSION');
625
-        $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
625
+        $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
626 626
         foreach ($rows as $record) {
627 627
             $superGlobal->put(
628 628
                 $record['id'],
@@ -713,10 +713,10 @@  discard block
 block discarded – undo
713 713
         $superGlobal->put('latest_items_tab', [], 'SESSION');
714 714
         $superGlobal->put('nb_roles', 0, 'SESSION');
715 715
         foreach ($superGlobal->get('latest_items', 'SESSION') as $item) {
716
-            if (! empty($item)) {
716
+            if (!empty($item)) {
717 717
                 $dataLastItems = DB::queryFirstRow(
718 718
                     'SELECT id,label,id_tree
719
-                    FROM ' . prefixTable('items') . '
719
+                    FROM ' . prefixTable('items').'
720 720
                     WHERE id=%i',
721 721
                     $item
722 722
                 );
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
                     [
726 726
                         'id' => $item,
727 727
                         'label' => $dataLastItems['label'],
728
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
728
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
729 729
                     ],
730 730
                     'SESSION',
731 731
                     'latest_items_tab'
@@ -742,12 +742,12 @@  discard block
 block discarded – undo
742 742
         ) {
743 743
             // get all Admin users
744 744
             $receivers = '';
745
-            $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
745
+            $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
746 746
             foreach ($rows as $record) {
747 747
                 if (empty($receivers)) {
748 748
                     $receivers = $record['email'];
749 749
                 } else {
750
-                    $receivers = ',' . $record['email'];
750
+                    $receivers = ','.$record['email'];
751 751
                 }
752 752
             }
753 753
             // Add email to table
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
                             '#tp_time#',
764 764
                         ],
765 765
                         [
766
-                            ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')',
766
+                            ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')',
767 767
                             date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
768 768
                             date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
769 769
                         ],
@@ -981,44 +981,44 @@  discard block
 block discarded – undo
981 981
     }
982 982
 
983 983
     // Load expected libraries
984
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
985
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
986
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
987
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
988
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
989
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
990
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
991
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
992
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php';
993
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
994
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
995
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
996
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
997
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
998
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
999
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
1000
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
1001
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
1002
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
1003
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
1004
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
1005
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
1006
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
1007
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
1008
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
1009
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
1010
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
1011
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
1012
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
1013
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
1014
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
1015
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
1016
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
1017
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
1018
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
1019
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
1020
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
1021
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
984
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
985
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
986
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
987
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
988
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
989
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
990
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
991
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
992
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php';
993
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
994
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
995
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
996
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
997
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
998
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
999
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
1000
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
1001
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
1002
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
1003
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
1004
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
1005
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
1006
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
1007
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
1008
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
1009
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
1010
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
1011
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
1012
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
1013
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
1014
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
1015
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
1016
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
1017
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
1018
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
1019
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
1020
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
1021
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
1022 1022
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
1023 1023
     $ad->register();
1024 1024
     $connection = new Connection($config);
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
         $error = $e->getDetailedError();
1031 1031
         return [
1032 1032
             'error' => true,
1033
-            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage().' '.$config['username'],
1033
+            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage().' '.$config['username'],
1034 1034
 
1035 1035
         ];
1036 1036
     }
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
     }
1059 1059
 
1060 1060
     // load passwordLib library
1061
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1061
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1062 1062
     $pwdlib->register();
1063 1063
     $pwdlib = new PasswordLib\PasswordLib();
1064 1064
     $hashedPassword = $pwdlib->createPasswordHash($passwordClear);
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
 function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array
1124 1124
 {
1125 1125
     // Load superGlobals
1126
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1126
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1127 1127
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1128 1128
     $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1129 1129
     $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
     }
1163 1163
 
1164 1164
     // Now check yubico validity
1165
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1165
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1166 1166
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1167 1167
     $auth = $yubi->verify($yubico_key);
1168 1168
     //, null, null, null, 60
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
             'gestionnaire' => '0',
1215 1215
             'can_manage_all_users' => '0',
1216 1216
             'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0',
1217
-            'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'] . ';' : '') . (isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'),
1217
+            'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'].';' : '').(isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'),
1218 1218
             'groupes_interdits' => '',
1219 1219
             'groupes_visibles' => '',
1220 1220
             'last_pw_change' => (int) time(),
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
             ]
1240 1240
         );
1241 1241
         // Rebuild tree
1242
-        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1242
+        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1243 1243
         $tree->register();
1244 1244
         $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1245 1245
         $tree->rebuild();
@@ -1270,13 +1270,13 @@  discard block
 block discarded – undo
1270 1270
         && empty($dataReceived['GACode']) === false
1271 1271
     ) {
1272 1272
         // Load superGlobals
1273
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1273
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1274 1274
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1275 1275
         $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1276 1276
         $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
1277 1277
         $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
1278 1278
         // load library
1279
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1279
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1280 1280
         // create new instance
1281 1281
         $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
1282 1282
         // Init
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
             $mfaMessage = langHdl('ga_flash_qr_and_login');
1299 1299
             // generate new QR
1300 1300
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1301
-                'Teampass - ' . $username,
1301
+                'Teampass - '.$username,
1302 1302
                 $userInfo['ga']
1303 1303
             );
1304 1304
             // clear temporary code from DB
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
                 $userInfo['id']
1312 1312
             );
1313 1313
             $firstTime = [
1314
-                'value' => '<img src="' . $new_2fa_qr . '">',
1314
+                'value' => '<img src="'.$new_2fa_qr.'">',
1315 1315
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1316 1316
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1317 1317
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1363,8 +1363,8 @@  discard block
 block discarded – undo
1363 1363
     // Set to false
1364 1364
     $userPasswordVerified = false;
1365 1365
     // load passwordLib library
1366
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1367
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1366
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1367
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1368 1368
     $pwdlib->register();
1369 1369
     $pwdlib = new PasswordLib\PasswordLib();
1370 1370
     // Check if old encryption used
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
     // Brute force management
1496 1496
     if ($sessionPwdAttempts > 3) {
1497 1497
         // Load superGlobals
1498
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1498
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1499 1499
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1500 1500
         $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION');
1501 1501
         $superGlobal->put('pwd_attempts', 0, 'SESSION');
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
     // Check if user exists
1538 1538
     $userInfo = DB::queryFirstRow(
1539 1539
         'SELECT *
1540
-        FROM ' . prefixTable('users') . ' WHERE login=%s',
1540
+        FROM ' . prefixTable('users').' WHERE login=%s',
1541 1541
         $username
1542 1542
     );
1543 1543
     
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
124 124
 {
125
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
125
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
126 126
     $err = false;
127 127
     // load PhpEncryption library
128 128
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
129 129
         $path = '../includes/libraries/Encryption/Encryption/';
130 130
     } else {
131
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
131
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
132 132
     }
133 133
 
134 134
     // Check if class already exists
135 135
     if (!class_exists('Defuse\Crypto\Crypto', false)) {
136
-		include_once $path . 'Crypto.php';
137
-		include_once $path . 'Encoding.php';
138
-		include_once $path . 'DerivedKeys.php';
139
-		include_once $path . 'Key.php';
140
-		include_once $path . 'KeyOrPassword.php';
141
-		include_once $path . 'File.php';
142
-		include_once $path . 'RuntimeTests.php';
143
-		include_once $path . 'KeyProtectedByPassword.php';
144
-		include_once $path . 'Core.php';
136
+		include_once $path.'Crypto.php';
137
+		include_once $path.'Encoding.php';
138
+		include_once $path.'DerivedKeys.php';
139
+		include_once $path.'Key.php';
140
+		include_once $path.'KeyOrPassword.php';
141
+		include_once $path.'File.php';
142
+		include_once $path.'RuntimeTests.php';
143
+		include_once $path.'KeyProtectedByPassword.php';
144
+		include_once $path.'Core.php';
145 145
 	}
146 146
     
147 147
     // convert KEY
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
         $path = '../includes/libraries/Encryption/Encryption/';
188 188
     }
189 189
 
190
-    include_once $path . 'Crypto.php';
191
-    include_once $path . 'Encoding.php';
192
-    include_once $path . 'DerivedKeys.php';
193
-    include_once $path . 'Key.php';
194
-    include_once $path . 'KeyOrPassword.php';
195
-    include_once $path . 'File.php';
196
-    include_once $path . 'RuntimeTests.php';
197
-    include_once $path . 'KeyProtectedByPassword.php';
198
-    include_once $path . 'Core.php';
190
+    include_once $path.'Crypto.php';
191
+    include_once $path.'Encoding.php';
192
+    include_once $path.'DerivedKeys.php';
193
+    include_once $path.'Key.php';
194
+    include_once $path.'KeyOrPassword.php';
195
+    include_once $path.'File.php';
196
+    include_once $path.'RuntimeTests.php';
197
+    include_once $path.'KeyProtectedByPassword.php';
198
+    include_once $path.'Core.php';
199 199
     $key = \Defuse\Crypto\Key::createNewRandomKey();
200 200
     $key = $key->saveToAsciiSafeString();
201 201
     return $key;
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
         $path = '../includes/libraries/Encryption/Encryption/';
218 218
     }
219 219
 
220
-    include_once $path . 'Crypto.php';
221
-    include_once $path . 'Encoding.php';
222
-    include_once $path . 'DerivedKeys.php';
223
-    include_once $path . 'Key.php';
224
-    include_once $path . 'KeyOrPassword.php';
225
-    include_once $path . 'File.php';
226
-    include_once $path . 'RuntimeTests.php';
227
-    include_once $path . 'KeyProtectedByPassword.php';
228
-    include_once $path . 'Core.php';
220
+    include_once $path.'Crypto.php';
221
+    include_once $path.'Encoding.php';
222
+    include_once $path.'DerivedKeys.php';
223
+    include_once $path.'Key.php';
224
+    include_once $path.'KeyOrPassword.php';
225
+    include_once $path.'File.php';
226
+    include_once $path.'RuntimeTests.php';
227
+    include_once $path.'KeyProtectedByPassword.php';
228
+    include_once $path.'Core.php';
229 229
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
230 230
     return $protected_key->saveToAsciiSafeString(); // save this in user table
231 231
 }
@@ -247,15 +247,15 @@  discard block
 block discarded – undo
247 247
         $path = '../includes/libraries/Encryption/Encryption/';
248 248
     }
249 249
 
250
-    include_once $path . 'Crypto.php';
251
-    include_once $path . 'Encoding.php';
252
-    include_once $path . 'DerivedKeys.php';
253
-    include_once $path . 'Key.php';
254
-    include_once $path . 'KeyOrPassword.php';
255
-    include_once $path . 'File.php';
256
-    include_once $path . 'RuntimeTests.php';
257
-    include_once $path . 'KeyProtectedByPassword.php';
258
-    include_once $path . 'Core.php';
250
+    include_once $path.'Crypto.php';
251
+    include_once $path.'Encoding.php';
252
+    include_once $path.'DerivedKeys.php';
253
+    include_once $path.'Key.php';
254
+    include_once $path.'KeyOrPassword.php';
255
+    include_once $path.'File.php';
256
+    include_once $path.'RuntimeTests.php';
257
+    include_once $path.'KeyProtectedByPassword.php';
258
+    include_once $path.'Core.php';
259 259
     try {
260 260
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
261 261
         $user_key = $protected_key->unlockKey($psk);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function trimElement($chaine, string $element): string
296 296
 {
297
-    if (! empty($chaine)) {
297
+    if (!empty($chaine)) {
298 298
         if (is_array($chaine) === true) {
299 299
             $chaine = implode(';', $chaine);
300 300
         }
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
  */
341 341
 function db_error_handler(array $params): void
342 342
 {
343
-    echo 'Error: ' . $params['error'] . "<br>\n";
344
-    echo 'Query: ' . $params['query'] . "<br>\n";
343
+    echo 'Error: '.$params['error']."<br>\n";
344
+    echo 'Query: '.$params['query']."<br>\n";
345 345
     throw new Exception('Error - Query', 1);
346 346
 }
347 347
 
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
     $SETTINGS
364 364
 ) {
365 365
     //load ClassLoader
366
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
366
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
367 367
     // Load superglobal
368
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
368
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
369 369
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
370 370
     //Connect to DB
371
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
371
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
372 372
     if (defined('DB_PASSWD_CLEAR') === false) {
373 373
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
374 374
     }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     DB::$port = DB_PORT;
380 380
     DB::$encoding = DB_ENCODING;
381 381
     //Build tree
382
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
382
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
383 383
     $tree->register();
384 384
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
385 385
     // Check if user is ADMINISTRATOR
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 function identAdmin($idFonctions, $SETTINGS, $tree)
423 423
 {
424 424
     // Load superglobal
425
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
425
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
426 426
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
427 427
     // Init
428 428
     $groupesVisibles = [];
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
442 442
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
443 443
     // Get list of Folders
444
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
444
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
445 445
     foreach ($rows as $record) {
446 446
         array_push($groupesVisibles, $record['id']);
447 447
     }
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
     }
461 461
     // Get ID of personal folder
462 462
     $persfld = DB::queryfirstrow(
463
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
463
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
464 464
         $globalsUserId
465 465
     );
466 466
     if (empty($persfld['id']) === false) {
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
     // get complete list of ROLES
482 482
     $tmp = explode(';', $idFonctions);
483 483
     $rows = DB::query(
484
-        'SELECT * FROM ' . prefixTable('roles_title') . '
484
+        'SELECT * FROM '.prefixTable('roles_title').'
485 485
         ORDER BY title ASC'
486 486
     );
487 487
     foreach ($rows as $record) {
488
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
488
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
489 489
             array_push($tmp, $record['id']);
490 490
         }
491 491
     }
492 492
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
493 493
     $superGlobal->put('is_admin', 1, 'SESSION');
494 494
     // Check if admin has created Folders and Roles
495
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
495
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
496 496
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
497
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
497
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
498 498
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
499 499
 }
500 500
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     object $tree
537 537
 ) {
538 538
     // Load superglobal
539
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
539
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
540 540
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
541 541
     // Init
542 542
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
     // Get list of folders depending on Roles
565 565
     $rows = DB::query(
566 566
         'SELECT *
567
-        FROM ' . prefixTable('roles_values') . '
567
+        FROM ' . prefixTable('roles_values').'
568 568
         WHERE role_id IN %li AND type IN %ls',
569 569
         $userRoles,
570 570
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -589,10 +589,10 @@  discard block
 block discarded – undo
589 589
     // Does this user is allowed to see other items
590 590
     $inc = 0;
591 591
     $rows = DB::query(
592
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
592
+        'SELECT id, id_tree FROM '.prefixTable('items').'
593 593
             WHERE restricted_to LIKE %ss AND inactif = %s'.
594 594
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
595
-        $globalsUserId . ';',
595
+        $globalsUserId.';',
596 596
         '0'
597 597
     );
598 598
     foreach ($rows as $record) {
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
     // Check for the users roles if some specific rights exist on items
607 607
     $rows = DB::query(
608 608
         'SELECT i.id_tree, r.item_id
609
-        FROM ' . prefixTable('items') . ' as i
610
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
609
+        FROM ' . prefixTable('items').' as i
610
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
611 611
         WHERE r.role_id IN %li AND i.id_tree <> ""
612 612
         ORDER BY i.id_tree ASC',
613 613
         $userRoles
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
     ) {
629 629
         $persoFld = DB::queryfirstrow(
630 630
             'SELECT id
631
-            FROM ' . prefixTable('nested_tree') . '
631
+            FROM ' . prefixTable('nested_tree').'
632 632
             WHERE title = %s AND personal_folder = %i'.
633 633
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
634 634
             $globalsUserId,
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     }
663 663
     $persoFlds = DB::query(
664 664
         'SELECT id
665
-        FROM ' . prefixTable('nested_tree') . '
665
+        FROM ' . prefixTable('nested_tree').'
666 666
         WHERE %l',
667 667
         $where
668 668
     );
@@ -703,16 +703,16 @@  discard block
 block discarded – undo
703 703
         'SESSION'
704 704
     );
705 705
     // Folders and Roles numbers
706
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
706
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
707 707
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
708
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
708
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
709 709
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
710 710
     // check if change proposals on User's items
711 711
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
712 712
         DB::query(
713 713
             'SELECT *
714
-            FROM ' . prefixTable('items_change') . ' AS c
715
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
714
+            FROM ' . prefixTable('items_change').' AS c
715
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
716 716
             WHERE i.action = %s AND i.id_user = %i',
717 717
             'at_creation',
718 718
             $globalsUserId
@@ -756,9 +756,9 @@  discard block
 block discarded – undo
756 756
  */
757 757
 function cacheTableRefresh(array $SETTINGS): void
758 758
 {
759
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
759
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
760 760
     //Connect to DB
761
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
761
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
762 762
     if (defined('DB_PASSWD_CLEAR') === false) {
763 763
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
764 764
     }
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
     $tree->register();
774 774
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
775 775
     // truncate table
776
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
776
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
777 777
     // reload date
778 778
     $rows = DB::query(
779 779
         'SELECT *
780
-        FROM ' . prefixTable('items') . ' as i
781
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
780
+        FROM ' . prefixTable('items').' as i
781
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
782 782
         AND l.action = %s
783 783
         AND i.inactif = %i',
784 784
         'at_creation',
@@ -790,18 +790,18 @@  discard block
 block discarded – undo
790 790
             $tags = '';
791 791
             $itemTags = DB::query(
792 792
                 'SELECT tag
793
-                            FROM ' . prefixTable('tags') . '
793
+                            FROM ' . prefixTable('tags').'
794 794
                             WHERE item_id = %i AND tag != ""',
795 795
                 $record['id']
796 796
             );
797 797
             foreach ($itemTags as $itemTag) {
798
-                $tags .= $itemTag['tag'] . ' ';
798
+                $tags .= $itemTag['tag'].' ';
799 799
             }
800 800
 
801 801
             // Get renewal period
802 802
             $resNT = DB::queryfirstrow(
803 803
                 'SELECT renewal_period
804
-                FROM ' . prefixTable('nested_tree') . '
804
+                FROM ' . prefixTable('nested_tree').'
805 805
                 WHERE id = %i',
806 806
                 $record['id_tree']
807 807
             );
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
                     // Is this a User id?
815 815
                     $user = DB::queryfirstrow(
816 816
                         'SELECT id, login
817
-                        FROM ' . prefixTable('users') . '
817
+                        FROM ' . prefixTable('users').'
818 818
                         WHERE id = %i',
819 819
                         $elem->title
820 820
                     );
@@ -832,11 +832,11 @@  discard block
 block discarded – undo
832 832
                     'id' => $record['id'],
833 833
                     'label' => $record['label'],
834 834
                     'description' => $record['description'] ?? '',
835
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
835
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
836 836
                     'tags' => $tags,
837 837
                     'id_tree' => $record['id_tree'],
838 838
                     'perso' => $record['perso'],
839
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
839
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
840 840
                     'login' => $record['login'] ?? '',
841 841
                     'folder' => implode(' > ', $folder),
842 842
                     'author' => $record['id_user'],
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
  */
857 857
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
858 858
 {
859
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
859
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
860 860
     // Load superglobal
861
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
861
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
862 862
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
863 863
     //Connect to DB
864
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
864
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
865 865
     if (defined('DB_PASSWD_CLEAR') === false) {
866 866
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
867 867
     }
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
     // get new value from db
879 879
     $data = DB::queryfirstrow(
880 880
         'SELECT label, description, id_tree, perso, restricted_to, login, url
881
-        FROM ' . prefixTable('items') . '
881
+        FROM ' . prefixTable('items').'
882 882
         WHERE id=%i',
883 883
         $ident
884 884
     );
@@ -886,12 +886,12 @@  discard block
 block discarded – undo
886 886
     $tags = '';
887 887
     $itemTags = DB::query(
888 888
         'SELECT tag
889
-            FROM ' . prefixTable('tags') . '
889
+            FROM ' . prefixTable('tags').'
890 890
             WHERE item_id = %i AND tag != ""',
891 891
         $ident
892 892
     );
893 893
     foreach ($itemTags as $itemTag) {
894
-        $tags .= $itemTag['tag'] . ' ';
894
+        $tags .= $itemTag['tag'].' ';
895 895
     }
896 896
     // form id_tree to full foldername
897 897
     $folder = [];
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
             // Is this a User id?
903 903
             $user = DB::queryfirstrow(
904 904
                 'SELECT id, login
905
-                FROM ' . prefixTable('users') . '
905
+                FROM ' . prefixTable('users').'
906 906
                 WHERE id = %i',
907 907
                 $elem->title
908 908
             );
@@ -920,10 +920,10 @@  discard block
 block discarded – undo
920 920
             'label' => $data['label'],
921 921
             'description' => $data['description'],
922 922
             'tags' => $tags,
923
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
923
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
924 924
             'id_tree' => $data['id_tree'],
925 925
             'perso' => $data['perso'],
926
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
926
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
927 927
             'login' => $data['login'] ?? '',
928 928
             'folder' => implode(' » ', $folder),
929 929
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -941,14 +941,14 @@  discard block
 block discarded – undo
941 941
  */
942 942
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
943 943
 {
944
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
944
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
945 945
     // Load superglobal
946
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
946
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
947 947
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
948 948
     // Get superglobals
949 949
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
950 950
     //Connect to DB
951
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
951
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
952 952
     if (defined('DB_PASSWD_CLEAR') === false) {
953 953
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
954 954
     }
@@ -965,8 +965,8 @@  discard block
 block discarded – undo
965 965
     // get new value from db
966 966
     $data = DB::queryFirstRow(
967 967
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
968
-        FROM ' . prefixTable('items') . ' as i
969
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
968
+        FROM ' . prefixTable('items').' as i
969
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
970 970
         WHERE i.id = %i
971 971
         AND l.action = %s',
972 972
         $ident,
@@ -976,12 +976,12 @@  discard block
 block discarded – undo
976 976
     $tags = '';
977 977
     $itemTags = DB::query(
978 978
         'SELECT tag
979
-            FROM ' . prefixTable('tags') . '
979
+            FROM ' . prefixTable('tags').'
980 980
             WHERE item_id = %i AND tag != ""',
981 981
         $ident
982 982
     );
983 983
     foreach ($itemTags as $itemTag) {
984
-        $tags .= $itemTag['tag'] . ' ';
984
+        $tags .= $itemTag['tag'].' ';
985 985
     }
986 986
     // form id_tree to full foldername
987 987
     $folder = [];
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
             // Is this a User id?
993 993
             $user = DB::queryfirstrow(
994 994
                 'SELECT id, login
995
-                FROM ' . prefixTable('users') . '
995
+                FROM ' . prefixTable('users').'
996 996
                 WHERE id = %i',
997 997
                 $elem->title
998 998
             );
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
             'label' => $data['label'],
1012 1012
             'description' => $data['description'],
1013 1013
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1014
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1014
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1015 1015
             'id_tree' => $data['id_tree'],
1016 1016
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1017 1017
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1033,52 +1033,52 @@  discard block
 block discarded – undo
1033 1033
 function getStatisticsData(array $SETTINGS): array
1034 1034
 {
1035 1035
     DB::query(
1036
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1036
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1037 1037
         0
1038 1038
     );
1039 1039
     $counter_folders = DB::count();
1040 1040
     DB::query(
1041
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1041
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1042 1042
         1
1043 1043
     );
1044 1044
     $counter_folders_perso = DB::count();
1045 1045
     DB::query(
1046
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1046
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1047 1047
         0
1048 1048
     );
1049 1049
     $counter_items = DB::count();
1050 1050
         DB::query(
1051
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1051
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1052 1052
         1
1053 1053
     );
1054 1054
     $counter_items_perso = DB::count();
1055 1055
         DB::query(
1056
-        'SELECT id FROM ' . prefixTable('users') . ''
1056
+        'SELECT id FROM '.prefixTable('users').''
1057 1057
     );
1058 1058
     $counter_users = DB::count();
1059 1059
         DB::query(
1060
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1060
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1061 1061
         1
1062 1062
     );
1063 1063
     $admins = DB::count();
1064 1064
     DB::query(
1065
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1065
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1066 1066
         1
1067 1067
     );
1068 1068
     $managers = DB::count();
1069 1069
     DB::query(
1070
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1070
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1071 1071
         1
1072 1072
     );
1073 1073
     $readOnly = DB::count();
1074 1074
     // list the languages
1075 1075
     $usedLang = [];
1076 1076
     $tp_languages = DB::query(
1077
-        'SELECT name FROM ' . prefixTable('languages')
1077
+        'SELECT name FROM '.prefixTable('languages')
1078 1078
     );
1079 1079
     foreach ($tp_languages as $tp_language) {
1080 1080
         DB::query(
1081
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1081
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1082 1082
             $tp_language['name']
1083 1083
         );
1084 1084
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1087,12 +1087,12 @@  discard block
 block discarded – undo
1087 1087
     // get list of ips
1088 1088
     $usedIp = [];
1089 1089
     $tp_ips = DB::query(
1090
-        'SELECT user_ip FROM ' . prefixTable('users')
1090
+        'SELECT user_ip FROM '.prefixTable('users')
1091 1091
     );
1092 1092
     foreach ($tp_ips as $ip) {
1093 1093
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1094 1094
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1095
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1095
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1096 1096
             $usedIp[$ip['user_ip']] = 1;
1097 1097
         }
1098 1098
     }
@@ -1158,14 +1158,14 @@  discard block
 block discarded – undo
1158 1158
     }
1159 1159
 
1160 1160
     // Load settings
1161
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1161
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1162 1162
     // Load superglobal
1163
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1163
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1164 1164
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1165 1165
     // Get user language
1166
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1166
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1167 1167
     // Load library
1168
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1168
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1169 1169
     // load PHPMailer
1170 1170
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1171 1171
     $mail->register();
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
     
1174 1174
     try {
1175 1175
         // send to user
1176
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1176
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1177 1177
         $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1178 1178
         $mail->Port = $SETTINGS['email_port'];
1179 1179
         //COULD BE USED
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
         <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;">
1274 1274
         <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;">
1275 1275
         <br><div style="float:right;">' .
1276
-        $textMail .
1276
+        $textMail.
1277 1277
         '<br><br></td></tr></table>
1278 1278
     </td></tr></table>
1279 1279
     <br></body></html>';
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
  */
1285 1285
 function generateKey(): string
1286 1286
 {
1287
-    return substr(md5(rand() . rand()), 0, 15);
1287
+    return substr(md5(rand().rand()), 0, 15);
1288 1288
 }
1289 1289
 
1290 1290
 /**
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
 {
1356 1356
     array_walk_recursive(
1357 1357
         $array,
1358
-        static function (&$item): void {
1358
+        static function(&$item): void {
1359 1359
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1360 1360
                 $item = utf8_encode($item);
1361 1361
             }
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
     }
1391 1391
 
1392 1392
     // Load superglobal
1393
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1393
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1394 1394
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1395 1395
     // Get superglobals
1396 1396
     if ($key !== null) {
@@ -1401,9 +1401,9 @@  discard block
 block discarded – undo
1401 1401
     }
1402 1402
 
1403 1403
     //load ClassLoader
1404
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1404
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1405 1405
     //Load AES
1406
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1406
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1407 1407
     $aes->register();
1408 1408
     if ($type === 'encode' && is_array($data) === true) {
1409 1409
         // Ensure UTF8 format
@@ -1473,8 +1473,8 @@  discard block
 block discarded – undo
1473 1473
  */
1474 1474
 function prefixTable(string $table): string
1475 1475
 {
1476
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1477
-    if (! empty($safeTable)) {
1476
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1477
+    if (!empty($safeTable)) {
1478 1478
         // sanitize string
1479 1479
         return $safeTable;
1480 1480
     }
@@ -1502,13 +1502,13 @@  discard block
 block discarded – undo
1502 1502
     bool $lowercase = false,
1503 1503
     array $SETTINGS = []
1504 1504
 ): string {
1505
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1506
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1505
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1506
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1507 1507
     $generator->register();
1508 1508
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1509 1509
     // Is PHP7 being used?
1510 1510
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1511
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1511
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1512 1512
         $php7generator->register();
1513 1513
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1514 1514
     }
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1539 1539
 {
1540 1540
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1541
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1541
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1542 1542
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1543 1543
     socket_close($sock);
1544 1544
 }
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
     }
1561 1561
 
1562 1562
     // include librairies & connect to DB
1563
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1563
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1564 1564
     if (defined('DB_PASSWD_CLEAR') === false) {
1565 1565
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1566 1566
     }
@@ -1584,14 +1584,14 @@  discard block
 block discarded – undo
1584 1584
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1585 1585
         if ($type === 'user_mngt') {
1586 1586
             send_syslog(
1587
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1587
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1588 1588
                 $SETTINGS['syslog_host'],
1589 1589
                 $SETTINGS['syslog_port'],
1590 1590
                 'teampass'
1591 1591
             );
1592 1592
         } else {
1593 1593
             send_syslog(
1594
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1594
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1595 1595
                 $SETTINGS['syslog_host'],
1596 1596
                 $SETTINGS['syslog_port'],
1597 1597
                 'teampass'
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
     ?string $encryption_type = null
1624 1624
 ): void {
1625 1625
     // include librairies & connect to DB
1626
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1626
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1627 1627
     if (defined('DB_PASSWD_CLEAR') === false) {
1628 1628
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1629 1629
     }
@@ -1667,7 +1667,7 @@  discard block
 block discarded – undo
1667 1667
         if (empty($item_label) === true) {
1668 1668
             $dataItem = DB::queryfirstrow(
1669 1669
                 'SELECT id, id_tree, label
1670
-                FROM ' . prefixTable('items') . '
1670
+                FROM ' . prefixTable('items').'
1671 1671
                 WHERE id = %i',
1672 1672
                 $item_id
1673 1673
             );
@@ -1675,11 +1675,11 @@  discard block
 block discarded – undo
1675 1675
         }
1676 1676
 
1677 1677
         send_syslog(
1678
-            'action=' . str_replace('at_', '', $action) .
1679
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1680
-                ' itemno=' . $item_id .
1681
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1682
-                ' itemname="' . addslashes($item_label) . '"',
1678
+            'action='.str_replace('at_', '', $action).
1679
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1680
+                ' itemno='.$item_id.
1681
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1682
+                ' itemname="'.addslashes($item_label).'"',
1683 1683
             $SETTINGS['syslog_host'],
1684 1684
             $SETTINGS['syslog_port'],
1685 1685
             'teampass'
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
         && $action === 'at_shown'
1706 1706
     ) {
1707 1707
         // Load superglobal
1708
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1708
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1709 1709
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1710 1710
         // Get superglobals
1711 1711
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
         // Get info about item
1715 1715
         $dataItem = DB::queryfirstrow(
1716 1716
             'SELECT id, id_tree, label
1717
-            FROM ' . prefixTable('items') . '
1717
+            FROM ' . prefixTable('items').'
1718 1718
             WHERE id = %i',
1719 1719
             $item_id
1720 1720
         );
@@ -1728,9 +1728,9 @@  discard block
 block discarded – undo
1728 1728
                 'body' => str_replace(
1729 1729
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1730 1730
                     [
1731
-                        addslashes($globalsName . ' ' . $globalsLastname),
1731
+                        addslashes($globalsName.' '.$globalsLastname),
1732 1732
                         addslashes($item_label),
1733
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1733
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1734 1734
                     ],
1735 1735
                     langHdl('email_on_open_notification_mail')
1736 1736
                 ),
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1753 1753
 {
1754 1754
     // Load superglobal
1755
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1755
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1756 1756
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1757 1757
     // Get superglobals
1758 1758
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1762,8 +1762,8 @@  discard block
 block discarded – undo
1762 1762
     $notification = DB::queryOneColumn(
1763 1763
         'email',
1764 1764
         'SELECT *
1765
-        FROM ' . prefixTable('notification') . ' AS n
1766
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1765
+        FROM ' . prefixTable('notification').' AS n
1766
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1767 1767
         WHERE n.item_id = %i AND n.user_id != %i',
1768 1768
         $item_id,
1769 1769
         $globalsUserId
@@ -1774,7 +1774,7 @@  discard block
 block discarded – undo
1774 1774
         // Get list of changes
1775 1775
         $htmlChanges = '<ul>';
1776 1776
         foreach ($changes as $change) {
1777
-            $htmlChanges .= '<li>' . $change . '</li>';
1777
+            $htmlChanges .= '<li>'.$change.'</li>';
1778 1778
         }
1779 1779
         $htmlChanges .= '</ul>';
1780 1780
         // send email
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1806 1806
 {
1807 1807
     // Class loader
1808
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1808
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1809 1809
     //Load Tree
1810 1810
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1811 1811
     $tree->register();
@@ -1814,15 +1814,15 @@  discard block
 block discarded – undo
1814 1814
     $path = '';
1815 1815
     foreach ($arbo as $elem) {
1816 1816
         if (empty($path) === true) {
1817
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1817
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1818 1818
         } else {
1819
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1819
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1820 1820
         }
1821 1821
     }
1822 1822
 
1823 1823
     // Build text to show user
1824 1824
     if (empty($label) === false) {
1825
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1825
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1826 1826
     }
1827 1827
     return empty($path) === true ? '' : $path;
1828 1828
 }
@@ -1877,9 +1877,9 @@  discard block
 block discarded – undo
1877 1877
  */
1878 1878
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1879 1879
 {
1880
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1880
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1881 1881
     // include librairies & connect to DB
1882
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1882
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1883 1883
     if (defined('DB_PASSWD_CLEAR') === false) {
1884 1884
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1885 1885
     }
@@ -1892,8 +1892,8 @@  discard block
 block discarded – undo
1892 1892
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1893 1893
         // perform a copy
1894 1894
         if (file_exists($tp_config_file)) {
1895
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1896
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1895
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1896
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1897 1897
             }
1898 1898
         }
1899 1899
 
@@ -1903,11 +1903,11 @@  discard block
 block discarded – undo
1903 1903
         $data[1] = "global \$SETTINGS;\n";
1904 1904
         $data[2] = "\$SETTINGS = array (\n";
1905 1905
         $rows = DB::query(
1906
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1906
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1907 1907
             'admin'
1908 1908
         );
1909 1909
         foreach ($rows as $record) {
1910
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
1910
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
1911 1911
         }
1912 1912
         array_push($data, ");\n");
1913 1913
         $data = array_unique($data);
@@ -1921,15 +1921,15 @@  discard block
 block discarded – undo
1921 1921
                 break;
1922 1922
             }
1923 1923
 
1924
-            if (stristr($line, "'" . $field . "' => '")) {
1925
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
1924
+            if (stristr($line, "'".$field."' => '")) {
1925
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
1926 1926
                 $bFound = true;
1927 1927
                 break;
1928 1928
             }
1929 1929
             ++$inc;
1930 1930
         }
1931 1931
         if ($bFound === false) {
1932
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
1932
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
1933 1933
         }
1934 1934
     }
1935 1935
 
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 {
1956 1956
     global $SETTINGS;
1957 1957
     /* LOAD CPASSMAN SETTINGS */
1958
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1958
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1959 1959
         $SETTINGS = [];
1960 1960
         $SETTINGS['duplicate_folder'] = 0;
1961 1961
         //by default, this is set to 0;
@@ -1965,7 +1965,7 @@  discard block
 block discarded – undo
1965 1965
         //by default, this value is set to 5;
1966 1966
         $settings = [];
1967 1967
         $rows = DB::query(
1968
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1968
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1969 1969
             [
1970 1970
                 'type' => 'admin',
1971 1971
                 'type2' => 'settings',
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
     $source_cf = [];
1993 1993
     $rows = DB::QUERY(
1994 1994
         'SELECT id_category
1995
-            FROM ' . prefixTable('categories_folders') . '
1995
+            FROM ' . prefixTable('categories_folders').'
1996 1996
             WHERE id_folder = %i',
1997 1997
         $source_id
1998 1998
     );
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
     $target_cf = [];
2004 2004
     $rows = DB::QUERY(
2005 2005
         'SELECT id_category
2006
-            FROM ' . prefixTable('categories_folders') . '
2006
+            FROM ' . prefixTable('categories_folders').'
2007 2007
             WHERE id_folder = %i',
2008 2008
         $target_id
2009 2009
     );
@@ -2038,9 +2038,9 @@  discard block
 block discarded – undo
2038 2038
     $password = null
2039 2039
 ) {
2040 2040
     // Load AntiXSS
2041
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2042
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2043
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2041
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2042
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2043
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2044 2044
     $antiXss = new voku\helper\AntiXSS();
2045 2045
     // Protect against bad inputs
2046 2046
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
     $target_file = $antiXss->xss_clean($target_file);
2053 2053
     if (empty($password) === true || is_null($password) === true) {
2054 2054
         // get KEY to define password
2055
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2055
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2056 2056
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2057 2057
     }
2058 2058
 
@@ -2097,15 +2097,15 @@  discard block
 block discarded – undo
2097 2097
 ) {
2098 2098
     // load PhpEncryption library
2099 2099
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2100
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2101
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2102
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2103
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2104
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2105
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2106
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2107
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2108
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2100
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2101
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2102
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2103
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2104
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2105
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2106
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2107
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2108
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2109 2109
     try {
2110 2110
         \Defuse\Crypto\File::encryptFileWithPassword(
2111 2111
             $source_file,
@@ -2142,15 +2142,15 @@  discard block
 block discarded – undo
2142 2142
 ) {
2143 2143
     // load PhpEncryption library
2144 2144
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2145
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2146
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2147
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2148
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2149
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2150
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2151
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2152
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2153
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2145
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2146
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2147
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2148
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2149
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2150
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2151
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2152
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2153
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2154 2154
     try {
2155 2155
         \Defuse\Crypto\File::decryptFileWithPassword(
2156 2156
             $source_file,
@@ -2195,9 +2195,9 @@  discard block
 block discarded – undo
2195 2195
 function fileDelete(string $file, array $SETTINGS): void
2196 2196
 {
2197 2197
     // Load AntiXSS
2198
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2199
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2200
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2198
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2199
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2200
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2201 2201
     $antiXss = new voku\helper\AntiXSS();
2202 2202
     $file = $antiXss->xss_clean($file);
2203 2203
     if (is_file($file)) {
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 
2242 2242
 function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755) {
2243 2243
     // Check if the path exists
2244
-    if (! file_exists($path)) {
2244
+    if (!file_exists($path)) {
2245 2245
         return false;
2246 2246
     }
2247 2247
 
@@ -2276,7 +2276,7 @@  discard block
 block discarded – undo
2276 2276
  */
2277 2277
 function accessToItemIsGranted(int $item_id, $SETTINGS)
2278 2278
 {
2279
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2279
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2280 2280
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2281 2281
     // Prepare superGlobal variables
2282 2282
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2284,7 +2284,7 @@  discard block
 block discarded – undo
2284 2284
     // Load item data
2285 2285
     $data = DB::queryFirstRow(
2286 2286
         'SELECT id_tree
2287
-        FROM ' . prefixTable('items') . '
2287
+        FROM ' . prefixTable('items').'
2288 2288
         WHERE id = %i',
2289 2289
         $item_id
2290 2290
     );
@@ -2357,8 +2357,8 @@  discard block
 block discarded – undo
2357 2357
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2358 2358
 {
2359 2359
     // include librairies & connect to DB
2360
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2361
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2360
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2361
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2362 2362
     if (defined('DB_PASSWD_CLEAR') === false) {
2363 2363
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2364 2364
     }
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
     DB::$encoding = DB_ENCODING;
2371 2371
     // Insert log in DB
2372 2372
     return DB::query(
2373
-        'SELECT ' . $fields . '
2373
+        'SELECT '.$fields.'
2374 2374
         FROM ' . prefixTable($table)
2375 2375
     );
2376 2376
 }
@@ -2383,11 +2383,11 @@  discard block
 block discarded – undo
2383 2383
 function formatSizeUnits(int $bytes): string
2384 2384
 {
2385 2385
     if ($bytes >= 1073741824) {
2386
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2386
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2387 2387
     } elseif ($bytes >= 1048576) {
2388
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2388
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2389 2389
     } elseif ($bytes >= 1024) {
2390
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2390
+        $bytes = number_format($bytes / 1024, 2).' KB';
2391 2391
     } elseif ($bytes > 1) {
2392 2392
         $bytes .= ' bytes';
2393 2393
     } elseif ($bytes === 1) {
@@ -2578,14 +2578,14 @@  discard block
 block discarded – undo
2578 2578
 
2579 2579
     // Encrypt the file content
2580 2580
     $plaintext = file_get_contents(
2581
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2581
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2582 2582
     );
2583 2583
     $ciphertext = $cipher->encrypt($plaintext);
2584 2584
     // Save new file
2585 2585
     $hash = md5($plaintext);
2586
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2586
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2587 2587
     file_put_contents($fileOut, $ciphertext);
2588
-    unlink($fileInPath . '/' . $fileInName);
2588
+    unlink($fileInPath.'/'.$fileInName);
2589 2589
     return [
2590 2590
         'fileHash' => base64_encode($hash),
2591 2591
         'objectKey' => base64_encode($objectKey),
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
  */
2602 2602
 function decryptFile(string $fileName, string $filePath, string $key): string
2603 2603
 {
2604
-    if (! defined('FILE_BUFFER_SIZE')) {
2604
+    if (!defined('FILE_BUFFER_SIZE')) {
2605 2605
         define('FILE_BUFFER_SIZE', 128 * 1024);
2606 2606
     }
2607 2607
 
@@ -2620,7 +2620,7 @@  discard block
 block discarded – undo
2620 2620
     $cipher->enableContinuousBuffer();
2621 2621
     $cipher->disablePadding();
2622 2622
     // Get file content
2623
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2623
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2624 2624
     // Decrypt file content and return
2625 2625
     return base64_encode($cipher->decrypt($ciphertext));
2626 2626
 }
@@ -2670,8 +2670,8 @@  discard block
 block discarded – undo
2670 2670
     array $SETTINGS
2671 2671
 ): void {
2672 2672
     // include librairies & connect to DB
2673
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2674
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2673
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2674
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2675 2675
     if (defined('DB_PASSWD_CLEAR') === false) {
2676 2676
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2677 2677
     }
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
         $post_object_id
2689 2689
     );
2690 2690
     // Superglobals
2691
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2691
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2692 2692
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2693 2693
     // Prepare superGlobal variables
2694 2694
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2713,8 +2713,8 @@  discard block
 block discarded – undo
2713 2713
         // Create sharekey for each user
2714 2714
         $users = DB::query(
2715 2715
             'SELECT id, public_key
2716
-            FROM ' . prefixTable('users') . '
2717
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2716
+            FROM ' . prefixTable('users').'
2717
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2718 2718
             AND public_key != ""'
2719 2719
         );
2720 2720
         foreach ($users as $user) {
@@ -2742,7 +2742,7 @@  discard block
 block discarded – undo
2742 2742
 function isBase64(string $str): bool
2743 2743
 {
2744 2744
     $str = (string) trim($str);
2745
-    if (! isset($str[0])) {
2745
+    if (!isset($str[0])) {
2746 2746
         return false;
2747 2747
     }
2748 2748
 
@@ -2810,13 +2810,13 @@  discard block
 block discarded – undo
2810 2810
         ],
2811 2811
     ];
2812 2812
     // Load expected libraries
2813
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2814
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2815
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2816
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2817
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2818
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2819
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2813
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2814
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2815
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2816
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2817
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2818
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2819
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2820 2820
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2821 2821
     $ad->register();
2822 2822
     $connection = new Connection($config);
@@ -2825,7 +2825,7 @@  discard block
 block discarded – undo
2825 2825
         $connection->connect();
2826 2826
     } catch (\LdapRecord\Auth\BindException $e) {
2827 2827
         $error = $e->getDetailedError();
2828
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2828
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2829 2829
         return false;
2830 2830
     }
2831 2831
 
@@ -2838,7 +2838,7 @@  discard block
 block discarded – undo
2838 2838
         }
2839 2839
     } catch (\LdapRecord\Auth\BindException $e) {
2840 2840
         $error = $e->getDetailedError();
2841
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2841
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2842 2842
         return false;
2843 2843
     }
2844 2844
 
@@ -2856,8 +2856,8 @@  discard block
 block discarded – undo
2856 2856
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
2857 2857
 {
2858 2858
     // include librairies & connect to DB
2859
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2860
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2859
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2860
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2861 2861
     if (defined('DB_PASSWD_CLEAR') === false) {
2862 2862
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2863 2863
     }
@@ -2915,7 +2915,7 @@  discard block
 block discarded – undo
2915 2915
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2916 2916
             $now->setTimezone(new DateTimeZone($timezone));
2917 2917
             $offsets[] = $offset = $now->getOffset();
2918
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2918
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2919 2919
         }
2920 2920
 
2921 2921
         array_multisort($offsets, $timezones);
@@ -2935,7 +2935,7 @@  discard block
 block discarded – undo
2935 2935
 {
2936 2936
     $hours = intval($offset / 3600);
2937 2937
     $minutes = abs(intval($offset % 3600 / 60));
2938
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2938
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2939 2939
 }
2940 2940
 
2941 2941
 /**
Please login to merge, or discard this patch.