Passed
Push — teampass_3.0 ( 2e6bd1...4c0075 )
by Nils
13:44 queued 05:04
created
pages/utilities.deletion.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
Please login to merge, or discard this patch.
pages/search.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,16 +43,16 @@
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], curPage($SETTINGS), $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 
54 54
 // Load
55
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
55
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
56 56
 
57 57
 ?>
58 58
 
Please login to merge, or discard this patch.
pages/emails.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], '2fa', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
Please login to merge, or discard this patch.
pages/roles.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
Please login to merge, or discard this patch.
pages/import.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
Please login to merge, or discard this patch.
pages/options.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
Please login to merge, or discard this patch.
pages/offline.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
Please login to merge, or discard this patch.
pages/export.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,16 +43,16 @@
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], curPage($SETTINGS), $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 
54 54
 // Load
55
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
55
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
56 56
 
57 57
 ?>
58 58
 
Please login to merge, or discard this patch.
sources/main.functions.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2226,7 +2226,7 @@
 block discarded – undo
2226 2226
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2227 2227
  *
2228 2228
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2229
-  *
2229
+ *
2230 2230
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2231 2231
  * @param int    $filePerm The permissions any found files should get.
2232 2232
  * @param int    $dirPerm  The permissions any found folder should get.
Please login to merge, or discard this patch.
Spacing   +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
@@ -679,16 +679,16 @@  discard block
 block discarded – undo
679 679
         'SESSION'
680 680
     );
681 681
     // Folders and Roles numbers
682
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
682
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
683 683
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
684
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
684
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
685 685
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
686 686
     // check if change proposals on User's items
687 687
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
688 688
         $countNewItems = DB::query(
689 689
             'SELECT COUNT(*)
690
-            FROM ' . prefixTable('items_change') . ' AS c
691
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
690
+            FROM ' . prefixTable('items_change').' AS c
691
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
692 692
             WHERE i.action = %s AND i.id_user = %i',
693 693
             'at_creation',
694 694
             $globalsUserId
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
     
717 717
     $rows = DB::query(
718 718
         'SELECT *
719
-        FROM ' . prefixTable('roles_values') . '
719
+        FROM ' . prefixTable('roles_values').'
720 720
         WHERE role_id IN %li AND type IN %ls',
721 721
         $userRoles,
722 722
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
     ) {
781 781
         $persoFld = DB::queryfirstrow(
782 782
             'SELECT id
783
-            FROM ' . prefixTable('nested_tree') . '
783
+            FROM ' . prefixTable('nested_tree').'
784 784
             WHERE title = %s AND personal_folder = %i'.
785 785
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
786 786
             $globalsUserId,
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
     }
815 815
     $persoFlds = DB::query(
816 816
         'SELECT id
817
-        FROM ' . prefixTable('nested_tree') . '
817
+        FROM ' . prefixTable('nested_tree').'
818 818
         WHERE %l',
819 819
         $where
820 820
     );
@@ -878,9 +878,9 @@  discard block
 block discarded – undo
878 878
  */
879 879
 function cacheTableRefresh(array $SETTINGS): void
880 880
 {
881
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
881
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
882 882
     //Connect to DB
883
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
883
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
884 884
     if (defined('DB_PASSWD_CLEAR') === false) {
885 885
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
886 886
     }
@@ -895,12 +895,12 @@  discard block
 block discarded – undo
895 895
     $tree->register();
896 896
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
897 897
     // truncate table
898
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
898
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
899 899
     // reload date
900 900
     $rows = DB::query(
901 901
         'SELECT *
902
-        FROM ' . prefixTable('items') . ' as i
903
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
902
+        FROM ' . prefixTable('items').' as i
903
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
904 904
         AND l.action = %s
905 905
         AND i.inactif = %i',
906 906
         'at_creation',
@@ -912,18 +912,18 @@  discard block
 block discarded – undo
912 912
             $tags = '';
913 913
             $itemTags = DB::query(
914 914
                 'SELECT tag
915
-                            FROM ' . prefixTable('tags') . '
915
+                            FROM ' . prefixTable('tags').'
916 916
                             WHERE item_id = %i AND tag != ""',
917 917
                 $record['id']
918 918
             );
919 919
             foreach ($itemTags as $itemTag) {
920
-                $tags .= $itemTag['tag'] . ' ';
920
+                $tags .= $itemTag['tag'].' ';
921 921
             }
922 922
 
923 923
             // Get renewal period
924 924
             $resNT = DB::queryfirstrow(
925 925
                 'SELECT renewal_period
926
-                FROM ' . prefixTable('nested_tree') . '
926
+                FROM ' . prefixTable('nested_tree').'
927 927
                 WHERE id = %i',
928 928
                 $record['id_tree']
929 929
             );
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
                     // Is this a User id?
937 937
                     $user = DB::queryfirstrow(
938 938
                         'SELECT id, login
939
-                        FROM ' . prefixTable('users') . '
939
+                        FROM ' . prefixTable('users').'
940 940
                         WHERE id = %i',
941 941
                         $elem->title
942 942
                     );
@@ -954,11 +954,11 @@  discard block
 block discarded – undo
954 954
                     'id' => $record['id'],
955 955
                     'label' => $record['label'],
956 956
                     'description' => $record['description'] ?? '',
957
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
957
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
958 958
                     'tags' => $tags,
959 959
                     'id_tree' => $record['id_tree'],
960 960
                     'perso' => $record['perso'],
961
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
961
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
962 962
                     'login' => $record['login'] ?? '',
963 963
                     'folder' => implode(' > ', $folder),
964 964
                     'author' => $record['id_user'],
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
  */
981 981
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
982 982
 {
983
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
983
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
984 984
     // Load superglobal
985
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
985
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
986 986
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
987 987
     //Connect to DB
988
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
988
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
989 989
     if (defined('DB_PASSWD_CLEAR') === false) {
990 990
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
991 991
     }
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
     // get new value from db
1003 1003
     $data = DB::queryfirstrow(
1004 1004
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1005
-        FROM ' . prefixTable('items') . '
1005
+        FROM ' . prefixTable('items').'
1006 1006
         WHERE id=%i',
1007 1007
         $ident
1008 1008
     );
@@ -1010,12 +1010,12 @@  discard block
 block discarded – undo
1010 1010
     $tags = '';
1011 1011
     $itemTags = DB::query(
1012 1012
         'SELECT tag
1013
-            FROM ' . prefixTable('tags') . '
1013
+            FROM ' . prefixTable('tags').'
1014 1014
             WHERE item_id = %i AND tag != ""',
1015 1015
         $ident
1016 1016
     );
1017 1017
     foreach ($itemTags as $itemTag) {
1018
-        $tags .= $itemTag['tag'] . ' ';
1018
+        $tags .= $itemTag['tag'].' ';
1019 1019
     }
1020 1020
     // form id_tree to full foldername
1021 1021
     $folder = [];
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
             // Is this a User id?
1027 1027
             $user = DB::queryfirstrow(
1028 1028
                 'SELECT id, login
1029
-                FROM ' . prefixTable('users') . '
1029
+                FROM ' . prefixTable('users').'
1030 1030
                 WHERE id = %i',
1031 1031
                 $elem->title
1032 1032
             );
@@ -1044,10 +1044,10 @@  discard block
 block discarded – undo
1044 1044
             'label' => $data['label'],
1045 1045
             'description' => $data['description'],
1046 1046
             'tags' => $tags,
1047
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1047
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1048 1048
             'id_tree' => $data['id_tree'],
1049 1049
             'perso' => $data['perso'],
1050
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1050
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1051 1051
             'login' => $data['login'] ?? '',
1052 1052
             'folder' => implode(' » ', $folder),
1053 1053
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1067,14 +1067,14 @@  discard block
 block discarded – undo
1067 1067
  */
1068 1068
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1069 1069
 {
1070
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1070
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1071 1071
     // Load superglobal
1072
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1072
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1073 1073
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1074 1074
     // Get superglobals
1075 1075
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1076 1076
     //Connect to DB
1077
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1077
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1078 1078
     if (defined('DB_PASSWD_CLEAR') === false) {
1079 1079
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1080 1080
     }
@@ -1091,8 +1091,8 @@  discard block
 block discarded – undo
1091 1091
     // get new value from db
1092 1092
     $data = DB::queryFirstRow(
1093 1093
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1094
-        FROM ' . prefixTable('items') . ' as i
1095
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1094
+        FROM ' . prefixTable('items').' as i
1095
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1096 1096
         WHERE i.id = %i
1097 1097
         AND l.action = %s',
1098 1098
         $ident,
@@ -1102,12 +1102,12 @@  discard block
 block discarded – undo
1102 1102
     $tags = '';
1103 1103
     $itemTags = DB::query(
1104 1104
         'SELECT tag
1105
-            FROM ' . prefixTable('tags') . '
1105
+            FROM ' . prefixTable('tags').'
1106 1106
             WHERE item_id = %i AND tag != ""',
1107 1107
         $ident
1108 1108
     );
1109 1109
     foreach ($itemTags as $itemTag) {
1110
-        $tags .= $itemTag['tag'] . ' ';
1110
+        $tags .= $itemTag['tag'].' ';
1111 1111
     }
1112 1112
     // form id_tree to full foldername
1113 1113
     $folder = [];
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
             // Is this a User id?
1119 1119
             $user = DB::queryfirstrow(
1120 1120
                 'SELECT id, login
1121
-                FROM ' . prefixTable('users') . '
1121
+                FROM ' . prefixTable('users').'
1122 1122
                 WHERE id = %i',
1123 1123
                 $elem->title
1124 1124
             );
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
             'label' => $data['label'],
1138 1138
             'description' => $data['description'],
1139 1139
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1140
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1140
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1141 1141
             'id_tree' => $data['id_tree'],
1142 1142
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1143 1143
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1159,52 +1159,52 @@  discard block
 block discarded – undo
1159 1159
 function getStatisticsData(array $SETTINGS): array
1160 1160
 {
1161 1161
     DB::query(
1162
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1162
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1163 1163
         0
1164 1164
     );
1165 1165
     $counter_folders = DB::count();
1166 1166
     DB::query(
1167
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1167
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1168 1168
         1
1169 1169
     );
1170 1170
     $counter_folders_perso = DB::count();
1171 1171
     DB::query(
1172
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1172
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1173 1173
         0
1174 1174
     );
1175 1175
     $counter_items = DB::count();
1176 1176
         DB::query(
1177
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1177
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1178 1178
         1
1179 1179
     );
1180 1180
     $counter_items_perso = DB::count();
1181 1181
         DB::query(
1182
-        'SELECT id FROM ' . prefixTable('users') . ''
1182
+        'SELECT id FROM '.prefixTable('users').''
1183 1183
     );
1184 1184
     $counter_users = DB::count();
1185 1185
         DB::query(
1186
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1186
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1187 1187
         1
1188 1188
     );
1189 1189
     $admins = DB::count();
1190 1190
     DB::query(
1191
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1191
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1192 1192
         1
1193 1193
     );
1194 1194
     $managers = DB::count();
1195 1195
     DB::query(
1196
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1196
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1197 1197
         1
1198 1198
     );
1199 1199
     $readOnly = DB::count();
1200 1200
     // list the languages
1201 1201
     $usedLang = [];
1202 1202
     $tp_languages = DB::query(
1203
-        'SELECT name FROM ' . prefixTable('languages')
1203
+        'SELECT name FROM '.prefixTable('languages')
1204 1204
     );
1205 1205
     foreach ($tp_languages as $tp_language) {
1206 1206
         DB::query(
1207
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1207
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1208 1208
             $tp_language['name']
1209 1209
         );
1210 1210
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1213,12 +1213,12 @@  discard block
 block discarded – undo
1213 1213
     // get list of ips
1214 1214
     $usedIp = [];
1215 1215
     $tp_ips = DB::query(
1216
-        'SELECT user_ip FROM ' . prefixTable('users')
1216
+        'SELECT user_ip FROM '.prefixTable('users')
1217 1217
     );
1218 1218
     foreach ($tp_ips as $ip) {
1219 1219
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1220 1220
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1221
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1221
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1222 1222
             $usedIp[$ip['user_ip']] = 1;
1223 1223
         }
1224 1224
     }
@@ -1284,14 +1284,14 @@  discard block
 block discarded – undo
1284 1284
     }
1285 1285
 
1286 1286
     // Load settings
1287
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1287
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1288 1288
     // Load superglobal
1289
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1289
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1290 1290
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1291 1291
     // Get user language
1292
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1292
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1293 1293
     // Load library
1294
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1294
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1295 1295
     // load PHPMailer
1296 1296
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1297 1297
     $mail->register();
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
     
1300 1300
     try {
1301 1301
         // send to user
1302
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1302
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1303 1303
         $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1304 1304
         $mail->Port = $SETTINGS['email_port'];
1305 1305
         //COULD BE USED
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
         <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;">
1400 1400
         <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;">
1401 1401
         <br><div style="float:right;">' .
1402
-        $textMail .
1402
+        $textMail.
1403 1403
         '<br><br></td></tr></table>
1404 1404
     </td></tr></table>
1405 1405
     <br></body></html>';
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
  */
1413 1413
 function generateKey(): string
1414 1414
 {
1415
-    return substr(md5(rand() . rand()), 0, 15);
1415
+    return substr(md5(rand().rand()), 0, 15);
1416 1416
 }
1417 1417
 
1418 1418
 /**
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 {
1484 1484
     array_walk_recursive(
1485 1485
         $array,
1486
-        static function (&$item): void {
1486
+        static function(&$item): void {
1487 1487
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1488 1488
                 $item = utf8_encode($item);
1489 1489
             }
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
     }
1519 1519
 
1520 1520
     // Load superglobal
1521
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1521
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1522 1522
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1523 1523
     // Get superglobals
1524 1524
     if ($key !== null) {
@@ -1529,9 +1529,9 @@  discard block
 block discarded – undo
1529 1529
     }
1530 1530
 
1531 1531
     //load ClassLoader
1532
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1532
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1533 1533
     //Load AES
1534
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1534
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1535 1535
     $aes->register();
1536 1536
     if ($type === 'encode' && is_array($data) === true) {
1537 1537
         // Ensure UTF8 format
@@ -1605,8 +1605,8 @@  discard block
 block discarded – undo
1605 1605
  */
1606 1606
 function prefixTable(string $table): string
1607 1607
 {
1608
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1609
-    if (! empty($safeTable)) {
1608
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1609
+    if (!empty($safeTable)) {
1610 1610
         // sanitize string
1611 1611
         return $safeTable;
1612 1612
     }
@@ -1636,13 +1636,13 @@  discard block
 block discarded – undo
1636 1636
     bool $lowercase = false,
1637 1637
     array $SETTINGS = []
1638 1638
 ): string {
1639
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1640
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1639
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1640
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1641 1641
     $generator->register();
1642 1642
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1643 1643
     // Is PHP7 being used?
1644 1644
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1645
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1645
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1646 1646
         $php7generator->register();
1647 1647
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1648 1648
     }
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1678 1678
 {
1679 1679
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1680
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1680
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1681 1681
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1682 1682
     socket_close($sock);
1683 1683
 }
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
     }
1702 1702
 
1703 1703
     // include librairies & connect to DB
1704
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1704
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1705 1705
     if (defined('DB_PASSWD_CLEAR') === false) {
1706 1706
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1707 1707
     }
@@ -1725,14 +1725,14 @@  discard block
 block discarded – undo
1725 1725
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1726 1726
         if ($type === 'user_mngt') {
1727 1727
             send_syslog(
1728
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1728
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1729 1729
                 $SETTINGS['syslog_host'],
1730 1730
                 $SETTINGS['syslog_port'],
1731 1731
                 'teampass'
1732 1732
             );
1733 1733
         } else {
1734 1734
             send_syslog(
1735
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1735
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1736 1736
                 $SETTINGS['syslog_host'],
1737 1737
                 $SETTINGS['syslog_port'],
1738 1738
                 'teampass'
@@ -1766,7 +1766,7 @@  discard block
 block discarded – undo
1766 1766
     ?string $encryption_type = null
1767 1767
 ): void {
1768 1768
     // include librairies & connect to DB
1769
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1769
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1770 1770
     if (defined('DB_PASSWD_CLEAR') === false) {
1771 1771
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1772 1772
     }
@@ -1810,7 +1810,7 @@  discard block
 block discarded – undo
1810 1810
         if (empty($item_label) === true) {
1811 1811
             $dataItem = DB::queryfirstrow(
1812 1812
                 'SELECT id, id_tree, label
1813
-                FROM ' . prefixTable('items') . '
1813
+                FROM ' . prefixTable('items').'
1814 1814
                 WHERE id = %i',
1815 1815
                 $item_id
1816 1816
             );
@@ -1818,11 +1818,11 @@  discard block
 block discarded – undo
1818 1818
         }
1819 1819
 
1820 1820
         send_syslog(
1821
-            'action=' . str_replace('at_', '', $action) .
1822
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1823
-                ' itemno=' . $item_id .
1824
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1825
-                ' itemname="' . addslashes($item_label) . '"',
1821
+            'action='.str_replace('at_', '', $action).
1822
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1823
+                ' itemno='.$item_id.
1824
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1825
+                ' itemname="'.addslashes($item_label).'"',
1826 1826
             $SETTINGS['syslog_host'],
1827 1827
             $SETTINGS['syslog_port'],
1828 1828
             'teampass'
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
         && $action === 'at_shown'
1851 1851
     ) {
1852 1852
         // Load superglobal
1853
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1853
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1854 1854
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1855 1855
         // Get superglobals
1856 1856
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
         // Get info about item
1860 1860
         $dataItem = DB::queryfirstrow(
1861 1861
             'SELECT id, id_tree, label
1862
-            FROM ' . prefixTable('items') . '
1862
+            FROM ' . prefixTable('items').'
1863 1863
             WHERE id = %i',
1864 1864
             $item_id
1865 1865
         );
@@ -1873,9 +1873,9 @@  discard block
 block discarded – undo
1873 1873
                 'body' => str_replace(
1874 1874
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1875 1875
                     [
1876
-                        addslashes($globalsName . ' ' . $globalsLastname),
1876
+                        addslashes($globalsName.' '.$globalsLastname),
1877 1877
                         addslashes($item_label),
1878
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1878
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1879 1879
                     ],
1880 1880
                     langHdl('email_on_open_notification_mail')
1881 1881
                 ),
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1900 1900
 {
1901 1901
     // Load superglobal
1902
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1902
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1903 1903
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1904 1904
     // Get superglobals
1905 1905
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1909,8 +1909,8 @@  discard block
 block discarded – undo
1909 1909
     $notification = DB::queryOneColumn(
1910 1910
         'email',
1911 1911
         'SELECT *
1912
-        FROM ' . prefixTable('notification') . ' AS n
1913
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1912
+        FROM ' . prefixTable('notification').' AS n
1913
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1914 1914
         WHERE n.item_id = %i AND n.user_id != %i',
1915 1915
         $item_id,
1916 1916
         $globalsUserId
@@ -1921,7 +1921,7 @@  discard block
 block discarded – undo
1921 1921
         // Get list of changes
1922 1922
         $htmlChanges = '<ul>';
1923 1923
         foreach ($changes as $change) {
1924
-            $htmlChanges .= '<li>' . $change . '</li>';
1924
+            $htmlChanges .= '<li>'.$change.'</li>';
1925 1925
         }
1926 1926
         $htmlChanges .= '</ul>';
1927 1927
         // send email
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1955 1955
 {
1956 1956
     // Class loader
1957
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1957
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1958 1958
     //Load Tree
1959 1959
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1960 1960
     $tree->register();
@@ -1963,15 +1963,15 @@  discard block
 block discarded – undo
1963 1963
     $path = '';
1964 1964
     foreach ($arbo as $elem) {
1965 1965
         if (empty($path) === true) {
1966
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1966
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1967 1967
         } else {
1968
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1968
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1969 1969
         }
1970 1970
     }
1971 1971
 
1972 1972
     // Build text to show user
1973 1973
     if (empty($label) === false) {
1974
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1974
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1975 1975
     }
1976 1976
     return empty($path) === true ? '' : $path;
1977 1977
 }
@@ -2028,9 +2028,9 @@  discard block
 block discarded – undo
2028 2028
  */
2029 2029
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2030 2030
 {
2031
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2031
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2032 2032
     // include librairies & connect to DB
2033
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2033
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2034 2034
     if (defined('DB_PASSWD_CLEAR') === false) {
2035 2035
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2036 2036
     }
@@ -2043,8 +2043,8 @@  discard block
 block discarded – undo
2043 2043
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2044 2044
         // perform a copy
2045 2045
         if (file_exists($tp_config_file)) {
2046
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2047
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2046
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2047
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2048 2048
             }
2049 2049
         }
2050 2050
 
@@ -2054,11 +2054,11 @@  discard block
 block discarded – undo
2054 2054
         $data[1] = "global \$SETTINGS;\n";
2055 2055
         $data[2] = "\$SETTINGS = array (\n";
2056 2056
         $rows = DB::query(
2057
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2057
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2058 2058
             'admin'
2059 2059
         );
2060 2060
         foreach ($rows as $record) {
2061
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2061
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2062 2062
         }
2063 2063
         array_push($data, ");\n");
2064 2064
         $data = array_unique($data);
@@ -2072,15 +2072,15 @@  discard block
 block discarded – undo
2072 2072
                 break;
2073 2073
             }
2074 2074
 
2075
-            if (stristr($line, "'" . $field . "' => '")) {
2076
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2075
+            if (stristr($line, "'".$field."' => '")) {
2076
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2077 2077
                 $bFound = true;
2078 2078
                 break;
2079 2079
             }
2080 2080
             ++$inc;
2081 2081
         }
2082 2082
         if ($bFound === false) {
2083
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2083
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2084 2084
         }
2085 2085
     }
2086 2086
 
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 {
2111 2111
     global $SETTINGS;
2112 2112
     /* LOAD CPASSMAN SETTINGS */
2113
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2113
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2114 2114
         $SETTINGS = [];
2115 2115
         $SETTINGS['duplicate_folder'] = 0;
2116 2116
         //by default, this is set to 0;
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
         //by default, this value is set to 5;
2121 2121
         $settings = [];
2122 2122
         $rows = DB::query(
2123
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2123
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2124 2124
             [
2125 2125
                 'type' => 'admin',
2126 2126
                 'type2' => 'settings',
@@ -2152,7 +2152,7 @@  discard block
 block discarded – undo
2152 2152
     $source_cf = [];
2153 2153
     $rows = DB::QUERY(
2154 2154
         'SELECT id_category
2155
-            FROM ' . prefixTable('categories_folders') . '
2155
+            FROM ' . prefixTable('categories_folders').'
2156 2156
             WHERE id_folder = %i',
2157 2157
         $source_id
2158 2158
     );
@@ -2163,7 +2163,7 @@  discard block
 block discarded – undo
2163 2163
     $target_cf = [];
2164 2164
     $rows = DB::QUERY(
2165 2165
         'SELECT id_category
2166
-            FROM ' . prefixTable('categories_folders') . '
2166
+            FROM ' . prefixTable('categories_folders').'
2167 2167
             WHERE id_folder = %i',
2168 2168
         $target_id
2169 2169
     );
@@ -2198,9 +2198,9 @@  discard block
 block discarded – undo
2198 2198
     string $password = null
2199 2199
 ) {
2200 2200
     // Load AntiXSS
2201
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2202
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2203
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2201
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2202
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2203
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2204 2204
     $antiXss = new voku\helper\AntiXSS();
2205 2205
     // Protect against bad inputs
2206 2206
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2212,7 +2212,7 @@  discard block
 block discarded – undo
2212 2212
     $target_file = $antiXss->xss_clean($target_file);
2213 2213
     if (empty($password) === true || is_null($password) === true) {
2214 2214
         // get KEY to define password
2215
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2215
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2216 2216
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2217 2217
     }
2218 2218
 
@@ -2257,15 +2257,15 @@  discard block
 block discarded – undo
2257 2257
 ) {
2258 2258
     // load PhpEncryption library
2259 2259
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2260
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2261
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2262
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2263
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2264
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2265
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2266
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2267
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2268
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2260
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2261
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2262
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2263
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2264
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2265
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2266
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2267
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2268
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2269 2269
     try {
2270 2270
         \Defuse\Crypto\File::encryptFileWithPassword(
2271 2271
             $source_file,
@@ -2302,15 +2302,15 @@  discard block
 block discarded – undo
2302 2302
 ) {
2303 2303
     // load PhpEncryption library
2304 2304
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2305
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2306
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2307
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2308
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2309
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2310
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2311
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2312
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2313
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2305
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2306
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2307
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2308
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2309
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2310
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2311
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2312
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2313
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2314 2314
     try {
2315 2315
         \Defuse\Crypto\File::decryptFileWithPassword(
2316 2316
             $source_file,
@@ -2357,9 +2357,9 @@  discard block
 block discarded – undo
2357 2357
 function fileDelete(string $file, array $SETTINGS): void
2358 2358
 {
2359 2359
     // Load AntiXSS
2360
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2361
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2362
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2360
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2361
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2362
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2363 2363
     $antiXss = new voku\helper\AntiXSS();
2364 2364
     $file = $antiXss->xss_clean($file);
2365 2365
     if (is_file($file)) {
@@ -2409,7 +2409,7 @@  discard block
 block discarded – undo
2409 2409
     int  $dirPerm = 0755
2410 2410
 ) {
2411 2411
     // Check if the path exists
2412
-    if (! file_exists($path)) {
2412
+    if (!file_exists($path)) {
2413 2413
         return false;
2414 2414
     }
2415 2415
 
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
  */
2448 2448
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2449 2449
 {
2450
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2450
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2451 2451
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2452 2452
     // Prepare superGlobal variables
2453 2453
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2455,7 +2455,7 @@  discard block
 block discarded – undo
2455 2455
     // Load item data
2456 2456
     $data = DB::queryFirstRow(
2457 2457
         'SELECT id_tree
2458
-        FROM ' . prefixTable('items') . '
2458
+        FROM ' . prefixTable('items').'
2459 2459
         WHERE id = %i',
2460 2460
         $item_id
2461 2461
     );
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
         }
2519 2519
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2520 2520
     }
2521
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2521
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2522 2522
     return $email;
2523 2523
 }
2524 2524
 
@@ -2534,8 +2534,8 @@  discard block
 block discarded – undo
2534 2534
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2535 2535
 {
2536 2536
     // include librairies & connect to DB
2537
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2538
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2537
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2538
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2539 2539
     if (defined('DB_PASSWD_CLEAR') === false) {
2540 2540
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2541 2541
     }
@@ -2547,7 +2547,7 @@  discard block
 block discarded – undo
2547 2547
     DB::$encoding = DB_ENCODING;
2548 2548
     // Insert log in DB
2549 2549
     return DB::query(
2550
-        'SELECT ' . $fields . '
2550
+        'SELECT '.$fields.'
2551 2551
         FROM ' . prefixTable($table)
2552 2552
     );
2553 2553
 }
@@ -2562,11 +2562,11 @@  discard block
 block discarded – undo
2562 2562
 function formatSizeUnits(int $bytes): string
2563 2563
 {
2564 2564
     if ($bytes >= 1073741824) {
2565
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2565
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2566 2566
     } elseif ($bytes >= 1048576) {
2567
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2567
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2568 2568
     } elseif ($bytes >= 1024) {
2569
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2569
+        $bytes = number_format($bytes / 1024, 2).' KB';
2570 2570
     } elseif ($bytes > 1) {
2571 2571
         $bytes .= ' bytes';
2572 2572
     } elseif ($bytes === 1) {
@@ -2775,14 +2775,14 @@  discard block
 block discarded – undo
2775 2775
 
2776 2776
     // Encrypt the file content
2777 2777
     $plaintext = file_get_contents(
2778
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2778
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2779 2779
     );
2780 2780
     $ciphertext = $cipher->encrypt($plaintext);
2781 2781
     // Save new file
2782 2782
     $hash = md5($plaintext);
2783
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2783
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2784 2784
     file_put_contents($fileOut, $ciphertext);
2785
-    unlink($fileInPath . '/' . $fileInName);
2785
+    unlink($fileInPath.'/'.$fileInName);
2786 2786
     return [
2787 2787
         'fileHash' => base64_encode($hash),
2788 2788
         'objectKey' => base64_encode($objectKey),
@@ -2800,7 +2800,7 @@  discard block
 block discarded – undo
2800 2800
  */
2801 2801
 function decryptFile(string $fileName, string $filePath, string $key): string
2802 2802
 {
2803
-    if (! defined('FILE_BUFFER_SIZE')) {
2803
+    if (!defined('FILE_BUFFER_SIZE')) {
2804 2804
         define('FILE_BUFFER_SIZE', 128 * 1024);
2805 2805
     }
2806 2806
 
@@ -2819,7 +2819,7 @@  discard block
 block discarded – undo
2819 2819
     $cipher->enableContinuousBuffer();
2820 2820
     $cipher->disablePadding();
2821 2821
     // Get file content
2822
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2822
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2823 2823
     // Decrypt file content and return
2824 2824
     return base64_encode($cipher->decrypt($ciphertext));
2825 2825
 }
@@ -2873,8 +2873,8 @@  discard block
 block discarded – undo
2873 2873
     array $SETTINGS
2874 2874
 ): void {
2875 2875
     // include librairies & connect to DB
2876
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2877
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2876
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2877
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2878 2878
     if (defined('DB_PASSWD_CLEAR') === false) {
2879 2879
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2880 2880
     }
@@ -2891,7 +2891,7 @@  discard block
 block discarded – undo
2891 2891
         $post_object_id
2892 2892
     );
2893 2893
     // Superglobals
2894
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2894
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2895 2895
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2896 2896
     // Prepare superGlobal variables
2897 2897
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2916,8 +2916,8 @@  discard block
 block discarded – undo
2916 2916
         // Create sharekey for each user
2917 2917
         $users = DB::query(
2918 2918
             'SELECT id, public_key
2919
-            FROM ' . prefixTable('users') . '
2920
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2919
+            FROM ' . prefixTable('users').'
2920
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2921 2921
             AND public_key != ""'
2922 2922
         );
2923 2923
         foreach ($users as $user) {
@@ -2947,7 +2947,7 @@  discard block
 block discarded – undo
2947 2947
 function isBase64(string $str): bool
2948 2948
 {
2949 2949
     $str = (string) trim($str);
2950
-    if (! isset($str[0])) {
2950
+    if (!isset($str[0])) {
2951 2951
         return false;
2952 2952
     }
2953 2953
 
@@ -3015,13 +3015,13 @@  discard block
 block discarded – undo
3015 3015
         ],
3016 3016
     ];
3017 3017
     // Load expected libraries
3018
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3019
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3020
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3021
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3022
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3023
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
3024
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3018
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3019
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3020
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3021
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3022
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3023
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
3024
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3025 3025
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3026 3026
     $ad->register();
3027 3027
     $connection = new Connection($config);
@@ -3030,7 +3030,7 @@  discard block
 block discarded – undo
3030 3030
         $connection->connect();
3031 3031
     } catch (\LdapRecord\Auth\BindException $e) {
3032 3032
         $error = $e->getDetailedError();
3033
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3033
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3034 3034
         return false;
3035 3035
     }
3036 3036
 
@@ -3043,7 +3043,7 @@  discard block
 block discarded – undo
3043 3043
         }
3044 3044
     } catch (\LdapRecord\Auth\BindException $e) {
3045 3045
         $error = $e->getDetailedError();
3046
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3046
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3047 3047
         return false;
3048 3048
     }
3049 3049
 
@@ -3061,8 +3061,8 @@  discard block
 block discarded – undo
3061 3061
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3062 3062
 {
3063 3063
     // include librairies & connect to DB
3064
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3065
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3064
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3065
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3066 3066
     if (defined('DB_PASSWD_CLEAR') === false) {
3067 3067
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3068 3068
     }
@@ -3120,7 +3120,7 @@  discard block
 block discarded – undo
3120 3120
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3121 3121
             $now->setTimezone(new DateTimeZone($timezone));
3122 3122
             $offsets[] = $offset = $now->getOffset();
3123
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3123
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3124 3124
         }
3125 3125
 
3126 3126
         array_multisort($offsets, $timezones);
@@ -3140,7 +3140,7 @@  discard block
 block discarded – undo
3140 3140
 {
3141 3141
     $hours = intval($offset / 3600);
3142 3142
     $minutes = abs(intval($offset % 3600 / 60));
3143
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3143
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3144 3144
 }
3145 3145
 
3146 3146
 /**
Please login to merge, or discard this patch.