Passed
Push — teampass_3.0 ( a80954...c89a77 )
by Nils
06:00
created
sources/roles.queries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -505,7 +505,7 @@
 block discarded – undo
505 505
 
506 506
             // decrypt and retrieve data in JSON format
507 507
             $dataReceived = prepareExchangedData(
508
-                $SETTINGS['cpassman_dir'],$post_data, 'decode');
508
+                $SETTINGS['cpassman_dir'], $post_data, 'decode');
509 509
 
510 510
             // Prepare variables
511 511
             $post_roleId = filter_var($dataReceived['roleId'], FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
sources/ldap.queries.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 /* do checks */
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
49
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
50 50
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'ldap', $SETTINGS)) {
51 51
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
52
-    include $SETTINGS['cpassman_dir'] . '/error.php';
52
+    include $SETTINGS['cpassman_dir'].'/error.php';
53 53
     exit();
54 54
 }
55 55
 
56
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
56
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
59 59
 
60 60
 header('Content-type: text/html; charset=utf-8');
61 61
 header('Cache-Control: no-cache, no-store, must-revalidate');
62 62
 
63
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
64
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
63
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
64
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
65 65
 
66 66
 // connect to the server
67
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
67
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
68 68
 if (defined('DB_PASSWD_CLEAR') === false) {
69 69
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
70 70
 }
@@ -129,38 +129,38 @@  discard block
 block discarded – undo
129 129
         ];
130 130
 
131 131
         // Load expected libraries
132
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
133
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
134
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
135
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
136
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
137
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
138
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
139
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
140
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
141
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
142
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
143
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
144
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
145
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
146
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
147
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
148
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
149
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
150
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
151
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
152
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
153
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
154
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
155
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
156
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
157
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
158
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
159
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
160
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
161
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
162
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
163
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php';
132
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
133
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
134
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
135
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
136
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
137
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
138
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
139
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
140
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
141
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
142
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
143
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
144
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
145
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
146
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
147
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
148
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
149
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
150
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
151
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
152
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
153
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
154
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
155
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
156
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
157
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
158
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
159
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
160
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
161
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
162
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
163
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php';
164 164
 
165 165
         $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
166 166
         $ad->register();
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                 $SETTINGS['cpassman_dir'],
177 177
                 array(
178 178
                     'error' => true,
179
-                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
179
+                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
180 180
                 ),
181 181
                 'encode'
182 182
             );
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                 $SETTINGS['cpassman_dir'],
196 196
                 array(
197 197
                     'error' => true,
198
-                    'message' => "Error : ".$e->withDetailedError($e),//->detailedError(),
198
+                    'message' => "Error : ".$e->withDetailedError($e), //->detailedError(),
199 199
                 ),
200 200
                 'encode'
201 201
             );
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                 $SETTINGS['cpassman_dir'],
216 216
                 array(
217 217
                     'error' => true,
218
-                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
218
+                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
219 219
                 ),
220 220
                 'encode'
221 221
             );
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +174 added lines, -174 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
 }
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
 
129 129
             // decrypt and retrieve data in JSON format
130 130
             $dataReceived = prepareExchangedData(
131
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
131
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
132 132
 
133 133
             // Prepare variables
134 134
             $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
135 135
             $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL);
136
-            $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
136
+            $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
137 137
             $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING);
138 138
             $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING);
139 139
             $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             // Check if user already exists
164 164
             $data = DB::query(
165 165
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
166
-                FROM ' . prefixTable('users') . '
166
+                FROM ' . prefixTable('users').'
167 167
                 WHERE login = %s',
168 168
                 $login
169 169
             );
@@ -379,14 +379,14 @@  discard block
 block discarded – undo
379 379
 
380 380
             // decrypt and retrieve data in JSON format
381 381
             $dataReceived = prepareExchangedData(
382
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
382
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
383 383
 
384 384
             // Prepare variables
385 385
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
386 386
 
387 387
             // Get info about user to delete
388 388
             $data_user = DB::queryfirstrow(
389
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
389
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
390 390
                 WHERE id = %i',
391 391
                 $post_id
392 392
             );
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                 );
406 406
                 // delete personal folder and subfolders
407 407
                 $data = DB::queryfirstrow(
408
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
408
+                    'SELECT id FROM '.prefixTable('nested_tree').'
409 409
                     WHERE title = %s AND personal_folder = %i',
410 410
                     $post_id,
411 411
                     '1'
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
419 419
                         // delete items & logs
420 420
                         $items = DB::query(
421
-                            'SELECT id FROM ' . prefixTable('items') . '
421
+                            'SELECT id FROM '.prefixTable('items').'
422 422
                             WHERE id_tree=%i AND perso = %i',
423 423
                             $folder->id,
424 424
                             '1'
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
             // Check KEY
471 471
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
472 472
                 echo prepareExchangedData(
473
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
473
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
474 474
                 break;
475 475
             }
476 476
 
@@ -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
             );
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
                     $post_id
499 499
                 );
500 500
                 echo prepareExchangedData(
501
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
501
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
502 502
             } else {
503 503
                 echo prepareExchangedData(
504
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
504
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
505 505
             }
506 506
             break;
507 507
             /*
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
                 || $_SESSION['is_admin'] !== '1'
515 515
             ) {
516 516
                 echo prepareExchangedData(
517
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
517
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
518 518
                 exit();
519 519
             }
520 520
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
             // Get info about user to delete
525 525
             $data_user = DB::queryfirstrow(
526
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
526
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
527 527
                 WHERE id = %i',
528 528
                 $post_id
529 529
             );
@@ -546,10 +546,10 @@  discard block
 block discarded – undo
546 546
                 );
547 547
 
548 548
                 echo prepareExchangedData(
549
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
549
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
550 550
             } else {
551 551
                 echo prepareExchangedData(
552
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
552
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
553 553
             }
554 554
             break;
555 555
             /*
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
             // Check KEY
560 560
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
561 561
                 echo prepareExchangedData(
562
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
562
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
563 563
                 break;
564 564
             }
565 565
 
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
             // Get info about user to delete
570 570
             $data_user = DB::queryfirstrow(
571 571
                 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire
572
-                FROM ' . prefixTable('users') . '
572
+                FROM ' . prefixTable('users').'
573 573
                 WHERE id = %i',
574 574
                 $post_id
575 575
             );
@@ -594,10 +594,10 @@  discard block
 block discarded – undo
594 594
                     $post_id
595 595
                 );
596 596
                 echo prepareExchangedData(
597
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
597
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
598 598
             } else {
599 599
                 echo prepareExchangedData(
600
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
600
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
601 601
             }
602 602
             break;
603 603
             /*
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
             // Check KEY
608 608
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
609 609
                 echo prepareExchangedData(
610
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
610
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
611 611
                 break;
612 612
             }
613 613
 
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 
617 617
             // Get info about user to delete
618 618
             $data_user = DB::queryfirstrow(
619
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
619
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
620 620
                 WHERE id = %i',
621 621
                 $post_id
622 622
             );
@@ -638,10 +638,10 @@  discard block
 block discarded – undo
638 638
                     $post_id
639 639
                 );
640 640
                 echo prepareExchangedData(
641
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
641
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
642 642
             } else {
643 643
                 echo prepareExchangedData(
644
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
644
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
645 645
             }
646 646
             break;
647 647
             /*
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
             // Check KEY
653 653
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
654 654
                 echo prepareExchangedData(
655
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
655
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
656 656
                 break;
657 657
             }
658 658
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
             // Get info about user to delete
663 663
             $data_user = DB::queryfirstrow(
664 664
                 'SELECT admin, isAdministratedByRole, gestionnaire
665
-                FROM ' . prefixTable('users') . '
665
+                FROM ' . prefixTable('users').'
666 666
                 WHERE id = %i',
667 667
                 $post_id
668 668
             );
@@ -685,10 +685,10 @@  discard block
 block discarded – undo
685 685
                     $post_id
686 686
                 );
687 687
                 echo prepareExchangedData(
688
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
688
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
689 689
             } else {
690 690
                 echo prepareExchangedData(
691
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
691
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
692 692
             }
693 693
             break;
694 694
             /*
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
             // Check KEY
699 699
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
700 700
                 echo prepareExchangedData(
701
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
701
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
702 702
                 break;
703 703
             }
704 704
 
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
             // Get info about user to delete
709 709
             $data_user = DB::queryfirstrow(
710 710
                 'SELECT admin, isAdministratedByRole, gestionnaire
711
-                FROM ' . prefixTable('users') . '
711
+                FROM ' . prefixTable('users').'
712 712
                 WHERE id = %i',
713 713
                 $post_id
714 714
             );
@@ -728,10 +728,10 @@  discard block
 block discarded – undo
728 728
                     $post_id
729 729
                 );
730 730
                 echo prepareExchangedData(
731
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
731
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
732 732
             } else {
733 733
                 echo prepareExchangedData(
734
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
734
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
735 735
             }
736 736
             break;
737 737
 
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
             // Get info about user to delete
751 751
             $data_user = DB::queryfirstrow(
752 752
                 'SELECT admin, isAdministratedByRole, gestionnaire
753
-                FROM ' . prefixTable('users') . '
753
+                FROM ' . prefixTable('users').'
754 754
                 WHERE id = %i',
755 755
                 $post_id
756 756
             );
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
             $return = array();
790 790
             // Check if folder exists
791 791
             $data = DB::query(
792
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
792
+                'SELECT * FROM '.prefixTable('nested_tree').'
793 793
                 WHERE title = %s AND parent_id = %i',
794 794
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING),
795 795
                 '0'
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
             }
803 803
             // Check if role exists
804 804
             $data = DB::query(
805
-                'SELECT * FROM ' . prefixTable('roles_title') . '
805
+                'SELECT * FROM '.prefixTable('roles_title').'
806 806
                 WHERE title = %s',
807 807
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING)
808 808
             );
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
         case 'user_log_items':
823 823
             $nb_pages = 1;
824 824
             $logs = $sql_filter = '';
825
-            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . '&nbsp;:&nbsp;</td>';
825
+            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').'&nbsp;:&nbsp;</td>';
826 826
 
827 827
             // Prepare POST variables
828 828
             $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT);
@@ -834,14 +834,14 @@  discard block
 block discarded – undo
834 834
                     && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING))
835 835
                     && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all'
836 836
                 ) {
837
-                    $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'";
837
+                    $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'";
838 838
                 }
839 839
                 // get number of pages
840 840
                 DB::query(
841 841
                     'SELECT *
842
-                    FROM ' . prefixTable('log_items') . ' as l
843
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
844
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
842
+                    FROM ' . prefixTable('log_items').' as l
843
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
844
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
845 845
                     WHERE l.id_user = %i ' . $sql_filter,
846 846
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
847 847
                 );
@@ -859,19 +859,19 @@  discard block
 block discarded – undo
859 859
                 // launch query
860 860
                 $rows = DB::query(
861 861
                     'SELECT l.date as date, u.login as login, i.label as label, l.action as action
862
-                    FROM ' . prefixTable('log_items') . ' as l
863
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
864
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
865
-                    WHERE l.id_user = %i ' . $sql_filter . '
862
+                    FROM ' . prefixTable('log_items').' as l
863
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
864
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
865
+                    WHERE l.id_user = %i ' . $sql_filter.'
866 866
                     ORDER BY date DESC
867
-                    LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page),
867
+                    LIMIT ' . intval($start).','.intval($post_nb_items_by_page),
868 868
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
869 869
                 );
870 870
             } else {
871 871
                 // get number of pages
872 872
                 DB::query(
873 873
                     'SELECT *
874
-                    FROM ' . prefixTable('log_system') . '
874
+                    FROM ' . prefixTable('log_system').'
875 875
                     WHERE type = %s AND field_1=%i',
876 876
                     'user_mngt',
877 877
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
                 // launch query
891 891
                 $rows = DB::query(
892 892
                     'SELECT *
893
-                    FROM ' . prefixTable('log_system') . '
893
+                    FROM ' . prefixTable('log_system').'
894 894
                     WHERE type = %s AND field_1 = %i
895 895
                     ORDER BY date DESC
896 896
                     LIMIT %i, %i',
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
             if (isset($counter) && $counter != 0) {
905 905
                 $nb_pages = ceil($counter / intval($post_nb_items_by_page));
906 906
                 for ($i = 1; $i <= $nb_pages; ++$i) {
907
-                    $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>';
907
+                    $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>';
908 908
                 }
909 909
             }
910 910
             $pages .= '</tr></table>';
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
                     if ($post_scope === 'user_mngt') {
914 914
                         $user = DB::queryfirstrow(
915 915
                             'SELECT login
916
-                            from ' . prefixTable('users') . '
916
+                            from ' . prefixTable('users').'
917 917
                             WHERE id=%i',
918 918
                             $record['qui']
919 919
                         );
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
                         if ($tmp[0] == 'at_user_initial_pwd_changed') {
924 924
                             $label = langHdl('log_user_initial_pwd_changed');
925 925
                         } elseif ($tmp[0] == 'at_user_email_changed') {
926
-                            $label = langHdl('log_user_email_changed') . $tmp[1];
926
+                            $label = langHdl('log_user_email_changed').$tmp[1];
927 927
                         } elseif ($tmp[0] == 'at_user_added') {
928 928
                             $label = langHdl('log_user_created');
929 929
                         } elseif ($tmp[0] == 'at_user_locked') {
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
                             $label = langHdl('log_user_pwd_changed');
935 935
                         }
936 936
                         // prepare log
937
-                        $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>';
937
+                        $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>';
938 938
                     } else {
939
-                        $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>';
939
+                        $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>';
940 940
                     }
941 941
                 }
942 942
             }
943 943
 
944
-            echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]';
944
+            echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]';
945 945
             break;
946 946
 
947 947
             /*
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
             } else {
968 968
                 // Get folder id for Admin
969 969
                 $admin_folder = DB::queryFirstRow(
970
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
970
+                    'SELECT id FROM '.prefixTable('nested_tree').'
971 971
                     WHERE title = %i AND personal_folder = %i',
972 972
                     intval($_SESSION['user_id']),
973 973
                     '1'
@@ -978,15 +978,15 @@  discard block
 block discarded – undo
978 978
                     // Get each Items in PF
979 979
                     $rows = DB::query(
980 980
                         'SELECT i.pw, i.label, l.id_user
981
-                        FROM ' . prefixTable('items') . ' as i
982
-                        LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id)
981
+                        FROM ' . prefixTable('items').' as i
982
+                        LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id)
983 983
                         WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i',
984 984
                         'at_creation',
985 985
                         '1',
986 986
                         intval($folder->id)
987 987
                     );
988 988
                     foreach ($rows as $record) {
989
-                        echo $record['label'] . ' - ';
989
+                        echo $record['label'].' - ';
990 990
                         // Change user
991 991
                         DB::update(
992 992
                             prefixTable('log_items'),
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
             // Get info about user to delete
1022 1022
             $data_user = DB::queryfirstrow(
1023 1023
                 'SELECT admin, isAdministratedByRole, gestionnaire
1024
-                FROM ' . prefixTable('users') . '
1024
+                FROM ' . prefixTable('users').'
1025 1025
                 WHERE id = %i',
1026 1026
                 $post_user_id
1027 1027
             );
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 
1059 1059
             // Do
1060 1060
             $rows = DB::query(
1061
-                'SELECT id FROM ' . prefixTable('users') . '
1061
+                'SELECT id FROM '.prefixTable('users').'
1062 1062
                 WHERE timestamp != %s AND admin != %i',
1063 1063
                 '',
1064 1064
                 '1'
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
                 // Get info about user to delete
1068 1068
                 $data_user = DB::queryfirstrow(
1069 1069
                     'SELECT admin, isAdministratedByRole, gestionnaire
1070
-                    FROM ' . prefixTable('users') . '
1070
+                    FROM ' . prefixTable('users').'
1071 1071
                     WHERE id = %i',
1072 1072
                     $record['id']
1073 1073
                 );
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
             // decrypt and retrieve data in JSON format
1122 1122
             $dataReceived = prepareExchangedData(
1123
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1123
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1124 1124
             
1125 1125
             // Prepare variables
1126 1126
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
             // Get info about user
1129 1129
             $rowUser = DB::queryfirstrow(
1130 1130
                 'SELECT *
1131
-                FROM ' . prefixTable('users') . '
1131
+                FROM ' . prefixTable('users').'
1132 1132
                 WHERE id = %i',
1133 1133
                 $post_id
1134 1134
             );
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
                 $arrFldAllowed = array();
1147 1147
 
1148 1148
                 //Build tree
1149
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1149
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1150 1150
                 $tree->register();
1151 1151
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1152 1152
 
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
                 // array of roles for actual user
1158 1158
                 $my_functions = explode(';', $_SESSION['fonction_id']);
1159 1159
 
1160
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
1160
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
1161 1161
                 foreach ($rows as $record) {
1162 1162
                     if (
1163 1163
                         (int) $_SESSION['is_admin'] === 1
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
                 $rolesList = array();
1194 1194
                 $managedBy = array();
1195 1195
                 $selected = '';
1196
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
1196
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
1197 1197
                 foreach ($rows as $reccord) {
1198 1198
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
1199 1199
                 }
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
                         array_push(
1225 1225
                             $managedBy,
1226 1226
                             array(
1227
-                                'title' => langHdl('managers_of') . ' ' . $fonction['title'],
1227
+                                'title' => langHdl('managers_of').' '.$fonction['title'],
1228 1228
                                 'id' => $fonction['id'],
1229 1229
                                 'selected' => $selected,
1230 1230
                             )
@@ -1306,9 +1306,9 @@  discard block
 block discarded – undo
1306 1306
 
1307 1307
                 // get USER STATUS
1308 1308
                 if ($rowUser['disabled'] == 1) {
1309
-                    $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>';
1309
+                    $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>';
1310 1310
                 } else {
1311
-                    $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . langHdl('user_info_lock_question');
1311
+                    $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.langHdl('user_info_lock_question');
1312 1312
                 }
1313 1313
 
1314 1314
                 $arrData['error'] = false;
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 
1381 1381
             // decrypt and retrieve data in JSON format
1382 1382
             $dataReceived = prepareExchangedData(
1383
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1383
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1384 1384
 
1385 1385
             // Prepare variables
1386 1386
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_STRING);
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
                 // count number of admins
1406 1406
                 $users = DB::query(
1407 1407
                     'SELECT id
1408
-                    FROM ' . prefixTable('users') . '
1408
+                    FROM ' . prefixTable('users').'
1409 1409
                     WHERE admin = 1 AND email != "" AND pw != ""'
1410 1410
                 );
1411 1411
                 if (DB::count() === 1) {
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
 
1495 1495
             // Get info about user to delete
1496 1496
             $data_user = DB::queryfirstrow(
1497
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1497
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1498 1498
                 WHERE id = %i',
1499 1499
                 $post_id
1500 1500
             );
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
                     );
1516 1516
                     // delete personal folder and subfolders
1517 1517
                     $data = DB::queryfirstrow(
1518
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1518
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1519 1519
                         WHERE title = %s AND personal_folder = %i',
1520 1520
                         $post_id,
1521 1521
                         '1'
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1529 1529
                             // delete items & logs
1530 1530
                             $items = DB::query(
1531
-                                'SELECT id FROM ' . prefixTable('items') . '
1531
+                                'SELECT id FROM '.prefixTable('items').'
1532 1532
                                 WHERE id_tree=%i AND perso = %i',
1533 1533
                                 $folder->id,
1534 1534
                                 '1'
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
                 } else {
1550 1550
                     // Get old data about user
1551 1551
                     $oldData = DB::queryfirstrow(
1552
-                        'SELECT * FROM ' . prefixTable('users') . '
1552
+                        'SELECT * FROM '.prefixTable('users').'
1553 1553
                         WHERE id = %i',
1554 1554
                         $post_id
1555 1555
                     );
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
 
1580 1580
                     // update LOG
1581 1581
                     if ($oldData['email'] !== $post_email) {
1582
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1582
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1583 1583
                     }
1584 1584
                 }
1585 1585
                 echo prepareExchangedData(
@@ -1632,14 +1632,14 @@  discard block
 block discarded – undo
1632 1632
 
1633 1633
             // decrypt and retrieve data in JSON format
1634 1634
             $dataReceived = prepareExchangedData(
1635
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1635
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1636 1636
 
1637 1637
             // Prepare variables
1638 1638
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
1639 1639
 
1640 1640
             // Get info about user to delete
1641 1641
             $data_user = DB::queryfirstrow(
1642
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1642
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1643 1643
                 WHERE id = %i',
1644 1644
                 $post_id
1645 1645
             );
@@ -1691,7 +1691,7 @@  discard block
 block discarded – undo
1691 1691
             }
1692 1692
 
1693 1693
             DB::queryfirstrow(
1694
-                'SELECT * FROM ' . prefixTable('users') . '
1694
+                'SELECT * FROM '.prefixTable('users').'
1695 1695
                 WHERE login = %s',
1696 1696
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING)
1697 1697
             );
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 
1737 1737
             // decrypt and retrieve data in JSON format
1738 1738
             $dataReceived = prepareExchangedData(
1739
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1739
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1740 1740
 
1741 1741
             // Prepare variables
1742 1742
             $post_id = filter_input(INPUT_POST, 'user_id', FILTER_SANITIZE_NUMBER_INT);
@@ -1744,14 +1744,14 @@  discard block
 block discarded – undo
1744 1744
             $arrData = array();
1745 1745
 
1746 1746
             //Build tree
1747
-            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1747
+            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1748 1748
             $tree->register();
1749 1749
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1750 1750
 
1751 1751
             // get User info
1752 1752
             $rowUser = DB::queryFirstRow(
1753 1753
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb
1754
-                FROM ' . prefixTable('users') . '
1754
+                FROM ' . prefixTable('users').'
1755 1755
                 WHERE id = %i',
1756 1756
                 $post_id
1757 1757
             );
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
                 // refine folders based upon roles
1770 1770
                 $rows = DB::query(
1771 1771
                     'SELECT folder_id, type
1772
-                    FROM ' . prefixTable('roles_values') . '
1772
+                    FROM ' . prefixTable('roles_values').'
1773 1773
                     WHERE role_id IN %ls
1774 1774
                     ORDER BY folder_id ASC',
1775 1775
                     $arrData['functions']
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
                 }
1793 1793
 
1794 1794
                 // add allowed folders
1795
-                foreach($arrData['allowed_folders'] as $Fld) {
1795
+                foreach ($arrData['allowed_folders'] as $Fld) {
1796 1796
                     array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true));
1797 1797
                 }
1798 1798
 
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
                             // get folder name
1804 1804
                             $row = DB::queryFirstRow(
1805 1805
                                 'SELECT title, nlevel, id
1806
-                                FROM ' . prefixTable('nested_tree') . '
1806
+                                FROM ' . prefixTable('nested_tree').'
1807 1807
                                 WHERE id = %i',
1808 1808
                                 $fld['id']
1809 1809
                             );
@@ -1816,36 +1816,36 @@  discard block
 block discarded – undo
1816 1816
 
1817 1817
                             // manage right icon
1818 1818
                             if ($fld['type'] == 'W') {
1819
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' .
1820
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1821
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1819
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'.
1820
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1821
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1822 1822
                             } elseif ($fld['type'] == 'ND') {
1823
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1824
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1825
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1823
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1824
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1825
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1826 1826
                             } elseif ($fld['type'] == 'NE') {
1827
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1828
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1829
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1827
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1828
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1829
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1830 1830
                             } elseif ($fld['type'] == 'NDNE') {
1831
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1832
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1833
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1831
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1832
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1833
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1834 1834
                             } else {
1835
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>';
1835
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>';
1836 1836
                             }
1837 1837
 
1838
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1839
-                                ' <small class="text-info">[' . $row['id'] . ']</small>'.
1840
-                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . langHdl('user_specific_right') . '"></i>' : '').
1841
-                                '</td><td>' . $label . '</td></tr>';
1838
+                            $html .= '<tr><td>'.$ident.$row['title'].
1839
+                                ' <small class="text-info">['.$row['id'].']</small>'.
1840
+                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.langHdl('user_specific_right').'"></i>' : '').
1841
+                                '</td><td>'.$label.'</td></tr>';
1842 1842
                             break;
1843 1843
                         }
1844 1844
                     }
1845 1845
                 }
1846 1846
 
1847
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1848
-                    $html . '</tbody></table>';
1847
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1848
+                    $html.'</tbody></table>';
1849 1849
             } else {
1850 1850
                 $html_full = '';
1851 1851
             }
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
             if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) {
1895 1895
                 $rows = DB::query(
1896 1896
                     'SELECT *
1897
-                    FROM ' . prefixTable('users') . '
1897
+                    FROM ' . prefixTable('users').'
1898 1898
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1899 1899
                     '0',
1900 1900
                     array_filter($_SESSION['user_roles'])
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
             } else {
1903 1903
                 $rows = DB::query(
1904 1904
                     'SELECT *
1905
-                    FROM ' . prefixTable('users') . '
1905
+                    FROM ' . prefixTable('users').'
1906 1906
                     WHERE admin = %i',
1907 1907
                     '0'
1908 1908
                 );
@@ -1914,7 +1914,7 @@  discard block
 block discarded – undo
1914 1914
                 $groupIds = [];
1915 1915
                 foreach (explode(';', $record['fonction_id']) as $group) {
1916 1916
                     $tmp = DB::queryfirstrow(
1917
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1917
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1918 1918
                         WHERE id = %i',
1919 1919
                         $group
1920 1920
                     );
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 
1927 1927
                 // Get managed_by
1928 1928
                 $managedBy = DB::queryfirstrow(
1929
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1929
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1930 1930
                     WHERE id = %i',
1931 1931
                     $record['isAdministratedByRole']
1932 1932
                 );
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
                 $foldersAllowedIds = [];
1937 1937
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1938 1938
                     $tmp = DB::queryfirstrow(
1939
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1939
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1940 1940
                         WHERE id = %i',
1941 1941
                         $role
1942 1942
                     );
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
                 $foldersForbiddenIds = [];
1950 1950
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1951 1951
                     $tmp = DB::queryfirstrow(
1952
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1952
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1953 1953
                         WHERE id = %i',
1954 1954
                         $role
1955 1955
                     );
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
                         'login' => $record['login'],
1968 1968
                         'groups' => implode(', ', $groups),
1969 1969
                         'groupIds' => $groupIds,
1970
-                        'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'],
1970
+                        'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'],
1971 1971
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1972 1972
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1973 1973
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
 
2024 2024
             // decrypt and retreive data in JSON format
2025 2025
             $dataReceived = prepareExchangedData(
2026
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2026
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2027 2027
 
2028 2028
             $post_source_id = filter_var(htmlspecialchars_decode($dataReceived['source_id']), FILTER_SANITIZE_NUMBER_INT);
2029 2029
             $post_destination_ids = filter_var_array($dataReceived['destination_ids'], FILTER_SANITIZE_NUMBER_INT);
@@ -2049,7 +2049,7 @@  discard block
 block discarded – undo
2049 2049
 
2050 2050
             // Get info about user
2051 2051
             $data_user = DB::queryfirstrow(
2052
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2052
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2053 2053
                 WHERE id = %i',
2054 2054
                 $post_source_id
2055 2055
             );
@@ -2205,7 +2205,7 @@  discard block
 block discarded – undo
2205 2205
 
2206 2206
             // decrypt and retrieve data in JSON format
2207 2207
             $dataReceived = prepareExchangedData(
2208
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2208
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2209 2209
 
2210 2210
             // prepare variables
2211 2211
             $post_user_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -2217,14 +2217,14 @@  discard block
 block discarded – undo
2217 2217
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
2218 2218
                 $data_user = DB::queryfirstrow(
2219 2219
                     'SELECT fonction_id
2220
-                    FROM ' . prefixTable('users') . '
2220
+                    FROM ' . prefixTable('users').'
2221 2221
                     WHERE id = %i',
2222 2222
                     $post_user_id
2223 2223
                 );
2224 2224
 
2225 2225
                 if ($data_user) {
2226 2226
                     // Ensure array is unique
2227
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
2227
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
2228 2228
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
2229 2229
                 } else {
2230 2230
                     // User not found
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
             if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') {
2283 2283
                 $record = DB::queryFirstRow(
2284 2284
                     'SELECT user_ip_lastdate
2285
-                    FROM ' . prefixTable('users') . '
2285
+                    FROM ' . prefixTable('users').'
2286 2286
                     WHERE id = %i',
2287 2287
                     $_SESSION['user_id']
2288 2288
                 );
@@ -2378,38 +2378,38 @@  discard block
 block discarded – undo
2378 2378
             ];
2379 2379
 
2380 2380
             // Load expected libraries
2381
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2382
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2383
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2384
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
2385
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
2386
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
2387
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
2388
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
2389
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2390
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
2391
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
2392
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
2393
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
2394
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
2395
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
2396
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
2397
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
2398
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
2399
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
2400
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
2401
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
2402
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
2403
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
2404
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
2405
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
2406
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
2407
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
2408
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2409
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2410
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2411
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php';
2412
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2381
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2382
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2383
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2384
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
2385
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
2386
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
2387
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
2388
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
2389
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2390
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
2391
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
2392
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
2393
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
2394
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
2395
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
2396
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
2397
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
2398
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
2399
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
2400
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
2401
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
2402
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
2403
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
2404
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
2405
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
2406
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
2407
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
2408
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2409
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2410
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2411
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php';
2412
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2413 2413
 
2414 2414
             $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2415 2415
             $ad->register();
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
                     $SETTINGS['cpassman_dir'],
2427 2427
                     array(
2428 2428
                         'error' => true,
2429
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
2429
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
2430 2430
                     ),
2431 2431
                     'encode'
2432 2432
                 );
@@ -2457,12 +2457,12 @@  discard block
 block discarded – undo
2457 2457
                 ['objectclass', '=', 'posixaccount'],
2458 2458
             ], null, null, 'or')->get();
2459 2459
             
2460
-            foreach($users as $i => $adUser) {
2460
+            foreach ($users as $i => $adUser) {
2461 2461
                 if (isset($adUser[$SETTINGS['ldap_user_attribute']]) === false) continue;
2462 2462
                 
2463 2463
                 // Build the list of all groups in AD
2464 2464
                 if (isset($adUser['memberof']) === true) {
2465
-                    foreach($adUser['memberof'] as $j => $adUserGroup) {
2465
+                    foreach ($adUser['memberof'] as $j => $adUserGroup) {
2466 2466
                         if (empty($adUserGroup) === false && $j !== "count") {
2467 2467
                             $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2468 2468
                             if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2478,7 +2478,7 @@  discard block
 block discarded – undo
2478 2478
                     // Get his ID
2479 2479
                     DB::queryfirstrow(
2480 2480
                         'SELECT id, fonction_id, auth_type
2481
-                        FROM ' . prefixTable('users') . '
2481
+                        FROM ' . prefixTable('users').'
2482 2482
                         WHERE login = %s',
2483 2483
                         $userLogin
2484 2484
                     );
@@ -2513,7 +2513,7 @@  discard block
 block discarded – undo
2513 2513
             }
2514 2514
 
2515 2515
             // Get all groups in Teampass
2516
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2516
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2517 2517
             foreach ($rows as $record) {
2518 2518
                 array_push(
2519 2519
                     $teampassRoles,
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
 
2557 2557
             // decrypt and retrieve data in JSON format
2558 2558
             $dataReceived = prepareExchangedData(
2559
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2559
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2560 2560
 
2561 2561
             // Prepare variables
2562 2562
             $post_login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
             // Check if user already exists
2584 2584
             $data = DB::query(
2585 2585
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2586
-                FROM ' . prefixTable('users') . '
2586
+                FROM ' . prefixTable('users').'
2587 2587
                 WHERE login = %s',
2588 2588
                 $post_login
2589 2589
             );
@@ -2690,7 +2690,7 @@  discard block
 block discarded – undo
2690 2690
                 );
2691 2691
 
2692 2692
                 // Rebuild tree
2693
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
2693
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
2694 2694
                 $tree->register();
2695 2695
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
2696 2696
                 $tree->rebuild();
@@ -2767,7 +2767,7 @@  discard block
 block discarded – undo
2767 2767
             // Check if user already exists
2768 2768
             DB::query(
2769 2769
                 'SELECT id
2770
-                FROM ' . prefixTable('users') . '
2770
+                FROM ' . prefixTable('users').'
2771 2771
                 WHERE id = %i',
2772 2772
                 $post_id
2773 2773
             );
@@ -2824,7 +2824,7 @@  discard block
 block discarded – undo
2824 2824
 
2825 2825
             // decrypt and retrieve data in JSON format
2826 2826
             $dataReceived = prepareExchangedData(
2827
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2827
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2828 2828
 
2829 2829
             // Prepare variables
2830 2830
             $post_userid = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
             // Check if user already exists
2849 2849
             $userInfo = DB::queryfirstrow(
2850 2850
                 'SELECT id, private_key, public_key
2851
-                FROM ' . prefixTable('users') . '
2851
+                FROM ' . prefixTable('users').'
2852 2852
                 WHERE id = %i',
2853 2853
                 $post_userid
2854 2854
             );
@@ -2897,7 +2897,7 @@  discard block
 block discarded – undo
2897 2897
             if (count($_SESSION['personal_folders']) > 0) {
2898 2898
                 DB::query(
2899 2899
                     'SELECT id
2900
-                    FROM ' . prefixTable('items') . '
2900
+                    FROM ' . prefixTable('items').'
2901 2901
                     WHERE id_tree IN %ls',
2902 2902
                     $_SESSION['personal_folders']
2903 2903
                 );
@@ -2957,7 +2957,7 @@  discard block
 block discarded – undo
2957 2957
 
2958 2958
             // decrypt and retrieve data in JSON format
2959 2959
             $dataReceived = prepareExchangedData(
2960
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2960
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2961 2961
 
2962 2962
             // Prepare variables
2963 2963
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -2979,7 +2979,7 @@  discard block
 block discarded – undo
2979 2979
             // Check if user already exists
2980 2980
             DB::query(
2981 2981
                 'SELECT id
2982
-                FROM ' . prefixTable('users') . '
2982
+                FROM ' . prefixTable('users').'
2983 2983
                 WHERE id = %i',
2984 2984
                 $post_id
2985 2985
             );
@@ -3046,7 +3046,7 @@  discard block
 block discarded – undo
3046 3046
 
3047 3047
             // decrypt and retrieve data in JSON format
3048 3048
             $dataReceived = prepareExchangedData(
3049
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
3049
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
3050 3050
 
3051 3051
             // Prepare variables
3052 3052
             $post_user_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -3077,7 +3077,7 @@  discard block
 block discarded – undo
3077 3077
 
3078 3078
     // Get info about user
3079 3079
     $data_user = DB::queryfirstrow(
3080
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3080
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3081 3081
         WHERE id = %i',
3082 3082
         $value[1]
3083 3083
     );
@@ -3110,7 +3110,7 @@  discard block
 block discarded – undo
3110 3110
             logEvents(
3111 3111
                 $SETTINGS,
3112 3112
                 'user_mngt',
3113
-                'at_user_new_' . $value[0] . ':' . $value[1],
3113
+                'at_user_new_'.$value[0].':'.$value[1],
3114 3114
                 (string) $_SESSION['user_id'],
3115 3115
                 $_SESSION['login'],
3116 3116
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING)
@@ -3142,7 +3142,7 @@  discard block
 block discarded – undo
3142 3142
 
3143 3143
     // Get info about user
3144 3144
     $data_user = DB::queryfirstrow(
3145
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3145
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3146 3146
         WHERE id = %i',
3147 3147
         $value[1]
3148 3148
     );
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -122,29 +122,29 @@  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/';
132
-    }
133
-
134
-    include_once $path . 'Exception/CryptoException.php';
135
-    include_once $path . 'Exception/BadFormatException.php';
136
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
137
-    include_once $path . 'Exception/IOException.php';
138
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
139
-    include_once $path . 'Crypto.php';
140
-    include_once $path . 'Encoding.php';
141
-    include_once $path . 'DerivedKeys.php';
142
-    include_once $path . 'Key.php';
143
-    include_once $path . 'KeyOrPassword.php';
144
-    include_once $path . 'File.php';
145
-    include_once $path . 'RuntimeTests.php';
146
-    include_once $path . 'KeyProtectedByPassword.php';
147
-    include_once $path . 'Core.php';
131
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
132
+    }
133
+
134
+    include_once $path.'Exception/CryptoException.php';
135
+    include_once $path.'Exception/BadFormatException.php';
136
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
137
+    include_once $path.'Exception/IOException.php';
138
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
139
+    include_once $path.'Crypto.php';
140
+    include_once $path.'Encoding.php';
141
+    include_once $path.'DerivedKeys.php';
142
+    include_once $path.'Key.php';
143
+    include_once $path.'KeyOrPassword.php';
144
+    include_once $path.'File.php';
145
+    include_once $path.'RuntimeTests.php';
146
+    include_once $path.'KeyProtectedByPassword.php';
147
+    include_once $path.'Core.php';
148 148
     
149 149
     // convert KEY
150 150
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
         $path = '../includes/libraries/Encryption/Encryption/';
190 190
     }
191 191
 
192
-    include_once $path . 'Exception/CryptoException.php';
193
-    include_once $path . 'Exception/BadFormatException.php';
194
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
195
-    include_once $path . 'Exception/IOException.php';
196
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
197
-    include_once $path . 'Crypto.php';
198
-    include_once $path . 'Encoding.php';
199
-    include_once $path . 'DerivedKeys.php';
200
-    include_once $path . 'Key.php';
201
-    include_once $path . 'KeyOrPassword.php';
202
-    include_once $path . 'File.php';
203
-    include_once $path . 'RuntimeTests.php';
204
-    include_once $path . 'KeyProtectedByPassword.php';
205
-    include_once $path . 'Core.php';
192
+    include_once $path.'Exception/CryptoException.php';
193
+    include_once $path.'Exception/BadFormatException.php';
194
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
195
+    include_once $path.'Exception/IOException.php';
196
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
197
+    include_once $path.'Crypto.php';
198
+    include_once $path.'Encoding.php';
199
+    include_once $path.'DerivedKeys.php';
200
+    include_once $path.'Key.php';
201
+    include_once $path.'KeyOrPassword.php';
202
+    include_once $path.'File.php';
203
+    include_once $path.'RuntimeTests.php';
204
+    include_once $path.'KeyProtectedByPassword.php';
205
+    include_once $path.'Core.php';
206 206
 
207 207
     $key = \Defuse\Crypto\Key::createNewRandomKey();
208 208
     $key = $key->saveToAsciiSafeString();
@@ -227,20 +227,20 @@  discard block
 block discarded – undo
227 227
         $path = '../includes/libraries/Encryption/Encryption/';
228 228
     }
229 229
 
230
-    include_once $path . 'Exception/CryptoException.php';
231
-    include_once $path . 'Exception/BadFormatException.php';
232
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
233
-    include_once $path . 'Exception/IOException.php';
234
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
235
-    include_once $path . 'Crypto.php';
236
-    include_once $path . 'Encoding.php';
237
-    include_once $path . 'DerivedKeys.php';
238
-    include_once $path . 'Key.php';
239
-    include_once $path . 'KeyOrPassword.php';
240
-    include_once $path . 'File.php';
241
-    include_once $path . 'RuntimeTests.php';
242
-    include_once $path . 'KeyProtectedByPassword.php';
243
-    include_once $path . 'Core.php';
230
+    include_once $path.'Exception/CryptoException.php';
231
+    include_once $path.'Exception/BadFormatException.php';
232
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
233
+    include_once $path.'Exception/IOException.php';
234
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
235
+    include_once $path.'Crypto.php';
236
+    include_once $path.'Encoding.php';
237
+    include_once $path.'DerivedKeys.php';
238
+    include_once $path.'Key.php';
239
+    include_once $path.'KeyOrPassword.php';
240
+    include_once $path.'File.php';
241
+    include_once $path.'RuntimeTests.php';
242
+    include_once $path.'KeyProtectedByPassword.php';
243
+    include_once $path.'Core.php';
244 244
     
245 245
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
246 246
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -265,20 +265,20 @@  discard block
 block discarded – undo
265 265
         $path = '../includes/libraries/Encryption/Encryption/';
266 266
     }
267 267
 
268
-    include_once $path . 'Exception/CryptoException.php';
269
-    include_once $path . 'Exception/BadFormatException.php';
270
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
271
-    include_once $path . 'Exception/IOException.php';
272
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
273
-    include_once $path . 'Crypto.php';
274
-    include_once $path . 'Encoding.php';
275
-    include_once $path . 'DerivedKeys.php';
276
-    include_once $path . 'Key.php';
277
-    include_once $path . 'KeyOrPassword.php';
278
-    include_once $path . 'File.php';
279
-    include_once $path . 'RuntimeTests.php';
280
-    include_once $path . 'KeyProtectedByPassword.php';
281
-    include_once $path . 'Core.php';
268
+    include_once $path.'Exception/CryptoException.php';
269
+    include_once $path.'Exception/BadFormatException.php';
270
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
271
+    include_once $path.'Exception/IOException.php';
272
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
273
+    include_once $path.'Crypto.php';
274
+    include_once $path.'Encoding.php';
275
+    include_once $path.'DerivedKeys.php';
276
+    include_once $path.'Key.php';
277
+    include_once $path.'KeyOrPassword.php';
278
+    include_once $path.'File.php';
279
+    include_once $path.'RuntimeTests.php';
280
+    include_once $path.'KeyProtectedByPassword.php';
281
+    include_once $path.'Core.php';
282 282
 
283 283
     try {
284 284
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
  */
321 321
 function trimElement($chaine, string $element): string
322 322
 {
323
-    if (! empty($chaine)) {
323
+    if (!empty($chaine)) {
324 324
         if (is_array($chaine) === true) {
325 325
             $chaine = implode(';', $chaine);
326 326
         }
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function db_error_handler(array $params): void
370 370
 {
371
-    echo 'Error: ' . $params['error'] . "<br>\n";
372
-    echo 'Query: ' . $params['query'] . "<br>\n";
371
+    echo 'Error: '.$params['error']."<br>\n";
372
+    echo 'Query: '.$params['query']."<br>\n";
373 373
     throw new Exception('Error - Query', 1);
374 374
 }
375 375
 
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
     $SETTINGS
392 392
 ) {
393 393
     //load ClassLoader
394
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
394
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
395 395
     // Load superglobal
396
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
396
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
397 397
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
398 398
     //Connect to DB
399
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
399
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
400 400
     if (defined('DB_PASSWD_CLEAR') === false) {
401 401
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
402 402
     }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     DB::$port = DB_PORT;
408 408
     DB::$encoding = DB_ENCODING;
409 409
     //Build tree
410
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
410
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
411 411
     $tree->register();
412 412
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
413 413
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 function identAdmin($idFonctions, $SETTINGS, $tree)
453 453
 {
454 454
     // Load superglobal
455
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
455
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
456 456
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
457 457
     // Init
458 458
     $groupesVisibles = [];
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
472 472
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
473 473
     // Get list of Folders
474
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
474
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
475 475
     foreach ($rows as $record) {
476 476
         array_push($groupesVisibles, $record['id']);
477 477
     }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     }
491 491
     // Get ID of personal folder
492 492
     $persfld = DB::queryfirstrow(
493
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
493
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
494 494
         $globalsUserId
495 495
     );
496 496
     if (empty($persfld['id']) === false) {
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
     // get complete list of ROLES
512 512
     $tmp = explode(';', $idFonctions);
513 513
     $rows = DB::query(
514
-        'SELECT * FROM ' . prefixTable('roles_title') . '
514
+        'SELECT * FROM '.prefixTable('roles_title').'
515 515
         ORDER BY title ASC'
516 516
     );
517 517
     foreach ($rows as $record) {
518
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
518
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
519 519
             array_push($tmp, $record['id']);
520 520
         }
521 521
     }
522 522
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
523 523
     $superGlobal->put('is_admin', 1, 'SESSION');
524 524
     // Check if admin has created Folders and Roles
525
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
525
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
526 526
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
527
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
527
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
528 528
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
529 529
 
530 530
     return true;
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
     object $tree
571 571
 ) {
572 572
     // Load superglobal
573
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
573
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
574 574
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
575 575
     // Init
576 576
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
     // Does this user is allowed to see other items
610 610
     $inc = 0;
611 611
     $rows = DB::query(
612
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
612
+        'SELECT id, id_tree FROM '.prefixTable('items').'
613 613
             WHERE restricted_to LIKE %ss AND inactif = %s'.
614 614
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
615
-        $globalsUserId . ';',
615
+        $globalsUserId.';',
616 616
         '0'
617 617
     );
618 618
     foreach ($rows as $record) {
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
     // Check for the users roles if some specific rights exist on items
627 627
     $rows = DB::query(
628 628
         'SELECT i.id_tree, r.item_id
629
-        FROM ' . prefixTable('items') . ' as i
630
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
629
+        FROM ' . prefixTable('items').' as i
630
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
631 631
         WHERE r.role_id IN %li AND i.id_tree <> ""
632 632
         ORDER BY i.id_tree ASC',
633 633
         $userRoles
@@ -681,16 +681,16 @@  discard block
 block discarded – undo
681 681
         'SESSION'
682 682
     );
683 683
     // Folders and Roles numbers
684
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
684
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
685 685
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
686
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
686
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
687 687
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
688 688
     // check if change proposals on User's items
689 689
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
690 690
         $countNewItems = DB::query(
691 691
             'SELECT COUNT(*)
692
-            FROM ' . prefixTable('items_change') . ' AS c
693
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
692
+            FROM ' . prefixTable('items_change').' AS c
693
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
694 694
             WHERE i.action = %s AND i.id_user = %i',
695 695
             'at_creation',
696 696
             $globalsUserId
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
     
719 719
     $rows = DB::query(
720 720
         'SELECT *
721
-        FROM ' . prefixTable('roles_values') . '
721
+        FROM ' . prefixTable('roles_values').'
722 722
         WHERE role_id IN %li AND type IN %ls',
723 723
         $userRoles,
724 724
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
     ) {
786 786
         $persoFld = DB::queryfirstrow(
787 787
             'SELECT id
788
-            FROM ' . prefixTable('nested_tree') . '
788
+            FROM ' . prefixTable('nested_tree').'
789 789
             WHERE title = %s AND personal_folder = %i'.
790 790
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
791 791
             $globalsUserId,
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     }
820 820
     $persoFlds = DB::query(
821 821
         'SELECT id
822
-        FROM ' . prefixTable('nested_tree') . '
822
+        FROM ' . prefixTable('nested_tree').'
823 823
         WHERE %l',
824 824
         $where
825 825
     );
@@ -883,9 +883,9 @@  discard block
 block discarded – undo
883 883
  */
884 884
 function cacheTableRefresh(array $SETTINGS): void
885 885
 {
886
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
886
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
887 887
     //Connect to DB
888
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
888
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
889 889
     if (defined('DB_PASSWD_CLEAR') === false) {
890 890
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
891 891
     }
@@ -900,12 +900,12 @@  discard block
 block discarded – undo
900 900
     $tree->register();
901 901
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
902 902
     // truncate table
903
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
903
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
904 904
     // reload date
905 905
     $rows = DB::query(
906 906
         'SELECT *
907
-        FROM ' . prefixTable('items') . ' as i
908
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
907
+        FROM ' . prefixTable('items').' as i
908
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
909 909
         AND l.action = %s
910 910
         AND i.inactif = %i',
911 911
         'at_creation',
@@ -917,18 +917,18 @@  discard block
 block discarded – undo
917 917
             $tags = '';
918 918
             $itemTags = DB::query(
919 919
                 'SELECT tag
920
-                            FROM ' . prefixTable('tags') . '
920
+                            FROM ' . prefixTable('tags').'
921 921
                             WHERE item_id = %i AND tag != ""',
922 922
                 $record['id']
923 923
             );
924 924
             foreach ($itemTags as $itemTag) {
925
-                $tags .= $itemTag['tag'] . ' ';
925
+                $tags .= $itemTag['tag'].' ';
926 926
             }
927 927
 
928 928
             // Get renewal period
929 929
             $resNT = DB::queryfirstrow(
930 930
                 'SELECT renewal_period
931
-                FROM ' . prefixTable('nested_tree') . '
931
+                FROM ' . prefixTable('nested_tree').'
932 932
                 WHERE id = %i',
933 933
                 $record['id_tree']
934 934
             );
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
                     // Is this a User id?
942 942
                     $user = DB::queryfirstrow(
943 943
                         'SELECT id, login
944
-                        FROM ' . prefixTable('users') . '
944
+                        FROM ' . prefixTable('users').'
945 945
                         WHERE id = %i',
946 946
                         $elem->title
947 947
                     );
@@ -959,11 +959,11 @@  discard block
 block discarded – undo
959 959
                     'id' => $record['id'],
960 960
                     'label' => $record['label'],
961 961
                     'description' => $record['description'] ?? '',
962
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
962
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
963 963
                     'tags' => $tags,
964 964
                     'id_tree' => $record['id_tree'],
965 965
                     'perso' => $record['perso'],
966
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
966
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
967 967
                     'login' => $record['login'] ?? '',
968 968
                     'folder' => implode(' > ', $folder),
969 969
                     'author' => $record['id_user'],
@@ -985,12 +985,12 @@  discard block
 block discarded – undo
985 985
  */
986 986
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
987 987
 {
988
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
988
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
989 989
     // Load superglobal
990
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
990
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
991 991
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
992 992
     //Connect to DB
993
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
993
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
994 994
     if (defined('DB_PASSWD_CLEAR') === false) {
995 995
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
996 996
     }
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
     // get new value from db
1008 1008
     $data = DB::queryfirstrow(
1009 1009
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1010
-        FROM ' . prefixTable('items') . '
1010
+        FROM ' . prefixTable('items').'
1011 1011
         WHERE id=%i',
1012 1012
         $ident
1013 1013
     );
@@ -1015,12 +1015,12 @@  discard block
 block discarded – undo
1015 1015
     $tags = '';
1016 1016
     $itemTags = DB::query(
1017 1017
         'SELECT tag
1018
-            FROM ' . prefixTable('tags') . '
1018
+            FROM ' . prefixTable('tags').'
1019 1019
             WHERE item_id = %i AND tag != ""',
1020 1020
         $ident
1021 1021
     );
1022 1022
     foreach ($itemTags as $itemTag) {
1023
-        $tags .= $itemTag['tag'] . ' ';
1023
+        $tags .= $itemTag['tag'].' ';
1024 1024
     }
1025 1025
     // form id_tree to full foldername
1026 1026
     $folder = [];
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
             // Is this a User id?
1032 1032
             $user = DB::queryfirstrow(
1033 1033
                 'SELECT id, login
1034
-                FROM ' . prefixTable('users') . '
1034
+                FROM ' . prefixTable('users').'
1035 1035
                 WHERE id = %i',
1036 1036
                 $elem->title
1037 1037
             );
@@ -1049,10 +1049,10 @@  discard block
 block discarded – undo
1049 1049
             'label' => $data['label'],
1050 1050
             'description' => $data['description'],
1051 1051
             'tags' => $tags,
1052
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1052
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1053 1053
             'id_tree' => $data['id_tree'],
1054 1054
             'perso' => $data['perso'],
1055
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1055
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1056 1056
             'login' => $data['login'] ?? '',
1057 1057
             'folder' => implode(' » ', $folder),
1058 1058
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1072,14 +1072,14 @@  discard block
 block discarded – undo
1072 1072
  */
1073 1073
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1074 1074
 {
1075
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1075
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1076 1076
     // Load superglobal
1077
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1077
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1078 1078
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1079 1079
     // Get superglobals
1080 1080
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1081 1081
     //Connect to DB
1082
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1082
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1083 1083
     if (defined('DB_PASSWD_CLEAR') === false) {
1084 1084
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1085 1085
     }
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
     // get new value from db
1097 1097
     $data = DB::queryFirstRow(
1098 1098
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1099
-        FROM ' . prefixTable('items') . ' as i
1100
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1099
+        FROM ' . prefixTable('items').' as i
1100
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1101 1101
         WHERE i.id = %i
1102 1102
         AND l.action = %s',
1103 1103
         $ident,
@@ -1107,12 +1107,12 @@  discard block
 block discarded – undo
1107 1107
     $tags = '';
1108 1108
     $itemTags = DB::query(
1109 1109
         'SELECT tag
1110
-            FROM ' . prefixTable('tags') . '
1110
+            FROM ' . prefixTable('tags').'
1111 1111
             WHERE item_id = %i AND tag != ""',
1112 1112
         $ident
1113 1113
     );
1114 1114
     foreach ($itemTags as $itemTag) {
1115
-        $tags .= $itemTag['tag'] . ' ';
1115
+        $tags .= $itemTag['tag'].' ';
1116 1116
     }
1117 1117
     // form id_tree to full foldername
1118 1118
     $folder = [];
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
             // Is this a User id?
1124 1124
             $user = DB::queryfirstrow(
1125 1125
                 'SELECT id, login
1126
-                FROM ' . prefixTable('users') . '
1126
+                FROM ' . prefixTable('users').'
1127 1127
                 WHERE id = %i',
1128 1128
                 $elem->title
1129 1129
             );
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
             'label' => $data['label'],
1143 1143
             'description' => $data['description'],
1144 1144
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1145
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1145
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1146 1146
             'id_tree' => $data['id_tree'],
1147 1147
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1148 1148
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1164,52 +1164,52 @@  discard block
 block discarded – undo
1164 1164
 function getStatisticsData(array $SETTINGS): array
1165 1165
 {
1166 1166
     DB::query(
1167
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1167
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1168 1168
         0
1169 1169
     );
1170 1170
     $counter_folders = DB::count();
1171 1171
     DB::query(
1172
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1172
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1173 1173
         1
1174 1174
     );
1175 1175
     $counter_folders_perso = DB::count();
1176 1176
     DB::query(
1177
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1177
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1178 1178
         0
1179 1179
     );
1180 1180
     $counter_items = DB::count();
1181 1181
         DB::query(
1182
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1182
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1183 1183
         1
1184 1184
     );
1185 1185
     $counter_items_perso = DB::count();
1186 1186
         DB::query(
1187
-        'SELECT id FROM ' . prefixTable('users') . ''
1187
+        'SELECT id FROM '.prefixTable('users').''
1188 1188
     );
1189 1189
     $counter_users = DB::count();
1190 1190
         DB::query(
1191
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1191
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1192 1192
         1
1193 1193
     );
1194 1194
     $admins = DB::count();
1195 1195
     DB::query(
1196
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1196
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1197 1197
         1
1198 1198
     );
1199 1199
     $managers = DB::count();
1200 1200
     DB::query(
1201
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1201
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1202 1202
         1
1203 1203
     );
1204 1204
     $readOnly = DB::count();
1205 1205
     // list the languages
1206 1206
     $usedLang = [];
1207 1207
     $tp_languages = DB::query(
1208
-        'SELECT name FROM ' . prefixTable('languages')
1208
+        'SELECT name FROM '.prefixTable('languages')
1209 1209
     );
1210 1210
     foreach ($tp_languages as $tp_language) {
1211 1211
         DB::query(
1212
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1212
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1213 1213
             $tp_language['name']
1214 1214
         );
1215 1215
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1218,12 +1218,12 @@  discard block
 block discarded – undo
1218 1218
     // get list of ips
1219 1219
     $usedIp = [];
1220 1220
     $tp_ips = DB::query(
1221
-        'SELECT user_ip FROM ' . prefixTable('users')
1221
+        'SELECT user_ip FROM '.prefixTable('users')
1222 1222
     );
1223 1223
     foreach ($tp_ips as $ip) {
1224 1224
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1225 1225
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1226
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1226
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1227 1227
             $usedIp[$ip['user_ip']] = 1;
1228 1228
         }
1229 1229
     }
@@ -1289,14 +1289,14 @@  discard block
 block discarded – undo
1289 1289
     }
1290 1290
 
1291 1291
     // Load settings
1292
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1292
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1293 1293
     // Load superglobal
1294
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1294
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1295 1295
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1296 1296
     // Get user language
1297
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1297
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1298 1298
     // Load library
1299
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1299
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1300 1300
     // load PHPMailer
1301 1301
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1302 1302
     $mail->register();
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
     
1305 1305
     try {
1306 1306
         // send to user
1307
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1307
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1308 1308
         $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1309 1309
         $mail->Port = $SETTINGS['email_port'];
1310 1310
         //COULD BE USED
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
         <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;">
1405 1405
         <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;">
1406 1406
         <br><div style="float:right;">' .
1407
-        $textMail .
1407
+        $textMail.
1408 1408
         '<br><br></td></tr></table>
1409 1409
     </td></tr></table>
1410 1410
     <br></body></html>';
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
  */
1418 1418
 function generateKey(): string
1419 1419
 {
1420
-    return substr(md5(rand() . rand()), 0, 15);
1420
+    return substr(md5(rand().rand()), 0, 15);
1421 1421
 }
1422 1422
 
1423 1423
 /**
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 {
1489 1489
     array_walk_recursive(
1490 1490
         $array,
1491
-        static function (&$item): void {
1491
+        static function(&$item): void {
1492 1492
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1493 1493
                 $item = utf8_encode($item);
1494 1494
             }
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1511 1511
 {
1512 1512
     // Load superglobal
1513
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1513
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1514 1514
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1515 1515
     // Get superglobals
1516 1516
     if ($key !== null) {
@@ -1521,9 +1521,9 @@  discard block
 block discarded – undo
1521 1521
     }
1522 1522
 
1523 1523
     //load ClassLoader
1524
-    include_once $teampassDir . '/sources/SplClassLoader.php';
1524
+    include_once $teampassDir.'/sources/SplClassLoader.php';
1525 1525
     //Load AES
1526
-    $aes = new SplClassLoader('Encryption\Crypt', $teampassDir . '/includes/libraries');
1526
+    $aes = new SplClassLoader('Encryption\Crypt', $teampassDir.'/includes/libraries');
1527 1527
     $aes->register();
1528 1528
     if ($type === 'encode' && is_array($data) === true) {
1529 1529
         // Ensure UTF8 format
@@ -1597,8 +1597,8 @@  discard block
 block discarded – undo
1597 1597
  */
1598 1598
 function prefixTable(string $table): string
1599 1599
 {
1600
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1601
-    if (! empty($safeTable)) {
1600
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1601
+    if (!empty($safeTable)) {
1602 1602
         // sanitize string
1603 1603
         return $safeTable;
1604 1604
     }
@@ -1628,13 +1628,13 @@  discard block
 block discarded – undo
1628 1628
     bool $lowercase = false,
1629 1629
     array $SETTINGS = []
1630 1630
 ): string {
1631
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1632
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1631
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1632
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1633 1633
     $generator->register();
1634 1634
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1635 1635
     // Is PHP7 being used?
1636 1636
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1637
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1637
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1638 1638
         $php7generator->register();
1639 1639
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1640 1640
     }
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1670 1670
 {
1671 1671
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1672
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1672
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1673 1673
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1674 1674
     socket_close($sock);
1675 1675
 }
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
     }
1694 1694
 
1695 1695
     // include librairies & connect to DB
1696
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1696
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1697 1697
     if (defined('DB_PASSWD_CLEAR') === false) {
1698 1698
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1699 1699
     }
@@ -1717,14 +1717,14 @@  discard block
 block discarded – undo
1717 1717
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1718 1718
         if ($type === 'user_mngt') {
1719 1719
             send_syslog(
1720
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1720
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1721 1721
                 $SETTINGS['syslog_host'],
1722 1722
                 $SETTINGS['syslog_port'],
1723 1723
                 'teampass'
1724 1724
             );
1725 1725
         } else {
1726 1726
             send_syslog(
1727
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1727
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1728 1728
                 $SETTINGS['syslog_host'],
1729 1729
                 $SETTINGS['syslog_port'],
1730 1730
                 'teampass'
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
     ?string $encryption_type = null
1759 1759
 ): void {
1760 1760
     // include librairies & connect to DB
1761
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1761
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1762 1762
     if (defined('DB_PASSWD_CLEAR') === false) {
1763 1763
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1764 1764
     }
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
         if (empty($item_label) === true) {
1803 1803
             $dataItem = DB::queryfirstrow(
1804 1804
                 'SELECT id, id_tree, label
1805
-                FROM ' . prefixTable('items') . '
1805
+                FROM ' . prefixTable('items').'
1806 1806
                 WHERE id = %i',
1807 1807
                 $item_id
1808 1808
             );
@@ -1810,11 +1810,11 @@  discard block
 block discarded – undo
1810 1810
         }
1811 1811
 
1812 1812
         send_syslog(
1813
-            'action=' . str_replace('at_', '', $action) .
1814
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1815
-                ' itemno=' . $item_id .
1816
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1817
-                ' itemname="' . addslashes($item_label) . '"',
1813
+            'action='.str_replace('at_', '', $action).
1814
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1815
+                ' itemno='.$item_id.
1816
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1817
+                ' itemname="'.addslashes($item_label).'"',
1818 1818
             $SETTINGS['syslog_host'],
1819 1819
             $SETTINGS['syslog_port'],
1820 1820
             'teampass'
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
         && $action === 'at_shown'
1843 1843
     ) {
1844 1844
         // Load superglobal
1845
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1845
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1846 1846
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1847 1847
         // Get superglobals
1848 1848
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
         // Get info about item
1852 1852
         $dataItem = DB::queryfirstrow(
1853 1853
             'SELECT id, id_tree, label
1854
-            FROM ' . prefixTable('items') . '
1854
+            FROM ' . prefixTable('items').'
1855 1855
             WHERE id = %i',
1856 1856
             $item_id
1857 1857
         );
@@ -1865,9 +1865,9 @@  discard block
 block discarded – undo
1865 1865
                 'body' => str_replace(
1866 1866
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1867 1867
                     [
1868
-                        addslashes($globalsName . ' ' . $globalsLastname),
1868
+                        addslashes($globalsName.' '.$globalsLastname),
1869 1869
                         addslashes($item_label),
1870
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1870
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1871 1871
                     ],
1872 1872
                     langHdl('email_on_open_notification_mail')
1873 1873
                 ),
@@ -1891,7 +1891,7 @@  discard block
 block discarded – undo
1891 1891
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1892 1892
 {
1893 1893
     // Load superglobal
1894
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1894
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1895 1895
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1896 1896
     // Get superglobals
1897 1897
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1901,8 +1901,8 @@  discard block
 block discarded – undo
1901 1901
     $notification = DB::queryOneColumn(
1902 1902
         'email',
1903 1903
         'SELECT *
1904
-        FROM ' . prefixTable('notification') . ' AS n
1905
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1904
+        FROM ' . prefixTable('notification').' AS n
1905
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1906 1906
         WHERE n.item_id = %i AND n.user_id != %i',
1907 1907
         $item_id,
1908 1908
         $globalsUserId
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
         // Get list of changes
1914 1914
         $htmlChanges = '<ul>';
1915 1915
         foreach ($changes as $change) {
1916
-            $htmlChanges .= '<li>' . $change . '</li>';
1916
+            $htmlChanges .= '<li>'.$change.'</li>';
1917 1917
         }
1918 1918
         $htmlChanges .= '</ul>';
1919 1919
         // send email
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1947 1947
 {
1948 1948
     // Class loader
1949
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1949
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1950 1950
     //Load Tree
1951 1951
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1952 1952
     $tree->register();
@@ -1955,15 +1955,15 @@  discard block
 block discarded – undo
1955 1955
     $path = '';
1956 1956
     foreach ($arbo as $elem) {
1957 1957
         if (empty($path) === true) {
1958
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1958
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1959 1959
         } else {
1960
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1960
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1961 1961
         }
1962 1962
     }
1963 1963
 
1964 1964
     // Build text to show user
1965 1965
     if (empty($label) === false) {
1966
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1966
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1967 1967
     }
1968 1968
     return empty($path) === true ? '' : $path;
1969 1969
 }
@@ -2020,9 +2020,9 @@  discard block
 block discarded – undo
2020 2020
  */
2021 2021
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2022 2022
 {
2023
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2023
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2024 2024
     // include librairies & connect to DB
2025
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2025
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2026 2026
     if (defined('DB_PASSWD_CLEAR') === false) {
2027 2027
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2028 2028
     }
@@ -2035,8 +2035,8 @@  discard block
 block discarded – undo
2035 2035
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2036 2036
         // perform a copy
2037 2037
         if (file_exists($tp_config_file)) {
2038
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2039
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2038
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2039
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2040 2040
             }
2041 2041
         }
2042 2042
 
@@ -2046,11 +2046,11 @@  discard block
 block discarded – undo
2046 2046
         $data[1] = "global \$SETTINGS;\n";
2047 2047
         $data[2] = "\$SETTINGS = array (\n";
2048 2048
         $rows = DB::query(
2049
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2049
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2050 2050
             'admin'
2051 2051
         );
2052 2052
         foreach ($rows as $record) {
2053
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2053
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2054 2054
         }
2055 2055
         array_push($data, ");\n");
2056 2056
         $data = array_unique($data);
@@ -2064,15 +2064,15 @@  discard block
 block discarded – undo
2064 2064
                 break;
2065 2065
             }
2066 2066
 
2067
-            if (stristr($line, "'" . $field . "' => '")) {
2068
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2067
+            if (stristr($line, "'".$field."' => '")) {
2068
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2069 2069
                 $bFound = true;
2070 2070
                 break;
2071 2071
             }
2072 2072
             ++$inc;
2073 2073
         }
2074 2074
         if ($bFound === false) {
2075
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2075
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2076 2076
         }
2077 2077
     }
2078 2078
 
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 {
2103 2103
     global $SETTINGS;
2104 2104
     /* LOAD CPASSMAN SETTINGS */
2105
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2105
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2106 2106
         $SETTINGS = [];
2107 2107
         $SETTINGS['duplicate_folder'] = 0;
2108 2108
         //by default, this is set to 0;
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
         //by default, this value is set to 5;
2113 2113
         $settings = [];
2114 2114
         $rows = DB::query(
2115
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2115
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2116 2116
             [
2117 2117
                 'type' => 'admin',
2118 2118
                 'type2' => 'settings',
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
     $source_cf = [];
2145 2145
     $rows = DB::QUERY(
2146 2146
         'SELECT id_category
2147
-            FROM ' . prefixTable('categories_folders') . '
2147
+            FROM ' . prefixTable('categories_folders').'
2148 2148
             WHERE id_folder = %i',
2149 2149
         $source_id
2150 2150
     );
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
     $target_cf = [];
2156 2156
     $rows = DB::QUERY(
2157 2157
         'SELECT id_category
2158
-            FROM ' . prefixTable('categories_folders') . '
2158
+            FROM ' . prefixTable('categories_folders').'
2159 2159
             WHERE id_folder = %i',
2160 2160
         $target_id
2161 2161
     );
@@ -2190,9 +2190,9 @@  discard block
 block discarded – undo
2190 2190
     string $password = null
2191 2191
 ) {
2192 2192
     // Load AntiXSS
2193
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2194
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2195
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2193
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2194
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2195
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2196 2196
     $antiXss = new voku\helper\AntiXSS();
2197 2197
     // Protect against bad inputs
2198 2198
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2204,7 +2204,7 @@  discard block
 block discarded – undo
2204 2204
     $target_file = $antiXss->xss_clean($target_file);
2205 2205
     if (empty($password) === true || is_null($password) === true) {
2206 2206
         // get KEY to define password
2207
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2207
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2208 2208
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2209 2209
     }
2210 2210
 
@@ -2249,15 +2249,15 @@  discard block
 block discarded – undo
2249 2249
 ) {
2250 2250
     // load PhpEncryption library
2251 2251
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2252
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2253
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2254
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2255
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2256
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2257
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2258
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2259
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2260
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2252
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2253
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2254
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2255
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2256
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2257
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2258
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2259
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2260
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2261 2261
     try {
2262 2262
         \Defuse\Crypto\File::encryptFileWithPassword(
2263 2263
             $source_file,
@@ -2294,15 +2294,15 @@  discard block
 block discarded – undo
2294 2294
 ) {
2295 2295
     // load PhpEncryption library
2296 2296
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2297
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2298
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2299
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2300
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2301
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2302
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2303
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2304
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2305
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2297
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2298
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2299
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2300
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2301
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2302
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2303
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2304
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2305
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2306 2306
     try {
2307 2307
         \Defuse\Crypto\File::decryptFileWithPassword(
2308 2308
             $source_file,
@@ -2349,9 +2349,9 @@  discard block
 block discarded – undo
2349 2349
 function fileDelete(string $file, array $SETTINGS): void
2350 2350
 {
2351 2351
     // Load AntiXSS
2352
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2353
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2354
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2352
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2353
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2354
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2355 2355
     $antiXss = new voku\helper\AntiXSS();
2356 2356
     $file = $antiXss->xss_clean($file);
2357 2357
     if (is_file($file)) {
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
     int  $dirPerm = 0755
2402 2402
 ) {
2403 2403
     // Check if the path exists
2404
-    if (! file_exists($path)) {
2404
+    if (!file_exists($path)) {
2405 2405
         return false;
2406 2406
     }
2407 2407
 
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
  */
2440 2440
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2441 2441
 {
2442
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2442
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2443 2443
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2444 2444
     // Prepare superGlobal variables
2445 2445
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
     // Load item data
2448 2448
     $data = DB::queryFirstRow(
2449 2449
         'SELECT id_tree
2450
-        FROM ' . prefixTable('items') . '
2450
+        FROM ' . prefixTable('items').'
2451 2451
         WHERE id = %i',
2452 2452
         $item_id
2453 2453
     );
@@ -2510,7 +2510,7 @@  discard block
 block discarded – undo
2510 2510
         }
2511 2511
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2512 2512
     }
2513
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2513
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2514 2514
     return $email;
2515 2515
 }
2516 2516
 
@@ -2526,8 +2526,8 @@  discard block
 block discarded – undo
2526 2526
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2527 2527
 {
2528 2528
     // include librairies & connect to DB
2529
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2530
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2529
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2530
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2531 2531
     if (defined('DB_PASSWD_CLEAR') === false) {
2532 2532
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2533 2533
     }
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
     DB::$encoding = DB_ENCODING;
2540 2540
     // Insert log in DB
2541 2541
     return DB::query(
2542
-        'SELECT ' . $fields . '
2542
+        'SELECT '.$fields.'
2543 2543
         FROM ' . prefixTable($table)
2544 2544
     );
2545 2545
 }
@@ -2554,11 +2554,11 @@  discard block
 block discarded – undo
2554 2554
 function formatSizeUnits(int $bytes): string
2555 2555
 {
2556 2556
     if ($bytes >= 1073741824) {
2557
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2557
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2558 2558
     } elseif ($bytes >= 1048576) {
2559
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2559
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2560 2560
     } elseif ($bytes >= 1024) {
2561
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2561
+        $bytes = number_format($bytes / 1024, 2).' KB';
2562 2562
     } elseif ($bytes > 1) {
2563 2563
         $bytes .= ' bytes';
2564 2564
     } elseif ($bytes === 1) {
@@ -2767,14 +2767,14 @@  discard block
 block discarded – undo
2767 2767
 
2768 2768
     // Encrypt the file content
2769 2769
     $plaintext = file_get_contents(
2770
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2770
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2771 2771
     );
2772 2772
     $ciphertext = $cipher->encrypt($plaintext);
2773 2773
     // Save new file
2774 2774
     $hash = md5($plaintext);
2775
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2775
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2776 2776
     file_put_contents($fileOut, $ciphertext);
2777
-    unlink($fileInPath . '/' . $fileInName);
2777
+    unlink($fileInPath.'/'.$fileInName);
2778 2778
     return [
2779 2779
         'fileHash' => base64_encode($hash),
2780 2780
         'objectKey' => base64_encode($objectKey),
@@ -2792,7 +2792,7 @@  discard block
 block discarded – undo
2792 2792
  */
2793 2793
 function decryptFile(string $fileName, string $filePath, string $key): string
2794 2794
 {
2795
-    if (! defined('FILE_BUFFER_SIZE')) {
2795
+    if (!defined('FILE_BUFFER_SIZE')) {
2796 2796
         define('FILE_BUFFER_SIZE', 128 * 1024);
2797 2797
     }
2798 2798
 
@@ -2811,7 +2811,7 @@  discard block
 block discarded – undo
2811 2811
     $cipher->enableContinuousBuffer();
2812 2812
     $cipher->disablePadding();
2813 2813
     // Get file content
2814
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2814
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2815 2815
     // Decrypt file content and return
2816 2816
     return base64_encode($cipher->decrypt($ciphertext));
2817 2817
 }
@@ -2865,8 +2865,8 @@  discard block
 block discarded – undo
2865 2865
     array $SETTINGS
2866 2866
 ): void {
2867 2867
     // include librairies & connect to DB
2868
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2869
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2868
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2869
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2870 2870
     if (defined('DB_PASSWD_CLEAR') === false) {
2871 2871
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2872 2872
     }
@@ -2883,7 +2883,7 @@  discard block
 block discarded – undo
2883 2883
         $post_object_id
2884 2884
     );
2885 2885
     // Superglobals
2886
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2886
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2887 2887
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2888 2888
     // Prepare superGlobal variables
2889 2889
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2908,8 +2908,8 @@  discard block
 block discarded – undo
2908 2908
         // Create sharekey for each user
2909 2909
         $users = DB::query(
2910 2910
             'SELECT id, public_key
2911
-            FROM ' . prefixTable('users') . '
2912
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2911
+            FROM ' . prefixTable('users').'
2912
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2913 2913
             AND public_key != ""'
2914 2914
         );
2915 2915
         foreach ($users as $user) {
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
 function isBase64(string $str): bool
2940 2940
 {
2941 2941
     $str = (string) trim($str);
2942
-    if (! isset($str[0])) {
2942
+    if (!isset($str[0])) {
2943 2943
         return false;
2944 2944
     }
2945 2945
 
@@ -3007,12 +3007,12 @@  discard block
 block discarded – undo
3007 3007
         ],
3008 3008
     ];
3009 3009
     // Load expected libraries
3010
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3011
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3012
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3013
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3014
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3015
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3010
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3011
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3012
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3013
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3014
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3015
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3016 3016
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3017 3017
     $ad->register();
3018 3018
     $connection = new Connection($config);
@@ -3021,7 +3021,7 @@  discard block
 block discarded – undo
3021 3021
         $connection->connect();
3022 3022
     } catch (\LdapRecord\Auth\BindException $e) {
3023 3023
         $error = $e->getDetailedError();
3024
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3024
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3025 3025
         return false;
3026 3026
     }
3027 3027
 
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
         }
3035 3035
     } catch (\LdapRecord\Auth\BindException $e) {
3036 3036
         $error = $e->getDetailedError();
3037
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3037
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3038 3038
         return false;
3039 3039
     }
3040 3040
 
@@ -3052,8 +3052,8 @@  discard block
 block discarded – undo
3052 3052
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3053 3053
 {
3054 3054
     // include librairies & connect to DB
3055
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3056
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3055
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3056
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3057 3057
     if (defined('DB_PASSWD_CLEAR') === false) {
3058 3058
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3059 3059
     }
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3112 3112
             $now->setTimezone(new DateTimeZone($timezone));
3113 3113
             $offsets[] = $offset = $now->getOffset();
3114
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3114
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3115 3115
         }
3116 3116
 
3117 3117
         array_multisort($offsets, $timezones);
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
 {
3132 3132
     $hours = intval($offset / 3600);
3133 3133
     $minutes = abs(intval($offset % 3600 / 60));
3134
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3134
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3135 3135
 }
3136 3136
 
3137 3137
 /**
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +88 added lines, -88 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
 }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     // This step creates the DUO request encrypted key
94 94
 
95 95
     // load library
96
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
96
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
97 97
     $sig_request = Duo::signRequest(
98 98
         $SETTINGS['IKEY'],
99 99
         $SETTINGS['SKEY'],
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
         debugIdentify(
105 105
             DEBUGDUO,
106 106
             DEBUGDUOFILE,
107
-            "\n\n-----\n\n" .
108
-                'sig request : ' . $post_login . "\n" .
109
-                'resp : ' . $sig_request . "\n"
107
+            "\n\n-----\n\n".
108
+                'sig request : '.$post_login."\n".
109
+                'resp : '.$sig_request."\n"
110 110
         );
111 111
     }
112 112
 
113 113
     // load csrfprotector
114
-    $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php';
114
+    $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php';
115 115
     // return result
116
-    echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]';
116
+    echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]';
117 117
 // ---
118 118
     // ---
119 119
 } elseif ($post_type === 'identify_duo_user_check') {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     //--------
124 124
 
125 125
     // load library
126
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
126
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
127 127
     $authenticated_username = Duo::verifyResponse(
128 128
         $SETTINGS['duo_ikey'],
129 129
         $SETTINGS['duo_skey'],
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             // is user in Teampass?
139 139
             DB::queryfirstrow(
140 140
                 'SELECT id
141
-                FROM ' . prefixTable('users') . '
141
+                FROM ' . prefixTable('users').'
142 142
                 WHERE login = %s',
143 143
                 $post_login
144 144
             );
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
             }
149 149
         }
150 150
 
151
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
151
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
152 152
     } else {
153
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
153
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
154 154
     }
155 155
     // ---
156 156
     // ---
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
     // Load superGlobals
179
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
179
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
180 180
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
181 181
     // Prepare GET variables
182 182
     $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
@@ -266,19 +266,19 @@  discard block
 block discarded – undo
266 266
     } else {
267 267
         throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
268 268
     }
269
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
270
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
271
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
269
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
270
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
271
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
272 272
     
273 273
     header('Content-type: text/html; charset=utf-8');
274 274
     error_reporting(E_ERROR);
275 275
 
276 276
     // Load AntiXSS
277
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
277
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
278 278
     $antiXss = new voku\helper\AntiXSS();
279 279
 
280 280
     // Load superGlobals
281
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
281
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
282 282
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
283 283
 
284 284
     // Prepare GET variables
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
     $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER');
293 293
 
294 294
     // connect to the server
295
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
295
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
296 296
     DB::$host = DB_HOST;
297 297
     DB::$user = DB_USER;
298 298
     DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR;
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
     DB::$port = DB_PORT;
301 301
     DB::$encoding = DB_ENCODING;
302 302
     // User's language loading
303
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php';
303
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php';
304 304
     
305 305
     // decrypt and retreive data in JSON format
306 306
     if (empty($sessionKey) === true) {
307 307
         $dataReceived = $sentData;
308 308
     } else {
309 309
         $dataReceived = prepareExchangedData(
310
-    $SETTINGS['cpassman_dir'],$sentData, 'decode', $sessionKey);
310
+    $SETTINGS['cpassman_dir'], $sentData, 'decode', $sessionKey);
311 311
         $superGlobal->put('key', $sessionKey, 'SESSION');
312 312
     }
313 313
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         // Check if any unsuccessfull login tries exist
457 457
         $rows = DB::query(
458 458
             'SELECT date
459
-            FROM ' . prefixTable('log_system') . "
459
+            FROM ' . prefixTable('log_system')."
460 460
             WHERE field_1 = %s
461 461
             AND type = 'failed_auth'
462 462
             AND label = 'password_is_not_correct'
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
             foreach ($rows as $record) {
471 471
                 array_push(
472 472
                     $arrAttempts,
473
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
473
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
474 474
                 );
475 475
             }
476 476
         }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         foreach ($superGlobal->get('user_roles', 'SESSION') as $role) {
586 586
             $resRoles = DB::queryFirstRow(
587 587
                 'SELECT title, complexity
588
-                FROM ' . prefixTable('roles_title') . '
588
+                FROM ' . prefixTable('roles_title').'
589 589
                 WHERE id=%i',
590 590
                 $role
591 591
             );
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 
607 607
         // build complete array of roles
608 608
         $superGlobal->put('arr_roles_full', [], 'SESSION');
609
-        $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
609
+        $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
610 610
         foreach ($rows as $record) {
611 611
             $superGlobal->put(
612 612
                 $record['id'],
@@ -684,10 +684,10 @@  discard block
 block discarded – undo
684 684
         $superGlobal->put('latest_items_tab', [], 'SESSION');
685 685
         $superGlobal->put('nb_roles', 0, 'SESSION');
686 686
         foreach ($superGlobal->get('latest_items', 'SESSION') as $item) {
687
-            if (! empty($item)) {
687
+            if (!empty($item)) {
688 688
                 $dataLastItems = DB::queryFirstRow(
689 689
                     'SELECT id,label,id_tree
690
-                    FROM ' . prefixTable('items') . '
690
+                    FROM ' . prefixTable('items').'
691 691
                     WHERE id=%i',
692 692
                     $item
693 693
                 );
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
                     [
697 697
                         'id' => $item,
698 698
                         'label' => $dataLastItems['label'],
699
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
699
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
700 700
                     ],
701 701
                     'SESSION',
702 702
                     'latest_items_tab'
@@ -713,12 +713,12 @@  discard block
 block discarded – undo
713 713
         ) {
714 714
             // get all Admin users
715 715
             $receivers = '';
716
-            $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
716
+            $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
717 717
             foreach ($rows as $record) {
718 718
                 if (empty($receivers)) {
719 719
                     $receivers = $record['email'];
720 720
                 } else {
721
-                    $receivers = ',' . $record['email'];
721
+                    $receivers = ','.$record['email'];
722 722
                 }
723 723
             }
724 724
             // Add email to table
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
                             '#tp_time#',
735 735
                         ],
736 736
                         [
737
-                            ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')',
737
+                            ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')',
738 738
                             date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
739 739
                             date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
740 740
                         ],
@@ -1059,44 +1059,44 @@  discard block
 block discarded – undo
1059 1059
     }
1060 1060
 
1061 1061
     // Load expected libraries
1062
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
1063
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
1064
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
1065
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
1066
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
1067
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
1068
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
1069
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
1070
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php';
1071
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
1072
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
1073
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
1074
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
1075
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
1076
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
1077
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
1078
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
1079
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
1080
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
1081
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
1082
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
1083
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
1084
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
1085
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
1086
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
1087
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
1088
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
1089
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
1090
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
1091
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
1092
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
1093
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
1094
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
1095
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
1096
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
1097
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
1098
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php';
1099
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
1062
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
1063
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
1064
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
1065
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
1066
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
1067
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
1068
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
1069
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
1070
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php';
1071
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
1072
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
1073
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
1074
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
1075
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
1076
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
1077
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
1078
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
1079
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
1080
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
1081
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
1082
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
1083
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
1084
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
1085
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
1086
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
1087
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
1088
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
1089
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
1090
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
1091
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
1092
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
1093
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
1094
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
1095
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
1096
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
1097
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
1098
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php';
1099
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
1100 1100
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
1101 1101
     $ad->register();
1102 1102
     $connection = new Connection($config);
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
         $error = $e->getDetailedError();
1109 1109
         return [
1110 1110
             'error' => true,
1111
-            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage().' '.$config['username'],
1111
+            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage().' '.$config['username'],
1112 1112
 
1113 1113
         ];
1114 1114
     }
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
     }
1137 1137
 
1138 1138
     // load passwordLib library
1139
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1139
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1140 1140
     $pwdlib->register();
1141 1141
     $pwdlib = new PasswordLib\PasswordLib();
1142 1142
     $hashedPassword = $pwdlib->createPasswordHash($passwordClear);
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array
1196 1196
 {
1197 1197
     // Load superGlobals
1198
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1198
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1199 1199
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1200 1200
     $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1201 1201
     $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
     }
1235 1235
 
1236 1236
     // Now check yubico validity
1237
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1237
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1238 1238
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1239 1239
     $auth = $yubi->verify($yubico_key);
1240 1240
     //, null, null, null, 60
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
             'gestionnaire' => '0',
1287 1287
             'can_manage_all_users' => '0',
1288 1288
             'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0',
1289
-            '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'),
1289
+            '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'),
1290 1290
             'groupes_interdits' => '',
1291 1291
             'groupes_visibles' => '',
1292 1292
             'last_pw_change' => (int) time(),
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
             ]
1312 1312
         );
1313 1313
         // Rebuild tree
1314
-        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1314
+        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1315 1315
         $tree->register();
1316 1316
         $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1317 1317
         $tree->rebuild();
@@ -1342,13 +1342,13 @@  discard block
 block discarded – undo
1342 1342
         && empty($dataReceived['GACode']) === false
1343 1343
     ) {
1344 1344
         // Load superGlobals
1345
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1345
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1346 1346
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1347 1347
         $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1348 1348
         $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
1349 1349
         $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
1350 1350
         // load library
1351
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1351
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1352 1352
         // create new instance
1353 1353
         $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
1354 1354
         // Init
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
             $mfaMessage = langHdl('ga_flash_qr_and_login');
1371 1371
             // generate new QR
1372 1372
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1373
-                'Teampass - ' . $username,
1373
+                'Teampass - '.$username,
1374 1374
                 $userInfo['ga']
1375 1375
             );
1376 1376
             // clear temporary code from DB
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
                 $userInfo['id']
1384 1384
             );
1385 1385
             $firstTime = [
1386
-                'value' => '<img src="' . $new_2fa_qr . '">',
1386
+                'value' => '<img src="'.$new_2fa_qr.'">',
1387 1387
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1388 1388
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1389 1389
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1434,8 +1434,8 @@  discard block
 block discarded – undo
1434 1434
     // Set to false
1435 1435
     $userPasswordVerified = false;
1436 1436
     // load passwordLib library
1437
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1438
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1437
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1438
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1439 1439
     $pwdlib->register();
1440 1440
     $pwdlib = new PasswordLib\PasswordLib();
1441 1441
     // Check if old encryption used
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
     // Brute force management
1567 1567
     if ($sessionPwdAttempts > 3) {
1568 1568
         // Load superGlobals
1569
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1569
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1570 1570
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1571 1571
         $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION');
1572 1572
         $superGlobal->put('pwd_attempts', 0, 'SESSION');
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
     // Check if user exists
1609 1609
     $userInfo = DB::queryFirstRow(
1610 1610
         'SELECT *
1611
-        FROM ' . prefixTable('users') . ' WHERE login=%s',
1611
+        FROM ' . prefixTable('users').' WHERE login=%s',
1612 1612
         $username
1613 1613
     );
1614 1614
     
Please login to merge, or discard this patch.