Passed
Push — teampass_3.0 ( ae6be7...59a813 )
by Nils
04:28
created
sources/main.functions.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2226,7 +2226,7 @@
 block discarded – undo
2226 2226
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2227 2227
  *
2228 2228
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2229
-  *
2229
+ *
2230 2230
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2231 2231
  * @param int    $filePerm The permissions any found files should get.
2232 2232
  * @param int    $dirPerm  The permissions any found folder should get.
Please login to merge, or discard this 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
     // Check if user is ADMINISTRATOR
@@ -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');
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
     // Get list of folders depending on Roles
599 599
     $rows = DB::query(
600 600
         'SELECT *
601
-        FROM ' . prefixTable('roles_values') . '
601
+        FROM ' . prefixTable('roles_values').'
602 602
         WHERE role_id IN %li AND type IN %ls',
603 603
         $userRoles,
604 604
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -623,10 +623,10 @@  discard block
 block discarded – undo
623 623
     // Does this user is allowed to see other items
624 624
     $inc = 0;
625 625
     $rows = DB::query(
626
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
626
+        'SELECT id, id_tree FROM '.prefixTable('items').'
627 627
             WHERE restricted_to LIKE %ss AND inactif = %s'.
628 628
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
629
-        $globalsUserId . ';',
629
+        $globalsUserId.';',
630 630
         '0'
631 631
     );
632 632
     foreach ($rows as $record) {
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
     // Check for the users roles if some specific rights exist on items
641 641
     $rows = DB::query(
642 642
         'SELECT i.id_tree, r.item_id
643
-        FROM ' . prefixTable('items') . ' as i
644
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
643
+        FROM ' . prefixTable('items').' as i
644
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
645 645
         WHERE r.role_id IN %li AND i.id_tree <> ""
646 646
         ORDER BY i.id_tree ASC',
647 647
         $userRoles
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     ) {
663 663
         $persoFld = DB::queryfirstrow(
664 664
             'SELECT id
665
-            FROM ' . prefixTable('nested_tree') . '
665
+            FROM ' . prefixTable('nested_tree').'
666 666
             WHERE title = %s AND personal_folder = %i'.
667 667
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
668 668
             $globalsUserId,
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
     }
697 697
     $persoFlds = DB::query(
698 698
         'SELECT id
699
-        FROM ' . prefixTable('nested_tree') . '
699
+        FROM ' . prefixTable('nested_tree').'
700 700
         WHERE %l',
701 701
         $where
702 702
     );
@@ -737,16 +737,16 @@  discard block
 block discarded – undo
737 737
         'SESSION'
738 738
     );
739 739
     // Folders and Roles numbers
740
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
740
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
741 741
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
742
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
742
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
743 743
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
744 744
     // check if change proposals on User's items
745 745
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
746 746
         DB::query(
747 747
             'SELECT *
748
-            FROM ' . prefixTable('items_change') . ' AS c
749
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
748
+            FROM ' . prefixTable('items_change').' AS c
749
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
750 750
             WHERE i.action = %s AND i.id_user = %i',
751 751
             'at_creation',
752 752
             $globalsUserId
@@ -794,9 +794,9 @@  discard block
 block discarded – undo
794 794
  */
795 795
 function cacheTableRefresh(array $SETTINGS): void
796 796
 {
797
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
797
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
798 798
     //Connect to DB
799
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
799
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
800 800
     if (defined('DB_PASSWD_CLEAR') === false) {
801 801
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
802 802
     }
@@ -811,12 +811,12 @@  discard block
 block discarded – undo
811 811
     $tree->register();
812 812
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
813 813
     // truncate table
814
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
814
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
815 815
     // reload date
816 816
     $rows = DB::query(
817 817
         'SELECT *
818
-        FROM ' . prefixTable('items') . ' as i
819
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
818
+        FROM ' . prefixTable('items').' as i
819
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
820 820
         AND l.action = %s
821 821
         AND i.inactif = %i',
822 822
         'at_creation',
@@ -828,18 +828,18 @@  discard block
 block discarded – undo
828 828
             $tags = '';
829 829
             $itemTags = DB::query(
830 830
                 'SELECT tag
831
-                            FROM ' . prefixTable('tags') . '
831
+                            FROM ' . prefixTable('tags').'
832 832
                             WHERE item_id = %i AND tag != ""',
833 833
                 $record['id']
834 834
             );
835 835
             foreach ($itemTags as $itemTag) {
836
-                $tags .= $itemTag['tag'] . ' ';
836
+                $tags .= $itemTag['tag'].' ';
837 837
             }
838 838
 
839 839
             // Get renewal period
840 840
             $resNT = DB::queryfirstrow(
841 841
                 'SELECT renewal_period
842
-                FROM ' . prefixTable('nested_tree') . '
842
+                FROM ' . prefixTable('nested_tree').'
843 843
                 WHERE id = %i',
844 844
                 $record['id_tree']
845 845
             );
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
                     // Is this a User id?
853 853
                     $user = DB::queryfirstrow(
854 854
                         'SELECT id, login
855
-                        FROM ' . prefixTable('users') . '
855
+                        FROM ' . prefixTable('users').'
856 856
                         WHERE id = %i',
857 857
                         $elem->title
858 858
                     );
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
                     'id' => $record['id'],
871 871
                     'label' => $record['label'],
872 872
                     'description' => $record['description'] ?? '',
873
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
873
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
874 874
                     'tags' => $tags,
875 875
                     'id_tree' => $record['id_tree'],
876 876
                     'perso' => $record['perso'],
877
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
877
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
878 878
                     'login' => $record['login'] ?? '',
879 879
                     'folder' => implode(' > ', $folder),
880 880
                     'author' => $record['id_user'],
@@ -896,12 +896,12 @@  discard block
 block discarded – undo
896 896
  */
897 897
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
898 898
 {
899
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
899
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
900 900
     // Load superglobal
901
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
901
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
902 902
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
903 903
     //Connect to DB
904
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
904
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
905 905
     if (defined('DB_PASSWD_CLEAR') === false) {
906 906
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
907 907
     }
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
     // get new value from db
919 919
     $data = DB::queryfirstrow(
920 920
         'SELECT label, description, id_tree, perso, restricted_to, login, url
921
-        FROM ' . prefixTable('items') . '
921
+        FROM ' . prefixTable('items').'
922 922
         WHERE id=%i',
923 923
         $ident
924 924
     );
@@ -926,12 +926,12 @@  discard block
 block discarded – undo
926 926
     $tags = '';
927 927
     $itemTags = DB::query(
928 928
         'SELECT tag
929
-            FROM ' . prefixTable('tags') . '
929
+            FROM ' . prefixTable('tags').'
930 930
             WHERE item_id = %i AND tag != ""',
931 931
         $ident
932 932
     );
933 933
     foreach ($itemTags as $itemTag) {
934
-        $tags .= $itemTag['tag'] . ' ';
934
+        $tags .= $itemTag['tag'].' ';
935 935
     }
936 936
     // form id_tree to full foldername
937 937
     $folder = [];
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
             // Is this a User id?
943 943
             $user = DB::queryfirstrow(
944 944
                 'SELECT id, login
945
-                FROM ' . prefixTable('users') . '
945
+                FROM ' . prefixTable('users').'
946 946
                 WHERE id = %i',
947 947
                 $elem->title
948 948
             );
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
             'label' => $data['label'],
961 961
             'description' => $data['description'],
962 962
             'tags' => $tags,
963
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
963
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
964 964
             'id_tree' => $data['id_tree'],
965 965
             'perso' => $data['perso'],
966
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
966
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
967 967
             'login' => $data['login'] ?? '',
968 968
             'folder' => implode(' » ', $folder),
969 969
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -983,14 +983,14 @@  discard block
 block discarded – undo
983 983
  */
984 984
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
985 985
 {
986
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
986
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
987 987
     // Load superglobal
988
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
988
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
989 989
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
990 990
     // Get superglobals
991 991
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
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,8 +1007,8 @@  discard block
 block discarded – undo
1007 1007
     // get new value from db
1008 1008
     $data = DB::queryFirstRow(
1009 1009
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1010
-        FROM ' . prefixTable('items') . ' as i
1011
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1010
+        FROM ' . prefixTable('items').' as i
1011
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1012 1012
         WHERE i.id = %i
1013 1013
         AND l.action = %s',
1014 1014
         $ident,
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
     $tags = '';
1019 1019
     $itemTags = DB::query(
1020 1020
         'SELECT tag
1021
-            FROM ' . prefixTable('tags') . '
1021
+            FROM ' . prefixTable('tags').'
1022 1022
             WHERE item_id = %i AND tag != ""',
1023 1023
         $ident
1024 1024
     );
1025 1025
     foreach ($itemTags as $itemTag) {
1026
-        $tags .= $itemTag['tag'] . ' ';
1026
+        $tags .= $itemTag['tag'].' ';
1027 1027
     }
1028 1028
     // form id_tree to full foldername
1029 1029
     $folder = [];
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
             // Is this a User id?
1035 1035
             $user = DB::queryfirstrow(
1036 1036
                 'SELECT id, login
1037
-                FROM ' . prefixTable('users') . '
1037
+                FROM ' . prefixTable('users').'
1038 1038
                 WHERE id = %i',
1039 1039
                 $elem->title
1040 1040
             );
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
             'label' => $data['label'],
1054 1054
             'description' => $data['description'],
1055 1055
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1056
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1056
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1057 1057
             'id_tree' => $data['id_tree'],
1058 1058
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1059 1059
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1075,52 +1075,52 @@  discard block
 block discarded – undo
1075 1075
 function getStatisticsData(array $SETTINGS): array
1076 1076
 {
1077 1077
     DB::query(
1078
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1078
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1079 1079
         0
1080 1080
     );
1081 1081
     $counter_folders = DB::count();
1082 1082
     DB::query(
1083
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1083
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1084 1084
         1
1085 1085
     );
1086 1086
     $counter_folders_perso = DB::count();
1087 1087
     DB::query(
1088
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1088
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1089 1089
         0
1090 1090
     );
1091 1091
     $counter_items = DB::count();
1092 1092
         DB::query(
1093
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1093
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1094 1094
         1
1095 1095
     );
1096 1096
     $counter_items_perso = DB::count();
1097 1097
         DB::query(
1098
-        'SELECT id FROM ' . prefixTable('users') . ''
1098
+        'SELECT id FROM '.prefixTable('users').''
1099 1099
     );
1100 1100
     $counter_users = DB::count();
1101 1101
         DB::query(
1102
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1102
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1103 1103
         1
1104 1104
     );
1105 1105
     $admins = DB::count();
1106 1106
     DB::query(
1107
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1107
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1108 1108
         1
1109 1109
     );
1110 1110
     $managers = DB::count();
1111 1111
     DB::query(
1112
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1112
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1113 1113
         1
1114 1114
     );
1115 1115
     $readOnly = DB::count();
1116 1116
     // list the languages
1117 1117
     $usedLang = [];
1118 1118
     $tp_languages = DB::query(
1119
-        'SELECT name FROM ' . prefixTable('languages')
1119
+        'SELECT name FROM '.prefixTable('languages')
1120 1120
     );
1121 1121
     foreach ($tp_languages as $tp_language) {
1122 1122
         DB::query(
1123
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1123
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1124 1124
             $tp_language['name']
1125 1125
         );
1126 1126
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1129,12 +1129,12 @@  discard block
 block discarded – undo
1129 1129
     // get list of ips
1130 1130
     $usedIp = [];
1131 1131
     $tp_ips = DB::query(
1132
-        'SELECT user_ip FROM ' . prefixTable('users')
1132
+        'SELECT user_ip FROM '.prefixTable('users')
1133 1133
     );
1134 1134
     foreach ($tp_ips as $ip) {
1135 1135
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1136 1136
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1137
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1137
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1138 1138
             $usedIp[$ip['user_ip']] = 1;
1139 1139
         }
1140 1140
     }
@@ -1200,14 +1200,14 @@  discard block
 block discarded – undo
1200 1200
     }
1201 1201
 
1202 1202
     // Load settings
1203
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1203
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1204 1204
     // Load superglobal
1205
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1205
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1206 1206
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1207 1207
     // Get user language
1208
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1208
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1209 1209
     // Load library
1210
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1210
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1211 1211
     // load PHPMailer
1212 1212
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1213 1213
     $mail->register();
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
     
1216 1216
     try {
1217 1217
         // send to user
1218
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1218
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1219 1219
         $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1220 1220
         $mail->Port = $SETTINGS['email_port'];
1221 1221
         //COULD BE USED
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
         <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;">
1316 1316
         <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;">
1317 1317
         <br><div style="float:right;">' .
1318
-        $textMail .
1318
+        $textMail.
1319 1319
         '<br><br></td></tr></table>
1320 1320
     </td></tr></table>
1321 1321
     <br></body></html>';
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
  */
1329 1329
 function generateKey(): string
1330 1330
 {
1331
-    return substr(md5(rand() . rand()), 0, 15);
1331
+    return substr(md5(rand().rand()), 0, 15);
1332 1332
 }
1333 1333
 
1334 1334
 /**
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 {
1400 1400
     array_walk_recursive(
1401 1401
         $array,
1402
-        static function (&$item): void {
1402
+        static function(&$item): void {
1403 1403
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1404 1404
                 $item = utf8_encode($item);
1405 1405
             }
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
     }
1435 1435
 
1436 1436
     // Load superglobal
1437
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1437
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1438 1438
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1439 1439
     // Get superglobals
1440 1440
     if ($key !== null) {
@@ -1445,9 +1445,9 @@  discard block
 block discarded – undo
1445 1445
     }
1446 1446
 
1447 1447
     //load ClassLoader
1448
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1448
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1449 1449
     //Load AES
1450
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1450
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1451 1451
     $aes->register();
1452 1452
     if ($type === 'encode' && is_array($data) === true) {
1453 1453
         // Ensure UTF8 format
@@ -1521,8 +1521,8 @@  discard block
 block discarded – undo
1521 1521
  */
1522 1522
 function prefixTable(string $table): string
1523 1523
 {
1524
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1525
-    if (! empty($safeTable)) {
1524
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1525
+    if (!empty($safeTable)) {
1526 1526
         // sanitize string
1527 1527
         return $safeTable;
1528 1528
     }
@@ -1552,13 +1552,13 @@  discard block
 block discarded – undo
1552 1552
     bool $lowercase = false,
1553 1553
     array $SETTINGS = []
1554 1554
 ): string {
1555
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1556
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1555
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1556
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1557 1557
     $generator->register();
1558 1558
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1559 1559
     // Is PHP7 being used?
1560 1560
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1561
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1561
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1562 1562
         $php7generator->register();
1563 1563
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1564 1564
     }
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1594 1594
 {
1595 1595
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1596
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1596
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1597 1597
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1598 1598
     socket_close($sock);
1599 1599
 }
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
     }
1618 1618
 
1619 1619
     // include librairies & connect to DB
1620
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1620
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1621 1621
     if (defined('DB_PASSWD_CLEAR') === false) {
1622 1622
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1623 1623
     }
@@ -1641,14 +1641,14 @@  discard block
 block discarded – undo
1641 1641
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1642 1642
         if ($type === 'user_mngt') {
1643 1643
             send_syslog(
1644
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1644
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1645 1645
                 $SETTINGS['syslog_host'],
1646 1646
                 $SETTINGS['syslog_port'],
1647 1647
                 'teampass'
1648 1648
             );
1649 1649
         } else {
1650 1650
             send_syslog(
1651
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1651
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1652 1652
                 $SETTINGS['syslog_host'],
1653 1653
                 $SETTINGS['syslog_port'],
1654 1654
                 'teampass'
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
     ?string $encryption_type = null
1683 1683
 ): void {
1684 1684
     // include librairies & connect to DB
1685
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1685
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1686 1686
     if (defined('DB_PASSWD_CLEAR') === false) {
1687 1687
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1688 1688
     }
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
         if (empty($item_label) === true) {
1727 1727
             $dataItem = DB::queryfirstrow(
1728 1728
                 'SELECT id, id_tree, label
1729
-                FROM ' . prefixTable('items') . '
1729
+                FROM ' . prefixTable('items').'
1730 1730
                 WHERE id = %i',
1731 1731
                 $item_id
1732 1732
             );
@@ -1734,11 +1734,11 @@  discard block
 block discarded – undo
1734 1734
         }
1735 1735
 
1736 1736
         send_syslog(
1737
-            'action=' . str_replace('at_', '', $action) .
1738
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1739
-                ' itemno=' . $item_id .
1740
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1741
-                ' itemname="' . addslashes($item_label) . '"',
1737
+            'action='.str_replace('at_', '', $action).
1738
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1739
+                ' itemno='.$item_id.
1740
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1741
+                ' itemname="'.addslashes($item_label).'"',
1742 1742
             $SETTINGS['syslog_host'],
1743 1743
             $SETTINGS['syslog_port'],
1744 1744
             'teampass'
@@ -1766,7 +1766,7 @@  discard block
 block discarded – undo
1766 1766
         && $action === 'at_shown'
1767 1767
     ) {
1768 1768
         // Load superglobal
1769
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1769
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1770 1770
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1771 1771
         // Get superglobals
1772 1772
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
         // Get info about item
1776 1776
         $dataItem = DB::queryfirstrow(
1777 1777
             'SELECT id, id_tree, label
1778
-            FROM ' . prefixTable('items') . '
1778
+            FROM ' . prefixTable('items').'
1779 1779
             WHERE id = %i',
1780 1780
             $item_id
1781 1781
         );
@@ -1789,9 +1789,9 @@  discard block
 block discarded – undo
1789 1789
                 'body' => str_replace(
1790 1790
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1791 1791
                     [
1792
-                        addslashes($globalsName . ' ' . $globalsLastname),
1792
+                        addslashes($globalsName.' '.$globalsLastname),
1793 1793
                         addslashes($item_label),
1794
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1794
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1795 1795
                     ],
1796 1796
                     langHdl('email_on_open_notification_mail')
1797 1797
                 ),
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1816 1816
 {
1817 1817
     // Load superglobal
1818
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1818
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1819 1819
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1820 1820
     // Get superglobals
1821 1821
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1825,8 +1825,8 @@  discard block
 block discarded – undo
1825 1825
     $notification = DB::queryOneColumn(
1826 1826
         'email',
1827 1827
         'SELECT *
1828
-        FROM ' . prefixTable('notification') . ' AS n
1829
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1828
+        FROM ' . prefixTable('notification').' AS n
1829
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1830 1830
         WHERE n.item_id = %i AND n.user_id != %i',
1831 1831
         $item_id,
1832 1832
         $globalsUserId
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
         // Get list of changes
1838 1838
         $htmlChanges = '<ul>';
1839 1839
         foreach ($changes as $change) {
1840
-            $htmlChanges .= '<li>' . $change . '</li>';
1840
+            $htmlChanges .= '<li>'.$change.'</li>';
1841 1841
         }
1842 1842
         $htmlChanges .= '</ul>';
1843 1843
         // send email
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1871 1871
 {
1872 1872
     // Class loader
1873
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1873
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1874 1874
     //Load Tree
1875 1875
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1876 1876
     $tree->register();
@@ -1879,15 +1879,15 @@  discard block
 block discarded – undo
1879 1879
     $path = '';
1880 1880
     foreach ($arbo as $elem) {
1881 1881
         if (empty($path) === true) {
1882
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1882
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1883 1883
         } else {
1884
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1884
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1885 1885
         }
1886 1886
     }
1887 1887
 
1888 1888
     // Build text to show user
1889 1889
     if (empty($label) === false) {
1890
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1890
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1891 1891
     }
1892 1892
     return empty($path) === true ? '' : $path;
1893 1893
 }
@@ -1944,9 +1944,9 @@  discard block
 block discarded – undo
1944 1944
  */
1945 1945
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1946 1946
 {
1947
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1947
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1948 1948
     // include librairies & connect to DB
1949
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1949
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1950 1950
     if (defined('DB_PASSWD_CLEAR') === false) {
1951 1951
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1952 1952
     }
@@ -1959,8 +1959,8 @@  discard block
 block discarded – undo
1959 1959
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1960 1960
         // perform a copy
1961 1961
         if (file_exists($tp_config_file)) {
1962
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1963
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1962
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1963
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1964 1964
             }
1965 1965
         }
1966 1966
 
@@ -1970,11 +1970,11 @@  discard block
 block discarded – undo
1970 1970
         $data[1] = "global \$SETTINGS;\n";
1971 1971
         $data[2] = "\$SETTINGS = array (\n";
1972 1972
         $rows = DB::query(
1973
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1973
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1974 1974
             'admin'
1975 1975
         );
1976 1976
         foreach ($rows as $record) {
1977
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
1977
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
1978 1978
         }
1979 1979
         array_push($data, ");\n");
1980 1980
         $data = array_unique($data);
@@ -1988,15 +1988,15 @@  discard block
 block discarded – undo
1988 1988
                 break;
1989 1989
             }
1990 1990
 
1991
-            if (stristr($line, "'" . $field . "' => '")) {
1992
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
1991
+            if (stristr($line, "'".$field."' => '")) {
1992
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
1993 1993
                 $bFound = true;
1994 1994
                 break;
1995 1995
             }
1996 1996
             ++$inc;
1997 1997
         }
1998 1998
         if ($bFound === false) {
1999
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
1999
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2000 2000
         }
2001 2001
     }
2002 2002
 
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
 {
2027 2027
     global $SETTINGS;
2028 2028
     /* LOAD CPASSMAN SETTINGS */
2029
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2029
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2030 2030
         $SETTINGS = [];
2031 2031
         $SETTINGS['duplicate_folder'] = 0;
2032 2032
         //by default, this is set to 0;
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
         //by default, this value is set to 5;
2037 2037
         $settings = [];
2038 2038
         $rows = DB::query(
2039
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2039
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2040 2040
             [
2041 2041
                 'type' => 'admin',
2042 2042
                 'type2' => 'settings',
@@ -2068,7 +2068,7 @@  discard block
 block discarded – undo
2068 2068
     $source_cf = [];
2069 2069
     $rows = DB::QUERY(
2070 2070
         'SELECT id_category
2071
-            FROM ' . prefixTable('categories_folders') . '
2071
+            FROM ' . prefixTable('categories_folders').'
2072 2072
             WHERE id_folder = %i',
2073 2073
         $source_id
2074 2074
     );
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
     $target_cf = [];
2080 2080
     $rows = DB::QUERY(
2081 2081
         'SELECT id_category
2082
-            FROM ' . prefixTable('categories_folders') . '
2082
+            FROM ' . prefixTable('categories_folders').'
2083 2083
             WHERE id_folder = %i',
2084 2084
         $target_id
2085 2085
     );
@@ -2114,9 +2114,9 @@  discard block
 block discarded – undo
2114 2114
     string $password = null
2115 2115
 ) {
2116 2116
     // Load AntiXSS
2117
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2118
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2119
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2117
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2118
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2119
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2120 2120
     $antiXss = new voku\helper\AntiXSS();
2121 2121
     // Protect against bad inputs
2122 2122
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
     $target_file = $antiXss->xss_clean($target_file);
2129 2129
     if (empty($password) === true || is_null($password) === true) {
2130 2130
         // get KEY to define password
2131
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2131
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2132 2132
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2133 2133
     }
2134 2134
 
@@ -2173,15 +2173,15 @@  discard block
 block discarded – undo
2173 2173
 ) {
2174 2174
     // load PhpEncryption library
2175 2175
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2176
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2177
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2178
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2179
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2180
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2181
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2182
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2183
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2184
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2176
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2177
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2178
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2179
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2180
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2181
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2182
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2183
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2184
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2185 2185
     try {
2186 2186
         \Defuse\Crypto\File::encryptFileWithPassword(
2187 2187
             $source_file,
@@ -2218,15 +2218,15 @@  discard block
 block discarded – undo
2218 2218
 ) {
2219 2219
     // load PhpEncryption library
2220 2220
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2221
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2222
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2223
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2224
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2225
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2226
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2227
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2228
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2229
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2221
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2222
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2223
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2224
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2225
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2226
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2227
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2228
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2229
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2230 2230
     try {
2231 2231
         \Defuse\Crypto\File::decryptFileWithPassword(
2232 2232
             $source_file,
@@ -2273,9 +2273,9 @@  discard block
 block discarded – undo
2273 2273
 function fileDelete(string $file, array $SETTINGS): void
2274 2274
 {
2275 2275
     // Load AntiXSS
2276
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2277
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2278
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2276
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2277
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2278
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2279 2279
     $antiXss = new voku\helper\AntiXSS();
2280 2280
     $file = $antiXss->xss_clean($file);
2281 2281
     if (is_file($file)) {
@@ -2325,7 +2325,7 @@  discard block
 block discarded – undo
2325 2325
     int  $dirPerm = 0755
2326 2326
 ) {
2327 2327
     // Check if the path exists
2328
-    if (! file_exists($path)) {
2328
+    if (!file_exists($path)) {
2329 2329
         return false;
2330 2330
     }
2331 2331
 
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
  */
2364 2364
 function accessToItemIsGranted(int $item_id, array $SETTINGS): bool
2365 2365
 {
2366
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2366
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2367 2367
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2368 2368
     // Prepare superGlobal variables
2369 2369
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
     // Load item data
2372 2372
     $data = DB::queryFirstRow(
2373 2373
         'SELECT id_tree
2374
-        FROM ' . prefixTable('items') . '
2374
+        FROM ' . prefixTable('items').'
2375 2375
         WHERE id = %i',
2376 2376
         $item_id
2377 2377
     );
@@ -2448,8 +2448,8 @@  discard block
 block discarded – undo
2448 2448
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2449 2449
 {
2450 2450
     // include librairies & connect to DB
2451
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2452
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2451
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2452
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2453 2453
     if (defined('DB_PASSWD_CLEAR') === false) {
2454 2454
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2455 2455
     }
@@ -2461,7 +2461,7 @@  discard block
 block discarded – undo
2461 2461
     DB::$encoding = DB_ENCODING;
2462 2462
     // Insert log in DB
2463 2463
     return DB::query(
2464
-        'SELECT ' . $fields . '
2464
+        'SELECT '.$fields.'
2465 2465
         FROM ' . prefixTable($table)
2466 2466
     );
2467 2467
 }
@@ -2476,11 +2476,11 @@  discard block
 block discarded – undo
2476 2476
 function formatSizeUnits(int $bytes): string
2477 2477
 {
2478 2478
     if ($bytes >= 1073741824) {
2479
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2479
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2480 2480
     } elseif ($bytes >= 1048576) {
2481
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2481
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2482 2482
     } elseif ($bytes >= 1024) {
2483
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2483
+        $bytes = number_format($bytes / 1024, 2).' KB';
2484 2484
     } elseif ($bytes > 1) {
2485 2485
         $bytes .= ' bytes';
2486 2486
     } elseif ($bytes === 1) {
@@ -2681,14 +2681,14 @@  discard block
 block discarded – undo
2681 2681
 
2682 2682
     // Encrypt the file content
2683 2683
     $plaintext = file_get_contents(
2684
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2684
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2685 2685
     );
2686 2686
     $ciphertext = $cipher->encrypt($plaintext);
2687 2687
     // Save new file
2688 2688
     $hash = md5($plaintext);
2689
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2689
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2690 2690
     file_put_contents($fileOut, $ciphertext);
2691
-    unlink($fileInPath . '/' . $fileInName);
2691
+    unlink($fileInPath.'/'.$fileInName);
2692 2692
     return [
2693 2693
         'fileHash' => base64_encode($hash),
2694 2694
         'objectKey' => base64_encode($objectKey),
@@ -2706,7 +2706,7 @@  discard block
 block discarded – undo
2706 2706
  */
2707 2707
 function decryptFile(string $fileName, string $filePath, string $key): string
2708 2708
 {
2709
-    if (! defined('FILE_BUFFER_SIZE')) {
2709
+    if (!defined('FILE_BUFFER_SIZE')) {
2710 2710
         define('FILE_BUFFER_SIZE', 128 * 1024);
2711 2711
     }
2712 2712
 
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
     $cipher->enableContinuousBuffer();
2726 2726
     $cipher->disablePadding();
2727 2727
     // Get file content
2728
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2728
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2729 2729
     // Decrypt file content and return
2730 2730
     return base64_encode($cipher->decrypt($ciphertext));
2731 2731
 }
@@ -2779,8 +2779,8 @@  discard block
 block discarded – undo
2779 2779
     array $SETTINGS
2780 2780
 ): void {
2781 2781
     // include librairies & connect to DB
2782
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2783
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2782
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2783
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2784 2784
     if (defined('DB_PASSWD_CLEAR') === false) {
2785 2785
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2786 2786
     }
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
         $post_object_id
2798 2798
     );
2799 2799
     // Superglobals
2800
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2800
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2801 2801
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2802 2802
     // Prepare superGlobal variables
2803 2803
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2822,8 +2822,8 @@  discard block
 block discarded – undo
2822 2822
         // Create sharekey for each user
2823 2823
         $users = DB::query(
2824 2824
             'SELECT id, public_key
2825
-            FROM ' . prefixTable('users') . '
2826
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2825
+            FROM ' . prefixTable('users').'
2826
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2827 2827
             AND public_key != ""'
2828 2828
         );
2829 2829
         foreach ($users as $user) {
@@ -2853,7 +2853,7 @@  discard block
 block discarded – undo
2853 2853
 function isBase64(string $str): bool
2854 2854
 {
2855 2855
     $str = (string) trim($str);
2856
-    if (! isset($str[0])) {
2856
+    if (!isset($str[0])) {
2857 2857
         return false;
2858 2858
     }
2859 2859
 
@@ -2921,13 +2921,13 @@  discard block
 block discarded – undo
2921 2921
         ],
2922 2922
     ];
2923 2923
     // Load expected libraries
2924
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2925
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2926
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2927
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2928
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2929
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2930
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2924
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2925
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2926
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2927
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2928
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2929
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2930
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2931 2931
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2932 2932
     $ad->register();
2933 2933
     $connection = new Connection($config);
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
         $connection->connect();
2937 2937
     } catch (\LdapRecord\Auth\BindException $e) {
2938 2938
         $error = $e->getDetailedError();
2939
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2939
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2940 2940
         return false;
2941 2941
     }
2942 2942
 
@@ -2949,7 +2949,7 @@  discard block
 block discarded – undo
2949 2949
         }
2950 2950
     } catch (\LdapRecord\Auth\BindException $e) {
2951 2951
         $error = $e->getDetailedError();
2952
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2952
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2953 2953
         return false;
2954 2954
     }
2955 2955
 
@@ -2967,8 +2967,8 @@  discard block
 block discarded – undo
2967 2967
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
2968 2968
 {
2969 2969
     // include librairies & connect to DB
2970
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2971
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2970
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2971
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2972 2972
     if (defined('DB_PASSWD_CLEAR') === false) {
2973 2973
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2974 2974
     }
@@ -3026,7 +3026,7 @@  discard block
 block discarded – undo
3026 3026
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3027 3027
             $now->setTimezone(new DateTimeZone($timezone));
3028 3028
             $offsets[] = $offset = $now->getOffset();
3029
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3029
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3030 3030
         }
3031 3031
 
3032 3032
         array_multisort($offsets, $timezones);
@@ -3046,7 +3046,7 @@  discard block
 block discarded – undo
3046 3046
 {
3047 3047
     $hours = intval($offset / 3600);
3048 3048
     $minutes = abs(intval($offset % 3600 / 60));
3049
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3049
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3050 3050
 }
3051 3051
 
3052 3052
 /**
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
 }
@@ -124,38 +124,38 @@  discard block
 block discarded – undo
124 124
         ];
125 125
 
126 126
         // Load expected libraries
127
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
128
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
129
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
130
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
131
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
132
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
133
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
134
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
135
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
136
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
137
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
138
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
139
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
140
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
141
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
142
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
143
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
144
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
145
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
146
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
147
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
148
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
149
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
150
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
151
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
152
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
153
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
154
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
155
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
156
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
157
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
158
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
127
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
128
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
129
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
130
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
131
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
132
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
133
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
134
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
135
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
136
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
137
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
138
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
139
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
140
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
141
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
142
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
143
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
144
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
145
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
146
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
147
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
148
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
149
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
150
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
151
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
152
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
153
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
154
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
155
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
156
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
157
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
158
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
159 159
 
160 160
         $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
161 161
         $ad->register();
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             echo prepareExchangedData(
171 171
                 array(
172 172
                     'error' => true,
173
-                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
173
+                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
174 174
                 ),
175 175
                 'encode'
176 176
             );
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             echo prepareExchangedData(
189 189
                 array(
190 190
                     'error' => true,
191
-                    'message' => "Error : ".(null !== $error->getErrorCode() ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : ""),
191
+                    'message' => "Error : ".(null !== $error->getErrorCode() ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : ""),
192 192
                 ),
193 193
                 'encode'
194 194
             );
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             echo prepareExchangedData(
208 208
                 array(
209 209
                     'error' => true,
210
-                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
210
+                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
211 211
                 ),
212 212
                 'encode'
213 213
             );
Please login to merge, or discard this patch.