Passed
Push — master ( 01b3cb...27391d )
by Nils
05:54
created
sources/main.functions.php 1 patch
Spacing   +282 added lines, -285 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');
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             and improve performance by avoiding to include the file for every missing strings.
64 64
         */
65 65
         if (isset($_SESSION['teampass']) === false || isset($_SESSION['teampass']['en_lang'][trim($string)]) === false) {
66
-            $_SESSION['teampass']['en_lang'] = include_once __DIR__. '/../includes/language/english.php';
66
+            $_SESSION['teampass']['en_lang'] = include_once __DIR__.'/../includes/language/english.php';
67 67
             $session_language = isset($_SESSION['teampass']['en_lang'][trim($string)]) === false ? '' : $_SESSION['teampass']['en_lang'][trim($string)];
68 68
         } else {
69 69
             $session_language = $_SESSION['teampass']['en_lang'][trim($string)];
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
     
123 123
     $path = __DIR__.'/../includes/libraries/Encryption/Encryption/';
124 124
 
125
-    include_once $path . 'Exception/CryptoException.php';
126
-    include_once $path . 'Exception/BadFormatException.php';
127
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
128
-    include_once $path . 'Exception/IOException.php';
129
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
130
-    include_once $path . 'Crypto.php';
131
-    include_once $path . 'Encoding.php';
132
-    include_once $path . 'DerivedKeys.php';
133
-    include_once $path . 'Key.php';
134
-    include_once $path . 'KeyOrPassword.php';
135
-    include_once $path . 'File.php';
136
-    include_once $path . 'RuntimeTests.php';
137
-    include_once $path . 'KeyProtectedByPassword.php';
138
-    include_once $path . 'Core.php';
125
+    include_once $path.'Exception/CryptoException.php';
126
+    include_once $path.'Exception/BadFormatException.php';
127
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
128
+    include_once $path.'Exception/IOException.php';
129
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
130
+    include_once $path.'Crypto.php';
131
+    include_once $path.'Encoding.php';
132
+    include_once $path.'DerivedKeys.php';
133
+    include_once $path.'Key.php';
134
+    include_once $path.'KeyOrPassword.php';
135
+    include_once $path.'File.php';
136
+    include_once $path.'RuntimeTests.php';
137
+    include_once $path.'KeyProtectedByPassword.php';
138
+    include_once $path.'Core.php';
139 139
     
140 140
     // convert KEY
141 141
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -180,20 +180,20 @@  discard block
 block discarded – undo
180 180
         $path = '../includes/libraries/Encryption/Encryption/';
181 181
     }
182 182
 
183
-    include_once $path . 'Exception/CryptoException.php';
184
-    include_once $path . 'Exception/BadFormatException.php';
185
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
186
-    include_once $path . 'Exception/IOException.php';
187
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
188
-    include_once $path . 'Crypto.php';
189
-    include_once $path . 'Encoding.php';
190
-    include_once $path . 'DerivedKeys.php';
191
-    include_once $path . 'Key.php';
192
-    include_once $path . 'KeyOrPassword.php';
193
-    include_once $path . 'File.php';
194
-    include_once $path . 'RuntimeTests.php';
195
-    include_once $path . 'KeyProtectedByPassword.php';
196
-    include_once $path . 'Core.php';
183
+    include_once $path.'Exception/CryptoException.php';
184
+    include_once $path.'Exception/BadFormatException.php';
185
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
186
+    include_once $path.'Exception/IOException.php';
187
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
188
+    include_once $path.'Crypto.php';
189
+    include_once $path.'Encoding.php';
190
+    include_once $path.'DerivedKeys.php';
191
+    include_once $path.'Key.php';
192
+    include_once $path.'KeyOrPassword.php';
193
+    include_once $path.'File.php';
194
+    include_once $path.'RuntimeTests.php';
195
+    include_once $path.'KeyProtectedByPassword.php';
196
+    include_once $path.'Core.php';
197 197
 
198 198
     $key = \Defuse\Crypto\Key::createNewRandomKey();
199 199
     $key = $key->saveToAsciiSafeString();
@@ -218,20 +218,20 @@  discard block
 block discarded – undo
218 218
         $path = '../includes/libraries/Encryption/Encryption/';
219 219
     }
220 220
 
221
-    include_once $path . 'Exception/CryptoException.php';
222
-    include_once $path . 'Exception/BadFormatException.php';
223
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
224
-    include_once $path . 'Exception/IOException.php';
225
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
226
-    include_once $path . 'Crypto.php';
227
-    include_once $path . 'Encoding.php';
228
-    include_once $path . 'DerivedKeys.php';
229
-    include_once $path . 'Key.php';
230
-    include_once $path . 'KeyOrPassword.php';
231
-    include_once $path . 'File.php';
232
-    include_once $path . 'RuntimeTests.php';
233
-    include_once $path . 'KeyProtectedByPassword.php';
234
-    include_once $path . 'Core.php';
221
+    include_once $path.'Exception/CryptoException.php';
222
+    include_once $path.'Exception/BadFormatException.php';
223
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
224
+    include_once $path.'Exception/IOException.php';
225
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
226
+    include_once $path.'Crypto.php';
227
+    include_once $path.'Encoding.php';
228
+    include_once $path.'DerivedKeys.php';
229
+    include_once $path.'Key.php';
230
+    include_once $path.'KeyOrPassword.php';
231
+    include_once $path.'File.php';
232
+    include_once $path.'RuntimeTests.php';
233
+    include_once $path.'KeyProtectedByPassword.php';
234
+    include_once $path.'Core.php';
235 235
     
236 236
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
237 237
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -256,20 +256,20 @@  discard block
 block discarded – undo
256 256
         $path = '../includes/libraries/Encryption/Encryption/';
257 257
     }
258 258
 
259
-    include_once $path . 'Exception/CryptoException.php';
260
-    include_once $path . 'Exception/BadFormatException.php';
261
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
262
-    include_once $path . 'Exception/IOException.php';
263
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
264
-    include_once $path . 'Crypto.php';
265
-    include_once $path . 'Encoding.php';
266
-    include_once $path . 'DerivedKeys.php';
267
-    include_once $path . 'Key.php';
268
-    include_once $path . 'KeyOrPassword.php';
269
-    include_once $path . 'File.php';
270
-    include_once $path . 'RuntimeTests.php';
271
-    include_once $path . 'KeyProtectedByPassword.php';
272
-    include_once $path . 'Core.php';
259
+    include_once $path.'Exception/CryptoException.php';
260
+    include_once $path.'Exception/BadFormatException.php';
261
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
262
+    include_once $path.'Exception/IOException.php';
263
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
264
+    include_once $path.'Crypto.php';
265
+    include_once $path.'Encoding.php';
266
+    include_once $path.'DerivedKeys.php';
267
+    include_once $path.'Key.php';
268
+    include_once $path.'KeyOrPassword.php';
269
+    include_once $path.'File.php';
270
+    include_once $path.'RuntimeTests.php';
271
+    include_once $path.'KeyProtectedByPassword.php';
272
+    include_once $path.'Core.php';
273 273
 
274 274
     try {
275 275
         $protected_key_encoded = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
@@ -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,7 +602,7 @@  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 608
         $globalsUserId,
@@ -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 i.id_tree <> "" '.
625 625
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
626 626
         'ORDER BY i.id_tree ASC',
@@ -675,16 +675,16 @@  discard block
 block discarded – undo
675 675
         'SESSION'
676 676
     );
677 677
     // Folders and Roles numbers
678
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
678
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
679 679
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
680
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
680
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
681 681
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
682 682
     // check if change proposals on User's items
683 683
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
684 684
         $countNewItems = DB::query(
685 685
             'SELECT COUNT(*)
686
-            FROM ' . prefixTable('items_change') . ' AS c
687
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
686
+            FROM ' . prefixTable('items_change').' AS c
687
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
688 688
             WHERE i.action = %s AND i.id_user = %i',
689 689
             'at_creation',
690 690
             $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 type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
716 716
         ['W', 'ND', 'NE', 'NDNE', 'R'],
717 717
         $userRoles,
@@ -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,
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
     }
812 812
     $persoFlds = DB::query(
813 813
         'SELECT id
814
-        FROM ' . prefixTable('nested_tree') . '
814
+        FROM ' . prefixTable('nested_tree').'
815 815
         WHERE %l',
816 816
         $where
817 817
     );
@@ -875,9 +875,9 @@  discard block
 block discarded – undo
875 875
  */
876 876
 function cacheTableRefresh(array $SETTINGS): void
877 877
 {
878
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
878
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
879 879
     //Connect to DB
880
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
880
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
881 881
     if (defined('DB_PASSWD_CLEAR') === false) {
882 882
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
883 883
     }
@@ -890,16 +890,16 @@  discard block
 block discarded – undo
890 890
     DB::$ssl = DB_SSL;
891 891
     DB::$connect_options = DB_CONNECT_OPTIONS;
892 892
     //Load Tree
893
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] .'/includes/libraries');
893
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
894 894
     $tree->register();
895 895
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
896 896
     // truncate table
897
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
897
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
898 898
     // reload date
899 899
     $rows = DB::query(
900 900
         'SELECT *
901
-        FROM ' . prefixTable('items') . ' as i
902
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
901
+        FROM ' . prefixTable('items').' as i
902
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
903 903
         AND l.action = %s
904 904
         AND i.inactif = %i',
905 905
         'at_creation',
@@ -911,18 +911,18 @@  discard block
 block discarded – undo
911 911
             $tags = '';
912 912
             $itemTags = DB::query(
913 913
                 'SELECT tag
914
-                FROM ' . prefixTable('tags') . '
914
+                FROM ' . prefixTable('tags').'
915 915
                 WHERE item_id = %i AND tag != ""',
916 916
                 $record['id']
917 917
             );
918 918
             foreach ($itemTags as $itemTag) {
919
-                $tags .= $itemTag['tag'] . ' ';
919
+                $tags .= $itemTag['tag'].' ';
920 920
             }
921 921
 
922 922
             // Get renewal period
923 923
             $resNT = DB::queryfirstrow(
924 924
                 'SELECT renewal_period
925
-                FROM ' . prefixTable('nested_tree') . '
925
+                FROM ' . prefixTable('nested_tree').'
926 926
                 WHERE id = %i',
927 927
                 $record['id_tree']
928 928
             );
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                     // Is this a User id?
936 936
                     $user = DB::queryfirstrow(
937 937
                         'SELECT id, login
938
-                        FROM ' . prefixTable('users') . '
938
+                        FROM ' . prefixTable('users').'
939 939
                         WHERE id = %i',
940 940
                         $elem->title
941 941
                     );
@@ -953,11 +953,11 @@  discard block
 block discarded – undo
953 953
                     'id' => $record['id'],
954 954
                     'label' => $record['label'],
955 955
                     'description' => $record['description'] ?? '',
956
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
956
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
957 957
                     'tags' => $tags,
958 958
                     'id_tree' => $record['id_tree'],
959 959
                     'perso' => $record['perso'],
960
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
960
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
961 961
                     'login' => $record['login'] ?? '',
962 962
                     'folder' => implode(' > ', $folder),
963 963
                     'author' => $record['id_user'],
@@ -979,12 +979,12 @@  discard block
 block discarded – undo
979 979
  */
980 980
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
981 981
 {
982
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
982
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
983 983
     // Load superglobal
984
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
984
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
985 985
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
986 986
     //Connect to DB
987
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
987
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
988 988
     if (defined('DB_PASSWD_CLEAR') === false) {
989 989
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
990 990
     }
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
     // get new value from db
1004 1004
     $data = DB::queryfirstrow(
1005 1005
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1006
-        FROM ' . prefixTable('items') . '
1006
+        FROM ' . prefixTable('items').'
1007 1007
         WHERE id=%i',
1008 1008
         $ident
1009 1009
     );
@@ -1011,12 +1011,12 @@  discard block
 block discarded – undo
1011 1011
     $tags = '';
1012 1012
     $itemTags = DB::query(
1013 1013
         'SELECT tag
1014
-            FROM ' . prefixTable('tags') . '
1014
+            FROM ' . prefixTable('tags').'
1015 1015
             WHERE item_id = %i AND tag != ""',
1016 1016
         $ident
1017 1017
     );
1018 1018
     foreach ($itemTags as $itemTag) {
1019
-        $tags .= $itemTag['tag'] . ' ';
1019
+        $tags .= $itemTag['tag'].' ';
1020 1020
     }
1021 1021
     // form id_tree to full foldername
1022 1022
     $folder = [];
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
             // Is this a User id?
1028 1028
             $user = DB::queryfirstrow(
1029 1029
                 'SELECT id, login
1030
-                FROM ' . prefixTable('users') . '
1030
+                FROM ' . prefixTable('users').'
1031 1031
                 WHERE id = %i',
1032 1032
                 $elem->title
1033 1033
             );
@@ -1045,10 +1045,10 @@  discard block
 block discarded – undo
1045 1045
             'label' => $data['label'],
1046 1046
             'description' => $data['description'],
1047 1047
             'tags' => $tags,
1048
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1048
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1049 1049
             'id_tree' => $data['id_tree'],
1050 1050
             'perso' => $data['perso'],
1051
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1051
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1052 1052
             'login' => $data['login'] ?? '',
1053 1053
             'folder' => implode(' » ', $folder),
1054 1054
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1068,14 +1068,14 @@  discard block
 block discarded – undo
1068 1068
  */
1069 1069
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1070 1070
 {
1071
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1071
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1072 1072
     // Load superglobal
1073
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1073
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1074 1074
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1075 1075
     // Get superglobals
1076 1076
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1077 1077
     //Connect to DB
1078
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1078
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1079 1079
     if (defined('DB_PASSWD_CLEAR') === false) {
1080 1080
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1081 1081
     }
@@ -1094,8 +1094,8 @@  discard block
 block discarded – undo
1094 1094
     // get new value from db
1095 1095
     $data = DB::queryFirstRow(
1096 1096
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1097
-        FROM ' . prefixTable('items') . ' as i
1098
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1097
+        FROM ' . prefixTable('items').' as i
1098
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1099 1099
         WHERE i.id = %i
1100 1100
         AND l.action = %s',
1101 1101
         $ident,
@@ -1105,12 +1105,12 @@  discard block
 block discarded – undo
1105 1105
     $tags = '';
1106 1106
     $itemTags = DB::query(
1107 1107
         'SELECT tag
1108
-            FROM ' . prefixTable('tags') . '
1108
+            FROM ' . prefixTable('tags').'
1109 1109
             WHERE item_id = %i AND tag != ""',
1110 1110
         $ident
1111 1111
     );
1112 1112
     foreach ($itemTags as $itemTag) {
1113
-        $tags .= $itemTag['tag'] . ' ';
1113
+        $tags .= $itemTag['tag'].' ';
1114 1114
     }
1115 1115
     // form id_tree to full foldername
1116 1116
     $folder = [];
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
             // Is this a User id?
1122 1122
             $user = DB::queryfirstrow(
1123 1123
                 'SELECT id, login
1124
-                FROM ' . prefixTable('users') . '
1124
+                FROM ' . prefixTable('users').'
1125 1125
                 WHERE id = %i',
1126 1126
                 $elem->title
1127 1127
             );
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
             'label' => $data['label'],
1141 1141
             'description' => $data['description'],
1142 1142
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1143
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1143
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1144 1144
             'id_tree' => $data['id_tree'],
1145 1145
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1146 1146
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1162,52 +1162,52 @@  discard block
 block discarded – undo
1162 1162
 function getStatisticsData(array $SETTINGS): array
1163 1163
 {
1164 1164
     DB::query(
1165
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1165
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1166 1166
         0
1167 1167
     );
1168 1168
     $counter_folders = DB::count();
1169 1169
     DB::query(
1170
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1170
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1171 1171
         1
1172 1172
     );
1173 1173
     $counter_folders_perso = DB::count();
1174 1174
     DB::query(
1175
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1175
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1176 1176
         0
1177 1177
     );
1178 1178
     $counter_items = DB::count();
1179 1179
         DB::query(
1180
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1180
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1181 1181
         1
1182 1182
     );
1183 1183
     $counter_items_perso = DB::count();
1184 1184
         DB::query(
1185
-        'SELECT id FROM ' . prefixTable('users') . ''
1185
+        'SELECT id FROM '.prefixTable('users').''
1186 1186
     );
1187 1187
     $counter_users = DB::count();
1188 1188
         DB::query(
1189
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1189
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1190 1190
         1
1191 1191
     );
1192 1192
     $admins = DB::count();
1193 1193
     DB::query(
1194
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1194
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1195 1195
         1
1196 1196
     );
1197 1197
     $managers = DB::count();
1198 1198
     DB::query(
1199
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1199
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1200 1200
         1
1201 1201
     );
1202 1202
     $readOnly = DB::count();
1203 1203
     // list the languages
1204 1204
     $usedLang = [];
1205 1205
     $tp_languages = DB::query(
1206
-        'SELECT name FROM ' . prefixTable('languages')
1206
+        'SELECT name FROM '.prefixTable('languages')
1207 1207
     );
1208 1208
     foreach ($tp_languages as $tp_language) {
1209 1209
         DB::query(
1210
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1210
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1211 1211
             $tp_language['name']
1212 1212
         );
1213 1213
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1216,12 +1216,12 @@  discard block
 block discarded – undo
1216 1216
     // get list of ips
1217 1217
     $usedIp = [];
1218 1218
     $tp_ips = DB::query(
1219
-        'SELECT user_ip FROM ' . prefixTable('users')
1219
+        'SELECT user_ip FROM '.prefixTable('users')
1220 1220
     );
1221 1221
     foreach ($tp_ips as $ip) {
1222 1222
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1223 1223
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1224
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1224
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1225 1225
             $usedIp[$ip['user_ip']] = 1;
1226 1226
         }
1227 1227
     }
@@ -1374,19 +1374,19 @@  discard block
 block discarded – undo
1374 1374
     // Load settings
1375 1375
     //include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1376 1376
     // Load superglobal
1377
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1377
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1378 1378
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1379 1379
     // Get user language
1380
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . (null !== $superGlobal->get('user_language', 'SESSION', 'user') ? $superGlobal->get('user_language', 'SESSION', 'user') : 'english') . '.php';
1380
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.(null !== $superGlobal->get('user_language', 'SESSION', 'user') ? $superGlobal->get('user_language', 'SESSION', 'user') : 'english').'.php';
1381 1381
     // Load library
1382
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1382
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1383 1383
     // load PHPMailer
1384
-    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1384
+    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'].'/includes/libraries');
1385 1385
     $mail->register();
1386 1386
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1387 1387
 
1388 1388
     // send to user
1389
-    $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1389
+    $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1390 1390
     $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true && $cron === false && $silent === false ? $SETTINGS['email_debug_level'] : 0;
1391 1391
     $mail->Port = (int) $SETTINGS['email_port'];
1392 1392
     //COULD BE USED
@@ -1476,7 +1476,7 @@  discard block
 block discarded – undo
1476 1476
         <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;">
1477 1477
         <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;">
1478 1478
         <br><div style="float:right;">' .
1479
-        $textMail .
1479
+        $textMail.
1480 1480
         '<br><br></td></tr></table>
1481 1481
     </td></tr></table>
1482 1482
     <br></body></html>';
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
  */
1490 1490
 function generateKey(): string
1491 1491
 {
1492
-    return substr(md5(rand() . rand()), 0, 15);
1492
+    return substr(md5(rand().rand()), 0, 15);
1493 1493
 }
1494 1494
 
1495 1495
 /**
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 {
1568 1568
     array_walk_recursive(
1569 1569
         $array,
1570
-        static function (&$item): void {
1570
+        static function(&$item): void {
1571 1571
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1572 1572
                 $item = utf8_encode($item);
1573 1573
             }
@@ -1588,9 +1588,9 @@  discard block
 block discarded – undo
1588 1588
  */
1589 1589
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1590 1590
 {
1591
-    $teampassDir = __DIR__ . '/..';
1591
+    $teampassDir = __DIR__.'/..';
1592 1592
     // Load superglobal
1593
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1593
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1594 1594
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1595 1595
     // Get superglobals
1596 1596
     if ($key !== null) {
@@ -1601,10 +1601,10 @@  discard block
 block discarded – undo
1601 1601
     }
1602 1602
 
1603 1603
     //load Encoding
1604
-    include_once $teampassDir . '/includes/libraries/ForceUTF8/Encoding.php';
1604
+    include_once $teampassDir.'/includes/libraries/ForceUTF8/Encoding.php';
1605 1605
     
1606 1606
     //Load CRYPTOJS
1607
-    include_once $teampassDir . '/includes/libraries/Encryption/CryptoJs/Encryption.php';
1607
+    include_once $teampassDir.'/includes/libraries/Encryption/CryptoJs/Encryption.php';
1608 1608
 
1609 1609
     // Perform
1610 1610
     if ($type === 'encode' && is_array($data) === true) {
@@ -1676,8 +1676,8 @@  discard block
 block discarded – undo
1676 1676
  */
1677 1677
 function prefixTable(string $table): string
1678 1678
 {
1679
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1680
-    if (! empty($safeTable)) {
1679
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1680
+    if (!empty($safeTable)) {
1681 1681
         // sanitize string
1682 1682
         return $safeTable;
1683 1683
     }
@@ -1707,13 +1707,13 @@  discard block
 block discarded – undo
1707 1707
     bool $lowercase = false,
1708 1708
     array $SETTINGS = []
1709 1709
 ): string {
1710
-    include_once __DIR__ . '/../sources/SplClassLoader.php';
1711
-    $generator = new SplClassLoader('PasswordGenerator\Generator', __DIR__. '/../includes/libraries');
1710
+    include_once __DIR__.'/../sources/SplClassLoader.php';
1711
+    $generator = new SplClassLoader('PasswordGenerator\Generator', __DIR__.'/../includes/libraries');
1712 1712
     $generator->register();
1713 1713
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1714 1714
     // Is PHP7 being used?
1715 1715
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1716
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', __DIR__ . '/../includes/libraries');
1716
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', __DIR__.'/../includes/libraries');
1717 1717
         $php7generator->register();
1718 1718
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1719 1719
     }
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1749 1749
 {
1750 1750
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1751
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1751
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1752 1752
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1753 1753
     socket_close($sock);
1754 1754
 }
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
     }
1780 1780
 
1781 1781
     // include librairies & connect to DB
1782
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1782
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1783 1783
     if (defined('DB_PASSWD_CLEAR') === false) {
1784 1784
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1785 1785
     }
@@ -1805,14 +1805,14 @@  discard block
 block discarded – undo
1805 1805
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1806 1806
         if ($type === 'user_mngt') {
1807 1807
             send_syslog(
1808
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1808
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1809 1809
                 $SETTINGS['syslog_host'],
1810 1810
                 $SETTINGS['syslog_port'],
1811 1811
                 'teampass'
1812 1812
             );
1813 1813
         } else {
1814 1814
             send_syslog(
1815
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1815
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1816 1816
                 $SETTINGS['syslog_host'],
1817 1817
                 $SETTINGS['syslog_port'],
1818 1818
                 'teampass'
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
     ?string $old_value = null
1851 1851
 ): void {
1852 1852
     // include librairies & connect to DB
1853
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1853
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1854 1854
     if (defined('DB_PASSWD_CLEAR') === false) {
1855 1855
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1856 1856
     }
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
         if (empty($item_label) === true) {
1897 1897
             $dataItem = DB::queryfirstrow(
1898 1898
                 'SELECT id, id_tree, label
1899
-                FROM ' . prefixTable('items') . '
1899
+                FROM ' . prefixTable('items').'
1900 1900
                 WHERE id = %i',
1901 1901
                 $item_id
1902 1902
             );
@@ -1904,11 +1904,11 @@  discard block
 block discarded – undo
1904 1904
         }
1905 1905
 
1906 1906
         send_syslog(
1907
-            'action=' . str_replace('at_', '', $action) .
1908
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1909
-                ' itemno=' . $item_id .
1910
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1911
-                ' itemname="' . addslashes($item_label) . '"',
1907
+            'action='.str_replace('at_', '', $action).
1908
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1909
+                ' itemno='.$item_id.
1910
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1911
+                ' itemname="'.addslashes($item_label).'"',
1912 1912
             $SETTINGS['syslog_host'],
1913 1913
             $SETTINGS['syslog_port'],
1914 1914
             'teampass'
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1988 1988
 {
1989 1989
     // Load superglobal
1990
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1990
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1991 1991
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1992 1992
     // Get superglobals
1993 1993
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1997,8 +1997,8 @@  discard block
 block discarded – undo
1997 1997
     $notification = DB::queryOneColumn(
1998 1998
         'email',
1999 1999
         'SELECT *
2000
-        FROM ' . prefixTable('notification') . ' AS n
2001
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
2000
+        FROM ' . prefixTable('notification').' AS n
2001
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
2002 2002
         WHERE n.item_id = %i AND n.user_id != %i',
2003 2003
         $item_id,
2004 2004
         $globalsUserId
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
         // Get list of changes
2010 2010
         $htmlChanges = '<ul>';
2011 2011
         foreach ($changes as $change) {
2012
-            $htmlChanges .= '<li>' . $change . '</li>';
2012
+            $htmlChanges .= '<li>'.$change.'</li>';
2013 2013
         }
2014 2014
         $htmlChanges .= '</ul>';
2015 2015
         // send email
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
2043 2043
 {
2044 2044
     // Class loader
2045
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
2045
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
2046 2046
     //Load Tree
2047 2047
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
2048 2048
     $tree->register();
@@ -2051,15 +2051,15 @@  discard block
 block discarded – undo
2051 2051
     $path = '';
2052 2052
     foreach ($arbo as $elem) {
2053 2053
         if (empty($path) === true) {
2054
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
2054
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
2055 2055
         } else {
2056
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2056
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2057 2057
         }
2058 2058
     }
2059 2059
 
2060 2060
     // Build text to show user
2061 2061
     if (empty($label) === false) {
2062
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
2062
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
2063 2063
     }
2064 2064
     return empty($path) === true ? '' : $path;
2065 2065
 }
@@ -2116,9 +2116,9 @@  discard block
 block discarded – undo
2116 2116
  */
2117 2117
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2118 2118
 {
2119
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2119
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2120 2120
     // include librairies & connect to DB
2121
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2121
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2122 2122
     if (defined('DB_PASSWD_CLEAR') === false) {
2123 2123
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2124 2124
     }
@@ -2133,8 +2133,8 @@  discard block
 block discarded – undo
2133 2133
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2134 2134
         // perform a copy
2135 2135
         if (file_exists($tp_config_file)) {
2136
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2137
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2136
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2137
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2138 2138
             }
2139 2139
         }
2140 2140
 
@@ -2144,11 +2144,11 @@  discard block
 block discarded – undo
2144 2144
         $data[1] = "global \$SETTINGS;\n";
2145 2145
         $data[2] = "\$SETTINGS = array (\n";
2146 2146
         $rows = DB::query(
2147
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2147
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2148 2148
             'admin'
2149 2149
         );
2150 2150
         foreach ($rows as $record) {
2151
-            array_push($data, "    '" . $record['intitule'] . "' => '" . htmlspecialchars_decode($record['valeur'], ENT_COMPAT) . "',\n");
2151
+            array_push($data, "    '".$record['intitule']."' => '".htmlspecialchars_decode($record['valeur'], ENT_COMPAT)."',\n");
2152 2152
         }
2153 2153
         array_push($data, ");\n");
2154 2154
         $data = array_unique($data);
@@ -2162,15 +2162,15 @@  discard block
 block discarded – undo
2162 2162
                 break;
2163 2163
             }
2164 2164
 
2165
-            if (stristr($line, "'" . $field . "' => '")) {
2166
-                $data[$inc] = "    '" . $field . "' => '" . htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
2165
+            if (stristr($line, "'".$field."' => '")) {
2166
+                $data[$inc] = "    '".$field."' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
2167 2167
                 $bFound = true;
2168 2168
                 break;
2169 2169
             }
2170 2170
             ++$inc;
2171 2171
         }
2172 2172
         if ($bFound === false) {
2173
-            $data[$inc] = "    '" . $field . "' => '" . htmlspecialchars_decode($value, ENT_COMPAT). "',\n);\n";
2173
+            $data[$inc] = "    '".$field."' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n);\n";
2174 2174
         }
2175 2175
     }
2176 2176
 
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 {
2201 2201
     global $SETTINGS;
2202 2202
     /* LOAD CPASSMAN SETTINGS */
2203
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2203
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2204 2204
         $SETTINGS = [];
2205 2205
         $SETTINGS['duplicate_folder'] = 0;
2206 2206
         //by default, this is set to 0;
@@ -2210,7 +2210,7 @@  discard block
 block discarded – undo
2210 2210
         //by default, this value is set to 5;
2211 2211
         $settings = [];
2212 2212
         $rows = DB::query(
2213
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2213
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2214 2214
             [
2215 2215
                 'type' => 'admin',
2216 2216
                 'type2' => 'settings',
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
     $source_cf = [];
2243 2243
     $rows = DB::QUERY(
2244 2244
         'SELECT id_category
2245
-            FROM ' . prefixTable('categories_folders') . '
2245
+            FROM ' . prefixTable('categories_folders').'
2246 2246
             WHERE id_folder = %i',
2247 2247
         $source_id
2248 2248
     );
@@ -2253,7 +2253,7 @@  discard block
 block discarded – undo
2253 2253
     $target_cf = [];
2254 2254
     $rows = DB::QUERY(
2255 2255
         'SELECT id_category
2256
-            FROM ' . prefixTable('categories_folders') . '
2256
+            FROM ' . prefixTable('categories_folders').'
2257 2257
             WHERE id_folder = %i',
2258 2258
         $target_id
2259 2259
     );
@@ -2288,9 +2288,9 @@  discard block
 block discarded – undo
2288 2288
     string $password = null
2289 2289
 ) {
2290 2290
     // Load AntiXSS
2291
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
2292
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
2293
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
2291
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
2292
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
2293
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
2294 2294
     $antiXss = new voku\helper\AntiXSS();
2295 2295
     // Protect against bad inputs
2296 2296
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2347,20 +2347,20 @@  discard block
 block discarded – undo
2347 2347
 ) {
2348 2348
     // load PhpEncryption library
2349 2349
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2350
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php';
2351
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php';
2352
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php';
2353
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php';
2354
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php';
2355
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2356
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2357
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2358
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2359
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2360
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2361
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2362
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2363
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2350
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php';
2351
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php';
2352
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php';
2353
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php';
2354
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php';
2355
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2356
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2357
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2358
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2359
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2360
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2361
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2362
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2363
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2364 2364
     try {
2365 2365
         \Defuse\Crypto\File::encryptFileWithPassword(
2366 2366
             $source_file,
@@ -2397,20 +2397,20 @@  discard block
 block discarded – undo
2397 2397
 ) {
2398 2398
     // load PhpEncryption library
2399 2399
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2400
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php';
2401
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php';
2402
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php';
2403
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php';
2404
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php';
2405
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2406
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2407
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2408
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2409
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2410
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2411
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2412
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2413
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2400
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php';
2401
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php';
2402
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php';
2403
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php';
2404
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php';
2405
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2406
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2407
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2408
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2409
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2410
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2411
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2412
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2413
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2414 2414
     try {
2415 2415
         \Defuse\Crypto\File::decryptFileWithPassword(
2416 2416
             $source_file,
@@ -2457,9 +2457,9 @@  discard block
 block discarded – undo
2457 2457
 function fileDelete(string $file, array $SETTINGS): void
2458 2458
 {
2459 2459
     // Load AntiXSS
2460
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
2461
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
2462
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
2460
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
2461
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
2462
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
2463 2463
     $antiXss = new voku\helper\AntiXSS();
2464 2464
     $file = $antiXss->xss_clean($file);
2465 2465
     if (is_file($file)) {
@@ -2509,7 +2509,7 @@  discard block
 block discarded – undo
2509 2509
     int  $dirPerm = 0755
2510 2510
 ) {
2511 2511
     // Check if the path exists
2512
-    if (! file_exists($path)) {
2512
+    if (!file_exists($path)) {
2513 2513
         return false;
2514 2514
     }
2515 2515
 
@@ -2547,7 +2547,7 @@  discard block
 block discarded – undo
2547 2547
  */
2548 2548
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2549 2549
 {
2550
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2550
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2551 2551
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2552 2552
     // Prepare superGlobal variables
2553 2553
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2555,7 +2555,7 @@  discard block
 block discarded – undo
2555 2555
     // Load item data
2556 2556
     $data = DB::queryFirstRow(
2557 2557
         'SELECT id_tree
2558
-        FROM ' . prefixTable('items') . '
2558
+        FROM ' . prefixTable('items').'
2559 2559
         WHERE id = %i',
2560 2560
         $item_id
2561 2561
     );
@@ -2618,7 +2618,7 @@  discard block
 block discarded – undo
2618 2618
         }
2619 2619
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2620 2620
     }
2621
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2621
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2622 2622
     return $email;
2623 2623
 }
2624 2624
 
@@ -2634,8 +2634,8 @@  discard block
 block discarded – undo
2634 2634
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2635 2635
 {
2636 2636
     // include librairies & connect to DB
2637
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2638
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2637
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2638
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2639 2639
     if (defined('DB_PASSWD_CLEAR') === false) {
2640 2640
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2641 2641
     }
@@ -2649,7 +2649,7 @@  discard block
 block discarded – undo
2649 2649
     DB::$connect_options = DB_CONNECT_OPTIONS;
2650 2650
     // Insert log in DB
2651 2651
     return DB::query(
2652
-        'SELECT ' . $fields . '
2652
+        'SELECT '.$fields.'
2653 2653
         FROM ' . prefixTable($table)
2654 2654
     );
2655 2655
 }
@@ -2664,11 +2664,11 @@  discard block
 block discarded – undo
2664 2664
 function formatSizeUnits(int $bytes): string
2665 2665
 {
2666 2666
     if ($bytes >= 1073741824) {
2667
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2667
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2668 2668
     } elseif ($bytes >= 1048576) {
2669
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2669
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2670 2670
     } elseif ($bytes >= 1024) {
2671
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2671
+        $bytes = number_format($bytes / 1024, 2).' KB';
2672 2672
     } elseif ($bytes > 1) {
2673 2673
         $bytes .= ' bytes';
2674 2674
     } elseif ($bytes === 1) {
@@ -2883,14 +2883,14 @@  discard block
 block discarded – undo
2883 2883
 
2884 2884
     // Encrypt the file content
2885 2885
     $plaintext = file_get_contents(
2886
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2886
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2887 2887
     );
2888 2888
     $ciphertext = $cipher->encrypt($plaintext);
2889 2889
     // Save new file
2890 2890
     $hash = md5($plaintext);
2891
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2891
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2892 2892
     file_put_contents($fileOut, $ciphertext);
2893
-    unlink($fileInPath . '/' . $fileInName);
2893
+    unlink($fileInPath.'/'.$fileInName);
2894 2894
     return [
2895 2895
         'fileHash' => base64_encode($hash),
2896 2896
         'objectKey' => base64_encode($objectKey),
@@ -2908,7 +2908,7 @@  discard block
 block discarded – undo
2908 2908
  */
2909 2909
 function decryptFile(string $fileName, string $filePath, string $key): string
2910 2910
 {
2911
-    if (! defined('FILE_BUFFER_SIZE')) {
2911
+    if (!defined('FILE_BUFFER_SIZE')) {
2912 2912
         define('FILE_BUFFER_SIZE', 128 * 1024);
2913 2913
     }
2914 2914
 
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
     $cipher->enableContinuousBuffer();
2928 2928
     $cipher->disablePadding();
2929 2929
     // Get file content
2930
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2930
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2931 2931
     // Decrypt file content and return
2932 2932
     return base64_encode($cipher->decrypt($ciphertext));
2933 2933
 }
@@ -2988,9 +2988,9 @@  discard block
 block discarded – undo
2988 2988
     array $objectKeyArray = []
2989 2989
 ): void {
2990 2990
     // include librairies
2991
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2992
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2993
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2991
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2992
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2993
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2994 2994
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2995 2995
 
2996 2996
     // connect to DB
@@ -3054,10 +3054,9 @@  discard block
 block discarded – undo
3054 3054
         //DB::debugmode(true);
3055 3055
         $users = DB::query(
3056 3056
             'SELECT id, public_key
3057
-            FROM ' . prefixTable('users') . '
3057
+            FROM ' . prefixTable('users').'
3058 3058
             WHERE ' . ($onlyForUser === true ? 
3059
-                'id IN ("' . TP_USER_ID . '","' . $superGlobal->get('user_id', 'SESSION') . '") ' : 
3060
-                'id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") ') . '
3059
+                'id IN ("'.TP_USER_ID.'","'.$superGlobal->get('user_id', 'SESSION').'") ' : 'id NOT IN ("'.OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") ').'
3061 3060
             AND public_key != ""'
3062 3061
         );
3063 3062
         //DB::debugmode(false);
@@ -3104,7 +3103,7 @@  discard block
 block discarded – undo
3104 3103
 function isBase64(string $str): bool
3105 3104
 {
3106 3105
     $str = (string) trim($str);
3107
-    if (! isset($str[0])) {
3106
+    if (!isset($str[0])) {
3108 3107
         return false;
3109 3108
     }
3110 3109
 
@@ -3172,12 +3171,12 @@  discard block
 block discarded – undo
3172 3171
         ],
3173 3172
     ];
3174 3173
     // Load expected libraries
3175
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3176
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3177
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3178
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3179
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3180
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3174
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3175
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3176
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3177
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3178
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3179
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3181 3180
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3182 3181
     $ad->register();
3183 3182
     $connection = new Connection($config);
@@ -3186,7 +3185,7 @@  discard block
 block discarded – undo
3186 3185
         $connection->connect();
3187 3186
     } catch (\LdapRecord\Auth\BindException $e) {
3188 3187
         $error = $e->getDetailedError();
3189
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3188
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3190 3189
         return false;
3191 3190
     }
3192 3191
 
@@ -3199,7 +3198,7 @@  discard block
 block discarded – undo
3199 3198
         }
3200 3199
     } catch (\LdapRecord\Auth\BindException $e) {
3201 3200
         $error = $e->getDetailedError();
3202
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3201
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3203 3202
         return false;
3204 3203
     }
3205 3204
 
@@ -3217,8 +3216,8 @@  discard block
 block discarded – undo
3217 3216
 function deleteUserObjetsKeys(int $userId, array $SETTINGS = []): bool
3218 3217
 {
3219 3218
     // include librairies & connect to DB
3220
-    include_once __DIR__. '/../includes/config/settings.php';
3221
-    include_once __DIR__. '/../includes/libraries/Database/Meekrodb/db.class.php';
3219
+    include_once __DIR__.'/../includes/config/settings.php';
3220
+    include_once __DIR__.'/../includes/libraries/Database/Meekrodb/db.class.php';
3222 3221
     if (defined('DB_PASSWD_CLEAR') === false) {
3223 3222
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3224 3223
     }
@@ -3278,7 +3277,7 @@  discard block
 block discarded – undo
3278 3277
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3279 3278
             $now->setTimezone(new DateTimeZone($timezone));
3280 3279
             $offsets[] = $offset = $now->getOffset();
3281
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3280
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3282 3281
         }
3283 3282
 
3284 3283
         array_multisort($offsets, $timezones);
@@ -3298,7 +3297,7 @@  discard block
 block discarded – undo
3298 3297
 {
3299 3298
     $hours = intval($offset / 3600);
3300 3299
     $minutes = abs(intval($offset % 3600 / 60));
3301
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3300
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3302 3301
 }
3303 3302
 
3304 3303
 /**
@@ -3398,8 +3397,7 @@  discard block
 block discarded – undo
3398 3397
 {
3399 3398
     if (isset($array[$key]) === true
3400 3399
         && (is_int($value) === true ?
3401
-            (int) $array[$key] === $value :
3402
-            (string) $array[$key] === $value)
3400
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3403 3401
     ) {
3404 3402
         return true;
3405 3403
     }
@@ -3421,8 +3419,7 @@  discard block
 block discarded – undo
3421 3419
 {
3422 3420
     if (isset($var) === false
3423 3421
         || (is_int($value) === true ?
3424
-            (int) $var === $value :
3425
-            (string) $var === $value)
3422
+            (int) $var === $value : (string) $var === $value)
3426 3423
     ) {
3427 3424
         return true;
3428 3425
     }
@@ -3473,7 +3470,7 @@  discard block
 block discarded – undo
3473 3470
  */
3474 3471
 function isSetArrayOfValues(array $arrayOfValues): bool
3475 3472
 {
3476
-    foreach($arrayOfValues as $value) {
3473
+    foreach ($arrayOfValues as $value) {
3477 3474
         if (isset($value) === false) {
3478 3475
             return false;
3479 3476
         }
@@ -3495,7 +3492,7 @@  discard block
 block discarded – undo
3495 3492
     /*PHP8 - integer|string*/$value
3496 3493
 ) : bool
3497 3494
 {
3498
-    foreach($arrayOfVars as $variable) {
3495
+    foreach ($arrayOfVars as $variable) {
3499 3496
         if ($variable !== $value) {
3500 3497
             return false;
3501 3498
         }
@@ -3515,7 +3512,7 @@  discard block
 block discarded – undo
3515 3512
     /*PHP8 - integer|string*/$value
3516 3513
 ) : bool
3517 3514
 {
3518
-    foreach($arrayOfVars as $variable) {
3515
+    foreach ($arrayOfVars as $variable) {
3519 3516
         if ($variable === $value) {
3520 3517
             return true;
3521 3518
         }
@@ -3584,26 +3581,26 @@  discard block
 block discarded – undo
3584 3581
 function dataSanitizer(
3585 3582
     array $data,
3586 3583
     array $filters,
3587
-    string $path = __DIR__. '/..' // Path to Teampass root
3584
+    string $path = __DIR__.'/..' // Path to Teampass root
3588 3585
 )
3589 3586
 {
3590 3587
     // Load Sanitizer library
3591
-    require_once $path . '/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3592
-    require_once $path . '/includes/libraries/Illuminate/Support/Str.php';
3593
-    require_once $path . '/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3594
-    require_once $path . '/includes/libraries/Illuminate/Support/Arr.php';
3595
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3596
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3597
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3598
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3599
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3600
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3588
+    require_once $path.'/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3589
+    require_once $path.'/includes/libraries/Illuminate/Support/Str.php';
3590
+    require_once $path.'/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3591
+    require_once $path.'/includes/libraries/Illuminate/Support/Arr.php';
3592
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3593
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3594
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3595
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3596
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3597
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3601 3598
     $sanitizer = new Elegant\sanitizer\Sanitizer($data, $filters);
3602 3599
 
3603 3600
     // Load AntiXSS
3604
-    include_once $path. '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
3605
-    include_once $path . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
3606
-    include_once $path . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
3601
+    include_once $path.'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
3602
+    include_once $path.'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
3603
+    include_once $path.'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
3607 3604
     $antiXss = new voku\helper\AntiXSS();
3608 3605
 
3609 3606
     // Sanitize post and get variables
@@ -3621,9 +3618,9 @@  discard block
 block discarded – undo
3621 3618
  */
3622 3619
 function cacheTreeUserHandler(int $user_id, string $data, array $SETTINGS, string $field_update = '')
3623 3620
 {
3624
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
3621
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
3625 3622
     //Connect to DB
3626
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3623
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3627 3624
     if (defined('DB_PASSWD_CLEAR') === false) {
3628 3625
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3629 3626
     }
@@ -3639,7 +3636,7 @@  discard block
 block discarded – undo
3639 3636
     // Exists ?
3640 3637
     $userCacheId = DB::queryfirstrow(
3641 3638
         'SELECT increment_id
3642
-        FROM ' . prefixTable('cache_tree') . '
3639
+        FROM ' . prefixTable('cache_tree').'
3643 3640
         WHERE user_id = %i',
3644 3641
         $user_id
3645 3642
     );
@@ -3688,7 +3685,7 @@  discard block
 block discarded – undo
3688 3685
  */
3689 3686
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3690 3687
 { 
3691
-    $resultat = ($nombre/$total) * $pourcentage;
3688
+    $resultat = ($nombre / $total) * $pourcentage;
3692 3689
     return round($resultat);
3693 3690
 }
3694 3691
 
@@ -3716,7 +3713,7 @@  discard block
 block discarded – undo
3716 3713
 
3717 3714
     // Get last folder update
3718 3715
     $lastFolderChange = DB::queryfirstrow(
3719
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3716
+        'SELECT valeur FROM '.prefixTable('misc').'
3720 3717
         WHERE type = %s AND intitule = %s',
3721 3718
         'timestamp',
3722 3719
         'last_folder_change'
@@ -3746,7 +3743,7 @@  discard block
 block discarded – undo
3746 3743
     // Does this user has a tree cache
3747 3744
     $userCacheTree = DB::queryfirstrow(
3748 3745
         'SELECT '.$fieldName.'
3749
-        FROM ' . prefixTable('cache_tree') . '
3746
+        FROM ' . prefixTable('cache_tree').'
3750 3747
         WHERE user_id = %i',
3751 3748
         $_SESSION['user_id']
3752 3749
     );
@@ -3775,10 +3772,10 @@  discard block
 block discarded – undo
3775 3772
 )
3776 3773
 {
3777 3774
     //load ClassLoader
3778
-    include_once __DIR__. '/../sources/SplClassLoader.php';
3775
+    include_once __DIR__.'/../sources/SplClassLoader.php';
3779 3776
     
3780 3777
     //Connect to DB
3781
-    include_once __DIR__. '/../includes/libraries/Database/Meekrodb/db.class.php';
3778
+    include_once __DIR__.'/../includes/libraries/Database/Meekrodb/db.class.php';
3782 3779
     if (defined('DB_PASSWD_CLEAR') === false) {
3783 3780
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, []));
3784 3781
     }
@@ -3797,7 +3794,7 @@  discard block
 block discarded – undo
3797 3794
     if (count($folderIds) === 0) {
3798 3795
         $folderIds = DB::queryFirstColumn(
3799 3796
             'SELECT id
3800
-            FROM ' . prefixTable('nested_tree') . '
3797
+            FROM ' . prefixTable('nested_tree').'
3801 3798
             WHERE personal_folder=%i',
3802 3799
             0
3803 3800
         );
@@ -3814,8 +3811,8 @@  discard block
 block discarded – undo
3814 3811
         $rows_tmp = DB::query(
3815 3812
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3816 3813
             f.id_category AS category_id
3817
-            FROM ' . prefixTable('categories_folders') . ' AS f
3818
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3814
+            FROM ' . prefixTable('categories_folders').' AS f
3815
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3819 3816
             WHERE id_folder=%i',
3820 3817
             $folder
3821 3818
         );
@@ -3841,7 +3838,7 @@  discard block
 block discarded – undo
3841 3838
         $valTemp = '';
3842 3839
         $data = DB::queryFirstRow(
3843 3840
             'SELECT valeur
3844
-            FROM ' . prefixTable('misc') . '
3841
+            FROM ' . prefixTable('misc').'
3845 3842
             WHERE type = %s AND intitule=%i',
3846 3843
             'complex',
3847 3844
             $folder
@@ -3858,14 +3855,14 @@  discard block
 block discarded – undo
3858 3855
         $valTemp = '';
3859 3856
         $rows_tmp = DB::query(
3860 3857
             'SELECT t.title
3861
-            FROM ' . prefixTable('roles_values') . ' as v
3862
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3858
+            FROM ' . prefixTable('roles_values').' as v
3859
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3863 3860
             WHERE v.folder_id = %i
3864 3861
             GROUP BY title',
3865 3862
             $folder
3866 3863
         );
3867 3864
         foreach ($rows_tmp as $record) {
3868
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3865
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3869 3866
         }
3870 3867
         $arr_data['visibilityRoles'] = $valTemp;
3871 3868
 
@@ -3897,7 +3894,7 @@  discard block
 block discarded – undo
3897 3894
         // loop on users and check if user has this role
3898 3895
         $rows = DB::query(
3899 3896
             'SELECT id, fonction_id
3900
-            FROM ' . prefixTable('users') . '
3897
+            FROM ' . prefixTable('users').'
3901 3898
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3902 3899
             $_SESSION['user_id']
3903 3900
         );
@@ -3936,7 +3933,7 @@  discard block
 block discarded – undo
3936 3933
 
3937 3934
     $val = DB::queryfirstrow(
3938 3935
         'SELECT *
3939
-        FROM ' . prefixTable('users') . '
3936
+        FROM ' . prefixTable('users').'
3940 3937
         WHERE id = %i',
3941 3938
         $userId
3942 3939
     );
@@ -3952,12 +3949,12 @@  discard block
 block discarded – undo
3952 3949
 function upgradeRequired(): bool
3953 3950
 {
3954 3951
     // Get settings.php
3955
-    include_once __DIR__. '/../includes/config/settings.php';
3952
+    include_once __DIR__.'/../includes/config/settings.php';
3956 3953
 
3957 3954
     // Get timestamp in DB
3958 3955
     $val = DB::queryfirstrow(
3959 3956
         'SELECT valeur
3960
-        FROM ' . prefixTable('misc') . '
3957
+        FROM ' . prefixTable('misc').'
3961 3958
         WHERE type = %s AND intitule = %s',
3962 3959
         'admin',
3963 3960
         'upgrade_timestamp'
@@ -4004,7 +4001,7 @@  discard block
 block discarded – undo
4004 4001
     // prepapre background tasks for item keys generation        
4005 4002
     $userTP = DB::queryFirstRow(
4006 4003
         'SELECT pw, public_key, private_key
4007
-        FROM ' . prefixTable('users') . '
4004
+        FROM ' . prefixTable('users').'
4008 4005
         WHERE id = %i',
4009 4006
         TP_USER_ID
4010 4007
     );
@@ -4064,8 +4061,8 @@  discard block
 block discarded – undo
4064 4061
                 'process_type' => 'create_user_keys',
4065 4062
                 'arguments' => json_encode([
4066 4063
                     'new_user_id' => (int) $userId,
4067
-                    'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
4068
-                    'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
4064
+                    'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
4065
+                    'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
4069 4066
                     'owner_id' => (int) TP_USER_ID,
4070 4067
                     'creator_pwd' => $userTP['pw'],
4071 4068
                     'send_email' => $sendEmailToUser === true ? 1 : 0,
Please login to merge, or discard this patch.
sources/items.queries.php 1 patch
Spacing   +278 added lines, -279 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Do checks
40
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
41
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
40
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
41
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
42 42
 
43 43
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'items', $SETTINGS) === false) {
44 44
     // Not allowed page
45 45
     echo "> ".$_SESSION['user_id']." < - > ".$_SESSION['key']." <";
46 46
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
47
-    include $SETTINGS['cpassman_dir'] . '/error.php';
47
+    include $SETTINGS['cpassman_dir'].'/error.php';
48 48
     exit;
49 49
 }
50 50
 
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
     date_default_timezone_set('UTC');
58 58
 }
59 59
 
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
61
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
61
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
62 62
 header('Content-type: text/html; charset=utf-8');
63 63
 header('Cache-Control: no-cache, must-revalidate');
64 64
 require_once 'main.functions.php';
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 }
79 79
 
80 80
 // Load AntiXSS
81
-include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
82
-include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
83
-include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
81
+include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php';
82
+include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php';
83
+include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php';
84 84
 $antiXss = new voku\helper\AntiXSS();
85 85
 
86 86
 // Connect to mysql server
87
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
87
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
88 88
 if (defined('DB_PASSWD_CLEAR') === false) {
89 89
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
90 90
 }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 DB::$connect_options = DB_CONNECT_OPTIONS;
99 99
 
100 100
 // Load Tree
101
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tree/NestedTree/NestedTree.php';
101
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tree/NestedTree/NestedTree.php';
102 102
 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
103 103
 
104 104
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
             // About special settings
339 339
             $dataFolderSettings = DB::queryFirstRow(
340 340
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
341
-                FROM ' . prefixTable('nested_tree') . ' 
341
+                FROM ' . prefixTable('nested_tree').' 
342 342
                 WHERE id = %i',
343 343
                 $inputData['folderId']
344 344
             );
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             // Get folder complexity
356 356
             $folderComplexity = DB::queryfirstrow(
357 357
                 'SELECT valeur
358
-                FROM ' . prefixTable('misc') . '
358
+                FROM ' . prefixTable('misc').'
359 359
                 WHERE type = %s AND intitule = %i',
360 360
                 'complex',
361 361
                 $inputData['folderId']
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             $itemExists = 0;
382 382
             $newID = '';
383 383
             $data = DB::queryfirstrow(
384
-                'SELECT * FROM ' . prefixTable('items') . '
384
+                'SELECT * FROM '.prefixTable('items').'
385 385
                 WHERE label = %s AND inactif = %i',
386 386
                 $inputData['label'],
387 387
                 0
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                             // should we encrypt the data
485 485
                             $dataTmp = DB::queryFirstRow(
486 486
                                 'SELECT encrypted_data
487
-                                FROM ' . prefixTable('categories') . '
487
+                                FROM ' . prefixTable('categories').'
488 488
                                 WHERE id = %i',
489 489
                                 $field['id']
490 490
                             );
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
                 ) {
554 554
                     DB::queryFirstRow(
555 555
                         'SELECT *
556
-                        FROM ' . prefixTable('templates') . '
556
+                        FROM ' . prefixTable('templates').'
557 557
                         WHERE item_id = %i',
558 558
                         $newID
559 559
                     );
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
                 ) {
623 623
                     foreach ($post_restricted_to as $userRest) {
624 624
                         if (empty($userRest) === false) {
625
-                            $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
625
+                            $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
626 626
                             if (empty($listOfRestricted)) {
627 627
                                 $listOfRestricted = $dataTmp['login'];
628 628
                             } else {
629
-                                $listOfRestricted .= ';' . $dataTmp['login'];
629
+                                $listOfRestricted .= ';'.$dataTmp['login'];
630 630
                             }
631 631
                         }
632 632
                     }
@@ -640,11 +640,11 @@  discard block
 block discarded – undo
640 640
                     if (empty($data['restricted_to']) === false) {
641 641
                         foreach (explode(';', $data['restricted_to']) as $userRest) {
642 642
                             if (empty($userRest) === false) {
643
-                                $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= ' . $userRest);
643
+                                $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= '.$userRest);
644 644
                                 if (empty($oldRestrictionList) === true) {
645 645
                                     $oldRestrictionList = $dataTmp['login'];
646 646
                                 } else {
647
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
647
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
648 648
                                 }
649 649
                             }
650 650
                         }
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
                 if (empty($post_uploaded_file_id) === false) {
708 708
                     $rows = DB::query(
709 709
                         'SELECT id
710
-                        FROM ' . prefixTable('files') . '
710
+                        FROM ' . prefixTable('files').'
711 711
                         WHERE id_item = %s',
712 712
                         $post_uploaded_file_id
713 713
                     );
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
                                     langHdl('email_subject_item_updated'),
762 762
                                     str_replace(
763 763
                                         array('#label', '#link'),
764
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
764
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
765 765
                                             langHdl('new_item_email_body')
766 766
                                     ),
767 767
                                     $emailAddress,
@@ -899,8 +899,7 @@  discard block
 block discarded – undo
899 899
             $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
900 900
                     $dataReceived['to_be_deleted_after_date'],
901 901
                     FILTER_SANITIZE_FULL_SPECIAL_CHARS
902
-                ) :
903
-                '';
902
+                ) : '';
904 903
             $post_fields = (filter_var_array(
905 904
                 $dataReceived['fields'],
906 905
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -960,7 +959,7 @@  discard block
 block discarded – undo
960 959
             // About special settings
961 960
             $dataFolderSettings = DB::queryFirstRow(
962 961
                 'SELECT bloquer_creation, bloquer_modification, personal_folder, title
963
-                FROM ' . prefixTable('nested_tree') . ' 
962
+                FROM ' . prefixTable('nested_tree').' 
964 963
                 WHERE id = %i',
965 964
                 $inputData['folderId']
966 965
             );
@@ -976,7 +975,7 @@  discard block
 block discarded – undo
976 975
             // Get folder complexity
977 976
             $folderComplexity = DB::queryfirstrow(
978 977
                 'SELECT valeur
979
-                FROM ' . prefixTable('misc') . '
978
+                FROM ' . prefixTable('misc').'
980 979
                 WHERE type = %s AND intitule = %i',
981 980
                 'complex',
982 981
                 $inputData['folderId']
@@ -1016,8 +1015,8 @@  discard block
 block discarded – undo
1016 1015
             // Get all informations for this item
1017 1016
             $dataItem = DB::queryfirstrow(
1018 1017
                 'SELECT *
1019
-                FROM ' . prefixTable('items') . ' as i
1020
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1018
+                FROM ' . prefixTable('items').' as i
1019
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1021 1020
                 WHERE i.id=%i AND l.action = %s',
1022 1021
                 $inputData['itemId'],
1023 1022
                 'at_creation'
@@ -1027,7 +1026,7 @@  discard block
 block discarded – undo
1027 1026
             //db::debugmode(true);
1028 1027
             DB::query(
1029 1028
                 'SELECT *
1030
-                FROM ' . prefixTable('sharekeys_items') . '
1029
+                FROM ' . prefixTable('sharekeys_items').'
1031 1030
                 WHERE object_id = %i AND user_id = %s',
1032 1031
                 $inputData['itemId'],
1033 1032
                 $_SESSION['user_id']
@@ -1076,9 +1075,9 @@  discard block
 block discarded – undo
1076 1075
                     'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, 
1077 1076
                     i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification,
1078 1077
                     u.login as user_login, u.email as user_email
1079
-                    FROM ' . prefixTable('items') . ' as i
1080
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1081
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1078
+                    FROM ' . prefixTable('items').' as i
1079
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1080
+                    INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1082 1081
                     WHERE i.id=%i',
1083 1082
                     $inputData['itemId']
1084 1083
                 );
@@ -1086,7 +1085,7 @@  discard block
 block discarded – undo
1086 1085
                 // Should we log a password change?
1087 1086
                 $userKey = DB::queryFirstRow(
1088 1087
                     'SELECT share_key
1089
-                    FROM ' . prefixTable('sharekeys_items') . '
1088
+                    FROM ' . prefixTable('sharekeys_items').'
1090 1089
                     WHERE user_id = %i AND object_id = %i',
1091 1090
                     $_SESSION['user_id'],
1092 1091
                     $inputData['itemId']
@@ -1155,7 +1154,7 @@  discard block
 block discarded – undo
1155 1154
                 // Get list of tags
1156 1155
                 $itemTags = DB::queryFirstColumn(
1157 1156
                     'SELECT tag
1158
-                    FROM ' . prefixTable('tags') . '
1157
+                    FROM ' . prefixTable('tags').'
1159 1158
                     WHERE item_id = %i',
1160 1159
                     $inputData['itemId']
1161 1160
                 );
@@ -1201,7 +1200,7 @@  discard block
 block discarded – undo
1201 1200
                         $_SESSION['user_id'],
1202 1201
                         'at_modification',
1203 1202
                         $_SESSION['login'],
1204
-                        'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1203
+                        'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1205 1204
                     );
1206 1205
                 }
1207 1206
 
@@ -1240,8 +1239,8 @@  discard block
 block discarded – undo
1240 1239
                                 'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1241 1240
                                 i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1242 1241
                                 c.masked AS masked, i.id AS field_item_id
1243
-                                FROM ' . prefixTable('categories_items') . ' AS i
1244
-                                INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1242
+                                FROM ' . prefixTable('categories_items').' AS i
1243
+                                INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1245 1244
                                 WHERE i.field_id = %i AND i.item_id = %i',
1246 1245
                                 $field['id'],
1247 1246
                                 $inputData['itemId']
@@ -1255,7 +1254,7 @@  discard block
 block discarded – undo
1255 1254
                                 // Perform new query
1256 1255
                                 $dataTmpCat = DB::queryFirstRow(
1257 1256
                                     'SELECT id, title, encrypted_data, masked
1258
-                                    FROM ' . prefixTable('categories') . '
1257
+                                    FROM ' . prefixTable('categories').'
1259 1258
                                     WHERE id = %i',
1260 1259
                                     $field['id']
1261 1260
                                 );
@@ -1327,7 +1326,7 @@  discard block
 block discarded – undo
1327 1326
                                     $_SESSION['user_id'],
1328 1327
                                     'at_modification',
1329 1328
                                     $_SESSION['login'],
1330
-                                    'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1329
+                                    'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1331 1330
                                 );
1332 1331
                             } else {
1333 1332
                                 // compare the old and new value
@@ -1335,7 +1334,7 @@  discard block
 block discarded – undo
1335 1334
                                     // Get user sharekey for this field
1336 1335
                                     $userKey = DB::queryFirstRow(
1337 1336
                                         'SELECT share_key
1338
-                                        FROM ' . prefixTable('sharekeys_fields') . '
1337
+                                        FROM ' . prefixTable('sharekeys_fields').'
1339 1338
                                         WHERE user_id = %i AND object_id = %i',
1340 1339
                                         $_SESSION['user_id'],
1341 1340
                                         $dataTmpCat['field_item_id']
@@ -1405,7 +1404,7 @@  discard block
 block discarded – undo
1405 1404
                                         $_SESSION['user_id'],
1406 1405
                                         'at_modification',
1407 1406
                                         $_SESSION['login'],
1408
-                                        'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1407
+                                        'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1409 1408
                                     );
1410 1409
                                 }
1411 1410
                             }
@@ -1430,7 +1429,7 @@  discard block
 block discarded – undo
1430 1429
                 ) {
1431 1430
                     DB::queryFirstRow(
1432 1431
                         'SELECT *
1433
-                        FROM ' . prefixTable('templates') . '
1432
+                        FROM ' . prefixTable('templates').'
1434 1433
                         WHERE item_id = %i',
1435 1434
                         $inputData['itemId']
1436 1435
                     );
@@ -1473,7 +1472,7 @@  discard block
 block discarded – undo
1473 1472
                     // check if elem exists in Table. If not add it or update it.
1474 1473
                     DB::query(
1475 1474
                         'SELECT *
1476
-                        FROM ' . prefixTable('automatic_del') . '
1475
+                        FROM ' . prefixTable('automatic_del').'
1477 1476
                         WHERE item_id = %i',
1478 1477
                         $inputData['itemId']
1479 1478
                     );
@@ -1500,7 +1499,7 @@  discard block
 block discarded – undo
1500 1499
                             // Store updates performed
1501 1500
                             array_push(
1502 1501
                                 $arrayOfChanges,
1503
-                                langHdl('automatic_deletion_engaged') . ': ' . langHdl('enabled')
1502
+                                langHdl('automatic_deletion_engaged').': '.langHdl('enabled')
1504 1503
                             );
1505 1504
 
1506 1505
                             // update LOG
@@ -1543,7 +1542,7 @@  discard block
 block discarded – undo
1543 1542
                             // Store updates performed
1544 1543
                             array_push(
1545 1544
                                 $arrayOfChanges,
1546
-                                langHdl('automatic_deletion_engaged') . ': ' . langHdl('disabled')
1545
+                                langHdl('automatic_deletion_engaged').': '.langHdl('disabled')
1547 1546
                             );
1548 1547
 
1549 1548
                             // update LOG
@@ -1576,7 +1575,7 @@  discard block
 block discarded – undo
1576 1575
                         if (empty($userId) === false) {
1577 1576
                             $dataTmp = DB::queryfirstrow(
1578 1577
                                 'SELECT id, name, lastname
1579
-                                FROM ' . prefixTable('users') . '
1578
+                                FROM ' . prefixTable('users').'
1580 1579
                                 WHERE id= %i',
1581 1580
                                 $userId
1582 1581
                             );
@@ -1584,7 +1583,7 @@  discard block
 block discarded – undo
1584 1583
                             // Add to array
1585 1584
                             array_push(
1586 1585
                                 $arrayOfUsersRestriction,
1587
-                                $dataTmp['name'] . ' ' . $dataTmp['lastname']
1586
+                                $dataTmp['name'].' '.$dataTmp['lastname']
1588 1587
                             );
1589 1588
                             array_push(
1590 1589
                                 $arrayOfUsersIdRestriction,
@@ -1615,8 +1614,8 @@  discard block
 block discarded – undo
1615 1614
                     // get values before deleting them
1616 1615
                     $rows = DB::query(
1617 1616
                         'SELECT t.title, t.id AS id
1618
-                        FROM ' . prefixTable('roles_title') . ' as t
1619
-                        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1617
+                        FROM ' . prefixTable('roles_title').' as t
1618
+                        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1620 1619
                         WHERE r.item_id = %i
1621 1620
                         ORDER BY t.title ASC',
1622 1621
                         $inputData['itemId']
@@ -1650,7 +1649,7 @@  discard block
 block discarded – undo
1650 1649
                             );
1651 1650
                             $dataTmp = DB::queryfirstrow(
1652 1651
                                 'SELECT title
1653
-                                FROM ' . prefixTable('roles_title') . '
1652
+                                FROM ' . prefixTable('roles_title').'
1654 1653
                                 WHERE id = %i',
1655 1654
                                 $role
1656 1655
                             );
@@ -1691,8 +1690,8 @@  discard block
 block discarded – undo
1691 1690
                         $_SESSION['user_id'],
1692 1691
                         'at_modification',
1693 1692
                         $_SESSION['login'],
1694
-                        'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1695
-                            implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1693
+                        'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1694
+                            implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1696 1695
                     );
1697 1696
                 }
1698 1697
 
@@ -1712,7 +1711,7 @@  discard block
 block discarded – undo
1712 1711
                         $_SESSION['user_id'],
1713 1712
                         'at_modification',
1714 1713
                         $_SESSION['login'],
1715
-                        'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1714
+                        'at_label : '.$data['label'].' => '.$inputData['label']
1716 1715
                     );
1717 1716
                 }
1718 1717
                 // LOGIN
@@ -1731,7 +1730,7 @@  discard block
 block discarded – undo
1731 1730
                         $_SESSION['user_id'],
1732 1731
                         'at_modification',
1733 1732
                         $_SESSION['login'],
1734
-                        'at_login : ' . $data['login'] . ' => ' . $post_login
1733
+                        'at_login : '.$data['login'].' => '.$post_login
1735 1734
                     );
1736 1735
                 }
1737 1736
                 // EMAIL
@@ -1750,7 +1749,7 @@  discard block
 block discarded – undo
1750 1749
                         $_SESSION['user_id'],
1751 1750
                         'at_modification',
1752 1751
                         $_SESSION['login'],
1753
-                        'at_email : ' . $data['email'] . ' => ' . $post_email
1752
+                        'at_email : '.$data['email'].' => '.$post_email
1754 1753
                     );
1755 1754
                 }
1756 1755
                 // URL
@@ -1769,7 +1768,7 @@  discard block
 block discarded – undo
1769 1768
                         $_SESSION['user_id'],
1770 1769
                         'at_modification',
1771 1770
                         $_SESSION['login'],
1772
-                        'at_url : ' . $data['url'] . ' => ' . $post_url
1771
+                        'at_url : '.$data['url'].' => '.$post_url
1773 1772
                     );
1774 1773
                 }
1775 1774
                 // DESCRIPTION
@@ -1794,7 +1793,7 @@  discard block
 block discarded – undo
1794 1793
                 // FOLDER
1795 1794
                 if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1796 1795
                     // Get name of folders
1797
-                    $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1796
+                    $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1798 1797
 
1799 1798
                     // Store updates performed
1800 1799
                     array_push(
@@ -1810,7 +1809,7 @@  discard block
 block discarded – undo
1810 1809
                         $_SESSION['user_id'],
1811 1810
                         'at_modification',
1812 1811
                         $_SESSION['login'],
1813
-                        'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
1812
+                        'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
1814 1813
                     );
1815 1814
                 }
1816 1815
                 // ANYONE_CAN_MODIFY
@@ -1818,7 +1817,7 @@  discard block
 block discarded – undo
1818 1817
                     // Store updates performed
1819 1818
                     array_push(
1820 1819
                         $arrayOfChanges,
1821
-                        langHdl('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? langHdl('disabled') : langHdl('enabled'))
1820
+                        langHdl('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? langHdl('disabled') : langHdl('enabled'))
1822 1821
                     );
1823 1822
 
1824 1823
                     // Log
@@ -1829,15 +1828,15 @@  discard block
 block discarded – undo
1829 1828
                         $_SESSION['user_id'],
1830 1829
                         'at_modification',
1831 1830
                         $_SESSION['login'],
1832
-                        'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
1831
+                        'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
1833 1832
                     );
1834 1833
                 }
1835 1834
 
1836 1835
                 // Reload new values
1837 1836
                 $dataItem = DB::queryfirstrow(
1838 1837
                     'SELECT *
1839
-                    FROM ' . prefixTable('items') . ' as i
1840
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1838
+                    FROM ' . prefixTable('items').' as i
1839
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1841 1840
                     WHERE i.id = %i AND l.action = %s',
1842 1841
                     $inputData['itemId'],
1843 1842
                     'at_creation'
@@ -1846,8 +1845,8 @@  discard block
 block discarded – undo
1846 1845
                 $history = '';
1847 1846
                 $rows = DB::query(
1848 1847
                     'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
1849
-                    FROM ' . prefixTable('log_items') . ' as l
1850
-                    LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
1848
+                    FROM ' . prefixTable('log_items').' as l
1849
+                    LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
1851 1850
                     WHERE l.action <> %s AND id_item=%s',
1852 1851
                     'at_shown',
1853 1852
                     $inputData['itemId']
@@ -1856,14 +1855,14 @@  discard block
 block discarded – undo
1856 1855
                     if ($record['raison'] === NULL) continue;
1857 1856
                     $reason = explode(':', $record['raison']);
1858 1857
                     if (count($reason) > 0) {
1859
-                        $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
1860
-                            . $record['login'] . ' - ' . langHdl($record['action']) . ' - '
1861
-                            . (empty($record['raison']) === false ? (count($reason) > 1 ? langHdl(trim($reason[0])) . ' : ' . $reason[1]
1858
+                        $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
1859
+                            . $record['login'].' - '.langHdl($record['action']).' - '
1860
+                            . (empty($record['raison']) === false ? (count($reason) > 1 ? langHdl(trim($reason[0])).' : '.$reason[1]
1862 1861
                                 : langHdl(trim($reason[0]))) : '');
1863 1862
                         if (empty($history)) {
1864 1863
                             $history = $sentence;
1865 1864
                         } else {
1866
-                            $history .= '<br />' . $sentence;
1865
+                            $history .= '<br />'.$sentence;
1867 1866
                         }
1868 1867
                     }
1869 1868
                 }
@@ -1996,7 +1995,7 @@  discard block
 block discarded – undo
1996 1995
         ) {
1997 1996
             // load the original record into an array
1998 1997
             $originalRecord = DB::queryfirstrow(
1999
-                'SELECT * FROM ' . prefixTable('items') . '
1998
+                'SELECT * FROM '.prefixTable('items').'
2000 1999
                 WHERE id = %i',
2001 2000
                 $inputData['itemId']
2002 2001
             );
@@ -2016,7 +2015,7 @@  discard block
 block discarded – undo
2016 2015
 
2017 2016
             // Load the destination folder record into an array
2018 2017
             $dataDestination = DB::queryfirstrow(
2019
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2018
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2020 2019
                 WHERE id = %i',
2021 2020
                 $post_dest_id
2022 2021
             );
@@ -2024,7 +2023,7 @@  discard block
 block discarded – undo
2024 2023
             // Get the ITEM object key for the user
2025 2024
             $userKey = DB::queryFirstRow(
2026 2025
                 'SELECT share_key
2027
-                FROM ' . prefixTable('sharekeys_items') . '
2026
+                FROM ' . prefixTable('sharekeys_items').'
2028 2027
                 WHERE user_id = %i AND object_id = %i',
2029 2028
                 $_SESSION['user_id'],
2030 2029
                 $inputData['itemId']
@@ -2106,7 +2105,7 @@  discard block
 block discarded – undo
2106 2105
             // Manage Custom Fields
2107 2106
             $rows = DB::query(
2108 2107
                 'SELECT *
2109
-                FROM ' . prefixTable('categories_items') . '
2108
+                FROM ' . prefixTable('categories_items').'
2110 2109
                 WHERE item_id = %i',
2111 2110
                 $inputData['itemId']
2112 2111
             );
@@ -2164,15 +2163,15 @@  discard block
 block discarded – undo
2164 2163
             $rows = DB::query(
2165 2164
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2166 2165
                 f.size AS size, f.type AS type, s.share_key AS share_key
2167
-                FROM ' . prefixTable('files') . ' AS f
2168
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2166
+                FROM ' . prefixTable('files').' AS f
2167
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2169 2168
                 WHERE s.user_id = %i AND f.id_item = %i',
2170 2169
                 $_SESSION['user_id'],
2171 2170
                 $inputData['itemId']
2172 2171
             );
2173 2172
             foreach ($rows as $record) {
2174 2173
                 // Check if file still exists
2175
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2174
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2176 2175
                     // Step1 - decrypt the file
2177 2176
                     $fileContent = decryptFile(
2178 2177
                         $record['file'],
@@ -2181,8 +2180,8 @@  discard block
 block discarded – undo
2181 2180
                     );
2182 2181
 
2183 2182
                     // Step2 - create file
2184
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2185
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2183
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2184
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2186 2185
                     if ($outstream === false) {
2187 2186
                         echo prepareExchangedData(
2188 2187
                             $SETTINGS['cpassman_dir'],
@@ -2256,7 +2255,7 @@  discard block
 block discarded – undo
2256 2255
 
2257 2256
             // -------------------------
2258 2257
             // Add specific restrictions
2259
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2258
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2260 2259
             foreach ($rows as $record) {
2261 2260
                 DB::insert(
2262 2261
                     prefixTable('restriction_to_roles'),
@@ -2268,7 +2267,7 @@  discard block
 block discarded – undo
2268 2267
             }
2269 2268
 
2270 2269
             // Add Tags
2271
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2270
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2272 2271
             foreach ($rows as $record) {
2273 2272
                 DB::insert(
2274 2273
                     prefixTable('tags'),
@@ -2298,7 +2297,7 @@  discard block
 block discarded – undo
2298 2297
                 $_SESSION['login']
2299 2298
             );
2300 2299
             // reload cache table
2301
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2300
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2302 2301
             updateCacheTable('reload', $SETTINGS, null);
2303 2302
 
2304 2303
             echo (string) prepareExchangedData(
@@ -2346,7 +2345,7 @@  discard block
 block discarded – undo
2346 2345
 
2347 2346
         // Decrypt and retreive data in JSON format
2348 2347
         $dataReceived = prepareExchangedData(
2349
-            $SETTINGS['cpassman_dir'],$inputData['data'],
2348
+            $SETTINGS['cpassman_dir'], $inputData['data'],
2350 2349
             'decode'
2351 2350
         );
2352 2351
 
@@ -2372,7 +2371,7 @@  discard block
 block discarded – undo
2372 2371
         // then we can show it
2373 2372
         $item_deleted = DB::queryFirstRow(
2374 2373
             'SELECT *
2375
-            FROM ' . prefixTable('log_items') . '
2374
+            FROM ' . prefixTable('log_items').'
2376 2375
             WHERE id_item = %i AND action = %s
2377 2376
             ORDER BY date DESC
2378 2377
             LIMIT 0, 1',
@@ -2383,7 +2382,7 @@  discard block
 block discarded – undo
2383 2382
 
2384 2383
         $item_restored = DB::queryFirstRow(
2385 2384
             'SELECT *
2386
-            FROM ' . prefixTable('log_items') . '
2385
+            FROM ' . prefixTable('log_items').'
2387 2386
             WHERE id_item = %i AND action = %s
2388 2387
             ORDER BY date DESC
2389 2388
             LIMIT 0, 1',
@@ -2408,8 +2407,8 @@  discard block
 block discarded – undo
2408 2407
         // Get all informations for this item
2409 2408
         $dataItem = DB::queryfirstrow(
2410 2409
             'SELECT *
2411
-            FROM ' . prefixTable('items') . ' as i
2412
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2410
+            FROM ' . prefixTable('items').' as i
2411
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2413 2412
             WHERE i.id = %i AND l.action = %s',
2414 2413
             $inputData['id'],
2415 2414
             'at_creation'
@@ -2418,7 +2417,7 @@  discard block
 block discarded – undo
2418 2417
         // Notification
2419 2418
         DB::queryfirstrow(
2420 2419
             'SELECT *
2421
-            FROM ' . prefixTable('notification') . '
2420
+            FROM ' . prefixTable('notification').'
2422 2421
             WHERE item_id = %i AND user_id = %i',
2423 2422
             $inputData['id'],
2424 2423
             $_SESSION['user_id']
@@ -2461,7 +2460,7 @@  discard block
 block discarded – undo
2461 2460
 
2462 2461
         // manage case of API user
2463 2462
         if ($dataItem['id_user'] === API_USER_ID) {
2464
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2463
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2465 2464
             $arrData['id_user'] = API_USER_ID;
2466 2465
             $arrData['author_email'] = '';
2467 2466
             $arrData['notification_status'] = false;
@@ -2471,7 +2470,7 @@  discard block
 block discarded – undo
2471 2470
         $tags = array();
2472 2471
         $rows = DB::query(
2473 2472
             'SELECT tag
2474
-            FROM ' . prefixTable('tags') . '
2473
+            FROM ' . prefixTable('tags').'
2475 2474
             WHERE item_id = %i',
2476 2475
             $inputData['id']
2477 2476
         );
@@ -2496,7 +2495,7 @@  discard block
 block discarded – undo
2496 2495
         // Check if user has a role that is accepted
2497 2496
         $rows_tmp = DB::query(
2498 2497
             'SELECT role_id
2499
-            FROM ' . prefixTable('restriction_to_roles') . '
2498
+            FROM ' . prefixTable('restriction_to_roles').'
2500 2499
             WHERE item_id=%i',
2501 2500
             $inputData['id']
2502 2501
         );
@@ -2510,7 +2509,7 @@  discard block
 block discarded – undo
2510 2509
         // Get the object key for the user
2511 2510
         $userKey = DB::queryFirstRow(
2512 2511
             'SELECT share_key
2513
-            FROM ' . prefixTable('sharekeys_items') . '
2512
+            FROM ' . prefixTable('sharekeys_items').'
2514 2513
             WHERE user_id = %i AND object_id = %i',
2515 2514
             $_SESSION['user_id'],
2516 2515
             $inputData['id']
@@ -2626,8 +2625,8 @@  discard block
 block discarded – undo
2626 2625
                 // Add restriction if item is restricted to roles
2627 2626
                 $rows = DB::query(
2628 2627
                     'SELECT t.title, t.id
2629
-                    FROM ' . prefixTable('roles_title') . ' AS t
2630
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2628
+                    FROM ' . prefixTable('roles_title').' AS t
2629
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2631 2630
                     WHERE r.item_id = %i
2632 2631
                     ORDER BY t.title ASC',
2633 2632
                     $inputData['id']
@@ -2643,8 +2642,8 @@  discard block
 block discarded – undo
2643 2642
                 $tmp = array();
2644 2643
                 $rows = DB::query(
2645 2644
                     'SELECT k.label, k.id
2646
-                    FROM ' . prefixTable('kb_items') . ' as i
2647
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2645
+                    FROM ' . prefixTable('kb_items').' as i
2646
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2648 2647
                     WHERE i.item_id = %i
2649 2648
                     ORDER BY k.label ASC',
2650 2649
                     $inputData['id']
@@ -2727,7 +2726,7 @@  discard block
 block discarded – undo
2727 2726
                 $arrCatList = array();
2728 2727
                 $rows_tmp = DB::query(
2729 2728
                     'SELECT id_category
2730
-                    FROM ' . prefixTable('categories_folders') . '
2729
+                    FROM ' . prefixTable('categories_folders').'
2731 2730
                     WHERE id_folder=%i',
2732 2731
                     $inputData['folderId']
2733 2732
                 );
@@ -2742,8 +2741,8 @@  discard block
 block discarded – undo
2742 2741
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2743 2742
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2744 2743
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2745
-                        FROM ' . prefixTable('categories_items') . ' AS i
2746
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2744
+                        FROM ' . prefixTable('categories_items').' AS i
2745
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2747 2746
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2748 2747
                         $inputData['id'],
2749 2748
                         $arrCatList
@@ -2754,7 +2753,7 @@  discard block
 block discarded – undo
2754 2753
                         //db::debugmode(true);
2755 2754
                         $userKey = DB::queryFirstRow(
2756 2755
                             'SELECT share_key
2757
-                            FROM ' . prefixTable('sharekeys_fields') . '
2756
+                            FROM ' . prefixTable('sharekeys_fields').'
2758 2757
                             WHERE user_id = %i AND object_id = %i',
2759 2758
                             $_SESSION['user_id'],
2760 2759
                             $row['id']
@@ -2814,7 +2813,7 @@  discard block
 block discarded – undo
2814 2813
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2815 2814
                 $rows_tmp = DB::queryfirstrow(
2816 2815
                     'SELECT category_id
2817
-                    FROM ' . prefixTable('templates') . '
2816
+                    FROM ' . prefixTable('templates').'
2818 2817
                     WHERE item_id = %i',
2819 2818
                     $inputData['id']
2820 2819
                 );
@@ -2840,7 +2839,7 @@  discard block
 block discarded – undo
2840 2839
                 // Is the Item to be deleted?
2841 2840
                 $dataDelete = DB::queryfirstrow(
2842 2841
                     'SELECT * 
2843
-                    FROM ' . prefixTable('automatic_del') . '
2842
+                    FROM ' . prefixTable('automatic_del').'
2844 2843
                     WHERE item_id = %i',
2845 2844
                     $inputData['id']
2846 2845
                 );
@@ -2923,11 +2922,11 @@  discard block
 block discarded – undo
2923 2922
             if (empty($dataItem['restricted_to']) === false) {
2924 2923
                 foreach (explode(';', $dataItem['restricted_to']) as $userRest) {
2925 2924
                     if (empty($userRest) === false) {
2926
-                        $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= ' . $userRest);
2925
+                        $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= '.$userRest);
2927 2926
                         if (empty($listOfRestricted)) {
2928 2927
                             $listOfRestricted = $dataTmp['login'];
2929 2928
                         } else {
2930
-                            $listOfRestricted .= ';' . $dataTmp['login'];
2929
+                            $listOfRestricted .= ';'.$dataTmp['login'];
2931 2930
                         }
2932 2931
                     }
2933 2932
                 }
@@ -2990,8 +2989,8 @@  discard block
 block discarded – undo
2990 2989
         // Load item data
2991 2990
         $dataItem = DB::queryFirstRow(
2992 2991
             'SELECT i.*, n.title AS folder_title
2993
-            FROM ' . prefixTable('items') . ' AS i
2994
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
2992
+            FROM ' . prefixTable('items').' AS i
2993
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
2995 2994
             WHERE i.id = %i',
2996 2995
             $inputData['id']
2997 2996
         );
@@ -3013,7 +3012,7 @@  discard block
 block discarded – undo
3013 3012
         // Check if user has a role that is accepted
3014 3013
         $rows_tmp = DB::query(
3015 3014
             'SELECT role_id
3016
-            FROM ' . prefixTable('restriction_to_roles') . '
3015
+            FROM ' . prefixTable('restriction_to_roles').'
3017 3016
             WHERE item_id=%i',
3018 3017
             $inputData['id']
3019 3018
         );
@@ -3060,7 +3059,7 @@  discard block
 block discarded – undo
3060 3059
             // launch query
3061 3060
             $rows = DB::query(
3062 3061
                 'SELECT id, name, file, extension, size
3063
-                FROM ' . prefixTable('files') . '
3062
+                FROM ' . prefixTable('files').'
3064 3063
                 WHERE id_item = %i AND confirmed = 1',
3065 3064
                 $inputData['id']
3066 3065
             );
@@ -3069,7 +3068,7 @@  discard block
 block discarded – undo
3069 3068
                     $attachments,
3070 3069
                     array(
3071 3070
                         'icon' => fileFormatImage(strtolower($record['extension'])),
3072
-                        'filename' => basename($record['name'], '.' . $record['extension']),
3071
+                        'filename' => basename($record['name'], '.'.$record['extension']),
3073 3072
                         'extension' => $record['extension'],
3074 3073
                         'size' => formatSizeUnits((int) $record['size']),
3075 3074
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
@@ -3095,7 +3094,7 @@  discard block
 block discarded – undo
3095 3094
                     array(
3096 3095
                         'latest_items' => implode(';', $_SESSION['latest_items']),
3097 3096
                     ),
3098
-                    'id=' . $_SESSION['user_id']
3097
+                    'id='.$_SESSION['user_id']
3099 3098
                 );
3100 3099
             }
3101 3100
 
@@ -3104,8 +3103,8 @@  discard block
 block discarded – undo
3104 3103
             $listOptionsForRoles = array();
3105 3104
             $rows = DB::query(
3106 3105
                 'SELECT r.role_id AS role_id, t.title AS title
3107
-                FROM ' . prefixTable('roles_values') . ' AS r
3108
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3106
+                FROM ' . prefixTable('roles_values').' AS r
3107
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3109 3108
                 WHERE r.folder_id = %i',
3110 3109
                 $dataItem['id_tree']
3111 3110
             );
@@ -3119,9 +3118,9 @@  discard block
 block discarded – undo
3119 3118
                 );
3120 3119
                 $rows2 = DB::query(
3121 3120
                     'SELECT id, login, fonction_id, email, name, lastname
3122
-                    FROM ' . prefixTable('users') . '
3121
+                    FROM ' . prefixTable('users').'
3123 3122
                     WHERE fonction_id LIKE %s',
3124
-                    '%' . $record['role_id'] . '%'
3123
+                    '%'.$record['role_id'].'%'
3125 3124
                 );
3126 3125
                 foreach ($rows2 as $record2) {
3127 3126
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3134,7 +3133,7 @@  discard block
 block discarded – undo
3134 3133
                                 array(
3135 3134
                                     'id' => (int) $record2['id'],
3136 3135
                                     'login' => $record2['login'],
3137
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3136
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3138 3137
                                     'email' => $record2['email'],
3139 3138
                                 )
3140 3139
                             );
@@ -3153,16 +3152,16 @@  discard block
 block discarded – undo
3153 3152
                 $path = '';
3154 3153
                 foreach ($arbo as $elem) {
3155 3154
                     if (empty($path) === true) {
3156
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3155
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3157 3156
                     } else {
3158
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3157
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3159 3158
                     }
3160 3159
                 }
3161 3160
                 // Build text to show user
3162 3161
                 if (empty($path) === true) {
3163 3162
                     $path = addslashes($dataItem['label']);
3164 3163
                 } else {
3165
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3164
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3166 3165
                 }
3167 3166
 
3168 3167
                 // Add Admins to notification list if expected
@@ -3185,7 +3184,7 @@  discard block
 block discarded – undo
3185 3184
                         array(
3186 3185
                             addslashes($_SESSION['login']),
3187 3186
                             $path,
3188
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3187
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3189 3188
                         ),
3190 3189
                         langHdl('email_on_open_notification_mail')
3191 3190
                     ),
@@ -3196,7 +3195,7 @@  discard block
 block discarded – undo
3196 3195
             }
3197 3196
 
3198 3197
             // has this item a change proposal
3199
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3198
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3200 3199
             $returnArray['has_change_proposal'] = DB::count();
3201 3200
 
3202 3201
             // Setting
@@ -3277,7 +3276,7 @@  discard block
 block discarded – undo
3277 3276
         // Load item data
3278 3277
         $data = DB::queryFirstRow(
3279 3278
             'SELECT id_tree
3280
-            FROM ' . prefixTable('items') . '
3279
+            FROM ' . prefixTable('items').'
3281 3280
             WHERE id = %i',
3282 3281
             $inputData['itemId']
3283 3282
         );
@@ -3345,7 +3344,7 @@  discard block
 block discarded – undo
3345 3344
         }
3346 3345
         // decrypt and retreive data in JSON format
3347 3346
         $dataReceived = prepareExchangedData(
3348
-$SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
3347
+$SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
3349 3348
 
3350 3349
         // Prepare variables
3351 3350
         $title = filter_var(htmlspecialchars_decode($dataReceived['title'], ENT_QUOTES), FILTER_SANITIZE_FULL_SPECIAL_CHARS);
@@ -3353,13 +3352,13 @@  discard block
 block discarded – undo
3353 3352
 
3354 3353
         // Check if user is allowed to access this folder
3355 3354
         if (!in_array($inputData['folderId'], $_SESSION['groupes_visibles'])) {
3356
-            echo '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3355
+            echo '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3357 3356
             break;
3358 3357
         }
3359 3358
 
3360 3359
         // Check if title doesn't contains html codes
3361 3360
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3362
-            echo '[ { "error" : "' . langHdl('error_html_codes') . '" } ]';
3361
+            echo '[ { "error" : "'.langHdl('error_html_codes').'" } ]';
3363 3362
             break;
3364 3363
         }
3365 3364
         // check that title is not numeric
@@ -3370,9 +3369,9 @@  discard block
 block discarded – undo
3370 3369
 
3371 3370
         // Check if duplicate folders name are allowed
3372 3371
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3373
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3372
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3374 3373
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3375
-                echo '[ { "error" : "' . langHdl('error_group_exist') . '" } ]';
3374
+                echo '[ { "error" : "'.langHdl('error_group_exist').'" } ]';
3376 3375
                 break;
3377 3376
             }
3378 3377
         }
@@ -3380,7 +3379,7 @@  discard block
 block discarded – undo
3380 3379
         // query on folder
3381 3380
         $data = DB::queryfirstrow(
3382 3381
             'SELECT parent_id, personal_folder
3383
-            FROM ' . prefixTable('nested_tree') . '
3382
+            FROM ' . prefixTable('nested_tree').'
3384 3383
             WHERE id = %i',
3385 3384
             $inputData['folderId']
3386 3385
         );
@@ -3390,20 +3389,20 @@  discard block
 block discarded – undo
3390 3389
         if ($_SESSION['is_admin'] !== 1 && $_SESSION['user_manager'] !== 1 && $data['personal_folder'] === '0') {
3391 3390
             $data = DB::queryfirstrow(
3392 3391
                 'SELECT valeur
3393
-                FROM ' . prefixTable('misc') . '
3392
+                FROM ' . prefixTable('misc').'
3394 3393
                 WHERE intitule = %i AND type = %s',
3395 3394
                 $data['parent_id'],
3396 3395
                 'complex'
3397 3396
             );
3398 3397
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3399
-                echo '[ { "error" : "' . langHdl('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3398
+                echo '[ { "error" : "'.langHdl('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3400 3399
                 break;
3401 3400
             }
3402 3401
         }
3403 3402
 
3404 3403
         // update Folders table
3405 3404
         $tmp = DB::queryFirstRow(
3406
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3405
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3407 3406
             $dataReceived['folder']
3408 3407
         );
3409 3408
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $_SESSION['user_id'] || $tmp['personal_folder'] !== 1) {
@@ -3462,7 +3461,7 @@  discard block
 block discarded – undo
3462 3461
         }
3463 3462
         // decrypt and retreive data in JSON format
3464 3463
         $dataReceived = prepareExchangedData(
3465
-$SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
3464
+$SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
3466 3465
         $post_source_folder_id = filter_var(htmlspecialchars_decode($dataReceived['source_folder_id']), FILTER_SANITIZE_NUMBER_INT);
3467 3466
         $post_target_folder_id = filter_var(htmlspecialchars_decode($dataReceived['target_folder_id']), FILTER_SANITIZE_NUMBER_INT);
3468 3467
 
@@ -3471,42 +3470,42 @@  discard block
 block discarded – undo
3471 3470
                 in_array($post_target_folder_id, $_SESSION['groupes_visibles']) === false) && ($post_target_folder_id === '0' &&
3472 3471
                 isset($SETTINGS['can_create_root_folder']) === true && (int) $SETTINGS['can_create_root_folder'] === 1)
3473 3472
         ) {
3474
-            $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3473
+            $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3475 3474
             echo $returnValues;
3476 3475
             break;
3477 3476
         }
3478 3477
 
3479 3478
         $tmp_source = DB::queryFirstRow(
3480 3479
             'SELECT title, parent_id, personal_folder
3481
-            FROM ' . prefixTable('nested_tree') . '
3480
+            FROM ' . prefixTable('nested_tree').'
3482 3481
             WHERE id = %i',
3483 3482
             $post_source_folder_id
3484 3483
         );
3485 3484
 
3486 3485
         $tmp_target = DB::queryFirstRow(
3487 3486
             'SELECT title, parent_id, personal_folder
3488
-            FROM ' . prefixTable('nested_tree') . '
3487
+            FROM ' . prefixTable('nested_tree').'
3489 3488
             WHERE id = %i',
3490 3489
             $post_target_folder_id
3491 3490
         );
3492 3491
 
3493 3492
         // check if target is not a child of source
3494 3493
         if ($tree->isChildOf($post_target_folder_id, $post_source_folder_id) === true) {
3495
-            $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3494
+            $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3496 3495
             echo $returnValues;
3497 3496
             break;
3498 3497
         }
3499 3498
 
3500 3499
         // check if source or target folder is PF. If Yes, then cancel operation
3501 3500
         if ((int) $tmp_source['personal_folder'] === 1 || (int) $tmp_target['personal_folder'] === 1) {
3502
-            $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3501
+            $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3503 3502
             echo $returnValues;
3504 3503
             break;
3505 3504
         }
3506 3505
 
3507 3506
         // check if source or target folder is PF. If Yes, then cancel operation
3508 3507
         if ($tmp_source['title'] === $_SESSION['user_id'] || $tmp_target['title'] === $_SESSION['user_id']) {
3509
-            $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3508
+            $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3510 3509
             echo $returnValues;
3511 3510
             break;
3512 3511
         }
@@ -3631,7 +3630,7 @@  discard block
 block discarded – undo
3631 3630
             $uniqueLoadData['path'] = $arr_arbo;
3632 3631
 
3633 3632
             // store last folder accessed in cookie
3634
-            $arr_cookie_options = array (
3633
+            $arr_cookie_options = array(
3635 3634
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3636 3635
                 'path' => '/', 
3637 3636
                 'secure' => true,
@@ -3649,7 +3648,7 @@  discard block
 block discarded – undo
3649 3648
             foreach ($_SESSION['user_roles'] as $role) {
3650 3649
                 $roleQ = DB::queryfirstrow(
3651 3650
                     'SELECT allow_pw_change
3652
-                    FROM ' . prefixTable('roles_title') . '
3651
+                    FROM ' . prefixTable('roles_title').'
3653 3652
                     WHERE id = %i',
3654 3653
                     $role
3655 3654
                 );
@@ -3674,11 +3673,11 @@  discard block
 block discarded – undo
3674 3673
                 
3675 3674
                 foreach ($_SESSION['user_roles'] as $role) {
3676 3675
                     $access = DB::queryFirstRow(
3677
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3676
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3678 3677
                         $role,
3679 3678
                         $inputData['id']
3680 3679
                     );
3681
-                    if (DB::count()>0) {
3680
+                    if (DB::count() > 0) {
3682 3681
                         if ($access['type'] === 'R') {
3683 3682
                             array_push($arrTmp, 10);
3684 3683
                         } elseif ($access['type'] === 'W') {
@@ -3743,7 +3742,7 @@  discard block
 block discarded – undo
3743 3742
             } else {
3744 3743
                 DB::query(
3745 3744
                     'SELECT *
3746
-                    FROM ' . prefixTable('items') . '
3745
+                    FROM ' . prefixTable('items').'
3747 3746
                     WHERE inactif = %i',
3748 3747
                     0
3749 3748
                 );
@@ -3753,7 +3752,7 @@  discard block
 block discarded – undo
3753 3752
 
3754 3753
             // Get folder complexity
3755 3754
             $folderComplexity = DB::queryFirstRow(
3756
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3755
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3757 3756
                 'complex',
3758 3757
                 $inputData['id']
3759 3758
             );
@@ -3765,7 +3764,7 @@  discard block
 block discarded – undo
3765 3764
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3766 3765
                 $folderRow = DB::query(
3767 3766
                     'SELECT id_category
3768
-                    FROM ' . prefixTable('categories_folders') . '
3767
+                    FROM ' . prefixTable('categories_folders').'
3769 3768
                     WHERE id_folder = %i',
3770 3769
                     $inputData['id']
3771 3770
                 );
@@ -3879,13 +3878,13 @@  discard block
 block discarded – undo
3879 3878
             // List all ITEMS
3880 3879
             if ($folderIsPf === false) {
3881 3880
                 $where->add('i.inactif=%i', 0);
3882
-                $where->add('l.date=%l', '(SELECT date FROM ' . prefixTable('log_items') . " WHERE action IN ('at_creation', 'at_modification') AND id_item=i.id ORDER BY date DESC LIMIT 1)");
3881
+                $where->add('l.date=%l', '(SELECT date FROM '.prefixTable('log_items')." WHERE action IN ('at_creation', 'at_modification') AND id_item=i.id ORDER BY date DESC LIMIT 1)");
3883 3882
                 if (empty($limited_to_items) === false) {
3884 3883
                     $where->add('i.id IN %ls', explode(',', $limited_to_items));
3885 3884
                 }
3886 3885
 
3887
-                $query_limit = ' LIMIT ' .
3888
-                    $start . ',' .
3886
+                $query_limit = ' LIMIT '.
3887
+                    $start.','.
3889 3888
                     $post_nb_items_to_display_once;
3890 3889
                 //db::debugmode(true);
3891 3890
                 $rows = DB::query(
@@ -3896,9 +3895,9 @@  discard block
 block discarded – undo
3896 3895
                     MIN(l.action) AS log_action,
3897 3896
                     l.id_user AS log_user,
3898 3897
                     i.url AS link
3899
-                    FROM ' . prefixTable('items') . ' AS i
3900
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3901
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
3898
+                    FROM ' . prefixTable('items').' AS i
3899
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3900
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
3902 3901
                     WHERE %l
3903 3902
                     GROUP BY i.id, l.date, l.id_user, l.action
3904 3903
                     ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -3917,9 +3916,9 @@  discard block
 block discarded – undo
3917 3916
                     MIN(l.action) AS log_action,
3918 3917
                     l.id_user AS log_user,
3919 3918
                     i.url AS link
3920
-                    FROM ' . prefixTable('items') . ' AS i
3921
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3922
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
3919
+                    FROM ' . prefixTable('items').' AS i
3920
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3921
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
3923 3922
                     WHERE %l
3924 3923
                     GROUP BY i.id, l.date, l.id_user, l.action
3925 3924
                     ORDER BY i.label ASC, l.date DESC',
@@ -3950,7 +3949,7 @@  discard block
 block discarded – undo
3950 3949
                     $item_is_restricted_to_role = false;
3951 3950
                     DB::queryfirstrow(
3952 3951
                         'SELECT role_id
3953
-                        FROM ' . prefixTable('restriction_to_roles') . '
3952
+                        FROM ' . prefixTable('restriction_to_roles').'
3954 3953
                         WHERE item_id = %i',
3955 3954
                         $record['id']
3956 3955
                     );
@@ -3962,7 +3961,7 @@  discard block
 block discarded – undo
3962 3961
                     $user_is_included_in_role = false;
3963 3962
                     DB::query(
3964 3963
                         'SELECT role_id
3965
-                        FROM ' . prefixTable('restriction_to_roles') . '
3964
+                        FROM ' . prefixTable('restriction_to_roles').'
3966 3965
                         WHERE item_id = %i AND role_id IN %ls',
3967 3966
                         $record['id'],
3968 3967
                         $_SESSION['user_roles']
@@ -4168,9 +4167,9 @@  discard block
 block discarded – undo
4168 4167
         if ((int) $start === 0) {
4169 4168
             DB::query(
4170 4169
                 'SELECT i.id
4171
-                FROM ' . prefixTable('items') . ' as i
4172
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4173
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4170
+                FROM ' . prefixTable('items').' as i
4171
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4172
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4174 4173
                 WHERE %l
4175 4174
                 ORDER BY i.label ASC, l.date DESC',
4176 4175
                 $where
@@ -4236,8 +4235,8 @@  discard block
 block discarded – undo
4236 4235
         // Run query
4237 4236
         $dataItem = DB::queryfirstrow(
4238 4237
             'SELECT i.pw AS pw, s.share_key AS share_key
4239
-            FROM ' . prefixTable('items') . ' AS i
4240
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4238
+            FROM ' . prefixTable('items').' AS i
4239
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4241 4240
             WHERE user_id = %i AND i.item_key = %s',
4242 4241
             $_SESSION['user_id'],
4243 4242
             $inputData['itemKey']
@@ -4280,7 +4279,7 @@  discard block
 block discarded – undo
4280 4279
         if (null !== $inputData['itemId'] && empty($inputData['itemId']) === false) {
4281 4280
             $dataItem = DB::queryfirstrow(
4282 4281
                 'SELECT perso, anyone_can_modify
4283
-                FROM ' . prefixTable('items') . '
4282
+                FROM ' . prefixTable('items').'
4284 4283
                 WHERE id=%i',
4285 4284
                 $inputData['itemId']
4286 4285
             );
@@ -4319,7 +4318,7 @@  discard block
 block discarded – undo
4319 4318
             */
4320 4319
 
4321 4320
             // Lock Item (if already locked), go back and warn
4322
-            $dataTmp = DB::queryFirstRow('SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i', $inputData['itemId']);
4321
+            $dataTmp = DB::queryFirstRow('SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i', $inputData['itemId']);
4323 4322
 
4324 4323
             // If token is taken for this Item and delay is passed then delete it.
4325 4324
             if (
@@ -4330,7 +4329,7 @@  discard block
 block discarded – undo
4330 4329
                 DB::delete(prefixTable('items_edition'), 'item_id = %i', $inputData['itemId']);
4331 4330
                 //reload the previous data
4332 4331
                 $dataTmp = DB::queryFirstRow(
4333
-                    'SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i',
4332
+                    'SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i',
4334 4333
                     $inputData['itemId']
4335 4334
                 );
4336 4335
             }
@@ -4374,7 +4373,7 @@  discard block
 block discarded – undo
4374 4373
         // do query on this folder
4375 4374
         $data_this_folder = DB::queryFirstRow(
4376 4375
             'SELECT id, personal_folder, title
4377
-            FROM ' . prefixTable('nested_tree') . '
4376
+            FROM ' . prefixTable('nested_tree').'
4378 4377
             WHERE id = %s',
4379 4378
             $inputData['folderId']
4380 4379
         );
@@ -4415,8 +4414,8 @@  discard block
 block discarded – undo
4415 4414
         $visibilite = '';
4416 4415
         $data = DB::queryFirstRow(
4417 4416
             'SELECT m.valeur, n.personal_folder
4418
-            FROM ' . prefixTable('misc') . ' AS m
4419
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4417
+            FROM ' . prefixTable('misc').' AS m
4418
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4420 4419
             WHERE type=%s AND intitule = %s',
4421 4420
             'complex',
4422 4421
             $inputData['folderId']
@@ -4429,8 +4428,8 @@  discard block
 block discarded – undo
4429 4428
             // Prepare Item actual visibility (what Users/Roles can see it)
4430 4429
             $rows = DB::query(
4431 4430
                 'SELECT t.title
4432
-                FROM ' . prefixTable('roles_values') . ' as v
4433
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4431
+                FROM ' . prefixTable('roles_values').' as v
4432
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4434 4433
                 WHERE v.folder_id = %i
4435 4434
                 GROUP BY title',
4436 4435
                 $inputData['folderId']
@@ -4439,7 +4438,7 @@  discard block
 block discarded – undo
4439 4438
                 if (empty($visibilite)) {
4440 4439
                     $visibilite = $record['title'];
4441 4440
                 } else {
4442
-                    $visibilite .= ' - ' . $record['title'];
4441
+                    $visibilite .= ' - '.$record['title'];
4443 4442
                 }
4444 4443
             }
4445 4444
         } else {
@@ -4449,14 +4448,14 @@  discard block
 block discarded – undo
4449 4448
             // do new query to know if current folder is pf
4450 4449
             $data_pf = DB::queryFirstRow(
4451 4450
                 'SELECT personal_folder
4452
-                FROM ' . prefixTable('nested_tree') . '
4451
+                FROM ' . prefixTable('nested_tree').'
4453 4452
                 WHERE id = %s',
4454 4453
                 $inputData['folderId']
4455 4454
             );
4456 4455
             
4457 4456
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4458 4457
             
4459
-            $visibilite = $_SESSION['name'] . ' ' . $_SESSION['lastname'] . ' (' . $_SESSION['login'] . ')';
4458
+            $visibilite = $_SESSION['name'].' '.$_SESSION['lastname'].' ('.$_SESSION['login'].')';
4460 4459
         }
4461 4460
 
4462 4461
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4466,8 +4465,8 @@  discard block
 block discarded – undo
4466 4465
         $listOptionsForRoles = array();
4467 4466
         $rows = DB::query(
4468 4467
             'SELECT r.role_id AS role_id, t.title AS title
4469
-            FROM ' . prefixTable('roles_values') . ' AS r
4470
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4468
+            FROM ' . prefixTable('roles_values').' AS r
4469
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4471 4470
             WHERE r.folder_id = %i',
4472 4471
             $inputData['folderId']
4473 4472
         );
@@ -4481,7 +4480,7 @@  discard block
 block discarded – undo
4481 4480
             );
4482 4481
             $rows2 = DB::query(
4483 4482
                 'SELECT id, login, fonction_id, email, name, lastname
4484
-                FROM ' . prefixTable('users') . '
4483
+                FROM ' . prefixTable('users').'
4485 4484
                 WHERE admin = 0 AND fonction_id is not null'
4486 4485
             );
4487 4486
             foreach ($rows2 as $record2) {
@@ -4495,7 +4494,7 @@  discard block
 block discarded – undo
4495 4494
                             array(
4496 4495
                                 'id' => $record2['id'],
4497 4496
                                 'login' => $record2['login'],
4498
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4497
+                                'name' => $record2['name'].' '.$record2['lastname'],
4499 4498
                                 'email' => $record2['email'],
4500 4499
                             )
4501 4500
                         );
@@ -4512,13 +4511,13 @@  discard block
 block discarded – undo
4512 4511
                 //db::debugmode(true);
4513 4512
                 $access = DB::queryFirstRow(
4514 4513
                     'SELECT type
4515
-                    FROM ' . prefixTable('roles_values') . '
4514
+                    FROM ' . prefixTable('roles_values').'
4516 4515
                     WHERE role_id = %i AND folder_id = %i',
4517 4516
                     $role,
4518 4517
                     $inputData['folderId']
4519 4518
                 );
4520 4519
                 //db::debugmode(false);
4521
-                if (DB::count()>0) {
4520
+                if (DB::count() > 0) {
4522 4521
                     if ($access['type'] === 'R') {
4523 4522
                         array_push($arrTmp, 10);
4524 4523
                     } elseif ($access['type'] === 'W') {
@@ -4594,7 +4593,7 @@  discard block
 block discarded – undo
4594 4593
         // Get some info before deleting
4595 4594
         $data = DB::queryFirstRow(
4596 4595
             'SELECT name, id_item, file
4597
-            FROM ' . prefixTable('files') . '
4596
+            FROM ' . prefixTable('files').'
4598 4597
             WHERE id = %i',
4599 4598
             $fileId
4600 4599
         );
@@ -4602,7 +4601,7 @@  discard block
 block discarded – undo
4602 4601
         // Load item data
4603 4602
         $data_item = DB::queryFirstRow(
4604 4603
             'SELECT id_tree
4605
-            FROM ' . prefixTable('items') . '
4604
+            FROM ' . prefixTable('items').'
4606 4605
             WHERE id = %i',
4607 4606
             $data['id_item']
4608 4607
         );
@@ -4633,7 +4632,7 @@  discard block
 block discarded – undo
4633 4632
                 $_SESSION['user_id'],
4634 4633
                 'at_modification',
4635 4634
                 $_SESSION['login'],
4636
-                'at_del_file : ' . $data['name']
4635
+                'at_del_file : '.$data['name']
4637 4636
             );
4638 4637
 
4639 4638
             // DElete sharekeys
@@ -4644,7 +4643,7 @@  discard block
 block discarded – undo
4644 4643
             );
4645 4644
 
4646 4645
             // Delete file from server
4647
-            fileDelete($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']), $SETTINGS);
4646
+            fileDelete($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']), $SETTINGS);
4648 4647
         }
4649 4648
 
4650 4649
         echo (string) prepareExchangedData(
@@ -4697,13 +4696,13 @@  discard block
 block discarded – undo
4697 4696
             // Update SESSION with this new favourite
4698 4697
             $data = DB::queryfirstrow(
4699 4698
                 'SELECT label,id_tree
4700
-                FROM ' . prefixTable('items') . '
4699
+                FROM ' . prefixTable('items').'
4701 4700
                 WHERE id = %i',
4702 4701
                 $inputData['itemId']
4703 4702
             );
4704 4703
             $_SESSION['favourites_tab'][$inputData['itemId']] = array(
4705 4704
                 'label' => $data['label'],
4706
-                'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
4705
+                'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
4707 4706
             );
4708 4707
         } elseif ((int) $inputData['action'] === 1) {
4709 4708
             // delete from session
@@ -4775,8 +4774,8 @@  discard block
 block discarded – undo
4775 4774
         // get data about item
4776 4775
         $dataSource = DB::queryfirstrow(
4777 4776
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
4778
-            FROM ' . prefixTable('items') . ' as i
4779
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
4777
+            FROM ' . prefixTable('items').' as i
4778
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
4780 4779
             WHERE i.id=%i',
4781 4780
             $inputData['itemId']
4782 4781
         );
@@ -4784,7 +4783,7 @@  discard block
 block discarded – undo
4784 4783
         // get data about new folder
4785 4784
         $dataDestination = DB::queryfirstrow(
4786 4785
             'SELECT personal_folder, title
4787
-            FROM ' . prefixTable('nested_tree') . '
4786
+            FROM ' . prefixTable('nested_tree').'
4788 4787
             WHERE id = %i',
4789 4788
             $inputData['folderId']
4790 4789
         );
@@ -4838,7 +4837,7 @@  discard block
 block discarded – undo
4838 4837
             // Get fields for this Item
4839 4838
             $rows = DB::query(
4840 4839
                 'SELECT id
4841
-                FROM ' . prefixTable('categories_items') . '
4840
+                FROM ' . prefixTable('categories_items').'
4842 4841
                 WHERE item_id = %i',
4843 4842
                 $inputData['itemId']
4844 4843
             );
@@ -4855,7 +4854,7 @@  discard block
 block discarded – undo
4855 4854
             // Get FILES for this Item
4856 4855
             $rows = DB::query(
4857 4856
                 'SELECT id
4858
-                FROM ' . prefixTable('files') . '
4857
+                FROM ' . prefixTable('files').'
4859 4858
                 WHERE id_item = %i',
4860 4859
                 $inputData['itemId']
4861 4860
             );
@@ -4902,7 +4901,7 @@  discard block
 block discarded – undo
4902 4901
             // Get the ITEM object key for the user
4903 4902
             $userKey = DB::queryFirstRow(
4904 4903
                 'SELECT share_key
4905
-                FROM ' . prefixTable('sharekeys_items') . '
4904
+                FROM ' . prefixTable('sharekeys_items').'
4906 4905
                 WHERE user_id = %i AND object_id = %i',
4907 4906
                 $_SESSION['user_id'],
4908 4907
                 $inputData['itemId']
@@ -4913,8 +4912,8 @@  discard block
 block discarded – undo
4913 4912
                 // This is a public object
4914 4913
                 $users = DB::query(
4915 4914
                     'SELECT id, public_key
4916
-                    FROM ' . prefixTable('users') . '
4917
-                    WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4915
+                    FROM ' . prefixTable('users').'
4916
+                    WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4918 4917
                     AND public_key != ""'
4919 4918
                 );
4920 4919
                 foreach ($users as $user) {
@@ -4934,14 +4933,14 @@  discard block
 block discarded – undo
4934 4933
             // Get fields for this Item
4935 4934
             $rows = DB::query(
4936 4935
                 'SELECT id
4937
-                FROM ' . prefixTable('categories_items') . '
4936
+                FROM ' . prefixTable('categories_items').'
4938 4937
                 WHERE item_id = %i',
4939 4938
                 $inputData['itemId']
4940 4939
             );
4941 4940
             foreach ($rows as $field) {
4942 4941
                 $userKey = DB::queryFirstRow(
4943 4942
                     'SELECT share_key
4944
-                    FROM ' . prefixTable('sharekeys_fields') . '
4943
+                    FROM ' . prefixTable('sharekeys_fields').'
4945 4944
                     WHERE user_id = %i AND object_id = %i',
4946 4945
                     $_SESSION['user_id'],
4947 4946
                     $field['id']
@@ -4952,8 +4951,8 @@  discard block
 block discarded – undo
4952 4951
                     // This is a public object
4953 4952
                     $users = DB::query(
4954 4953
                         'SELECT id, public_key
4955
-                        FROM ' . prefixTable('users') . '
4956
-                        WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4954
+                        FROM ' . prefixTable('users').'
4955
+                        WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4957 4956
                         AND public_key != ""'
4958 4957
                     );
4959 4958
                     foreach ($users as $user) {
@@ -4974,14 +4973,14 @@  discard block
 block discarded – undo
4974 4973
             // Get FILES for this Item
4975 4974
             $rows = DB::query(
4976 4975
                 'SELECT id
4977
-                FROM ' . prefixTable('files') . '
4976
+                FROM ' . prefixTable('files').'
4978 4977
                 WHERE id_item = %i',
4979 4978
                 $inputData['itemId']
4980 4979
             );
4981 4980
             foreach ($rows as $attachment) {
4982 4981
                 $userKey = DB::queryFirstRow(
4983 4982
                     'SELECT share_key
4984
-                    FROM ' . prefixTable('sharekeys_files') . '
4983
+                    FROM ' . prefixTable('sharekeys_files').'
4985 4984
                     WHERE user_id = %i AND object_id = %i',
4986 4985
                     $_SESSION['user_id'],
4987 4986
                     $attachment['id']
@@ -4992,8 +4991,8 @@  discard block
 block discarded – undo
4992 4991
                     // This is a public object
4993 4992
                     $users = DB::query(
4994 4993
                         'SELECT id, public_key
4995
-                        FROM ' . prefixTable('users') . '
4996
-                        WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4994
+                        FROM ' . prefixTable('users').'
4995
+                        WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4997 4996
                         AND public_key != ""'
4998 4997
                     );
4999 4998
                     foreach ($users as $user) {
@@ -5031,7 +5030,7 @@  discard block
 block discarded – undo
5031 5030
             $_SESSION['user_id'],
5032 5031
             'at_modification',
5033 5032
             $_SESSION['login'],
5034
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5033
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5035 5034
         );
5036 5035
 
5037 5036
         // Update cache table
@@ -5098,8 +5097,8 @@  discard block
 block discarded – undo
5098 5097
                 // get data about item
5099 5098
                 $dataSource = DB::queryfirstrow(
5100 5099
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5101
-                    FROM ' . prefixTable('items') . ' as i
5102
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5100
+                    FROM ' . prefixTable('items').' as i
5101
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5103 5102
                     WHERE i.id=%i',
5104 5103
                     $item_id
5105 5104
                 );
@@ -5122,7 +5121,7 @@  discard block
 block discarded – undo
5122 5121
 
5123 5122
                 // get data about new folder
5124 5123
                 $dataDestination = DB::queryfirstrow(
5125
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5124
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5126 5125
                     $inputData['folderId']
5127 5126
                 );
5128 5127
 
@@ -5164,7 +5163,7 @@  discard block
 block discarded – undo
5164 5163
                     // Get fields for this Item
5165 5164
                     $rows = DB::query(
5166 5165
                         'SELECT id
5167
-                        FROM ' . prefixTable('categories_items') . '
5166
+                        FROM ' . prefixTable('categories_items').'
5168 5167
                         WHERE item_id = %i',
5169 5168
                         $item_id
5170 5169
                     );
@@ -5181,7 +5180,7 @@  discard block
 block discarded – undo
5181 5180
                     // Get FILES for this Item
5182 5181
                     $rows = DB::query(
5183 5182
                         'SELECT id
5184
-                        FROM ' . prefixTable('files') . '
5183
+                        FROM ' . prefixTable('files').'
5185 5184
                         WHERE id_item = %i',
5186 5185
                         $item_id
5187 5186
                     );
@@ -5236,7 +5235,7 @@  discard block
 block discarded – undo
5236 5235
                     // Get the ITEM object key for the user
5237 5236
                     $userKey = DB::queryFirstRow(
5238 5237
                         'SELECT share_key
5239
-                        FROM ' . prefixTable('sharekeys_items') . '
5238
+                        FROM ' . prefixTable('sharekeys_items').'
5240 5239
                         WHERE user_id = %i AND object_id = %i',
5241 5240
                         $_SESSION['user_id'],
5242 5241
                         $item_id
@@ -5247,8 +5246,8 @@  discard block
 block discarded – undo
5247 5246
                         // This is a public object
5248 5247
                         $users = DB::query(
5249 5248
                             'SELECT id, public_key
5250
-                            FROM ' . prefixTable('users') . '
5251
-                            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5249
+                            FROM ' . prefixTable('users').'
5250
+                            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5252 5251
                             AND public_key != ""'
5253 5252
                         );
5254 5253
                         foreach ($users as $user) {
@@ -5268,14 +5267,14 @@  discard block
 block discarded – undo
5268 5267
                     // Get fields for this Item
5269 5268
                     $rows = DB::query(
5270 5269
                         'SELECT id
5271
-                        FROM ' . prefixTable('categories_items') . '
5270
+                        FROM ' . prefixTable('categories_items').'
5272 5271
                         WHERE item_id = %i',
5273 5272
                         $item_id
5274 5273
                     );
5275 5274
                     foreach ($rows as $field) {
5276 5275
                         $userKey = DB::queryFirstRow(
5277 5276
                             'SELECT share_key
5278
-                            FROM ' . prefixTable('sharekeys_fields') . '
5277
+                            FROM ' . prefixTable('sharekeys_fields').'
5279 5278
                             WHERE user_id = %i AND object_id = %i',
5280 5279
                             $_SESSION['user_id'],
5281 5280
                             $field['id']
@@ -5286,8 +5285,8 @@  discard block
 block discarded – undo
5286 5285
                             // This is a public object
5287 5286
                             $users = DB::query(
5288 5287
                                 'SELECT id, public_key
5289
-                                FROM ' . prefixTable('users') . '
5290
-                                WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5288
+                                FROM ' . prefixTable('users').'
5289
+                                WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5291 5290
                                 AND public_key != ""'
5292 5291
                             );
5293 5292
                             foreach ($users as $user) {
@@ -5308,14 +5307,14 @@  discard block
 block discarded – undo
5308 5307
                     // Get FILES for this Item
5309 5308
                     $rows = DB::query(
5310 5309
                         'SELECT id
5311
-                        FROM ' . prefixTable('files') . '
5310
+                        FROM ' . prefixTable('files').'
5312 5311
                         WHERE id_item = %i',
5313 5312
                         $item_id
5314 5313
                     );
5315 5314
                     foreach ($rows as $attachment) {
5316 5315
                         $userKey = DB::queryFirstRow(
5317 5316
                             'SELECT share_key
5318
-                            FROM ' . prefixTable('sharekeys_files') . '
5317
+                            FROM ' . prefixTable('sharekeys_files').'
5319 5318
                             WHERE user_id = %i AND object_id = %i',
5320 5319
                             $_SESSION['user_id'],
5321 5320
                             $attachment['id']
@@ -5326,8 +5325,8 @@  discard block
 block discarded – undo
5326 5325
                             // This is a public object
5327 5326
                             $users = DB::query(
5328 5327
                                 'SELECT id, public_key
5329
-                                FROM ' . prefixTable('users') . '
5330
-                                WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5328
+                                FROM ' . prefixTable('users').'
5329
+                                WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5331 5330
                                 AND public_key != ""'
5332 5331
                             );
5333 5332
                             foreach ($users as $user) {
@@ -5364,13 +5363,13 @@  discard block
 block discarded – undo
5364 5363
                     $_SESSION['user_id'],
5365 5364
                     'at_modification',
5366 5365
                     $_SESSION['login'],
5367
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5366
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5368 5367
                 );
5369 5368
             }
5370 5369
         }
5371 5370
 
5372 5371
         // reload cache table
5373
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5372
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5374 5373
         updateCacheTable('reload', $SETTINGS, null);
5375 5374
 
5376 5375
         echo (string) prepareExchangedData(
@@ -5439,7 +5438,7 @@  discard block
 block discarded – undo
5439 5438
                 // get info
5440 5439
                 $dataSource = DB::queryfirstrow(
5441 5440
                     'SELECT label, id_tree
5442
-                    FROM ' . prefixTable('items') . '
5441
+                    FROM ' . prefixTable('items').'
5443 5442
                     WHERE id=%i',
5444 5443
                     $item_id
5445 5444
                 );
@@ -5543,8 +5542,8 @@  discard block
 block discarded – undo
5543 5542
         }
5544 5543
         if ($inputData['cat'] === 'request_access_to_author') {
5545 5544
             // Variables
5546
-            $dataAuthor = DB::queryfirstrow('SELECT email,login FROM ' . prefixTable('users') . ' WHERE id = ' . $post_content[1]);
5547
-            $dataItem = DB::queryfirstrow('SELECT label, id_tree FROM ' . prefixTable('items') . ' WHERE id = ' . $post_content[0]);
5545
+            $dataAuthor = DB::queryfirstrow('SELECT email,login FROM '.prefixTable('users').' WHERE id = '.$post_content[1]);
5546
+            $dataItem = DB::queryfirstrow('SELECT label, id_tree FROM '.prefixTable('items').' WHERE id = '.$post_content[0]);
5548 5547
 
5549 5548
             // Get path
5550 5549
             $path = geItemReadablePath(
@@ -5558,7 +5557,7 @@  discard block
 block discarded – undo
5558 5557
                 langHdl('email_request_access_subject'),
5559 5558
                 str_replace(
5560 5559
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5561
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($_SESSION['login']), $path),
5560
+                    array(' '.addslashes($dataAuthor['login']), addslashes($_SESSION['login']), $path),
5562 5561
                     langHdl('email_request_access_mail')
5563 5562
                 ),
5564 5563
                 $dataAuthor['email'],
@@ -5568,7 +5567,7 @@  discard block
 block discarded – undo
5568 5567
         } elseif ($inputData['cat'] === 'share_this_item') {
5569 5568
             $dataItem = DB::queryfirstrow(
5570 5569
                 'SELECT label,id_tree
5571
-                FROM ' . prefixTable('items') . '
5570
+                FROM ' . prefixTable('items').'
5572 5571
                 WHERE id= %i',
5573 5572
                 $inputData['id']
5574 5573
             );
@@ -5591,7 +5590,7 @@  discard block
 block discarded – undo
5591 5590
                     ),
5592 5591
                     array(
5593 5592
                         empty($SETTINGS['email_server_url']) === false ?
5594
-                            $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'],
5593
+                            $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'],
5595 5594
                         addslashes($_SESSION['login']),
5596 5595
                         addslashes($path),
5597 5596
                     ),
@@ -5694,8 +5693,8 @@  discard block
 block discarded – undo
5694 5693
         // Get all informations for this item
5695 5694
         $dataItem = DB::queryfirstrow(
5696 5695
             'SELECT *
5697
-            FROM ' . prefixTable('items') . ' as i
5698
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
5696
+            FROM ' . prefixTable('items').' as i
5697
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
5699 5698
             WHERE i.id=%i AND l.action = %s',
5700 5699
             $item_id,
5701 5700
             'at_creation'
@@ -5724,18 +5723,18 @@  discard block
 block discarded – undo
5724 5723
                 $_SESSION['login'],
5725 5724
                 htmlspecialchars_decode($label, ENT_QUOTES),
5726 5725
                 null,
5727
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
5726
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
5728 5727
             );
5729 5728
             // Prepare new line
5730 5729
             $data = DB::queryfirstrow(
5731
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
5730
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
5732 5731
                 $item_id
5733 5732
             );
5734
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $_SESSION['login'] . ' - ' . langHdl($data['action']) . ' - ' . $data['raison'];
5733
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$_SESSION['login'].' - '.langHdl($data['action']).' - '.$data['raison'];
5735 5734
             // send back
5736 5735
             $data = array(
5737 5736
                 'error' => '',
5738
-                'new_line' => '<br>' . addslashes($historic),
5737
+                'new_line' => '<br>'.addslashes($historic),
5739 5738
             );
5740 5739
             echo (string) prepareExchangedData(
5741 5740
                 $SETTINGS['cpassman_dir'],
@@ -5810,7 +5809,7 @@  discard block
 block discarded – undo
5810 5809
         );
5811 5810
 
5812 5811
         // delete all existing old otv codes
5813
-        $rows = DB::query('SELECT id FROM ' . prefixTable('otv') . ' WHERE time_limit < ' . time());
5812
+        $rows = DB::query('SELECT id FROM '.prefixTable('otv').' WHERE time_limit < '.time());
5814 5813
         foreach ($rows as $record) {
5815 5814
             DB::delete(prefixTable('otv'), 'id=%i', $record['id']);
5816 5815
         }
@@ -5832,8 +5831,8 @@  discard block
 block discarded – undo
5832 5831
         // Should we log a password change?
5833 5832
         $itemQ = DB::queryFirstRow(
5834 5833
             'SELECT s.share_key, i.pw
5835
-            FROM ' . prefixTable('items') . ' AS i
5836
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
5834
+            FROM ' . prefixTable('items').' AS i
5835
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
5837 5836
             WHERE s.user_id = %i AND s.object_id = %i',
5838 5837
             $_SESSION['user_id'],
5839 5838
             $dataReceived['id']
@@ -5885,7 +5884,7 @@  discard block
 block discarded – undo
5885 5884
         if (isset($SETTINGS['otv_expiration_period']) === false) {
5886 5885
             $SETTINGS['otv_expiration_period'] = 7;
5887 5886
         }
5888
-        $url = $SETTINGS['cpassman_url'] . '/index.php?otv=true&' . http_build_query($otv_session);
5887
+        $url = $SETTINGS['cpassman_url'].'/index.php?otv=true&'.http_build_query($otv_session);
5889 5888
 
5890 5889
         echo json_encode(
5891 5890
             array(
@@ -5957,8 +5956,8 @@  discard block
 block discarded – undo
5957 5956
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
5958 5957
             f.extension AS extension, f.type AS type,
5959 5958
             s.share_key AS share_key
5960
-            FROM ' . prefixTable('files') . ' AS f
5961
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
5959
+            FROM ' . prefixTable('files').' AS f
5960
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
5962 5961
             WHERE s.user_id = %i AND s.object_id = %i',
5963 5962
             $_SESSION['user_id'],
5964 5963
             $inputData['id']
@@ -5980,7 +5979,7 @@  discard block
 block discarded – undo
5980 5979
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
5981 5980
 
5982 5981
         // prepare image info
5983
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
5982
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
5984 5983
         $post_title = isBase64($post_title) === true ?
5985 5984
             base64_decode($post_title) : $post_title;
5986 5985
         $image_code = $file_info['file'];
@@ -5998,7 +5997,7 @@  discard block
 block discarded – undo
5998 5997
             $SETTINGS['cpassman_dir'],
5999 5998
             array(
6000 5999
                 'error' => false,
6001
-                'filename' => $post_title . '.' . $file_info['extension'],
6000
+                'filename' => $post_title.'.'.$file_info['extension'],
6002 6001
                 'file_type' => $file_info['type'],
6003 6002
                 'file_content' => $fileContent,
6004 6003
             ),
@@ -6052,16 +6051,16 @@  discard block
 block discarded – undo
6052 6051
         $idFolder = $dataReceived['idFolder'];
6053 6052
 
6054 6053
         // don't check if Personal Folder
6055
-        $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $idFolder);
6054
+        $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $idFolder);
6056 6055
         if ($data['title'] === $_SESSION['user_id']) {
6057 6056
             // send data
6058
-            echo '[{"duplicate" : "' . $duplicate . '" , error" : ""}]';
6057
+            echo '[{"duplicate" : "'.$duplicate.'" , error" : ""}]';
6059 6058
         } else {
6060 6059
             if ($inputData['option'] === 'same_folder') {
6061 6060
                 // case unique folder
6062 6061
                 DB::query(
6063 6062
                     'SELECT label
6064
-                    FROM ' . prefixTable('items') . '
6063
+                    FROM ' . prefixTable('items').'
6065 6064
                     WHERE id_tree = %i AND label = %s',
6066 6065
                     $idFolder,
6067 6066
                     $label
@@ -6073,7 +6072,7 @@  discard block
 block discarded – undo
6073 6072
                 $arrayPf = array();
6074 6073
                 if (empty($row['id']) === false) {
6075 6074
                     $rows = DB::query(
6076
-                        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
6075
+                        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
6077 6076
                         '1'
6078 6077
                     );
6079 6078
                     foreach ($rows as $record) {
@@ -6088,12 +6087,12 @@  discard block
 block discarded – undo
6088 6087
                 $where->add('id_tree = %i', $idFolder);
6089 6088
                 $where->add('label = %s', $label);
6090 6089
                 if (empty($arrayPf) === false) {
6091
-                    $where->add('id_tree NOT IN (' . implode(',', $arrayPf) . ')');
6090
+                    $where->add('id_tree NOT IN ('.implode(',', $arrayPf).')');
6092 6091
                 }
6093 6092
 
6094 6093
                 DB::query(
6095 6094
                     'SELECT label
6096
-                    FROM ' . prefixTable('items') . '
6095
+                    FROM ' . prefixTable('items').'
6097 6096
                     WHERE %l',
6098 6097
                     $where
6099 6098
                 );
@@ -6105,7 +6104,7 @@  discard block
 block discarded – undo
6105 6104
             }
6106 6105
 
6107 6106
             // send data
6108
-            echo '[{"duplicate" : "' . $duplicate . '" , "error" : ""}]';
6107
+            echo '[{"duplicate" : "'.$duplicate.'" , "error" : ""}]';
6109 6108
         }
6110 6109
         break;
6111 6110
 
@@ -6150,7 +6149,7 @@  discard block
 block discarded – undo
6150 6149
         if (isset($dataReceived['force_refresh_cache']) === true && $dataReceived['force_refresh_cache'] === false) {
6151 6150
             $goCachedFolders = loadFoldersListByCache('visible_folders', 'folders');
6152 6151
             if ($goCachedFolders['state'] === true) {
6153
-                $arr_data['folders'] = json_decode($goCachedFolders['data'], true);//print_r($arr_data);
6152
+                $arr_data['folders'] = json_decode($goCachedFolders['data'], true); //print_r($arr_data);
6154 6153
                 // send data
6155 6154
                 echo (string) prepareExchangedData(
6156 6155
                     $SETTINGS['cpassman_dir'],
@@ -6187,7 +6186,7 @@  discard block
 block discarded – undo
6187 6186
         }
6188 6187
 
6189 6188
         //Build tree
6190
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tree/NestedTree/NestedTree.php';
6189
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tree/NestedTree/NestedTree.php';
6191 6190
         $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
6192 6191
         $tree->rebuild();
6193 6192
         $folders = $tree->getDescendants();
@@ -6237,7 +6236,7 @@  discard block
 block discarded – undo
6237 6236
                         if (empty($arr_data['folders'][$inc]['path']) === true) {
6238 6237
                             $arr_data['folders'][$inc]['path'] = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6239 6238
                         } else {
6240
-                            $arr_data['folders'][$inc]['path'] .= ' / ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6239
+                            $arr_data['folders'][$inc]['path'] .= ' / '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6241 6240
                         }
6242 6241
                     }
6243 6242
 
@@ -6319,7 +6318,7 @@  discard block
 block discarded – undo
6319 6318
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6320 6319
             $rows = DB::query(
6321 6320
                 'SELECT id, categories
6322
-                FROM ' . prefixTable('nested_tree') . '
6321
+                FROM ' . prefixTable('nested_tree').'
6323 6322
                 WHERE id IN (%l)',
6324 6323
                 implode(',', $foldersArray)
6325 6324
             );
@@ -6363,7 +6362,7 @@  discard block
 block discarded – undo
6363 6362
         // get item info
6364 6363
         $dataItem = DB::queryFirstRow(
6365 6364
             'SELECT *
6366
-            FROM ' . prefixTable('items') . '
6365
+            FROM ' . prefixTable('items').'
6367 6366
             WHERE id=%i',
6368 6367
             $inputData['itemId']
6369 6368
         );
@@ -6375,8 +6374,8 @@  discard block
 block discarded – undo
6375 6374
             'SELECT l.date as date, l.action as action, l.raison as raison,
6376 6375
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6377 6376
                 l.old_value as old_value
6378
-            FROM ' . prefixTable('log_items') . ' as l
6379
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6377
+            FROM ' . prefixTable('log_items').' as l
6378
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6380 6379
             WHERE id_item=%i AND l.action NOT IN (%l)
6381 6380
             ORDER BY date DESC',
6382 6381
             $inputData['itemId'],
@@ -6391,18 +6390,18 @@  discard block
 block discarded – undo
6391 6390
             
6392 6391
             // imported via API
6393 6392
             if (empty($record['login']) === true) {
6394
-                $record['login'] = langHdl('imported_via_api') . ' [' . $record['raison'] . ']';
6393
+                $record['login'] = langHdl('imported_via_api').' ['.$record['raison'].']';
6395 6394
             }
6396 6395
             
6397 6396
             // Prepare avatar
6398 6397
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6399
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6400
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6398
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6399
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6401 6400
                 } else {
6402
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6401
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6403 6402
                 }
6404 6403
             } else {
6405
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6404
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6406 6405
             }
6407 6406
 
6408 6407
             // Prepare action
@@ -6422,7 +6421,7 @@  discard block
 block discarded – undo
6422 6421
                         $previous_passwords, 
6423 6422
                         [
6424 6423
                             'password' => $previous_pwd['string'],
6425
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6424
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6426 6425
                         ]
6427 6426
                     );
6428 6427
                 }
@@ -6435,19 +6434,19 @@  discard block
 block discarded – undo
6435 6434
                 $action = langHdl($reason[0]);
6436 6435
                 if ($reason[0] === 'at_moved') {
6437 6436
                     $tmp = explode(' -> ', $reason[1]);
6438
-                    $detail = langHdl('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . langHdl('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6437
+                    $detail = langHdl('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.langHdl('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6439 6438
                 } elseif ($reason[0] === 'at_field') {
6440 6439
                     $tmp = explode(' => ', $reason[1]);
6441 6440
                     if (count($tmp) > 1) {
6442
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . langHdl('previous_value') .
6443
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6441
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.langHdl('previous_value').
6442
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6444 6443
                     } else {
6445 6444
                         $detail = trim($reason[1]);
6446 6445
                     }
6447 6446
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6448 6447
                     $tmp = explode(' => ', $reason[1]);
6449 6448
                     $detail = empty(trim($tmp[0])) === true ?
6450
-                        langHdl('no_previous_value') : langHdl('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6449
+                        langHdl('no_previous_value') : langHdl('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6451 6450
                 } elseif ($reason[0] === 'at_automatic_del') {
6452 6451
                     $detail = langHdl($reason[1]);
6453 6452
                 } elseif ($reason[0] === 'at_anyoneconmodify') {
@@ -6456,7 +6455,7 @@  discard block
 block discarded – undo
6456 6455
                     $tmp = explode(':', $reason[1]);
6457 6456
                     $tmp = explode('.', $tmp[0]);
6458 6457
                     $detail = isBase64($tmp[0]) === true ?
6459
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6458
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6460 6459
                 } elseif ($reason[0] === 'at_import') {
6461 6460
                     $detail = '';
6462 6461
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6475,8 +6474,8 @@  discard block
 block discarded – undo
6475 6474
                 array(
6476 6475
                     'avatar' => $avatar,
6477 6476
                     'login' => $record['login'],
6478
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6479
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6477
+                    'name' => $record['name'].' '.$record['lastname'],
6478
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6480 6479
                     'action' => $action,
6481 6480
                     'detail' => $detail,
6482 6481
                 )
@@ -6568,18 +6567,18 @@  discard block
 block discarded – undo
6568 6567
 
6569 6568
         // get some info to add to the notification email
6570 6569
         $resp_user = DB::queryfirstrow(
6571
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6570
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6572 6571
             $_SESSION['user_id']
6573 6572
         );
6574 6573
         $resp_folder = DB::queryfirstrow(
6575
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6574
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6576 6575
             $folder
6577 6576
         );
6578 6577
 
6579 6578
         // notify Managers
6580 6579
         $rows = DB::query(
6581 6580
             'SELECT email
6582
-            FROM ' . prefixTable('users') . '
6581
+            FROM ' . prefixTable('users').'
6583 6582
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6584 6583
             1
6585 6584
         );
@@ -6611,14 +6610,14 @@  discard block
 block discarded – undo
6611 6610
         // Get list of users
6612 6611
         $usersList = array();
6613 6612
         $usersString = '';
6614
-        $rows = DB::query('SELECT id,login,email FROM ' . prefixTable('users') . ' ORDER BY login ASC');
6613
+        $rows = DB::query('SELECT id,login,email FROM '.prefixTable('users').' ORDER BY login ASC');
6615 6614
         foreach ($rows as $record) {
6616 6615
             $usersList[$record['login']] = array(
6617 6616
                 'id' => $record['id'],
6618 6617
                 'login' => $record['login'],
6619 6618
                 'email' => $record['email'],
6620 6619
             );
6621
-            $usersString .= $record['id'] . '#' . $record['login'] . ';';
6620
+            $usersString .= $record['id'].'#'.$record['login'].';';
6622 6621
         }
6623 6622
 
6624 6623
         $data = array(
@@ -6661,7 +6660,7 @@  discard block
 block discarded – undo
6661 6660
         // Send email
6662 6661
         $dataItem = DB::queryfirstrow(
6663 6662
             'SELECT label, id_tree
6664
-            FROM ' . prefixTable('items') . '
6663
+            FROM ' . prefixTable('items').'
6665 6664
             WHERE id = %i',
6666 6665
             $inputData['itemId']
6667 6666
         );
@@ -6761,7 +6760,7 @@  discard block
 block discarded – undo
6761 6760
 
6762 6761
         DB::query(
6763 6762
             'SELECT *
6764
-            FROM ' . prefixTable('notification') . '
6763
+            FROM ' . prefixTable('notification').'
6765 6764
             WHERE item_id = %i AND user_id = %i',
6766 6765
             $inputData['itemId'],
6767 6766
             $_SESSION['user_id']
@@ -6836,7 +6835,7 @@  discard block
 block discarded – undo
6836 6835
         // And related logs
6837 6836
         $rows = DB::query(
6838 6837
             'SELECT id, file AS filename
6839
-            FROM ' . prefixTable('files') . '
6838
+            FROM ' . prefixTable('files').'
6840 6839
             WHERE id_item = %i AND confirmed = %i',
6841 6840
             $inputData['itemId'],
6842 6841
             0
@@ -6850,12 +6849,12 @@  discard block
 block discarded – undo
6850 6849
             );
6851 6850
 
6852 6851
             // Delete file on server
6853
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6852
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6854 6853
 
6855 6854
             // Delete related logs
6856 6855
             $logFile = DB::query(
6857 6856
                 'SELECT increment_id, raison
6858
-                FROM ' . prefixTable('log_items') . '
6857
+                FROM ' . prefixTable('log_items').'
6859 6858
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6860 6859
                 $inputData['itemId'],
6861 6860
                 $_SESSION['user_id'],
@@ -6917,7 +6916,7 @@  discard block
 block discarded – undo
6917 6916
         // Confirm attachments
6918 6917
         $rows = DB::query(
6919 6918
             'SELECT id, file AS filename
6920
-            FROM ' . prefixTable('files') . '
6919
+            FROM ' . prefixTable('files').'
6921 6920
             WHERE id_item = %i AND confirmed = %i',
6922 6921
             $inputData['itemId'],
6923 6922
             0
@@ -6978,7 +6977,7 @@  discard block
 block discarded – undo
6978 6977
 
6979 6978
         $data = DB::queryFirstRow(
6980 6979
             'SELECT visible_folders
6981
-            FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i',
6980
+            FROM ' . prefixTable('cache_tree').' WHERE user_id = %i',
6982 6981
             $inputData['userId']
6983 6982
         );
6984 6983
         // Check if tree ID is in visible folders.
@@ -7013,15 +7012,15 @@  discard block
 block discarded – undo
7013 7012
         case 'autocomplete_tags':
7014 7013
             // Get a list off all existing TAGS
7015 7014
             $listOfTags = '';
7016
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7015
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7017 7016
             foreach ($rows as $record) {
7018 7017
                 if (empty($listOfTags)) {
7019
-                    $listOfTags = '"' . $record['tag'] . '"';
7018
+                    $listOfTags = '"'.$record['tag'].'"';
7020 7019
                 } else {
7021
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7020
+                    $listOfTags .= ', "'.$record['tag'].'"';
7022 7021
                 }
7023 7022
             }
7024
-            echo '[' . $listOfTags . ']';
7023
+            echo '['.$listOfTags.']';
7025 7024
             break;
7026 7025
     }
7027 7026
 }
@@ -7037,7 +7036,7 @@  discard block
 block discarded – undo
7037 7036
 {
7038 7037
     $data = DB::queryFirstRow(
7039 7038
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7040
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7039
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7041 7040
         $groupe
7042 7041
     );
7043 7042
     // Check if it's in a personal folder. If yes, then force complexity overhead.
Please login to merge, or discard this patch.