Passed
Push — teampass_3.0 ( 6e80da...a28a84 )
by Nils
10:40
created
includes/core/load.js.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                                     console.log('User has to regenerate keys')
84 84
                                     // HIde
85 85
                                     $('.content-header, .content').addClass('hidden');
86
-                                    $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected');?>');
86
+                                    $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected'); ?>');
87 87
 
88 88
                                     // Show passwords inputs and form
89 89
                                     $('#dialog-user-temporary-code').removeClass('hidden');
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
                                     // Show passwords inputs and form
99 99
                                     $('#dialog-user-change-password-info')
100
-                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('user_has_to_change_password_info');?>')
100
+                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('user_has_to_change_password_info'); ?>')
101 101
                                         .removeClass('hidden');
102 102
                                     $('#dialog-user-change-password').removeClass('hidden');
103 103
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
                                     // Show passwords inputs and form
112 112
                                     $('#dialog-ldap-user-change-password-info')
113
-                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('ldap_user_has_changed_his_password');?>')
113
+                                        .html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('ldap_user_has_changed_his_password'); ?>')
114 114
                                         .removeClass('hidden');
115 115
                                     $('#dialog-ldap-user-change-password').removeClass('hidden');
116 116
                                     
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         console.log('User has to regenerate keys')
182 182
         // HIde
183 183
         $('.content-header, .content').addClass('hidden');
184
-        $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected');?>');
184
+        $('#dialog-user-temporary-code-info').html('<i class="icon fas fa-info mr-2"></i><?php echo langHdl('renecyption_expected'); ?>');
185 185
 
186 186
         // Show passwords inputs and form
187 187
         $('#dialog-user-temporary-code').removeClass('hidden');
@@ -748,13 +748,13 @@  discard block
 block discarded – undo
748 748
             //
749 749
 
750 750
             
751
-            $('#dialog-admin-change-user-password-info').html('<?php echo langHdl('sending_email_message');?>');
751
+            $('#dialog-admin-change-user-password-info').html('<?php echo langHdl('sending_email_message'); ?>');
752 752
             
753 753
             // Prepare data
754 754
             var data = {
755 755
                 'receipt': $('#temp-user-email').val(),
756
-                'subject': '[Teampass] <?php echo langHdl('temporary_encryption_code');?>',
757
-                'body': '<?php echo langHdl('email_body_temporary_encryption_code');?>',
756
+                'subject': '[Teampass] <?php echo langHdl('temporary_encryption_code'); ?>',
757
+                'body': '<?php echo langHdl('email_body_temporary_encryption_code'); ?>',
758 758
                 'pre_replace' : {
759 759
                     '#enc_code#' : $('#temp-user-pwd').val(),
760 760
                 }
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
             '#warningModal',
1221 1221
             '<i class="fas fa-clock fa-lg warning mr-2"></i><?php echo langHdl('index_add_one_hour'); ?>',
1222 1222
             '<div class="form-group">' +
1223
-            '<label for="warningModal-input" class="col-form-label"><?php echo langHdl('index_session_duration') . ' (' . langHdl('minutes') . ')'; ?>:</label>' +
1223
+            '<label for="warningModal-input" class="col-form-label"><?php echo langHdl('index_session_duration').' ('.langHdl('minutes').')'; ?>:</label>' +
1224 1224
             '<input type="text" class="form-control" id="warningModal-input" value="<?php echo isset($_SESSION['user']['session_duration']) === true ? (int) $_SESSION['user']['session_duration'] / 60 : 60; ?>">' +
1225 1225
             '</div>',
1226 1226
             '<?php echo langHdl('confirm'); ?>',
Please login to merge, or discard this patch.
pages/users.js.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 }
37 37
 
38 38
 /* do checks */
39
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
39
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
40 40
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
41 41
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
42
-    include $SETTINGS['cpassman_dir'] . '/error.php';
42
+    include $SETTINGS['cpassman_dir'].'/error.php';
43 43
     exit();
44 44
 }
45 45
 ?>
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
         // Prepare data
262 262
         var data = {
263 263
             'receipt': $('#form-email').val(),
264
-            'subject': 'TEAMPASS - <?php echo langHdl('temporary_encryption_code');?>',
265
-            'body': '<?php echo langHdl('email_body_temporary_encryption_code');?>',
264
+            'subject': 'TEAMPASS - <?php echo langHdl('temporary_encryption_code'); ?>',
265
+            'body': '<?php echo langHdl('email_body_temporary_encryption_code'); ?>',
266 266
             'pre_replace' : {
267 267
                 '#enc_code#' : store.get('teampassUser').admin_new_user_password,
268 268
             }
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
                         } else {
1116 1116
                             // Show icon or not
1117 1117
                             if ($('#user-disabled').prop('checked') === true) {
1118
-                                $('#user-login-'+userID).before('<i class="fas fa-user-slash infotip text-danger mr-2" title="<?php echo langHdl('account_is_locked');?>" id="user-disable-'+userID+'"></i>');
1118
+                                $('#user-login-'+userID).before('<i class="fas fa-user-slash infotip text-danger mr-2" title="<?php echo langHdl('account_is_locked'); ?>" id="user-disable-'+userID+'"></i>');
1119 1119
                             } else {
1120 1120
                                 $('#user-disable-'+userID).remove();
1121 1121
                             }
Please login to merge, or discard this patch.
sources/main.functions.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3340,9 +3340,9 @@
 block discarded – undo
3340 3340
  */
3341 3341
 function mfa_auth_requested($userRolesIds, $mfaRoles)
3342 3342
 {
3343
-	if (is_null($mfaRoles) === true) {
3344
-		return false;
3345
-	}
3343
+    if (is_null($mfaRoles) === true) {
3344
+        return false;
3345
+    }
3346 3346
 	
3347 3347
     $mfaRoles = array_values(json_decode($mfaRoles, true));
3348 3348
     $userRolesIds = array_filter(explode(';' , $userRolesIds));
Please login to merge, or discard this patch.
Spacing   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $var_dk = ''; // Derived key
108 108
 
109 109
     for ($block = 1; $block <= $var_kb; ++$block) { // Create key
110
-        $var_ib = $var_h = hash_hmac($var_a, $var_s . pack('N', $block), $var_p, true); // Initial hash for this block
110
+        $var_ib = $var_h = hash_hmac($var_a, $var_s.pack('N', $block), $var_p, true); // Initial hash for this block
111 111
         for ($var_i = 1; $var_i < $var_c; ++$var_i) { // Perform block iterations
112 112
             $var_ib ^= ($var_h = hash_hmac($var_a, $var_h, $var_p, true)); // XOR each iterate
113 113
         }
@@ -341,25 +341,25 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function cryption($message, $ascii_key, $type, $SETTINGS)
343 343
 {
344
-    $ascii_key = (empty($ascii_key) === true) ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
344
+    $ascii_key = (empty($ascii_key) === true) ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
345 345
     $err = false;
346 346
 
347 347
     // load PhpEncryption library
348 348
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
349 349
         $path = '../includes/libraries/Encryption/Encryption/';
350 350
     } else {
351
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
351
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
352 352
     }
353 353
 
354
-    include_once $path . 'Crypto.php';
355
-    include_once $path . 'Encoding.php';
356
-    include_once $path . 'DerivedKeys.php';
357
-    include_once $path . 'Key.php';
358
-    include_once $path . 'KeyOrPassword.php';
359
-    include_once $path . 'File.php';
360
-    include_once $path . 'RuntimeTests.php';
361
-    include_once $path . 'KeyProtectedByPassword.php';
362
-    include_once $path . 'Core.php';
354
+    include_once $path.'Crypto.php';
355
+    include_once $path.'Encoding.php';
356
+    include_once $path.'DerivedKeys.php';
357
+    include_once $path.'Key.php';
358
+    include_once $path.'KeyOrPassword.php';
359
+    include_once $path.'File.php';
360
+    include_once $path.'RuntimeTests.php';
361
+    include_once $path.'KeyProtectedByPassword.php';
362
+    include_once $path.'Core.php';
363 363
 
364 364
     // convert KEY
365 365
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -405,15 +405,15 @@  discard block
 block discarded – undo
405 405
         $path = '../includes/libraries/Encryption/Encryption/';
406 406
     }
407 407
 
408
-    include_once $path . 'Crypto.php';
409
-    include_once $path . 'Encoding.php';
410
-    include_once $path . 'DerivedKeys.php';
411
-    include_once $path . 'Key.php';
412
-    include_once $path . 'KeyOrPassword.php';
413
-    include_once $path . 'File.php';
414
-    include_once $path . 'RuntimeTests.php';
415
-    include_once $path . 'KeyProtectedByPassword.php';
416
-    include_once $path . 'Core.php';
408
+    include_once $path.'Crypto.php';
409
+    include_once $path.'Encoding.php';
410
+    include_once $path.'DerivedKeys.php';
411
+    include_once $path.'Key.php';
412
+    include_once $path.'KeyOrPassword.php';
413
+    include_once $path.'File.php';
414
+    include_once $path.'RuntimeTests.php';
415
+    include_once $path.'KeyProtectedByPassword.php';
416
+    include_once $path.'Core.php';
417 417
 
418 418
     $key = \Defuse\Crypto\Key::createNewRandomKey();
419 419
     $key = $key->saveToAsciiSafeString();
@@ -439,15 +439,15 @@  discard block
 block discarded – undo
439 439
         $path = '../includes/libraries/Encryption/Encryption/';
440 440
     }
441 441
 
442
-    include_once $path . 'Crypto.php';
443
-    include_once $path . 'Encoding.php';
444
-    include_once $path . 'DerivedKeys.php';
445
-    include_once $path . 'Key.php';
446
-    include_once $path . 'KeyOrPassword.php';
447
-    include_once $path . 'File.php';
448
-    include_once $path . 'RuntimeTests.php';
449
-    include_once $path . 'KeyProtectedByPassword.php';
450
-    include_once $path . 'Core.php';
442
+    include_once $path.'Crypto.php';
443
+    include_once $path.'Encoding.php';
444
+    include_once $path.'DerivedKeys.php';
445
+    include_once $path.'Key.php';
446
+    include_once $path.'KeyOrPassword.php';
447
+    include_once $path.'File.php';
448
+    include_once $path.'RuntimeTests.php';
449
+    include_once $path.'KeyProtectedByPassword.php';
450
+    include_once $path.'Core.php';
451 451
 
452 452
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
453 453
     $protected_key_encoded = $protected_key->saveToAsciiSafeString();
@@ -474,15 +474,15 @@  discard block
 block discarded – undo
474 474
         $path = '../includes/libraries/Encryption/Encryption/';
475 475
     }
476 476
 
477
-    include_once $path . 'Crypto.php';
478
-    include_once $path . 'Encoding.php';
479
-    include_once $path . 'DerivedKeys.php';
480
-    include_once $path . 'Key.php';
481
-    include_once $path . 'KeyOrPassword.php';
482
-    include_once $path . 'File.php';
483
-    include_once $path . 'RuntimeTests.php';
484
-    include_once $path . 'KeyProtectedByPassword.php';
485
-    include_once $path . 'Core.php';
477
+    include_once $path.'Crypto.php';
478
+    include_once $path.'Encoding.php';
479
+    include_once $path.'DerivedKeys.php';
480
+    include_once $path.'Key.php';
481
+    include_once $path.'KeyOrPassword.php';
482
+    include_once $path.'File.php';
483
+    include_once $path.'RuntimeTests.php';
484
+    include_once $path.'KeyProtectedByPassword.php';
485
+    include_once $path.'Core.php';
486 486
 
487 487
     try {
488 488
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
  */
570 570
 function db_error_handler($params)
571 571
 {
572
-    echo 'Error: ' . $params['error'] . "<br>\n";
573
-    echo 'Query: ' . $params['query'] . "<br>\n";
572
+    echo 'Error: '.$params['error']."<br>\n";
573
+    echo 'Query: '.$params['query']."<br>\n";
574 574
     throw new Exception('Error - Query', 1);
575 575
 }
576 576
 
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
     $SETTINGS
593 593
 ) {
594 594
     //load ClassLoader
595
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
595
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
596 596
 
597 597
     // Load superglobal
598
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
598
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
599 599
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
600 600
 
601 601
     //Connect to DB
602
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
602
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
603 603
     if (defined('DB_PASSWD_CLEAR') === false) {
604 604
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
605 605
     }
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
     DB::$encoding = DB_ENCODING;
612 612
 
613 613
     //Build tree
614
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
614
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
615 615
     $tree->register();
616 616
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
617 617
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 function identAdmin($idFonctions, $SETTINGS, $tree)
654 654
 {
655 655
     // Load superglobal
656
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
656
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
657 657
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
658 658
 
659 659
     // Init
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
676 676
 
677 677
     // Get list of Folders
678
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
678
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
679 679
     foreach ($rows as $record) {
680 680
         array_push($groupesVisibles, $record['id']);
681 681
     }
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
     }
695 695
     // Get ID of personal folder
696 696
     $persfld = DB::queryfirstrow(
697
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
697
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
698 698
         $globalsUserId
699 699
     );
700 700
     if (empty($persfld['id']) === false) {
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
     // get complete list of ROLES
716 716
     $tmp = explode(';', $idFonctions);
717 717
     $rows = DB::query(
718
-        'SELECT * FROM ' . prefixTable('roles_title') . '
718
+        'SELECT * FROM '.prefixTable('roles_title').'
719 719
         ORDER BY title ASC'
720 720
     );
721 721
     foreach ($rows as $record) {
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
     $superGlobal->put('is_admin', 1, 'SESSION');
728 728
 
729 729
     // Check if admin has created Folders and Roles
730
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
730
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
731 731
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
732
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
732
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
733 733
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
734 734
 }
735 735
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     $tree
774 774
 ) {
775 775
     // Load superglobal
776
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
776
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
777 777
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
778 778
 
779 779
     // Init
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
     // Get list of folders depending on Roles
807 807
     $rows = DB::query(
808 808
         'SELECT *
809
-        FROM ' . prefixTable('roles_values') . '
809
+        FROM ' . prefixTable('roles_values').'
810 810
         WHERE role_id IN %li AND type IN %ls',
811 811
         $userRoles,
812 812
         array('W', 'ND', 'NE', 'NDNE', 'R')
@@ -831,9 +831,9 @@  discard block
 block discarded – undo
831 831
     // Does this user is allowed to see other items
832 832
     $inc = 0;
833 833
     $rows = DB::query(
834
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
834
+        'SELECT id, id_tree FROM '.prefixTable('items').'
835 835
         WHERE restricted_to LIKE %ss AND inactif = %s',
836
-        $globalsUserId . ';',
836
+        $globalsUserId.';',
837 837
         '0'
838 838
     );
839 839
     foreach ($rows as $record) {
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
     // Check for the users roles if some specific rights exist on items
848 848
     $rows = DB::query(
849 849
         'SELECT i.id_tree, r.item_id
850
-        FROM ' . prefixTable('items') . ' as i
851
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
850
+        FROM ' . prefixTable('items').' as i
851
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
852 852
         WHERE r.role_id IN %li
853 853
         ORDER BY i.id_tree ASC',
854 854
         $userRoles
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
     ) {
870 870
         $persoFld = DB::queryfirstrow(
871 871
             'SELECT id
872
-            FROM ' . prefixTable('nested_tree') . '
872
+            FROM ' . prefixTable('nested_tree').'
873 873
             WHERE title = %s AND personal_folder = %i',
874 874
             $globalsUserId,
875 875
             1
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
     }
904 904
     $persoFlds = DB::query(
905 905
         'SELECT id
906
-        FROM ' . prefixTable('nested_tree') . '
906
+        FROM ' . prefixTable('nested_tree').'
907 907
         WHERE %l',
908 908
         $where
909 909
     );
@@ -946,17 +946,17 @@  discard block
 block discarded – undo
946 946
     );
947 947
 
948 948
     // Folders and Roles numbers
949
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
949
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
950 950
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
951
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
951
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
952 952
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
953 953
 
954 954
     // check if change proposals on User's items
955 955
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
956 956
         DB::query(
957 957
             'SELECT *
958
-            FROM ' . prefixTable('items_change') . ' AS c
959
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
958
+            FROM ' . prefixTable('items_change').' AS c
959
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
960 960
             WHERE i.action = %s AND i.id_user = %i',
961 961
             'at_creation',
962 962
             $globalsUserId
@@ -1000,10 +1000,10 @@  discard block
 block discarded – undo
1000 1000
  */
1001 1001
 function cacheTableRefresh($SETTINGS)
1002 1002
 {
1003
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1003
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1004 1004
 
1005 1005
     //Connect to DB
1006
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1006
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1007 1007
     if (defined('DB_PASSWD_CLEAR') === false) {
1008 1008
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1009 1009
     }
@@ -1020,13 +1020,13 @@  discard block
 block discarded – undo
1020 1020
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1021 1021
 
1022 1022
     // truncate table
1023
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
1023
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
1024 1024
 
1025 1025
     // reload date
1026 1026
     $rows = DB::query(
1027 1027
         'SELECT *
1028
-        FROM ' . prefixTable('items') . ' as i
1029
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1028
+        FROM ' . prefixTable('items').' as i
1029
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1030 1030
         AND l.action = %s
1031 1031
         AND i.inactif = %i',
1032 1032
         'at_creation',
@@ -1038,18 +1038,18 @@  discard block
 block discarded – undo
1038 1038
             $tags = '';
1039 1039
             $itemTags = DB::query(
1040 1040
                 'SELECT tag
1041
-                FROM ' . prefixTable('tags') . '
1041
+                FROM ' . prefixTable('tags').'
1042 1042
                 WHERE item_id = %i AND tag != ""',
1043 1043
                 $record['id']
1044 1044
             );
1045 1045
             foreach ($itemTags as $itemTag) {
1046
-                $tags .= $itemTag['tag'] . ' ';
1046
+                $tags .= $itemTag['tag'].' ';
1047 1047
             }
1048 1048
 
1049 1049
             // Get renewal period
1050 1050
             $resNT = DB::queryfirstrow(
1051 1051
                 'SELECT renewal_period
1052
-                FROM ' . prefixTable('nested_tree') . '
1052
+                FROM ' . prefixTable('nested_tree').'
1053 1053
                 WHERE id = %i',
1054 1054
                 $record['id_tree']
1055 1055
             );
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
                     // Is this a User id?
1064 1064
                     $user = DB::queryfirstrow(
1065 1065
                         'SELECT id, login
1066
-                        FROM ' . prefixTable('users') . '
1066
+                        FROM ' . prefixTable('users').'
1067 1067
                         WHERE id = %i',
1068 1068
                         $elem->title
1069 1069
                     );
@@ -1105,14 +1105,14 @@  discard block
 block discarded – undo
1105 1105
  */
1106 1106
 function cacheTableUpdate($SETTINGS, $ident = null)
1107 1107
 {
1108
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1108
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1109 1109
 
1110 1110
     // Load superglobal
1111
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1111
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1112 1112
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1113 1113
 
1114 1114
     //Connect to DB
1115
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1115
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1116 1116
     if (defined('DB_PASSWD_CLEAR') === false) {
1117 1117
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1118 1118
     }
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
     // get new value from db
1132 1132
     $data = DB::queryfirstrow(
1133 1133
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1134
-        FROM ' . prefixTable('items') . '
1134
+        FROM ' . prefixTable('items').'
1135 1135
         WHERE id=%i',
1136 1136
         $ident
1137 1137
     );
@@ -1139,12 +1139,12 @@  discard block
 block discarded – undo
1139 1139
     $tags = '';
1140 1140
     $itemTags = DB::query(
1141 1141
         'SELECT tag
1142
-        FROM ' . prefixTable('tags') . '
1142
+        FROM ' . prefixTable('tags').'
1143 1143
         WHERE item_id = %i AND tag != ""',
1144 1144
         $ident
1145 1145
     );
1146 1146
     foreach ($itemTags as $itemTag) {
1147
-        $tags .= $itemTag['tag'] . ' ';
1147
+        $tags .= $itemTag['tag'].' ';
1148 1148
     }
1149 1149
     // form id_tree to full foldername
1150 1150
     $folder = array();
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
             // Is this a User id?
1156 1156
             $user = DB::queryfirstrow(
1157 1157
                 'SELECT id, login
1158
-                FROM ' . prefixTable('users') . '
1158
+                FROM ' . prefixTable('users').'
1159 1159
                 WHERE id = %i',
1160 1160
                 $elem->title
1161 1161
             );
@@ -1194,17 +1194,17 @@  discard block
 block discarded – undo
1194 1194
  */
1195 1195
 function cacheTableAdd($SETTINGS, $ident = null)
1196 1196
 {
1197
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1197
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1198 1198
 
1199 1199
     // Load superglobal
1200
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1200
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1201 1201
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1202 1202
 
1203 1203
     // Get superglobals
1204 1204
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1205 1205
 
1206 1206
     //Connect to DB
1207
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1207
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1208 1208
     if (defined('DB_PASSWD_CLEAR') === false) {
1209 1209
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1210 1210
     }
@@ -1223,8 +1223,8 @@  discard block
 block discarded – undo
1223 1223
     // get new value from db
1224 1224
     $data = DB::queryFirstRow(
1225 1225
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1226
-        FROM ' . prefixTable('items') . ' as i
1227
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1226
+        FROM ' . prefixTable('items').' as i
1227
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1228 1228
         WHERE i.id = %i
1229 1229
         AND l.action = %s',
1230 1230
         $ident,
@@ -1234,12 +1234,12 @@  discard block
 block discarded – undo
1234 1234
     $tags = '';
1235 1235
     $itemTags = DB::query(
1236 1236
         'SELECT tag
1237
-        FROM ' . prefixTable('tags') . '
1237
+        FROM ' . prefixTable('tags').'
1238 1238
         WHERE item_id = %i AND tag != ""',
1239 1239
         $ident
1240 1240
     );
1241 1241
     foreach ($itemTags as $itemTag) {
1242
-        $tags .= $itemTag['tag'] . ' ';
1242
+        $tags .= $itemTag['tag'].' ';
1243 1243
     }
1244 1244
     // form id_tree to full foldername
1245 1245
     $folder = array();
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
             // Is this a User id?
1251 1251
             $user = DB::queryfirstrow(
1252 1252
                 'SELECT id, login
1253
-                FROM ' . prefixTable('users') . '
1253
+                FROM ' . prefixTable('users').'
1254 1254
                 WHERE id = %i',
1255 1255
                 $elem->title
1256 1256
             );
@@ -1291,48 +1291,48 @@  discard block
 block discarded – undo
1291 1291
 function getStatisticsData($SETTINGS)
1292 1292
 {
1293 1293
     DB::query(
1294
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1294
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1295 1295
         0
1296 1296
     );
1297 1297
     $counter_folders = DB::count();
1298 1298
 
1299 1299
     DB::query(
1300
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1300
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1301 1301
         1
1302 1302
     );
1303 1303
     $counter_folders_perso = DB::count();
1304 1304
 
1305 1305
     DB::query(
1306
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1306
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1307 1307
         0
1308 1308
     );
1309 1309
     $counter_items = DB::count();
1310 1310
 
1311 1311
     DB::query(
1312
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1312
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1313 1313
         1
1314 1314
     );
1315 1315
     $counter_items_perso = DB::count();
1316 1316
 
1317 1317
     DB::query(
1318
-        'SELECT id FROM ' . prefixTable('users') . ''
1318
+        'SELECT id FROM '.prefixTable('users').''
1319 1319
     );
1320 1320
     $counter_users = DB::count();
1321 1321
 
1322 1322
     DB::query(
1323
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1323
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1324 1324
         1
1325 1325
     );
1326 1326
     $admins = DB::count();
1327 1327
 
1328 1328
     DB::query(
1329
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1329
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1330 1330
         1
1331 1331
     );
1332 1332
     $managers = DB::count();
1333 1333
 
1334 1334
     DB::query(
1335
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1335
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1336 1336
         1
1337 1337
     );
1338 1338
     $readOnly = DB::count();
@@ -1340,11 +1340,11 @@  discard block
 block discarded – undo
1340 1340
     // list the languages
1341 1341
     $usedLang = [];
1342 1342
     $tp_languages = DB::query(
1343
-        'SELECT name FROM ' . prefixTable('languages')
1343
+        'SELECT name FROM '.prefixTable('languages')
1344 1344
     );
1345 1345
     foreach ($tp_languages as $tp_language) {
1346 1346
         DB::query(
1347
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1347
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1348 1348
             $tp_language['name']
1349 1349
         );
1350 1350
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
     // get list of ips
1354 1354
     $usedIp = [];
1355 1355
     $tp_ips = DB::query(
1356
-        'SELECT user_ip FROM ' . prefixTable('users')
1356
+        'SELECT user_ip FROM '.prefixTable('users')
1357 1357
     );
1358 1358
     foreach ($tp_ips as $ip) {
1359 1359
         if (array_key_exists($ip['user_ip'], $usedIp)) {
@@ -1415,21 +1415,21 @@  discard block
 block discarded – undo
1415 1415
 ) {
1416 1416
     // CAse where email not defined
1417 1417
     if ($email === 'none' || empty($email) === true) {
1418
-        return '"error":"" , "message":"' . langHdl('forgot_my_pw_email_sent') . '"';
1418
+        return '"error":"" , "message":"'.langHdl('forgot_my_pw_email_sent').'"';
1419 1419
     }
1420 1420
 
1421 1421
     // Load settings
1422
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1422
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1423 1423
 
1424 1424
     // Load superglobal
1425
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1425
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1426 1426
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1427 1427
 
1428 1428
     // Get user language
1429
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1429
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1430 1430
 
1431 1431
     // Load library
1432
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1432
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1433 1433
 
1434 1434
     // load PHPMailer
1435 1435
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1438 1438
     try {
1439 1439
         // send to user
1440
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1440
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1441 1441
         $mail->SMTPDebug = 0; //value 1 can be used to debug - 4 for debuging connections
1442 1442
         $mail->Port = $SETTINGS['email_port']; //COULD BE USED
1443 1443
         $mail->CharSet = 'utf-8';
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
         <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;">
1524 1524
         <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;">
1525 1525
         <br><div style="float:right;">' .
1526
-        $textMail .
1526
+        $textMail.
1527 1527
         '<br><br></td></tr></table>
1528 1528
     </td></tr></table>
1529 1529
     <br></body></html>';
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
  */
1537 1537
 function generateKey()
1538 1538
 {
1539
-    return substr(md5(rand() . rand()), 0, 15);
1539
+    return substr(md5(rand().rand()), 0, 15);
1540 1540
 }
1541 1541
 
1542 1542
 /**
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 {
1607 1607
     array_walk_recursive(
1608 1608
         $array,
1609
-        function (&$item) {
1609
+        function(&$item) {
1610 1610
             if (mb_detect_encoding($item, 'utf-8', true) === false) {
1611 1611
                 $item = utf8_encode($item);
1612 1612
             }
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
     }
1643 1643
 
1644 1644
     // Load superglobal
1645
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1645
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1646 1646
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1647 1647
 
1648 1648
     // Get superglobals
@@ -1654,9 +1654,9 @@  discard block
 block discarded – undo
1654 1654
     }
1655 1655
 
1656 1656
     //load ClassLoader
1657
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1657
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1658 1658
     //Load AES
1659
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1659
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1660 1660
     $aes->register();
1661 1661
 
1662 1662
     if ($type === 'encode' && is_array($data) === true) {
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 function makeThumbnail($src, $dest, $desired_width)
1712 1712
 {
1713 1713
     /* read the source image */
1714
-    if(is_file($src) === true && mime_content_type($src) === 'image/png'){
1714
+    if (is_file($src) === true && mime_content_type($src) === 'image/png') {
1715 1715
         $source_image = imagecreatefrompng($src);
1716 1716
         if ($source_image === false) {
1717 1717
             return "Error: Not a valid PNG file! It's type is ".mime_content_type($src);
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
  */
1749 1749
 function prefixTable($table)
1750 1750
 {
1751
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1751
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1752 1752
     if (!empty($safeTable)) {
1753 1753
         // sanitize string
1754 1754
         return $safeTable;
@@ -1780,14 +1780,14 @@  discard block
 block discarded – undo
1780 1780
     $lowercase = false,
1781 1781
     $SETTINGS = array()
1782 1782
 ) {
1783
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1784
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1783
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1784
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1785 1785
     $generator->register();
1786 1786
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1787 1787
 
1788 1788
     // Is PHP7 being used?
1789 1789
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1790
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1790
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1791 1791
         $php7generator->register();
1792 1792
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1793 1793
     }
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
 function send_syslog($message, $host, $port, $component = 'teampass')
1819 1819
 {
1820 1820
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1821
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1821
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1822 1822
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1823 1823
     socket_close($sock);
1824 1824
 }
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
     }
1843 1843
 
1844 1844
     // include librairies & connect to DB
1845
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1845
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1846 1846
     if (defined('DB_PASSWD_CLEAR') === false) {
1847 1847
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1848 1848
     }
@@ -1868,14 +1868,14 @@  discard block
 block discarded – undo
1868 1868
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1869 1869
         if ($type === 'user_mngt') {
1870 1870
             send_syslog(
1871
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1871
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1872 1872
                 $SETTINGS['syslog_host'],
1873 1873
                 $SETTINGS['syslog_port'],
1874 1874
                 'teampass'
1875 1875
             );
1876 1876
         } else {
1877 1877
             send_syslog(
1878
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1878
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1879 1879
                 $SETTINGS['syslog_host'],
1880 1880
                 $SETTINGS['syslog_port'],
1881 1881
                 'teampass'
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
     $encryption_type = null
1908 1908
 ) {
1909 1909
     // include librairies & connect to DB
1910
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1910
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1911 1911
     if (defined('DB_PASSWD_CLEAR') === false) {
1912 1912
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1913 1913
     }
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
         if (empty($item_label) === true) {
1954 1954
             $dataItem = DB::queryfirstrow(
1955 1955
                 'SELECT id, id_tree, label
1956
-                FROM ' . prefixTable('items') . '
1956
+                FROM ' . prefixTable('items').'
1957 1957
                 WHERE id = %i',
1958 1958
                 $item_id
1959 1959
             );
@@ -1962,11 +1962,11 @@  discard block
 block discarded – undo
1962 1962
         }
1963 1963
 
1964 1964
         send_syslog(
1965
-            'action=' . str_replace('at_', '', $action) .
1966
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1967
-                ' itemno=' . $item_id .
1968
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1969
-                ' itemname="' . addslashes($item_label) . '"',
1965
+            'action='.str_replace('at_', '', $action).
1966
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1967
+                ' itemno='.$item_id.
1968
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1969
+                ' itemname="'.addslashes($item_label).'"',
1970 1970
             $SETTINGS['syslog_host'],
1971 1971
             $SETTINGS['syslog_port'],
1972 1972
             'teampass'
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
         && $action === 'at_shown'
1993 1993
     ) {
1994 1994
         // Load superglobal
1995
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1995
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1996 1996
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1997 1997
 
1998 1998
         // Get superglobals
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
         // Get info about item
2004 2004
         $dataItem = DB::queryfirstrow(
2005 2005
             'SELECT id, id_tree, label
2006
-            FROM ' . prefixTable('items') . '
2006
+            FROM ' . prefixTable('items').'
2007 2007
             WHERE id = %i',
2008 2008
             $item_id
2009 2009
         );
@@ -2018,9 +2018,9 @@  discard block
 block discarded – undo
2018 2018
                 'body' => str_replace(
2019 2019
                     array('#tp_user#', '#tp_item#', '#tp_link#'),
2020 2020
                     array(
2021
-                        addslashes($globalsName . ' ' . $globalsLastname),
2021
+                        addslashes($globalsName.' '.$globalsLastname),
2022 2022
                         addslashes($item_label),
2023
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
2023
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
2024 2024
                     ),
2025 2025
                     langHdl('email_on_open_notification_mail')
2026 2026
                 ),
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 function notifyChangesToSubscribers($item_id, $label, $changes, $SETTINGS)
2043 2043
 {
2044 2044
     // Load superglobal
2045
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2045
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2046 2046
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2047 2047
 
2048 2048
     // Get superglobals
@@ -2054,8 +2054,8 @@  discard block
 block discarded – undo
2054 2054
     $notification = DB::queryOneColumn(
2055 2055
         'email',
2056 2056
         'SELECT *
2057
-        FROM ' . prefixTable('notification') . ' AS n
2058
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
2057
+        FROM ' . prefixTable('notification').' AS n
2058
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
2059 2059
         WHERE n.item_id = %i AND n.user_id != %i',
2060 2060
         $item_id,
2061 2061
         $globalsUserId
@@ -2068,7 +2068,7 @@  discard block
 block discarded – undo
2068 2068
         // Get list of changes
2069 2069
         $htmlChanges = '<ul>';
2070 2070
         foreach ($changes as $change) {
2071
-            $htmlChanges .= '<li>' . $change . '</li>';
2071
+            $htmlChanges .= '<li>'.$change.'</li>';
2072 2072
         }
2073 2073
         $htmlChanges .= '</ul>';
2074 2074
 
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 function geItemReadablePath($id_tree, $label, $SETTINGS)
2103 2103
 {
2104 2104
     // Class loader
2105
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
2105
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
2106 2106
 
2107 2107
     //Load Tree
2108 2108
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
@@ -2113,15 +2113,15 @@  discard block
 block discarded – undo
2113 2113
     $path = '';
2114 2114
     foreach ($arbo as $elem) {
2115 2115
         if (empty($path) === true) {
2116
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
2116
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
2117 2117
         } else {
2118
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2118
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2119 2119
         }
2120 2120
     }
2121 2121
 
2122 2122
     // Build text to show user
2123 2123
     if (empty($label) === false) {
2124
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
2124
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
2125 2125
     } else {
2126 2126
         return empty($path) === true ? '' : $path;
2127 2127
     }
@@ -2180,10 +2180,10 @@  discard block
 block discarded – undo
2180 2180
  */
2181 2181
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2182 2182
 {
2183
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2183
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2184 2184
 
2185 2185
     // include librairies & connect to DB
2186
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2186
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2187 2187
     if (defined('DB_PASSWD_CLEAR') === false) {
2188 2188
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2189 2189
     }
@@ -2197,8 +2197,8 @@  discard block
 block discarded – undo
2197 2197
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2198 2198
         // perform a copy
2199 2199
         if (file_exists($tp_config_file)) {
2200
-            if (!copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2201
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2200
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2201
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2202 2202
             }
2203 2203
         }
2204 2204
 
@@ -2209,11 +2209,11 @@  discard block
 block discarded – undo
2209 2209
         $data[1] = "global \$SETTINGS;\n";
2210 2210
         $data[2] = "\$SETTINGS = array (\n";
2211 2211
         $rows = DB::query(
2212
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2212
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2213 2213
             'admin'
2214 2214
         );
2215 2215
         foreach ($rows as $record) {
2216
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2216
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2217 2217
         }
2218 2218
         array_push($data, ");\n");
2219 2219
         $data = array_unique($data);
@@ -2227,15 +2227,15 @@  discard block
 block discarded – undo
2227 2227
                 break;
2228 2228
             }
2229 2229
 
2230
-            if (stristr($line, "'" . $field . "' => '")) {
2231
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2230
+            if (stristr($line, "'".$field."' => '")) {
2231
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2232 2232
                 $bFound = true;
2233 2233
                 break;
2234 2234
             }
2235 2235
             ++$inc;
2236 2236
         }
2237 2237
         if ($bFound === false) {
2238
-            $data[($inc)] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2238
+            $data[($inc)] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2239 2239
         }
2240 2240
     }
2241 2241
 
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
         $settings = array();
2274 2274
 
2275 2275
         $rows = DB::query(
2276
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2276
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2277 2277
             array(
2278 2278
                 'type' => 'admin',
2279 2279
                 'type2' => 'settings',
@@ -2300,7 +2300,7 @@  discard block
 block discarded – undo
2300 2300
     $source_cf = array();
2301 2301
     $rows = DB::QUERY(
2302 2302
         'SELECT id_category
2303
-        FROM ' . prefixTable('categories_folders') . '
2303
+        FROM ' . prefixTable('categories_folders').'
2304 2304
         WHERE id_folder = %i',
2305 2305
         $source_id
2306 2306
     );
@@ -2311,7 +2311,7 @@  discard block
 block discarded – undo
2311 2311
     $target_cf = array();
2312 2312
     $rows = DB::QUERY(
2313 2313
         'SELECT id_category
2314
-        FROM ' . prefixTable('categories_folders') . '
2314
+        FROM ' . prefixTable('categories_folders').'
2315 2315
         WHERE id_folder = %i',
2316 2316
         $target_id
2317 2317
     );
@@ -2346,9 +2346,9 @@  discard block
 block discarded – undo
2346 2346
     $password = null
2347 2347
 ) {
2348 2348
     // Load AntiXSS
2349
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2350
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2351
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2349
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2350
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2351
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2352 2352
     $antiXss = new voku\helper\AntiXSS();
2353 2353
 
2354 2354
     // Protect against bad inputs
@@ -2362,7 +2362,7 @@  discard block
 block discarded – undo
2362 2362
 
2363 2363
     if (empty($password) === true || is_null($password) === true) {
2364 2364
         // get KEY to define password
2365
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2365
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2366 2366
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2367 2367
     }
2368 2368
 
@@ -2408,15 +2408,15 @@  discard block
 block discarded – undo
2408 2408
 ) {
2409 2409
     // load PhpEncryption library
2410 2410
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2411
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2412
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2413
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2414
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2415
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2416
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2417
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2418
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2419
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2411
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2412
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2413
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2414
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2415
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2416
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2417
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2418
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2419
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2420 2420
 
2421 2421
     try {
2422 2422
         \Defuse\Crypto\File::encryptFileWithPassword(
@@ -2454,15 +2454,15 @@  discard block
 block discarded – undo
2454 2454
 ) {
2455 2455
     // load PhpEncryption library
2456 2456
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2457
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2458
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2459
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2460
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2461
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2462
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2463
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2464
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2465
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2457
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2458
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2459
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2460
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2461
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2462
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2463
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2464
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2465
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2466 2466
 
2467 2467
     try {
2468 2468
         \Defuse\Crypto\File::decryptFileWithPassword(
@@ -2508,9 +2508,9 @@  discard block
 block discarded – undo
2508 2508
 function fileDelete($file, $SETTINGS)
2509 2509
 {
2510 2510
     // Load AntiXSS
2511
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2512
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2513
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2511
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2512
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2513
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2514 2514
     $antiXss = new voku\helper\AntiXSS();
2515 2515
 
2516 2516
     $file = $antiXss->xss_clean($file);
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
             continue;
2557 2557
         }
2558 2558
 
2559
-        $fullPath = $dir . '/' . $file;
2559
+        $fullPath = $dir.'/'.$file;
2560 2560
 
2561 2561
         if (is_dir($fullPath)) {
2562 2562
             if ($res = @chmod($fullPath, $dirPermissions)) {
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
  */
2587 2587
 function accessToItemIsGranted($item_id, $SETTINGS)
2588 2588
 {
2589
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2589
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2590 2590
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2591 2591
 
2592 2592
     // Prepare superGlobal variables
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
     // Load item data
2597 2597
     $data = DB::queryFirstRow(
2598 2598
         'SELECT id_tree
2599
-        FROM ' . prefixTable('items') . '
2599
+        FROM ' . prefixTable('items').'
2600 2600
         WHERE id = %i',
2601 2601
         $item_id
2602 2602
     );
@@ -2678,8 +2678,8 @@  discard block
 block discarded – undo
2678 2678
 function performDBQuery($SETTINGS, $fields, $table)
2679 2679
 {
2680 2680
     // include librairies & connect to DB
2681
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2682
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2681
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2682
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2683 2683
     if (defined('DB_PASSWD_CLEAR') === false) {
2684 2684
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2685 2685
     }
@@ -2692,7 +2692,7 @@  discard block
 block discarded – undo
2692 2692
 
2693 2693
     // Insert log in DB
2694 2694
     return DB::query(
2695
-        'SELECT ' . $fields . '
2695
+        'SELECT '.$fields.'
2696 2696
         FROM ' . prefixTable($table)
2697 2697
     );
2698 2698
 }
@@ -2707,15 +2707,15 @@  discard block
 block discarded – undo
2707 2707
 function formatSizeUnits($bytes)
2708 2708
 {
2709 2709
     if ($bytes >= 1073741824) {
2710
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2710
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2711 2711
     } elseif ($bytes >= 1048576) {
2712
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2712
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2713 2713
     } elseif ($bytes >= 1024) {
2714
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2714
+        $bytes = number_format($bytes / 1024, 2).' KB';
2715 2715
     } elseif ($bytes > 1) {
2716
-        $bytes = $bytes . ' bytes';
2716
+        $bytes = $bytes.' bytes';
2717 2717
     } elseif ($bytes == 1) {
2718
-        $bytes = $bytes . ' byte';
2718
+        $bytes = $bytes.' byte';
2719 2719
     } else {
2720 2720
         $bytes = '0 bytes';
2721 2721
     }
@@ -2895,7 +2895,7 @@  discard block
 block discarded – undo
2895 2895
     // Decrypt
2896 2896
     try {
2897 2897
         $ret = base64_encode($rsa->decrypt(base64_decode($key)));
2898
-    } catch(Exception $e) {
2898
+    } catch (Exception $e) {
2899 2899
         return $e;
2900 2900
     }
2901 2901
 
@@ -2937,16 +2937,16 @@  discard block
 block discarded – undo
2937 2937
 
2938 2938
     // Encrypt the file content
2939 2939
     $plaintext = file_get_contents(
2940
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2940
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2941 2941
     );
2942 2942
 
2943 2943
     $ciphertext = $cipher->encrypt($plaintext);
2944 2944
 
2945 2945
     // Save new file
2946 2946
     $hash = md5($plaintext);
2947
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2947
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2948 2948
     file_put_contents($fileOut, $ciphertext);
2949
-    unlink($fileInPath . '/' . $fileInName);
2949
+    unlink($fileInPath.'/'.$fileInName);
2950 2950
 
2951 2951
     return array(
2952 2952
         'fileHash' => base64_encode($hash),
@@ -2989,7 +2989,7 @@  discard block
 block discarded – undo
2989 2989
     $cipher->disablePadding();
2990 2990
 
2991 2991
     // Get file content
2992
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2992
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2993 2993
 
2994 2994
     // Decrypt file content and return
2995 2995
     return base64_encode($cipher->decrypt($ciphertext));
@@ -3045,8 +3045,8 @@  discard block
 block discarded – undo
3045 3045
     $SETTINGS
3046 3046
 ) {
3047 3047
     // include librairies & connect to DB
3048
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3049
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3048
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3049
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3050 3050
     if (defined('DB_PASSWD_CLEAR') === false) {
3051 3051
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3052 3052
     }
@@ -3065,7 +3065,7 @@  discard block
 block discarded – undo
3065 3065
     );
3066 3066
 
3067 3067
     // Superglobals
3068
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3068
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3069 3069
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
3070 3070
 
3071 3071
     // Prepare superGlobal variables
@@ -3092,8 +3092,8 @@  discard block
 block discarded – undo
3092 3092
         // Create sharekey for each user
3093 3093
         $users = DB::query(
3094 3094
             'SELECT id, public_key
3095
-            FROM ' . prefixTable('users') . '
3096
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
3095
+            FROM ' . prefixTable('users').'
3096
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
3097 3097
             AND public_key != ""'
3098 3098
         );
3099 3099
         foreach ($users as $user) {
@@ -3194,13 +3194,13 @@  discard block
 block discarded – undo
3194 3194
     ];
3195 3195
 
3196 3196
     // Load expected libraries
3197
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3198
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3199
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3200
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3201
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3202
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
3203
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3197
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3198
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3199
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3200
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3201
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3202
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
3203
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3204 3204
 
3205 3205
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3206 3206
     $ad->register();
@@ -3213,7 +3213,7 @@  discard block
 block discarded – undo
3213 3213
     } catch (\LdapRecord\Auth\BindException $e) {
3214 3214
         $error = $e->getDetailedError();
3215 3215
 
3216
-        echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage();
3216
+        echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage();
3217 3217
         return false;
3218 3218
     }
3219 3219
 
@@ -3224,7 +3224,7 @@  discard block
 block discarded – undo
3224 3224
     } catch (\LdapRecord\Auth\BindException $e) {
3225 3225
         $error = $e->getDetailedError();
3226 3226
         
3227
-        echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage();
3227
+        echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage();
3228 3228
         return false;
3229 3229
     }
3230 3230
 
@@ -3245,8 +3245,8 @@  discard block
 block discarded – undo
3245 3245
 function deleteUserObjetsKeys($userId, $SETTINGS)
3246 3246
 {
3247 3247
     // include librairies & connect to DB
3248
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3249
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3248
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3249
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3250 3250
     if (defined('DB_PASSWD_CLEAR') === false) {
3251 3251
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3252 3252
     }
@@ -3307,7 +3307,7 @@  discard block
 block discarded – undo
3307 3307
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3308 3308
             $now->setTimezone(new DateTimeZone($timezone));
3309 3309
             $offsets[] = $offset = $now->getOffset();
3310
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3310
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3311 3311
         }
3312 3312
 
3313 3313
         array_multisort($offsets, $timezones);
@@ -3319,7 +3319,7 @@  discard block
 block discarded – undo
3319 3319
 function format_GMT_offset($offset) {
3320 3320
     $hours = intval($offset / 3600);
3321 3321
     $minutes = abs(intval($offset % 3600 / 60));
3322
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3322
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3323 3323
 }
3324 3324
 
3325 3325
 function format_timezone_name($name) {
@@ -3345,7 +3345,7 @@  discard block
 block discarded – undo
3345 3345
 	}
3346 3346
 	
3347 3347
     $mfaRoles = array_values(json_decode($mfaRoles, true));
3348
-    $userRolesIds = array_filter(explode(';' , $userRolesIds));
3348
+    $userRolesIds = array_filter(explode(';', $userRolesIds));
3349 3349
 
3350 3350
     if (count($mfaRoles) === 0 || count($mfaRoles) === 0) {
3351 3351
         return true;
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 // DO CHECKS
46
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
47
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
47
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
48 48
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
49 49
 if (
50 50
     isset($post_type) === true
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     && checkUser($_SESSION['user_id'], $_SESSION['key'], 'home', $SETTINGS) === false
61 61
 ) {
62 62
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
63
-    include $SETTINGS['cpassman_dir'] . '/error.php';
63
+    include $SETTINGS['cpassman_dir'].'/error.php';
64 64
     exit();
65 65
 } elseif ((isset($_SESSION['user_id']) === true
66 66
         && isset($_SESSION['key'])) === true
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     mainQuery($SETTINGS);
72 72
 } else {
73 73
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
74
-    include $SETTINGS['cpassman_dir'] . '/error.php';
74
+    include $SETTINGS['cpassman_dir'].'/error.php';
75 75
     exit();
76 76
 }
77 77
 
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
         date_default_timezone_set('UTC');
103 103
     }
104 104
 
105
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
106
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
105
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
106
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
107 107
 
108 108
     // Includes
109
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
110
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
109
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
110
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
111 111
 
112 112
     // Connect to mysql server
113
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
113
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
114 114
     if (defined('DB_PASSWD_CLEAR') === false) {
115 115
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
116 116
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     DB::$encoding = DB_ENCODING;
123 123
 
124 124
     // User's language loading
125
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
125
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
126 126
 
127 127
     // Prepare post variables
128 128
     $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                     echo prepareExchangedData(
192 192
                         array(
193 193
                             'error' => true,
194
-                            'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('error_not_allowed_to') . '</div>',
194
+                            'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('error_not_allowed_to').'</div>',
195 195
                         ),
196 196
                         'encode'
197 197
                     );
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                 // check if expected security level is reached
202 202
                 $dataUser = DB::queryfirstrow(
203 203
                     'SELECT *
204
-                    FROM ' . prefixTable('users') . '
204
+                    FROM ' . prefixTable('users').'
205 205
                     WHERE id = %i',
206 206
                     $post_user_id
207 207
                 );
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
                 if (empty($dataUser['fonction_id']) === false) {
224 224
                     $data = DB::queryFirstRow(
225 225
                         'SELECT complexity
226
-                        FROM ' . prefixTable('roles_title') . '
227
-                        WHERE id IN (' . $dataUser['fonction_id'] . ')
226
+                        FROM ' . prefixTable('roles_title').'
227
+                        WHERE id IN (' . $dataUser['fonction_id'].')
228 228
                         ORDER BY complexity DESC'
229 229
                     );
230 230
                 } else {
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
                     echo prepareExchangedData(
238 238
                         array(
239 239
                             'error' => true,
240
-                            'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('complexity_level_not_reached') . '.<br>' .
241
-                                langHdl('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
240
+                            'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('complexity_level_not_reached').'.<br>'.
241
+                                langHdl('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
242 242
                         ),
243 243
                         'encode'
244 244
                     );
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
                 // Get data about user
440 440
                 $data = DB::queryfirstrow(
441 441
                     'SELECT id, email, pw
442
-                    FROM ' . prefixTable('users') . '
442
+                    FROM ' . prefixTable('users').'
443 443
                     WHERE login = %s',
444 444
                     $post_login
445 445
                 );
446 446
             } else {
447 447
                 $data = DB::queryfirstrow(
448 448
                     'SELECT id, login, email, pw
449
-                    FROM ' . prefixTable('users') . '
449
+                    FROM ' . prefixTable('users').'
450 450
                     WHERE id = %i',
451 451
                     $post_id
452 452
                 );
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             $counter = DB::count();
458 458
 
459 459
             // load passwordLib library
460
-            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
460
+            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
461 461
             $pwdlib->register();
462 462
             $pwdlib = new PasswordLib\PasswordLib();
463 463
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
                     );
504 504
                 } else {
505 505
                     // generate new GA user code
506
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
506
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
507 507
                     $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
508 508
                     $gaSecretKey = $tfa->createSecret();
509 509
                     $gaTemporaryCode = GenerateCryptKey(12, false, true, true, false, true, $SETTINGS);
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
                                 'email' => $data['email'],
599 599
                                 'email_result' => str_replace(
600 600
                                     '#email#',
601
-                                    '<b>' . obfuscateEmail($data['email']) . '</b>',
601
+                                    '<b>'.obfuscateEmail($data['email']).'</b>',
602 602
                                     addslashes(langHdl('admin_email_result_ok'))
603 603
                                 ),
604 604
                             ),
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                                 'email' => $data['email'],
614 614
                                 'email_result' => str_replace(
615 615
                                     '#email#',
616
-                                    '<b>' . obfuscateEmail($data['email']) . '</b>',
616
+                                    '<b>'.obfuscateEmail($data['email']).'</b>',
617 617
                                     addslashes(langHdl('admin_email_result_ok'))
618 618
                                 ),
619 619
                             ),
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
                     $_SESSION['user_id']
642 642
                 );
643 643
                 // Return data
644
-                echo '[{"new_value":"' . $_SESSION['sessionDuration'] . '"}]';
644
+                echo '[{"new_value":"'.$_SESSION['sessionDuration'].'"}]';
645 645
             } else {
646 646
                 echo '[{"new_value":"expired"}]';
647 647
             }
@@ -666,26 +666,26 @@  discard block
 block discarded – undo
666 666
             // Get account and pw associated to email
667 667
             DB::query(
668 668
                 'SELECT *
669
-                FROM ' . prefixTable('users') . '
669
+                FROM ' . prefixTable('users').'
670 670
                 WHERE login = %s',
671 671
                 $post_login
672 672
             );
673 673
             $counter = DB::count();
674 674
             if ($counter != 0) {
675 675
                 $data = DB::queryFirstRow(
676
-                    'SELECT login, pw, email FROM ' . prefixTable('users') . ' WHERE login = %s',
676
+                    'SELECT login, pw, email FROM '.prefixTable('users').' WHERE login = %s',
677 677
                     $post_login
678 678
                 );
679
-                $textMail = langHdl('forgot_pw_email_body_1') . ' <a href="' .
680
-                    $SETTINGS['cpassman_url'] . '/index.php?action=password_recovery&key=' . $key .
681
-                    '&login=' . $post_login . '">' . $SETTINGS['cpassman_url'] .
682
-                    '/index.php?action=password_recovery&key=' . $key . '&login=' . $post_login . '</a>.<br><br>' . langHdl('thku');
683
-                $textMailAlt = langHdl('forgot_pw_email_altbody_1') . ' ' . langHdl('at_login') . ' : ' . $post_login . ' - ' .
684
-                    langHdl('index_password') . ' : ' . md5($data['pw']);
679
+                $textMail = langHdl('forgot_pw_email_body_1').' <a href="'.
680
+                    $SETTINGS['cpassman_url'].'/index.php?action=password_recovery&key='.$key.
681
+                    '&login='.$post_login.'">'.$SETTINGS['cpassman_url'].
682
+                    '/index.php?action=password_recovery&key='.$key.'&login='.$post_login.'</a>.<br><br>'.langHdl('thku');
683
+                $textMailAlt = langHdl('forgot_pw_email_altbody_1').' '.langHdl('at_login').' : '.$post_login.' - '.
684
+                    langHdl('index_password').' : '.md5($data['pw']);
685 685
 
686 686
                 // Check if email has already a key in DB
687 687
                 DB::query(
688
-                    'SELECT * FROM ' . prefixTable('misc') . ' WHERE intitule = %s AND type = %s',
688
+                    'SELECT * FROM '.prefixTable('misc').' WHERE intitule = %s AND type = %s',
689 689
                     $post_login,
690 690
                     'password_recovery'
691 691
                 );
@@ -723,10 +723,10 @@  discard block
 block discarded – undo
723 723
                     true
724 724
                 );
725 725
 
726
-                echo '[{"error":"' . $ret['error'] . '" , "message":"' . $ret['message'] . '"}]';
726
+                echo '[{"error":"'.$ret['error'].'" , "message":"'.$ret['message'].'"}]';
727 727
             } else {
728 728
                 // no one has this email ... alert
729
-                echo '[{"error":"error_email" , "message":"' . langHdl('forgot_my_pw_error_email_not_exist') . '"}]';
729
+                echo '[{"error":"error_email" , "message":"'.langHdl('forgot_my_pw_error_email_not_exist').'"}]';
730 730
             }
731 731
             break;
732 732
 
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
             // check if key is okay
746 746
             $data = DB::queryFirstRow(
747 747
                 'SELECT valeur
748
-                FROM ' . prefixTable('misc') . '
748
+                FROM ' . prefixTable('misc').'
749 749
                 WHERE intitule = %s AND type = %s',
750 750
                 $login,
751 751
                 'password_recovery'
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
                 );
782 782
                 // Get email
783 783
                 $dataUser = DB::queryFirstRow(
784
-                    'SELECT email FROM ' . prefixTable('users') . ' WHERE login = %s',
784
+                    'SELECT email FROM '.prefixTable('users').' WHERE login = %s',
785 785
                     $login
786 786
                 );
787 787
 
@@ -790,10 +790,10 @@  discard block
 block discarded – undo
790 790
                 $ret = json_decode(
791 791
                     sendEmail(
792 792
                         langHdl('forgot_pw_email_subject_confirm'),
793
-                        langHdl('forgot_pw_email_body') . ' ' . $newPwNotCrypted,
793
+                        langHdl('forgot_pw_email_body').' '.$newPwNotCrypted,
794 794
                         $dataUser['email'],
795 795
                         $SETTINGS,
796
-                        strip_tags(langHdl('forgot_pw_email_body')) . ' ' . $newPwNotCrypted
796
+                        strip_tags(langHdl('forgot_pw_email_body')).' '.$newPwNotCrypted
797 797
                     ),
798 798
                     true
799 799
                 );
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
                     // Store PSK
903 903
                     $_SESSION['user']['session_psk'] = $user_key_encoded;
904 904
                     setcookie(
905
-                        'TeamPass_PFSK_' . md5($_SESSION['user_id']),
905
+                        'TeamPass_PFSK_'.md5($_SESSION['user_id']),
906 906
                         $user_key_encoded,
907 907
                         (!isset($SETTINGS['personal_saltkey_cookie_duration']) || $SETTINGS['personal_saltkey_cookie_duration'] == 0) ? time() + 60 * 60 * 24 : time() + 60 * 60 * 24 * $SETTINGS['personal_saltkey_cookie_duration'],
908 908
                         '/'
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
             // Get key from user
951 951
             $userInfo = DB::queryfirstrow(
952 952
                 'SELECT encrypted_psk
953
-                FROM ' . prefixTable('users') . '
953
+                FROM ' . prefixTable('users').'
954 954
                 WHERE id = %i',
955 955
                 $_SESSION['user_id']
956 956
             );
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
             // Build list of items to be re-encrypted
1046 1046
             $rows = DB::query(
1047 1047
                 'SELECT i.id as id, i.pw as pw
1048
-                FROM ' . prefixTable('items') . ' as i
1049
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1048
+                FROM ' . prefixTable('items').' as i
1049
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1050 1050
                 WHERE i.perso = %i AND l.id_user= %i AND l.action = %s',
1051 1051
                 '1',
1052 1052
                 $_SESSION['user_id'],
@@ -1058,14 +1058,14 @@  discard block
 block discarded – undo
1058 1058
                     if (empty($list)) {
1059 1059
                         $list = $record['id'];
1060 1060
                     } else {
1061
-                        $list .= ',' . $record['id'];
1061
+                        $list .= ','.$record['id'];
1062 1062
                     }
1063 1063
                 }
1064 1064
             }
1065 1065
 
1066 1066
             // change salt
1067 1067
             setcookie(
1068
-                'TeamPass_PFSK_' . md5($_SESSION['user_id']),
1068
+                'TeamPass_PFSK_'.md5($_SESSION['user_id']),
1069 1069
                 $_SESSION['user']['session_psk'],
1070 1070
                 time() + 60 * 60 * 24 * $SETTINGS['personal_saltkey_cookie_duration'],
1071 1071
                 '/'
@@ -1112,8 +1112,8 @@  discard block
 block discarded – undo
1112 1112
                     // delete all previous items of this user
1113 1113
                     $rows = DB::query(
1114 1114
                         'SELECT i.id as id
1115
-                        FROM ' . prefixTable('items') . ' as i
1116
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1115
+                        FROM ' . prefixTable('items').' as i
1116
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1117 1117
                         WHERE i.perso = %i AND l.id_user= %i AND l.action = %s',
1118 1118
                         '1',
1119 1119
                         $_SESSION['user_id'],
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 
1159 1159
                     // change salt
1160 1160
                     setcookie(
1161
-                        'TeamPass_PFSK_' . md5($_SESSION['user_id']),
1161
+                        'TeamPass_PFSK_'.md5($_SESSION['user_id']),
1162 1162
                         $_SESSION['user']['session_psk'],
1163 1163
                         time() + 60 * 60 * 24 * $SETTINGS['personal_saltkey_cookie_duration'],
1164 1164
                         '/'
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
                 && $SETTINGS['enable_send_email_on_user_login'] === '1'
1212 1212
             ) {
1213 1213
                 $row = DB::queryFirstRow(
1214
-                    'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1214
+                    'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1215 1215
                     'cron',
1216 1216
                     'sending_emails'
1217 1217
                 );
@@ -1219,12 +1219,12 @@  discard block
 block discarded – undo
1219 1219
                 if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1220 1220
                     $rows = DB::query(
1221 1221
                         'SELECT *
1222
-                        FROM ' . prefixTable('emails') .
1222
+                        FROM ' . prefixTable('emails').
1223 1223
                             ' WHERE status != %s',
1224 1224
                         'sent'
1225 1225
                     );
1226 1226
                     foreach ($rows as $record) {
1227
-                        echo $record['increment_id'] . " >> ";
1227
+                        echo $record['increment_id']." >> ";
1228 1228
                         // Send email
1229 1229
                         $ret = json_decode(
1230 1230
                             sendEmail(
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
          */
1343 1343
         case 'check_login_exists':
1344 1344
             $data = DB::query(
1345
-                'SELECT login, psk FROM ' . prefixTable('users') . '
1345
+                'SELECT login, psk FROM '.prefixTable('users').'
1346 1346
                 WHERE login = %i',
1347 1347
                 stripslashes(filter_input(INPUT_POST, 'userId', FILTER_SANITIZE_NUMBER_INT))
1348 1348
             );
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
                 $userOk = true;
1353 1353
             }
1354 1354
 
1355
-            echo '[{"login" : "' . $userOk . '", "psk":"0"}]';
1355
+            echo '[{"login" : "'.$userOk.'", "psk":"0"}]';
1356 1356
             break;
1357 1357
             /*
1358 1358
          * Make statistics on item
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
                 && filter_input(INPUT_POST, 'scope', FILTER_SANITIZE_STRING) === 'item'
1364 1364
             ) {
1365 1365
                 $data = DB::queryfirstrow(
1366
-                    'SELECT view FROM ' . prefixTable('statistics') . ' WHERE scope = %s AND item_id = %i',
1366
+                    'SELECT view FROM '.prefixTable('statistics').' WHERE scope = %s AND item_id = %i',
1367 1367
                     'item',
1368 1368
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
1369 1369
                 );
@@ -1404,8 +1404,8 @@  discard block
 block discarded – undo
1404 1404
             $arr_html = array();
1405 1405
             $rows = DB::query(
1406 1406
                 'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
1407
-                FROM ' . prefixTable('log_items') . ' AS l
1408
-                RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1407
+                FROM ' . prefixTable('log_items').' AS l
1408
+                RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1409 1409
                 WHERE l.action = %s AND l.id_user = %i
1410 1410
                 ORDER BY l.date DESC
1411 1411
                 LIMIT 0, 100',
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
                 isset($SETTINGS['enable_suggestion']) && $SETTINGS['enable_suggestion'] == 1
1439 1439
                 && ($_SESSION['user_admin'] == 1 || $_SESSION['user_manager'] == 1)
1440 1440
             ) {
1441
-                DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1441
+                DB::query('SELECT * FROM '.prefixTable('suggestion'));
1442 1442
                 $nb_suggestions_waiting = DB::count();
1443 1443
             }
1444 1444
 
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
             $pwdlib = new PasswordLib\PasswordLib();
1463 1463
             // generate key
1464 1464
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
1465
-            echo '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
1465
+            echo '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
1466 1466
             break;
1467 1467
 
1468 1468
             /*
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
                 )
1492 1492
             );
1493 1493
 
1494
-            echo '[{"token" : "' . $token . '"}]';
1494
+            echo '[{"token" : "'.$token.'"}]';
1495 1495
             break;
1496 1496
 
1497 1497
 
@@ -1506,14 +1506,14 @@  discard block
 block discarded – undo
1506 1506
 
1507 1507
             if ($_SESSION['user_manager'] === '1' || $_SESSION['is_admin'] === '1') {
1508 1508
                 $count = 0;
1509
-                DB::query('SELECT * FROM ' . prefixTable('items_change'));
1509
+                DB::query('SELECT * FROM '.prefixTable('items_change'));
1510 1510
                 $count += DB::count();
1511
-                DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1511
+                DB::query('SELECT * FROM '.prefixTable('suggestion'));
1512 1512
                 $count += DB::count();
1513 1513
 
1514
-                echo '[ { "error" : "" , "count" : "' . $count . '" , "show_sug_in_menu" : "0"} ]';
1514
+                echo '[ { "error" : "" , "count" : "'.$count.'" , "show_sug_in_menu" : "0"} ]';
1515 1515
             } elseif (isset($_SESSION['nb_item_change_proposals']) && $_SESSION['nb_item_change_proposals'] > 0) {
1516
-                echo '[ { "error" : "" , "count" : "' . $_SESSION['nb_item_change_proposals'] . '" , "show_sug_in_menu" : "1"} ]';
1516
+                echo '[ { "error" : "" , "count" : "'.$_SESSION['nb_item_change_proposals'].'" , "show_sug_in_menu" : "1"} ]';
1517 1517
             } else {
1518 1518
                 echo '[ { "error" : "" , "count" : "" , "show_sug_in_menu" : "0"} ]';
1519 1519
             }
@@ -1548,9 +1548,9 @@  discard block
 block discarded – undo
1548 1548
                         $tmp = '';
1549 1549
                         foreach ($stats_data[$data] as $key => $value) {
1550 1550
                             if (empty($tmp)) {
1551
-                                $tmp = $key . '-' . $value;
1551
+                                $tmp = $key.'-'.$value;
1552 1552
                             } else {
1553
-                                $tmp .= ',' . $key . '-' . $value;
1553
+                                $tmp .= ','.$key.'-'.$value;
1554 1554
                             }
1555 1555
                         }
1556 1556
                         $statsToSend[$data] = $tmp;
@@ -1558,9 +1558,9 @@  discard block
 block discarded – undo
1558 1558
                         $tmp = '';
1559 1559
                         foreach ($stats_data[$data] as $key => $value) {
1560 1560
                             if (empty($tmp)) {
1561
-                                $tmp = $key . '-' . $value;
1561
+                                $tmp = $key.'-'.$value;
1562 1562
                             } else {
1563
-                                $tmp .= ',' . $key . '-' . $value;
1563
+                                $tmp .= ','.$key.'-'.$value;
1564 1564
                             }
1565 1565
                         }
1566 1566
                         $statsToSend[$data] = $tmp;
@@ -1657,8 +1657,8 @@  discard block
 block discarded – undo
1657 1657
                     if (strpos($line, 'cpassman_url') > 0 && empty($url_found) === true) {
1658 1658
                         $url_found = substr($line, 19, strlen($line) - 22);
1659 1659
                         $tmp = parse_url($url_found);
1660
-                        $anonym_url = $tmp['scheme'] . '://<anonym_url>' . $tmp['path'];
1661
-                        $line = "'cpassman_url' => '" . $anonym_url . "\n";
1660
+                        $anonym_url = $tmp['scheme'].'://<anonym_url>'.$tmp['path'];
1661
+                        $line = "'cpassman_url' => '".$anonym_url."\n";
1662 1662
                     }
1663 1663
 
1664 1664
                     // Anonymize all urls
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
             $teampass_errors = '';
1687 1687
             $rows = DB::query(
1688 1688
                 'SELECT label, date AS error_date
1689
-                FROM ' . prefixTable('log_system') . "
1689
+                FROM ' . prefixTable('log_system')."
1690 1690
                 WHERE `type` LIKE 'error'
1691 1691
                 ORDER BY `date` DESC
1692 1692
                 LIMIT 0, 10"
@@ -1694,10 +1694,10 @@  discard block
 block discarded – undo
1694 1694
             if (DB::count() > 0) {
1695 1695
                 foreach ($rows as $record) {
1696 1696
                     if (empty($teampass_errors) === true) {
1697
-                        $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['error_date']) . ' - ' . $record['label'];
1697
+                        $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['error_date']).' - '.$record['label'];
1698 1698
                     } else {
1699 1699
                         $teampass_errors .= '
1700
- * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['error_date']) . ' - ' . $record['label'];
1700
+ * ' . date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['error_date']).' - '.$record['label'];
1701 1701
                     }
1702 1702
                 }
1703 1703
             }
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
 
1707 1707
             // Now prepare text
1708 1708
             $txt = '### Page on which it happened
1709
-' . $post_data['current_page'] . '
1709
+' . $post_data['current_page'].'
1710 1710
 
1711 1711
 ### Steps to reproduce
1712 1712
 1.
@@ -1721,39 +1721,39 @@  discard block
 block discarded – undo
1721 1721
 Tell us what happens instead
1722 1722
 
1723 1723
 ### Server configuration
1724
-**Operating system**: ' . php_uname() . '
1724
+**Operating system**: ' . php_uname().'
1725 1725
 
1726
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1726
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1727 1727
 
1728
-**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)) . '
1728
+**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)).'
1729 1729
 
1730
-**PHP version:** ' . PHP_VERSION . '
1730
+**PHP version:** ' . PHP_VERSION.'
1731 1731
 
1732
-**Teampass version:** ' . TP_VERSION_FULL . '
1732
+**Teampass version:** ' . TP_VERSION_FULL.'
1733 1733
 
1734 1734
 **Teampass configuration file:**
1735 1735
 ```
1736
-' . $list_of_options . '
1736
+' . $list_of_options.'
1737 1737
 ```
1738 1738
 
1739 1739
 **Updated from an older Teampass or fresh install:**
1740 1740
 
1741 1741
 ### Client configuration
1742 1742
 
1743
-**Browser:** ' . $post_data['browser_name'] . ' - ' . $post_data['browser_version'] . '
1743
+**Browser:** ' . $post_data['browser_name'].' - '.$post_data['browser_version'].'
1744 1744
 
1745
-**Operating system:** ' . $post_data['os'] . ' - ' . $post_data['os_archi'] . 'bits
1745
+**Operating system:** ' . $post_data['os'].' - '.$post_data['os_archi'].'bits
1746 1746
 
1747 1747
 ### Logs
1748 1748
 
1749 1749
 #### Web server error log
1750 1750
 ```
1751
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1751
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1752 1752
 ```
1753 1753
 
1754 1754
 #### Teampass 10 last system errors
1755 1755
 ```
1756
-' . $teampass_errors . '
1756
+' . $teampass_errors.'
1757 1757
 ```
1758 1758
 
1759 1759
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
                 // Check if user exists
1859 1859
                 $userInfo = DB::queryFirstRow(
1860 1860
                     'SELECT public_key, private_key, pw
1861
-                    FROM ' . prefixTable('users') . '
1861
+                    FROM ' . prefixTable('users').'
1862 1862
                     WHERE id = %i',
1863 1863
                     $post_user_id
1864 1864
                 );
@@ -1866,14 +1866,14 @@  discard block
 block discarded – undo
1866 1866
                     // Get one item
1867 1867
                     $record = DB::queryFirstRow(
1868 1868
                         'SELECT id, pw
1869
-                        FROM ' . prefixTable('items') . '
1869
+                        FROM ' . prefixTable('items').'
1870 1870
                         WHERE perso = 0'
1871 1871
                     );
1872 1872
 
1873 1873
                     // Get itemKey from current user
1874 1874
                     $currentUserKey = DB::queryFirstRow(
1875 1875
                         'SELECT share_key, increment_id
1876
-                        FROM ' . prefixTable('sharekeys_items') . '
1876
+                        FROM ' . prefixTable('sharekeys_items').'
1877 1877
                         WHERE object_id = %i AND user_id = %i',
1878 1878
                         $record['id'],
1879 1879
                         $post_user_id
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
                     } else {
1903 1903
                         // Use the password check
1904 1904
                         // load passwordLib library
1905
-                        $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1905
+                        $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1906 1906
                         $pwdlib->register();
1907 1907
                         $pwdlib = new PasswordLib\PasswordLib();
1908 1908
                         
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
                 // Get user info
2084 2084
                 $userData = DB::queryFirstRow(
2085 2085
                     'SELECT private_key
2086
-                    FROM ' . prefixTable('users') . '
2086
+                    FROM ' . prefixTable('users').'
2087 2087
                     WHERE id = %i',
2088 2088
                     $post_user_id
2089 2089
                 );
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
                     );
2105 2105
 
2106 2106
                     // Load superGlobals
2107
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2107
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2108 2108
                     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2109 2109
 
2110 2110
                     $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
                 // Get user info
2167 2167
                 $userData = DB::queryFirstRow(
2168 2168
                     'SELECT email, auth_type, login
2169
-                    FROM ' . prefixTable('users') . '
2169
+                    FROM ' . prefixTable('users').'
2170 2170
                     WHERE id = %i',
2171 2171
                     $post_user_id
2172 2172
                 );
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
                     // Get user info
2371 2371
                     $userData = DB::queryFirstRow(
2372 2372
                         'SELECT email, auth_type, login
2373
-                        FROM ' . prefixTable('users') . '
2373
+                        FROM ' . prefixTable('users').'
2374 2374
                         WHERE id = %i',
2375 2375
                         $post_user_id
2376 2376
                     );
@@ -2439,13 +2439,13 @@  discard block
 block discarded – undo
2439 2439
                 // Check if user exists
2440 2440
                 DB::queryFirstRow(
2441 2441
                     'SELECT *
2442
-                    FROM ' . prefixTable('users') . '
2442
+                    FROM ' . prefixTable('users').'
2443 2443
                     WHERE id = %i',
2444 2444
                     $post_user_id
2445 2445
                 );
2446 2446
                 if (DB::count() > 0) {
2447 2447
                     // Include libraries
2448
-                    include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
2448
+                    include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
2449 2449
 
2450 2450
                     // CLear old sharekeys
2451 2451
                     if ($post_self_change === false) {
@@ -2514,13 +2514,13 @@  discard block
 block discarded – undo
2514 2514
                 // Check if user exists
2515 2515
                 $userInfo = DB::queryFirstRow(
2516 2516
                     'SELECT public_key
2517
-                    FROM ' . prefixTable('users') . '
2517
+                    FROM ' . prefixTable('users').'
2518 2518
                     WHERE id = %i',
2519 2519
                     $post_user_id
2520 2520
                 );
2521 2521
                 if (DB::count() > 0) {
2522 2522
                     // Include libraries
2523
-                    include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
2523
+                    include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
2524 2524
 
2525 2525
                     // WHAT STEP TO PERFORM?
2526 2526
                     if ($post_action === 'step0') {
@@ -2536,15 +2536,15 @@  discard block
 block discarded – undo
2536 2536
                         // Loop on items
2537 2537
                         $rows = DB::query(
2538 2538
                             'SELECT id, pw
2539
-                            FROM ' . prefixTable('items') . '
2539
+                            FROM ' . prefixTable('items').'
2540 2540
                             WHERE perso = 0
2541
-                            LIMIT ' . $post_start . ', ' . $post_length
2541
+                            LIMIT ' . $post_start.', '.$post_length
2542 2542
                         );
2543 2543
                         foreach ($rows as $record) {
2544 2544
                             // Get itemKey from current user
2545 2545
                             $currentUserKey = DB::queryFirstRow(
2546 2546
                                 'SELECT share_key, increment_id
2547
-                                FROM ' . prefixTable('sharekeys_items') . '
2547
+                                FROM ' . prefixTable('sharekeys_items').'
2548 2548
                                 WHERE object_id = %i AND user_id = %i',
2549 2549
                                 $record['id'],
2550 2550
                                 $_SESSION['user_id']
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
                                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2572 2572
                                     $currentUserKey = DB::queryFirstRow(
2573 2573
                                         'SELECT increment_id
2574
-                                        FROM ' . prefixTable('sharekeys_items') . '
2574
+                                        FROM ' . prefixTable('sharekeys_items').'
2575 2575
                                         WHERE object_id = %i AND user_id = %i',
2576 2576
                                         $record['id'],
2577 2577
                                         $post_user_id
@@ -2604,7 +2604,7 @@  discard block
 block discarded – undo
2604 2604
                         // SHould we change step?
2605 2605
                         DB::query(
2606 2606
                             'SELECT *
2607
-                            FROM ' . prefixTable('items') . '
2607
+                            FROM ' . prefixTable('items').'
2608 2608
                             WHERE perso = 0'
2609 2609
                         );
2610 2610
                         $next_start = (int) $post_start + (int) $post_length;
@@ -2620,15 +2620,15 @@  discard block
 block discarded – undo
2620 2620
                         // Loop on logs
2621 2621
                         $rows = DB::query(
2622 2622
                             'SELECT increment_id
2623
-                            FROM ' . prefixTable('log_items') . '
2623
+                            FROM ' . prefixTable('log_items').'
2624 2624
                             WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2625
-                            LIMIT ' . $post_start . ', ' . $post_length
2625
+                            LIMIT ' . $post_start.', '.$post_length
2626 2626
                         );
2627 2627
                         foreach ($rows as $record) {
2628 2628
                             // Get itemKey from current user
2629 2629
                             $currentUserKey = DB::queryFirstRow(
2630 2630
                                 'SELECT share_key
2631
-                                FROM ' . prefixTable('sharekeys_logs') . '
2631
+                                FROM ' . prefixTable('sharekeys_logs').'
2632 2632
                                 WHERE object_id = %i AND user_id = %i',
2633 2633
                                 $record['increment_id'],
2634 2634
                                 $_SESSION['user_id']
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
                                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2656 2656
                                     $currentUserKey = DB::queryFirstRow(
2657 2657
                                         'SELECT increment_id
2658
-                                        FROM ' . prefixTable('sharekeys_items') . '
2658
+                                        FROM ' . prefixTable('sharekeys_items').'
2659 2659
                                         WHERE object_id = %i AND user_id = %i',
2660 2660
                                         $record['id'],
2661 2661
                                         $post_user_id
@@ -2677,7 +2677,7 @@  discard block
 block discarded – undo
2677 2677
                         // SHould we change step?
2678 2678
                         DB::query(
2679 2679
                             'SELECT increment_id
2680
-                            FROM ' . prefixTable('log_items') . '
2680
+                            FROM ' . prefixTable('log_items').'
2681 2681
                             WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2682 2682
                         );
2683 2683
                         $next_start = (int) $post_start + (int) $post_length;
@@ -2693,15 +2693,15 @@  discard block
 block discarded – undo
2693 2693
                         // Loop on fields
2694 2694
                         $rows = DB::query(
2695 2695
                             'SELECT id
2696
-                            FROM ' . prefixTable('categories_items') . '
2696
+                            FROM ' . prefixTable('categories_items').'
2697 2697
                             WHERE encryption_type = "teampass_aes"
2698
-                            LIMIT ' . $post_start . ', ' . $post_length
2698
+                            LIMIT ' . $post_start.', '.$post_length
2699 2699
                         );
2700 2700
                         foreach ($rows as $record) {
2701 2701
                             // Get itemKey from current user
2702 2702
                             $currentUserKey = DB::queryFirstRow(
2703 2703
                                 'SELECT share_key
2704
-                                FROM ' . prefixTable('sharekeys_fields') . '
2704
+                                FROM ' . prefixTable('sharekeys_fields').'
2705 2705
                                 WHERE object_id = %i AND user_id = %i',
2706 2706
                                 $record['id'],
2707 2707
                                 $_SESSION['user_id']
@@ -2728,7 +2728,7 @@  discard block
 block discarded – undo
2728 2728
                                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2729 2729
                                     $currentUserKey = DB::queryFirstRow(
2730 2730
                                         'SELECT increment_id
2731
-                                        FROM ' . prefixTable('sharekeys_items') . '
2731
+                                        FROM ' . prefixTable('sharekeys_items').'
2732 2732
                                         WHERE object_id = %i AND user_id = %i',
2733 2733
                                         $record['id'],
2734 2734
                                         $post_user_id
@@ -2750,7 +2750,7 @@  discard block
 block discarded – undo
2750 2750
                         // SHould we change step?
2751 2751
                         DB::query(
2752 2752
                             'SELECT *
2753
-                            FROM ' . prefixTable('categories_items') . '
2753
+                            FROM ' . prefixTable('categories_items').'
2754 2754
                             WHERE encryption_type = "teampass_aes"'
2755 2755
                         );
2756 2756
                         $next_start = (int) $post_start + (int) $post_length;
@@ -2766,14 +2766,14 @@  discard block
 block discarded – undo
2766 2766
                         // Loop on suggestions
2767 2767
                         $rows = DB::query(
2768 2768
                             'SELECT id
2769
-                            FROM ' . prefixTable('suggestion') . '
2770
-                            LIMIT ' . $post_start . ', ' . $post_length
2769
+                            FROM ' . prefixTable('suggestion').'
2770
+                            LIMIT ' . $post_start.', '.$post_length
2771 2771
                         );
2772 2772
                         foreach ($rows as $record) {
2773 2773
                             // Get itemKey from current user
2774 2774
                             $currentUserKey = DB::queryFirstRow(
2775 2775
                                 'SELECT share_key
2776
-                                FROM ' . prefixTable('sharekeys_suggestions') . '
2776
+                                FROM ' . prefixTable('sharekeys_suggestions').'
2777 2777
                                 WHERE object_id = %i AND user_id = %i',
2778 2778
                                 $record['id'],
2779 2779
                                 $_SESSION['user_id']
@@ -2800,7 +2800,7 @@  discard block
 block discarded – undo
2800 2800
                                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2801 2801
                                     $currentUserKey = DB::queryFirstRow(
2802 2802
                                         'SELECT increment_id
2803
-                                        FROM ' . prefixTable('sharekeys_items') . '
2803
+                                        FROM ' . prefixTable('sharekeys_items').'
2804 2804
                                         WHERE object_id = %i AND user_id = %i',
2805 2805
                                         $record['id'],
2806 2806
                                         $post_user_id
@@ -2837,15 +2837,15 @@  discard block
 block discarded – undo
2837 2837
                         // Loop on files
2838 2838
                         $rows = DB::query(
2839 2839
                             'SELECT id
2840
-                            FROM ' . prefixTable('files') . '
2841
-                            WHERE status = "' . TP_ENCRYPTION_NAME . '"
2842
-                            LIMIT ' . $post_start . ', ' . $post_length
2840
+                            FROM ' . prefixTable('files').'
2841
+                            WHERE status = "' . TP_ENCRYPTION_NAME.'"
2842
+                            LIMIT ' . $post_start.', '.$post_length
2843 2843
                         ); //aes_encryption
2844 2844
                         foreach ($rows as $record) {
2845 2845
                             // Get itemKey from current user
2846 2846
                             $currentUserKey = DB::queryFirstRow(
2847 2847
                                 'SELECT share_key
2848
-                                FROM ' . prefixTable('sharekeys_files') . '
2848
+                                FROM ' . prefixTable('sharekeys_files').'
2849 2849
                                 WHERE object_id = %i AND user_id = %i',
2850 2850
                                 $record['id'],
2851 2851
                                 $_SESSION['user_id']
@@ -2872,7 +2872,7 @@  discard block
 block discarded – undo
2872 2872
                                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2873 2873
                                     $currentUserKey = DB::queryFirstRow(
2874 2874
                                         'SELECT increment_id
2875
-                                        FROM ' . prefixTable('sharekeys_items') . '
2875
+                                        FROM ' . prefixTable('sharekeys_items').'
2876 2876
                                         WHERE object_id = %i AND user_id = %i',
2877 2877
                                         $record['id'],
2878 2878
                                         $post_user_id
@@ -2894,8 +2894,8 @@  discard block
 block discarded – undo
2894 2894
                         // SHould we change step?
2895 2895
                         DB::query(
2896 2896
                             'SELECT *
2897
-                            FROM ' . prefixTable('files') . '
2898
-                            WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2897
+                            FROM ' . prefixTable('files').'
2898
+                            WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2899 2899
                         );
2900 2900
                         $next_start = (int) $post_start + (int) $post_length;
2901 2901
                         if ($next_start > DB::count()) {
@@ -2915,16 +2915,16 @@  discard block
 block discarded – undo
2915 2915
                             if (count($_SESSION['personal_folders']) > 0) {
2916 2916
                                 $rows = DB::query(
2917 2917
                                     'SELECT id, pw
2918
-                                    FROM ' . prefixTable('items') . '
2918
+                                    FROM ' . prefixTable('items').'
2919 2919
                                     WHERE perso = 1 AND id_tree IN %ls
2920
-                                    LIMIT ' . $post_start . ', ' . $post_length,
2920
+                                    LIMIT ' . $post_start.', '.$post_length,
2921 2921
                                     $_SESSION['personal_folders']
2922 2922
                                 );
2923 2923
                                 foreach ($rows as $record) {
2924 2924
                                     // Get itemKey from current user
2925 2925
                                     $currentUserKey = DB::queryFirstRow(
2926 2926
                                         'SELECT share_key, increment_id
2927
-                                        FROM ' . prefixTable('sharekeys_items') . '
2927
+                                        FROM ' . prefixTable('sharekeys_items').'
2928 2928
                                         WHERE object_id = %i AND user_id = %i',
2929 2929
                                         $record['id'],
2930 2930
                                         $_SESSION['user_id']
@@ -2951,7 +2951,7 @@  discard block
 block discarded – undo
2951 2951
                                         if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2952 2952
                                             $currentUserKey = DB::queryFirstRow(
2953 2953
                                                 'SELECT increment_id
2954
-                                                FROM ' . prefixTable('sharekeys_items') . '
2954
+                                                FROM ' . prefixTable('sharekeys_items').'
2955 2955
                                                 WHERE object_id = %i AND user_id = %i',
2956 2956
                                                 $record['id'],
2957 2957
                                                 $post_user_id
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
                             // SHould we change step?
2975 2975
                             DB::query(
2976 2976
                                 'SELECT *
2977
-                                FROM ' . prefixTable('items') . '
2977
+                                FROM ' . prefixTable('items').'
2978 2978
                                 WHERE perso = 0'
2979 2979
                             );
2980 2980
                             $next_start = (int) $post_start + (int) $post_length;
@@ -3061,7 +3061,7 @@  discard block
 block discarded – undo
3061 3061
                 // Check if user exists
3062 3062
                 $userInfo = DB::queryFirstRow(
3063 3063
                     'SELECT public_key, encrypted_psk
3064
-                    FROM ' . prefixTable('users') . '
3064
+                    FROM ' . prefixTable('users').'
3065 3065
                     WHERE id = %i',
3066 3066
                     $post_user_id
3067 3067
                 );
@@ -3086,9 +3086,9 @@  discard block
 block discarded – undo
3086 3086
                             // Loop on persoanl items
3087 3087
                             $rows = DB::query(
3088 3088
                                 'SELECT id, pw
3089
-                                FROM ' . prefixTable('items') . '
3089
+                                FROM ' . prefixTable('items').'
3090 3090
                                 WHERE perso = 1 AND id_tree IN %ls
3091
-                                LIMIT ' . $post_start . ', ' . $post_length,
3091
+                                LIMIT ' . $post_start.', '.$post_length,
3092 3092
                                 $_SESSION['personal_folders']
3093 3093
                             );
3094 3094
                             $countUserPersonalItems = DB::count();
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
                                     // Loop on files
3132 3132
                                     $rows = DB::query(
3133 3133
                                         'SELECT id, file
3134
-                                        FROM ' . prefixTable('files') . '
3134
+                                        FROM ' . prefixTable('files').'
3135 3135
                                         WHERE status != %s
3136 3136
                                         AND id_item = %i',
3137 3137
                                         TP_ENCRYPTION_NAME,
@@ -3142,13 +3142,13 @@  discard block
 block discarded – undo
3142 3142
                                         // Now decrypt the file
3143 3143
                                         prepareFileWithDefuse(
3144 3144
                                             'decrypt',
3145
-                                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
3146
-                                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
3145
+                                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
3146
+                                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
3147 3147
                                             $dataReceived['userPsk']
3148 3148
                                         );
3149 3149
 
3150 3150
                                         // Encrypt the file
3151
-                                        $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
3151
+                                        $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
3152 3152
 
3153 3153
                                         DB::update(
3154 3154
                                             prefixTable('files'),
@@ -3171,7 +3171,7 @@  discard block
 block discarded – undo
3171 3171
                                         );
3172 3172
 
3173 3173
                                         // Unlink original file
3174
-                                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
3174
+                                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
3175 3175
                                     }
3176 3176
                                 }
3177 3177
                             }
@@ -3264,7 +3264,7 @@  discard block
 block discarded – undo
3264 3264
                     // Get user info
3265 3265
                     $userData = DB::queryFirstRow(
3266 3266
                         'SELECT '.$post_fields.'
3267
-                        FROM ' . prefixTable('users') . '
3267
+                        FROM ' . prefixTable('users').'
3268 3268
                         WHERE id = %i',
3269 3269
                         $post_user_id
3270 3270
                     );
@@ -3324,7 +3324,7 @@  discard block
 block discarded – undo
3324 3324
                         // Get user info
3325 3325
                         $userData = DB::queryFirstRow(
3326 3326
                             'SELECT auth_type, login, private_key
3327
-                            FROM ' . prefixTable('users') . '
3327
+                            FROM ' . prefixTable('users').'
3328 3328
                             WHERE id = %i',
3329 3329
                             $post_user_id
3330 3330
                         );
@@ -3335,7 +3335,7 @@  discard block
 block discarded – undo
3335 3335
                             $privateKey = decryptPrivateKey($post_current_pwd, $userData['private_key']);
3336 3336
 
3337 3337
                             // Load superGlobals
3338
-                            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3338
+                            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3339 3339
                             $superGlobal = new protect\SuperGlobal\SuperGlobal();
3340 3340
 
3341 3341
                             if ($superGlobal->get('private_key', 'SESSION', 'user') === $privateKey) {
@@ -3368,7 +3368,7 @@  discard block
 block discarded – undo
3368 3368
                                 echo prepareExchangedData(
3369 3369
                                     array(
3370 3370
                                         'error' => false,
3371
-                                        'message' => langHdl('done'),'',
3371
+                                        'message' => langHdl('done'), '',
3372 3372
                                     ),
3373 3373
                                     'encode'
3374 3374
                                 );
@@ -3430,7 +3430,7 @@  discard block
 block discarded – undo
3430 3430
                         // Get user info
3431 3431
                         $userData = DB::queryFirstRow(
3432 3432
                             'SELECT auth_type, login, private_key, special
3433
-                            FROM ' . prefixTable('users') . '
3433
+                            FROM ' . prefixTable('users').'
3434 3434
                             WHERE id = %i',
3435 3435
                             $post_user_id
3436 3436
                         );
@@ -3460,14 +3460,14 @@  discard block
 block discarded – undo
3460 3460
                                 );
3461 3461
 
3462 3462
                                 // Load superGlobals
3463
-                                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3463
+                                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3464 3464
                                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
3465 3465
                                 $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
3466 3466
 
3467 3467
                                 echo prepareExchangedData(
3468 3468
                                     array(
3469 3469
                                         'error' => false,
3470
-                                        'message' => langHdl('done'),'',
3470
+                                        'message' => langHdl('done'), '',
3471 3471
                                     ),
3472 3472
                                     'encode'
3473 3473
                                 );
@@ -3494,14 +3494,14 @@  discard block
 block discarded – undo
3494 3494
                                 // Get one item
3495 3495
                                 $record = DB::queryFirstRow(
3496 3496
                                     'SELECT id, pw
3497
-                                    FROM ' . prefixTable('items') . '
3497
+                                    FROM ' . prefixTable('items').'
3498 3498
                                     WHERE perso = 0'
3499 3499
                                 );
3500 3500
 
3501 3501
                                 // Get itemKey from current user
3502 3502
                                 $currentUserKey = DB::queryFirstRow(
3503 3503
                                     'SELECT share_key, increment_id
3504
-                                    FROM ' . prefixTable('sharekeys_items') . '
3504
+                                    FROM ' . prefixTable('sharekeys_items').'
3505 3505
                                     WHERE object_id = %i AND user_id = %i',
3506 3506
                                     $record['id'],
3507 3507
                                     $post_user_id
@@ -3534,7 +3534,7 @@  discard block
 block discarded – undo
3534 3534
                                         );
3535 3535
                                         
3536 3536
                                         // Load superGlobals
3537
-                                        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3537
+                                        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3538 3538
                                         $superGlobal = new protect\SuperGlobal\SuperGlobal();
3539 3539
                                         $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
3540 3540
     
Please login to merge, or discard this patch.