Passed
Push — teampass_3.0 ( b28540...71c6f8 )
by Nils
04:22
created
sources/main.queries.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 date_default_timezone_set(isset($SETTINGS['timezone']) === true ? $SETTINGS['timezone'] : 'UTC');
46 46
 
47 47
 // DO CHECKS
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
49
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
50 50
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
51 51
 if (
52 52
     isset($post_type) === true
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     && checkUser($_SESSION['user_id'], $_SESSION['key'], 'home', $SETTINGS) === false
63 63
 ) {
64 64
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
65
-    include $SETTINGS['cpassman_dir'] . '/error.php';
65
+    include $SETTINGS['cpassman_dir'].'/error.php';
66 66
     exit();
67 67
 } elseif ((isset($_SESSION['user_id']) === true
68 68
         && isset($_SESSION['key'])) === true
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     mainQuery($SETTINGS);
75 75
 } else {
76 76
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit();
79 79
 }
80 80
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
     // Includes
92
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
93
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
94
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
95
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
92
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
93
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
94
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
95
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
96 96
 
97 97
     // Connect to mysql server
98
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
98
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
99 99
 
100 100
     DB::$host = DB_HOST;
101 101
     DB::$user = DB_USER;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     DB::$encoding = DB_ENCODING;
106 106
 
107 107
     // User's language loading
108
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
108
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
109 109
 
110 110
     // Prepare post variables
111 111
     $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             $pwdlib = new PasswordLib\PasswordLib();
234 234
             // generate key
235 235
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
236
-            echo '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
236
+            echo '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
237 237
             break;
238 238
 
239 239
         /*
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 )
263 263
             );
264 264
 
265
-            echo '[{"token" : "' . $token . '"}]';
265
+            echo '[{"token" : "'.$token.'"}]';
266 266
             break;
267 267
 
268 268
 
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
         // check if expected security level is reached
543 543
         $dataUser = DB::queryfirstrow(
544 544
             'SELECT *
545
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
545
+            FROM ' . prefixTable('users').' WHERE id = %i',
546 546
             $post_user_id
547 547
         );
548 548
 
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
         if (empty($dataUser['fonction_id']) === false) {
564 564
             $data = DB::queryFirstRow(
565 565
                 'SELECT complexity
566
-                FROM ' . prefixTable('roles_title') . '
567
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
566
+                FROM ' . prefixTable('roles_title').'
567
+                WHERE id IN (' . $dataUser['fonction_id'].')
568 568
                 ORDER BY complexity DESC'
569 569
             );
570 570
         } else {
@@ -577,8 +577,8 @@  discard block
 block discarded – undo
577 577
             return prepareExchangedData(
578 578
                 array(
579 579
                     'error' => true,
580
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('complexity_level_not_reached') . '.<br>' .
581
-                        langHdl('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
580
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('complexity_level_not_reached').'.<br>'.
581
+                        langHdl('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
582 582
                 ),
583 583
                 'encode'
584 584
             );
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
         // Get data about user
680 680
         $data = DB::queryfirstrow(
681 681
             'SELECT id, email, pw
682
-            FROM ' . prefixTable('users') . '
682
+            FROM ' . prefixTable('users').'
683 683
             WHERE login = %s',
684 684
             $post_login
685 685
         );
686 686
     } else {
687 687
         $data = DB::queryfirstrow(
688 688
             'SELECT id, login, email, pw
689
-            FROM ' . prefixTable('users') . '
689
+            FROM ' . prefixTable('users').'
690 690
             WHERE id = %i',
691 691
             $post_id
692 692
         );
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
     $counter = DB::count();
697 697
 
698 698
     // load passwordLib library
699
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
699
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
700 700
     $pwdlib->register();
701 701
     $pwdlib = new PasswordLib\PasswordLib();
702 702
 
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
     }
744 744
     
745 745
     // generate new GA user code
746
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
746
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
747 747
     $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
748 748
     $gaSecretKey = $tfa->createSecret();
749 749
     $gaTemporaryCode = GenerateCryptKey(12, false, true, true, false, true, $SETTINGS);
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                 'email' => $data['email'],
786 786
                 'email_result' => str_replace(
787 787
                     '#email#',
788
-                    '<b>' . obfuscateEmail($data['email']) . '</b>',
788
+                    '<b>'.obfuscateEmail($data['email']).'</b>',
789 789
                     addslashes(langHdl('admin_email_result_ok'))
790 790
                 ),
791 791
             ),
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
             'email' => $data['email'],
802 802
             'email_result' => str_replace(
803 803
                 '#email#',
804
-                '<b>' . obfuscateEmail($data['email']) . '</b>',
804
+                '<b>'.obfuscateEmail($data['email']).'</b>',
805 805
                 addslashes(langHdl('admin_email_result_ok'))
806 806
             ),
807 807
         ),
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
         && (int) $SETTINGS['enable_send_email_on_user_login'] === 1
818 818
     ) {
819 819
         $row = DB::queryFirstRow(
820
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
820
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
821 821
             'cron',
822 822
             'sending_emails'
823 823
         );
@@ -825,12 +825,12 @@  discard block
 block discarded – undo
825 825
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
826 826
             $rows = DB::query(
827 827
                 'SELECT *
828
-                FROM ' . prefixTable('emails') .
828
+                FROM ' . prefixTable('emails').
829 829
                 ' WHERE status != %s',
830 830
                 'sent'
831 831
             );
832 832
             foreach ($rows as $record) {
833
-                echo $record['increment_id'] . " >> ";
833
+                echo $record['increment_id']." >> ";
834 834
                 // Send email
835 835
                 $ret = json_decode(
836 836
                     sendEmail(
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
     $arr_html = array();
930 930
     $rows = DB::query(
931 931
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
932
-        FROM ' . prefixTable('log_items') . ' AS l
933
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
932
+        FROM ' . prefixTable('log_items').' AS l
933
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
934 934
         WHERE l.action = %s AND l.id_user = %i
935 935
         ORDER BY l.date DESC
936 936
         LIMIT 0, 100',
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
         isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1
964 964
         && ((int) $_SESSION['user_admin'] === 1 || (int) $_SESSION['user_manager'] === 1)
965 965
     ) {
966
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
966
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
967 967
         $nb_suggestions_waiting = DB::count();
968 968
     }
969 969
 
@@ -999,13 +999,13 @@  discard block
 block discarded – undo
999 999
             if ($data === 'stat_languages') {
1000 1000
                 $tmp = '';
1001 1001
                 foreach ($stats_data[$data] as $key => $value) {
1002
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1002
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1003 1003
                 }
1004 1004
                 $statsToSend[$data] = $tmp;
1005 1005
             } elseif ($data === 'stat_country') {
1006 1006
                 $tmp = '';
1007 1007
                 foreach ($stats_data[$data] as $key => $value) {
1008
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1008
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1009 1009
                 }
1010 1010
                 $statsToSend[$data] = $tmp;
1011 1011
             } else {
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
             if (strpos($line, 'cpassman_url') > 0 && empty($url_found) === true) {
1080 1080
                 $url_found = substr($line, 19, strlen($line) - 22);
1081 1081
                 $tmp = parse_url($url_found);
1082
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . $tmp['path'];
1083
-                $line = "'cpassman_url' => '" . $anonym_url . "\n";
1082
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.$tmp['path'];
1083
+                $line = "'cpassman_url' => '".$anonym_url."\n";
1084 1084
             }
1085 1085
 
1086 1086
             // Anonymize all urls
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
     $teampass_errors = '';
1108 1108
     $rows = DB::query(
1109 1109
         'SELECT label, date AS error_date
1110
-        FROM ' . prefixTable('log_system') . "
1110
+        FROM ' . prefixTable('log_system')."
1111 1111
         WHERE `type` LIKE 'error'
1112 1112
         ORDER BY `date` DESC
1113 1113
         LIMIT 0, 10"
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
     if (DB::count() > 0) {
1116 1116
         foreach ($rows as $record) {
1117 1117
             if (empty($teampass_errors) === true) {
1118
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1118
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1119 1119
             } else {
1120
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1120
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1121 1121
             }
1122 1122
         }
1123 1123
     }
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 
1127 1127
     // Now prepare text
1128 1128
     $txt = '### Page on which it happened
1129
-' . $post_data['current_page'] . '
1129
+' . $post_data['current_page'].'
1130 1130
 
1131 1131
 ### Steps to reproduce
1132 1132
 1.
@@ -1141,39 +1141,39 @@  discard block
 block discarded – undo
1141 1141
 Tell us what happens instead
1142 1142
 
1143 1143
 ### Server configuration
1144
-**Operating system**: ' . php_uname() . '
1144
+**Operating system**: ' . php_uname().'
1145 1145
 
1146
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1146
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1147 1147
 
1148
-**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)) . '
1148
+**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)).'
1149 1149
 
1150
-**PHP version:** ' . PHP_VERSION . '
1150
+**PHP version:** ' . PHP_VERSION.'
1151 1151
 
1152
-**Teampass version:** ' . TP_VERSION_FULL . '
1152
+**Teampass version:** ' . TP_VERSION_FULL.'
1153 1153
 
1154 1154
 **Teampass configuration file:**
1155 1155
 ```
1156
-' . $list_of_options . '
1156
+' . $list_of_options.'
1157 1157
 ```
1158 1158
 
1159 1159
 **Updated from an older Teampass or fresh install:**
1160 1160
 
1161 1161
 ### Client configuration
1162 1162
 
1163
-**Browser:** ' . $post_data['browser_name'] . ' - ' . $post_data['browser_version'] . '
1163
+**Browser:** ' . $post_data['browser_name'].' - '.$post_data['browser_version'].'
1164 1164
 
1165
-**Operating system:** ' . $post_data['os'] . ' - ' . $post_data['os_archi'] . 'bits
1165
+**Operating system:** ' . $post_data['os'].' - '.$post_data['os_archi'].'bits
1166 1166
 
1167 1167
 ### Logs
1168 1168
 
1169 1169
 #### Web server error log
1170 1170
 ```
1171
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1171
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1172 1172
 ```
1173 1173
 
1174 1174
 #### Teampass 10 last system errors
1175 1175
 ```
1176
-' . $teampass_errors . '
1176
+' . $teampass_errors.'
1177 1177
 ```
1178 1178
 
1179 1179
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
         // Check if user exists
1202 1202
         $userInfo = DB::queryFirstRow(
1203 1203
             'SELECT public_key, private_key, pw, auth_type
1204
-            FROM ' . prefixTable('users') . '
1204
+            FROM ' . prefixTable('users').'
1205 1205
             WHERE id = %i',
1206 1206
             $post_user_id
1207 1207
         );
@@ -1209,14 +1209,14 @@  discard block
 block discarded – undo
1209 1209
             // Get one item
1210 1210
             $record = DB::queryFirstRow(
1211 1211
                 'SELECT id, pw
1212
-                FROM ' . prefixTable('items') . '
1212
+                FROM ' . prefixTable('items').'
1213 1213
                 WHERE perso = 0'
1214 1214
             );
1215 1215
 
1216 1216
             // Get itemKey from current user
1217 1217
             $currentUserKey = DB::queryFirstRow(
1218 1218
                 'SELECT share_key, increment_id
1219
-                FROM ' . prefixTable('sharekeys_items') . '
1219
+                FROM ' . prefixTable('sharekeys_items').'
1220 1220
                 WHERE object_id = %i AND user_id = %i',
1221 1221
                 $record['id'],
1222 1222
                 $post_user_id
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
             
1245 1245
             // Use the password check
1246 1246
             // load passwordLib library
1247
-            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1247
+            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1248 1248
             $pwdlib->register();
1249 1249
             $pwdlib = new PasswordLib\PasswordLib();
1250 1250
             
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
         // Get user info
1289 1289
         $userData = DB::queryFirstRow(
1290 1290
             'SELECT private_key
1291
-            FROM ' . prefixTable('users') . '
1291
+            FROM ' . prefixTable('users').'
1292 1292
             WHERE id = %i',
1293 1293
             $post_user_id
1294 1294
         );
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
             );
1316 1316
 
1317 1317
             // Load superGlobals
1318
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1318
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1319 1319
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
1320 1320
 
1321 1321
             $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
         // Get user info
1354 1354
         $userData = DB::queryFirstRow(
1355 1355
             'SELECT email, auth_type, login
1356
-            FROM ' . prefixTable('users') . '
1356
+            FROM ' . prefixTable('users').'
1357 1357
             WHERE id = %i',
1358 1358
             $post_user_id
1359 1359
         );
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
         // Get user info
1488 1488
         $userData = DB::queryFirstRow(
1489 1489
             'SELECT email, auth_type, login
1490
-            FROM ' . prefixTable('users') . '
1490
+            FROM ' . prefixTable('users').'
1491 1491
             WHERE id = %i',
1492 1492
             $post_user_id
1493 1493
         );
@@ -1550,13 +1550,13 @@  discard block
 block discarded – undo
1550 1550
         // Check if user exists
1551 1551
         DB::queryFirstRow(
1552 1552
             'SELECT *
1553
-            FROM ' . prefixTable('users') . '
1553
+            FROM ' . prefixTable('users').'
1554 1554
             WHERE id = %i',
1555 1555
             $post_user_id
1556 1556
         );
1557 1557
         if (DB::count() > 0) {
1558 1558
             // Include libraries
1559
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1559
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1560 1560
 
1561 1561
             // CLear old sharekeys
1562 1562
             if ($post_self_change === false) {
@@ -1608,13 +1608,13 @@  discard block
 block discarded – undo
1608 1608
         // Check if user exists
1609 1609
         $userInfo = DB::queryFirstRow(
1610 1610
             'SELECT public_key
1611
-            FROM ' . prefixTable('users') . '
1611
+            FROM ' . prefixTable('users').'
1612 1612
             WHERE id = %i',
1613 1613
             $post_user_id
1614 1614
         );
1615 1615
         if (DB::count() > 0) {
1616 1616
             // Include libraries
1617
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1617
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1618 1618
 
1619 1619
             // WHAT STEP TO PERFORM?
1620 1620
             if ($post_action === 'step0') {
@@ -1773,15 +1773,15 @@  discard block
 block discarded – undo
1773 1773
     // Loop on items
1774 1774
     $rows = DB::query(
1775 1775
         'SELECT id, pw
1776
-        FROM ' . prefixTable('items') . '
1776
+        FROM ' . prefixTable('items').'
1777 1777
         WHERE perso = 0
1778
-        LIMIT ' . $post_start . ', ' . $post_length
1778
+        LIMIT ' . $post_start.', '.$post_length
1779 1779
     );
1780 1780
     foreach ($rows as $record) {
1781 1781
         // Get itemKey from current user
1782 1782
         $currentUserKey = DB::queryFirstRow(
1783 1783
             'SELECT share_key, increment_id
1784
-            FROM ' . prefixTable('sharekeys_items') . '
1784
+            FROM ' . prefixTable('sharekeys_items').'
1785 1785
             WHERE object_id = %i AND user_id = %i',
1786 1786
             $record['id'],
1787 1787
             $_SESSION['user_id']
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1810 1810
                 $currentUserKey = DB::queryFirstRow(
1811 1811
                     'SELECT increment_id
1812
-                    FROM ' . prefixTable('sharekeys_items') . '
1812
+                    FROM ' . prefixTable('sharekeys_items').'
1813 1813
                     WHERE object_id = %i AND user_id = %i',
1814 1814
                     $record['id'],
1815 1815
                     $post_user_id
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
     // SHould we change step?
1843 1843
     DB::query(
1844 1844
         'SELECT *
1845
-        FROM ' . prefixTable('items') . '
1845
+        FROM ' . prefixTable('items').'
1846 1846
         WHERE perso = 0'
1847 1847
     );
1848 1848
 
@@ -1866,15 +1866,15 @@  discard block
 block discarded – undo
1866 1866
     // Loop on logs
1867 1867
     $rows = DB::query(
1868 1868
         'SELECT increment_id
1869
-        FROM ' . prefixTable('log_items') . '
1869
+        FROM ' . prefixTable('log_items').'
1870 1870
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
1871
-        LIMIT ' . $post_start . ', ' . $post_length
1871
+        LIMIT ' . $post_start.', '.$post_length
1872 1872
     );
1873 1873
     foreach ($rows as $record) {
1874 1874
         // Get itemKey from current user
1875 1875
         $currentUserKey = DB::queryFirstRow(
1876 1876
             'SELECT share_key
1877
-            FROM ' . prefixTable('sharekeys_logs') . '
1877
+            FROM ' . prefixTable('sharekeys_logs').'
1878 1878
             WHERE object_id = %i AND user_id = %i',
1879 1879
             $record['increment_id'],
1880 1880
             $_SESSION['user_id']
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1902 1902
                 $currentUserKey = DB::queryFirstRow(
1903 1903
                     'SELECT increment_id
1904
-                    FROM ' . prefixTable('sharekeys_items') . '
1904
+                    FROM ' . prefixTable('sharekeys_items').'
1905 1905
                     WHERE object_id = %i AND user_id = %i',
1906 1906
                     $record['id'],
1907 1907
                     $post_user_id
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
     // SHould we change step?
1924 1924
     DB::query(
1925 1925
         'SELECT increment_id
1926
-        FROM ' . prefixTable('log_items') . '
1926
+        FROM ' . prefixTable('log_items').'
1927 1927
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
1928 1928
     );
1929 1929
 
@@ -1947,15 +1947,15 @@  discard block
 block discarded – undo
1947 1947
     // Loop on fields
1948 1948
     $rows = DB::query(
1949 1949
         'SELECT id
1950
-        FROM ' . prefixTable('categories_items') . '
1950
+        FROM ' . prefixTable('categories_items').'
1951 1951
         WHERE encryption_type = "teampass_aes"
1952
-        LIMIT ' . $post_start . ', ' . $post_length
1952
+        LIMIT ' . $post_start.', '.$post_length
1953 1953
     );
1954 1954
     foreach ($rows as $record) {
1955 1955
         // Get itemKey from current user
1956 1956
         $currentUserKey = DB::queryFirstRow(
1957 1957
             'SELECT share_key
1958
-            FROM ' . prefixTable('sharekeys_fields') . '
1958
+            FROM ' . prefixTable('sharekeys_fields').'
1959 1959
             WHERE object_id = %i AND user_id = %i',
1960 1960
             $record['id'],
1961 1961
             $_SESSION['user_id']
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1983 1983
                 $currentUserKey = DB::queryFirstRow(
1984 1984
                     'SELECT increment_id
1985
-                    FROM ' . prefixTable('sharekeys_items') . '
1985
+                    FROM ' . prefixTable('sharekeys_items').'
1986 1986
                     WHERE object_id = %i AND user_id = %i',
1987 1987
                     $record['id'],
1988 1988
                     $post_user_id
@@ -2004,7 +2004,7 @@  discard block
 block discarded – undo
2004 2004
     // SHould we change step?
2005 2005
     DB::query(
2006 2006
         'SELECT *
2007
-        FROM ' . prefixTable('categories_items') . '
2007
+        FROM ' . prefixTable('categories_items').'
2008 2008
         WHERE encryption_type = "teampass_aes"'
2009 2009
     );
2010 2010
 
@@ -2028,14 +2028,14 @@  discard block
 block discarded – undo
2028 2028
     // Loop on suggestions
2029 2029
     $rows = DB::query(
2030 2030
         'SELECT id
2031
-        FROM ' . prefixTable('suggestion') . '
2032
-        LIMIT ' . $post_start . ', ' . $post_length
2031
+        FROM ' . prefixTable('suggestion').'
2032
+        LIMIT ' . $post_start.', '.$post_length
2033 2033
     );
2034 2034
     foreach ($rows as $record) {
2035 2035
         // Get itemKey from current user
2036 2036
         $currentUserKey = DB::queryFirstRow(
2037 2037
             'SELECT share_key
2038
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2038
+            FROM ' . prefixTable('sharekeys_suggestions').'
2039 2039
             WHERE object_id = %i AND user_id = %i',
2040 2040
             $record['id'],
2041 2041
             $_SESSION['user_id']
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2063 2063
                 $currentUserKey = DB::queryFirstRow(
2064 2064
                     'SELECT increment_id
2065
-                    FROM ' . prefixTable('sharekeys_items') . '
2065
+                    FROM ' . prefixTable('sharekeys_items').'
2066 2066
                     WHERE object_id = %i AND user_id = %i',
2067 2067
                     $record['id'],
2068 2068
                     $post_user_id
@@ -2107,15 +2107,15 @@  discard block
 block discarded – undo
2107 2107
     // Loop on files
2108 2108
     $rows = DB::query(
2109 2109
         'SELECT id
2110
-        FROM ' . prefixTable('files') . '
2111
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2112
-        LIMIT ' . $post_start . ', ' . $post_length
2110
+        FROM ' . prefixTable('files').'
2111
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2112
+        LIMIT ' . $post_start.', '.$post_length
2113 2113
     ); //aes_encryption
2114 2114
     foreach ($rows as $record) {
2115 2115
         // Get itemKey from current user
2116 2116
         $currentUserKey = DB::queryFirstRow(
2117 2117
             'SELECT share_key
2118
-            FROM ' . prefixTable('sharekeys_files') . '
2118
+            FROM ' . prefixTable('sharekeys_files').'
2119 2119
             WHERE object_id = %i AND user_id = %i',
2120 2120
             $record['id'],
2121 2121
             $_SESSION['user_id']
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2143 2143
                 $currentUserKey = DB::queryFirstRow(
2144 2144
                     'SELECT increment_id
2145
-                    FROM ' . prefixTable('sharekeys_items') . '
2145
+                    FROM ' . prefixTable('sharekeys_items').'
2146 2146
                     WHERE object_id = %i AND user_id = %i',
2147 2147
                     $record['id'],
2148 2148
                     $post_user_id
@@ -2164,8 +2164,8 @@  discard block
 block discarded – undo
2164 2164
     // SHould we change step?
2165 2165
     DB::query(
2166 2166
         'SELECT *
2167
-        FROM ' . prefixTable('files') . '
2168
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2167
+        FROM ' . prefixTable('files').'
2168
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2169 2169
     );
2170 2170
 
2171 2171
     $next_start = (int) $post_start + (int) $post_length;
@@ -2197,16 +2197,16 @@  discard block
 block discarded – undo
2197 2197
     if (count($_SESSION['personal_folders']) > 0) {
2198 2198
         $rows = DB::query(
2199 2199
             'SELECT id, pw
2200
-            FROM ' . prefixTable('items') . '
2200
+            FROM ' . prefixTable('items').'
2201 2201
             WHERE perso = 1 AND id_tree IN %ls
2202
-            LIMIT ' . $post_start . ', ' . $post_length,
2202
+            LIMIT ' . $post_start.', '.$post_length,
2203 2203
             $_SESSION['personal_folders']
2204 2204
         );
2205 2205
         foreach ($rows as $record) {
2206 2206
             // Get itemKey from current user
2207 2207
             $currentUserKey = DB::queryFirstRow(
2208 2208
                 'SELECT share_key, increment_id
2209
-                FROM ' . prefixTable('sharekeys_items') . '
2209
+                FROM ' . prefixTable('sharekeys_items').'
2210 2210
                 WHERE object_id = %i AND user_id = %i',
2211 2211
                 $record['id'],
2212 2212
                 $_SESSION['user_id']
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2234 2234
                     $currentUserKey = DB::queryFirstRow(
2235 2235
                         'SELECT increment_id
2236
-                        FROM ' . prefixTable('sharekeys_items') . '
2236
+                        FROM ' . prefixTable('sharekeys_items').'
2237 2237
                         WHERE object_id = %i AND user_id = %i',
2238 2238
                         $record['id'],
2239 2239
                         $post_user_id
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
     // SHould we change step?
2257 2257
     DB::query(
2258 2258
         'SELECT *
2259
-        FROM ' . prefixTable('items') . '
2259
+        FROM ' . prefixTable('items').'
2260 2260
         WHERE perso = 0'
2261 2261
     );
2262 2262
 
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
         // Check if user exists
2281 2281
         $userInfo = DB::queryFirstRow(
2282 2282
             'SELECT public_key, encrypted_psk
2283
-            FROM ' . prefixTable('users') . '
2283
+            FROM ' . prefixTable('users').'
2284 2284
             WHERE id = %i',
2285 2285
             $post_user_id
2286 2286
         );
@@ -2305,9 +2305,9 @@  discard block
 block discarded – undo
2305 2305
                 // Loop on persoanl items
2306 2306
                 $rows = DB::query(
2307 2307
                     'SELECT id, pw
2308
-                    FROM ' . prefixTable('items') . '
2308
+                    FROM ' . prefixTable('items').'
2309 2309
                     WHERE perso = 1 AND id_tree IN %ls
2310
-                    LIMIT ' . $post_start . ', ' . $post_length,
2310
+                    LIMIT ' . $post_start.', '.$post_length,
2311 2311
                     $_SESSION['personal_folders']
2312 2312
                 );
2313 2313
                 $countUserPersonalItems = DB::count();
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
                         // Loop on files
2351 2351
                         $rows = DB::query(
2352 2352
                             'SELECT id, file
2353
-                            FROM ' . prefixTable('files') . '
2353
+                            FROM ' . prefixTable('files').'
2354 2354
                             WHERE status != %s
2355 2355
                             AND id_item = %i',
2356 2356
                             TP_ENCRYPTION_NAME,
@@ -2361,14 +2361,14 @@  discard block
 block discarded – undo
2361 2361
                             // Now decrypt the file
2362 2362
                             prepareFileWithDefuse(
2363 2363
                                 'decrypt',
2364
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2365
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2364
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2365
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2366 2366
                                 $SETTINGS,
2367 2367
                                 $post_user_psk
2368 2368
                             );
2369 2369
 
2370 2370
                             // Encrypt the file
2371
-                            $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2371
+                            $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2372 2372
 
2373 2373
                             DB::update(
2374 2374
                                 prefixTable('files'),
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
                             );
2392 2392
 
2393 2393
                             // Unlink original file
2394
-                            unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2394
+                            unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2395 2395
                         }
2396 2396
                     }
2397 2397
                 }
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
         // Get user info
2461 2461
         $userData = DB::queryFirstRow(
2462 2462
             'SELECT '.$post_fields.'
2463
-            FROM ' . prefixTable('users') . '
2463
+            FROM ' . prefixTable('users').'
2464 2464
             WHERE id = %i',
2465 2465
             $post_user_id
2466 2466
         );
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
         // Get user info
2496 2496
         $userData = DB::queryFirstRow(
2497 2497
             'SELECT auth_type, login, private_key
2498
-            FROM ' . prefixTable('users') . '
2498
+            FROM ' . prefixTable('users').'
2499 2499
             WHERE id = %i',
2500 2500
             $post_user_id
2501 2501
         );
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
             $privateKey = decryptPrivateKey($post_current_pwd, $userData['private_key']);
2507 2507
 
2508 2508
             // Load superGlobals
2509
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2509
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2510 2510
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
2511 2511
 
2512 2512
             if ($superGlobal->get('private_key', 'SESSION', 'user') === $privateKey) {
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
                 return prepareExchangedData(
2540 2540
                     array(
2541 2541
                         'error' => false,
2542
-                        'message' => langHdl('done'),'',
2542
+                        'message' => langHdl('done'), '',
2543 2543
                     ),
2544 2544
                     'encode'
2545 2545
                 );
@@ -2577,7 +2577,7 @@  discard block
 block discarded – undo
2577 2577
         // Get user info
2578 2578
         $userData = DB::queryFirstRow(
2579 2579
             'SELECT auth_type, login, private_key, special
2580
-            FROM ' . prefixTable('users') . '
2580
+            FROM ' . prefixTable('users').'
2581 2581
             WHERE id = %i',
2582 2582
             $post_user_id
2583 2583
         );
@@ -2607,14 +2607,14 @@  discard block
 block discarded – undo
2607 2607
                 );
2608 2608
 
2609 2609
                 // Load superGlobals
2610
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2610
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2611 2611
                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
2612 2612
                 $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2613 2613
 
2614 2614
                 return prepareExchangedData(
2615 2615
                     array(
2616 2616
                         'error' => false,
2617
-                        'message' => langHdl('done'),'',
2617
+                        'message' => langHdl('done'), '',
2618 2618
                     ),
2619 2619
                     'encode'
2620 2620
                 );
@@ -2638,14 +2638,14 @@  discard block
 block discarded – undo
2638 2638
             // Get one item
2639 2639
             $record = DB::queryFirstRow(
2640 2640
                 'SELECT id, pw
2641
-                FROM ' . prefixTable('items') . '
2641
+                FROM ' . prefixTable('items').'
2642 2642
                 WHERE perso = 0'
2643 2643
             );
2644 2644
 
2645 2645
             // Get itemKey from current user
2646 2646
             $currentUserKey = DB::queryFirstRow(
2647 2647
                 'SELECT share_key, increment_id
2648
-                FROM ' . prefixTable('sharekeys_items') . '
2648
+                FROM ' . prefixTable('sharekeys_items').'
2649 2649
                 WHERE object_id = %i AND user_id = %i',
2650 2650
                 $record['id'],
2651 2651
                 $post_user_id
@@ -2673,7 +2673,7 @@  discard block
 block discarded – undo
2673 2673
                     );
2674 2674
                     
2675 2675
                     // Load superGlobals
2676
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2676
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2677 2677
                     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2678 2678
                     $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2679 2679
 
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
             $_SESSION['user_id']
2728 2728
         );
2729 2729
         // Return data
2730
-        return '[{"new_value":"' . $_SESSION['sessionDuration'] . '"}]';
2730
+        return '[{"new_value":"'.$_SESSION['sessionDuration'].'"}]';
2731 2731
     }
2732 2732
     
2733 2733
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
sources/main.functions.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
 
134 134
     // Check if class already exists
135 135
     if (!class_exists('Defuse\Crypto\Crypto', false)) {
136
-		include_once $path . 'Crypto.php';
137
-		include_once $path . 'Encoding.php';
138
-		include_once $path . 'DerivedKeys.php';
139
-		include_once $path . 'Key.php';
140
-		include_once $path . 'KeyOrPassword.php';
141
-		include_once $path . 'File.php';
142
-		include_once $path . 'RuntimeTests.php';
143
-		include_once $path . 'KeyProtectedByPassword.php';
144
-		include_once $path . 'Core.php';
145
-	}
136
+        include_once $path . 'Crypto.php';
137
+        include_once $path . 'Encoding.php';
138
+        include_once $path . 'DerivedKeys.php';
139
+        include_once $path . 'Key.php';
140
+        include_once $path . 'KeyOrPassword.php';
141
+        include_once $path . 'File.php';
142
+        include_once $path . 'RuntimeTests.php';
143
+        include_once $path . 'KeyProtectedByPassword.php';
144
+        include_once $path . 'Core.php';
145
+    }
146 146
     
147 147
     // convert KEY
148 148
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -2236,7 +2236,7 @@  discard block
 block discarded – undo
2236 2236
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2237 2237
  *
2238 2238
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2239
-  *
2239
+ *
2240 2240
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2241 2241
  * @param int    $filePerm The permissions any found files should get.
2242 2242
  * @param int    $dirPerm  The permissions any found folder should get.
Please login to merge, or discard this patch.
Spacing   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
124 124
 {
125
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
125
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
126 126
     $err = false;
127 127
     // load PhpEncryption library
128 128
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
129 129
         $path = '../includes/libraries/Encryption/Encryption/';
130 130
     } else {
131
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
131
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
132 132
     }
133 133
 
134 134
     // Check if class already exists
135 135
     if (!class_exists('Defuse\Crypto\Crypto', false)) {
136
-		include_once $path . 'Crypto.php';
137
-		include_once $path . 'Encoding.php';
138
-		include_once $path . 'DerivedKeys.php';
139
-		include_once $path . 'Key.php';
140
-		include_once $path . 'KeyOrPassword.php';
141
-		include_once $path . 'File.php';
142
-		include_once $path . 'RuntimeTests.php';
143
-		include_once $path . 'KeyProtectedByPassword.php';
144
-		include_once $path . 'Core.php';
136
+		include_once $path.'Crypto.php';
137
+		include_once $path.'Encoding.php';
138
+		include_once $path.'DerivedKeys.php';
139
+		include_once $path.'Key.php';
140
+		include_once $path.'KeyOrPassword.php';
141
+		include_once $path.'File.php';
142
+		include_once $path.'RuntimeTests.php';
143
+		include_once $path.'KeyProtectedByPassword.php';
144
+		include_once $path.'Core.php';
145 145
 	}
146 146
     
147 147
     // convert KEY
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
         $path = '../includes/libraries/Encryption/Encryption/';
188 188
     }
189 189
 
190
-    include_once $path . 'Crypto.php';
191
-    include_once $path . 'Encoding.php';
192
-    include_once $path . 'DerivedKeys.php';
193
-    include_once $path . 'Key.php';
194
-    include_once $path . 'KeyOrPassword.php';
195
-    include_once $path . 'File.php';
196
-    include_once $path . 'RuntimeTests.php';
197
-    include_once $path . 'KeyProtectedByPassword.php';
198
-    include_once $path . 'Core.php';
190
+    include_once $path.'Crypto.php';
191
+    include_once $path.'Encoding.php';
192
+    include_once $path.'DerivedKeys.php';
193
+    include_once $path.'Key.php';
194
+    include_once $path.'KeyOrPassword.php';
195
+    include_once $path.'File.php';
196
+    include_once $path.'RuntimeTests.php';
197
+    include_once $path.'KeyProtectedByPassword.php';
198
+    include_once $path.'Core.php';
199 199
     $key = \Defuse\Crypto\Key::createNewRandomKey();
200 200
     $key = $key->saveToAsciiSafeString();
201 201
     return $key;
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
         $path = '../includes/libraries/Encryption/Encryption/';
218 218
     }
219 219
 
220
-    include_once $path . 'Crypto.php';
221
-    include_once $path . 'Encoding.php';
222
-    include_once $path . 'DerivedKeys.php';
223
-    include_once $path . 'Key.php';
224
-    include_once $path . 'KeyOrPassword.php';
225
-    include_once $path . 'File.php';
226
-    include_once $path . 'RuntimeTests.php';
227
-    include_once $path . 'KeyProtectedByPassword.php';
228
-    include_once $path . 'Core.php';
220
+    include_once $path.'Crypto.php';
221
+    include_once $path.'Encoding.php';
222
+    include_once $path.'DerivedKeys.php';
223
+    include_once $path.'Key.php';
224
+    include_once $path.'KeyOrPassword.php';
225
+    include_once $path.'File.php';
226
+    include_once $path.'RuntimeTests.php';
227
+    include_once $path.'KeyProtectedByPassword.php';
228
+    include_once $path.'Core.php';
229 229
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
230 230
     return $protected_key->saveToAsciiSafeString(); // save this in user table
231 231
 }
@@ -247,15 +247,15 @@  discard block
 block discarded – undo
247 247
         $path = '../includes/libraries/Encryption/Encryption/';
248 248
     }
249 249
 
250
-    include_once $path . 'Crypto.php';
251
-    include_once $path . 'Encoding.php';
252
-    include_once $path . 'DerivedKeys.php';
253
-    include_once $path . 'Key.php';
254
-    include_once $path . 'KeyOrPassword.php';
255
-    include_once $path . 'File.php';
256
-    include_once $path . 'RuntimeTests.php';
257
-    include_once $path . 'KeyProtectedByPassword.php';
258
-    include_once $path . 'Core.php';
250
+    include_once $path.'Crypto.php';
251
+    include_once $path.'Encoding.php';
252
+    include_once $path.'DerivedKeys.php';
253
+    include_once $path.'Key.php';
254
+    include_once $path.'KeyOrPassword.php';
255
+    include_once $path.'File.php';
256
+    include_once $path.'RuntimeTests.php';
257
+    include_once $path.'KeyProtectedByPassword.php';
258
+    include_once $path.'Core.php';
259 259
     try {
260 260
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
261 261
         $user_key = $protected_key->unlockKey($psk);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function trimElement($chaine, string $element): string
296 296
 {
297
-    if (! empty($chaine)) {
297
+    if (!empty($chaine)) {
298 298
         if (is_array($chaine) === true) {
299 299
             $chaine = implode(';', $chaine);
300 300
         }
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
  */
341 341
 function db_error_handler(array $params): void
342 342
 {
343
-    echo 'Error: ' . $params['error'] . "<br>\n";
344
-    echo 'Query: ' . $params['query'] . "<br>\n";
343
+    echo 'Error: '.$params['error']."<br>\n";
344
+    echo 'Query: '.$params['query']."<br>\n";
345 345
     throw new Exception('Error - Query', 1);
346 346
 }
347 347
 
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
     $SETTINGS
364 364
 ) {
365 365
     //load ClassLoader
366
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
366
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
367 367
     // Load superglobal
368
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
368
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
369 369
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
370 370
     //Connect to DB
371
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
371
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
372 372
     if (defined('DB_PASSWD_CLEAR') === false) {
373 373
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
374 374
     }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     DB::$port = DB_PORT;
380 380
     DB::$encoding = DB_ENCODING;
381 381
     //Build tree
382
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
382
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
383 383
     $tree->register();
384 384
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
385 385
     // Check if user is ADMINISTRATOR
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 function identAdmin($idFonctions, $SETTINGS, $tree)
423 423
 {
424 424
     // Load superglobal
425
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
425
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
426 426
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
427 427
     // Init
428 428
     $groupesVisibles = [];
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
442 442
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
443 443
     // Get list of Folders
444
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
444
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
445 445
     foreach ($rows as $record) {
446 446
         array_push($groupesVisibles, $record['id']);
447 447
     }
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
     }
461 461
     // Get ID of personal folder
462 462
     $persfld = DB::queryfirstrow(
463
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
463
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
464 464
         $globalsUserId
465 465
     );
466 466
     if (empty($persfld['id']) === false) {
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
     // get complete list of ROLES
482 482
     $tmp = explode(';', $idFonctions);
483 483
     $rows = DB::query(
484
-        'SELECT * FROM ' . prefixTable('roles_title') . '
484
+        'SELECT * FROM '.prefixTable('roles_title').'
485 485
         ORDER BY title ASC'
486 486
     );
487 487
     foreach ($rows as $record) {
488
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
488
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
489 489
             array_push($tmp, $record['id']);
490 490
         }
491 491
     }
492 492
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
493 493
     $superGlobal->put('is_admin', 1, 'SESSION');
494 494
     // Check if admin has created Folders and Roles
495
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
495
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
496 496
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
497
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
497
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
498 498
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
499 499
 }
500 500
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     object $tree
537 537
 ) {
538 538
     // Load superglobal
539
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
539
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
540 540
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
541 541
     // Init
542 542
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
     // Get list of folders depending on Roles
565 565
     $rows = DB::query(
566 566
         'SELECT *
567
-        FROM ' . prefixTable('roles_values') . '
567
+        FROM ' . prefixTable('roles_values').'
568 568
         WHERE role_id IN %li AND type IN %ls',
569 569
         $userRoles,
570 570
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -589,10 +589,10 @@  discard block
 block discarded – undo
589 589
     // Does this user is allowed to see other items
590 590
     $inc = 0;
591 591
     $rows = DB::query(
592
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
592
+        'SELECT id, id_tree FROM '.prefixTable('items').'
593 593
             WHERE restricted_to LIKE %ss AND inactif = %s'.
594 594
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
595
-        $globalsUserId . ';',
595
+        $globalsUserId.';',
596 596
         '0'
597 597
     );
598 598
     foreach ($rows as $record) {
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
     // Check for the users roles if some specific rights exist on items
607 607
     $rows = DB::query(
608 608
         'SELECT i.id_tree, r.item_id
609
-        FROM ' . prefixTable('items') . ' as i
610
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
609
+        FROM ' . prefixTable('items').' as i
610
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
611 611
         WHERE r.role_id IN %li AND i.id_tree <> ""
612 612
         ORDER BY i.id_tree ASC',
613 613
         $userRoles
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
     ) {
629 629
         $persoFld = DB::queryfirstrow(
630 630
             'SELECT id
631
-            FROM ' . prefixTable('nested_tree') . '
631
+            FROM ' . prefixTable('nested_tree').'
632 632
             WHERE title = %s AND personal_folder = %i'.
633 633
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
634 634
             $globalsUserId,
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     }
663 663
     $persoFlds = DB::query(
664 664
         'SELECT id
665
-        FROM ' . prefixTable('nested_tree') . '
665
+        FROM ' . prefixTable('nested_tree').'
666 666
         WHERE %l',
667 667
         $where
668 668
     );
@@ -704,16 +704,16 @@  discard block
 block discarded – undo
704 704
         'SESSION'
705 705
     );
706 706
     // Folders and Roles numbers
707
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
707
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
708 708
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
709
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
709
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
710 710
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
711 711
     // check if change proposals on User's items
712 712
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
713 713
         DB::query(
714 714
             'SELECT *
715
-            FROM ' . prefixTable('items_change') . ' AS c
716
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
715
+            FROM ' . prefixTable('items_change').' AS c
716
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
717 717
             WHERE i.action = %s AND i.id_user = %i',
718 718
             'at_creation',
719 719
             $globalsUserId
@@ -757,9 +757,9 @@  discard block
 block discarded – undo
757 757
  */
758 758
 function cacheTableRefresh(array $SETTINGS): void
759 759
 {
760
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
760
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
761 761
     //Connect to DB
762
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
762
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
763 763
     if (defined('DB_PASSWD_CLEAR') === false) {
764 764
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
765 765
     }
@@ -774,12 +774,12 @@  discard block
 block discarded – undo
774 774
     $tree->register();
775 775
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
776 776
     // truncate table
777
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
777
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
778 778
     // reload date
779 779
     $rows = DB::query(
780 780
         'SELECT *
781
-        FROM ' . prefixTable('items') . ' as i
782
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
781
+        FROM ' . prefixTable('items').' as i
782
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
783 783
         AND l.action = %s
784 784
         AND i.inactif = %i',
785 785
         'at_creation',
@@ -791,18 +791,18 @@  discard block
 block discarded – undo
791 791
             $tags = '';
792 792
             $itemTags = DB::query(
793 793
                 'SELECT tag
794
-                            FROM ' . prefixTable('tags') . '
794
+                            FROM ' . prefixTable('tags').'
795 795
                             WHERE item_id = %i AND tag != ""',
796 796
                 $record['id']
797 797
             );
798 798
             foreach ($itemTags as $itemTag) {
799
-                $tags .= $itemTag['tag'] . ' ';
799
+                $tags .= $itemTag['tag'].' ';
800 800
             }
801 801
 
802 802
             // Get renewal period
803 803
             $resNT = DB::queryfirstrow(
804 804
                 'SELECT renewal_period
805
-                FROM ' . prefixTable('nested_tree') . '
805
+                FROM ' . prefixTable('nested_tree').'
806 806
                 WHERE id = %i',
807 807
                 $record['id_tree']
808 808
             );
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
                     // Is this a User id?
816 816
                     $user = DB::queryfirstrow(
817 817
                         'SELECT id, login
818
-                        FROM ' . prefixTable('users') . '
818
+                        FROM ' . prefixTable('users').'
819 819
                         WHERE id = %i',
820 820
                         $elem->title
821 821
                     );
@@ -833,11 +833,11 @@  discard block
 block discarded – undo
833 833
                     'id' => $record['id'],
834 834
                     'label' => $record['label'],
835 835
                     'description' => $record['description'] ?? '',
836
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
836
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
837 837
                     'tags' => $tags,
838 838
                     'id_tree' => $record['id_tree'],
839 839
                     'perso' => $record['perso'],
840
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
840
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
841 841
                     'login' => $record['login'] ?? '',
842 842
                     'folder' => implode(' > ', $folder),
843 843
                     'author' => $record['id_user'],
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
  */
858 858
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
859 859
 {
860
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
860
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
861 861
     // Load superglobal
862
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
862
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
863 863
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
864 864
     //Connect to DB
865
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
865
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
866 866
     if (defined('DB_PASSWD_CLEAR') === false) {
867 867
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
868 868
     }
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
     // get new value from db
880 880
     $data = DB::queryfirstrow(
881 881
         'SELECT label, description, id_tree, perso, restricted_to, login, url
882
-        FROM ' . prefixTable('items') . '
882
+        FROM ' . prefixTable('items').'
883 883
         WHERE id=%i',
884 884
         $ident
885 885
     );
@@ -887,12 +887,12 @@  discard block
 block discarded – undo
887 887
     $tags = '';
888 888
     $itemTags = DB::query(
889 889
         'SELECT tag
890
-            FROM ' . prefixTable('tags') . '
890
+            FROM ' . prefixTable('tags').'
891 891
             WHERE item_id = %i AND tag != ""',
892 892
         $ident
893 893
     );
894 894
     foreach ($itemTags as $itemTag) {
895
-        $tags .= $itemTag['tag'] . ' ';
895
+        $tags .= $itemTag['tag'].' ';
896 896
     }
897 897
     // form id_tree to full foldername
898 898
     $folder = [];
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
             // Is this a User id?
904 904
             $user = DB::queryfirstrow(
905 905
                 'SELECT id, login
906
-                FROM ' . prefixTable('users') . '
906
+                FROM ' . prefixTable('users').'
907 907
                 WHERE id = %i',
908 908
                 $elem->title
909 909
             );
@@ -921,10 +921,10 @@  discard block
 block discarded – undo
921 921
             'label' => $data['label'],
922 922
             'description' => $data['description'],
923 923
             'tags' => $tags,
924
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
924
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
925 925
             'id_tree' => $data['id_tree'],
926 926
             'perso' => $data['perso'],
927
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
927
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
928 928
             'login' => $data['login'] ?? '',
929 929
             'folder' => implode(' » ', $folder),
930 930
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -942,14 +942,14 @@  discard block
 block discarded – undo
942 942
  */
943 943
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
944 944
 {
945
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
945
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
946 946
     // Load superglobal
947
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
947
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
948 948
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
949 949
     // Get superglobals
950 950
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
951 951
     //Connect to DB
952
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
952
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
953 953
     if (defined('DB_PASSWD_CLEAR') === false) {
954 954
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
955 955
     }
@@ -966,8 +966,8 @@  discard block
 block discarded – undo
966 966
     // get new value from db
967 967
     $data = DB::queryFirstRow(
968 968
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
969
-        FROM ' . prefixTable('items') . ' as i
970
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
969
+        FROM ' . prefixTable('items').' as i
970
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
971 971
         WHERE i.id = %i
972 972
         AND l.action = %s',
973 973
         $ident,
@@ -977,12 +977,12 @@  discard block
 block discarded – undo
977 977
     $tags = '';
978 978
     $itemTags = DB::query(
979 979
         'SELECT tag
980
-            FROM ' . prefixTable('tags') . '
980
+            FROM ' . prefixTable('tags').'
981 981
             WHERE item_id = %i AND tag != ""',
982 982
         $ident
983 983
     );
984 984
     foreach ($itemTags as $itemTag) {
985
-        $tags .= $itemTag['tag'] . ' ';
985
+        $tags .= $itemTag['tag'].' ';
986 986
     }
987 987
     // form id_tree to full foldername
988 988
     $folder = [];
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
             // Is this a User id?
994 994
             $user = DB::queryfirstrow(
995 995
                 'SELECT id, login
996
-                FROM ' . prefixTable('users') . '
996
+                FROM ' . prefixTable('users').'
997 997
                 WHERE id = %i',
998 998
                 $elem->title
999 999
             );
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
             'label' => $data['label'],
1013 1013
             'description' => $data['description'],
1014 1014
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1015
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1015
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1016 1016
             'id_tree' => $data['id_tree'],
1017 1017
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1018 1018
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1034,52 +1034,52 @@  discard block
 block discarded – undo
1034 1034
 function getStatisticsData(array $SETTINGS): array
1035 1035
 {
1036 1036
     DB::query(
1037
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1037
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1038 1038
         0
1039 1039
     );
1040 1040
     $counter_folders = DB::count();
1041 1041
     DB::query(
1042
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1042
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1043 1043
         1
1044 1044
     );
1045 1045
     $counter_folders_perso = DB::count();
1046 1046
     DB::query(
1047
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1047
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1048 1048
         0
1049 1049
     );
1050 1050
     $counter_items = DB::count();
1051 1051
         DB::query(
1052
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1052
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1053 1053
         1
1054 1054
     );
1055 1055
     $counter_items_perso = DB::count();
1056 1056
         DB::query(
1057
-        'SELECT id FROM ' . prefixTable('users') . ''
1057
+        'SELECT id FROM '.prefixTable('users').''
1058 1058
     );
1059 1059
     $counter_users = DB::count();
1060 1060
         DB::query(
1061
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1061
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1062 1062
         1
1063 1063
     );
1064 1064
     $admins = DB::count();
1065 1065
     DB::query(
1066
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1066
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1067 1067
         1
1068 1068
     );
1069 1069
     $managers = DB::count();
1070 1070
     DB::query(
1071
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1071
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1072 1072
         1
1073 1073
     );
1074 1074
     $readOnly = DB::count();
1075 1075
     // list the languages
1076 1076
     $usedLang = [];
1077 1077
     $tp_languages = DB::query(
1078
-        'SELECT name FROM ' . prefixTable('languages')
1078
+        'SELECT name FROM '.prefixTable('languages')
1079 1079
     );
1080 1080
     foreach ($tp_languages as $tp_language) {
1081 1081
         DB::query(
1082
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1082
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1083 1083
             $tp_language['name']
1084 1084
         );
1085 1085
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1088,12 +1088,12 @@  discard block
 block discarded – undo
1088 1088
     // get list of ips
1089 1089
     $usedIp = [];
1090 1090
     $tp_ips = DB::query(
1091
-        'SELECT user_ip FROM ' . prefixTable('users')
1091
+        'SELECT user_ip FROM '.prefixTable('users')
1092 1092
     );
1093 1093
     foreach ($tp_ips as $ip) {
1094 1094
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1095 1095
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1096
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1096
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1097 1097
             $usedIp[$ip['user_ip']] = 1;
1098 1098
         }
1099 1099
     }
@@ -1159,21 +1159,21 @@  discard block
 block discarded – undo
1159 1159
     }
1160 1160
 
1161 1161
     // Load settings
1162
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1162
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1163 1163
     // Load superglobal
1164
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1164
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1165 1165
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1166 1166
     // Get user language
1167
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1167
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1168 1168
     // Load library
1169
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1169
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1170 1170
     // load PHPMailer
1171 1171
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1172 1172
     $mail->register();
1173 1173
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1174 1174
     try {
1175 1175
         // send to user
1176
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1176
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1177 1177
         $mail->SMTPDebug = 0;
1178 1178
         //value 1 can be used to debug - 4 for debuging connections
1179 1179
         $mail->Port = $SETTINGS['email_port'];
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
         <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;">
1266 1266
         <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;">
1267 1267
         <br><div style="float:right;">' .
1268
-        $textMail .
1268
+        $textMail.
1269 1269
         '<br><br></td></tr></table>
1270 1270
     </td></tr></table>
1271 1271
     <br></body></html>';
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
  */
1277 1277
 function generateKey(): string
1278 1278
 {
1279
-    return substr(md5(rand() . rand()), 0, 15);
1279
+    return substr(md5(rand().rand()), 0, 15);
1280 1280
 }
1281 1281
 
1282 1282
 /**
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 {
1348 1348
     array_walk_recursive(
1349 1349
         $array,
1350
-        static function (&$item): void {
1350
+        static function(&$item): void {
1351 1351
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1352 1352
                 $item = utf8_encode($item);
1353 1353
             }
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
     }
1383 1383
 
1384 1384
     // Load superglobal
1385
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1385
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1386 1386
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1387 1387
     // Get superglobals
1388 1388
     if ($key !== null) {
@@ -1393,9 +1393,9 @@  discard block
 block discarded – undo
1393 1393
     }
1394 1394
 
1395 1395
     //load ClassLoader
1396
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1396
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1397 1397
     //Load AES
1398
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1398
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1399 1399
     $aes->register();
1400 1400
     if ($type === 'encode' && is_array($data) === true) {
1401 1401
         // Ensure UTF8 format
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
  */
1483 1483
 function prefixTable(string $table): string
1484 1484
 {
1485
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1486
-    if (! empty($safeTable)) {
1485
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1486
+    if (!empty($safeTable)) {
1487 1487
         // sanitize string
1488 1488
         return $safeTable;
1489 1489
     }
@@ -1511,13 +1511,13 @@  discard block
 block discarded – undo
1511 1511
     bool $lowercase = false,
1512 1512
     array $SETTINGS = []
1513 1513
 ): string {
1514
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1515
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1514
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1515
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1516 1516
     $generator->register();
1517 1517
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1518 1518
     // Is PHP7 being used?
1519 1519
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1520
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1520
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1521 1521
         $php7generator->register();
1522 1522
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1523 1523
     }
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1548 1548
 {
1549 1549
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1550
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1550
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1551 1551
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1552 1552
     socket_close($sock);
1553 1553
 }
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
     }
1570 1570
 
1571 1571
     // include librairies & connect to DB
1572
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1572
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1573 1573
     if (defined('DB_PASSWD_CLEAR') === false) {
1574 1574
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1575 1575
     }
@@ -1593,14 +1593,14 @@  discard block
 block discarded – undo
1593 1593
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1594 1594
         if ($type === 'user_mngt') {
1595 1595
             send_syslog(
1596
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1596
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1597 1597
                 $SETTINGS['syslog_host'],
1598 1598
                 $SETTINGS['syslog_port'],
1599 1599
                 'teampass'
1600 1600
             );
1601 1601
         } else {
1602 1602
             send_syslog(
1603
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1603
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1604 1604
                 $SETTINGS['syslog_host'],
1605 1605
                 $SETTINGS['syslog_port'],
1606 1606
                 'teampass'
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
     ?string $encryption_type = null
1633 1633
 ): void {
1634 1634
     // include librairies & connect to DB
1635
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1635
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1636 1636
     if (defined('DB_PASSWD_CLEAR') === false) {
1637 1637
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1638 1638
     }
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
         if (empty($item_label) === true) {
1677 1677
             $dataItem = DB::queryfirstrow(
1678 1678
                 'SELECT id, id_tree, label
1679
-                FROM ' . prefixTable('items') . '
1679
+                FROM ' . prefixTable('items').'
1680 1680
                 WHERE id = %i',
1681 1681
                 $item_id
1682 1682
             );
@@ -1684,11 +1684,11 @@  discard block
 block discarded – undo
1684 1684
         }
1685 1685
 
1686 1686
         send_syslog(
1687
-            'action=' . str_replace('at_', '', $action) .
1688
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1689
-                ' itemno=' . $item_id .
1690
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1691
-                ' itemname="' . addslashes($item_label) . '"',
1687
+            'action='.str_replace('at_', '', $action).
1688
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1689
+                ' itemno='.$item_id.
1690
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1691
+                ' itemname="'.addslashes($item_label).'"',
1692 1692
             $SETTINGS['syslog_host'],
1693 1693
             $SETTINGS['syslog_port'],
1694 1694
             'teampass'
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
         && $action === 'at_shown'
1715 1715
     ) {
1716 1716
         // Load superglobal
1717
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1717
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1718 1718
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1719 1719
         // Get superglobals
1720 1720
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1723,7 +1723,7 @@  discard block
 block discarded – undo
1723 1723
         // Get info about item
1724 1724
         $dataItem = DB::queryfirstrow(
1725 1725
             'SELECT id, id_tree, label
1726
-            FROM ' . prefixTable('items') . '
1726
+            FROM ' . prefixTable('items').'
1727 1727
             WHERE id = %i',
1728 1728
             $item_id
1729 1729
         );
@@ -1737,9 +1737,9 @@  discard block
 block discarded – undo
1737 1737
                 'body' => str_replace(
1738 1738
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1739 1739
                     [
1740
-                        addslashes($globalsName . ' ' . $globalsLastname),
1740
+                        addslashes($globalsName.' '.$globalsLastname),
1741 1741
                         addslashes($item_label),
1742
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1742
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1743 1743
                     ],
1744 1744
                     langHdl('email_on_open_notification_mail')
1745 1745
                 ),
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1762 1762
 {
1763 1763
     // Load superglobal
1764
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1764
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1765 1765
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1766 1766
     // Get superglobals
1767 1767
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1771,8 +1771,8 @@  discard block
 block discarded – undo
1771 1771
     $notification = DB::queryOneColumn(
1772 1772
         'email',
1773 1773
         'SELECT *
1774
-        FROM ' . prefixTable('notification') . ' AS n
1775
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1774
+        FROM ' . prefixTable('notification').' AS n
1775
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1776 1776
         WHERE n.item_id = %i AND n.user_id != %i',
1777 1777
         $item_id,
1778 1778
         $globalsUserId
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
         // Get list of changes
1784 1784
         $htmlChanges = '<ul>';
1785 1785
         foreach ($changes as $change) {
1786
-            $htmlChanges .= '<li>' . $change . '</li>';
1786
+            $htmlChanges .= '<li>'.$change.'</li>';
1787 1787
         }
1788 1788
         $htmlChanges .= '</ul>';
1789 1789
         // send email
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1815 1815
 {
1816 1816
     // Class loader
1817
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1817
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1818 1818
     //Load Tree
1819 1819
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1820 1820
     $tree->register();
@@ -1823,15 +1823,15 @@  discard block
 block discarded – undo
1823 1823
     $path = '';
1824 1824
     foreach ($arbo as $elem) {
1825 1825
         if (empty($path) === true) {
1826
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1826
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1827 1827
         } else {
1828
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1828
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1829 1829
         }
1830 1830
     }
1831 1831
 
1832 1832
     // Build text to show user
1833 1833
     if (empty($label) === false) {
1834
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1834
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1835 1835
     }
1836 1836
     return empty($path) === true ? '' : $path;
1837 1837
 }
@@ -1886,9 +1886,9 @@  discard block
 block discarded – undo
1886 1886
  */
1887 1887
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1888 1888
 {
1889
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1889
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1890 1890
     // include librairies & connect to DB
1891
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1891
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1892 1892
     if (defined('DB_PASSWD_CLEAR') === false) {
1893 1893
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1894 1894
     }
@@ -1901,8 +1901,8 @@  discard block
 block discarded – undo
1901 1901
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1902 1902
         // perform a copy
1903 1903
         if (file_exists($tp_config_file)) {
1904
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1905
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1904
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1905
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1906 1906
             }
1907 1907
         }
1908 1908
 
@@ -1912,11 +1912,11 @@  discard block
 block discarded – undo
1912 1912
         $data[1] = "global \$SETTINGS;\n";
1913 1913
         $data[2] = "\$SETTINGS = array (\n";
1914 1914
         $rows = DB::query(
1915
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1915
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1916 1916
             'admin'
1917 1917
         );
1918 1918
         foreach ($rows as $record) {
1919
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
1919
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
1920 1920
         }
1921 1921
         array_push($data, ");\n");
1922 1922
         $data = array_unique($data);
@@ -1930,15 +1930,15 @@  discard block
 block discarded – undo
1930 1930
                 break;
1931 1931
             }
1932 1932
 
1933
-            if (stristr($line, "'" . $field . "' => '")) {
1934
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
1933
+            if (stristr($line, "'".$field."' => '")) {
1934
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
1935 1935
                 $bFound = true;
1936 1936
                 break;
1937 1937
             }
1938 1938
             ++$inc;
1939 1939
         }
1940 1940
         if ($bFound === false) {
1941
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
1941
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
1942 1942
         }
1943 1943
     }
1944 1944
 
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
 {
1965 1965
     global $SETTINGS;
1966 1966
     /* LOAD CPASSMAN SETTINGS */
1967
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1967
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1968 1968
         $SETTINGS = [];
1969 1969
         $SETTINGS['duplicate_folder'] = 0;
1970 1970
         //by default, this is set to 0;
@@ -1974,7 +1974,7 @@  discard block
 block discarded – undo
1974 1974
         //by default, this value is set to 5;
1975 1975
         $settings = [];
1976 1976
         $rows = DB::query(
1977
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1977
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1978 1978
             [
1979 1979
                 'type' => 'admin',
1980 1980
                 'type2' => 'settings',
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
     $source_cf = [];
2002 2002
     $rows = DB::QUERY(
2003 2003
         'SELECT id_category
2004
-            FROM ' . prefixTable('categories_folders') . '
2004
+            FROM ' . prefixTable('categories_folders').'
2005 2005
             WHERE id_folder = %i',
2006 2006
         $source_id
2007 2007
     );
@@ -2012,7 +2012,7 @@  discard block
 block discarded – undo
2012 2012
     $target_cf = [];
2013 2013
     $rows = DB::QUERY(
2014 2014
         'SELECT id_category
2015
-            FROM ' . prefixTable('categories_folders') . '
2015
+            FROM ' . prefixTable('categories_folders').'
2016 2016
             WHERE id_folder = %i',
2017 2017
         $target_id
2018 2018
     );
@@ -2047,9 +2047,9 @@  discard block
 block discarded – undo
2047 2047
     $password = null
2048 2048
 ) {
2049 2049
     // Load AntiXSS
2050
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2051
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2052
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2050
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2051
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2052
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2053 2053
     $antiXss = new voku\helper\AntiXSS();
2054 2054
     // Protect against bad inputs
2055 2055
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
     $target_file = $antiXss->xss_clean($target_file);
2062 2062
     if (empty($password) === true || is_null($password) === true) {
2063 2063
         // get KEY to define password
2064
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2064
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2065 2065
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2066 2066
     }
2067 2067
 
@@ -2106,15 +2106,15 @@  discard block
 block discarded – undo
2106 2106
 ) {
2107 2107
     // load PhpEncryption library
2108 2108
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2109
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2110
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2111
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2112
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2113
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2114
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2115
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2116
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2117
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2109
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2110
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2111
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2112
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2113
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2114
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2115
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2116
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2117
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2118 2118
     try {
2119 2119
         \Defuse\Crypto\File::encryptFileWithPassword(
2120 2120
             $source_file,
@@ -2151,15 +2151,15 @@  discard block
 block discarded – undo
2151 2151
 ) {
2152 2152
     // load PhpEncryption library
2153 2153
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2154
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2155
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2156
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2157
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2158
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2159
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2160
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2161
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2162
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2154
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2155
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2156
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2157
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2158
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2159
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2160
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2161
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2162
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2163 2163
     try {
2164 2164
         \Defuse\Crypto\File::decryptFileWithPassword(
2165 2165
             $source_file,
@@ -2204,9 +2204,9 @@  discard block
 block discarded – undo
2204 2204
 function fileDelete(string $file, array $SETTINGS): void
2205 2205
 {
2206 2206
     // Load AntiXSS
2207
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2208
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2209
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2207
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2208
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2209
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2210 2210
     $antiXss = new voku\helper\AntiXSS();
2211 2211
     $file = $antiXss->xss_clean($file);
2212 2212
     if (is_file($file)) {
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
 
2251 2251
 function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755) {
2252 2252
     // Check if the path exists
2253
-    if (! file_exists($path)) {
2253
+    if (!file_exists($path)) {
2254 2254
         return false;
2255 2255
     }
2256 2256
 
@@ -2285,7 +2285,7 @@  discard block
 block discarded – undo
2285 2285
  */
2286 2286
 function accessToItemIsGranted(int $item_id, $SETTINGS)
2287 2287
 {
2288
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2288
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2289 2289
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2290 2290
     // Prepare superGlobal variables
2291 2291
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
     // Load item data
2294 2294
     $data = DB::queryFirstRow(
2295 2295
         'SELECT id_tree
2296
-        FROM ' . prefixTable('items') . '
2296
+        FROM ' . prefixTable('items').'
2297 2297
         WHERE id = %i',
2298 2298
         $item_id
2299 2299
     );
@@ -2366,8 +2366,8 @@  discard block
 block discarded – undo
2366 2366
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2367 2367
 {
2368 2368
     // include librairies & connect to DB
2369
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2370
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2369
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2370
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2371 2371
     if (defined('DB_PASSWD_CLEAR') === false) {
2372 2372
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2373 2373
     }
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
     DB::$encoding = DB_ENCODING;
2380 2380
     // Insert log in DB
2381 2381
     return DB::query(
2382
-        'SELECT ' . $fields . '
2382
+        'SELECT '.$fields.'
2383 2383
         FROM ' . prefixTable($table)
2384 2384
     );
2385 2385
 }
@@ -2392,11 +2392,11 @@  discard block
 block discarded – undo
2392 2392
 function formatSizeUnits(int $bytes): string
2393 2393
 {
2394 2394
     if ($bytes >= 1073741824) {
2395
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2395
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2396 2396
     } elseif ($bytes >= 1048576) {
2397
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2397
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2398 2398
     } elseif ($bytes >= 1024) {
2399
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2399
+        $bytes = number_format($bytes / 1024, 2).' KB';
2400 2400
     } elseif ($bytes > 1) {
2401 2401
         $bytes .= ' bytes';
2402 2402
     } elseif ($bytes === 1) {
@@ -2587,14 +2587,14 @@  discard block
 block discarded – undo
2587 2587
 
2588 2588
     // Encrypt the file content
2589 2589
     $plaintext = file_get_contents(
2590
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2590
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2591 2591
     );
2592 2592
     $ciphertext = $cipher->encrypt($plaintext);
2593 2593
     // Save new file
2594 2594
     $hash = md5($plaintext);
2595
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2595
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2596 2596
     file_put_contents($fileOut, $ciphertext);
2597
-    unlink($fileInPath . '/' . $fileInName);
2597
+    unlink($fileInPath.'/'.$fileInName);
2598 2598
     return [
2599 2599
         'fileHash' => base64_encode($hash),
2600 2600
         'objectKey' => base64_encode($objectKey),
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
  */
2611 2611
 function decryptFile(string $fileName, string $filePath, string $key): string
2612 2612
 {
2613
-    if (! defined('FILE_BUFFER_SIZE')) {
2613
+    if (!defined('FILE_BUFFER_SIZE')) {
2614 2614
         define('FILE_BUFFER_SIZE', 128 * 1024);
2615 2615
     }
2616 2616
 
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
     $cipher->enableContinuousBuffer();
2630 2630
     $cipher->disablePadding();
2631 2631
     // Get file content
2632
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2632
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2633 2633
     // Decrypt file content and return
2634 2634
     return base64_encode($cipher->decrypt($ciphertext));
2635 2635
 }
@@ -2679,8 +2679,8 @@  discard block
 block discarded – undo
2679 2679
     array $SETTINGS
2680 2680
 ): void {
2681 2681
     // include librairies & connect to DB
2682
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2683
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2682
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2683
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2684 2684
     if (defined('DB_PASSWD_CLEAR') === false) {
2685 2685
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2686 2686
     }
@@ -2697,7 +2697,7 @@  discard block
 block discarded – undo
2697 2697
         $post_object_id
2698 2698
     );
2699 2699
     // Superglobals
2700
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2700
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2701 2701
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2702 2702
     // Prepare superGlobal variables
2703 2703
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2722,8 +2722,8 @@  discard block
 block discarded – undo
2722 2722
         // Create sharekey for each user
2723 2723
         $users = DB::query(
2724 2724
             'SELECT id, public_key
2725
-            FROM ' . prefixTable('users') . '
2726
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2725
+            FROM ' . prefixTable('users').'
2726
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2727 2727
             AND public_key != ""'
2728 2728
         );
2729 2729
         foreach ($users as $user) {
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 function isBase64(string $str): bool
2752 2752
 {
2753 2753
     $str = (string) trim($str);
2754
-    if (! isset($str[0])) {
2754
+    if (!isset($str[0])) {
2755 2755
         return false;
2756 2756
     }
2757 2757
 
@@ -2819,13 +2819,13 @@  discard block
 block discarded – undo
2819 2819
         ],
2820 2820
     ];
2821 2821
     // Load expected libraries
2822
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2823
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2824
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2825
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2826
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2827
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2828
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2822
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2823
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2824
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2825
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2826
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2827
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2828
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2829 2829
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2830 2830
     $ad->register();
2831 2831
     $connection = new Connection($config);
@@ -2834,7 +2834,7 @@  discard block
 block discarded – undo
2834 2834
         $connection->connect();
2835 2835
     } catch (\LdapRecord\Auth\BindException $e) {
2836 2836
         $error = $e->getDetailedError();
2837
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2837
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2838 2838
         return false;
2839 2839
     }
2840 2840
 
@@ -2843,7 +2843,7 @@  discard block
 block discarded – undo
2843 2843
         $connection->auth()->attempt($SETTINGS['ldap_user_attribute'].'='.$login.','.$SETTINGS['ldap_bdn'], $password, $stayAuthenticated = true);
2844 2844
     } catch (\LdapRecord\Auth\BindException $e) {
2845 2845
         $error = $e->getDetailedError();
2846
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2846
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2847 2847
         return false;
2848 2848
     }
2849 2849
 
@@ -2861,8 +2861,8 @@  discard block
 block discarded – undo
2861 2861
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
2862 2862
 {
2863 2863
     // include librairies & connect to DB
2864
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2865
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2864
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2865
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2866 2866
     if (defined('DB_PASSWD_CLEAR') === false) {
2867 2867
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2868 2868
     }
@@ -2920,7 +2920,7 @@  discard block
 block discarded – undo
2920 2920
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2921 2921
             $now->setTimezone(new DateTimeZone($timezone));
2922 2922
             $offsets[] = $offset = $now->getOffset();
2923
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2923
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2924 2924
         }
2925 2925
 
2926 2926
         array_multisort($offsets, $timezones);
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
 {
2941 2941
     $hours = intval($offset / 3600);
2942 2942
     $minutes = abs(intval($offset % 3600 / 60));
2943
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2943
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2944 2944
 }
2945 2945
 
2946 2946
 /**
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 /* do checks */
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
52 52
 $isprofileupdate = filter_input(INPUT_POST, 'isprofileupdate', FILTER_SANITIZE_STRING);
53 53
 if (
54 54
     checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         || $isprofileupdate === false
60 60
     ) {
61 61
         $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
62
-        include $SETTINGS['cpassman_dir'] . '/error.php';
62
+        include $SETTINGS['cpassman_dir'].'/error.php';
63 63
         exit();
64 64
     } else {
65 65
         // Do special check to allow user to change attributes of his profile
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
             || checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
69 69
         ) {
70 70
             $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
71
-            include $SETTINGS['cpassman_dir'] . '/error.php';
71
+            include $SETTINGS['cpassman_dir'].'/error.php';
72 72
             exit();
73 73
         }
74 74
     }
75 75
 }
76 76
 
77
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
77
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
78 78
 header('Content-type: text/html; charset=utf-8');
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
80
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
81
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
80
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
81
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
82 82
 
83 83
 // Connect to mysql server
84
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
84
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
85 85
 if (defined('DB_PASSWD_CLEAR') === false) {
86 86
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
87 87
 }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             // Prepare variables
131 131
             $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
132 132
             $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL);
133
-            $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
133
+            $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
134 134
             $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING);
135 135
             $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING);
136 136
             $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // Check if user already exists
160 160
             $data = DB::query(
161 161
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
162
-                FROM ' . prefixTable('users') . '
162
+                FROM ' . prefixTable('users').'
163 163
                 WHERE login = %s',
164 164
                 $login
165 165
             );
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
             // Get info about user to delete
391 391
             $data_user = DB::queryfirstrow(
392
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
392
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
393 393
                 WHERE id = %i',
394 394
                 $post_id
395 395
             );
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 );
409 409
                 // delete personal folder and subfolders
410 410
                 $data = DB::queryfirstrow(
411
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
411
+                    'SELECT id FROM '.prefixTable('nested_tree').'
412 412
                     WHERE title = %s AND personal_folder = %i',
413 413
                     $post_id,
414 414
                     '1'
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
422 422
                         // delete items & logs
423 423
                         $items = DB::query(
424
-                            'SELECT id FROM ' . prefixTable('items') . '
424
+                            'SELECT id FROM '.prefixTable('items').'
425 425
                             WHERE id_tree=%i AND perso = %i',
426 426
                             $folder->id,
427 427
                             '1'
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
             // Get info about user to delete
480 480
             $data_user = DB::queryfirstrow(
481
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
481
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
482 482
                 WHERE id = %i',
483 483
                 $post_id
484 484
             );
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
             // Get info about user to delete
522 522
             $data_user = DB::queryfirstrow(
523
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
523
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
524 524
                 WHERE id = %i',
525 525
                 $post_id
526 526
             );
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             // Get info about user to delete
564 564
             $data_user = DB::queryfirstrow(
565 565
                 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire
566
-                FROM ' . prefixTable('users') . '
566
+                FROM ' . prefixTable('users').'
567 567
                 WHERE id = %i',
568 568
                 $post_id
569 569
             );
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
             // Get info about user to delete
609 609
             $data_user = DB::queryfirstrow(
610
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
610
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
611 611
                 WHERE id = %i',
612 612
                 $post_id
613 613
             );
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
             // Get info about user to delete
651 651
             $data_user = DB::queryfirstrow(
652 652
                 'SELECT admin, isAdministratedByRole, gestionnaire
653
-                FROM ' . prefixTable('users') . '
653
+                FROM ' . prefixTable('users').'
654 654
                 WHERE id = %i',
655 655
                 $post_id
656 656
             );
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
             // Get info about user to delete
694 694
             $data_user = DB::queryfirstrow(
695 695
                 'SELECT admin, isAdministratedByRole, gestionnaire
696
-                FROM ' . prefixTable('users') . '
696
+                FROM ' . prefixTable('users').'
697 697
                 WHERE id = %i',
698 698
                 $post_id
699 699
             );
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
             // Get info about user to delete
734 734
             $data_user = DB::queryfirstrow(
735 735
                 'SELECT admin, isAdministratedByRole, gestionnaire
736
-                FROM ' . prefixTable('users') . '
736
+                FROM ' . prefixTable('users').'
737 737
                 WHERE id = %i',
738 738
                 $post_id
739 739
             );
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             $return = array();
773 773
             // Check if folder exists
774 774
             $data = DB::query(
775
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
775
+                'SELECT * FROM '.prefixTable('nested_tree').'
776 776
                 WHERE title = %s AND parent_id = %i',
777 777
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING),
778 778
                 '0'
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
             }
786 786
             // Check if role exists
787 787
             $data = DB::query(
788
-                'SELECT * FROM ' . prefixTable('roles_title') . '
788
+                'SELECT * FROM '.prefixTable('roles_title').'
789 789
                 WHERE title = %s',
790 790
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING)
791 791
             );
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         case 'user_log_items':
806 806
             $nb_pages = 1;
807 807
             $logs = $sql_filter = '';
808
-            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . '&nbsp;:&nbsp;</td>';
808
+            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').'&nbsp;:&nbsp;</td>';
809 809
 
810 810
             // Prepare POST variables
811 811
             $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT);
@@ -817,14 +817,14 @@  discard block
 block discarded – undo
817 817
                     && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING))
818 818
                     && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all'
819 819
                 ) {
820
-                    $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'";
820
+                    $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'";
821 821
                 }
822 822
                 // get number of pages
823 823
                 DB::query(
824 824
                     'SELECT *
825
-                    FROM ' . prefixTable('log_items') . ' as l
826
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
827
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
825
+                    FROM ' . prefixTable('log_items').' as l
826
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
827
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
828 828
                     WHERE l.id_user = %i ' . $sql_filter,
829 829
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
830 830
                 );
@@ -842,19 +842,19 @@  discard block
 block discarded – undo
842 842
                 // launch query
843 843
                 $rows = DB::query(
844 844
                     'SELECT l.date as date, u.login as login, i.label as label, l.action as action
845
-                    FROM ' . prefixTable('log_items') . ' as l
846
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
847
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
848
-                    WHERE l.id_user = %i ' . $sql_filter . '
845
+                    FROM ' . prefixTable('log_items').' as l
846
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
847
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
848
+                    WHERE l.id_user = %i ' . $sql_filter.'
849 849
                     ORDER BY date DESC
850
-                    LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page),
850
+                    LIMIT ' . intval($start).','.intval($post_nb_items_by_page),
851 851
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
852 852
                 );
853 853
             } else {
854 854
                 // get number of pages
855 855
                 DB::query(
856 856
                     'SELECT *
857
-                    FROM ' . prefixTable('log_system') . '
857
+                    FROM ' . prefixTable('log_system').'
858 858
                     WHERE type = %s AND field_1=%i',
859 859
                     'user_mngt',
860 860
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
                 // launch query
874 874
                 $rows = DB::query(
875 875
                     'SELECT *
876
-                    FROM ' . prefixTable('log_system') . '
876
+                    FROM ' . prefixTable('log_system').'
877 877
                     WHERE type = %s AND field_1 = %i
878 878
                     ORDER BY date DESC
879 879
                     LIMIT %i, %i',
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
             if (isset($counter) && $counter != 0) {
888 888
                 $nb_pages = ceil($counter / intval($post_nb_items_by_page));
889 889
                 for ($i = 1; $i <= $nb_pages; ++$i) {
890
-                    $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>';
890
+                    $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>';
891 891
                 }
892 892
             }
893 893
             $pages .= '</tr></table>';
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
                     if ($post_scope === 'user_mngt') {
897 897
                         $user = DB::queryfirstrow(
898 898
                             'SELECT login
899
-                            from ' . prefixTable('users') . '
899
+                            from ' . prefixTable('users').'
900 900
                             WHERE id=%i',
901 901
                             $record['qui']
902 902
                         );
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         if ($tmp[0] == 'at_user_initial_pwd_changed') {
907 907
                             $label = langHdl('log_user_initial_pwd_changed');
908 908
                         } elseif ($tmp[0] == 'at_user_email_changed') {
909
-                            $label = langHdl('log_user_email_changed') . $tmp[1];
909
+                            $label = langHdl('log_user_email_changed').$tmp[1];
910 910
                         } elseif ($tmp[0] == 'at_user_added') {
911 911
                             $label = langHdl('log_user_created');
912 912
                         } elseif ($tmp[0] == 'at_user_locked') {
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
                             $label = langHdl('log_user_pwd_changed');
918 918
                         }
919 919
                         // prepare log
920
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>';
920
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>';
921 921
                     } else {
922
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>';
922
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>';
923 923
                     }
924 924
                 }
925 925
             }
926 926
 
927
-            echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]';
927
+            echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]';
928 928
             break;
929 929
 
930 930
             /*
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             } else {
950 950
                 // Get folder id for Admin
951 951
                 $admin_folder = DB::queryFirstRow(
952
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
952
+                    'SELECT id FROM '.prefixTable('nested_tree').'
953 953
                     WHERE title = %i AND personal_folder = %i',
954 954
                     intval($_SESSION['user_id']),
955 955
                     '1'
@@ -960,15 +960,15 @@  discard block
 block discarded – undo
960 960
                     // Get each Items in PF
961 961
                     $rows = DB::query(
962 962
                         'SELECT i.pw, i.label, l.id_user
963
-                        FROM ' . prefixTable('items') . ' as i
964
-                        LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id)
963
+                        FROM ' . prefixTable('items').' as i
964
+                        LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id)
965 965
                         WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i',
966 966
                         'at_creation',
967 967
                         '1',
968 968
                         intval($folder->id)
969 969
                     );
970 970
                     foreach ($rows as $record) {
971
-                        echo $record['label'] . ' - ';
971
+                        echo $record['label'].' - ';
972 972
                         // Change user
973 973
                         DB::update(
974 974
                             prefixTable('log_items'),
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
             // Get info about user to delete
1004 1004
             $data_user = DB::queryfirstrow(
1005 1005
                 'SELECT admin, isAdministratedByRole, gestionnaire
1006
-                FROM ' . prefixTable('users') . '
1006
+                FROM ' . prefixTable('users').'
1007 1007
                 WHERE id = %i',
1008 1008
                 $post_user_id
1009 1009
             );
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
             // Do
1042 1042
             $rows = DB::query(
1043
-                'SELECT id FROM ' . prefixTable('users') . '
1043
+                'SELECT id FROM '.prefixTable('users').'
1044 1044
                 WHERE timestamp != %s AND admin != %i',
1045 1045
                 '',
1046 1046
                 '1'
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
                 // Get info about user to delete
1050 1050
                 $data_user = DB::queryfirstrow(
1051 1051
                     'SELECT admin, isAdministratedByRole, gestionnaire
1052
-                    FROM ' . prefixTable('users') . '
1052
+                    FROM ' . prefixTable('users').'
1053 1053
                     WHERE id = %i',
1054 1054
                     $record['id']
1055 1055
                 );
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
             // Get info about user
1104 1104
             $rowUser = DB::queryfirstrow(
1105 1105
                 'SELECT *
1106
-                FROM ' . prefixTable('users') . '
1106
+                FROM ' . prefixTable('users').'
1107 1107
                 WHERE id = %i',
1108 1108
                 $post_id
1109 1109
             );
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
                 $arrFldAllowed = array();
1122 1122
 
1123 1123
                 //Build tree
1124
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1124
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1125 1125
                 $tree->register();
1126 1126
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1127 1127
 
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                 // array of roles for actual user
1133 1133
                 $my_functions = explode(';', $_SESSION['fonction_id']);
1134 1134
 
1135
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
1135
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
1136 1136
                 foreach ($rows as $record) {
1137 1137
                     if (
1138 1138
                         (int) $_SESSION['is_admin'] === 1
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
                 $rolesList = array();
1169 1169
                 $managedBy = array();
1170 1170
                 $selected = '';
1171
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
1171
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
1172 1172
                 foreach ($rows as $reccord) {
1173 1173
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
1174 1174
                 }
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
                         array_push(
1200 1200
                             $managedBy,
1201 1201
                             array(
1202
-                                'title' => langHdl('managers_of') . ' ' . $fonction['title'],
1202
+                                'title' => langHdl('managers_of').' '.$fonction['title'],
1203 1203
                                 'id' => $fonction['id'],
1204 1204
                                 'selected' => $selected,
1205 1205
                             )
@@ -1281,9 +1281,9 @@  discard block
 block discarded – undo
1281 1281
 
1282 1282
                 // get USER STATUS
1283 1283
                 if ($rowUser['disabled'] == 1) {
1284
-                    $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . langHdl('user_info_unlock_question') . '</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . langHdl('user_info_delete_question') . '</label>';
1284
+                    $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.langHdl('user_info_unlock_question').'</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.langHdl('user_info_delete_question').'</label>';
1285 1285
                 } else {
1286
-                    $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . langHdl('user_info_lock_question');
1286
+                    $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.langHdl('user_info_lock_question');
1287 1287
                 }
1288 1288
 
1289 1289
                 $arrData['error'] = false;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
                 // count number of admins
1376 1376
                 $users = DB::query(
1377 1377
                     'SELECT id
1378
-                    FROM ' . prefixTable('users') . '
1378
+                    FROM ' . prefixTable('users').'
1379 1379
                     WHERE admin = 1 AND email != "" AND pw != ""'
1380 1380
                 );
1381 1381
                 if (DB::count() === 1) {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
             // Get info about user to delete
1463 1463
             $data_user = DB::queryfirstrow(
1464
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1464
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1465 1465
                 WHERE id = %i',
1466 1466
                 $post_id
1467 1467
             );
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
                     );
1483 1483
                     // delete personal folder and subfolders
1484 1484
                     $data = DB::queryfirstrow(
1485
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1485
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1486 1486
                         WHERE title = %s AND personal_folder = %i',
1487 1487
                         $post_id,
1488 1488
                         '1'
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1496 1496
                             // delete items & logs
1497 1497
                             $items = DB::query(
1498
-                                'SELECT id FROM ' . prefixTable('items') . '
1498
+                                'SELECT id FROM '.prefixTable('items').'
1499 1499
                                 WHERE id_tree=%i AND perso = %i',
1500 1500
                                 $folder->id,
1501 1501
                                 '1'
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
                 } else {
1517 1517
                     // Get old data about user
1518 1518
                     $oldData = DB::queryfirstrow(
1519
-                        'SELECT * FROM ' . prefixTable('users') . '
1519
+                        'SELECT * FROM '.prefixTable('users').'
1520 1520
                         WHERE id = %i',
1521 1521
                         $post_id
1522 1522
                     );
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 
1547 1547
                     // update LOG
1548 1548
                     if ($oldData['email'] !== $post_email) {
1549
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1549
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1550 1550
                     }
1551 1551
                 }
1552 1552
                 echo prepareExchangedData(
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
 
1602 1602
             // Get info about user to delete
1603 1603
             $data_user = DB::queryfirstrow(
1604
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1604
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1605 1605
                 WHERE id = %i',
1606 1606
                 $post_id
1607 1607
             );
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
             }
1652 1652
 
1653 1653
             DB::queryfirstrow(
1654
-                'SELECT * FROM ' . prefixTable('users') . '
1654
+                'SELECT * FROM '.prefixTable('users').'
1655 1655
                 WHERE login = %s',
1656 1656
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING)
1657 1657
             );
@@ -1700,14 +1700,14 @@  discard block
 block discarded – undo
1700 1700
             $arrData = array();
1701 1701
 
1702 1702
             //Build tree
1703
-            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1703
+            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1704 1704
             $tree->register();
1705 1705
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1706 1706
 
1707 1707
             // get User info
1708 1708
             $rowUser = DB::queryFirstRow(
1709 1709
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb
1710
-                FROM ' . prefixTable('users') . '
1710
+                FROM ' . prefixTable('users').'
1711 1711
                 WHERE id = %i',
1712 1712
                 $post_id
1713 1713
             );
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
                 // refine folders based upon roles
1726 1726
                 $rows = DB::query(
1727 1727
                     'SELECT folder_id, type
1728
-                    FROM ' . prefixTable('roles_values') . '
1728
+                    FROM ' . prefixTable('roles_values').'
1729 1729
                     WHERE role_id IN %ls
1730 1730
                     ORDER BY folder_id ASC',
1731 1731
                     $arrData['functions']
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
                             // get folder name
1755 1755
                             $row = DB::queryFirstRow(
1756 1756
                                 'SELECT title, nlevel, id
1757
-                                FROM ' . prefixTable('nested_tree') . '
1757
+                                FROM ' . prefixTable('nested_tree').'
1758 1758
                                 WHERE id = %i',
1759 1759
                                 $fld['id']
1760 1760
                             );
@@ -1767,34 +1767,34 @@  discard block
 block discarded – undo
1767 1767
 
1768 1768
                             // manage right icon
1769 1769
                             if ($fld['type'] == 'W') {
1770
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' .
1771
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1772
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1770
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'.
1771
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1772
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1773 1773
                             } elseif ($fld['type'] == 'ND') {
1774
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1775
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1776
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1774
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1775
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1776
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1777 1777
                             } elseif ($fld['type'] == 'NE') {
1778
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1779
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1780
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1778
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1779
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1780
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1781 1781
                             } elseif ($fld['type'] == 'NDNE') {
1782
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1783
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1784
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1782
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1783
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1784
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1785 1785
                             } else {
1786
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>';
1786
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>';
1787 1787
                             }
1788 1788
 
1789
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1790
-                                ' <small>[' . $row['id'] . ']</small></td><td>' . $label . '</td></tr>';
1789
+                            $html .= '<tr><td>'.$ident.$row['title'].
1790
+                                ' <small>['.$row['id'].']</small></td><td>'.$label.'</td></tr>';
1791 1791
                             break;
1792 1792
                         }
1793 1793
                     }
1794 1794
                 }
1795 1795
 
1796
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1797
-                    $html . '</tbody></table>';
1796
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1797
+                    $html.'</tbody></table>';
1798 1798
             } else {
1799 1799
                 $html_full = '';
1800 1800
             }
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
             if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) {
1841 1841
                 $rows = DB::query(
1842 1842
                     'SELECT *
1843
-                    FROM ' . prefixTable('users') . '
1843
+                    FROM ' . prefixTable('users').'
1844 1844
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1845 1845
                     '0',
1846 1846
                     array_filter($_SESSION['user_roles'])
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
             } else {
1849 1849
                 $rows = DB::query(
1850 1850
                     'SELECT *
1851
-                    FROM ' . prefixTable('users') . '
1851
+                    FROM ' . prefixTable('users').'
1852 1852
                     WHERE admin = %i',
1853 1853
                     '0'
1854 1854
                 );
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
                 $groupIds = [];
1861 1861
                 foreach (explode(';', $record['fonction_id']) as $group) {
1862 1862
                     $tmp = DB::queryfirstrow(
1863
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1863
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1864 1864
                         WHERE id = %i',
1865 1865
                         $group
1866 1866
                     );
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
 
1873 1873
                 // Get managed_by
1874 1874
                 $managedBy = DB::queryfirstrow(
1875
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1875
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1876 1876
                     WHERE id = %i',
1877 1877
                     $record['isAdministratedByRole']
1878 1878
                 );
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
                 $foldersAllowedIds = [];
1883 1883
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1884 1884
                     $tmp = DB::queryfirstrow(
1885
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1885
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1886 1886
                         WHERE id = %i',
1887 1887
                         $role
1888 1888
                     );
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
                 $foldersForbiddenIds = [];
1896 1896
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1897 1897
                     $tmp = DB::queryfirstrow(
1898
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1898
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1899 1899
                         WHERE id = %i',
1900 1900
                         $role
1901 1901
                     );
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
                         'login' => $record['login'],
1914 1914
                         'groups' => implode(', ', $groups),
1915 1915
                         'groupIds' => $groupIds,
1916
-                        'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'],
1916
+                        'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'],
1917 1917
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1918 1918
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1919 1919
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
 
1992 1992
             // Get info about user
1993 1993
             $data_user = DB::queryfirstrow(
1994
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1994
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1995 1995
                 WHERE id = %i',
1996 1996
                 $post_source_id
1997 1997
             );
@@ -2151,14 +2151,14 @@  discard block
 block discarded – undo
2151 2151
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
2152 2152
                 $data_user = DB::queryfirstrow(
2153 2153
                     'SELECT fonction_id
2154
-                    FROM ' . prefixTable('users') . '
2154
+                    FROM ' . prefixTable('users').'
2155 2155
                     WHERE id = %i',
2156 2156
                     $post_user_id
2157 2157
                 );
2158 2158
 
2159 2159
                 if ($data_user) {
2160 2160
                     // Ensure array is unique
2161
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
2161
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
2162 2162
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
2163 2163
                 } else {
2164 2164
                     // User not found
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
             if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') {
2214 2214
                 $record = DB::queryFirstRow(
2215 2215
                     'SELECT user_ip_lastdate
2216
-                    FROM ' . prefixTable('users') . '
2216
+                    FROM ' . prefixTable('users').'
2217 2217
                     WHERE id = %i',
2218 2218
                     $_SESSION['user_id']
2219 2219
                 );
@@ -2305,38 +2305,38 @@  discard block
 block discarded – undo
2305 2305
             ];
2306 2306
 
2307 2307
             // Load expected libraries
2308
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2309
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2310
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2311
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
2312
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
2313
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
2314
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
2315
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
2316
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2317
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
2318
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
2319
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
2320
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
2321
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
2322
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
2323
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
2324
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
2325
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
2326
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
2327
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
2328
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
2329
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
2330
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
2331
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
2332
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
2333
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
2334
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
2335
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2336
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2337
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2338
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2339
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2308
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2309
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2310
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2311
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
2312
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
2313
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
2314
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
2315
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
2316
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2317
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
2318
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
2319
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
2320
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
2321
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
2322
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
2323
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
2324
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
2325
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
2326
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
2327
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
2328
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
2329
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
2330
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
2331
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
2332
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
2333
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
2334
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
2335
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2336
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2337
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2338
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2339
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2340 2340
 
2341 2341
             $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2342 2342
             $ad->register();
@@ -2352,7 +2352,7 @@  discard block
 block discarded – undo
2352 2352
                 echo prepareExchangedData(
2353 2353
                     array(
2354 2354
                         'error' => true,
2355
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
2355
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
2356 2356
                     ),
2357 2357
                     'encode'
2358 2358
                 );
@@ -2372,10 +2372,10 @@  discard block
 block discarded – undo
2372 2372
                 ['objectclass', '=', 'inetorgperson'],
2373 2373
             ])->get();
2374 2374
             
2375
-            foreach($users as $i => $adUser) {
2375
+            foreach ($users as $i => $adUser) {
2376 2376
 
2377 2377
                 // Build the list of all groups in AD
2378
-                foreach($adUser['memberof'] as $j => $adUserGroup) {
2378
+                foreach ($adUser['memberof'] as $j => $adUserGroup) {
2379 2379
                     if (empty($adUserGroup) === false && $j !== "count") {
2380 2380
                         $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2381 2381
                         if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
                     // Get his ID
2391 2391
                     DB::queryfirstrow(
2392 2392
                         'SELECT id, fonction_id, auth_type
2393
-                        FROM ' . prefixTable('users') . '
2393
+                        FROM ' . prefixTable('users').'
2394 2394
                         WHERE login = %s',
2395 2395
                         $userLogin
2396 2396
                     );
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
             }
2426 2426
 
2427 2427
             // Get all groups in Teampass
2428
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2428
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2429 2429
             foreach ($rows as $record) {
2430 2430
                 array_push(
2431 2431
                     $teampassRoles,
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
             // Check if user already exists
2492 2492
             $data = DB::query(
2493 2493
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2494
-                FROM ' . prefixTable('users') . '
2494
+                FROM ' . prefixTable('users').'
2495 2495
                 WHERE login = %s',
2496 2496
                 $post_login
2497 2497
             );
@@ -2595,7 +2595,7 @@  discard block
 block discarded – undo
2595 2595
                 );
2596 2596
 
2597 2597
                 // Rebuild tree
2598
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
2598
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
2599 2599
                 $tree->register();
2600 2600
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
2601 2601
                 $tree->rebuild();
@@ -2663,7 +2663,7 @@  discard block
 block discarded – undo
2663 2663
             // Check if user already exists
2664 2664
             DB::query(
2665 2665
                 'SELECT id
2666
-                FROM ' . prefixTable('users') . '
2666
+                FROM ' . prefixTable('users').'
2667 2667
                 WHERE id = %i',
2668 2668
                 $post_id
2669 2669
             );
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
             // Check if user already exists
2740 2740
             $userInfo = DB::queryfirstrow(
2741 2741
                 'SELECT id, private_key, public_key
2742
-                FROM ' . prefixTable('users') . '
2742
+                FROM ' . prefixTable('users').'
2743 2743
                 WHERE id = %i',
2744 2744
                 $post_userid
2745 2745
             );
@@ -2774,7 +2774,7 @@  discard block
 block discarded – undo
2774 2774
             if (count($_SESSION['personal_folders']) > 0) {
2775 2775
                 DB::query(
2776 2776
                     'SELECT id
2777
-                    FROM ' . prefixTable('items') . '
2777
+                    FROM ' . prefixTable('items').'
2778 2778
                     WHERE id_tree IN %ls',
2779 2779
                     $_SESSION['personal_folders']
2780 2780
                 );
@@ -2852,7 +2852,7 @@  discard block
 block discarded – undo
2852 2852
             // Check if user already exists
2853 2853
             DB::query(
2854 2854
                 'SELECT id
2855
-                FROM ' . prefixTable('users') . '
2855
+                FROM ' . prefixTable('users').'
2856 2856
                 WHERE id = %i',
2857 2857
                 $post_id
2858 2858
             );
@@ -2946,7 +2946,7 @@  discard block
 block discarded – undo
2946 2946
 
2947 2947
     // Get info about user
2948 2948
     $data_user = DB::queryfirstrow(
2949
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2949
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2950 2950
         WHERE id = %i',
2951 2951
         $value[1]
2952 2952
     );
@@ -2979,7 +2979,7 @@  discard block
 block discarded – undo
2979 2979
             logEvents(
2980 2980
                 $SETTINGS,
2981 2981
                 'user_mngt',
2982
-                'at_user_new_' . $value[0] . ':' . $value[1],
2982
+                'at_user_new_'.$value[0].':'.$value[1],
2983 2983
                 (string) $_SESSION['user_id'],
2984 2984
                 $_SESSION['login'],
2985 2985
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING)
@@ -3011,7 +3011,7 @@  discard block
 block discarded – undo
3011 3011
 
3012 3012
     // Get info about user
3013 3013
     $data_user = DB::queryfirstrow(
3014
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3014
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3015 3015
         WHERE id = %i',
3016 3016
         $value[1]
3017 3017
     );
Please login to merge, or discard this patch.