Passed
Push — teampass_3.0 ( b7c627...7063cf )
by Nils
04:29
created
sources/main.functions.php 1 patch
Spacing   +206 added lines, -206 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
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,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
         }
1963 1963
 
1964 1964
         send_syslog(
1965
-            'action=' . str_replace('at_', '', $action) . ' attribute=' . str_replace('at_', '', $attribute[0]) . ' itemno=' . $item_id . ' user=' . addslashes($login) . ' itemname="' . addslashes($item_label) . '"',
1965
+            'action='.str_replace('at_', '', $action).' attribute='.str_replace('at_', '', $attribute[0]).' itemno='.$item_id.' user='.addslashes($login).' itemname="'.addslashes($item_label).'"',
1966 1966
             $SETTINGS['syslog_host'],
1967 1967
             $SETTINGS['syslog_port'],
1968 1968
             'teampass'
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
         && $action === 'at_shown'
1989 1989
     ) {
1990 1990
         // Load superglobal
1991
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1991
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1992 1992
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1993 1993
 
1994 1994
         // Get superglobals
@@ -1999,7 +1999,7 @@  discard block
 block discarded – undo
1999 1999
         // Get info about item
2000 2000
         $dataItem = DB::queryfirstrow(
2001 2001
             'SELECT id, id_tree, label
2002
-            FROM ' . prefixTable('items') . '
2002
+            FROM ' . prefixTable('items').'
2003 2003
             WHERE id = %i',
2004 2004
             $item_id
2005 2005
         );
@@ -2014,9 +2014,9 @@  discard block
 block discarded – undo
2014 2014
                 'body' => str_replace(
2015 2015
                     array('#tp_user#', '#tp_item#', '#tp_link#'),
2016 2016
                     array(
2017
-                        addslashes($globalsName . ' ' . $globalsLastname),
2017
+                        addslashes($globalsName.' '.$globalsLastname),
2018 2018
                         addslashes($item_label),
2019
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
2019
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
2020 2020
                     ),
2021 2021
                     langHdl('email_on_open_notification_mail')
2022 2022
                 ),
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
 function notifyChangesToSubscribers($item_id, $label, $changes, $SETTINGS)
2039 2039
 {
2040 2040
     // Load superglobal
2041
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2041
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2042 2042
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2043 2043
 
2044 2044
     // Get superglobals
@@ -2050,8 +2050,8 @@  discard block
 block discarded – undo
2050 2050
     $notification = DB::queryOneColumn(
2051 2051
         'email',
2052 2052
         'SELECT *
2053
-        FROM ' . prefixTable('notification') . ' AS n
2054
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
2053
+        FROM ' . prefixTable('notification').' AS n
2054
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
2055 2055
         WHERE n.item_id = %i AND n.user_id != %i',
2056 2056
         $item_id,
2057 2057
         $globalsUserId
@@ -2064,7 +2064,7 @@  discard block
 block discarded – undo
2064 2064
         // Get list of changes
2065 2065
         $htmlChanges = '<ul>';
2066 2066
         foreach ($changes as $change) {
2067
-            $htmlChanges .= '<li>' . $change . '</li>';
2067
+            $htmlChanges .= '<li>'.$change.'</li>';
2068 2068
         }
2069 2069
         $htmlChanges .= '</ul>';
2070 2070
 
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 function geItemReadablePath($id_tree, $label, $SETTINGS)
2099 2099
 {
2100 2100
     // Class loader
2101
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
2101
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
2102 2102
 
2103 2103
     //Load Tree
2104 2104
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
@@ -2109,15 +2109,15 @@  discard block
 block discarded – undo
2109 2109
     $path = '';
2110 2110
     foreach ($arbo as $elem) {
2111 2111
         if (empty($path) === true) {
2112
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
2112
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
2113 2113
         } else {
2114
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2114
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2115 2115
         }
2116 2116
     }
2117 2117
 
2118 2118
     // Build text to show user
2119 2119
     if (empty($label) === false) {
2120
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
2120
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
2121 2121
     } else {
2122 2122
         return empty($path) === true ? '' : $path;
2123 2123
     }
@@ -2176,10 +2176,10 @@  discard block
 block discarded – undo
2176 2176
  */
2177 2177
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2178 2178
 {
2179
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2179
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2180 2180
 
2181 2181
     // include librairies & connect to DB
2182
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2182
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2183 2183
     if (defined('DB_PASSWD_CLEAR') === false) {
2184 2184
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2185 2185
     }
@@ -2193,8 +2193,8 @@  discard block
 block discarded – undo
2193 2193
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2194 2194
         // perform a copy
2195 2195
         if (file_exists($tp_config_file)) {
2196
-            if (!copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2197
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2196
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2197
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2198 2198
             }
2199 2199
         }
2200 2200
 
@@ -2205,11 +2205,11 @@  discard block
 block discarded – undo
2205 2205
         $data[1] = "global \$SETTINGS;\n";
2206 2206
         $data[2] = "\$SETTINGS = array (\n";
2207 2207
         $rows = DB::query(
2208
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2208
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2209 2209
             'admin'
2210 2210
         );
2211 2211
         foreach ($rows as $record) {
2212
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2212
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2213 2213
         }
2214 2214
         array_push($data, ");\n");
2215 2215
         $data = array_unique($data);
@@ -2223,15 +2223,15 @@  discard block
 block discarded – undo
2223 2223
                 break;
2224 2224
             }
2225 2225
 
2226
-            if (stristr($line, "'" . $field . "' => '")) {
2227
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2226
+            if (stristr($line, "'".$field."' => '")) {
2227
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2228 2228
                 $bFound = true;
2229 2229
                 break;
2230 2230
             }
2231 2231
             ++$inc;
2232 2232
         }
2233 2233
         if ($bFound === false) {
2234
-            $data[($inc)] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2234
+            $data[($inc)] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2235 2235
         }
2236 2236
     }
2237 2237
 
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
         $settings = array();
2270 2270
 
2271 2271
         $rows = DB::query(
2272
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2272
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2273 2273
             array(
2274 2274
                 'type' => 'admin',
2275 2275
                 'type2' => 'settings',
@@ -2296,7 +2296,7 @@  discard block
 block discarded – undo
2296 2296
     $source_cf = array();
2297 2297
     $rows = DB::QUERY(
2298 2298
         'SELECT id_category
2299
-        FROM ' . prefixTable('categories_folders') . '
2299
+        FROM ' . prefixTable('categories_folders').'
2300 2300
         WHERE id_folder = %i',
2301 2301
         $source_id
2302 2302
     );
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
     $target_cf = array();
2308 2308
     $rows = DB::QUERY(
2309 2309
         'SELECT id_category
2310
-        FROM ' . prefixTable('categories_folders') . '
2310
+        FROM ' . prefixTable('categories_folders').'
2311 2311
         WHERE id_folder = %i',
2312 2312
         $target_id
2313 2313
     );
@@ -2342,9 +2342,9 @@  discard block
 block discarded – undo
2342 2342
     $password = null
2343 2343
 ) {
2344 2344
     // Load AntiXSS
2345
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2346
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2347
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2345
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2346
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2347
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2348 2348
     $antiXss = new voku\helper\AntiXSS();
2349 2349
 
2350 2350
     // Protect against bad inputs
@@ -2358,7 +2358,7 @@  discard block
 block discarded – undo
2358 2358
 
2359 2359
     if (empty($password) === true || is_null($password) === true) {
2360 2360
         // get KEY to define password
2361
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2361
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2362 2362
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2363 2363
     }
2364 2364
 
@@ -2404,15 +2404,15 @@  discard block
 block discarded – undo
2404 2404
 ) {
2405 2405
     // load PhpEncryption library
2406 2406
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2407
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2408
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2409
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2410
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2411
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2412
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2413
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2414
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2415
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2407
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2408
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2409
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2410
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2411
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2412
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2413
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2414
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2415
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2416 2416
 
2417 2417
     try {
2418 2418
         \Defuse\Crypto\File::encryptFileWithPassword(
@@ -2450,15 +2450,15 @@  discard block
 block discarded – undo
2450 2450
 ) {
2451 2451
     // load PhpEncryption library
2452 2452
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2453
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2454
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2455
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2456
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2457
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2458
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2459
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2460
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2461
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2453
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2454
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2455
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2456
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2457
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2458
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2459
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2460
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2461
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2462 2462
 
2463 2463
     try {
2464 2464
         \Defuse\Crypto\File::decryptFileWithPassword(
@@ -2504,9 +2504,9 @@  discard block
 block discarded – undo
2504 2504
 function fileDelete($file, $SETTINGS)
2505 2505
 {
2506 2506
     // Load AntiXSS
2507
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2508
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2509
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2507
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2508
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2509
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2510 2510
     $antiXss = new voku\helper\AntiXSS();
2511 2511
 
2512 2512
     $file = $antiXss->xss_clean($file);
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
             continue;
2553 2553
         }
2554 2554
 
2555
-        $fullPath = $dir . '/' . $file;
2555
+        $fullPath = $dir.'/'.$file;
2556 2556
 
2557 2557
         if (is_dir($fullPath)) {
2558 2558
             if ($res = @chmod($fullPath, $dirPermissions)) {
@@ -2582,7 +2582,7 @@  discard block
 block discarded – undo
2582 2582
  */
2583 2583
 function accessToItemIsGranted($item_id, $SETTINGS)
2584 2584
 {
2585
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2585
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2586 2586
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2587 2587
 
2588 2588
     // Prepare superGlobal variables
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
     // Load item data
2593 2593
     $data = DB::queryFirstRow(
2594 2594
         'SELECT id_tree
2595
-        FROM ' . prefixTable('items') . '
2595
+        FROM ' . prefixTable('items').'
2596 2596
         WHERE id = %i',
2597 2597
         $item_id
2598 2598
     );
@@ -2674,8 +2674,8 @@  discard block
 block discarded – undo
2674 2674
 function performDBQuery($SETTINGS, $fields, $table)
2675 2675
 {
2676 2676
     // include librairies & connect to DB
2677
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2678
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2677
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2678
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2679 2679
     if (defined('DB_PASSWD_CLEAR') === false) {
2680 2680
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2681 2681
     }
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
 
2689 2689
     // Insert log in DB
2690 2690
     return DB::query(
2691
-        'SELECT ' . $fields . '
2691
+        'SELECT '.$fields.'
2692 2692
         FROM ' . prefixTable($table)
2693 2693
     );
2694 2694
 }
@@ -2703,15 +2703,15 @@  discard block
 block discarded – undo
2703 2703
 function formatSizeUnits($bytes)
2704 2704
 {
2705 2705
     if ($bytes >= 1073741824) {
2706
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2706
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2707 2707
     } elseif ($bytes >= 1048576) {
2708
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2708
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2709 2709
     } elseif ($bytes >= 1024) {
2710
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2710
+        $bytes = number_format($bytes / 1024, 2).' KB';
2711 2711
     } elseif ($bytes > 1) {
2712
-        $bytes = $bytes . ' bytes';
2712
+        $bytes = $bytes.' bytes';
2713 2713
     } elseif ($bytes == 1) {
2714
-        $bytes = $bytes . ' byte';
2714
+        $bytes = $bytes.' byte';
2715 2715
     } else {
2716 2716
         $bytes = '0 bytes';
2717 2717
     }
@@ -2891,7 +2891,7 @@  discard block
 block discarded – undo
2891 2891
     // Decrypt
2892 2892
     try {
2893 2893
         $ret = base64_encode($rsa->decrypt(base64_decode($key)));
2894
-    } catch(Exception $e) {
2894
+    } catch (Exception $e) {
2895 2895
         return $e;
2896 2896
     }
2897 2897
 
@@ -2933,16 +2933,16 @@  discard block
 block discarded – undo
2933 2933
 
2934 2934
     // Encrypt the file content
2935 2935
     $plaintext = file_get_contents(
2936
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2936
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2937 2937
     );
2938 2938
 
2939 2939
     $ciphertext = $cipher->encrypt($plaintext);
2940 2940
 
2941 2941
     // Save new file
2942 2942
     $hash = md5($plaintext);
2943
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2943
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2944 2944
     file_put_contents($fileOut, $ciphertext);
2945
-    unlink($fileInPath . '/' . $fileInName);
2945
+    unlink($fileInPath.'/'.$fileInName);
2946 2946
 
2947 2947
     return array(
2948 2948
         'fileHash' => base64_encode($hash),
@@ -2985,7 +2985,7 @@  discard block
 block discarded – undo
2985 2985
     $cipher->disablePadding();
2986 2986
 
2987 2987
     // Get file content
2988
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2988
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2989 2989
 
2990 2990
     // Decrypt file content and return
2991 2991
     return base64_encode($cipher->decrypt($ciphertext));
@@ -3041,8 +3041,8 @@  discard block
 block discarded – undo
3041 3041
     $SETTINGS
3042 3042
 ) {
3043 3043
     // include librairies & connect to DB
3044
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3045
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3044
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3045
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3046 3046
     if (defined('DB_PASSWD_CLEAR') === false) {
3047 3047
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3048 3048
     }
@@ -3061,7 +3061,7 @@  discard block
 block discarded – undo
3061 3061
     );
3062 3062
 
3063 3063
     // Superglobals
3064
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3064
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3065 3065
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
3066 3066
 
3067 3067
     // Prepare superGlobal variables
@@ -3088,8 +3088,8 @@  discard block
 block discarded – undo
3088 3088
         // Create sharekey for each user
3089 3089
         $users = DB::query(
3090 3090
             'SELECT id, public_key
3091
-            FROM ' . prefixTable('users') . '
3092
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
3091
+            FROM ' . prefixTable('users').'
3092
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
3093 3093
             AND public_key != ""'
3094 3094
         );
3095 3095
         foreach ($users as $user) {
@@ -3190,13 +3190,13 @@  discard block
 block discarded – undo
3190 3190
     ];
3191 3191
 
3192 3192
     // Load expected libraries
3193
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3194
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3195
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3196
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3197
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3198
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
3199
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3193
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3194
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3195
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3196
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3197
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3198
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
3199
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3200 3200
 
3201 3201
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3202 3202
     $ad->register();
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
     } catch (\LdapRecord\Auth\BindException $e) {
3210 3210
         $error = $e->getDetailedError();
3211 3211
 
3212
-        echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage();
3212
+        echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage();
3213 3213
         return false;
3214 3214
     }
3215 3215
 
@@ -3220,7 +3220,7 @@  discard block
 block discarded – undo
3220 3220
     } catch (\LdapRecord\Auth\BindException $e) {
3221 3221
         $error = $e->getDetailedError();
3222 3222
         
3223
-        echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage();
3223
+        echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage();
3224 3224
         return false;
3225 3225
     }
3226 3226
 
@@ -3241,8 +3241,8 @@  discard block
 block discarded – undo
3241 3241
 function deleteUserObjetsKeys($userId, $SETTINGS)
3242 3242
 {
3243 3243
     // include librairies & connect to DB
3244
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3245
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3244
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3245
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3246 3246
     if (defined('DB_PASSWD_CLEAR') === false) {
3247 3247
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3248 3248
     }
@@ -3303,7 +3303,7 @@  discard block
 block discarded – undo
3303 3303
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3304 3304
             $now->setTimezone(new DateTimeZone($timezone));
3305 3305
             $offsets[] = $offset = $now->getOffset();
3306
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3306
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3307 3307
         }
3308 3308
 
3309 3309
         array_multisort($offsets, $timezones);
@@ -3315,7 +3315,7 @@  discard block
 block discarded – undo
3315 3315
 function format_GMT_offset($offset) {
3316 3316
     $hours = intval($offset / 3600);
3317 3317
     $minutes = abs(intval($offset % 3600 / 60));
3318
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3318
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3319 3319
 }
3320 3320
 
3321 3321
 function format_timezone_name($name) {
@@ -3337,7 +3337,7 @@  discard block
 block discarded – undo
3337 3337
 function mfa_auth_requested($userRolesIds, $mfaRoles)
3338 3338
 {
3339 3339
     $mfaRoles = array_values(json_decode($mfaRoles, true));
3340
-    $userRolesIds = array_filter(explode(';' , $userRolesIds));
3340
+    $userRolesIds = array_filter(explode(';', $userRolesIds));
3341 3341
 
3342 3342
     if (count($mfaRoles) === 0 || count($mfaRoles) === 0) {
3343 3343
         return true;
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 // Load AntiXSS
46
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
46
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
47 47
 $antiXss = new voku\helper\AntiXSS();
48 48
 
49
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
49
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
52 52
 
53 53
 // init
54 54
 $ldap_suffix = '';
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 
58 58
 // If Debug then clean the files
59 59
 if (DEBUGLDAP === true) {
60
-    define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt');
60
+    define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt');
61 61
     $fp = fopen(DEBUGLDAPFILE, 'w');
62 62
     fclose($fp);
63 63
 }
64 64
 if (DEBUGDUO === true) {
65
-    define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'] . '/duo.debug.txt');
65
+    define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'].'/duo.debug.txt');
66 66
     $fp = fopen(DEBUGDUOFILE, 'w');
67 67
     fclose($fp);
68 68
 }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 if (defined('DB_PASSWD_CLEAR') === false) {
80 80
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
81 81
 }
82
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
82
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
83 83
 if (defined('DB_PASSWD_CLEAR') === false) {
84 84
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
85 85
 }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     // Get DUO keys
100 100
     $duoData = DB::query(
101 101
         'SELECT intitule, valeur
102
-        FROM ' . prefixTable('misc') . '
102
+        FROM ' . prefixTable('misc').'
103 103
         WHERE type = %s',
104 104
         'duoSecurity'
105 105
     );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     }
109 109
 
110 110
     // load library
111
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
111
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
112 112
     $sig_request = Duo::signRequest(
113 113
         $_GLOBALS['IKEY'],
114 114
         $_GLOBALS['SKEY'],
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
         debugIdentify(
121 121
             DEBUGDUO,
122 122
             DEBUGDUOFILE,
123
-            "\n\n-----\n\n" .
124
-                'sig request : ' . $post_login . "\n" .
125
-                'resp : ' . $sig_request . "\n"
123
+            "\n\n-----\n\n".
124
+                'sig request : '.$post_login."\n".
125
+                'resp : '.$sig_request."\n"
126 126
         );
127 127
     }
128 128
 
129 129
     // load csrfprotector
130
-    $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php';
130
+    $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php';
131 131
 
132 132
     // return result
133
-    echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]';
133
+    echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]';
134 134
     // ---
135 135
     // ---
136 136
 } elseif ($post_type === 'identify_duo_user_check') {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     //--------
141 141
 
142 142
     // load library
143
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
143
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
144 144
     $authenticated_username = Duo::verifyResponse(
145 145
         $SETTINGS['duo_ikey'],
146 146
         $SETTINGS['duo_skey'],
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
         debugIdentify(
153 153
             DEBUGDUO,
154 154
             DEBUGDUOFILE,
155
-            "\n\n-----\n\n" .
156
-                'sig response : ' . $post_sig_response . "\n" .
157
-                'resp : ' . $authenticated_username . "\n"
155
+            "\n\n-----\n\n".
156
+                'sig response : '.$post_sig_response."\n".
157
+                'resp : '.$authenticated_username."\n"
158 158
         );
159 159
     }
160 160
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             // is user in Teampass?
166 166
             $userInfo = DB::queryfirstrow(
167 167
                 'SELECT id
168
-                FROM ' . prefixTable('users') . '
168
+                FROM ' . prefixTable('users').'
169 169
                 WHERE login = %s',
170 170
                 $post_login
171 171
             );
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
             }
177 177
         }
178 178
 
179
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
179
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
180 180
     } else {
181
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
181
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
182 182
     }
183 183
     // ---
184 184
     // ---
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
 
191 191
     // Load superGlobals
192
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
192
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
193 193
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
194 194
 
195 195
     // Prepare GET variables
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
     } else {
283 283
         throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
284 284
     }
285
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
285
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
286 286
 
287 287
     header('Content-type: text/html; charset=utf-8');
288 288
     error_reporting(E_ERROR);
289
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
290
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
289
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
290
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
291 291
 
292 292
     // Load AntiXSS
293
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
293
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
294 294
     $antiXss = new voku\helper\AntiXSS();
295 295
 
296 296
     // Load superGlobals
297
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
297
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
298 298
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
299 299
 
300 300
     // Prepare GET variables
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
306 306
 
307 307
     // connect to the server
308
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
308
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
309 309
     if (defined('DB_PASSWD_CLEAR') === false) {
310 310
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
311 311
     }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     DB::$encoding = DB_ENCODING;
318 318
 
319 319
     // User's language loading
320
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php';
320
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php';
321 321
     //echo $dataReceived." -->".empty($sessionKey)."<-- ".$sessionKey." ** " ;
322 322
     // decrypt and retreive data in JSON format
323 323
     if (empty($sessionKey) === true) {
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
     // Check if user exists
398 398
     $userInfo = DB::queryFirstRow(
399 399
         'SELECT *
400
-        FROM ' . prefixTable('users') . '
400
+        FROM ' . prefixTable('users').'
401 401
         WHERE login=%s',
402 402
         $username
403 403
     );
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
         //$arrAttempts = array();
610 610
         $rows = DB::query(
611 611
             'SELECT date
612
-            FROM ' . prefixTable('log_system') . "
612
+            FROM ' . prefixTable('log_system')."
613 613
             WHERE field_1 = %s
614 614
             AND type = 'failed_auth'
615 615
             AND label = 'user_password_not_correct'
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
             foreach ($rows as $record) {
626 626
                 array_push(
627 627
                     $arrAttempts,
628
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['date'])
628
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['date'])
629 629
                 );
630 630
             }
631 631
         }
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         foreach ($superGlobal->get('user_roles', 'SESSION') as $role) {
766 766
             $resRoles = DB::queryFirstRow(
767 767
                 'SELECT title, complexity
768
-                FROM ' . prefixTable('roles_title') . '
768
+                FROM ' . prefixTable('roles_title').'
769 769
                 WHERE id=%i',
770 770
                 $role
771 771
             );
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 
787 787
         // build complete array of roles
788 788
         $superGlobal->put('arr_roles_full', array(), 'SESSION');
789
-        $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
789
+        $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
790 790
         foreach ($rows as $record) {
791 791
             $superGlobal->put(
792 792
                 $record['id'],
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
             if (!empty($item)) {
882 882
                 $dataLastItems = DB::queryFirstRow(
883 883
                     'SELECT id,label,id_tree
884
-                    FROM ' . prefixTable('items') . '
884
+                    FROM ' . prefixTable('items').'
885 885
                     WHERE id=%i',
886 886
                     $item
887 887
                 );
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
                     array(
891 891
                         'id' => $item,
892 892
                         'label' => $dataLastItems['label'],
893
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
893
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
894 894
                     ),
895 895
                     'SESSION',
896 896
                     'latest_items_tab'
@@ -907,12 +907,12 @@  discard block
 block discarded – undo
907 907
         ) {
908 908
             // get all Admin users
909 909
             $receivers = '';
910
-            $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
910
+            $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
911 911
             foreach ($rows as $record) {
912 912
                 if (empty($receivers)) {
913 913
                     $receivers = $record['email'];
914 914
                 } else {
915
-                    $receivers = ',' . $record['email'];
915
+                    $receivers = ','.$record['email'];
916 916
                 }
917 917
             }
918 918
             // Add email to table
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                             '#tp_time#',
929 929
                         ),
930 930
                         array(
931
-                            ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')',
931
+                            ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')',
932 932
                             date($SETTINGS['date_format'], $superGlobal->get('last_connection', 'SESSION')),
933 933
                             date($SETTINGS['time_format'], $superGlobal->get('last_connection', 'SESSION')),
934 934
                         ),
@@ -1077,8 +1077,8 @@  discard block
 block discarded – undo
1077 1077
     debugIdentify(
1078 1078
         DEBUGDUO,
1079 1079
         DEBUGDUOFILE,
1080
-        "\n\n----\n" .
1081
-            'Identified : ' . filter_var($return, FILTER_SANITIZE_STRING) . "\n\n"
1080
+        "\n\n----\n".
1081
+            'Identified : '.filter_var($return, FILTER_SANITIZE_STRING)."\n\n"
1082 1082
     );
1083 1083
 
1084 1084
     echo prepareExchangedData(
@@ -1144,44 +1144,44 @@  discard block
 block discarded – undo
1144 1144
     ];
1145 1145
     
1146 1146
     // Load expected libraries
1147
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/illuminate/Contracts/Auth/Authenticatable.php';
1148
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
1149
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
1150
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
1151
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
1152
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
1153
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
1154
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
1155
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php';
1156
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
1157
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
1158
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
1159
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
1160
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
1161
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
1162
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
1163
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
1164
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
1165
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
1166
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
1167
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
1168
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
1169
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
1170
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
1171
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
1172
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
1173
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
1174
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
1175
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
1176
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
1177
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
1178
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
1179
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
1180
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
1181
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
1182
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
1183
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
1184
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
1147
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/illuminate/Contracts/Auth/Authenticatable.php';
1148
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
1149
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
1150
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
1151
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
1152
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
1153
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
1154
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
1155
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php';
1156
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
1157
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
1158
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
1159
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
1160
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
1161
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
1162
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
1163
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
1164
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
1165
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
1166
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
1167
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
1168
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
1169
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
1170
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
1171
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
1172
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
1173
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
1174
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
1175
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
1176
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
1177
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
1178
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
1179
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
1180
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
1181
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
1182
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
1183
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
1184
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
1185 1185
 
1186 1186
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
1187 1187
     $ad->register();
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
         return array(
1198 1198
             'error' => true,
1199
-            'message' => langHdl('error').' : '.$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage()." ".$config['username'],
1199
+            'message' => langHdl('error').' : '.$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage()." ".$config['username'],
1200 1200
              
1201 1201
         );
1202 1202
     }
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
     }
1225 1225
 
1226 1226
     // load passwordLib library
1227
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1227
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1228 1228
     $pwdlib->register();
1229 1229
     $pwdlib = new PasswordLib\PasswordLib();
1230 1230
     $hashedPassword = $pwdlib->createPasswordHash($passwordClear);
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
             'id = %i',
1241 1241
             $userInfo['id']
1242 1242
         );
1243
-    } else if ($userInfo['special']=== 'user_added_from_ldap') {
1243
+    } else if ($userInfo['special'] === 'user_added_from_ldap') {
1244 1244
         // Case where user has been added from LDAP and never being connected to TP
1245 1245
         // We need to create his keys
1246 1246
         /*$userKeys = generateUserKeys($passwordClear);
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 function yubicoMFACheck($dataReceived, $userInfo, $SETTINGS)
1294 1294
 {
1295 1295
     // Load superGlobals
1296
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1296
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1297 1297
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1298 1298
     $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1299 1299
     $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
     }
1337 1337
 
1338 1338
     // Now check yubico validity
1339
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1339
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1340 1340
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1341 1341
     $auth = $yubi->verify($yubico_key); //, null, null, null, 60
1342 1342
 
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
             'gestionnaire' => '0',
1388 1388
             'can_manage_all_users' => '0',
1389 1389
             'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0',
1390
-            'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'] . ';' : '') . (isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'),
1390
+            'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'].';' : '').(isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'),
1391 1391
             'groupes_interdits' => '',
1392 1392
             'groupes_visibles' => '',
1393 1393
             'last_pw_change' => time(),
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
         );
1414 1414
 
1415 1415
         // Rebuild tree
1416
-        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1416
+        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1417 1417
         $tree->register();
1418 1418
         $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1419 1419
         $tree->rebuild();
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
         && empty($dataReceived['GACode']) === false
1445 1445
     ) {
1446 1446
         // Load superGlobals
1447
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1447
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1448 1448
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1449 1449
         $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1450 1450
         $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
         $proceedIdentification = false;
1455 1455
         
1456 1456
         // load library
1457
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1457
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1458 1458
 
1459 1459
         // create new instance
1460 1460
         $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 
1481 1481
             // generate new QR
1482 1482
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1483
-                'Teampass - ' . $username,
1483
+                'Teampass - '.$username,
1484 1484
                 $userInfo['ga']
1485 1485
             );
1486 1486
 
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
             );
1496 1496
 
1497 1497
             $firstTime = array(
1498
-                'value' => '<img src="' . $new_2fa_qr . '">',
1498
+                'value' => '<img src="'.$new_2fa_qr.'">',
1499 1499
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1500 1500
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1501 1501
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1548,8 +1548,8 @@  discard block
 block discarded – undo
1548 1548
     $userPasswordVerified = false;
1549 1549
 
1550 1550
     // load passwordLib library
1551
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1552
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1551
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1552
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1553 1553
     $pwdlib->register();
1554 1554
     $pwdlib = new PasswordLib\PasswordLib();
1555 1555
 
Please login to merge, or discard this patch.