Passed
Push — teampass_3.0 ( ad0650...a80954 )
by Nils
05:29
created
sources/import.queries.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             $config->setIgnoreHeaderLine('true');
166 166
             // extract data from CSV file
167 167
             $interpreter = new Interpreter();
168
-            $interpreter->addObserver(function (array $row) use (&$valuesToImport) {
168
+            $interpreter->addObserver(function(array $row) use (&$valuesToImport) {
169 169
                 $valuesToImport[] = array(
170 170
                     'Label' => $row[0],
171 171
                     'Login' => $row[1],
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
         // Decrypt and retreive data in JSON format
310 310
         $post_items = prepareExchangedData(
311
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
311
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
312 312
 
313 313
         // Init post variable
314 314
         $post_folder = filter_input(INPUT_POST, 'folder', FILTER_SANITIZE_NUMBER_INT);
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 
460 460
         // Decrypt and retreive data in JSON format
461 461
         $receivedParameters = prepareExchangedData(
462
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
462
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
463 463
 
464 464
         $post_folder_id = filter_var($receivedParameters['folder-id'], FILTER_SANITIZE_NUMBER_INT);
465 465
         $post_operation_id = filter_var($receivedParameters['file'], FILTER_SANITIZE_STRING);
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
         break;
1187 1187
 }
1188 1188
 
1189
-spl_autoload_register(function ($class) {
1189
+spl_autoload_register(function($class) {
1190 1190
     $prefix = 'League\\Csv\\';
1191 1191
     $base_dir = __DIR__.'/src/';
1192 1192
     $len = strlen($prefix);
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -122,29 +122,29 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
124 124
 {
125
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
125
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
126 126
     $err = false;
127 127
     // load PhpEncryption library
128 128
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
129 129
         $path = '../includes/libraries/Encryption/Encryption/';
130 130
     } else {
131
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
132
-    }
133
-
134
-    include_once $path . 'Exception/CryptoException.php';
135
-    include_once $path . 'Exception/BadFormatException.php';
136
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
137
-    include_once $path . 'Exception/IOException.php';
138
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
139
-    include_once $path . 'Crypto.php';
140
-    include_once $path . 'Encoding.php';
141
-    include_once $path . 'DerivedKeys.php';
142
-    include_once $path . 'Key.php';
143
-    include_once $path . 'KeyOrPassword.php';
144
-    include_once $path . 'File.php';
145
-    include_once $path . 'RuntimeTests.php';
146
-    include_once $path . 'KeyProtectedByPassword.php';
147
-    include_once $path . 'Core.php';
131
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
132
+    }
133
+
134
+    include_once $path.'Exception/CryptoException.php';
135
+    include_once $path.'Exception/BadFormatException.php';
136
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
137
+    include_once $path.'Exception/IOException.php';
138
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
139
+    include_once $path.'Crypto.php';
140
+    include_once $path.'Encoding.php';
141
+    include_once $path.'DerivedKeys.php';
142
+    include_once $path.'Key.php';
143
+    include_once $path.'KeyOrPassword.php';
144
+    include_once $path.'File.php';
145
+    include_once $path.'RuntimeTests.php';
146
+    include_once $path.'KeyProtectedByPassword.php';
147
+    include_once $path.'Core.php';
148 148
     
149 149
     // convert KEY
150 150
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
         $path = '../includes/libraries/Encryption/Encryption/';
190 190
     }
191 191
 
192
-    include_once $path . 'Exception/CryptoException.php';
193
-    include_once $path . 'Exception/BadFormatException.php';
194
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
195
-    include_once $path . 'Exception/IOException.php';
196
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
197
-    include_once $path . 'Crypto.php';
198
-    include_once $path . 'Encoding.php';
199
-    include_once $path . 'DerivedKeys.php';
200
-    include_once $path . 'Key.php';
201
-    include_once $path . 'KeyOrPassword.php';
202
-    include_once $path . 'File.php';
203
-    include_once $path . 'RuntimeTests.php';
204
-    include_once $path . 'KeyProtectedByPassword.php';
205
-    include_once $path . 'Core.php';
192
+    include_once $path.'Exception/CryptoException.php';
193
+    include_once $path.'Exception/BadFormatException.php';
194
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
195
+    include_once $path.'Exception/IOException.php';
196
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
197
+    include_once $path.'Crypto.php';
198
+    include_once $path.'Encoding.php';
199
+    include_once $path.'DerivedKeys.php';
200
+    include_once $path.'Key.php';
201
+    include_once $path.'KeyOrPassword.php';
202
+    include_once $path.'File.php';
203
+    include_once $path.'RuntimeTests.php';
204
+    include_once $path.'KeyProtectedByPassword.php';
205
+    include_once $path.'Core.php';
206 206
 
207 207
     $key = \Defuse\Crypto\Key::createNewRandomKey();
208 208
     $key = $key->saveToAsciiSafeString();
@@ -227,20 +227,20 @@  discard block
 block discarded – undo
227 227
         $path = '../includes/libraries/Encryption/Encryption/';
228 228
     }
229 229
 
230
-    include_once $path . 'Exception/CryptoException.php';
231
-    include_once $path . 'Exception/BadFormatException.php';
232
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
233
-    include_once $path . 'Exception/IOException.php';
234
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
235
-    include_once $path . 'Crypto.php';
236
-    include_once $path . 'Encoding.php';
237
-    include_once $path . 'DerivedKeys.php';
238
-    include_once $path . 'Key.php';
239
-    include_once $path . 'KeyOrPassword.php';
240
-    include_once $path . 'File.php';
241
-    include_once $path . 'RuntimeTests.php';
242
-    include_once $path . 'KeyProtectedByPassword.php';
243
-    include_once $path . 'Core.php';
230
+    include_once $path.'Exception/CryptoException.php';
231
+    include_once $path.'Exception/BadFormatException.php';
232
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
233
+    include_once $path.'Exception/IOException.php';
234
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
235
+    include_once $path.'Crypto.php';
236
+    include_once $path.'Encoding.php';
237
+    include_once $path.'DerivedKeys.php';
238
+    include_once $path.'Key.php';
239
+    include_once $path.'KeyOrPassword.php';
240
+    include_once $path.'File.php';
241
+    include_once $path.'RuntimeTests.php';
242
+    include_once $path.'KeyProtectedByPassword.php';
243
+    include_once $path.'Core.php';
244 244
     
245 245
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
246 246
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -265,20 +265,20 @@  discard block
 block discarded – undo
265 265
         $path = '../includes/libraries/Encryption/Encryption/';
266 266
     }
267 267
 
268
-    include_once $path . 'Exception/CryptoException.php';
269
-    include_once $path . 'Exception/BadFormatException.php';
270
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
271
-    include_once $path . 'Exception/IOException.php';
272
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
273
-    include_once $path . 'Crypto.php';
274
-    include_once $path . 'Encoding.php';
275
-    include_once $path . 'DerivedKeys.php';
276
-    include_once $path . 'Key.php';
277
-    include_once $path . 'KeyOrPassword.php';
278
-    include_once $path . 'File.php';
279
-    include_once $path . 'RuntimeTests.php';
280
-    include_once $path . 'KeyProtectedByPassword.php';
281
-    include_once $path . 'Core.php';
268
+    include_once $path.'Exception/CryptoException.php';
269
+    include_once $path.'Exception/BadFormatException.php';
270
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
271
+    include_once $path.'Exception/IOException.php';
272
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
273
+    include_once $path.'Crypto.php';
274
+    include_once $path.'Encoding.php';
275
+    include_once $path.'DerivedKeys.php';
276
+    include_once $path.'Key.php';
277
+    include_once $path.'KeyOrPassword.php';
278
+    include_once $path.'File.php';
279
+    include_once $path.'RuntimeTests.php';
280
+    include_once $path.'KeyProtectedByPassword.php';
281
+    include_once $path.'Core.php';
282 282
 
283 283
     try {
284 284
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
  */
321 321
 function trimElement($chaine, string $element): string
322 322
 {
323
-    if (! empty($chaine)) {
323
+    if (!empty($chaine)) {
324 324
         if (is_array($chaine) === true) {
325 325
             $chaine = implode(';', $chaine);
326 326
         }
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function db_error_handler(array $params): void
370 370
 {
371
-    echo 'Error: ' . $params['error'] . "<br>\n";
372
-    echo 'Query: ' . $params['query'] . "<br>\n";
371
+    echo 'Error: '.$params['error']."<br>\n";
372
+    echo 'Query: '.$params['query']."<br>\n";
373 373
     throw new Exception('Error - Query', 1);
374 374
 }
375 375
 
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
     $SETTINGS
392 392
 ) {
393 393
     //load ClassLoader
394
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
394
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
395 395
     // Load superglobal
396
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
396
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
397 397
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
398 398
     //Connect to DB
399
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
399
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
400 400
     if (defined('DB_PASSWD_CLEAR') === false) {
401 401
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
402 402
     }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     DB::$port = DB_PORT;
408 408
     DB::$encoding = DB_ENCODING;
409 409
     //Build tree
410
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
410
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
411 411
     $tree->register();
412 412
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
413 413
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 function identAdmin($idFonctions, $SETTINGS, $tree)
453 453
 {
454 454
     // Load superglobal
455
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
455
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
456 456
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
457 457
     // Init
458 458
     $groupesVisibles = [];
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
472 472
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
473 473
     // Get list of Folders
474
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
474
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
475 475
     foreach ($rows as $record) {
476 476
         array_push($groupesVisibles, $record['id']);
477 477
     }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     }
491 491
     // Get ID of personal folder
492 492
     $persfld = DB::queryfirstrow(
493
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
493
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
494 494
         $globalsUserId
495 495
     );
496 496
     if (empty($persfld['id']) === false) {
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
     // get complete list of ROLES
512 512
     $tmp = explode(';', $idFonctions);
513 513
     $rows = DB::query(
514
-        'SELECT * FROM ' . prefixTable('roles_title') . '
514
+        'SELECT * FROM '.prefixTable('roles_title').'
515 515
         ORDER BY title ASC'
516 516
     );
517 517
     foreach ($rows as $record) {
518
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
518
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
519 519
             array_push($tmp, $record['id']);
520 520
         }
521 521
     }
522 522
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
523 523
     $superGlobal->put('is_admin', 1, 'SESSION');
524 524
     // Check if admin has created Folders and Roles
525
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
525
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
526 526
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
527
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
527
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
528 528
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
529 529
 
530 530
     return true;
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
     object $tree
571 571
 ) {
572 572
     // Load superglobal
573
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
573
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
574 574
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
575 575
     // Init
576 576
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
     // Does this user is allowed to see other items
610 610
     $inc = 0;
611 611
     $rows = DB::query(
612
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
612
+        'SELECT id, id_tree FROM '.prefixTable('items').'
613 613
             WHERE restricted_to LIKE %ss AND inactif = %s'.
614 614
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
615
-        $globalsUserId . ';',
615
+        $globalsUserId.';',
616 616
         '0'
617 617
     );
618 618
     foreach ($rows as $record) {
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
     // Check for the users roles if some specific rights exist on items
627 627
     $rows = DB::query(
628 628
         'SELECT i.id_tree, r.item_id
629
-        FROM ' . prefixTable('items') . ' as i
630
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
629
+        FROM ' . prefixTable('items').' as i
630
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
631 631
         WHERE r.role_id IN %li AND i.id_tree <> ""
632 632
         ORDER BY i.id_tree ASC',
633 633
         $userRoles
@@ -681,16 +681,16 @@  discard block
 block discarded – undo
681 681
         'SESSION'
682 682
     );
683 683
     // Folders and Roles numbers
684
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
684
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
685 685
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
686
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
686
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
687 687
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
688 688
     // check if change proposals on User's items
689 689
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
690 690
         $countNewItems = DB::query(
691 691
             'SELECT COUNT(*)
692
-            FROM ' . prefixTable('items_change') . ' AS c
693
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
692
+            FROM ' . prefixTable('items_change').' AS c
693
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
694 694
             WHERE i.action = %s AND i.id_user = %i',
695 695
             'at_creation',
696 696
             $globalsUserId
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
     
719 719
     $rows = DB::query(
720 720
         'SELECT *
721
-        FROM ' . prefixTable('roles_values') . '
721
+        FROM ' . prefixTable('roles_values').'
722 722
         WHERE role_id IN %li AND type IN %ls',
723 723
         $userRoles,
724 724
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
     ) {
786 786
         $persoFld = DB::queryfirstrow(
787 787
             'SELECT id
788
-            FROM ' . prefixTable('nested_tree') . '
788
+            FROM ' . prefixTable('nested_tree').'
789 789
             WHERE title = %s AND personal_folder = %i'.
790 790
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
791 791
             $globalsUserId,
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     }
820 820
     $persoFlds = DB::query(
821 821
         'SELECT id
822
-        FROM ' . prefixTable('nested_tree') . '
822
+        FROM ' . prefixTable('nested_tree').'
823 823
         WHERE %l',
824 824
         $where
825 825
     );
@@ -883,9 +883,9 @@  discard block
 block discarded – undo
883 883
  */
884 884
 function cacheTableRefresh(array $SETTINGS): void
885 885
 {
886
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
886
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
887 887
     //Connect to DB
888
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
888
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
889 889
     if (defined('DB_PASSWD_CLEAR') === false) {
890 890
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
891 891
     }
@@ -900,12 +900,12 @@  discard block
 block discarded – undo
900 900
     $tree->register();
901 901
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
902 902
     // truncate table
903
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
903
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
904 904
     // reload date
905 905
     $rows = DB::query(
906 906
         'SELECT *
907
-        FROM ' . prefixTable('items') . ' as i
908
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
907
+        FROM ' . prefixTable('items').' as i
908
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
909 909
         AND l.action = %s
910 910
         AND i.inactif = %i',
911 911
         'at_creation',
@@ -917,18 +917,18 @@  discard block
 block discarded – undo
917 917
             $tags = '';
918 918
             $itemTags = DB::query(
919 919
                 'SELECT tag
920
-                            FROM ' . prefixTable('tags') . '
920
+                            FROM ' . prefixTable('tags').'
921 921
                             WHERE item_id = %i AND tag != ""',
922 922
                 $record['id']
923 923
             );
924 924
             foreach ($itemTags as $itemTag) {
925
-                $tags .= $itemTag['tag'] . ' ';
925
+                $tags .= $itemTag['tag'].' ';
926 926
             }
927 927
 
928 928
             // Get renewal period
929 929
             $resNT = DB::queryfirstrow(
930 930
                 'SELECT renewal_period
931
-                FROM ' . prefixTable('nested_tree') . '
931
+                FROM ' . prefixTable('nested_tree').'
932 932
                 WHERE id = %i',
933 933
                 $record['id_tree']
934 934
             );
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
                     // Is this a User id?
942 942
                     $user = DB::queryfirstrow(
943 943
                         'SELECT id, login
944
-                        FROM ' . prefixTable('users') . '
944
+                        FROM ' . prefixTable('users').'
945 945
                         WHERE id = %i',
946 946
                         $elem->title
947 947
                     );
@@ -959,11 +959,11 @@  discard block
 block discarded – undo
959 959
                     'id' => $record['id'],
960 960
                     'label' => $record['label'],
961 961
                     'description' => $record['description'] ?? '',
962
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
962
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
963 963
                     'tags' => $tags,
964 964
                     'id_tree' => $record['id_tree'],
965 965
                     'perso' => $record['perso'],
966
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
966
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
967 967
                     'login' => $record['login'] ?? '',
968 968
                     'folder' => implode(' > ', $folder),
969 969
                     'author' => $record['id_user'],
@@ -985,12 +985,12 @@  discard block
 block discarded – undo
985 985
  */
986 986
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
987 987
 {
988
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
988
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
989 989
     // Load superglobal
990
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
990
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
991 991
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
992 992
     //Connect to DB
993
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
993
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
994 994
     if (defined('DB_PASSWD_CLEAR') === false) {
995 995
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
996 996
     }
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
     // get new value from db
1008 1008
     $data = DB::queryfirstrow(
1009 1009
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1010
-        FROM ' . prefixTable('items') . '
1010
+        FROM ' . prefixTable('items').'
1011 1011
         WHERE id=%i',
1012 1012
         $ident
1013 1013
     );
@@ -1015,12 +1015,12 @@  discard block
 block discarded – undo
1015 1015
     $tags = '';
1016 1016
     $itemTags = DB::query(
1017 1017
         'SELECT tag
1018
-            FROM ' . prefixTable('tags') . '
1018
+            FROM ' . prefixTable('tags').'
1019 1019
             WHERE item_id = %i AND tag != ""',
1020 1020
         $ident
1021 1021
     );
1022 1022
     foreach ($itemTags as $itemTag) {
1023
-        $tags .= $itemTag['tag'] . ' ';
1023
+        $tags .= $itemTag['tag'].' ';
1024 1024
     }
1025 1025
     // form id_tree to full foldername
1026 1026
     $folder = [];
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
             // Is this a User id?
1032 1032
             $user = DB::queryfirstrow(
1033 1033
                 'SELECT id, login
1034
-                FROM ' . prefixTable('users') . '
1034
+                FROM ' . prefixTable('users').'
1035 1035
                 WHERE id = %i',
1036 1036
                 $elem->title
1037 1037
             );
@@ -1049,10 +1049,10 @@  discard block
 block discarded – undo
1049 1049
             'label' => $data['label'],
1050 1050
             'description' => $data['description'],
1051 1051
             'tags' => $tags,
1052
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1052
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1053 1053
             'id_tree' => $data['id_tree'],
1054 1054
             'perso' => $data['perso'],
1055
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1055
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1056 1056
             'login' => $data['login'] ?? '',
1057 1057
             'folder' => implode(' » ', $folder),
1058 1058
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1072,14 +1072,14 @@  discard block
 block discarded – undo
1072 1072
  */
1073 1073
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1074 1074
 {
1075
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1075
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1076 1076
     // Load superglobal
1077
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1077
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1078 1078
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1079 1079
     // Get superglobals
1080 1080
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1081 1081
     //Connect to DB
1082
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1082
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1083 1083
     if (defined('DB_PASSWD_CLEAR') === false) {
1084 1084
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1085 1085
     }
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
     // get new value from db
1097 1097
     $data = DB::queryFirstRow(
1098 1098
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1099
-        FROM ' . prefixTable('items') . ' as i
1100
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1099
+        FROM ' . prefixTable('items').' as i
1100
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1101 1101
         WHERE i.id = %i
1102 1102
         AND l.action = %s',
1103 1103
         $ident,
@@ -1107,12 +1107,12 @@  discard block
 block discarded – undo
1107 1107
     $tags = '';
1108 1108
     $itemTags = DB::query(
1109 1109
         'SELECT tag
1110
-            FROM ' . prefixTable('tags') . '
1110
+            FROM ' . prefixTable('tags').'
1111 1111
             WHERE item_id = %i AND tag != ""',
1112 1112
         $ident
1113 1113
     );
1114 1114
     foreach ($itemTags as $itemTag) {
1115
-        $tags .= $itemTag['tag'] . ' ';
1115
+        $tags .= $itemTag['tag'].' ';
1116 1116
     }
1117 1117
     // form id_tree to full foldername
1118 1118
     $folder = [];
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
             // Is this a User id?
1124 1124
             $user = DB::queryfirstrow(
1125 1125
                 'SELECT id, login
1126
-                FROM ' . prefixTable('users') . '
1126
+                FROM ' . prefixTable('users').'
1127 1127
                 WHERE id = %i',
1128 1128
                 $elem->title
1129 1129
             );
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
             'label' => $data['label'],
1143 1143
             'description' => $data['description'],
1144 1144
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1145
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1145
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1146 1146
             'id_tree' => $data['id_tree'],
1147 1147
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1148 1148
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1164,52 +1164,52 @@  discard block
 block discarded – undo
1164 1164
 function getStatisticsData(array $SETTINGS): array
1165 1165
 {
1166 1166
     DB::query(
1167
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1167
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1168 1168
         0
1169 1169
     );
1170 1170
     $counter_folders = DB::count();
1171 1171
     DB::query(
1172
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1172
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1173 1173
         1
1174 1174
     );
1175 1175
     $counter_folders_perso = DB::count();
1176 1176
     DB::query(
1177
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1177
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1178 1178
         0
1179 1179
     );
1180 1180
     $counter_items = DB::count();
1181 1181
         DB::query(
1182
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1182
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1183 1183
         1
1184 1184
     );
1185 1185
     $counter_items_perso = DB::count();
1186 1186
         DB::query(
1187
-        'SELECT id FROM ' . prefixTable('users') . ''
1187
+        'SELECT id FROM '.prefixTable('users').''
1188 1188
     );
1189 1189
     $counter_users = DB::count();
1190 1190
         DB::query(
1191
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1191
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1192 1192
         1
1193 1193
     );
1194 1194
     $admins = DB::count();
1195 1195
     DB::query(
1196
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1196
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1197 1197
         1
1198 1198
     );
1199 1199
     $managers = DB::count();
1200 1200
     DB::query(
1201
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1201
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1202 1202
         1
1203 1203
     );
1204 1204
     $readOnly = DB::count();
1205 1205
     // list the languages
1206 1206
     $usedLang = [];
1207 1207
     $tp_languages = DB::query(
1208
-        'SELECT name FROM ' . prefixTable('languages')
1208
+        'SELECT name FROM '.prefixTable('languages')
1209 1209
     );
1210 1210
     foreach ($tp_languages as $tp_language) {
1211 1211
         DB::query(
1212
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1212
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1213 1213
             $tp_language['name']
1214 1214
         );
1215 1215
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1218,12 +1218,12 @@  discard block
 block discarded – undo
1218 1218
     // get list of ips
1219 1219
     $usedIp = [];
1220 1220
     $tp_ips = DB::query(
1221
-        'SELECT user_ip FROM ' . prefixTable('users')
1221
+        'SELECT user_ip FROM '.prefixTable('users')
1222 1222
     );
1223 1223
     foreach ($tp_ips as $ip) {
1224 1224
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1225 1225
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1226
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1226
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1227 1227
             $usedIp[$ip['user_ip']] = 1;
1228 1228
         }
1229 1229
     }
@@ -1289,14 +1289,14 @@  discard block
 block discarded – undo
1289 1289
     }
1290 1290
 
1291 1291
     // Load settings
1292
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1292
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1293 1293
     // Load superglobal
1294
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1294
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1295 1295
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1296 1296
     // Get user language
1297
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1297
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1298 1298
     // Load library
1299
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1299
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1300 1300
     // load PHPMailer
1301 1301
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1302 1302
     $mail->register();
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
     
1305 1305
     try {
1306 1306
         // send to user
1307
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1307
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1308 1308
         $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1309 1309
         $mail->Port = $SETTINGS['email_port'];
1310 1310
         //COULD BE USED
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1405 1405
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1406 1406
         <br><div style="float:right;">' .
1407
-        $textMail .
1407
+        $textMail.
1408 1408
         '<br><br></td></tr></table>
1409 1409
     </td></tr></table>
1410 1410
     <br></body></html>';
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
  */
1418 1418
 function generateKey(): string
1419 1419
 {
1420
-    return substr(md5(rand() . rand()), 0, 15);
1420
+    return substr(md5(rand().rand()), 0, 15);
1421 1421
 }
1422 1422
 
1423 1423
 /**
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 {
1489 1489
     array_walk_recursive(
1490 1490
         $array,
1491
-        static function (&$item): void {
1491
+        static function(&$item): void {
1492 1492
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1493 1493
                 $item = utf8_encode($item);
1494 1494
             }
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1511 1511
 {
1512 1512
     // Load superglobal
1513
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1513
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1514 1514
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1515 1515
     // Get superglobals
1516 1516
     if ($key !== null) {
@@ -1521,9 +1521,9 @@  discard block
 block discarded – undo
1521 1521
     }
1522 1522
 
1523 1523
     //load ClassLoader
1524
-    include_once $teampassDir . '/sources/SplClassLoader.php';
1524
+    include_once $teampassDir.'/sources/SplClassLoader.php';
1525 1525
     //Load AES
1526
-    $aes = new SplClassLoader('Encryption\Crypt', $teampassDir . '/includes/libraries');
1526
+    $aes = new SplClassLoader('Encryption\Crypt', $teampassDir.'/includes/libraries');
1527 1527
     $aes->register();
1528 1528
     if ($type === 'encode' && is_array($data) === true) {
1529 1529
         // Ensure UTF8 format
@@ -1597,8 +1597,8 @@  discard block
 block discarded – undo
1597 1597
  */
1598 1598
 function prefixTable(string $table): string
1599 1599
 {
1600
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1601
-    if (! empty($safeTable)) {
1600
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1601
+    if (!empty($safeTable)) {
1602 1602
         // sanitize string
1603 1603
         return $safeTable;
1604 1604
     }
@@ -1628,13 +1628,13 @@  discard block
 block discarded – undo
1628 1628
     bool $lowercase = false,
1629 1629
     array $SETTINGS = []
1630 1630
 ): string {
1631
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1632
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1631
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1632
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1633 1633
     $generator->register();
1634 1634
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1635 1635
     // Is PHP7 being used?
1636 1636
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1637
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1637
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1638 1638
         $php7generator->register();
1639 1639
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1640 1640
     }
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1670 1670
 {
1671 1671
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1672
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1672
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1673 1673
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1674 1674
     socket_close($sock);
1675 1675
 }
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
     }
1694 1694
 
1695 1695
     // include librairies & connect to DB
1696
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1696
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1697 1697
     if (defined('DB_PASSWD_CLEAR') === false) {
1698 1698
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1699 1699
     }
@@ -1717,14 +1717,14 @@  discard block
 block discarded – undo
1717 1717
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1718 1718
         if ($type === 'user_mngt') {
1719 1719
             send_syslog(
1720
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1720
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1721 1721
                 $SETTINGS['syslog_host'],
1722 1722
                 $SETTINGS['syslog_port'],
1723 1723
                 'teampass'
1724 1724
             );
1725 1725
         } else {
1726 1726
             send_syslog(
1727
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1727
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1728 1728
                 $SETTINGS['syslog_host'],
1729 1729
                 $SETTINGS['syslog_port'],
1730 1730
                 'teampass'
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
     ?string $encryption_type = null
1759 1759
 ): void {
1760 1760
     // include librairies & connect to DB
1761
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1761
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1762 1762
     if (defined('DB_PASSWD_CLEAR') === false) {
1763 1763
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1764 1764
     }
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
         if (empty($item_label) === true) {
1803 1803
             $dataItem = DB::queryfirstrow(
1804 1804
                 'SELECT id, id_tree, label
1805
-                FROM ' . prefixTable('items') . '
1805
+                FROM ' . prefixTable('items').'
1806 1806
                 WHERE id = %i',
1807 1807
                 $item_id
1808 1808
             );
@@ -1810,11 +1810,11 @@  discard block
 block discarded – undo
1810 1810
         }
1811 1811
 
1812 1812
         send_syslog(
1813
-            'action=' . str_replace('at_', '', $action) .
1814
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1815
-                ' itemno=' . $item_id .
1816
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1817
-                ' itemname="' . addslashes($item_label) . '"',
1813
+            'action='.str_replace('at_', '', $action).
1814
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1815
+                ' itemno='.$item_id.
1816
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1817
+                ' itemname="'.addslashes($item_label).'"',
1818 1818
             $SETTINGS['syslog_host'],
1819 1819
             $SETTINGS['syslog_port'],
1820 1820
             'teampass'
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
         && $action === 'at_shown'
1843 1843
     ) {
1844 1844
         // Load superglobal
1845
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1845
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1846 1846
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1847 1847
         // Get superglobals
1848 1848
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
         // Get info about item
1852 1852
         $dataItem = DB::queryfirstrow(
1853 1853
             'SELECT id, id_tree, label
1854
-            FROM ' . prefixTable('items') . '
1854
+            FROM ' . prefixTable('items').'
1855 1855
             WHERE id = %i',
1856 1856
             $item_id
1857 1857
         );
@@ -1865,9 +1865,9 @@  discard block
 block discarded – undo
1865 1865
                 'body' => str_replace(
1866 1866
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1867 1867
                     [
1868
-                        addslashes($globalsName . ' ' . $globalsLastname),
1868
+                        addslashes($globalsName.' '.$globalsLastname),
1869 1869
                         addslashes($item_label),
1870
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1870
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1871 1871
                     ],
1872 1872
                     langHdl('email_on_open_notification_mail')
1873 1873
                 ),
@@ -1891,7 +1891,7 @@  discard block
 block discarded – undo
1891 1891
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1892 1892
 {
1893 1893
     // Load superglobal
1894
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1894
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1895 1895
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1896 1896
     // Get superglobals
1897 1897
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1901,8 +1901,8 @@  discard block
 block discarded – undo
1901 1901
     $notification = DB::queryOneColumn(
1902 1902
         'email',
1903 1903
         'SELECT *
1904
-        FROM ' . prefixTable('notification') . ' AS n
1905
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1904
+        FROM ' . prefixTable('notification').' AS n
1905
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1906 1906
         WHERE n.item_id = %i AND n.user_id != %i',
1907 1907
         $item_id,
1908 1908
         $globalsUserId
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
         // Get list of changes
1914 1914
         $htmlChanges = '<ul>';
1915 1915
         foreach ($changes as $change) {
1916
-            $htmlChanges .= '<li>' . $change . '</li>';
1916
+            $htmlChanges .= '<li>'.$change.'</li>';
1917 1917
         }
1918 1918
         $htmlChanges .= '</ul>';
1919 1919
         // send email
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1947 1947
 {
1948 1948
     // Class loader
1949
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1949
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1950 1950
     //Load Tree
1951 1951
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1952 1952
     $tree->register();
@@ -1955,15 +1955,15 @@  discard block
 block discarded – undo
1955 1955
     $path = '';
1956 1956
     foreach ($arbo as $elem) {
1957 1957
         if (empty($path) === true) {
1958
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1958
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1959 1959
         } else {
1960
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1960
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1961 1961
         }
1962 1962
     }
1963 1963
 
1964 1964
     // Build text to show user
1965 1965
     if (empty($label) === false) {
1966
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1966
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1967 1967
     }
1968 1968
     return empty($path) === true ? '' : $path;
1969 1969
 }
@@ -2020,9 +2020,9 @@  discard block
 block discarded – undo
2020 2020
  */
2021 2021
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2022 2022
 {
2023
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2023
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2024 2024
     // include librairies & connect to DB
2025
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2025
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2026 2026
     if (defined('DB_PASSWD_CLEAR') === false) {
2027 2027
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2028 2028
     }
@@ -2035,8 +2035,8 @@  discard block
 block discarded – undo
2035 2035
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2036 2036
         // perform a copy
2037 2037
         if (file_exists($tp_config_file)) {
2038
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2039
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2038
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2039
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2040 2040
             }
2041 2041
         }
2042 2042
 
@@ -2046,11 +2046,11 @@  discard block
 block discarded – undo
2046 2046
         $data[1] = "global \$SETTINGS;\n";
2047 2047
         $data[2] = "\$SETTINGS = array (\n";
2048 2048
         $rows = DB::query(
2049
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2049
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2050 2050
             'admin'
2051 2051
         );
2052 2052
         foreach ($rows as $record) {
2053
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2053
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2054 2054
         }
2055 2055
         array_push($data, ");\n");
2056 2056
         $data = array_unique($data);
@@ -2064,15 +2064,15 @@  discard block
 block discarded – undo
2064 2064
                 break;
2065 2065
             }
2066 2066
 
2067
-            if (stristr($line, "'" . $field . "' => '")) {
2068
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2067
+            if (stristr($line, "'".$field."' => '")) {
2068
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2069 2069
                 $bFound = true;
2070 2070
                 break;
2071 2071
             }
2072 2072
             ++$inc;
2073 2073
         }
2074 2074
         if ($bFound === false) {
2075
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2075
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2076 2076
         }
2077 2077
     }
2078 2078
 
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 {
2103 2103
     global $SETTINGS;
2104 2104
     /* LOAD CPASSMAN SETTINGS */
2105
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2105
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2106 2106
         $SETTINGS = [];
2107 2107
         $SETTINGS['duplicate_folder'] = 0;
2108 2108
         //by default, this is set to 0;
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
         //by default, this value is set to 5;
2113 2113
         $settings = [];
2114 2114
         $rows = DB::query(
2115
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2115
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2116 2116
             [
2117 2117
                 'type' => 'admin',
2118 2118
                 'type2' => 'settings',
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
     $source_cf = [];
2145 2145
     $rows = DB::QUERY(
2146 2146
         'SELECT id_category
2147
-            FROM ' . prefixTable('categories_folders') . '
2147
+            FROM ' . prefixTable('categories_folders').'
2148 2148
             WHERE id_folder = %i',
2149 2149
         $source_id
2150 2150
     );
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
     $target_cf = [];
2156 2156
     $rows = DB::QUERY(
2157 2157
         'SELECT id_category
2158
-            FROM ' . prefixTable('categories_folders') . '
2158
+            FROM ' . prefixTable('categories_folders').'
2159 2159
             WHERE id_folder = %i',
2160 2160
         $target_id
2161 2161
     );
@@ -2190,9 +2190,9 @@  discard block
 block discarded – undo
2190 2190
     string $password = null
2191 2191
 ) {
2192 2192
     // Load AntiXSS
2193
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2194
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2195
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2193
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2194
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2195
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2196 2196
     $antiXss = new voku\helper\AntiXSS();
2197 2197
     // Protect against bad inputs
2198 2198
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2204,7 +2204,7 @@  discard block
 block discarded – undo
2204 2204
     $target_file = $antiXss->xss_clean($target_file);
2205 2205
     if (empty($password) === true || is_null($password) === true) {
2206 2206
         // get KEY to define password
2207
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2207
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2208 2208
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2209 2209
     }
2210 2210
 
@@ -2249,15 +2249,15 @@  discard block
 block discarded – undo
2249 2249
 ) {
2250 2250
     // load PhpEncryption library
2251 2251
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2252
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2253
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2254
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2255
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2256
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2257
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2258
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2259
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2260
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2252
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2253
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2254
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2255
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2256
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2257
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2258
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2259
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2260
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2261 2261
     try {
2262 2262
         \Defuse\Crypto\File::encryptFileWithPassword(
2263 2263
             $source_file,
@@ -2294,15 +2294,15 @@  discard block
 block discarded – undo
2294 2294
 ) {
2295 2295
     // load PhpEncryption library
2296 2296
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2297
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2298
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2299
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2300
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2301
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2302
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2303
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2304
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2305
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2297
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2298
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2299
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2300
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2301
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2302
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2303
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2304
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2305
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2306 2306
     try {
2307 2307
         \Defuse\Crypto\File::decryptFileWithPassword(
2308 2308
             $source_file,
@@ -2349,9 +2349,9 @@  discard block
 block discarded – undo
2349 2349
 function fileDelete(string $file, array $SETTINGS): void
2350 2350
 {
2351 2351
     // Load AntiXSS
2352
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2353
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2354
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2352
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2353
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2354
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2355 2355
     $antiXss = new voku\helper\AntiXSS();
2356 2356
     $file = $antiXss->xss_clean($file);
2357 2357
     if (is_file($file)) {
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
     int  $dirPerm = 0755
2402 2402
 ) {
2403 2403
     // Check if the path exists
2404
-    if (! file_exists($path)) {
2404
+    if (!file_exists($path)) {
2405 2405
         return false;
2406 2406
     }
2407 2407
 
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
  */
2440 2440
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2441 2441
 {
2442
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2442
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2443 2443
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2444 2444
     // Prepare superGlobal variables
2445 2445
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
     // Load item data
2448 2448
     $data = DB::queryFirstRow(
2449 2449
         'SELECT id_tree
2450
-        FROM ' . prefixTable('items') . '
2450
+        FROM ' . prefixTable('items').'
2451 2451
         WHERE id = %i',
2452 2452
         $item_id
2453 2453
     );
@@ -2510,7 +2510,7 @@  discard block
 block discarded – undo
2510 2510
         }
2511 2511
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2512 2512
     }
2513
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2513
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2514 2514
     return $email;
2515 2515
 }
2516 2516
 
@@ -2526,8 +2526,8 @@  discard block
 block discarded – undo
2526 2526
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2527 2527
 {
2528 2528
     // include librairies & connect to DB
2529
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2530
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2529
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2530
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2531 2531
     if (defined('DB_PASSWD_CLEAR') === false) {
2532 2532
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2533 2533
     }
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
     DB::$encoding = DB_ENCODING;
2540 2540
     // Insert log in DB
2541 2541
     return DB::query(
2542
-        'SELECT ' . $fields . '
2542
+        'SELECT '.$fields.'
2543 2543
         FROM ' . prefixTable($table)
2544 2544
     );
2545 2545
 }
@@ -2554,11 +2554,11 @@  discard block
 block discarded – undo
2554 2554
 function formatSizeUnits(int $bytes): string
2555 2555
 {
2556 2556
     if ($bytes >= 1073741824) {
2557
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2557
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2558 2558
     } elseif ($bytes >= 1048576) {
2559
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2559
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2560 2560
     } elseif ($bytes >= 1024) {
2561
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2561
+        $bytes = number_format($bytes / 1024, 2).' KB';
2562 2562
     } elseif ($bytes > 1) {
2563 2563
         $bytes .= ' bytes';
2564 2564
     } elseif ($bytes === 1) {
@@ -2767,14 +2767,14 @@  discard block
 block discarded – undo
2767 2767
 
2768 2768
     // Encrypt the file content
2769 2769
     $plaintext = file_get_contents(
2770
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2770
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2771 2771
     );
2772 2772
     $ciphertext = $cipher->encrypt($plaintext);
2773 2773
     // Save new file
2774 2774
     $hash = md5($plaintext);
2775
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2775
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2776 2776
     file_put_contents($fileOut, $ciphertext);
2777
-    unlink($fileInPath . '/' . $fileInName);
2777
+    unlink($fileInPath.'/'.$fileInName);
2778 2778
     return [
2779 2779
         'fileHash' => base64_encode($hash),
2780 2780
         'objectKey' => base64_encode($objectKey),
@@ -2792,7 +2792,7 @@  discard block
 block discarded – undo
2792 2792
  */
2793 2793
 function decryptFile(string $fileName, string $filePath, string $key): string
2794 2794
 {
2795
-    if (! defined('FILE_BUFFER_SIZE')) {
2795
+    if (!defined('FILE_BUFFER_SIZE')) {
2796 2796
         define('FILE_BUFFER_SIZE', 128 * 1024);
2797 2797
     }
2798 2798
 
@@ -2811,7 +2811,7 @@  discard block
 block discarded – undo
2811 2811
     $cipher->enableContinuousBuffer();
2812 2812
     $cipher->disablePadding();
2813 2813
     // Get file content
2814
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2814
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2815 2815
     // Decrypt file content and return
2816 2816
     return base64_encode($cipher->decrypt($ciphertext));
2817 2817
 }
@@ -2865,8 +2865,8 @@  discard block
 block discarded – undo
2865 2865
     array $SETTINGS
2866 2866
 ): void {
2867 2867
     // include librairies & connect to DB
2868
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2869
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2868
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2869
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2870 2870
     if (defined('DB_PASSWD_CLEAR') === false) {
2871 2871
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2872 2872
     }
@@ -2883,7 +2883,7 @@  discard block
 block discarded – undo
2883 2883
         $post_object_id
2884 2884
     );
2885 2885
     // Superglobals
2886
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2886
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2887 2887
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2888 2888
     // Prepare superGlobal variables
2889 2889
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2908,8 +2908,8 @@  discard block
 block discarded – undo
2908 2908
         // Create sharekey for each user
2909 2909
         $users = DB::query(
2910 2910
             'SELECT id, public_key
2911
-            FROM ' . prefixTable('users') . '
2912
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2911
+            FROM ' . prefixTable('users').'
2912
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2913 2913
             AND public_key != ""'
2914 2914
         );
2915 2915
         foreach ($users as $user) {
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
 function isBase64(string $str): bool
2940 2940
 {
2941 2941
     $str = (string) trim($str);
2942
-    if (! isset($str[0])) {
2942
+    if (!isset($str[0])) {
2943 2943
         return false;
2944 2944
     }
2945 2945
 
@@ -3007,13 +3007,13 @@  discard block
 block discarded – undo
3007 3007
         ],
3008 3008
     ];
3009 3009
     // Load expected libraries
3010
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3011
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3012
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3013
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3014
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3015
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
3016
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3010
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3011
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3012
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3013
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3014
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3015
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
3016
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3017 3017
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3018 3018
     $ad->register();
3019 3019
     $connection = new Connection($config);
@@ -3022,7 +3022,7 @@  discard block
 block discarded – undo
3022 3022
         $connection->connect();
3023 3023
     } catch (\LdapRecord\Auth\BindException $e) {
3024 3024
         $error = $e->getDetailedError();
3025
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3025
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3026 3026
         return false;
3027 3027
     }
3028 3028
 
@@ -3035,7 +3035,7 @@  discard block
 block discarded – undo
3035 3035
         }
3036 3036
     } catch (\LdapRecord\Auth\BindException $e) {
3037 3037
         $error = $e->getDetailedError();
3038
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3038
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3039 3039
         return false;
3040 3040
     }
3041 3041
 
@@ -3053,8 +3053,8 @@  discard block
 block discarded – undo
3053 3053
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3054 3054
 {
3055 3055
     // include librairies & connect to DB
3056
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3057
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3056
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3057
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3058 3058
     if (defined('DB_PASSWD_CLEAR') === false) {
3059 3059
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3060 3060
     }
@@ -3112,7 +3112,7 @@  discard block
 block discarded – undo
3112 3112
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3113 3113
             $now->setTimezone(new DateTimeZone($timezone));
3114 3114
             $offsets[] = $offset = $now->getOffset();
3115
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3115
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3116 3116
         }
3117 3117
 
3118 3118
         array_multisort($offsets, $timezones);
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
 {
3133 3133
     $hours = intval($offset / 3600);
3134 3134
     $minutes = abs(intval($offset % 3600 / 60));
3135
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3135
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3136 3136
 }
3137 3137
 
3138 3138
 /**
Please login to merge, or discard this patch.
sources/folders.queries.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  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
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
43 43
     // Not allowed page
44 44
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
45
-    include $SETTINGS['cpassman_dir'] . '/error.php';
45
+    include $SETTINGS['cpassman_dir'].'/error.php';
46 46
     exit();
47 47
 }
48 48
 
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59 59
 header('Content-type: text/html; charset=utf-8');
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
61
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
62
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
61
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
62
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
63 63
 
64 64
 // Connect to mysql server
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
66 66
 if (defined('DB_PASSWD_CLEAR') === false) {
67 67
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
68 68
 }
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
                     && $t->personal_folder == 0
135 135
                 ) {
136 136
                     // get $t->parent_id
137
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
137
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
138 138
                     if ($t->nlevel == 1) {
139 139
                         $data['title'] = langHdl('root');
140 140
                     }
141 141
 
142 142
                     // get rights on this folder
143 143
                     $arrayRights = array();
144
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
144
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
145 145
                     foreach ($rows as $record) {
146 146
                         array_push($arrayRights, $record['fonction_id']);
147 147
                     }
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
                     $node_data = DB::queryFirstRow(
159 159
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
160 160
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification
161
-                        FROM ' . prefixTable('misc') . ' AS m,
162
-                        ' . prefixTable('nested_tree') . ' AS n
161
+                        FROM ' . prefixTable('misc').' AS m,
162
+                        ' . prefixTable('nested_tree').' AS n
163 163
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
164 164
                         'complex',
165 165
                         $t->id
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                     //col7
193 193
                     $data7 = DB::queryFirstRow(
194 194
                         'SELECT bloquer_creation,bloquer_modification
195
-                        FROM ' . prefixTable('nested_tree') . '
195
+                        FROM ' . prefixTable('nested_tree').'
196 196
                         WHERE id = %i',
197 197
                         intval($t->id)
198 198
                     );
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
             // decrypt and retrieve data in JSON format
306 306
             $dataReceived = prepareExchangedData(
307
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
307
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
308 308
 
309 309
             // prepare variables
310 310
             $post_title = filter_var($dataReceived['title'], FILTER_SANITIZE_STRING);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             // Get info about this folder
336 336
             $dataFolder = DB::queryfirstrow(
337 337
                 'SELECT *
338
-                FROM ' . prefixTable('nested_tree') . '
338
+                FROM ' . prefixTable('nested_tree').'
339 339
                 WHERE id = %i',
340 340
                 $post_folder_id
341 341
             );
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             //check if parent folder is personal
373 373
             $dataParent = DB::queryfirstrow(
374 374
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
375
-                FROM ' . prefixTable('nested_tree') . '
375
+                FROM ' . prefixTable('nested_tree').'
376 376
                 WHERE id = %i',
377 377
                 $post_parent_id
378 378
             );
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                     // get complexity level for this folder
402 402
                     $data = DB::queryfirstrow(
403 403
                         'SELECT valeur
404
-                        FROM ' . prefixTable('misc') . '
404
+                        FROM ' . prefixTable('misc').'
405 405
                         WHERE intitule = %i AND type = %s',
406 406
                         $post_parent_id,
407 407
                         'complex'
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                             array(
414 414
                                 'error' => true,
415 415
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
416
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
416
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
417 417
                             ),
418 418
                             'encode'
419 419
                         );
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 
509 509
             // decrypt and retrieve data in JSON format
510 510
             $dataReceived = prepareExchangedData(
511
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
511
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
512 512
 
513 513
             // prepare variables
514 514
             $post_title = filter_var($dataReceived['title'], FILTER_SANITIZE_STRING);
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
             ) {
573 573
                 DB::query(
574 574
                     'SELECT *
575
-                    FROM ' . prefixTable('nested_tree') . '
575
+                    FROM ' . prefixTable('nested_tree').'
576 576
                     WHERE title = %s',
577 577
                     $post_title
578 578
                 );
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
             //check if parent folder is personal
594 594
             $data = DB::queryfirstrow(
595 595
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
596
-                FROM ' . prefixTable('nested_tree') . '
596
+                FROM ' . prefixTable('nested_tree').'
597 597
                 WHERE id = %i',
598 598
                 $post_parent_id
599 599
             );
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
                     // get complexity level for this folder
623 623
                     $data = DB::queryfirstrow(
624 624
                         'SELECT valeur
625
-                        FROM ' . prefixTable('misc') . '
625
+                        FROM ' . prefixTable('misc').'
626 626
                         WHERE intitule = %i AND type = %s',
627 627
                         $post_parent_id,
628 628
                         'complex'
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
                             array(
634 634
                                 'error' => true,
635 635
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
636
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
636
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
637 637
                             ),
638 638
                             'encode'
639 639
                         );
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
                     && (int) $SETTINGS['subfolder_rights_as_parent'] === 1
708 708
                 ) {
709 709
                     //If it is a subfolder, then give access to it for all roles that allows the parent folder
710
-                    $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $post_parent_id);
710
+                    $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $post_parent_id);
711 711
                     foreach ($rows as $record) {
712 712
                         //add access to this subfolder
713 713
                         DB::insert(
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
                 }
723 723
 
724 724
                 // if parent folder has Custom Fields Categories then add to this child one too
725
-                $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $post_parent_id);
725
+                $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $post_parent_id);
726 726
                 foreach ($rows as $record) {
727 727
                     //add CF Category to this subfolder
728 728
                     DB::insert(
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 
778 778
             // decrypt and retrieve data in JSON format
779 779
             $dataReceived = prepareExchangedData(
780
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
780
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
781 781
 
782 782
             // prepare variables
783 783
             $post_folders = filter_var_array(
@@ -803,17 +803,17 @@  discard block
 block discarded – undo
803 803
                                 prefixTable('misc'),
804 804
                                 array(
805 805
                                     'type' => 'folder_deleted',
806
-                                    'intitule' => 'f' . $folder->id,
807
-                                    'valeur' => $folder->id . ', ' . $folder->parent_id . ', ' .
808
-                                        $folder->title . ', ' . $folder->nleft . ', ' . $folder->nright . ', ' .
809
-                                        $folder->nlevel . ', 0, 0, 0, 0',
806
+                                    'intitule' => 'f'.$folder->id,
807
+                                    'valeur' => $folder->id.', '.$folder->parent_id.', '.
808
+                                        $folder->title.', '.$folder->nleft.', '.$folder->nright.', '.
809
+                                        $folder->nlevel.', 0, 0, 0, 0',
810 810
                                 )
811 811
                             );
812 812
                             //array for delete folder
813 813
                             $folderForDel[] = $folder->id;
814 814
 
815 815
                             //delete items & logs
816
-                            $items = DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE id_tree=%i', $folder->id);
816
+                            $items = DB::query('SELECT id FROM '.prefixTable('items').' WHERE id_tree=%i', $folder->id);
817 817
                             foreach ($items as $item) {
818 818
                                 DB::update(
819 819
                                     prefixTable('items'),
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
             $tree->rebuild();
871 871
 
872 872
             // reload cache table
873
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
873
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
874 874
             updateCacheTable('reload', $SETTINGS, null);
875 875
 
876 876
             echo prepareExchangedData(
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 
911 911
             // decrypt and retrieve data in JSON format
912 912
             $dataReceived = prepareExchangedData(
913
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
913
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
914 914
 
915 915
             // Init post variables
916 916
             $post_source_folder_id = filter_var($dataReceived['source_folder_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
                 // get complexity of current node
962 962
                 $nodeComplexity = DB::queryfirstrow(
963 963
                     'SELECT valeur
964
-                    FROM ' . prefixTable('misc') . '
964
+                    FROM ' . prefixTable('misc').'
965 965
                     WHERE intitule = %i AND type= %s',
966 966
                     $nodeInfo->id,
967 967
                     'complex'
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1037 1037
                 $rows = DB::query(
1038 1038
                     'SELECT role_id, type
1039
-                    FROM ' . prefixTable('roles_values') . '
1039
+                    FROM ' . prefixTable('roles_values').'
1040 1040
                     WHERE folder_id = %i',
1041 1041
                     $parentId
1042 1042
                 );
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
                     // Add access to this subfolder after checking that it is not already set
1045 1045
                     DB::query(
1046 1046
                         'SELECT *
1047
-                        FROM ' . prefixTable('roles_values') . '
1047
+                        FROM ' . prefixTable('roles_values').'
1048 1048
                         WHERE folder_id = %i AND role_id = %i',
1049 1049
                         $newFolderId,
1050 1050
                         $record['role_id']
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
                 // if parent folder has Custom Fields Categories then add to this child one too
1065 1065
                 $rows = DB::query(
1066 1066
                     'SELECT id_category
1067
-                    FROM ' . prefixTable('categories_folders') . '
1067
+                    FROM ' . prefixTable('categories_folders').'
1068 1068
                     WHERE id_folder = %i',
1069 1069
                     $nodeInfo->id
1070 1070
                 );
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 
1084 1084
                 $rows = DB::query(
1085 1085
                     'SELECT *
1086
-                    FROM ' . prefixTable('items') . '
1086
+                    FROM ' . prefixTable('items').'
1087 1087
                     WHERE id_tree = %i',
1088 1088
                     $nodeInfo->id
1089 1089
                 );
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
                     // if it is then don't copy it
1093 1093
                     $item_deleted = DB::queryFirstRow(
1094 1094
                         'SELECT *
1095
-                        FROM ' . prefixTable('log_items') . '
1095
+                        FROM ' . prefixTable('log_items').'
1096 1096
                         WHERE id_item = %i AND action = %s
1097 1097
                         ORDER BY date DESC
1098 1098
                         LIMIT 0, 1',
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
                     $item_restored = DB::queryFirstRow(
1105 1105
                         'SELECT *
1106
-                        FROM ' . prefixTable('log_items') . '
1106
+                        FROM ' . prefixTable('log_items').'
1107 1107
                         WHERE id_item = %i AND action = %s
1108 1108
                         ORDER BY date DESC
1109 1109
                         LIMIT 0, 1',
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
                         // Get the ITEM object key for the user
1119 1119
                         $userKey = DB::queryFirstRow(
1120 1120
                             'SELECT share_key
1121
-                            FROM ' . prefixTable('sharekeys_items') . '
1121
+                            FROM ' . prefixTable('sharekeys_items').'
1122 1122
                             WHERE user_id = %i AND object_id = %i',
1123 1123
                             $_SESSION['user_id'],
1124 1124
                             $record['id']
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
                         // Manage Custom Fields
1194 1194
                         $categories = DB::query(
1195 1195
                             'SELECT *
1196
-                            FROM ' . prefixTable('categories_items') . '
1196
+                            FROM ' . prefixTable('categories_items').'
1197 1197
                             WHERE item_id = %i',
1198 1198
                             $record['id']
1199 1199
                         );
@@ -1241,15 +1241,15 @@  discard block
 block discarded – undo
1241 1241
                         $files = DB::query(
1242 1242
                             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
1243 1243
                             f.size AS size, f.type AS type, s.share_key AS share_key
1244
-                            FROM ' . prefixTable('files') . ' AS f
1245
-                            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
1244
+                            FROM ' . prefixTable('files').' AS f
1245
+                            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
1246 1246
                             WHERE s.user_id = %i AND f.id_item = %i',
1247 1247
                             $_SESSION['user_id'],
1248 1248
                             $record['id']
1249 1249
                         );
1250 1250
                         foreach ($files as $file) {
1251 1251
                             // Check if file still exists
1252
-                            if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) {
1252
+                            if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) {
1253 1253
                                 // Step1 - decrypt the file
1254 1254
                                 $fileContent = decryptFile(
1255 1255
                                     $file['file'],
@@ -1258,9 +1258,9 @@  discard block
 block discarded – undo
1258 1258
                                 );
1259 1259
 
1260 1260
                                 // Step2 - create file
1261
-                                $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension'];
1261
+                                $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension'];
1262 1262
 
1263
-                                $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
1263
+                                $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
1264 1264
                                 if ($outstream === false) {
1265 1265
                                     echo prepareExchangedData(
1266 1266
     $SETTINGS['cpassman_dir'],
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
             $tree->rebuild();
1337 1337
 
1338 1338
             // reload cache table
1339
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1339
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1340 1340
             updateCacheTable('reload', $SETTINGS, NULL);
1341 1341
 
1342 1342
             $data = array(
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 
1346 1346
             // send data
1347 1347
             echo prepareExchangedData(
1348
-    $SETTINGS['cpassman_dir'],$data, 'encode');
1348
+    $SETTINGS['cpassman_dir'], $data, 'encode');
1349 1349
 
1350 1350
             break;
1351 1351
 
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
                     // Get path
1402 1402
                     $text = '';
1403 1403
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1404
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1404
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1405 1405
                     }
1406 1406
 
1407 1407
                     // Save array
@@ -1411,7 +1411,7 @@  discard block
 block discarded – undo
1411 1411
                             'id' => (int) $folder->id,
1412 1412
                             'label' => $folder->title,
1413 1413
                             'level' => $folder->nlevel,
1414
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1414
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1415 1415
                         )
1416 1416
                     );
1417 1417
                 }
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 /* do checks */
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
50
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
50
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
51 51
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) {
52 52
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
53
-    include $SETTINGS['cpassman_dir'] . '/error.php';
53
+    include $SETTINGS['cpassman_dir'].'/error.php';
54 54
     exit;
55 55
 }
56 56
 
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
60 60
 
61 61
 header('Content-type: text/html; charset=utf-8');
62 62
 header('Cache-Control: no-cache, no-store, must-revalidate');
63 63
 
64
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
64
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
65 65
 
66 66
 // connect to the server
67
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
67
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
68 68
 if (defined('DB_PASSWD_CLEAR') === false) {
69 69
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
70 70
 }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                         array(
118 118
                             'http' => array(
119 119
                                 'ignore_errors' => true,
120
-                                'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'],
120
+                                'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'],
121 121
                             ),
122 122
                         )
123 123
                     );
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
                     $json_array = json_decode($json, true);
137 137
 
138 138
                     // About version
139
-                    $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION_FULL;
139
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL;
140 140
                     if (floatval(TP_VERSION_FULL) < floatval($json_array['info']['version'])) {
141
-                        $text .= '&nbsp;&nbsp;<b>' . $LANG['please_update'] . '</b>';
141
+                        $text .= '&nbsp;&nbsp;<b>'.$LANG['please_update'].'</b>';
142 142
                     }
143 143
                     $text .= '</li>';
144 144
 
145 145
                     // Libraries
146 146
                     $text .= '<li><u>Libraries</u> :</li>';
147 147
                     foreach ($json_array['libraries'] as $key => $val) {
148
-                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;" . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>';
148
+                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>';
149 149
                     }
150 150
                 }
151 151
             } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         }
157 157
         $text .= '</ul>';
158 158
 
159
-        echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]';
159
+        echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]';
160 160
         break;
161 161
 
162 162
         //##########################################################
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         //get through all users
191 191
         $rows = DB::query(
192 192
             'SELECT id, login, email
193
-            FROM ' . prefixTable('users') . '
193
+            FROM ' . prefixTable('users').'
194 194
             ORDER BY login ASC'
195 195
         );
196 196
         foreach ($rows as $record) {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             //if folder doesn't exist then create it
208 208
             $data = DB::queryfirstrow(
209 209
                 'SELECT id
210
-                FROM ' . prefixTable('nested_tree') . '
210
+                FROM ' . prefixTable('nested_tree').'
211 211
                 WHERE title = %s AND parent_id = %i',
212 212
                 $record['id'],
213 213
                 0
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
     $SETTINGS['cpassman_dir'],
271 271
             array(
272 272
                 'error' => false,
273
-                'message' => langHdl('last_execution') . ' ' .
274
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
273
+                'message' => langHdl('last_execution').' '.
274
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
275 275
                     '<i class="fas fa-check text-success ml-2"></i>',
276 276
             ),
277 277
             'encode'
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         }
308 308
 
309 309
         //Libraries call
310
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
310
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
311 311
 
312 312
         //init
313 313
         $foldersIds = array();
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             }
322 322
         }
323 323
 
324
-        $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
324
+        $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
325 325
         foreach ($items as $item) {
326 326
             //Delete item
327 327
             DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
         // delete orphan items
343 343
         $rows = DB::query(
344 344
             'SELECT id
345
-            FROM ' . prefixTable('items') . '
345
+            FROM ' . prefixTable('items').'
346 346
             ORDER BY id ASC'
347 347
         );
348 348
         foreach ($rows as $item) {
349 349
             DB::query(
350
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
350
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
351 351
                 $item['id'],
352 352
                 'at_creation'
353 353
             );
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
     $SETTINGS['cpassman_dir'],
379 379
             array(
380 380
                 'error' => false,
381
-                'message' => langHdl('last_execution') . ' ' .
382
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
381
+                'message' => langHdl('last_execution').' '.
382
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
383 383
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
384 384
                     <i class="fas fa-chevron-right mr-2"></i>' .
385
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
385
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
386 386
             ),
387 387
             'encode'
388 388
         );
@@ -416,21 +416,21 @@  discard block
 block discarded – undo
416 416
             break;
417 417
         }
418 418
 
419
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
419
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
420 420
         $return = '';
421 421
 
422 422
         //Get all tables
423 423
         $tables = array();
424 424
         $result = DB::query('SHOW TABLES');
425 425
         foreach ($result as $row) {
426
-            $tables[] = $row['Tables_in_' . $database];
426
+            $tables[] = $row['Tables_in_'.$database];
427 427
         }
428 428
 
429 429
         //cycle through
430 430
         foreach ($tables as $table) {
431 431
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
432 432
                 // Do query
433
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
433
+                $result = DB::queryRaw('SELECT * FROM '.$table);
434 434
                 DB::queryRaw(
435 435
                     'SELECT *
436 436
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -442,19 +442,19 @@  discard block
 block discarded – undo
442 442
                 $numFields = DB::count();
443 443
 
444 444
                 // prepare a drop table
445
-                $return .= 'DROP TABLE ' . $table . ';';
446
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
447
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
445
+                $return .= 'DROP TABLE '.$table.';';
446
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
447
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
448 448
 
449 449
                 //prepare all fields and datas
450 450
                 for ($i = 0; $i < $numFields; ++$i) {
451 451
                     while ($row = $result->fetch_row()) {
452
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
452
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
453 453
                         for ($j = 0; $j < $numFields; ++$j) {
454 454
                             $row[$j] = addslashes($row[$j]);
455 455
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
456 456
                             if (isset($row[$j])) {
457
-                                $return .= '"' . $row[$j] . '"';
457
+                                $return .= '"'.$row[$j].'"';
458 458
                             } else {
459 459
                                 $return .= 'NULL';
460 460
                             }
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
475 475
 
476 476
             //save file
477
-            $filename = time() . '-' . $token . '.sql';
478
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
477
+            $filename = time().'-'.$token.'.sql';
478
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
479 479
             if ($handle !== false) {
480 480
                 //write file
481 481
                 fwrite($handle, $return);
@@ -487,17 +487,17 @@  discard block
 block discarded – undo
487 487
                 // Encrypt the file
488 488
                 prepareFileWithDefuse(
489 489
                     'encrypt',
490
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
491
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
490
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
491
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
492 492
                     $SETTINGS,
493 493
                     $post_option
494 494
                 );
495 495
 
496 496
                 // Do clean
497
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
497
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
498 498
                 rename(
499
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
500
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
499
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
500
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
501 501
                 );
502 502
             }
503 503
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             //update LOG
508 508
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']);
509 509
 
510
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]';
510
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]';
511 511
         }
512 512
         break;
513 513
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
             );
539 539
             break;
540 540
         }
541
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
541
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
542 542
 
543 543
         $dataPost = explode('&', $post_option);
544 544
         $file = htmlspecialchars($dataPost[0]);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         // Get filename from database
548 548
         $data = DB::queryFirstRow(
549 549
             'SELECT valeur
550
-            FROM ' . prefixTable('misc') . '
550
+            FROM ' . prefixTable('misc').'
551 551
             WHERE increment_id = %i',
552 552
             $file
553 553
         );
@@ -566,22 +566,22 @@  discard block
 block discarded – undo
566 566
             // Decrypt the file
567 567
             $ret = prepareFileWithDefuse(
568 568
                 'decrypt',
569
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
570
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
569
+                $SETTINGS['path_to_files_folder'].'/'.$file,
570
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
571 571
                 $SETTINGS,
572 572
                 $key
573 573
             );
574 574
 
575 575
             if (empty($ret) === false) {
576
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
576
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
577 577
                 break;
578 578
             }
579 579
 
580 580
             // Do clean
581
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
582
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
581
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
582
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
583 583
         } else {
584
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
584
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
585 585
         }
586 586
 
587 587
         //read sql file
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
         fclose($handle);
599 599
 
600 600
         //delete file
601
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
601
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
602 602
 
603 603
         //Show done
604 604
         echo '[{"result":"db_restore" , "message":""}]';
@@ -638,8 +638,8 @@  discard block
 block discarded – undo
638 638
             foreach ($table as $i => $tablename) {
639 639
                 if (substr_count($tablename, DB_PREFIX) > 0) {
640 640
                     // launch optimization quieries
641
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
642
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
641
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
642
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
643 643
                 }
644 644
             }
645 645
         }
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
         //Clean up LOG_ITEMS table
648 648
         $rows = DB::query(
649 649
             'SELECT id
650
-            FROM ' . prefixTable('items') . '
650
+            FROM ' . prefixTable('items').'
651 651
             ORDER BY id ASC'
652 652
         );
653 653
         foreach ($rows as $item) {
654 654
             DB::query(
655
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
655
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
656 656
                 $item['id'],
657 657
                 'at_creation'
658 658
             );
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
             if ($counter === 0) {
661 661
                 //Create new at_creation entry
662 662
                 $rowTmp = DB::queryFirstRow(
663
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
663
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
664 664
                     $item['id']
665 665
                 );
666 666
                 DB::insert(
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
     $SETTINGS['cpassman_dir'],
692 692
             array(
693 693
                 'error' => false,
694
-                'message' => langHdl('last_execution') . ' ' .
695
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
694
+                'message' => langHdl('last_execution').' '.
695
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
696 696
                     '<i class="fas fa-check text-success ml-2"></i>',
697 697
             ),
698 698
             'encode'
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
             break;
728 728
         }
729 729
 
730
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
730
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
731 731
 
732 732
         //read folder
733 733
         if (is_dir($SETTINGS['path_to_files_folder']) === false) {
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
     $SETTINGS['cpassman_dir'],
736 736
                 array(
737 737
                     'error' => true,
738
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'],
738
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'],
739 739
                 ),
740 740
                 'encode'
741 741
             );
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
             //delete file FILES
748 748
             while (false !== ($f = readdir($dir))) {
749 749
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
750
-                    if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
751
-                        fileDelete($dir . '/' . $f, $SETTINGS);
750
+                    if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
751
+                        fileDelete($dir.'/'.$f, $SETTINGS);
752 752
                     }
753 753
                 }
754 754
             }
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
     $SETTINGS['cpassman_dir'],
764 764
                 array(
765 765
                     'error' => true,
766
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'],
766
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'],
767 767
                 ),
768 768
                 'encode'
769 769
             );
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
             while (false !== ($f = readdir($dir))) {
778 778
                 if ($f !== '.' && $f !== '..') {
779 779
                     if (strpos($f, '_delete.') > 0) {
780
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
780
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
781 781
                     }
782 782
                 }
783 783
             }
@@ -800,11 +800,11 @@  discard block
 block discarded – undo
800 800
     $SETTINGS['cpassman_dir'],
801 801
             array(
802 802
                 'error' => false,
803
-                'message' => langHdl('last_execution') . ' ' .
804
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
803
+                'message' => langHdl('last_execution').' '.
804
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
805 805
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
806 806
                     <i class="fas fa-chevron-right mr-2"></i>' .
807
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
807
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
808 808
             ),
809 809
             'encode'
810 810
         );
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
             break;
840 840
         }
841 841
 
842
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
842
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
843 843
         updateCacheTable('reload', $SETTINGS, NULL);
844 844
 
845 845
         // Log
@@ -856,8 +856,8 @@  discard block
 block discarded – undo
856 856
     $SETTINGS['cpassman_dir'],
857 857
             [
858 858
                 'error' => false,
859
-                'message' => langHdl('last_execution') . ' ' .
860
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
859
+                'message' => langHdl('last_execution').' '.
860
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
861 861
                     '<i class="fas fa-check text-success mr-2"></i>',
862 862
             ],
863 863
             'encode'
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
         }
895 895
 
896 896
         // Perform
897
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
897
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
898 898
         $ret = handleConfigFile('rebuild', $SETTINGS);
899 899
 
900 900
         // Log
@@ -923,8 +923,8 @@  discard block
 block discarded – undo
923 923
     $SETTINGS['cpassman_dir'],
924 924
             array(
925 925
                 'error' => false,
926
-                'message' => langHdl('last_execution') . ' ' .
927
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
926
+                'message' => langHdl('last_execution').' '.
927
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
928 928
                     '<i class="fas fa-check text-success ml-2"></i>',
929 929
             ),
930 930
             'encode'
@@ -966,33 +966,33 @@  discard block
 block discarded – undo
966 966
         $filename = $post_option;
967 967
         $tp_settings = [];
968 968
         //get backups infos
969
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
969
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
970 970
         foreach ($rows as $record) {
971 971
             $tp_settings[$record['intitule']] = $record['valeur'];
972 972
         }
973 973
 
974 974
         // check if backup file is in DB.
975 975
         // If YES then it is encrypted with DEFUSE
976
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
976
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
977 977
 
978 978
         //read file
979 979
         $return = '';
980
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
980
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
981 981
         if (file_exists($Fnm)) {
982 982
             if (!empty($bck) && $bck['valeur'] === $filename) {
983 983
                 $err = '';
984 984
 
985 985
                 // it means that file is DEFUSE encrypted
986
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
987
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
988
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
989
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
990
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
986
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
987
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
988
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
989
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
990
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
991 991
 
992 992
                 try {
993 993
                     \Defuse\Crypto\File::decryptFileWithPassword(
994
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
995
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
994
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
995
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
996 996
                         base64_decode($SETTINGS['bck_script_key'])
997 997
                     );
998 998
                 } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
                 }
1001 1001
 
1002 1002
                 if (!empty($err)) {
1003
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
1003
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
1004 1004
                     break;
1005 1005
                 }
1006 1006
             } else {
@@ -1022,19 +1022,19 @@  discard block
 block discarded – undo
1022 1022
                 );
1023 1023
 
1024 1024
                 //save the file
1025
-                $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
1025
+                $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
1026 1026
                 if ($handle !== false) {
1027 1027
                     fwrite($handle, $return);
1028 1028
                     fclose($handle);
1029 1029
                 }
1030 1030
             }
1031 1031
             $result = 'backup_decrypt_success';
1032
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
1032
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
1033 1033
         } else {
1034 1034
             $result = 'backup_decrypt_fails';
1035
-            $msg = 'File not found: ' . $Fnm;
1035
+            $msg = 'File not found: '.$Fnm;
1036 1036
         }
1037
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
1037
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
1038 1038
         break;
1039 1039
 
1040 1040
         /*
@@ -1070,22 +1070,22 @@  discard block
 block discarded – undo
1070 1070
         require_once 'main.functions.php';
1071 1071
 
1072 1072
         // store old sk
1073
-        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1073
+        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1074 1074
 
1075 1075
         // generate new saltkey
1076
-        $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
1076
+        $old_sk_filename = SECUREPATH.'/teampass-seckey.txt.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
1077 1077
         copy(
1078
-            SECUREPATH . '/teampass-seckey.txt',
1078
+            SECUREPATH.'/teampass-seckey.txt',
1079 1079
             $old_sk_filename
1080 1080
         );
1081 1081
         $new_key = defuse_generate_key();
1082 1082
         file_put_contents(
1083
-            SECUREPATH . '/teampass-seckey.txt',
1083
+            SECUREPATH.'/teampass-seckey.txt',
1084 1084
             $new_key
1085 1085
         );
1086 1086
 
1087 1087
         // store new sk
1088
-        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1088
+        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1089 1089
 
1090 1090
         //put tool in maintenance.
1091 1091
         DB::update(
@@ -1101,13 +1101,13 @@  discard block
 block discarded – undo
1101 1101
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']);
1102 1102
 
1103 1103
         // get number of items to change
1104
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
1104
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
1105 1105
         $nb_of_items = DB::count();
1106 1106
 
1107 1107
         // create backup table
1108
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1108
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1109 1109
         DB::query(
1110
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
1110
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
1111 1111
             `id` int(12) NOT null AUTO_INCREMENT,
1112 1112
             `current_table` varchar(100) NOT NULL,
1113 1113
             `current_field` varchar(500) NOT NULL,
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
         );
1136 1136
 
1137 1137
         // delete previous backup files
1138
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
1138
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
1139 1139
         foreach ($files as $file) { // iterate files
1140 1140
             if (is_file($file)) {
1141 1141
                 $file_parts = pathinfo($file);
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
     $SETTINGS['cpassman_dir'],
1223 1223
                     array(
1224 1224
                         'error' => true,
1225
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
1225
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
1226 1226
                         'nbOfItems' => '',
1227 1227
                         'nextAction' => '',
1228 1228
                     ),
@@ -1235,9 +1235,9 @@  discard block
 block discarded – undo
1235 1235
                 //change all encrypted data in Items (passwords)
1236 1236
                 $rows = DB::query(
1237 1237
                     'SELECT id, pw, pw_iv
1238
-                    FROM ' . prefixTable('items') . '
1238
+                    FROM ' . prefixTable('items').'
1239 1239
                     WHERE perso = %s
1240
-                    LIMIT ' . $post_start . ', ' . $post_length,
1240
+                    LIMIT ' . $post_start.', '.$post_length,
1241 1241
                     '0'
1242 1242
                 );
1243 1243
                 foreach ($rows as $record) {
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
                             'current_field' => 'pw',
1250 1250
                             'value_id' => $record['id'],
1251 1251
                             'value' => $record['pw'],
1252
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
1252
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
1253 1253
                             'value2' => 'none',
1254 1254
                             'result' => 'none',
1255 1255
                         )
@@ -1298,9 +1298,9 @@  discard block
 block discarded – undo
1298 1298
                 //change all encrypted data in Logs (passwords)
1299 1299
                 $rows = DB::query(
1300 1300
                     'SELECT raison, increment_id
1301
-                    FROM ' . prefixTable('log_items') . "
1301
+                    FROM ' . prefixTable('log_items')."
1302 1302
                     WHERE action = %s AND raison LIKE 'at_pw :%'
1303
-                    LIMIT " . $post_start . ', ' . $post_length,
1303
+                    LIMIT " . $post_start.', '.$post_length,
1304 1304
                     'at_modification'
1305 1305
                 );
1306 1306
                 foreach ($rows as $record) {
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                             'current_field' => 'raison',
1313 1313
                             'value_id' => $record['increment_id'],
1314 1314
                             'value' => $record['raison'],
1315
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
1315
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
1316 1316
                             'value2' => 'none',
1317 1317
                             'result' => 'none',
1318 1318
                         )
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
                         DB::update(
1341 1341
                             prefixTable('log_items'),
1342 1342
                             array(
1343
-                                'raison' => 'at_pw :' . $encrypt['string'],
1343
+                                'raison' => 'at_pw :'.$encrypt['string'],
1344 1344
                                 'encryption_type' => 'defuse',
1345 1345
                             ),
1346 1346
                             'increment_id = %i',
@@ -1365,8 +1365,8 @@  discard block
 block discarded – undo
1365 1365
                 //change all encrypted data in CATEGORIES (passwords)
1366 1366
                 $rows = DB::query(
1367 1367
                     'SELECT id, data
1368
-                    FROM ' . prefixTable('categories_items') . '
1369
-                    LIMIT ' . $post_start . ', ' . $post_length
1368
+                    FROM ' . prefixTable('categories_items').'
1369
+                    LIMIT ' . $post_start.', '.$post_length
1370 1370
                 );
1371 1371
                 foreach ($rows as $record) {
1372 1372
                     // backup data
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
                             'current_field' => 'data',
1378 1378
                             'value_id' => $record['id'],
1379 1379
                             'value' => $record['data'],
1380
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1380
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1381 1381
                             'value2' => 'none',
1382 1382
                             'result' => 'none',
1383 1383
                         )
@@ -1425,9 +1425,9 @@  discard block
 block discarded – undo
1425 1425
                 // Change all encrypted data in FILES (passwords)
1426 1426
                 $rows = DB::query(
1427 1427
                     'SELECT id, file, status
1428
-                    FROM ' . prefixTable('files') . "
1428
+                    FROM ' . prefixTable('files')."
1429 1429
                     WHERE status = 'encrypted'
1430
-                    LIMIT " . $post_start . ', ' . $post_length
1430
+                    LIMIT " . $post_start.', '.$post_length
1431 1431
                 );
1432 1432
                 foreach ($rows as $record) {
1433 1433
                     // backup data
@@ -1445,20 +1445,20 @@  discard block
 block discarded – undo
1445 1445
                     );
1446 1446
                     $newID = DB::insertId();
1447 1447
 
1448
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1448
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1449 1449
                         // make a copy of file
1450 1450
                         if (!copy(
1451
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1452
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1451
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1452
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1453 1453
                         )) {
1454 1454
                             $error = 'Copy not possible';
1455 1455
                             exit;
1456 1456
                         } else {
1457 1457
                             // prepare a bck of file (that will not be deleted)
1458
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1458
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1459 1459
                             copy(
1460
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1461
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1460
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1461
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1462 1462
                             );
1463 1463
                         }
1464 1464
 
@@ -1466,24 +1466,24 @@  discard block
 block discarded – undo
1466 1466
                         // STEP1 - Do decryption
1467 1467
                         prepareFileWithDefuse(
1468 1468
                             'decrypt',
1469
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1470
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1469
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1470
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1471 1471
                             $SETTINGS
1472 1472
                         );
1473 1473
 
1474 1474
                         // Do cleanup of files
1475
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1475
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1476 1476
 
1477 1477
                         // STEP2 - Do encryption
1478 1478
                         prepareFileWithDefuse(
1479 1479
                             'encryp',
1480
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1481
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1480
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1481
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1482 1482
                             $SETTINGS
1483 1483
                         );
1484 1484
 
1485 1485
                         // Do cleanup of files
1486
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1486
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1487 1487
 
1488 1488
                         // Update backup table
1489 1489
                         DB::update(
@@ -1509,13 +1509,13 @@  discard block
 block discarded – undo
1509 1509
                 // do some things for new object
1510 1510
                 if (isset($objects[0])) {
1511 1511
                     if ($objects[0] === 'logs') {
1512
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1512
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1513 1513
                     } elseif ($objects[0] === 'files') {
1514
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1514
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1515 1515
                     } elseif ($objects[0] === 'categories') {
1516
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1516
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1517 1517
                     } elseif ($objects[0] === 'custfields') {
1518
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1518
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1519 1519
                     }
1520 1520
                     $nb_of_items = DB::count();
1521 1521
                 } else {
@@ -1640,12 +1640,12 @@  discard block
 block discarded – undo
1640 1640
                 );
1641 1641
             } elseif ($record['current_table'] === 'files') {
1642 1642
                 // restore backup file
1643
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1644
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1645
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1643
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1644
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1645
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1646 1646
                         rename(
1647
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1648
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1647
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1648
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1649 1649
                         );
1650 1650
                     }
1651 1651
                 }
@@ -1656,15 +1656,15 @@  discard block
 block discarded – undo
1656 1656
 
1657 1657
         // restore saltkey file
1658 1658
         if (file_exists($previous_saltkey_filename)) {
1659
-            unlink(SECUREPATH . '/teampass-seckey.txt');
1659
+            unlink(SECUREPATH.'/teampass-seckey.txt');
1660 1660
             rename(
1661 1661
                 $previous_saltkey_filename,
1662
-                SECUREPATH . '/teampass-seckey.txt'
1662
+                SECUREPATH.'/teampass-seckey.txt'
1663 1663
             );
1664 1664
         }
1665 1665
 
1666 1666
         // drop table
1667
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1667
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1668 1668
 
1669 1669
         // Send back
1670 1670
         echo prepareExchangedData(
@@ -1710,17 +1710,17 @@  discard block
 block discarded – undo
1710 1710
         // delete files
1711 1711
         $rows = DB::query(
1712 1712
             'SELECT value, value2
1713
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1713
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1714 1714
             WHERE current_table = 'files'"
1715 1715
         );
1716 1716
         foreach ($rows as $record) {
1717
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1718
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1717
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1718
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1719 1719
             }
1720 1720
         }
1721 1721
 
1722 1722
         // drop table
1723
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1723
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1724 1724
 
1725 1725
         echo '[{"status":"done"}]';
1726 1726
         break;
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
             );
1755 1755
             break;
1756 1756
         } else {
1757
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1757
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1758 1758
 
1759 1759
             //send email
1760 1760
             sendEmail(
@@ -1792,11 +1792,11 @@  discard block
 block discarded – undo
1792 1792
             break;
1793 1793
         }
1794 1794
 
1795
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1795
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1796 1796
 
1797 1797
         $rows = DB::query(
1798 1798
             'SELECT *
1799
-            FROM ' . prefixTable('emails') . '
1799
+            FROM ' . prefixTable('emails').'
1800 1800
             WHERE status = %s OR status = %s',
1801 1801
             'not_sent',
1802 1802
             ''
@@ -1883,9 +1883,9 @@  discard block
 block discarded – undo
1883 1883
             break;
1884 1884
         }
1885 1885
 
1886
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1886
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1887 1887
 
1888
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1888
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1889 1889
         foreach ($rows as $record) {
1890 1890
             //send email
1891 1891
             $ret = json_decode(
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
             break;
1957 1957
         }
1958 1958
 
1959
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1959
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1960 1960
 
1961 1961
         // init
1962 1962
         $filesList = array();
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
                 FROM ' . prefixTable('files')
1970 1970
             );
1971 1971
             foreach ($rows as $record) {
1972
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1972
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1973 1973
                     $addFile = false;
1974 1974
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1975 1975
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -2038,8 +2038,8 @@  discard block
 block discarded – undo
2038 2038
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING);
2039 2039
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
2040 2040
 
2041
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2042
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2041
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2042
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2043 2043
 
2044 2044
         $cpt = 0;
2045 2045
         $continu = true;
@@ -2047,15 +2047,15 @@  discard block
 block discarded – undo
2047 2047
         $message = '';
2048 2048
 
2049 2049
         // load PhpEncryption library
2050
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
2051
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
2052
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2053
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
2054
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2055
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
2056
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2057
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2058
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
2050
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
2051
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
2052
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2053
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
2054
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2055
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
2056
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2057
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2058
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
2059 2059
 
2060 2060
         // treat 10 files
2061 2061
         foreach ($post_list as $file) {
@@ -2063,35 +2063,35 @@  discard block
 block discarded – undo
2063 2063
                 // Get file name
2064 2064
                 $file_info = DB::queryfirstrow(
2065 2065
                     'SELECT file
2066
-                    FROM ' . prefixTable('files') . '
2066
+                    FROM ' . prefixTable('files').'
2067 2067
                     WHERE id = %i',
2068 2068
                     $file
2069 2069
                 );
2070 2070
 
2071 2071
                 // skip file is Coherancey not respected
2072
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
2072
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
2073 2073
                     // Case where we want to decrypt
2074 2074
                     if ($post_option === 'decrypt') {
2075 2075
                         prepareFileWithDefuse(
2076 2076
                             'decrypt',
2077
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2078
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2077
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2078
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2079 2079
                             $SETTINGS
2080 2080
                         );
2081 2081
                         // Case where we want to encrypt
2082 2082
                     } elseif ($post_option === 'encrypt') {
2083 2083
                         prepareFileWithDefuse(
2084 2084
                             'encrypt',
2085
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2086
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2085
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2086
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2087 2087
                             $SETTINGS
2088 2088
                         );
2089 2089
                     }
2090 2090
                     // Do file cleanup
2091
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
2091
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
2092 2092
                     rename(
2093
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2094
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
2093
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2094
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
2095 2095
                     );
2096 2096
 
2097 2097
                     // store in DB
@@ -2126,8 +2126,8 @@  discard block
 block discarded – undo
2126 2126
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
2127 2127
             );
2128 2128
 
2129
-            $message = langHdl('last_execution') . ' ' .
2130
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
2129
+            $message = langHdl('last_execution').' '.
2130
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
2131 2131
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
2132 2132
         }
2133 2133
 
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
 
2176 2176
         // decrypt and retrieve data in JSON format
2177 2177
         $dataReceived = prepareExchangedData(
2178
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2178
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2179 2179
 
2180 2180
         $post_label = isset($dataReceived['label']) === true ? filter_var($dataReceived['label'], FILTER_SANITIZE_STRING) : '';
2181 2181
         $post_action = filter_var($dataReceived['action'], FILTER_SANITIZE_STRING);
@@ -2217,7 +2217,7 @@  discard block
 block discarded – undo
2217 2217
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2218 2218
 
2219 2219
             DB::query(
2220
-                'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i',
2220
+                'DELETE FROM '.prefixTable('api').' WHERE id = %i',
2221 2221
                 $post_id
2222 2222
             );
2223 2223
         }
@@ -2266,7 +2266,7 @@  discard block
 block discarded – undo
2266 2266
 
2267 2267
         // decrypt and retrieve data in JSON format
2268 2268
         $dataReceived = prepareExchangedData(
2269
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2269
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2270 2270
 
2271 2271
         $post_action = filter_var($dataReceived['action'], FILTER_SANITIZE_STRING);
2272 2272
 
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
             // Delete existing key
2314 2314
         } elseif (null !== $post_action && $post_action === 'delete') {
2315 2315
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2316
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id);
2316
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id);
2317 2317
         }
2318 2318
 
2319 2319
         echo prepareExchangedData(
@@ -2329,7 +2329,7 @@  discard block
 block discarded – undo
2329 2329
 
2330 2330
     case 'save_api_status':
2331 2331
         // Do query
2332
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2332
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2333 2333
         $counter = DB::count();
2334 2334
         if ($counter === 0) {
2335 2335
             DB::insert(
@@ -2355,7 +2355,7 @@  discard block
 block discarded – undo
2355 2355
         break;
2356 2356
 
2357 2357
     case 'save_duo_status':
2358
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2358
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2359 2359
         $counter = DB::count();
2360 2360
         if ($counter === 0) {
2361 2361
             DB::insert(
@@ -2395,12 +2395,12 @@  discard block
 block discarded – undo
2395 2395
 
2396 2396
         // decrypt and retrieve data in JSON format
2397 2397
         $dataReceived = prepareExchangedData(
2398
-    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2398
+    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2399 2399
         // Store in DB
2400 2400
         foreach ($dataReceived as $key => $value) {
2401 2401
             DB::query(
2402 2402
                 'SELECT * 
2403
-                FROM ' . prefixTable('misc') . '
2403
+                FROM ' . prefixTable('misc').'
2404 2404
                 WHERE type = %s AND intitule = %s',
2405 2405
                 'admin',
2406 2406
                 $key
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
         } else {
2472 2472
             $tmp = 1;
2473 2473
         }
2474
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2474
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2475 2475
         $counter = DB::count();
2476 2476
         if ($counter === 0) {
2477 2477
             DB::insert(
@@ -2497,7 +2497,7 @@  discard block
 block discarded – undo
2497 2497
 
2498 2498
         // ga_website_name
2499 2499
         if (is_null($dataReceived['ga_website_name']) === false) {
2500
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2500
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2501 2501
             $counter = DB::count();
2502 2502
             if ($counter === 0) {
2503 2503
                 DB::insert(
@@ -2528,7 +2528,7 @@  discard block
 block discarded – undo
2528 2528
         }
2529 2529
 
2530 2530
         // send data
2531
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2531
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2532 2532
         break;
2533 2533
 
2534 2534
     case 'save_agses_options':
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
 
2554 2554
         // agses_hosted_url
2555 2555
         if (!is_null($dataReceived['agses_hosted_url'])) {
2556
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2556
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2557 2557
             $counter = DB::count();
2558 2558
             if ($counter === 0) {
2559 2559
                 DB::insert(
@@ -2582,7 +2582,7 @@  discard block
 block discarded – undo
2582 2582
 
2583 2583
         // agses_hosted_id
2584 2584
         if (!is_null($dataReceived['agses_hosted_id'])) {
2585
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2585
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2586 2586
             $counter = DB::count();
2587 2587
             if ($counter === 0) {
2588 2588
                 DB::insert(
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
 
2612 2612
         // agses_hosted_apikey
2613 2613
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2614
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2614
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2615 2615
             $counter = DB::count();
2616 2616
             if ($counter === 0) {
2617 2617
                 DB::insert(
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
         }
2640 2640
 
2641 2641
         // send data
2642
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2642
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2643 2643
         break;
2644 2644
 
2645 2645
     case 'save_option_change':
@@ -2677,7 +2677,7 @@  discard block
 block discarded – undo
2677 2677
 
2678 2678
         // Check if setting is already in DB. If NO then insert, if YES then update.
2679 2679
         $data = DB::query(
2680
-            'SELECT * FROM ' . prefixTable('misc') . '
2680
+            'SELECT * FROM '.prefixTable('misc').'
2681 2681
             WHERE type = %s AND intitule = %s',
2682 2682
             $type,
2683 2683
             $dataReceived['field']
@@ -2699,7 +2699,7 @@  discard block
 block discarded – undo
2699 2699
                     array(
2700 2700
                         'valeur' => time(),
2701 2701
                         'type' => $type,
2702
-                        'intitule' => $dataReceived['field'] . '_time',
2702
+                        'intitule' => $dataReceived['field'].'_time',
2703 2703
                     )
2704 2704
                 );
2705 2705
             }
@@ -2717,10 +2717,10 @@  discard block
 block discarded – undo
2717 2717
             if ($dataReceived['field'] === 'send_stats') {
2718 2718
                 // Check if previous time exists, if not them insert this value in DB
2719 2719
                 DB::query(
2720
-                    'SELECT * FROM ' . prefixTable('misc') . '
2720
+                    'SELECT * FROM '.prefixTable('misc').'
2721 2721
                     WHERE type = %s AND intitule = %s',
2722 2722
                     $type,
2723
-                    $dataReceived['field'] . '_time'
2723
+                    $dataReceived['field'].'_time'
2724 2724
                 );
2725 2725
                 $counter = DB::count();
2726 2726
                 if ($counter === 0) {
@@ -2729,7 +2729,7 @@  discard block
 block discarded – undo
2729 2729
                         array(
2730 2730
                             'valeur' => 0,
2731 2731
                             'type' => $type,
2732
-                            'intitule' => $dataReceived['field'] . '_time',
2732
+                            'intitule' => $dataReceived['field'].'_time',
2733 2733
                         )
2734 2734
                     );
2735 2735
                 } else {
@@ -2749,13 +2749,13 @@  discard block
 block discarded – undo
2749 2749
         // special Cases
2750 2750
         if ($dataReceived['field'] === 'cpassman_url') {
2751 2751
             // update also jsUrl for CSFP protection
2752
-            $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js';
2752
+            $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js';
2753 2753
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2754 2754
             $data = file_get_contents($csrfp_file);
2755 2755
             $posJsUrl = strpos($data, '"jsUrl" => "');
2756 2756
             $posEndLine = strpos($data, '",', $posJsUrl);
2757 2757
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2758
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data);
2758
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data);
2759 2759
             file_put_contents($csrfp_file, $newdata);
2760 2760
         } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') {
2761 2761
             DB::update(
@@ -2780,7 +2780,7 @@  discard block
 block discarded – undo
2780 2780
     $SETTINGS['cpassman_dir'],
2781 2781
             array(
2782 2782
                 'error' => false,
2783
-                'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']],
2783
+                'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']],
2784 2784
             ),
2785 2785
             'encode'
2786 2786
         );
@@ -2825,7 +2825,7 @@  discard block
 block discarded – undo
2825 2825
 
2826 2826
         // send statistics
2827 2827
         if (null !== $post_status) {
2828
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2828
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2829 2829
             $counter = DB::count();
2830 2830
             if ($counter === 0) {
2831 2831
                 DB::insert(
@@ -2857,7 +2857,7 @@  discard block
 block discarded – undo
2857 2857
 
2858 2858
         // send statistics items
2859 2859
         if (null !== $post_list) {
2860
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2860
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2861 2861
             $counter = DB::count();
2862 2862
             if ($counter === 0) {
2863 2863
                 DB::insert(
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
             break;
2906 2906
         }
2907 2907
 
2908
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2908
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2909 2909
             if (DB::count() === 1) {
2910 2910
                 echo 1;
2911 2911
             } else {
@@ -2944,7 +2944,7 @@  discard block
 block discarded – undo
2944 2944
 
2945 2945
         $rows = DB::query(
2946 2946
             'SELECT id, title
2947
-                FROM ' . prefixTable('roles_title') . '
2947
+                FROM ' . prefixTable('roles_title').'
2948 2948
                 ORDER BY title ASC'
2949 2949
         );
2950 2950
         foreach ($rows as $record) {
@@ -2960,7 +2960,7 @@  discard block
 block discarded – undo
2960 2960
         }
2961 2961
 
2962 2962
         echo prepareExchangedData(
2963
-    $SETTINGS['cpassman_dir'],$json, 'encode');
2963
+    $SETTINGS['cpassman_dir'], $json, 'encode');
2964 2964
 
2965 2965
         break;
2966 2966
 }
Please login to merge, or discard this patch.