Passed
Push — master ( 3fa478...28d543 )
by Nils
11:03
created
sources/main.functions.php 1 patch
Spacing   +256 added lines, -258 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 // Load config if $SETTINGS not defined
35 35
 if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
36
-    include_once __DIR__ . '/../includes/config/tp.config.php';
36
+    include_once __DIR__.'/../includes/config/tp.config.php';
37 37
 }
38 38
 
39 39
 header('Content-type: text/html; charset=utf-8');
@@ -114,29 +114,29 @@  discard block
 block discarded – undo
114 114
  */
115 115
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
116 116
 {
117
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
117
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
118 118
     $err = false;
119 119
     // load PhpEncryption library
120 120
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
121 121
         $path = '../includes/libraries/Encryption/Encryption/';
122 122
     } else {
123
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
124
-    }
125
-
126
-    include_once $path . 'Exception/CryptoException.php';
127
-    include_once $path . 'Exception/BadFormatException.php';
128
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
129
-    include_once $path . 'Exception/IOException.php';
130
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
131
-    include_once $path . 'Crypto.php';
132
-    include_once $path . 'Encoding.php';
133
-    include_once $path . 'DerivedKeys.php';
134
-    include_once $path . 'Key.php';
135
-    include_once $path . 'KeyOrPassword.php';
136
-    include_once $path . 'File.php';
137
-    include_once $path . 'RuntimeTests.php';
138
-    include_once $path . 'KeyProtectedByPassword.php';
139
-    include_once $path . 'Core.php';
123
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
124
+    }
125
+
126
+    include_once $path.'Exception/CryptoException.php';
127
+    include_once $path.'Exception/BadFormatException.php';
128
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
129
+    include_once $path.'Exception/IOException.php';
130
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
131
+    include_once $path.'Crypto.php';
132
+    include_once $path.'Encoding.php';
133
+    include_once $path.'DerivedKeys.php';
134
+    include_once $path.'Key.php';
135
+    include_once $path.'KeyOrPassword.php';
136
+    include_once $path.'File.php';
137
+    include_once $path.'RuntimeTests.php';
138
+    include_once $path.'KeyProtectedByPassword.php';
139
+    include_once $path.'Core.php';
140 140
     
141 141
     // convert KEY
142 142
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -181,20 +181,20 @@  discard block
 block discarded – undo
181 181
         $path = '../includes/libraries/Encryption/Encryption/';
182 182
     }
183 183
 
184
-    include_once $path . 'Exception/CryptoException.php';
185
-    include_once $path . 'Exception/BadFormatException.php';
186
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
187
-    include_once $path . 'Exception/IOException.php';
188
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
189
-    include_once $path . 'Crypto.php';
190
-    include_once $path . 'Encoding.php';
191
-    include_once $path . 'DerivedKeys.php';
192
-    include_once $path . 'Key.php';
193
-    include_once $path . 'KeyOrPassword.php';
194
-    include_once $path . 'File.php';
195
-    include_once $path . 'RuntimeTests.php';
196
-    include_once $path . 'KeyProtectedByPassword.php';
197
-    include_once $path . 'Core.php';
184
+    include_once $path.'Exception/CryptoException.php';
185
+    include_once $path.'Exception/BadFormatException.php';
186
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
187
+    include_once $path.'Exception/IOException.php';
188
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
189
+    include_once $path.'Crypto.php';
190
+    include_once $path.'Encoding.php';
191
+    include_once $path.'DerivedKeys.php';
192
+    include_once $path.'Key.php';
193
+    include_once $path.'KeyOrPassword.php';
194
+    include_once $path.'File.php';
195
+    include_once $path.'RuntimeTests.php';
196
+    include_once $path.'KeyProtectedByPassword.php';
197
+    include_once $path.'Core.php';
198 198
 
199 199
     $key = \Defuse\Crypto\Key::createNewRandomKey();
200 200
     $key = $key->saveToAsciiSafeString();
@@ -219,20 +219,20 @@  discard block
 block discarded – undo
219 219
         $path = '../includes/libraries/Encryption/Encryption/';
220 220
     }
221 221
 
222
-    include_once $path . 'Exception/CryptoException.php';
223
-    include_once $path . 'Exception/BadFormatException.php';
224
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
225
-    include_once $path . 'Exception/IOException.php';
226
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
227
-    include_once $path . 'Crypto.php';
228
-    include_once $path . 'Encoding.php';
229
-    include_once $path . 'DerivedKeys.php';
230
-    include_once $path . 'Key.php';
231
-    include_once $path . 'KeyOrPassword.php';
232
-    include_once $path . 'File.php';
233
-    include_once $path . 'RuntimeTests.php';
234
-    include_once $path . 'KeyProtectedByPassword.php';
235
-    include_once $path . 'Core.php';
222
+    include_once $path.'Exception/CryptoException.php';
223
+    include_once $path.'Exception/BadFormatException.php';
224
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
225
+    include_once $path.'Exception/IOException.php';
226
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
227
+    include_once $path.'Crypto.php';
228
+    include_once $path.'Encoding.php';
229
+    include_once $path.'DerivedKeys.php';
230
+    include_once $path.'Key.php';
231
+    include_once $path.'KeyOrPassword.php';
232
+    include_once $path.'File.php';
233
+    include_once $path.'RuntimeTests.php';
234
+    include_once $path.'KeyProtectedByPassword.php';
235
+    include_once $path.'Core.php';
236 236
     
237 237
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
238 238
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -257,20 +257,20 @@  discard block
 block discarded – undo
257 257
         $path = '../includes/libraries/Encryption/Encryption/';
258 258
     }
259 259
 
260
-    include_once $path . 'Exception/CryptoException.php';
261
-    include_once $path . 'Exception/BadFormatException.php';
262
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
263
-    include_once $path . 'Exception/IOException.php';
264
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
265
-    include_once $path . 'Crypto.php';
266
-    include_once $path . 'Encoding.php';
267
-    include_once $path . 'DerivedKeys.php';
268
-    include_once $path . 'Key.php';
269
-    include_once $path . 'KeyOrPassword.php';
270
-    include_once $path . 'File.php';
271
-    include_once $path . 'RuntimeTests.php';
272
-    include_once $path . 'KeyProtectedByPassword.php';
273
-    include_once $path . 'Core.php';
260
+    include_once $path.'Exception/CryptoException.php';
261
+    include_once $path.'Exception/BadFormatException.php';
262
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
263
+    include_once $path.'Exception/IOException.php';
264
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
265
+    include_once $path.'Crypto.php';
266
+    include_once $path.'Encoding.php';
267
+    include_once $path.'DerivedKeys.php';
268
+    include_once $path.'Key.php';
269
+    include_once $path.'KeyOrPassword.php';
270
+    include_once $path.'File.php';
271
+    include_once $path.'RuntimeTests.php';
272
+    include_once $path.'KeyProtectedByPassword.php';
273
+    include_once $path.'Core.php';
274 274
 
275 275
     try {
276 276
         $user_key = $protected_key_encoded->unlockKey($psk);
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
  */
312 312
 function trimElement($chaine, string $element): string
313 313
 {
314
-    if (! empty($chaine)) {
314
+    if (!empty($chaine)) {
315 315
         if (is_array($chaine) === true) {
316 316
             $chaine = implode(';', $chaine);
317 317
         }
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
  */
360 360
 function db_error_handler(array $params): void
361 361
 {
362
-    echo 'Error: ' . $params['error'] . "<br>\n";
363
-    echo 'Query: ' . $params['query'] . "<br>\n";
362
+    echo 'Error: '.$params['error']."<br>\n";
363
+    echo 'Query: '.$params['query']."<br>\n";
364 364
     throw new Exception('Error - Query', 1);
365 365
 }
366 366
 
@@ -382,12 +382,12 @@  discard block
 block discarded – undo
382 382
     $SETTINGS
383 383
 ) {
384 384
     //load ClassLoader
385
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
385
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
386 386
     // Load superglobal
387
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
387
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
388 388
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
389 389
     //Connect to DB
390
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
390
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
391 391
     if (defined('DB_PASSWD_CLEAR') === false) {
392 392
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
393 393
     }
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     DB::$ssl = DB_SSL;
401 401
     DB::$connect_options = DB_CONNECT_OPTIONS;
402 402
     //Build tree
403
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
403
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
404 404
     $tree->register();
405 405
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
406 406
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 function identAdmin($idFonctions, $SETTINGS, $tree)
446 446
 {
447 447
     // Load superglobal
448
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
448
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
449 449
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
450 450
     // Init
451 451
     $groupesVisibles = [];
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
465 465
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
466 466
     // Get list of Folders
467
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
467
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
468 468
     foreach ($rows as $record) {
469 469
         array_push($groupesVisibles, $record['id']);
470 470
     }
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
     }
484 484
     // Get ID of personal folder
485 485
     $persfld = DB::queryfirstrow(
486
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
486
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
487 487
         $globalsUserId
488 488
     );
489 489
     if (empty($persfld['id']) === false) {
@@ -504,20 +504,20 @@  discard block
 block discarded – undo
504 504
     // get complete list of ROLES
505 505
     $tmp = explode(';', $idFonctions);
506 506
     $rows = DB::query(
507
-        'SELECT * FROM ' . prefixTable('roles_title') . '
507
+        'SELECT * FROM '.prefixTable('roles_title').'
508 508
         ORDER BY title ASC'
509 509
     );
510 510
     foreach ($rows as $record) {
511
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
511
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
512 512
             array_push($tmp, $record['id']);
513 513
         }
514 514
     }
515 515
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
516 516
     $superGlobal->put('is_admin', 1, 'SESSION');
517 517
     // Check if admin has created Folders and Roles
518
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
518
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
519 519
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
520
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
520
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
521 521
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
522 522
 
523 523
     return true;
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
     object $tree
564 564
 ) {
565 565
     // Load superglobal
566
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
566
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
567 567
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
568 568
     // Init
569 569
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -602,10 +602,10 @@  discard block
 block discarded – undo
602 602
     // Does this user is allowed to see other items
603 603
     $inc = 0;
604 604
     $rows = DB::query(
605
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
605
+        'SELECT id, id_tree FROM '.prefixTable('items').'
606 606
             WHERE restricted_to LIKE %ss AND inactif = %s'.
607 607
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
608
-        $globalsUserId . ';',
608
+        $globalsUserId.';',
609 609
         '0'
610 610
     );
611 611
     foreach ($rows as $record) {
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
     // Check for the users roles if some specific rights exist on items
620 620
     $rows = DB::query(
621 621
         'SELECT i.id_tree, r.item_id
622
-        FROM ' . prefixTable('items') . ' as i
623
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
622
+        FROM ' . prefixTable('items').' as i
623
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
624 624
         WHERE r.role_id IN %li AND i.id_tree <> ""
625 625
         ORDER BY i.id_tree ASC',
626 626
         $userRoles
@@ -674,16 +674,16 @@  discard block
 block discarded – undo
674 674
         'SESSION'
675 675
     );
676 676
     // Folders and Roles numbers
677
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
677
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
678 678
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
679
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
679
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
680 680
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
681 681
     // check if change proposals on User's items
682 682
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
683 683
         $countNewItems = DB::query(
684 684
             'SELECT COUNT(*)
685
-            FROM ' . prefixTable('items_change') . ' AS c
686
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
685
+            FROM ' . prefixTable('items_change').' AS c
686
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
687 687
             WHERE i.action = %s AND i.id_user = %i',
688 688
             'at_creation',
689 689
             $globalsUserId
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
     
712 712
     $rows = DB::query(
713 713
         'SELECT *
714
-        FROM ' . prefixTable('roles_values') . '
714
+        FROM ' . prefixTable('roles_values').'
715 715
         WHERE role_id IN %li AND type IN %ls',
716 716
         $userRoles,
717 717
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
     ) {
779 779
         $persoFld = DB::queryfirstrow(
780 780
             'SELECT id
781
-            FROM ' . prefixTable('nested_tree') . '
781
+            FROM ' . prefixTable('nested_tree').'
782 782
             WHERE title = %s AND personal_folder = %i'.
783 783
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
784 784
             $globalsUserId,
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
     }
809 809
     $persoFlds = DB::query(
810 810
         'SELECT id
811
-        FROM ' . prefixTable('nested_tree') . '
811
+        FROM ' . prefixTable('nested_tree').'
812 812
         WHERE %l',
813 813
         $where
814 814
     );
@@ -872,9 +872,9 @@  discard block
 block discarded – undo
872 872
  */
873 873
 function cacheTableRefresh(array $SETTINGS): void
874 874
 {
875
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
875
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
876 876
     //Connect to DB
877
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
877
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
878 878
     if (defined('DB_PASSWD_CLEAR') === false) {
879 879
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
880 880
     }
@@ -891,12 +891,12 @@  discard block
 block discarded – undo
891 891
     $tree->register();
892 892
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
893 893
     // truncate table
894
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
894
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
895 895
     // reload date
896 896
     $rows = DB::query(
897 897
         'SELECT *
898
-        FROM ' . prefixTable('items') . ' as i
899
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
898
+        FROM ' . prefixTable('items').' as i
899
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
900 900
         AND l.action = %s
901 901
         AND i.inactif = %i',
902 902
         'at_creation',
@@ -908,18 +908,18 @@  discard block
 block discarded – undo
908 908
             $tags = '';
909 909
             $itemTags = DB::query(
910 910
                 'SELECT tag
911
-                FROM ' . prefixTable('tags') . '
911
+                FROM ' . prefixTable('tags').'
912 912
                 WHERE item_id = %i AND tag != ""',
913 913
                 $record['id']
914 914
             );
915 915
             foreach ($itemTags as $itemTag) {
916
-                $tags .= $itemTag['tag'] . ' ';
916
+                $tags .= $itemTag['tag'].' ';
917 917
             }
918 918
 
919 919
             // Get renewal period
920 920
             $resNT = DB::queryfirstrow(
921 921
                 'SELECT renewal_period
922
-                FROM ' . prefixTable('nested_tree') . '
922
+                FROM ' . prefixTable('nested_tree').'
923 923
                 WHERE id = %i',
924 924
                 $record['id_tree']
925 925
             );
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
                     // Is this a User id?
933 933
                     $user = DB::queryfirstrow(
934 934
                         'SELECT id, login
935
-                        FROM ' . prefixTable('users') . '
935
+                        FROM ' . prefixTable('users').'
936 936
                         WHERE id = %i',
937 937
                         $elem->title
938 938
                     );
@@ -950,11 +950,11 @@  discard block
 block discarded – undo
950 950
                     'id' => $record['id'],
951 951
                     'label' => $record['label'],
952 952
                     'description' => $record['description'] ?? '',
953
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
953
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
954 954
                     'tags' => $tags,
955 955
                     'id_tree' => $record['id_tree'],
956 956
                     'perso' => $record['perso'],
957
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
957
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
958 958
                     'login' => $record['login'] ?? '',
959 959
                     'folder' => implode(' > ', $folder),
960 960
                     'author' => $record['id_user'],
@@ -976,12 +976,12 @@  discard block
 block discarded – undo
976 976
  */
977 977
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
978 978
 {
979
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
979
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
980 980
     // Load superglobal
981
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
981
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
982 982
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
983 983
     //Connect to DB
984
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
984
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
985 985
     if (defined('DB_PASSWD_CLEAR') === false) {
986 986
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
987 987
     }
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
     // get new value from db
1001 1001
     $data = DB::queryfirstrow(
1002 1002
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1003
-        FROM ' . prefixTable('items') . '
1003
+        FROM ' . prefixTable('items').'
1004 1004
         WHERE id=%i',
1005 1005
         $ident
1006 1006
     );
@@ -1008,12 +1008,12 @@  discard block
 block discarded – undo
1008 1008
     $tags = '';
1009 1009
     $itemTags = DB::query(
1010 1010
         'SELECT tag
1011
-            FROM ' . prefixTable('tags') . '
1011
+            FROM ' . prefixTable('tags').'
1012 1012
             WHERE item_id = %i AND tag != ""',
1013 1013
         $ident
1014 1014
     );
1015 1015
     foreach ($itemTags as $itemTag) {
1016
-        $tags .= $itemTag['tag'] . ' ';
1016
+        $tags .= $itemTag['tag'].' ';
1017 1017
     }
1018 1018
     // form id_tree to full foldername
1019 1019
     $folder = [];
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
             // Is this a User id?
1025 1025
             $user = DB::queryfirstrow(
1026 1026
                 'SELECT id, login
1027
-                FROM ' . prefixTable('users') . '
1027
+                FROM ' . prefixTable('users').'
1028 1028
                 WHERE id = %i',
1029 1029
                 $elem->title
1030 1030
             );
@@ -1042,10 +1042,10 @@  discard block
 block discarded – undo
1042 1042
             'label' => $data['label'],
1043 1043
             'description' => $data['description'],
1044 1044
             'tags' => $tags,
1045
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1045
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1046 1046
             'id_tree' => $data['id_tree'],
1047 1047
             'perso' => $data['perso'],
1048
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1048
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1049 1049
             'login' => $data['login'] ?? '',
1050 1050
             'folder' => implode(' » ', $folder),
1051 1051
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1065,14 +1065,14 @@  discard block
 block discarded – undo
1065 1065
  */
1066 1066
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1067 1067
 {
1068
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1068
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1069 1069
     // Load superglobal
1070
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1070
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1071 1071
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1072 1072
     // Get superglobals
1073 1073
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1074 1074
     //Connect to DB
1075
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1075
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1076 1076
     if (defined('DB_PASSWD_CLEAR') === false) {
1077 1077
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1078 1078
     }
@@ -1091,8 +1091,8 @@  discard block
 block discarded – undo
1091 1091
     // get new value from db
1092 1092
     $data = DB::queryFirstRow(
1093 1093
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1094
-        FROM ' . prefixTable('items') . ' as i
1095
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1094
+        FROM ' . prefixTable('items').' as i
1095
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1096 1096
         WHERE i.id = %i
1097 1097
         AND l.action = %s',
1098 1098
         $ident,
@@ -1102,12 +1102,12 @@  discard block
 block discarded – undo
1102 1102
     $tags = '';
1103 1103
     $itemTags = DB::query(
1104 1104
         'SELECT tag
1105
-            FROM ' . prefixTable('tags') . '
1105
+            FROM ' . prefixTable('tags').'
1106 1106
             WHERE item_id = %i AND tag != ""',
1107 1107
         $ident
1108 1108
     );
1109 1109
     foreach ($itemTags as $itemTag) {
1110
-        $tags .= $itemTag['tag'] . ' ';
1110
+        $tags .= $itemTag['tag'].' ';
1111 1111
     }
1112 1112
     // form id_tree to full foldername
1113 1113
     $folder = [];
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
             // Is this a User id?
1119 1119
             $user = DB::queryfirstrow(
1120 1120
                 'SELECT id, login
1121
-                FROM ' . prefixTable('users') . '
1121
+                FROM ' . prefixTable('users').'
1122 1122
                 WHERE id = %i',
1123 1123
                 $elem->title
1124 1124
             );
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
             'label' => $data['label'],
1138 1138
             'description' => $data['description'],
1139 1139
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1140
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1140
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1141 1141
             'id_tree' => $data['id_tree'],
1142 1142
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1143 1143
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1159,52 +1159,52 @@  discard block
 block discarded – undo
1159 1159
 function getStatisticsData(array $SETTINGS): array
1160 1160
 {
1161 1161
     DB::query(
1162
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1162
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1163 1163
         0
1164 1164
     );
1165 1165
     $counter_folders = DB::count();
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
         1
1169 1169
     );
1170 1170
     $counter_folders_perso = DB::count();
1171 1171
     DB::query(
1172
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1172
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1173 1173
         0
1174 1174
     );
1175 1175
     $counter_items = 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
         1
1179 1179
     );
1180 1180
     $counter_items_perso = DB::count();
1181 1181
         DB::query(
1182
-        'SELECT id FROM ' . prefixTable('users') . ''
1182
+        'SELECT id FROM '.prefixTable('users').''
1183 1183
     );
1184 1184
     $counter_users = DB::count();
1185 1185
         DB::query(
1186
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1186
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1187 1187
         1
1188 1188
     );
1189 1189
     $admins = DB::count();
1190 1190
     DB::query(
1191
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1191
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1192 1192
         1
1193 1193
     );
1194 1194
     $managers = DB::count();
1195 1195
     DB::query(
1196
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1196
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1197 1197
         1
1198 1198
     );
1199 1199
     $readOnly = DB::count();
1200 1200
     // list the languages
1201 1201
     $usedLang = [];
1202 1202
     $tp_languages = DB::query(
1203
-        'SELECT name FROM ' . prefixTable('languages')
1203
+        'SELECT name FROM '.prefixTable('languages')
1204 1204
     );
1205 1205
     foreach ($tp_languages as $tp_language) {
1206 1206
         DB::query(
1207
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1207
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1208 1208
             $tp_language['name']
1209 1209
         );
1210 1210
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1213,12 +1213,12 @@  discard block
 block discarded – undo
1213 1213
     // get list of ips
1214 1214
     $usedIp = [];
1215 1215
     $tp_ips = DB::query(
1216
-        'SELECT user_ip FROM ' . prefixTable('users')
1216
+        'SELECT user_ip FROM '.prefixTable('users')
1217 1217
     );
1218 1218
     foreach ($tp_ips as $ip) {
1219 1219
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1220 1220
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1221
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1221
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1222 1222
             $usedIp[$ip['user_ip']] = 1;
1223 1223
         }
1224 1224
     }
@@ -1284,21 +1284,21 @@  discard block
 block discarded – undo
1284 1284
     }
1285 1285
 
1286 1286
     // Load settings
1287
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1287
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1288 1288
     // Load superglobal
1289
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1289
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1290 1290
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1291 1291
     // Get user language
1292
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1292
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1293 1293
     // Load library
1294
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1294
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1295 1295
     // load PHPMailer
1296 1296
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1297 1297
     $mail->register();
1298 1298
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1299 1299
 
1300 1300
     // send to user
1301
-    $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1301
+    $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1302 1302
     $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1303 1303
     $mail->Port = (int) $SETTINGS['email_port'];
1304 1304
     //COULD BE USED
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
         <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;">
1406 1406
         <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;">
1407 1407
         <br><div style="float:right;">' .
1408
-        $textMail .
1408
+        $textMail.
1409 1409
         '<br><br></td></tr></table>
1410 1410
     </td></tr></table>
1411 1411
     <br></body></html>';
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
  */
1419 1419
 function generateKey(): string
1420 1420
 {
1421
-    return substr(md5(rand() . rand()), 0, 15);
1421
+    return substr(md5(rand().rand()), 0, 15);
1422 1422
 }
1423 1423
 
1424 1424
 /**
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 {
1490 1490
     array_walk_recursive(
1491 1491
         $array,
1492
-        static function (&$item): void {
1492
+        static function(&$item): void {
1493 1493
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1494 1494
                 $item = utf8_encode($item);
1495 1495
             }
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1512 1512
 {
1513 1513
     // Load superglobal
1514
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1514
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1515 1515
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1516 1516
     // Get superglobals
1517 1517
     if ($key !== null) {
@@ -1522,9 +1522,9 @@  discard block
 block discarded – undo
1522 1522
     }
1523 1523
 
1524 1524
     //load ClassLoader
1525
-    include_once $teampassDir . '/sources/SplClassLoader.php';
1525
+    include_once $teampassDir.'/sources/SplClassLoader.php';
1526 1526
     //Load AES
1527
-    $aes = new SplClassLoader('Encryption\Crypt', $teampassDir . '/includes/libraries');
1527
+    $aes = new SplClassLoader('Encryption\Crypt', $teampassDir.'/includes/libraries');
1528 1528
     $aes->register();
1529 1529
     if ($type === 'encode' && is_array($data) === true) {
1530 1530
         // Ensure UTF8 format
@@ -1598,8 +1598,8 @@  discard block
 block discarded – undo
1598 1598
  */
1599 1599
 function prefixTable(string $table): string
1600 1600
 {
1601
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1602
-    if (! empty($safeTable)) {
1601
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1602
+    if (!empty($safeTable)) {
1603 1603
         // sanitize string
1604 1604
         return $safeTable;
1605 1605
     }
@@ -1629,13 +1629,13 @@  discard block
 block discarded – undo
1629 1629
     bool $lowercase = false,
1630 1630
     array $SETTINGS = []
1631 1631
 ): string {
1632
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1633
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1632
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1633
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1634 1634
     $generator->register();
1635 1635
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1636 1636
     // Is PHP7 being used?
1637 1637
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1638
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1638
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1639 1639
         $php7generator->register();
1640 1640
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1641 1641
     }
@@ -1670,7 +1670,7 @@  discard block
 block discarded – undo
1670 1670
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1671 1671
 {
1672 1672
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1673
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1673
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1674 1674
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1675 1675
     socket_close($sock);
1676 1676
 }
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
     }
1695 1695
 
1696 1696
     // include librairies & connect to DB
1697
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1697
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1698 1698
     if (defined('DB_PASSWD_CLEAR') === false) {
1699 1699
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1700 1700
     }
@@ -1720,14 +1720,14 @@  discard block
 block discarded – undo
1720 1720
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1721 1721
         if ($type === 'user_mngt') {
1722 1722
             send_syslog(
1723
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1723
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1724 1724
                 $SETTINGS['syslog_host'],
1725 1725
                 $SETTINGS['syslog_port'],
1726 1726
                 'teampass'
1727 1727
             );
1728 1728
         } else {
1729 1729
             send_syslog(
1730
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1730
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1731 1731
                 $SETTINGS['syslog_host'],
1732 1732
                 $SETTINGS['syslog_port'],
1733 1733
                 'teampass'
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
     ?string $encryption_type = null
1762 1762
 ): void {
1763 1763
     // include librairies & connect to DB
1764
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1764
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1765 1765
     if (defined('DB_PASSWD_CLEAR') === false) {
1766 1766
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1767 1767
     }
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
         if (empty($item_label) === true) {
1808 1808
             $dataItem = DB::queryfirstrow(
1809 1809
                 'SELECT id, id_tree, label
1810
-                FROM ' . prefixTable('items') . '
1810
+                FROM ' . prefixTable('items').'
1811 1811
                 WHERE id = %i',
1812 1812
                 $item_id
1813 1813
             );
@@ -1815,11 +1815,11 @@  discard block
 block discarded – undo
1815 1815
         }
1816 1816
 
1817 1817
         send_syslog(
1818
-            'action=' . str_replace('at_', '', $action) .
1819
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1820
-                ' itemno=' . $item_id .
1821
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1822
-                ' itemname="' . addslashes($item_label) . '"',
1818
+            'action='.str_replace('at_', '', $action).
1819
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1820
+                ' itemno='.$item_id.
1821
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1822
+                ' itemname="'.addslashes($item_label).'"',
1823 1823
             $SETTINGS['syslog_host'],
1824 1824
             $SETTINGS['syslog_port'],
1825 1825
             'teampass'
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
         && $action === 'at_shown'
1848 1848
     ) {
1849 1849
         // Load superglobal
1850
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1850
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1851 1851
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1852 1852
         // Get superglobals
1853 1853
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
         // Get info about item
1857 1857
         $dataItem = DB::queryfirstrow(
1858 1858
             'SELECT id, id_tree, label
1859
-            FROM ' . prefixTable('items') . '
1859
+            FROM ' . prefixTable('items').'
1860 1860
             WHERE id = %i',
1861 1861
             $item_id
1862 1862
         );
@@ -1870,9 +1870,9 @@  discard block
 block discarded – undo
1870 1870
                 'body' => str_replace(
1871 1871
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1872 1872
                     [
1873
-                        addslashes($globalsName . ' ' . $globalsLastname),
1873
+                        addslashes($globalsName.' '.$globalsLastname),
1874 1874
                         addslashes($item_label),
1875
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1875
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1876 1876
                     ],
1877 1877
                     langHdl('email_on_open_notification_mail')
1878 1878
                 ),
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1897 1897
 {
1898 1898
     // Load superglobal
1899
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1899
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1900 1900
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1901 1901
     // Get superglobals
1902 1902
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1906,8 +1906,8 @@  discard block
 block discarded – undo
1906 1906
     $notification = DB::queryOneColumn(
1907 1907
         'email',
1908 1908
         'SELECT *
1909
-        FROM ' . prefixTable('notification') . ' AS n
1910
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1909
+        FROM ' . prefixTable('notification').' AS n
1910
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1911 1911
         WHERE n.item_id = %i AND n.user_id != %i',
1912 1912
         $item_id,
1913 1913
         $globalsUserId
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
         // Get list of changes
1919 1919
         $htmlChanges = '<ul>';
1920 1920
         foreach ($changes as $change) {
1921
-            $htmlChanges .= '<li>' . $change . '</li>';
1921
+            $htmlChanges .= '<li>'.$change.'</li>';
1922 1922
         }
1923 1923
         $htmlChanges .= '</ul>';
1924 1924
         // send email
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1952 1952
 {
1953 1953
     // Class loader
1954
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1954
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1955 1955
     //Load Tree
1956 1956
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1957 1957
     $tree->register();
@@ -1960,15 +1960,15 @@  discard block
 block discarded – undo
1960 1960
     $path = '';
1961 1961
     foreach ($arbo as $elem) {
1962 1962
         if (empty($path) === true) {
1963
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1963
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1964 1964
         } else {
1965
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1965
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1966 1966
         }
1967 1967
     }
1968 1968
 
1969 1969
     // Build text to show user
1970 1970
     if (empty($label) === false) {
1971
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1971
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1972 1972
     }
1973 1973
     return empty($path) === true ? '' : $path;
1974 1974
 }
@@ -2025,9 +2025,9 @@  discard block
 block discarded – undo
2025 2025
  */
2026 2026
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2027 2027
 {
2028
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2028
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2029 2029
     // include librairies & connect to DB
2030
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2030
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2031 2031
     if (defined('DB_PASSWD_CLEAR') === false) {
2032 2032
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2033 2033
     }
@@ -2042,8 +2042,8 @@  discard block
 block discarded – undo
2042 2042
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2043 2043
         // perform a copy
2044 2044
         if (file_exists($tp_config_file)) {
2045
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2046
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2045
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2046
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2047 2047
             }
2048 2048
         }
2049 2049
 
@@ -2053,11 +2053,11 @@  discard block
 block discarded – undo
2053 2053
         $data[1] = "global \$SETTINGS;\n";
2054 2054
         $data[2] = "\$SETTINGS = array (\n";
2055 2055
         $rows = DB::query(
2056
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2056
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2057 2057
             'admin'
2058 2058
         );
2059 2059
         foreach ($rows as $record) {
2060
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2060
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2061 2061
         }
2062 2062
         array_push($data, ");\n");
2063 2063
         $data = array_unique($data);
@@ -2071,15 +2071,15 @@  discard block
 block discarded – undo
2071 2071
                 break;
2072 2072
             }
2073 2073
 
2074
-            if (stristr($line, "'" . $field . "' => '")) {
2075
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2074
+            if (stristr($line, "'".$field."' => '")) {
2075
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2076 2076
                 $bFound = true;
2077 2077
                 break;
2078 2078
             }
2079 2079
             ++$inc;
2080 2080
         }
2081 2081
         if ($bFound === false) {
2082
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2082
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2083 2083
         }
2084 2084
     }
2085 2085
 
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
 {
2110 2110
     global $SETTINGS;
2111 2111
     /* LOAD CPASSMAN SETTINGS */
2112
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2112
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2113 2113
         $SETTINGS = [];
2114 2114
         $SETTINGS['duplicate_folder'] = 0;
2115 2115
         //by default, this is set to 0;
@@ -2119,7 +2119,7 @@  discard block
 block discarded – undo
2119 2119
         //by default, this value is set to 5;
2120 2120
         $settings = [];
2121 2121
         $rows = DB::query(
2122
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2122
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2123 2123
             [
2124 2124
                 'type' => 'admin',
2125 2125
                 'type2' => 'settings',
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
     $source_cf = [];
2152 2152
     $rows = DB::QUERY(
2153 2153
         'SELECT id_category
2154
-            FROM ' . prefixTable('categories_folders') . '
2154
+            FROM ' . prefixTable('categories_folders').'
2155 2155
             WHERE id_folder = %i',
2156 2156
         $source_id
2157 2157
     );
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
     $target_cf = [];
2163 2163
     $rows = DB::QUERY(
2164 2164
         'SELECT id_category
2165
-            FROM ' . prefixTable('categories_folders') . '
2165
+            FROM ' . prefixTable('categories_folders').'
2166 2166
             WHERE id_folder = %i',
2167 2167
         $target_id
2168 2168
     );
@@ -2197,9 +2197,9 @@  discard block
 block discarded – undo
2197 2197
     string $password = null
2198 2198
 ) {
2199 2199
     // Load AntiXSS
2200
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2201
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2202
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2200
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2201
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2202
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2203 2203
     $antiXss = new voku\helper\AntiXSS();
2204 2204
     // Protect against bad inputs
2205 2205
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
     $target_file = $antiXss->xss_clean($target_file);
2212 2212
     if (empty($password) === true || is_null($password) === true) {
2213 2213
         // get KEY to define password
2214
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2214
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2215 2215
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2216 2216
     }
2217 2217
 
@@ -2256,15 +2256,15 @@  discard block
 block discarded – undo
2256 2256
 ) {
2257 2257
     // load PhpEncryption library
2258 2258
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2259
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2260
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2261
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2262
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2263
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2264
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2265
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2266
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2267
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2259
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2260
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2261
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2262
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2263
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2264
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2265
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2266
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2267
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2268 2268
     try {
2269 2269
         \Defuse\Crypto\File::encryptFileWithPassword(
2270 2270
             $source_file,
@@ -2301,15 +2301,15 @@  discard block
 block discarded – undo
2301 2301
 ) {
2302 2302
     // load PhpEncryption library
2303 2303
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2304
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2305
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2306
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2307
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2308
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2309
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2310
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2311
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2312
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2304
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2305
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2306
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2307
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2308
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2309
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2310
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2311
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2312
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2313 2313
     try {
2314 2314
         \Defuse\Crypto\File::decryptFileWithPassword(
2315 2315
             $source_file,
@@ -2356,9 +2356,9 @@  discard block
 block discarded – undo
2356 2356
 function fileDelete(string $file, array $SETTINGS): void
2357 2357
 {
2358 2358
     // Load AntiXSS
2359
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2360
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2361
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2359
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2360
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2361
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2362 2362
     $antiXss = new voku\helper\AntiXSS();
2363 2363
     $file = $antiXss->xss_clean($file);
2364 2364
     if (is_file($file)) {
@@ -2408,7 +2408,7 @@  discard block
 block discarded – undo
2408 2408
     int  $dirPerm = 0755
2409 2409
 ) {
2410 2410
     // Check if the path exists
2411
-    if (! file_exists($path)) {
2411
+    if (!file_exists($path)) {
2412 2412
         return false;
2413 2413
     }
2414 2414
 
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
  */
2447 2447
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2448 2448
 {
2449
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2449
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2450 2450
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2451 2451
     // Prepare superGlobal variables
2452 2452
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2454,7 +2454,7 @@  discard block
 block discarded – undo
2454 2454
     // Load item data
2455 2455
     $data = DB::queryFirstRow(
2456 2456
         'SELECT id_tree
2457
-        FROM ' . prefixTable('items') . '
2457
+        FROM ' . prefixTable('items').'
2458 2458
         WHERE id = %i',
2459 2459
         $item_id
2460 2460
     );
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
         }
2518 2518
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2519 2519
     }
2520
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2520
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2521 2521
     return $email;
2522 2522
 }
2523 2523
 
@@ -2533,8 +2533,8 @@  discard block
 block discarded – undo
2533 2533
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2534 2534
 {
2535 2535
     // include librairies & connect to DB
2536
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2537
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2536
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2537
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2538 2538
     if (defined('DB_PASSWD_CLEAR') === false) {
2539 2539
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2540 2540
     }
@@ -2548,7 +2548,7 @@  discard block
 block discarded – undo
2548 2548
     DB::$connect_options = DB_CONNECT_OPTIONS;
2549 2549
     // Insert log in DB
2550 2550
     return DB::query(
2551
-        'SELECT ' . $fields . '
2551
+        'SELECT '.$fields.'
2552 2552
         FROM ' . prefixTable($table)
2553 2553
     );
2554 2554
 }
@@ -2563,11 +2563,11 @@  discard block
 block discarded – undo
2563 2563
 function formatSizeUnits(int $bytes): string
2564 2564
 {
2565 2565
     if ($bytes >= 1073741824) {
2566
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2566
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2567 2567
     } elseif ($bytes >= 1048576) {
2568
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2568
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2569 2569
     } elseif ($bytes >= 1024) {
2570
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2570
+        $bytes = number_format($bytes / 1024, 2).' KB';
2571 2571
     } elseif ($bytes > 1) {
2572 2572
         $bytes .= ' bytes';
2573 2573
     } elseif ($bytes === 1) {
@@ -2776,14 +2776,14 @@  discard block
 block discarded – undo
2776 2776
 
2777 2777
     // Encrypt the file content
2778 2778
     $plaintext = file_get_contents(
2779
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2779
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2780 2780
     );
2781 2781
     $ciphertext = $cipher->encrypt($plaintext);
2782 2782
     // Save new file
2783 2783
     $hash = md5($plaintext);
2784
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2784
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2785 2785
     file_put_contents($fileOut, $ciphertext);
2786
-    unlink($fileInPath . '/' . $fileInName);
2786
+    unlink($fileInPath.'/'.$fileInName);
2787 2787
     return [
2788 2788
         'fileHash' => base64_encode($hash),
2789 2789
         'objectKey' => base64_encode($objectKey),
@@ -2801,7 +2801,7 @@  discard block
 block discarded – undo
2801 2801
  */
2802 2802
 function decryptFile(string $fileName, string $filePath, string $key): string
2803 2803
 {
2804
-    if (! defined('FILE_BUFFER_SIZE')) {
2804
+    if (!defined('FILE_BUFFER_SIZE')) {
2805 2805
         define('FILE_BUFFER_SIZE', 128 * 1024);
2806 2806
     }
2807 2807
 
@@ -2820,7 +2820,7 @@  discard block
 block discarded – undo
2820 2820
     $cipher->enableContinuousBuffer();
2821 2821
     $cipher->disablePadding();
2822 2822
     // Get file content
2823
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2823
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2824 2824
     // Decrypt file content and return
2825 2825
     return base64_encode($cipher->decrypt($ciphertext));
2826 2826
 }
@@ -2874,8 +2874,8 @@  discard block
 block discarded – undo
2874 2874
     array $SETTINGS
2875 2875
 ): void {
2876 2876
     // include librairies & connect to DB
2877
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2878
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2877
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2878
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2879 2879
     if (defined('DB_PASSWD_CLEAR') === false) {
2880 2880
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2881 2881
     }
@@ -2894,7 +2894,7 @@  discard block
 block discarded – undo
2894 2894
         $post_object_id
2895 2895
     );
2896 2896
     // Superglobals
2897
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2897
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2898 2898
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2899 2899
     // Prepare superGlobal variables
2900 2900
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2919,8 +2919,8 @@  discard block
 block discarded – undo
2919 2919
         // Create sharekey for each user
2920 2920
         $users = DB::query(
2921 2921
             'SELECT id, public_key
2922
-            FROM ' . prefixTable('users') . '
2923
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2922
+            FROM ' . prefixTable('users').'
2923
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2924 2924
             AND public_key != ""'
2925 2925
         );
2926 2926
         foreach ($users as $user) {
@@ -2950,7 +2950,7 @@  discard block
 block discarded – undo
2950 2950
 function isBase64(string $str): bool
2951 2951
 {
2952 2952
     $str = (string) trim($str);
2953
-    if (! isset($str[0])) {
2953
+    if (!isset($str[0])) {
2954 2954
         return false;
2955 2955
     }
2956 2956
 
@@ -3018,12 +3018,12 @@  discard block
 block discarded – undo
3018 3018
         ],
3019 3019
     ];
3020 3020
     // Load expected libraries
3021
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3022
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3023
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3024
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3025
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3026
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3021
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3022
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3023
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3024
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3025
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3026
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3027 3027
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3028 3028
     $ad->register();
3029 3029
     $connection = new Connection($config);
@@ -3032,7 +3032,7 @@  discard block
 block discarded – undo
3032 3032
         $connection->connect();
3033 3033
     } catch (\LdapRecord\Auth\BindException $e) {
3034 3034
         $error = $e->getDetailedError();
3035
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3035
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3036 3036
         return false;
3037 3037
     }
3038 3038
 
@@ -3045,7 +3045,7 @@  discard block
 block discarded – undo
3045 3045
         }
3046 3046
     } catch (\LdapRecord\Auth\BindException $e) {
3047 3047
         $error = $e->getDetailedError();
3048
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3048
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3049 3049
         return false;
3050 3050
     }
3051 3051
 
@@ -3063,8 +3063,8 @@  discard block
 block discarded – undo
3063 3063
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3064 3064
 {
3065 3065
     // include librairies & connect to DB
3066
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3067
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3066
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3067
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3068 3068
     if (defined('DB_PASSWD_CLEAR') === false) {
3069 3069
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3070 3070
     }
@@ -3124,7 +3124,7 @@  discard block
 block discarded – undo
3124 3124
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3125 3125
             $now->setTimezone(new DateTimeZone($timezone));
3126 3126
             $offsets[] = $offset = $now->getOffset();
3127
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3127
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3128 3128
         }
3129 3129
 
3130 3130
         array_multisort($offsets, $timezones);
@@ -3144,7 +3144,7 @@  discard block
 block discarded – undo
3144 3144
 {
3145 3145
     $hours = intval($offset / 3600);
3146 3146
     $minutes = abs(intval($offset % 3600 / 60));
3147
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3147
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3148 3148
 }
3149 3149
 
3150 3150
 /**
@@ -3247,8 +3247,7 @@  discard block
 block discarded – undo
3247 3247
 {
3248 3248
     if (isset($array[$key]) === true
3249 3249
         && (is_int($value) === true ?
3250
-            (int) $array[$key] === $value :
3251
-            (string) $array[$key] === $value)
3250
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3252 3251
     ) {
3253 3252
         return true;
3254 3253
     }
@@ -3270,8 +3269,7 @@  discard block
 block discarded – undo
3270 3269
 {
3271 3270
     if (isset($var) === false
3272 3271
         || (is_int($value) === true ?
3273
-            (int) $var === $value :
3274
-            (string) $var === $value)
3272
+            (int) $var === $value : (string) $var === $value)
3275 3273
     ) {
3276 3274
         return true;
3277 3275
     }
@@ -3322,7 +3320,7 @@  discard block
 block discarded – undo
3322 3320
  */
3323 3321
 function isSetArrayOfValues(array $arrayOfValues): bool
3324 3322
 {
3325
-    foreach($arrayOfValues as $value) {
3323
+    foreach ($arrayOfValues as $value) {
3326 3324
         if (isset($value) === false) {
3327 3325
             return false;
3328 3326
         }
@@ -3344,7 +3342,7 @@  discard block
 block discarded – undo
3344 3342
     /*PHP8 - integer|string*/$value
3345 3343
 ) : bool
3346 3344
 {
3347
-    foreach($arrayOfVars as $variable) {
3345
+    foreach ($arrayOfVars as $variable) {
3348 3346
         if ($variable !== $value) {
3349 3347
             return false;
3350 3348
         }
@@ -3364,7 +3362,7 @@  discard block
 block discarded – undo
3364 3362
     /*PHP8 - integer|string*/$value
3365 3363
 ) : bool
3366 3364
 {
3367
-    foreach($arrayOfVars as $variable) {
3365
+    foreach ($arrayOfVars as $variable) {
3368 3366
         if ($variable === $value) {
3369 3367
             return true;
3370 3368
         }
@@ -3437,16 +3435,16 @@  discard block
 block discarded – undo
3437 3435
 ): array
3438 3436
 {
3439 3437
     // Load Sanitizer library
3440
-    require_once $path . '/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3441
-    require_once $path . '/includes/libraries/Illuminate/Support/Str.php';
3442
-    require_once $path . '/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3443
-    require_once $path . '/includes/libraries/Illuminate/Support/Arr.php';
3444
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3445
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3446
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3447
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3448
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3449
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3438
+    require_once $path.'/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3439
+    require_once $path.'/includes/libraries/Illuminate/Support/Str.php';
3440
+    require_once $path.'/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3441
+    require_once $path.'/includes/libraries/Illuminate/Support/Arr.php';
3442
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3443
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3444
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3445
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3446
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3447
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3450 3448
 
3451 3449
     // Sanitize post and get variables
3452 3450
     $sanitizer = new Elegant\sanitizer\Sanitizer($data, $filters);
@@ -3463,9 +3461,9 @@  discard block
 block discarded – undo
3463 3461
  */
3464 3462
 function cacheTreeUserHandler(int $user_id, string $data, array $SETTINGS)
3465 3463
 {
3466
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
3464
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
3467 3465
     //Connect to DB
3468
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3466
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3469 3467
     if (defined('DB_PASSWD_CLEAR') === false) {
3470 3468
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3471 3469
     }
@@ -3481,7 +3479,7 @@  discard block
 block discarded – undo
3481 3479
     // Exists ?
3482 3480
     $userCacheId = DB::queryfirstrow(
3483 3481
         'SELECT increment_id
3484
-        FROM ' . prefixTable('cache_tree') . '
3482
+        FROM ' . prefixTable('cache_tree').'
3485 3483
         WHERE user_id = %i',
3486 3484
         $user_id
3487 3485
     );
Please login to merge, or discard this patch.